[PATCH] Fix up Rumble and LED stuff and add extra drift stuff to rumble
Thanks Alug!
This commit is contained in:
parent
f7bf52bcfa
commit
c030d46462
11 changed files with 170 additions and 134 deletions
|
|
@ -1998,7 +1998,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
|||
return false;
|
||||
}
|
||||
case CL_LOADFILES:
|
||||
if (CL_LoadServerFiles())
|
||||
if (CL_LoadServerFiles())
|
||||
cl_mode = CL_SETUPFILES;
|
||||
|
||||
break;
|
||||
|
|
@ -2594,9 +2594,9 @@ static void Command_connect(void)
|
|||
M_ClearMenus(true);
|
||||
D_QuitNetGame();
|
||||
CL_Reset();
|
||||
|
||||
|
||||
D_StartTitle();
|
||||
|
||||
|
||||
}
|
||||
else if (I_NetOpenSocket)
|
||||
{
|
||||
|
|
@ -2741,7 +2741,7 @@ void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
|||
|
||||
K_CheckBumpers();
|
||||
P_CheckRacers();
|
||||
|
||||
|
||||
// Reset startedInFreePlay
|
||||
{
|
||||
INT32 i;
|
||||
|
|
@ -2807,6 +2807,8 @@ void CL_Reset(void)
|
|||
http_source[0] = '\0';
|
||||
#endif
|
||||
|
||||
G_ResetAllDeviceRumbles();
|
||||
|
||||
// D_StartTitle should get done now, but the calling function will handle it
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -197,12 +197,12 @@ UINT8 ctrldown = 0; // 0x1 left, 0x2 right
|
|||
UINT8 altdown = 0; // 0x1 left, 0x2 right
|
||||
boolean capslock = 0; // gee i wonder what this does.
|
||||
|
||||
static UINT8 curcolor[MAXSPLITSCREENPLAYERS] = {};
|
||||
static skincolornum_t curcolor[MAXSPLITSCREENPLAYERS] = {};
|
||||
|
||||
static void D_DeviceLEDTick(void)
|
||||
{
|
||||
UINT8 i;
|
||||
static UINT8 newcolor = UINT8_MAX;
|
||||
static skincolornum_t newcolor = SKINCOLOR_NONE;
|
||||
|
||||
if (numcontrollers == 0)
|
||||
{
|
||||
|
|
@ -1257,6 +1257,8 @@ void D_StartTitle(void)
|
|||
if (rendermode != render_none)
|
||||
V_SetPaletteLump("PLAYPAL");
|
||||
|
||||
G_ResetAllDeviceRumbles();
|
||||
|
||||
// The title screen is obviously not a tutorial! (Unless I'm mistaken)
|
||||
tutorialmode = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -2003,7 +2003,7 @@ void WeaponPref_Send(UINT8 ssplayer)
|
|||
|
||||
if (cv_shrinkme[ssplayer].value)
|
||||
prefs |= WP_SHRINKME;
|
||||
|
||||
|
||||
if (cv_flipcam[ssplayer].value)
|
||||
prefs |= WP_FLIPCAM;
|
||||
|
||||
|
|
@ -2028,7 +2028,7 @@ void WeaponPref_Save(UINT8 **cp, INT32 playernum)
|
|||
|
||||
if (player->pflags & PF_SHRINKME)
|
||||
prefs |= WP_SHRINKME;
|
||||
|
||||
|
||||
if (player->pflags & PF_FLIPCAM)
|
||||
prefs |= WP_FLIPCAM;
|
||||
|
||||
|
|
@ -2052,7 +2052,7 @@ void WeaponPref_Parse(UINT8 **cp, INT32 playernum)
|
|||
|
||||
if (prefs & WP_SHRINKME)
|
||||
player->pflags |= PF_SHRINKME;
|
||||
|
||||
|
||||
if (prefs & WP_FLIPCAM)
|
||||
player->pflags |= PF_FLIPCAM;
|
||||
|
||||
|
|
@ -3239,7 +3239,7 @@ static void Command_Map_f(void)
|
|||
// G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
if (!mapheaderinfo[newmapnum-1] || mapheaderinfo[newmapnum-1] == NULL)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Invalid mapheaderinfo for Course %s (%s)\n"), realmapname, G_BuildMapName(newmapnum));
|
||||
|
|
@ -3247,7 +3247,7 @@ static void Command_Map_f(void)
|
|||
Z_Free(mapname);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!(
|
||||
mapheaderinfo[newmapnum-1] &&
|
||||
mapheaderinfo[newmapnum-1]->typeoflevel & G_TOLFlag(newgametype)
|
||||
|
|
@ -3604,6 +3604,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
|
|||
}
|
||||
|
||||
I_UpdateMouseGrab();
|
||||
G_ResetAllDeviceRumbles();
|
||||
}
|
||||
|
||||
// Command for stuck characters in netgames, griefing, etc.
|
||||
|
|
@ -4545,7 +4546,7 @@ void Schedule_Insert(scheduleTask_t *addTask)
|
|||
{
|
||||
schedule_size *= 2;
|
||||
}
|
||||
|
||||
|
||||
schedule = Z_ReallocAlign(
|
||||
(void*) schedule,
|
||||
sizeof(scheduleTask_t*) * schedule_size,
|
||||
|
|
|
|||
|
|
@ -1737,6 +1737,8 @@ void G_DoLoadLevel(boolean resetplayer)
|
|||
|
||||
server_lagless = cv_lagless.value;
|
||||
|
||||
G_ResetAllDeviceRumbles();
|
||||
|
||||
if (doAutomate == true)
|
||||
{
|
||||
Automate_Run(AEV_ROUNDSTART);
|
||||
|
|
@ -2866,7 +2868,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
|||
karmapoints = players[player].karmapoints;
|
||||
wanted = players[player].wanted;
|
||||
rings = players[player].rings;
|
||||
|
||||
|
||||
minrings = players[player].ringmin;
|
||||
maxrings = players[player].ringmax;
|
||||
|
||||
|
|
@ -3583,9 +3585,10 @@ void G_BeginLevelExit(void)
|
|||
|
||||
void G_FinishExitLevel(void)
|
||||
{
|
||||
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
G_ResetAllDeviceRumbles();
|
||||
|
||||
if (g_exit.retry)
|
||||
{
|
||||
// Restart cup here whenever we do Online GP
|
||||
|
|
|
|||
|
|
@ -502,44 +502,34 @@ static const char *gamecontrolname[num_gamecontrols] =
|
|||
|
||||
skincolornum_t G_GetSkinColorForGamepad(INT32 playernum)
|
||||
{
|
||||
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
||||
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
player_t *player = &players[displayplayers[playernum]];
|
||||
const player_t *player = &players[displayplayers[playernum]];
|
||||
|
||||
if (player)
|
||||
{
|
||||
// make rgb rainbow vomit when invul or flash blue when grow
|
||||
if ((cv_gamepadled[playernum].value == 2) && player->mo && player->mo->color)
|
||||
return player->mo->color;
|
||||
return (skincolornum_t)player->mo->color;
|
||||
|
||||
// take actual player skincolour when ingame
|
||||
if (player->skincolor)
|
||||
return player->skincolor;
|
||||
return (skincolornum_t)player->skincolor;
|
||||
}
|
||||
}
|
||||
|
||||
// otherwise just fallback to whatever the cvar is
|
||||
switch (playernum)
|
||||
{
|
||||
case 0:
|
||||
return cv_playercolor[0].value;
|
||||
case 1:
|
||||
return cv_playercolor[1].value;
|
||||
case 2:
|
||||
return cv_playercolor[2].value;
|
||||
case 3:
|
||||
return cv_playercolor[3].value;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (skincolornum_t)cv_playercolor[playernum].value;
|
||||
}
|
||||
|
||||
// Sets the Indicator LED on supported gamepads to a desired skincolor
|
||||
// pass SKINCOLOR_NONE/0 to set the players skin color
|
||||
void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT16 color)
|
||||
{
|
||||
skincolornum_t skincolor;
|
||||
RGBA_t byte_color;
|
||||
byteColor_t byte_color;
|
||||
|
||||
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
||||
|
||||
|
|
@ -548,34 +538,40 @@ void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT16 color)
|
|||
return;
|
||||
}
|
||||
|
||||
// so we can override this
|
||||
skincolor = color ? color : G_GetSkinColorForGamepad(playernum);
|
||||
byte_color = V_GetColor(skincolors[skincolor].ramp[8]);
|
||||
byte_color = V_GetColor(skincolors[skincolor].ramp[8]).s;
|
||||
|
||||
I_SetGamepadIndicatorColor(playernum, byte_color.s.red, byte_color.s.green, byte_color.s.blue);
|
||||
I_SetGamepadIndicatorColor(playernum, byte_color.red, byte_color.green, byte_color.blue);
|
||||
}
|
||||
|
||||
static void G_ResetPlayerGamepadIndicatorColor(INT32 playernum)
|
||||
{
|
||||
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
||||
|
||||
if (cv_gamepadled[playernum].value == 0)
|
||||
{
|
||||
I_SetGamepadIndicatorColor(playernum, 0, 0, 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
G_SetPlayerGamepadIndicatorColor(playernum, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void G_ResetPlayerDeviceRumble(INT32 player)
|
||||
static void G_ResetPlayerDeviceRumble(INT32 playernum)
|
||||
{
|
||||
INT32 device_id;
|
||||
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
||||
|
||||
device_id = G_GetDevicePlayer(player);
|
||||
I_GamepadRumble(playernum, 0, 0, 0);
|
||||
}
|
||||
|
||||
if (device_id < 1)
|
||||
void G_ResetAllDeviceRumbles(void)
|
||||
{
|
||||
for (int i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
return;
|
||||
I_GamepadRumble(i, 0, 0, 0);
|
||||
}
|
||||
|
||||
I_GamepadRumble(device_id, 0, 0, 0);
|
||||
}
|
||||
|
||||
void G_PlayerDeviceRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength, UINT32 duration)
|
||||
|
|
|
|||
75
src/k_kart.c
75
src/k_kart.c
|
|
@ -8893,42 +8893,44 @@ static void K_KartDrift(player_t *player, boolean onground)
|
|||
|
||||
switch (driftstage)
|
||||
{
|
||||
case 1:
|
||||
boost = 20;
|
||||
player->driftlevel = 1;
|
||||
break;
|
||||
case 2:
|
||||
boost = 50;
|
||||
player->driftlevel = 2;
|
||||
if (cv_kartdriftsounds.value)
|
||||
S_StartSound(player->mo, sfx_kc5b);
|
||||
break;
|
||||
case 3:
|
||||
boost = 80;
|
||||
player->driftlevel = 3;
|
||||
if (cv_kartdriftsounds.value)
|
||||
{
|
||||
S_StartSound(player->mo, sfx_kc5b);
|
||||
S_StartSound(player->mo, sfx_kc3c);
|
||||
S_StartSoundAtVolume(player->mo, sfx_s3k81, 128);
|
||||
S_StartSound(player->mo, sfx_s3k47);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
boost = 125;
|
||||
player->driftlevel = 4;
|
||||
if (cv_kartdriftsounds.value)
|
||||
{
|
||||
S_StartSound(player->mo, sfx_kc5b);
|
||||
S_StartSound(player->mo, sfx_kc4d);
|
||||
S_StartSoundAtVolume(player->mo, sfx_s3k81, 128);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
boost = 20;
|
||||
player->driftlevel = 1;
|
||||
break;
|
||||
case 2:
|
||||
boost = 50;
|
||||
player->driftlevel = 2;
|
||||
if (cv_kartdriftsounds.value)
|
||||
S_StartSound(player->mo, sfx_kc5b);
|
||||
break;
|
||||
case 3:
|
||||
boost = 80;
|
||||
player->driftlevel = 3;
|
||||
if (cv_kartdriftsounds.value)
|
||||
{
|
||||
S_StartSound(player->mo, sfx_kc5b);
|
||||
S_StartSound(player->mo, sfx_kc3c);
|
||||
S_StartSoundAtVolume(player->mo, sfx_s3k81, 128);
|
||||
S_StartSound(player->mo, sfx_s3k47);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
boost = 125;
|
||||
player->driftlevel = 4;
|
||||
if (cv_kartdriftsounds.value)
|
||||
{
|
||||
S_StartSound(player->mo, sfx_kc5b);
|
||||
S_StartSound(player->mo, sfx_kc4d);
|
||||
S_StartSoundAtVolume(player->mo, sfx_s3k81, 128);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (player->driftboost < boost)
|
||||
player->driftboost = boost;
|
||||
|
||||
player->driftlevel = driftstage * 10; // * 10 to detect that this came from drift release
|
||||
|
||||
K_SpawnDriftEFX(player, driftstage);
|
||||
}
|
||||
|
||||
|
|
@ -8974,7 +8976,6 @@ static void K_KartDrift(player_t *player, boolean onground)
|
|||
player->pflags &= ~PF_DRIFTEND;
|
||||
}
|
||||
|
||||
|
||||
// Incease/decrease the drift value to continue drifting in that direction
|
||||
if (!P_PlayerInPain(player) && (player->pflags & PF_DRIFTINPUT) && onground && player->drift != 0)
|
||||
{
|
||||
|
|
@ -9015,6 +9016,7 @@ static void K_KartDrift(player_t *player, boolean onground)
|
|||
if (P_IsDisplayPlayer(player)) // UGHGHGH...
|
||||
S_StartSoundAtVolume(player->mo, sfx_s3ka2, 192); // Ugh...
|
||||
|
||||
player->driftlevel = driftstage; // for rumble
|
||||
player->driftsparkGrowTimer = DRIFTSPARKGROWTICS;
|
||||
}
|
||||
|
||||
|
|
@ -9039,6 +9041,7 @@ static void K_KartDrift(player_t *player, boolean onground)
|
|||
{
|
||||
minspeed = 0;
|
||||
}
|
||||
|
||||
if (P_PlayerInPain(player) || player->speed < minspeed)
|
||||
{
|
||||
player->drift = player->driftcharge = player->aizdriftstrat = 0;
|
||||
|
|
@ -9640,7 +9643,7 @@ static vector3_t *K_FindPlayerCluster(fixed_t eps, INT32 (*func)(player_t *, fix
|
|||
|
||||
// Double-remove the clusterplayer flag. Bad hack, I know...
|
||||
clusterplayer[i] = false;
|
||||
|
||||
|
||||
// 10/22/2025: Pairs don't count anymore
|
||||
if (N < 2)
|
||||
{
|
||||
|
|
@ -10146,7 +10149,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
}
|
||||
// Other items
|
||||
// TODO: how should player->itemusecooldown interact with LUA_HookPlayerItem?
|
||||
else if (player->itemusecooldown == 0)
|
||||
else if (player->itemusecooldown == 0)
|
||||
{
|
||||
// Eggman Monitor exploding
|
||||
if (player->eggmanexplode)
|
||||
|
|
@ -10198,7 +10201,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
SINT8 incr = (gametyperules & GTR_CLOSERPLAYERS) ? 3 : 2;
|
||||
SINT8 metincr = (gametyperules & GTR_CLOSERPLAYERS) ? 4 : 3;
|
||||
SINT8 comincr = (gametyperules & GTR_CLOSERPLAYERS) ? 10 : 4;
|
||||
|
||||
|
||||
// experiment: uses fuel faster, but raises temperature faster
|
||||
if (cv_kartflame_fastfuel.value)
|
||||
{
|
||||
|
|
@ -10230,7 +10233,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->flamedash += incr;
|
||||
player->flamestore = min(player->flamestore + metincr, FLAMESTOREMAX);
|
||||
player->flametimer -= comincr;
|
||||
|
||||
|
||||
P_Thrust(
|
||||
player->mo, player->mo->angle,
|
||||
FixedMul(player->mo->scale, K_GetKartGameSpeedScalar(gamespeed))/4
|
||||
|
|
|
|||
|
|
@ -1647,7 +1647,7 @@ static int lib_pSlideMove(lua_State *L)
|
|||
INLEVEL
|
||||
if (!mo)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
||||
|
||||
if (!P_TryMove(mo, mo->x, mo->y, true, &result))
|
||||
P_SlideMove(mo, &result);
|
||||
return 0;
|
||||
|
|
@ -4505,7 +4505,7 @@ static int lib_kPlayerUsesBotMovement(lua_State *L)
|
|||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
|
||||
|
||||
lua_pushboolean(L, K_PlayerUsesBotMovement(player));
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -4516,7 +4516,7 @@ static int lib_kBotCanTakeCut(lua_State *L)
|
|||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
|
||||
|
||||
lua_pushboolean(L, K_BotCanTakeCut(player));
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -4527,13 +4527,13 @@ static int lib_kGetBotController(lua_State *L)
|
|||
INLEVEL
|
||||
if (!mobj)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
||||
|
||||
botcontroller_t *botController = K_GetBotController(mobj);
|
||||
if (botController != NULL)
|
||||
LUA_PushUserdata(L, botController, META_BOTCONTROLLER);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -4550,7 +4550,7 @@ static int lib_kBotRubberband(lua_State *L)
|
|||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
|
||||
|
||||
lua_pushfixed(L, K_BotRubberband(player));
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -4561,7 +4561,7 @@ static int lib_kUpdateRubberband(lua_State *L)
|
|||
INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
|
||||
|
||||
lua_pushfixed(L, K_UpdateRubberband(player));
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -4600,16 +4600,16 @@ static int lib_kAddBot(lua_State *L)
|
|||
if (skinid == -1)
|
||||
return luaL_error(L, "could not find skin %s by name", name);
|
||||
}
|
||||
|
||||
|
||||
INLEVEL
|
||||
|
||||
|
||||
boolean success = K_AddBot(skinid, difficulty, style, &newplayernum);
|
||||
lua_pushboolean(L, success);
|
||||
if (success)
|
||||
LUA_PushUserdata(L, &players[newplayernum - 1], META_PLAYER);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
|
@ -4621,9 +4621,9 @@ static int lib_kSetNameForBot(lua_State *L)
|
|||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (!player->bot)
|
||||
return luaL_error(L, "You may only change bot names.");
|
||||
|
||||
|
||||
K_SetNameForBot(player-players, realname);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -4635,9 +4635,9 @@ static int lib_kRemoveBot(lua_State *L)
|
|||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (!player->bot)
|
||||
return luaL_error(L, "You may only remove bots.");
|
||||
|
||||
|
||||
CL_RemovePlayer(player-players, KR_LEAVE);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -5111,6 +5111,12 @@ static int lib_gSetPlayerGamepadIndicatorColor(lua_State *L)
|
|||
player_t *plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player
|
||||
UINT16 color = (UINT16)luaL_checkinteger(L, 2); // skincolor
|
||||
|
||||
if (!plr)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
|
||||
if (color >= numskincolors)
|
||||
return luaL_error(L, "color %d out of range (0 - %d).", color, numskincolors-1);
|
||||
|
||||
for (int i = 0; i < MAXSPLITSCREENPLAYERS; ++i)
|
||||
{
|
||||
if (plr - players == displayplayers[i])
|
||||
|
|
@ -5137,6 +5143,9 @@ static int lib_gPlayerDeviceRumble(lua_State *L)
|
|||
UINT16 high_strength = (UINT16)luaL_checkinteger(L, 3); // high frequency rumble motor strenght
|
||||
UINT32 duration = (UINT32)luaL_optinteger(L, 4, 84); // duration of rumble in ms
|
||||
|
||||
if (!plr)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
|
||||
for (int i = 0; i < MAXSPLITSCREENPLAYERS; ++i)
|
||||
{
|
||||
if (plr - players == displayplayers[i])
|
||||
|
|
@ -5512,7 +5521,7 @@ static luaL_Reg lib[] = {
|
|||
{"K_InitBossHealthBar", lib_kInitBossHealthBar},
|
||||
{"K_UpdateBossHealthBar", lib_kUpdateBossHealthBar},
|
||||
{"K_DeclareWeakspot", lib_kDeclareWeakspot},
|
||||
|
||||
|
||||
// I_System
|
||||
{"I_GetPreciseTime",lib_iGetPreciseTime},
|
||||
|
||||
|
|
@ -5539,7 +5548,7 @@ static luaL_Reg lib[] = {
|
|||
{"K_HandleFootstepParticles", lib_kHandleFootstepParticles},
|
||||
{"K_UpdateTerrainOverlay", lib_kUpdateTerrainOverlay},
|
||||
{"K_TerrainHasAffect", lib_kTerrainHasAffect},
|
||||
|
||||
|
||||
// k_items
|
||||
{"K_SetPlayerItemCooldown", lib_kSetPlayerItemCooldown},
|
||||
|
||||
|
|
|
|||
50
src/m_menu.c
50
src/m_menu.c
|
|
@ -482,10 +482,10 @@ consvar_t cv_dummyfollower = CVAR_INIT ("dummyfollower", "-1", CV_HIDEN, dummyfo
|
|||
SINT8 dummycolorplayer = 0;
|
||||
static void SetDummyColorPlayer(void)
|
||||
{
|
||||
G_SetPlayerGamepadIndicatorColor(dummycolorplayer, cv_dummycolor.value);
|
||||
G_SetPlayerGamepadIndicatorColor(dummycolorplayer, (UINT16)cv_dummycolor.value);
|
||||
}
|
||||
|
||||
consvar_t cv_dummycolor = CVAR_INIT ("dummycolor", "0", CV_HIDEN, dummycolor_cons_t, SetDummyColorPlayer);
|
||||
consvar_t cv_dummycolor = CVAR_INIT ("dummycolor", "0", CV_HIDEN|CV_CALL|CV_NOINIT, dummycolor_cons_t, SetDummyColorPlayer);
|
||||
|
||||
static CV_PossibleValue_t dummyserverpage_cons_t[] = {{0, "MIN"}, {0, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_dummyserverpage = CVAR_INIT ("dummyserverpage", "0", CV_HIDEN, dummyserverpage_cons_t, NULL);
|
||||
|
|
@ -1358,7 +1358,7 @@ boolean M_Responder(event_t *ev)
|
|||
|| gamestate == GS_BLANCREDITS || gamestate == GS_SECRETCREDITS
|
||||
)
|
||||
return false;
|
||||
|
||||
|
||||
if (CON_Ready() && gamestate != GS_WAITINGPLAYERS)
|
||||
return false;
|
||||
|
||||
|
|
@ -6764,7 +6764,7 @@ void MD_DrawMPMainMenu(void)
|
|||
if (M_IsItemOn(MN_MP_MAIN, "PLAYERSETUP") && i == cv_dummymultiplayer.value+1)
|
||||
{
|
||||
static fixed_t cursorframe = 0;
|
||||
|
||||
|
||||
cursorframe += renderdeltatics / 4;
|
||||
for (; cursorframe > 7 * FRACUNIT; cursorframe -= 7 * FRACUNIT) {}
|
||||
|
||||
|
|
@ -6836,14 +6836,14 @@ static UINT8 setupplayer;
|
|||
#define charw 72
|
||||
|
||||
void MD_DrawSetupMultiPlayerMenu(void)
|
||||
{
|
||||
{
|
||||
// use generic drawer for cursor, items and title
|
||||
// bg, text, arrows handled by generic drawer
|
||||
MD_DrawGenericMenu();
|
||||
|
||||
MD_DrawCssColourBar();
|
||||
MD_DrawCssCharacter();
|
||||
|
||||
|
||||
if (cv_skinselectstyle.value)
|
||||
{
|
||||
MD_DrawCssStatBars();
|
||||
|
|
@ -6903,7 +6903,7 @@ void MD_DrawCssStatBars(void)
|
|||
|
||||
const INT32 BITSTARTXMAIN = 17;
|
||||
const INT32 BITSTARTXSUB = 50;
|
||||
|
||||
|
||||
const INT32 BITSPEEDSTARTY = 2;
|
||||
const INT32 BITWEIGHTSTARTY = 18;
|
||||
|
||||
|
|
@ -6958,7 +6958,7 @@ void MD_DrawCssStatBars(void)
|
|||
{
|
||||
V_DrawFixedPatch((mx + BITSTARTXSUB - (BITSPACING * i))<<FRACBITS, (my + BITWEIGHTSTARTY + BITSHIFTSUB)<<FRACBITS, FRACUNIT, 0, statbitsub, subcolour);
|
||||
}
|
||||
|
||||
|
||||
// Draw our icons
|
||||
V_DrawFixedPatch((mx + ICNXFIRST)<<FRACBITS, (my + ICNYFIRST)<<FRACBITS, FRACUNIT, 0, speedicn, NULL);
|
||||
V_DrawFixedPatch((mx + ICNXFIRST)<<FRACBITS, (my + ICNYSECOND)<<FRACBITS, FRACUNIT, 0, weighticn, NULL);
|
||||
|
|
@ -7225,10 +7225,10 @@ void MD_DrawGridCssSelector(void)
|
|||
INT32 skinn;
|
||||
patch_t *face;
|
||||
UINT8 *colmap;
|
||||
|
||||
|
||||
patch_t *cursor;
|
||||
static fixed_t cursorframe = 0;
|
||||
|
||||
|
||||
INT32 gridx;
|
||||
INT32 gridy;
|
||||
INT32 cursorx;
|
||||
|
|
@ -7236,7 +7236,7 @@ void MD_DrawGridCssSelector(void)
|
|||
INT32 calcs;
|
||||
|
||||
INT32 skintodisplay = cv_chooseskin.value;
|
||||
|
||||
|
||||
// gridcss_skinydrag = 0;
|
||||
// draws background and scroll bar
|
||||
{
|
||||
|
|
@ -7250,10 +7250,10 @@ void MD_DrawGridCssSelector(void)
|
|||
INT32 columncount;
|
||||
INT32 barlen;
|
||||
INT32 barpos;
|
||||
|
||||
|
||||
//draw BG
|
||||
V_DrawFill(x, y, dx, dy, 159);
|
||||
|
||||
|
||||
columncount = ((numskins - 1) / SKINGRIDWIDTH) + 1;
|
||||
|
||||
if (columncount > SKINGRIDHEIGHT)
|
||||
|
|
@ -7283,9 +7283,9 @@ void MD_DrawGridCssSelector(void)
|
|||
}
|
||||
}
|
||||
// end background and scroll bar
|
||||
|
||||
|
||||
for (INT32 gridslot = 0; gridslot < SKINGRIDWIDTH*SKINGRIDHEIGHT; gridslot++)
|
||||
{
|
||||
{
|
||||
gridx = ((gridslot % SKINGRIDWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDWIDTH) - 8) + 100 + SKINXSHIFT; //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4;
|
||||
gridy = ((gridslot / SKINGRIDWIDTH) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDWIDTH/2))) + SKINYSHIFT; //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4;
|
||||
calcs = gridslot + (gridcss_skinydrag * SKINGRIDWIDTH);
|
||||
|
|
@ -7301,7 +7301,7 @@ void MD_DrawGridCssSelector(void)
|
|||
V_DrawFill(gridx, gridy, 16, 16, 158);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (skinn == skintodisplay)
|
||||
{
|
||||
cursorx = gridx;
|
||||
|
|
@ -7322,13 +7322,13 @@ void MD_DrawGridCssSelector(void)
|
|||
colmap = R_GetTranslationColormap(skintodisplay, cv_dummycolor.value, GTC_MENUCACHE);
|
||||
V_DrawFixedPatch((cursorx * FRACUNIT) - (face->width * FRACUNIT/4), (cursory * FRACUNIT) - (face->height * FRACUNIT/4), FRACUNIT, 0, face, colmap);
|
||||
|
||||
|
||||
|
||||
cursorframe += renderdeltatics / 4;
|
||||
for (; cursorframe > 7 * FRACUNIT; cursorframe -= 7 * FRACUNIT) {}
|
||||
cursor = W_CachePatchName(va("K_BHILI%d", (cursorframe >> FRACBITS) + 1), PU_CACHE);
|
||||
// cursor patch offsets are wrong so draw at same coordinate as portrait
|
||||
V_DrawFixedPatch((cursorx * FRACUNIT) - (face->width * FRACUNIT/4), (cursory * FRACUNIT) - (face->height * FRACUNIT/4), FRACUNIT, 0, cursor, colmap);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -7384,7 +7384,7 @@ INT32 MR_HandleSetupMultiPlayerMenu(INT32 choice)
|
|||
gridcss_row = (numskins - 1) % SKINGRIDWIDTH;
|
||||
gridcss_column = (numskins - 1) / SKINGRIDWIDTH;
|
||||
}
|
||||
|
||||
|
||||
if ((gridcss_column - gridcss_skinydrag) > SKINGRIDHEIGHT - 1)
|
||||
gridcss_skinydrag++;
|
||||
}
|
||||
|
|
@ -7421,7 +7421,7 @@ INT32 MR_HandleSetupMultiPlayerMenu(INT32 choice)
|
|||
{
|
||||
gridcss_row = SKINGRIDWIDTH - 1;
|
||||
gridcss_column--;
|
||||
|
||||
|
||||
if (gridcss_column < gridcss_skinydrag)
|
||||
gridcss_skinydrag--;
|
||||
}
|
||||
|
|
@ -7495,7 +7495,7 @@ INT32 MR_HandleSetupMultiPlayerMenu(INT32 choice)
|
|||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
CV_SetValue(&cv_chooseskin, skinsorted[MapGridSelectToSkin(gridcss_row, gridcss_column)]);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -7539,7 +7539,7 @@ INT32 MR_SetupMultiPlayer(INT32 arg)
|
|||
CV_SetValue(&cv_dummycolor, cv_playercolor[arg].value);
|
||||
G_SetPlayerGamepadIndicatorColor(arg, cv_playercolor[arg].value);
|
||||
dummycolorplayer = arg;
|
||||
|
||||
|
||||
Skinsort_option_Onchange();
|
||||
|
||||
M_GetFollowerState(); // update follower state
|
||||
|
|
@ -7814,7 +7814,7 @@ void MD_DrawJoystick(void)
|
|||
for (i = 0; i <= MAXGAMEPADS; i++)
|
||||
{
|
||||
#ifdef JOYSTICK_HOTPLUG
|
||||
if (atoi(cv_usejoystick[setupcontrolplayer-1].string) > I_NumJoys())
|
||||
if (atoi(cv_usejoystick[setupcontrolplayer-1].string) > numcontrollers)
|
||||
compareval = atoi(cv_usejoystick[setupcontrolplayer-1].string);
|
||||
else
|
||||
#endif
|
||||
|
|
@ -7827,7 +7827,7 @@ void MD_DrawJoystick(void)
|
|||
INT32 MR_SetupJoystickMenu(INT32 arg)
|
||||
{
|
||||
const char *joyNA = "Unavailable";
|
||||
const INT32 n = I_NumJoys();
|
||||
const INT32 n = numcontrollers;
|
||||
|
||||
INT32 i = 0;
|
||||
INT32 j;
|
||||
|
|
@ -7872,7 +7872,7 @@ INT32 MR_AssignJoystick(INT32 arg)
|
|||
|
||||
#ifdef JOYSTICK_HOTPLUG
|
||||
INT32 oldchoice, oldstringchoice;
|
||||
INT32 numjoys = I_NumJoys();
|
||||
INT32 numjoys = numcontrollers;
|
||||
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick[p].string) > numjoys ? atoi(cv_usejoystick[p].string) : cv_usejoystick[p].value;
|
||||
CV_SetValue(&cv_usejoystick[p], arg);
|
||||
|
|
|
|||
36
src/p_tick.c
36
src/p_tick.c
|
|
@ -586,17 +586,37 @@ static void P_DeviceRumbleTick(void)
|
|||
}
|
||||
|
||||
// pulse when gettin new driftlevel
|
||||
if (player->driftcharge
|
||||
&& player->driftlevel)
|
||||
if (/*player->driftcharge // gets reset within K_KartDrift
|
||||
&& */player->driftlevel)
|
||||
{
|
||||
high = CLAMP((high + FRACUNIT / 256), 0, UINT16_MAX);
|
||||
|
||||
if (player->driftlevel == 2)
|
||||
lenght = 114;
|
||||
else if (player->driftlevel == 3)
|
||||
lenght = 144;
|
||||
else if (player->driftlevel == 4)
|
||||
lenght = 174;
|
||||
// rumble during charging drifts
|
||||
// when you reach new driftlevel
|
||||
if (player->driftlevel < 20)
|
||||
{
|
||||
if (player->driftlevel == 2)
|
||||
lenght = 114;
|
||||
else if (player->driftlevel == 3)
|
||||
lenght = 144;
|
||||
else if (player->driftlevel == 4)
|
||||
lenght = 174;
|
||||
}
|
||||
|
||||
// drift release
|
||||
// adjust those if you want
|
||||
if (player->driftlevel >= 20)
|
||||
{
|
||||
// give some oompfh on release
|
||||
low = CLAMP((low + FRACUNIT / 256), 0, UINT16_MAX);
|
||||
|
||||
if (player->driftlevel == 20)
|
||||
lenght = 114;
|
||||
else if (player->driftlevel == 30)
|
||||
lenght = 144;
|
||||
else if (player->driftlevel == 40)
|
||||
lenght = 174;
|
||||
}
|
||||
}
|
||||
|
||||
// pulse when using rings
|
||||
|
|
|
|||
|
|
@ -1490,12 +1490,12 @@ const char *I_GetJoyName(INT32 joyindex)
|
|||
|
||||
void I_GamepadRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength, UINT32 duration)
|
||||
{
|
||||
#if !(SDL_VERSION_ATLEAST(2,0,14))
|
||||
#if !(SDL_VERSION_ATLEAST(2,0,14))
|
||||
(void)playernum;
|
||||
(void)low_strength;
|
||||
(void)high_strength;
|
||||
(void)duration;
|
||||
#else
|
||||
#else
|
||||
SDL_GameController *controller = JoyInfo[playernum].dev;
|
||||
|
||||
if (controller == NULL)
|
||||
|
|
@ -1504,17 +1504,17 @@ void I_GamepadRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength,
|
|||
}
|
||||
|
||||
SDL_GameControllerRumble(controller, low_strength, high_strength, duration);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void I_SetGamepadIndicatorColor(INT32 playernum, UINT8 red, UINT8 green, UINT8 blue)
|
||||
{
|
||||
#if !(SDL_VERSION_ATLEAST(2,0,14))
|
||||
#if !(SDL_VERSION_ATLEAST(2,0,14))
|
||||
(void)playernum;
|
||||
(void)red;
|
||||
(void)green;
|
||||
(void)blue;
|
||||
#else
|
||||
#else
|
||||
SDL_GameController *controller = JoyInfo[playernum].dev;
|
||||
|
||||
if (controller == NULL)
|
||||
|
|
@ -1523,7 +1523,7 @@ void I_SetGamepadIndicatorColor(INT32 playernum, UINT8 red, UINT8 green, UINT8 b
|
|||
}
|
||||
|
||||
SDL_GameControllerSetLED(controller, red, green, blue);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NOMUMBLE
|
||||
|
|
|
|||
|
|
@ -1042,7 +1042,7 @@ void I_GetEvent(void)
|
|||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
I_InitJoystick(i);
|
||||
G_SetPlayerGamepadIndicatorColor(i, G_GetSkinColorForGamepad(i)); // gotta update the controller led again on reconnect
|
||||
G_SetPlayerGamepadIndicatorColor(i, SKINCOLOR_NONE); // gotta update the controller led again on reconnect
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
Loading…
Reference in a new issue