Went and fixed the dashmode variable hack nonsense once and for all myself

would have gone for "dashtime", but then I was reminded that was already a name for something to do with spindash. Oh well
This commit is contained in:
Monster Iestyn 2016-01-25 11:47:33 +00:00
parent 95d6cba184
commit 67b92d7273
6 changed files with 16 additions and 5 deletions

View file

@ -531,6 +531,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
rsp->deadtimer = players[i].deadtimer;
rsp->exiting = (tic_t)LONG(players[i].exiting);
rsp->homing = players[i].homing;
rsp->dashmode = (tic_t)LONG(players[i].dashmode);
rsp->cmomx = (fixed_t)LONG(players[i].cmomx);
rsp->cmomy = (fixed_t)LONG(players[i].cmomy);
rsp->rmomx = (fixed_t)LONG(players[i].rmomx);
@ -656,6 +657,7 @@ static void resynch_read_player(resynch_pak *rsp)
players[i].deadtimer = rsp->deadtimer;
players[i].exiting = (tic_t)LONG(rsp->exiting);
players[i].homing = rsp->homing;
players[i].dashmode = (tic_t)LONG(rsp->dashmode);
players[i].cmomx = (fixed_t)LONG(rsp->cmomx);
players[i].cmomy = (fixed_t)LONG(rsp->cmomy);
players[i].rmomx = (fixed_t)LONG(rsp->rmomx);

View file

@ -191,6 +191,7 @@ typedef struct
INT32 deadtimer;
tic_t exiting;
UINT8 homing;
tic_t dashmode;
fixed_t cmomx;
fixed_t cmomy;
fixed_t rmomx;

View file

@ -352,6 +352,7 @@ typedef struct player_s
tic_t exiting; // Exitlevel timer
UINT8 homing; // Are you homing?
tic_t dashmode; // counter for dashmode ability
tic_t skidtime; // Skid timer

View file

@ -202,6 +202,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->exiting);
else if (fastcmp(field,"homing"))
lua_pushinteger(L, plr->homing);
else if (fastcmp(field,"dashmode"))
lua_pushinteger(L, plr->dashmode);
else if (fastcmp(field,"skidtime"))
lua_pushinteger(L, plr->skidtime);
else if (fastcmp(field,"cmomx"))
@ -452,6 +454,8 @@ static int player_set(lua_State *L)
plr->exiting = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"homing"))
plr->homing = (UINT8)luaL_checkinteger(L, 3);
else if (fastcmp(field,"dashmode"))
plr->dashmode = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"skidtime"))
plr->skidtime = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"cmomx"))

View file

@ -162,6 +162,7 @@ static inline void P_NetArchivePlayers(void)
WRITEINT32(save_p, players[i].deadtimer);
WRITEUINT32(save_p, players[i].exiting);
WRITEUINT8(save_p, players[i].homing);
WRITEUINT32(save_p, players[i].dashmode);
WRITEUINT32(save_p, players[i].skidtime);
////////////////////////////
@ -337,6 +338,7 @@ static inline void P_NetUnArchivePlayers(void)
players[i].deadtimer = READINT32(save_p); // End game if game over lasts too long
players[i].exiting = READUINT32(save_p); // Exitlevel timer
players[i].homing = READUINT8(save_p); // Are you homing?
players[i].dashmode = READUINT32(save_p); // counter for dashmode ability
players[i].skidtime = READUINT32(save_p); // Skid timer
////////////////////////////

View file

@ -9155,10 +9155,10 @@ void P_PlayerThink(player_t *player)
player->pflags &= ~PF_SLIDING;
#define dashmode player->dashmode
// Dash mode ability for Metal Sonic
if ((player->charability == CA_DASHMODE) && !(maptol & TOL_NIGHTS)) // woo, dashmode! no nights tho.
{
#define dashmode player->laps
if (player->speed >= FixedMul(skins[player->skin].normalspeed - 5*FRACUNIT, player->mo->scale) || (player->pflags & PF_STARTDASH))
{
dashmode++; // Counter. Adds 1 to dash mode per tic in top speed.
@ -9172,10 +9172,10 @@ void P_PlayerThink(player_t *player)
else
dashmode = 0;
}
if (dashmode > 254)
dashmode = 3*TICRATE+1;
if (dashmode < 3*TICRATE) // Exits Dash Mode if you drop below speed/dash counter tics. Not in the above block so it doesn't keep disabling in midair.
{
player->normalspeed = skins[player->skin].normalspeed; // Reset to default if not capable of entering dash mode.
@ -9195,9 +9195,10 @@ void P_PlayerThink(player_t *player)
mobj_t *ghost = P_SpawnGhostMobj(player->mo); // Spawns afterimages
ghost->fuse = 2; // Makes the images fade quickly
}
#undef dashmode
}
else
dashmode = 0;
#undef dashmode
/*
// Colormap verification
{