From 58f815ddbce985a5dc9442e0521c52fb1c87ba6e Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 3 Sep 2016 15:51:38 +0100 Subject: [PATCH] Revert "Revitem is saved by tying it to leveltime instead of dashtime, whilst dashtime is now dead." This reverts commit 0852a20014adb914ba7e56d6872a7eebc830664e. --- src/d_clisrv.c | 2 ++ src/d_clisrv.h | 1 + src/d_player.h | 1 + src/lua_playerlib.c | 4 ++++ src/p_saveg.c | 2 ++ src/p_user.c | 22 +++++++++++++++------- 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index f4caf66e6..e49f37e2a 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -550,6 +550,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->maxlink = LONG(players[i].maxlink); rsp->dashspeed = (fixed_t)LONG(players[i].dashspeed); + rsp->dashtime = LONG(players[i].dashtime); rsp->angle_pos = (angle_t)LONG(players[i].angle_pos); rsp->old_angle_pos = (angle_t)LONG(players[i].old_angle_pos); rsp->bumpertime = (tic_t)LONG(players[i].bumpertime); @@ -676,6 +677,7 @@ static void resynch_read_player(resynch_pak *rsp) players[i].maxlink = LONG(rsp->maxlink); players[i].dashspeed = (fixed_t)LONG(rsp->dashspeed); + players[i].dashtime = LONG(rsp->dashtime); players[i].angle_pos = (angle_t)LONG(rsp->angle_pos); players[i].old_angle_pos = (angle_t)LONG(rsp->old_angle_pos); players[i].bumpertime = (tic_t)LONG(rsp->bumpertime); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 9d130618b..f9e33dc4c 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -210,6 +210,7 @@ typedef struct INT32 maxlink; fixed_t dashspeed; + INT32 dashtime; angle_t angle_pos; angle_t old_angle_pos; tic_t bumpertime; diff --git a/src/d_player.h b/src/d_player.h index 59875b4cc..f57eb90cf 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -319,6 +319,7 @@ typedef struct player_s UINT32 score; // player score fixed_t dashspeed; // dashing speed + INT32 dashtime; // tics dashing, used for rev sound fixed_t normalspeed; // Normal ground fixed_t runspeed; // Speed you break into the run animation diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index c83aa8811..60119deae 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -142,6 +142,8 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->score); else if (fastcmp(field,"dashspeed")) lua_pushfixed(L, plr->dashspeed); + else if (fastcmp(field,"dashtime")) + lua_pushinteger(L, plr->dashtime); else if (fastcmp(field,"normalspeed")) lua_pushfixed(L, plr->normalspeed); else if (fastcmp(field,"runspeed")) @@ -399,6 +401,8 @@ static int player_set(lua_State *L) plr->score = (UINT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"dashspeed")) plr->dashspeed = luaL_checkfixed(L, 3); + else if (fastcmp(field,"dashtime")) + plr->dashtime = (INT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"normalspeed")) plr->normalspeed = luaL_checkfixed(L, 3); else if (fastcmp(field,"runspeed")) diff --git a/src/p_saveg.c b/src/p_saveg.c index 768949b3c..964e8b774 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -147,6 +147,7 @@ static void P_NetArchivePlayers(void) WRITEUINT32(save_p, players[i].score); WRITEFIXED(save_p, players[i].dashspeed); + WRITEINT32(save_p, players[i].dashtime); WRITESINT8(save_p, players[i].lives); WRITESINT8(save_p, players[i].continues); WRITESINT8(save_p, players[i].xtralife); @@ -322,6 +323,7 @@ static void P_NetUnArchivePlayers(void) players[i].score = READUINT32(save_p); players[i].dashspeed = READFIXED(save_p); // dashing speed + players[i].dashtime = READINT32(save_p); // dashing speed players[i].lives = READSINT8(save_p); players[i].continues = READSINT8(save_p); // continues that player has acquired players[i].xtralife = READSINT8(save_p); // Ring Extra Life counter diff --git a/src/p_user.c b/src/p_user.c index b165560f4..73f68e60e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3728,6 +3728,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) player->mo->momy = player->cmomy; player->pflags |= PF_STARTDASH|PF_SPINNING; player->dashspeed = FRACUNIT; + player->dashtime = 0; P_SetPlayerMobjState(player->mo, S_PLAY_DASH); player->pflags |= PF_USEDOWN; if (!player->spectator) @@ -3741,14 +3742,21 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) if (!player->spectator && soundcalculation != chargecalculation) S_StartSound(player->mo, sfx_s3kab); // Make the rev sound! Previously sfx_spndsh. #undef chargecalculation - if (player->revitem && !(leveltime % 5)) // Now spawn the color thok circle. - { - P_SpawnSpinMobj(player, player->revitem); - if (demorecording) - G_GhostAddRev(); - } - } + /*if (!(player->dashtime++ % 5)) + { + if (!player->spectator && player->dashspeed < player->maxdash) + S_StartSound(player->mo, sfx_s3kab); // Make the rev sound! Previously sfx_spndsh. + + // Now spawn the color thok circle. + if (player->revitem) + { + P_SpawnSpinMobj(player, player->revitem); + if (demorecording) + G_GhostAddRev(); + } + }*/ + } // If not moving up or down, and travelling faster than a speed of four while not holding // down the spin button and not spinning. // AKA Just go into a spin on the ground, you idiot. ;)