diff --git a/src/d_netcmd.c b/src/d_netcmd.c index bbf24e35e..c255a4e42 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2434,8 +2434,6 @@ static void Command_StopMovie_f(void) INT32 mapchangepending = 0; -tic_t driftsparkGrowTimer[MAXPLAYERS]; - /** Runs a map change. * The supplied data are assumed to be good. If provided by a user, they will * have already been checked in Command_Map_f(). @@ -2469,9 +2467,6 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pencoremode, boolean r CONS_Debug(DBG_GAMELOGIC, "Map change: mapnum=%d gametype=%d encoremode=%d resetplayers=%d delay=%d skipprecutscene=%d\n", mapnum, newgametype, pencoremode, resetplayers, delay, skipprecutscene); - // just gonna hack in a timer reset here... - memset(driftsparkGrowTimer, 0, sizeof(driftsparkGrowTimer)); - if (netgame || multiplayer) FLS = false; diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 3cffcf4bc..1b9bd9808 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -297,8 +297,6 @@ typedef union { #pragma pack() #endif -extern tic_t driftsparkGrowTimer[16]; - // add game commands, needs cleanup void D_RegisterServerCommands(void); void D_RegisterClientCommands(void); diff --git a/src/d_player.h b/src/d_player.h index d6702e2c0..0991144fb 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -551,6 +551,8 @@ typedef struct player_s UINT8 splitscreenindex; + tic_t driftsparkGrowTimer; + fixed_t fovadd; // adjust FOV for hw rendering } player_t; diff --git a/src/k_kart.c b/src/k_kart.c index 8fb4721b5..b9f2a8606 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3249,7 +3249,6 @@ static void K_SpawnDriftSparks(player_t *player) for (i = 0; i < 2; i++) { - UINT8 pindex; fixed_t driftExtraScale = 0; newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(32*FRACUNIT, player->mo->scale)); newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(32*FRACUNIT, player->mo->scale)); @@ -3259,16 +3258,7 @@ static void K_SpawnDriftSparks(player_t *player) spark->angle = travelangle-(ANGLE_45/5)*player->kartstuff[k_drift]; // scale increase while driftspark level gained timer is running - - // hack to find the correct player number - for (pindex = 0; pindex < MAXPLAYERS; pindex++) - { - if (player == &players[pindex]) - { - driftExtraScale = FixedDiv(driftsparkGrowTimer[pindex], DRIFTSPARKGROWTICS); - break; - } - } + driftExtraScale = FixedDiv(player->driftsparkGrowTimer, DRIFTSPARKGROWTICS); spark->destscale = FixedMul(player->mo->scale, FRACUNIT + FixedMul(driftExtraScale, cv_driftsparkpulse.value)); P_SetScale(spark, FixedMul(player->mo->scale, FRACUNIT + FixedMul(driftExtraScale, cv_driftsparkpulse.value))); @@ -6001,7 +5991,6 @@ static void K_KartDrift(player_t *player, boolean onground) player->kartstuff[k_driftend] = 0; } - // Incease/decrease the drift value to continue drifting in that direction if (player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_jmp] == 1 && onground && player->kartstuff[k_drift] != 0) { @@ -6041,20 +6030,11 @@ static void K_KartDrift(player_t *player, boolean onground) || (player->kartstuff[k_driftcharge] < dstwo && player->kartstuff[k_driftcharge]+driftadditive >= dstwo) || (player->kartstuff[k_driftcharge] < dsthree && player->kartstuff[k_driftcharge]+driftadditive >= dsthree)) { - UINT8 pindex; //S_StartSound(player->mo, sfx_s3ka2); if (P_IsLocalPlayer(player)) // UGHGHGH... S_StartSoundAtVolume(player->mo, sfx_s3ka2, 192); // Ugh... - // hack to find the correct player number - for (pindex = 0; pindex < MAXPLAYERS; pindex++) - { - if (player == &players[pindex]) - { - driftsparkGrowTimer[pindex] = DRIFTSPARKGROWTICS; - break; - } - } + player->driftsparkGrowTimer = DRIFTSPARKGROWTICS; } @@ -6067,21 +6047,8 @@ static void K_KartDrift(player_t *player, boolean onground) player->kartstuff[k_driftend] = 0; } - { - //im putting this in a block because i want the variables here, not at the top of the block - UINT8 pindex; - - // hack to find the correct player number - for (pindex = 0; pindex < MAXPLAYERS; pindex++) - { - if (player == &players[pindex]) - { - if (driftsparkGrowTimer[pindex]) - driftsparkGrowTimer[pindex]--; - break; - } - } - } + if (player->driftsparkGrowTimer) + player->driftsparkGrowTimer--; // Stop drifting if (player->kartstuff[k_spinouttimer] > 0 || player->speed < minspeed) diff --git a/src/p_setup.c b/src/p_setup.c index ef56316a6..7ff71b4be 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2227,6 +2227,8 @@ static void P_LevelInitStuff(boolean reloadinggamestate) players[i].laptime[j] = 0; } + players[i].driftsparkGrowTimer = 0; + players[i].gotcontinue = false; players[i].xtralife = players[i].deadtimer = players[i].numboxes = players[i].totalring = players[i].laps = 0;