From 890a5810ae9b9a5df205bf2cfa70b1a400bbd2e6 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 26 Feb 2026 14:53:50 +0100 Subject: [PATCH] massive cleanup player related dead code huge amount of things in player struct and stuff related to it were basically unused since those are technically exposed to lua and such this sure wont make it into the next saturn release and needs a good amount of testing, if it ever makes the cut lol prob messed stuff up somewhere but lul --- src/b_bot.c | 94 ++++++++-------- src/d_clisrv.c | 88 +++++---------- src/d_netcmd.c | 2 - src/d_player.h | 49 +------- src/doomstat.h | 2 - src/g_demo.c | 18 +-- src/g_game.c | 14 +-- src/lua_baselib.c | 1 - src/lua_playerlib.c | 65 ----------- src/m_cheat.c | 26 ++--- src/p_enemy.c | 5 +- src/p_floor.c | 2 +- src/p_inter.c | 267 ++++++++++---------------------------------- src/p_local.h | 1 - src/p_map.c | 16 +-- src/p_mobj.c | 161 +++----------------------- src/p_polyobj.c | 14 +-- src/p_saveg.c | 191 ++++++++++++++----------------- src/p_setup.c | 31 +---- src/p_slopes.c | 21 +--- src/p_spec.c | 106 +++++------------- src/p_user.c | 143 +++--------------------- src/r_skins.c | 2 - 23 files changed, 304 insertions(+), 1015 deletions(-) diff --git a/src/b_bot.c b/src/b_bot.c index fa1508917..d801150ce 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -42,25 +42,26 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm if (tails->player->pflags & (PF_MACESPIN|PF_ITEMHANG)) { dist = P_AproxDistance(tails->x-sonic->x, tails->y-sonic->y); + if (sonic->player->cmd.buttons & BT_DRIFT && sonic->player->pflags & (PF_JUMPED|PF_MACESPIN|PF_ITEMHANG)) cmd->buttons |= BT_DRIFT; + if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG)) { cmd->forwardmove = sonic->player->cmd.forwardmove; cmd->angleturn = abs((signed)(tails->angle - sonic->angle)) >> TICCMD_REDUCE; if (sonic->angle < tails->angle) cmd->angleturn = -cmd->angleturn; - } else if (dist > FixedMul(512*FRACUNIT, tails->scale)) + } + else if (dist > FixedMul(512*FRACUNIT, tails->scale)) cmd->buttons |= BT_DRIFT; + return; } // Gather data about the environment dist = P_AproxDistance(tails->x-sonic->x, tails->y-sonic->y); - if (tails->player->pflags & PF_STARTDASH) - angle = sonic->angle; - else - angle = R_PointToAngle2(tails->x, tails->y, sonic->x, sonic->y); + angle = R_PointToAngle2(tails->x, tails->y, sonic->x, sonic->y); // Decide which direction to turn angle = (tails->angle - angle); @@ -91,11 +92,6 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm jump = true; } - // Decide when to spin - if (sonic->player->pflags & PF_STARTDASH - && (tails->player->pflags & PF_STARTDASH || (P_AproxDistance(tails->momx, tails->momy) < 2*FRACUNIT && !forward))) - spin = true; - // Turn the virtual keypresses into ticcmd_t. B_KeysToTiccmd(tails, cmd, forward, backward, left, right, false, false, jump, spin); @@ -133,41 +129,35 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd) void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward, boolean left, boolean right, boolean strafeleft, boolean straferight, boolean jump, boolean spin) { // Turn the virtual keypresses into ticcmd_t. - if (twodlevel || mo->flags2 & MF2_TWOD) { - if (players[consoleplayer].climbing - || mo->player->pflags & PF_GLIDING) { - // Don't mess with bot inputs during these unhandled movement conditions. - // The normal AI doesn't use abilities, so custom AI should be sending us exactly what it wants anyway. - if (forward) - cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; - if (backward) - cmd->forwardmove -= MAXPLMOVE<> TICCMD_REDUCE; - if (left || strafeleft) - cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; - if (right || straferight) - cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; - } else { - // In standard 2D mode, interpret "forward" as "the way you're facing" and everything else as "the way you're not facing" - if (left || right) - backward = true; - left = right = false; - if (forward) { - if (mo->angle < ANGLE_90 || mo->angle > ANGLE_270) - right = true; - else - left = true; - } else if (backward) { - if (mo->angle < ANGLE_90 || mo->angle > ANGLE_270) - left = true; - else - right = true; - } - if (left || strafeleft) - cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; - if (right || straferight) - cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; + if (twodlevel || mo->flags2 & MF2_TWOD) + { + // In standard 2D mode, interpret "forward" as "the way you're facing" and everything else as "the way you're not facing" + if (left || right) + backward = true; + left = right = false; + + if (forward) + { + if (mo->angle < ANGLE_90 || mo->angle > ANGLE_270) + right = true; + else + left = true; } - } else { + else if (backward) + { + if (mo->angle < ANGLE_90 || mo->angle > ANGLE_270) + left = true; + else + right = true; + } + + if (left || strafeleft) + cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; + if (right || straferight) + cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; + } + else + { if (forward) cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; if (backward) @@ -181,6 +171,7 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward if (straferight) cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE; } + if (jump) cmd->buttons |= BT_DRIFT; if (spin) @@ -204,7 +195,7 @@ boolean B_CheckRespawn(player_t *player) // Check if Sonic is busy first. // If he's doing any of these things, he probably doesn't want to see us. - if (sonic->player->pflags & (PF_ROPEHANG|PF_GLIDING|PF_CARRIED|PF_SLIDING|PF_ITEMHANG|PF_MACESPIN|PF_NIGHTSMODE) + if (sonic->player->pflags & (PF_ROPEHANG|PF_CARRIED|PF_SLIDING|PF_ITEMHANG|PF_MACESPIN) || (sonic->player->panim != PA_IDLE && sonic->player->panim != PA_WALK)) return false; @@ -213,7 +204,8 @@ boolean B_CheckRespawn(player_t *player) return false; // If you're dead, wait a few seconds to respawn. - if (player->playerstate == PST_DEAD) { + if (player->playerstate == PST_DEAD) + { if (player->deadtimer > 4*TICRATE) return true; return false; @@ -241,12 +233,17 @@ void B_RespawnBot(INT32 playernum) x = sonic->x; y = sonic->y; - if (sonic->eflags & MFE_VERTICALFLIP) { + + if (sonic->eflags & MFE_VERTICALFLIP) + { tails->eflags |= MFE_VERTICALFLIP; + z = sonic->z - FixedMul(512*FRACUNIT,sonic->scale); if (z < sonic->floorz) z = sonic->floorz; - } else { + } + else + { z = sonic->z + sonic->height + FixedMul(512*FRACUNIT,sonic->scale); if (z > sonic->ceilingz - sonic->height) z = sonic->ceilingz - sonic->height; @@ -258,6 +255,7 @@ void B_RespawnBot(INT32 playernum) tails->flags2 |= MF2_TWOD; if (sonic->eflags & MFE_UNDERWATER) tails->eflags |= MFE_UNDERWATER; + player->powers[pw_underwater] = sonic->player->powers[pw_underwater]; player->powers[pw_spacetime] = sonic->player->powers[pw_spacetime]; player->powers[pw_gravityboots] = sonic->player->powers[pw_gravityboots]; diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 186983a11..12980a9db 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -552,7 +552,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->panim = (UINT8)players[i].panim; //panim_t rsp->aiming = (angle_t)LONG(players[i].aiming); - rsp->currentweapon = LONG(players[i].currentweapon); + rsp->currentweapon = 0; rsp->ringweapons = LONG(players[i].ringweapons); for (j = 0; j < NUMPOWERS; ++j) @@ -566,36 +566,38 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->health = 0; // resynched with mo health rsp->lives = players[i].lives; rsp->continues = players[i].continues; - rsp->scoreadd = players[i].scoreadd; - rsp->xtralife = players[i].xtralife; - rsp->pity = players[i].pity; + rsp->scoreadd = 0; + rsp->xtralife = 0; + rsp->pity = 0; rsp->skincolor = players[i].skincolor; rsp->skin = LONG(players[i].skin); + // Just in case Lua does something like // modify these at runtime // SRB2kart rsp->kartspeed = (UINT8)players[i].kartspeed; rsp->kartweight = (UINT8)players[i].kartweight; // - rsp->charflags = (UINT32)LONG(players[i].charflags); + + rsp->charflags = 0; rsp->speed = (fixed_t)LONG(players[i].speed); - rsp->jumping = players[i].jumping; - rsp->secondjump = players[i].secondjump; - rsp->fly1 = players[i].fly1; - rsp->glidetime = (tic_t)LONG(players[i].glidetime); - rsp->climbing = players[i].climbing; + rsp->jumping = 0; + rsp->secondjump = 0; + rsp->fly1 = 0; + rsp->glidetime = 0; + rsp->climbing = 0; rsp->deadtimer = players[i].deadtimer; rsp->exiting = (tic_t)LONG(players[i].exiting); - rsp->homing = players[i].homing; - rsp->skidtime = (tic_t)LONG(players[i].skidtime); + rsp->homing = 0; + rsp->skidtime = 0; rsp->cmomx = (fixed_t)LONG(players[i].cmomx); rsp->cmomy = (fixed_t)LONG(players[i].cmomy); rsp->rmomx = (fixed_t)LONG(players[i].rmomx); rsp->rmomy = (fixed_t)LONG(players[i].rmomy); - rsp->weapondelay = LONG(players[i].weapondelay); + rsp->weapondelay = 0; rsp->tossdelay = LONG(players[i].tossdelay); rsp->starpostx = SHORT(players[i].starpostx); @@ -605,27 +607,27 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->starposttime = (tic_t)LONG(players[i].starposttime); rsp->starpostangle = (angle_t)LONG(players[i].starpostangle); - 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->maxlink = 0; + rsp->dashspeed = 0; + rsp->dashtime = 0; + rsp->angle_pos = 0; + rsp->old_angle_pos = 0; rsp->bumpertime = (tic_t)LONG(players[i].bumpertime); rsp->flyangle = LONG(players[i].flyangle); - rsp->drilltimer = (tic_t)LONG(players[i].drilltimer); + rsp->drilltimer = 0; rsp->linkcount = LONG(players[i].linkcount); rsp->linktimer = (tic_t)LONG(players[i].linktimer); - rsp->anotherflyangle = LONG(players[i].anotherflyangle); + rsp->anotherflyangle = 0; rsp->nightstime = (tic_t)LONG(players[i].nightstime); - rsp->drillmeter = LONG(players[i].drillmeter); - rsp->drilldelay = players[i].drilldelay; - rsp->bonustime = players[i].bonustime; + rsp->drillmeter = 0; + rsp->drilldelay = 0; + rsp->bonustime = false; rsp->mare = players[i].mare; - rsp->lastsidehit = SHORT(players[i].lastsidehit); - rsp->lastlinehit = SHORT(players[i].lastlinehit); + rsp->lastsidehit = 0; + rsp->lastlinehit = 0; - rsp->losstime = (tic_t)LONG(players[i].losstime); - rsp->timeshit = players[i].timeshit; + rsp->losstime = 0; + rsp->timeshit = 0; rsp->onconveyor = LONG(players[i].onconveyor); rsp->jointime = (tic_t)LONG(players[i].jointime); @@ -681,7 +683,6 @@ static void resynch_read_player(resynch_pak *rsp) players[i].panim = (UINT8)rsp->panim; //panim_t players[i].aiming = (angle_t)LONG(rsp->aiming); - players[i].currentweapon = LONG(rsp->currentweapon); players[i].ringweapons = LONG(rsp->ringweapons); for (j = 0; j < NUMPOWERS; ++j) @@ -695,35 +696,23 @@ static void resynch_read_player(resynch_pak *rsp) players[i].health = rsp->health; players[i].lives = rsp->lives; players[i].continues = rsp->continues; - players[i].scoreadd = rsp->scoreadd; - players[i].xtralife = rsp->xtralife; - players[i].pity = rsp->pity; players[i].skincolor = rsp->skincolor; players[i].skin = LONG(rsp->skin); + // Just in case Lua does something like // modify these at runtime players[i].kartspeed = (UINT8)rsp->kartspeed; players[i].kartweight = (UINT8)rsp->kartweight; - players[i].charflags = (UINT32)LONG(rsp->charflags); - players[i].speed = (fixed_t)LONG(rsp->speed); - players[i].jumping = rsp->jumping; - players[i].secondjump = rsp->secondjump; - players[i].fly1 = rsp->fly1; - players[i].glidetime = (tic_t)LONG(rsp->glidetime); - players[i].climbing = rsp->climbing; players[i].deadtimer = rsp->deadtimer; players[i].exiting = (tic_t)LONG(rsp->exiting); - players[i].homing = rsp->homing; - players[i].skidtime = (tic_t)LONG(rsp->skidtime); players[i].cmomx = (fixed_t)LONG(rsp->cmomx); players[i].cmomy = (fixed_t)LONG(rsp->cmomy); players[i].rmomx = (fixed_t)LONG(rsp->rmomx); players[i].rmomy = (fixed_t)LONG(rsp->rmomy); - players[i].weapondelay = LONG(rsp->weapondelay); players[i].tossdelay = LONG(rsp->tossdelay); players[i].starpostx = SHORT(rsp->starpostx); @@ -733,27 +722,13 @@ static void resynch_read_player(resynch_pak *rsp) players[i].starposttime = (tic_t)LONG(rsp->starposttime); players[i].starpostangle = (angle_t)LONG(rsp->starpostangle); - 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); players[i].flyangle = LONG(rsp->flyangle); - players[i].drilltimer = (tic_t)LONG(rsp->drilltimer); players[i].linkcount = LONG(rsp->linkcount); players[i].linktimer = (tic_t)LONG(rsp->linktimer); - players[i].anotherflyangle = LONG(rsp->anotherflyangle); players[i].nightstime = (tic_t)LONG(rsp->nightstime); - players[i].drillmeter = LONG(rsp->drillmeter); - players[i].drilldelay = rsp->drilldelay; - players[i].bonustime = rsp->bonustime; players[i].mare = rsp->mare; - players[i].lastsidehit = SHORT(rsp->lastsidehit); - players[i].lastlinehit = SHORT(rsp->lastlinehit); - players[i].losstime = (tic_t)LONG(rsp->losstime); - players[i].timeshit = rsp->timeshit; players[i].onconveyor = LONG(rsp->onconveyor); players[i].jointime = (tic_t)LONG(rsp->jointime); @@ -3355,9 +3330,6 @@ void CL_ClearPlayer(INT32 playernum) { if (players[playernum].mo) { - // Don't leave a NiGHTS ghost! - if (UNLIKELY((players[playernum].pflags & PF_NIGHTSMODE) && players[playernum].mo->tracer)) - P_RemoveMobj(players[playernum].mo->tracer); P_RemoveMobj(players[playernum].mo); } diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f33373017..d08a8ff2c 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3459,12 +3459,10 @@ static void Got_Teamchange(const UINT8 **cp, INT32 playernum) { players[playernum].spectator = true; players[playernum].pflags &= ~PF_TAGIT; - players[playernum].pflags &= ~PF_TAGGED; } else if (NetPacket.packet.newteam != 3) // .newteam == 1 or 2. { players[playernum].pflags |= PF_WANTSTOJOIN; //players[playernum].spectator = false; - players[playernum].pflags &= ~PF_TAGGED;//Just in case. if (NetPacket.packet.newteam == 1) //Make the player IT. players[playernum].pflags |= PF_TAGIT; diff --git a/src/d_player.h b/src/d_player.h index bcecb66a5..8e0184a1b 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -397,8 +397,6 @@ typedef struct player_s /// \todo Remove this. We don't need a second health definition for players. INT32 health; - SINT8 pity; // i pity the fool. - INT32 currentweapon; // current weapon selected. INT32 ringweapons; // weapons currently obtained. // Power ups. invinc and invis are tic counters. @@ -434,37 +432,20 @@ typedef struct player_s boolean skinlocal; // determines if localskin is a skin already loaded in the server UINT32 score; // player score - fixed_t dashspeed; // dashing speed - INT32 dashtime; // tics dashing, used for rev sound // SRB2kart UINT8 kartspeed; // Kart speed stat between 1 and 9 UINT8 kartweight; // Kart weight stat between 1 and 9 // - UINT32 charflags; // Extra abilities/settings for skins (combinable stuff) - // See SF_ flags SINT8 lives; SINT8 continues; // continues that player has acquired - SINT8 xtralife; // Ring Extra Life counter - UINT8 gotcontinue; // Got continue from this stage? - fixed_t speed; // Player's speed (distance formula of MOMX and MOMY values) - UINT8 jumping; // Jump counter - UINT8 secondjump; - UINT8 fly1; // Tails flying - UINT8 scoreadd; // Used for multiple enemy attack bonus - tic_t glidetime; // Glide counter for thrust - UINT8 climbing; // Climbing on the wall INT32 deadtimer; // End game if game over lasts too long tic_t exiting; // Exitlevel timer - UINT8 homing; // Are you homing? - - tic_t skidtime; // Skid timer - //////////////////////////// // Conveyor Belt Movement // //////////////////////////// @@ -476,7 +457,6 @@ typedef struct player_s ///////////////////// // Race Mode Stuff // ///////////////////// - INT16 numboxes; // Number of item boxes obtained for Race Mode INT16 totalring; // Total number of rings obtained for Race Mode tic_t realtime; // integer replacement for leveltime tic_t laptime[LAP__MAX]; @@ -488,7 +468,6 @@ typedef struct player_s INT32 ctfteam; // 0 == Spectator, 1 == Red, 2 == Blue UINT16 gotflag; // 1 == Red, 2 == Blue Do you have the flag? - INT32 weapondelay; // Delay (if any) to fire the weapon again INT32 tossdelay; // Delay (if any) to toss a flag/emeralds again // Starpost information @@ -502,40 +481,18 @@ typedef struct player_s ///////////////// // NiGHTS Stuff// ///////////////// - angle_t angle_pos; - angle_t old_angle_pos; - - mobj_t *axis1; - mobj_t *axis2; tic_t bumpertime; // Currently being bounced by MT_NIGHTSBUMPER INT32 flyangle; - tic_t drilltimer; + INT32 linkcount; tic_t linktimer; - INT32 anotherflyangle; + tic_t nightstime; // How long you can fly as NiGHTS. - INT32 drillmeter; - UINT8 drilldelay; - boolean bonustime; // Capsule destroyed, now it's bonus time! - mobj_t *capsule; // Go inside the capsule + UINT8 mare; // Current mare // Statistical purposes. - tic_t marebegunat; // Leveltime when mare begun - tic_t startedtime; // Time which you started this mare with. - tic_t finishedtime; // Time it took you to finish the mare (used for display) - INT16 finishedrings; // The rings you had left upon finishing the mare UINT32 marescore; // SRB2Kart: Battle score - UINT32 lastmarescore; // score for the last mare - UINT8 lastmare; // previous mare - INT32 maxlink; // maximum link obtained - UINT8 texttimer; // nights_texttime should not be local - UINT8 textvar; // which line of NiGHTS text to show -- let's not use cheap hacks - - INT16 lastsidehit, lastlinehit; - - tic_t losstime; - UINT8 timeshit; // That's TIMES HIT, not TIME SHIT, you doofus! INT32 onconveyor; // You are on a conveyor belt if nonzero diff --git a/src/doomstat.h b/src/doomstat.h index 80f86b974..c8bd84b1b 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -178,8 +178,6 @@ extern cutscene_t *cutscenes[128]; extern INT16 nextmapoverride; extern boolean skipstats; -extern UINT32 totalrings; // Total # of rings in a level - // Fun extra stuff extern INT16 lastmap; // Last level you were at (returning from special stages). extern mobj_t *redflag, *blueflag; // Pointers to physical flags diff --git a/src/g_demo.c b/src/g_demo.c index 9662ce517..67b7cedc9 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -715,13 +715,6 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum) if (!(demoflags & DF_GHOST)) return; // No ghost data to write. - if (ghost->player && ghost->player->pflags & PF_NIGHTSMODE && ghost->tracer) - { - // We're talking about the NiGHTS thing, not the normal platforming thing! - ziptic |= GZT_NIGHTS; - ghost = ghost->tracer; - } - ziptic_p = demobuf.p++; // the ziptic, written at the end of this function #define MAXMOM (0x7FFF<<8) @@ -936,7 +929,6 @@ void G_ConsGhostTic(INT32 playernum) fixed_t px,py,pz,gx,gy,gz; mobj_t *testmo; fixed_t syncleeway; - boolean nightsfail = false; if (!(demoflags & DF_GHOST)) return; // No ghost data to use. @@ -976,14 +968,6 @@ void G_ConsGhostTic(INT32 playernum) if (ziptic & GZT_SPRITE) demobuf.p++; - if (ziptic & GZT_NIGHTS) - { - if (!testmo || !testmo->player || !(testmo->player->pflags & PF_NIGHTSMODE) || !testmo->tracer) - nightsfail = true; - else - testmo = testmo->tracer; - } - if (ziptic & GZT_EXTRA) { // But wait, there's more! ziptic = READUINT8(demobuf.p); @@ -1066,7 +1050,7 @@ void G_ConsGhostTic(INT32 playernum) gy = oldghost[playernum].y; gz = oldghost[playernum].z; - if (nightsfail || abs(px-gx) > syncleeway || abs(py-gy) > syncleeway || abs(pz-gz) > syncleeway) + if (abs(px-gx) > syncleeway || abs(py-gy) > syncleeway || abs(pz-gz) > syncleeway) { ghostext[playernum].desyncframes++; diff --git a/src/g_game.c b/src/g_game.c index 90334aa7b..edb0b4e71 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -111,7 +111,6 @@ INT32 displayplayers[MAXSPLITSCREENPLAYERS] = {}; // view being displayed tic_t gametic = 0; tic_t levelstarttic = 0; // gametic at level start -UINT32 totalrings = 0; // for intermission INT16 lastmap = 0; // last level you were at (returning from special stages) tic_t timeinmap = 0; // Ticker for time spent in level (used for levelcard display) @@ -2106,7 +2105,6 @@ void G_PlayerReborn(INT32 player) UINT8 kartspeed; UINT8 kartweight; // - INT32 charflags; INT32 pflags; INT32 ctfteam; INT32 starposttime; @@ -2116,7 +2114,6 @@ void G_PlayerReborn(INT32 player) INT32 starpostnum; INT32 starpostangle; INT32 exiting; - INT16 numboxes; INT16 totalring; UINT8 laps; UINT8 mare; @@ -2128,7 +2125,6 @@ void G_PlayerReborn(INT32 player) UINT8 splitscreenindex; boolean spectator; INT16 bot; - SINT8 pity; // SRB2kart INT32 starpostwp; @@ -2162,13 +2158,12 @@ void G_PlayerReborn(INT32 player) jointime = players[player].jointime; splitscreenindex = players[player].splitscreenindex; spectator = players[player].spectator; - pflags = (players[player].pflags & (PF_TIMEOVER|PF_FLIPCAM|PF_TAGIT|PF_TAGGED|PF_ANALOGMODE|PF_WANTSTOJOIN)); + pflags = (players[player].pflags & (PF_TIMEOVER|PF_FLIPCAM|PF_TAGIT|PF_ANALOGMODE|PF_WANTSTOJOIN)); // As long as we're not in multiplayer, carry over cheatcodes from map to map if (!(netgame || multiplayer)) pflags |= (players[player].pflags & (PF_GODMODE|PF_NOCLIP|PF_INVIS)); - numboxes = players[player].numboxes; laps = players[player].laps; totalring = players[player].totalring; @@ -2180,7 +2175,6 @@ void G_PlayerReborn(INT32 player) kartspeed = players[player].kartspeed; kartweight = players[player].kartweight; // - charflags = players[player].charflags; starposttime = players[player].starposttime; starpostx = players[player].starpostx; @@ -2192,7 +2186,6 @@ void G_PlayerReborn(INT32 player) mare = players[player].mare; bot = players[player].bot; - pity = players[player].pity; // SRB2kart if (leveltime <= starttime || spectator == true) @@ -2281,7 +2274,6 @@ void G_PlayerReborn(INT32 player) p->kartspeed = kartspeed; p->kartweight = kartweight; // - p->charflags = charflags; p->starposttime = starposttime; p->starpostx = starpostx; @@ -2291,7 +2283,6 @@ void G_PlayerReborn(INT32 player) p->starpostangle = starpostangle; p->exiting = exiting; - p->numboxes = numboxes; p->laps = laps; p->totalring = totalring; @@ -2303,7 +2294,6 @@ void G_PlayerReborn(INT32 player) p->mare = mare; if (bot) p->bot = 1; // reset to AI-controlled - p->pity = pity; // SRB2kart p->kartstuff[k_starpostwp] = starpostwp; // TODO: get these out of kartstuff, it causes desync @@ -4034,7 +4024,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool players[i].awayviewmobj = NULL; // The latter two should clear by themselves, but just in case - players[i].pflags &= ~(PF_TAGIT|PF_TAGGED|PF_FULLSTASIS); + players[i].pflags &= ~(PF_TAGIT|PF_FULLSTASIS); // Clear cheatcodes too, just in case. players[i].pflags &= ~(PF_GODMODE|PF_NOCLIP|PF_INVIS); diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 10e4188c9..0d98645a4 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -871,7 +871,6 @@ static int lib_pResetScore(lua_State *L) NOHUD if (!player) return LUA_ErrInvalid(L, "player_t"); - P_ResetScore(player); return 0; } diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index aa5fde833..3742c5118 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -37,8 +37,6 @@ int player_aiming_setter(lua_State *L); int player_powers_noset(lua_State *L); int player_kartstuff_noset(lua_State *L); int player_skincolor_setter(lua_State *L); -int player_axis_setter(lua_State *L); -int player_capsule_setter(lua_State *L); int player_awayviewmobj_setter(lua_State *L); int player_awayviewtics_setter(lua_State *L); int player_bot_noset(lua_State *L); @@ -66,8 +64,6 @@ static const udata_field_t player_fields[] = { FIELD(player_t, viewheight, udatalib_getter_fixed, udatalib_setter_fixed), FIELD(player_t, aiming, udatalib_getter_angle, player_aiming_setter), FIELD(player_t, health, udatalib_getter_int32, udatalib_setter_int32), - FIELD(player_t, pity, udatalib_getter_sint8, udatalib_setter_sint8), - FIELD(player_t, currentweapon, udatalib_getter_int32, udatalib_setter_int32), FIELD(player_t, ringweapons, udatalib_getter_int32, udatalib_setter_int32), FIELD(player_t, powers, udatalib_getter_powers, player_powers_noset), FIELD(player_t, kartstuff, udatalib_getter_kartstuff, player_kartstuff_noset), @@ -79,37 +75,22 @@ static const udata_field_t player_fields[] = { FIELD(player_t, skincolor, udatalib_getter_uint8, player_skincolor_setter), FIELD(player_t, localskin, player_localskin_getter, player_localskin_setter), FIELD(player_t, score, udatalib_getter_uint32, udatalib_setter_uint32), - FIELD(player_t, dashspeed, udatalib_getter_fixed, udatalib_setter_fixed), - FIELD(player_t, dashtime, udatalib_getter_int32, udatalib_setter_int32), FIELD(player_t, kartspeed, udatalib_getter_uint8, udatalib_setter_uint8), FIELD(player_t, kartweight, udatalib_getter_uint8, udatalib_setter_uint8), - FIELD(player_t, charflags, udatalib_getter_uint32, udatalib_setter_uint32), FIELD(player_t, lives, udatalib_getter_sint8, udatalib_setter_sint8), FIELD(player_t, continues, udatalib_getter_sint8, udatalib_setter_sint8), - FIELD(player_t, xtralife, udatalib_getter_sint8, udatalib_setter_sint8), - FIELD(player_t, gotcontinue, udatalib_getter_uint8, udatalib_setter_uint8), FIELD(player_t, speed, udatalib_getter_fixed, udatalib_setter_fixed), - FIELD(player_t, jumping, udatalib_getter_boolean, udatalib_setter_boolean), - FIELD(player_t, secondjump, udatalib_getter_uint8, udatalib_setter_uint8), - FIELD(player_t, fly1, udatalib_getter_uint8, udatalib_setter_uint8), - FIELD(player_t, scoreadd, udatalib_getter_uint8, udatalib_setter_uint8), - FIELD(player_t, glidetime, udatalib_getter_tic, udatalib_setter_tic), - FIELD(player_t, climbing, udatalib_getter_uint8, udatalib_setter_sint8), // For whatever reason, original setter casted to INT32... FIELD(player_t, deadtimer, udatalib_getter_int32, udatalib_setter_int32), FIELD(player_t, exiting, udatalib_getter_tic, udatalib_setter_tic), - FIELD(player_t, homing, udatalib_getter_uint8, udatalib_setter_uint8), - FIELD(player_t, skidtime, udatalib_getter_tic, udatalib_setter_tic), FIELD(player_t, cmomx, udatalib_getter_fixed, udatalib_setter_fixed), FIELD(player_t, cmomy, udatalib_getter_fixed, udatalib_setter_fixed), FIELD(player_t, rmomx, udatalib_getter_fixed, udatalib_setter_fixed), FIELD(player_t, rmomy, udatalib_getter_fixed, udatalib_setter_fixed), - FIELD(player_t, numboxes, udatalib_getter_int16, udatalib_setter_int16), FIELD(player_t, totalring, udatalib_getter_int16, udatalib_setter_int16), FIELD(player_t, realtime, udatalib_getter_tic, udatalib_setter_tic), FIELD(player_t, laps, udatalib_getter_uint8, udatalib_setter_uint8), FIELD(player_t, ctfteam, udatalib_getter_int32, udatalib_setter_int32), FIELD(player_t, gotflag, udatalib_getter_uint16, udatalib_setter_uint16), - FIELD(player_t, weapondelay, udatalib_getter_int32, udatalib_setter_int32), FIELD(player_t, tossdelay, udatalib_getter_int32, udatalib_setter_int32), FIELD(player_t, starpostx, udatalib_getter_int16, udatalib_setter_int16), FIELD(player_t, starposty, udatalib_getter_int16, udatalib_setter_int16), @@ -117,36 +98,13 @@ static const udata_field_t player_fields[] = { FIELD(player_t, starpostnum, udatalib_getter_int32, udatalib_setter_int32), FIELD(player_t, starposttime, udatalib_getter_tic, udatalib_setter_tic), FIELD(player_t, starpostangle, udatalib_getter_angle, udatalib_setter_angle), - FIELD(player_t, angle_pos, udatalib_getter_angle, udatalib_setter_angle), - FIELD(player_t, old_angle_pos, udatalib_getter_angle, udatalib_setter_angle), - FIELD(player_t, axis1, udatalib_getter_mobj, player_axis_setter), - FIELD(player_t, axis2, udatalib_getter_mobj, player_axis_setter), FIELD(player_t, bumpertime, udatalib_getter_tic, udatalib_setter_tic), FIELD(player_t, flyangle, udatalib_getter_int32, udatalib_setter_int32), - FIELD(player_t, drilltimer, udatalib_getter_tic, udatalib_setter_tic), FIELD(player_t, linkcount, udatalib_getter_int32, udatalib_setter_int32), FIELD(player_t, linktimer, udatalib_getter_tic, udatalib_setter_tic), - FIELD(player_t, anotherflyangle, udatalib_getter_int32, udatalib_setter_int32), FIELD(player_t, nightstime, udatalib_getter_tic, udatalib_setter_tic), - FIELD(player_t, drillmeter, udatalib_getter_int32, udatalib_setter_int32), - FIELD(player_t, drilldelay, udatalib_getter_uint8, udatalib_setter_uint8), - FIELD(player_t, bonustime, udatalib_getter_boolean, udatalib_setter_boolean), - FIELD(player_t, capsule, udatalib_getter_mobj, player_capsule_setter), FIELD(player_t, mare, udatalib_getter_uint8, udatalib_setter_uint8), - FIELD(player_t, marebegunat, udatalib_getter_tic, udatalib_setter_tic), - FIELD(player_t, startedtime, udatalib_getter_tic, udatalib_setter_tic), - FIELD(player_t, finishedtime, udatalib_getter_tic, udatalib_setter_tic), - FIELD(player_t, finishedrings, udatalib_getter_int16, udatalib_setter_int16), FIELD(player_t, marescore, udatalib_getter_uint32, udatalib_setter_uint32), - FIELD(player_t, lastmarescore, udatalib_getter_uint32, udatalib_setter_uint32), - FIELD(player_t, lastmare, udatalib_getter_uint8, udatalib_setter_uint8), - FIELD(player_t, maxlink, udatalib_getter_int32, udatalib_setter_int32), - FIELD(player_t, texttimer, udatalib_getter_uint8, udatalib_setter_uint8), - FIELD(player_t, textvar, udatalib_getter_uint8, udatalib_setter_uint8), - FIELD(player_t, lastsidehit, udatalib_getter_int16, udatalib_setter_int16), - FIELD(player_t, lastlinehit, udatalib_getter_int16, udatalib_setter_int16), - FIELD(player_t, losstime, udatalib_getter_tic, udatalib_setter_tic), - FIELD(player_t, timeshit, udatalib_getter_uint8, udatalib_setter_uint8), // Haha, time shit, funni FIELD(player_t, onconveyor, udatalib_getter_int32, udatalib_setter_int32), FIELD(player_t, awayviewmobj, udatalib_getter_mobj, player_awayviewmobj_setter), FIELD(player_t, awayviewtics, udatalib_getter_int32, player_awayviewtics_setter), @@ -312,29 +270,6 @@ int player_localskin_setter(lua_State *L) return 0; } -int player_axis_setter(lua_State *L) -{ - mobj_t **axis; - - UDATALIB_GETFIELD(mobj_t*, axis); - - P_SetTarget(axis, *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ))); - - return 0; -} - -int player_capsule_setter(lua_State *L) -{ - player_t *plr = GETPLAYER(); - - mobj_t *mo = NULL; - if (!lua_isnil(L, 2)) - mo = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); - P_SetTarget(&plr->capsule, mo); - - return 0; -} - // Probably can do same thing as with axis1 and axis2 int player_awayviewmobj_setter(lua_State *L) { diff --git a/src/m_cheat.c b/src/m_cheat.c index 8223f2250..3d63d2267 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -773,9 +773,6 @@ boolean OP_FreezeObjectplace(void) if (!objectplacing) return false; - if ((maptol & TOL_NIGHTS) && (players[consoleplayer].pflags & PF_NIGHTSMODE)) - return false; - return true; } @@ -794,7 +791,6 @@ void OP_NightsObjectplace(player_t *player) mapthing_t *mt; player->nightstime = 3*TICRATE; - player->drillmeter = TICRATE; if (player->pflags & PF_ATTACKDOWN) { @@ -809,7 +805,7 @@ void OP_NightsObjectplace(player_t *player) // This places a hoop! if (cmd->buttons & BT_ATTACK) { - UINT16 angle = (UINT16)(player->anotherflyangle % 360); + UINT16 angle = 0; INT16 temp = (INT16)FixedInt(AngleFixed(player->mo->angle)); // Traditional 2D Angle sector_t *sec = player->mo->subsector->sector; fixed_t fheight = P_GetSectorFloorZAt(sec, (player->mo->x & 0xFFFF0000), (player->mo->y & 0xFFFF0000)); @@ -821,10 +817,7 @@ void OP_NightsObjectplace(player_t *player) // Tilt mt->angle = (INT16)FixedInt(FixedDiv(angle*FRACUNIT, 360*(FRACUNIT/256))); - if (player->anotherflyangle < 90 || player->anotherflyangle > 270) - temp -= 90; - else - temp += 90; + temp -= 90; temp %= 360; mt->options = (UINT16)((player->mo->z - fheight)>>FRACBITS); @@ -866,14 +859,14 @@ void OP_NightsObjectplace(player_t *player) CONS_Alert(CONS_WARNING, "Set op_mapthingnum first!\n"); return; } + if (!OP_HeightOkay(player, false)) return; - if (player->mo->target->flags2 & MF2_AMBUSH) - angle = (UINT16)player->anotherflyangle; - else + angle = 0; + + if (!(player->mo->target->flags2 & MF2_AMBUSH)) { - angle = (UINT16)((360-player->anotherflyangle) % 360); if (angle > 90 && angle < 270) { angle += 180; @@ -907,7 +900,7 @@ void OP_ObjectplaceMovement(player_t *player) { ticcmd_t *cmd = &player->cmd; - if (!player->climbing && (netgame || (player->pflags & PF_SPINNING))) + if (netgame) player->mo->angle = (cmd->angleturn << TICCMD_REDUCE); ticruned++; @@ -1057,9 +1050,6 @@ void Command_ObjectPlace_f(void) { objectplacing = true; - if ((players[0].pflags & PF_NIGHTSMODE)) - return; - if (!COM_CheckParm("-silent")) { HU_SetCEchoFlags(V_RETURN8|V_MONOSPACE); @@ -1128,7 +1118,7 @@ void Command_ObjectPlace_f(void) // Don't touch the NiGHTS Objectplace stuff. // ... or if the mo mysteriously vanished. - if (!players[0].mo || (players[0].pflags & PF_NIGHTSMODE)) + if (!players[0].mo) return; // If still in dummy state, get out of it. diff --git a/src/p_enemy.c b/src/p_enemy.c index 3e83bec0c..2fa83fc9a 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5063,7 +5063,7 @@ void A_CrawlaCommanderThink(void *thing) if (actor->target->player && actor->health > 1) { if (dist < FixedMul(128*FRACUNIT, actor->scale) - && ((actor->target->player->pflags & PF_JUMPED) || (actor->target->player->pflags & PF_SPINNING))) + && (actor->target->player->pflags & PF_JUMPED)) { // Auugh! He's trying to kill you! Strafe! STRAAAAFFEEE!! if (actor->target->momx || actor->target->momy) @@ -5537,7 +5537,6 @@ void A_RecyclePowers(void *thing) UINT16 powers[MAXPLAYERS][NUMPOWERS]; INT32 weapons[MAXPLAYERS]; - INT32 weaponheld[MAXPLAYERS]; if (LUA_CallAction(A_RECYCLEPOWERS, actor)) return; @@ -5564,7 +5563,6 @@ void A_RecyclePowers(void *thing) powers[i][k] = players[i].powers[k]; //1.1: ring weapons too weapons[i] = players[i].ringweapons; - weaponheld[i] = players[i].currentweapon; j++; } @@ -5612,7 +5610,6 @@ void A_RecyclePowers(void *thing) //1.1: weapon rings too players[recv_pl].ringweapons = weapons[send_pl]; - players[recv_pl].currentweapon = weaponheld[send_pl]; P_SpawnShieldOrb(&players[recv_pl]); if (P_IsLocalPlayer(&players[recv_pl])) diff --git a/src/p_floor.c b/src/p_floor.c index bd7a2655e..99099ff87 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2256,7 +2256,7 @@ void T_RaiseSector(levelspecthink_t *raise) continue; // Option to require spindashing. - if (raise->vars[1] && !(thing->player->pflags & PF_STARTDASH)) + if (raise->vars[1]) continue; if (!(thing->z == P_GetSpecialTopZ(thing, raise->sector, sector))) diff --git a/src/p_inter.c b/src/p_inter.c index f97a964e8..d8d421e7c 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -111,35 +111,19 @@ void P_DoNightsScore(player_t *player) player = &players[consoleplayer]; // Individual link counts - if (++player->linkcount > player->maxlink) - player->maxlink = player->linkcount; + ++player->linkcount; + player->linktimer = 2*TICRATE; if (player->linkcount < 10) { - if (player->bonustime) - { - P_AddPlayerScore(player, player->linkcount*20); - P_SetMobjState(dummymo, dummymo->info->xdeathstate+player->linkcount-1); - } - else - { - P_AddPlayerScore(player, player->linkcount*10); - P_SetMobjState(dummymo, dummymo->info->spawnstate+player->linkcount-1); - } + P_AddPlayerScore(player, player->linkcount*10); + P_SetMobjState(dummymo, dummymo->info->spawnstate+player->linkcount-1); } else { - if (player->bonustime) - { - P_AddPlayerScore(player, 200); - P_SetMobjState(dummymo, dummymo->info->xdeathstate+9); - } - else - { - P_AddPlayerScore(player, 100); - P_SetMobjState(dummymo, dummymo->info->spawnstate+9); - } + P_AddPlayerScore(player, 100); + P_SetMobjState(dummymo, dummymo->info->spawnstate+9); } // Hoops are the only things that should add to your drill meter @@ -831,50 +815,37 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { S_StartSound(toucher, special->info->seesound); - if (UNLIKELY(player->pflags & PF_NIGHTSMODE)) - { - player->bumpertime = TICRATE/2; - if (special->threshold > 0) - player->flyangle = (special->threshold*30)-1; - else - player->flyangle = special->threshold; + // More like a spring + angle_t fa; + fixed_t xspeed, yspeed; + const fixed_t speed = FixedMul(FixedDiv(special->info->speed*FRACUNIT,75*FRACUNIT), FixedSqrt(FixedMul(toucher->scale,special->scale))); - player->speed = FixedMul(special->info->speed, special->scale); - toucher->z = special->z+(special->height/4); - } - else // More like a spring - { - angle_t fa; - fixed_t xspeed, yspeed; - const fixed_t speed = FixedMul(FixedDiv(special->info->speed*FRACUNIT,75*FRACUNIT), FixedSqrt(FixedMul(toucher->scale,special->scale))); + player->bumpertime = TICRATE/2; - player->bumpertime = TICRATE/2; + P_UnsetThingPosition(toucher); + toucher->x = special->x; + toucher->y = special->y; + P_SetThingPosition(toucher); + toucher->z = special->z+(special->height/4); - P_UnsetThingPosition(toucher); - toucher->x = special->x; - toucher->y = special->y; - P_SetThingPosition(toucher); - toucher->z = special->z+(special->height/4); + if (special->threshold > 0) + fa = (FixedAngle(((special->threshold*30)-1)*FRACUNIT)>>ANGLETOFINESHIFT) & FINEMASK; + else + fa = 0; - if (special->threshold > 0) - fa = (FixedAngle(((special->threshold*30)-1)*FRACUNIT)>>ANGLETOFINESHIFT) & FINEMASK; - else - fa = 0; + xspeed = FixedMul(FINECOSINE(fa),speed); + yspeed = FixedMul(FINESINE(fa),speed); - xspeed = FixedMul(FINECOSINE(fa),speed); - yspeed = FixedMul(FINESINE(fa),speed); + P_InstaThrust(toucher, special->angle, xspeed/10); + toucher->momz = yspeed/11; - P_InstaThrust(toucher, special->angle, xspeed/10); - toucher->momz = yspeed/11; + toucher->angle = special->angle; - toucher->angle = special->angle; + P_ForceLocalAngle(player, toucher->angle); - P_ForceLocalAngle(player, toucher->angle); + P_ResetPlayer(player); - P_ResetPlayer(player); - - P_SetPlayerMobjState(toucher, S_KART_STND1); // SRB2kart - was S_PLAY_FALL1 - } + P_SetPlayerMobjState(toucher, S_KART_STND1); // SRB2kart - was S_PLAY_FALL1 } return; case MT_NIGHTSWING: @@ -910,13 +881,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_DoNightsScore(player); - // Hoops are the only things that should add to the drill meter - // Also, one tic's worth of drill is too much. - if (player->bot) - players[consoleplayer].drillmeter += TICRATE/2; - else - player->drillmeter += TICRATE/2; - // Play hoop sound -- pick one depending on the current link. if (player->linkcount <= 5) S_StartSound(toucher, sfx_hoop1); @@ -924,6 +888,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) S_StartSound(toucher, sfx_hoop2); else S_StartSound(toucher, sfx_hoop3); + return; // ***** // @@ -1054,11 +1019,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) toucher->momx = P_ReturnThrustX(special, angle, touchspeed); toucher->momy = P_ReturnThrustY(special, angle, touchspeed); toucher->momz = -toucher->momz; - if (player->pflags & PF_GLIDING) - { - player->pflags &= ~(PF_GLIDING|PF_JUMPED); - P_SetPlayerMobjState(toucher, S_KART_STND1); // SRB2kart - was S_PLAY_FALL1 - } // Play a bounce sound? S_StartSound(toucher, special->info->painsound); @@ -1121,17 +1081,12 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) toucher->momx = P_ReturnThrustX(special, special->angle, touchspeed); toucher->momy = P_ReturnThrustY(special, special->angle, touchspeed); toucher->momz = -toucher->momz; - if (player->pflags & PF_GLIDING) - { - player->pflags &= ~(PF_GLIDING|PF_JUMPED); - P_SetPlayerMobjState(toucher, S_KART_STND1); // SRB2kart - was S_PLAY_FALL1 - } // Play a bounce sound? S_StartSound(toucher, special->info->painsound); return; } - else if (UNLIKELY((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) || (player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)) + else if ((player->pflags & PF_JUMPED) || player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object? { // Shatter the shield! @@ -1580,7 +1535,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) if (target->flags & MF_MONITOR || target->type == MT_RANDOMITEM) { P_SetTarget(&target->target, source); - source->player->numboxes++; + if (cv_itemrespawn.value && (netgame || multiplayer)) { target->fuse = cv_itemrespawntime.value*TICRATE + 2; // Random box generation @@ -1994,68 +1949,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) Graue 12-22-2003 */ } -static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source) -{ - player_t *player = target->player; - tic_t oldnightstime = player->nightstime; - - if (!player->powers[pw_flashing] - && !(player->pflags & PF_GODMODE)) - { - angle_t fa; - - player->angle_pos = player->old_angle_pos; - player->speed /= 5; - player->flyangle += 180; // Shuffle's BETTERNIGHTSMOVEMENT? - player->flyangle %= 360; - - if (G_RaceGametype()) - player->drillmeter -= 5*20; - else - { - if (source && source->player) - { - if (player->nightstime > 20*TICRATE) - player->nightstime -= 20*TICRATE; - else - player->nightstime = 1; - } - else - { - if (player->nightstime > 5*TICRATE) - player->nightstime -= 5*TICRATE; - else - player->nightstime = 1; - } - } - - if (player->pflags & PF_TRANSFERTOCLOSEST) - { - target->momx = -target->momx; - target->momy = -target->momy; - } - else - { - fa = player->old_angle_pos>>ANGLETOFINESHIFT; - - target->momx = FixedMul(FINECOSINE(fa),target->target->radius); - target->momy = FixedMul(FINESINE(fa),target->target->radius); - } - - player->powers[pw_flashing] = K_GetKartFlashing(player); - P_SetMobjState(target->tracer, S_NIGHTSHURT1); - S_StartSound(target, sfx_nghurt); - - if (oldnightstime > 10*TICRATE - && player->nightstime < 10*TICRATE) - { - //S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH - S_ChangeMusicInternal("drown",false); - } - } -} - -static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage) +static boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage) { player_t *player = target->player; (void)damage; //unused parm @@ -2123,14 +2017,13 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou return true; } -static inline boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage) +static boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage) { - player_t *player = target->player; - // Tag handling if (G_TagGametype()) return P_TagDamage(target, inflictor, source, damage); - else if (G_GametypeHasTeams()) // CTF + Team Match + + if (G_GametypeHasTeams()) // CTF + Team Match { // Don't allow players on the same team to hurt one another, // unless cv_friendlyfire is on. @@ -2149,17 +2042,12 @@ static inline boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj } } - // Add pity. - if (!player->powers[pw_flashing] && !player->powers[pw_invulnerability] && !player->powers[pw_super] - && source->player->score > player->score) - player->pity++; - return true; } static void P_KillPlayer(player_t *player, mobj_t *source) { - player->pflags &= ~(PF_CARRIED|PF_SLIDING|PF_ITEMHANG|PF_MACESPIN|PF_ROPEHANG|PF_NIGHTSMODE); + player->pflags &= ~(PF_CARRIED|PF_SLIDING|PF_ITEMHANG|PF_MACESPIN|PF_ROPEHANG); // Burst weapons and emeralds in Match/CTF only if (source && (G_BattleGametype())) @@ -2386,29 +2274,10 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (player->exiting) return false; - if (UNLIKELY(!(target->player->pflags & (PF_NIGHTSMODE|PF_NIGHTSFALL)) && (maptol & TOL_NIGHTS))) + if (UNLIKELY(maptol & TOL_NIGHTS)) return false; } - if (UNLIKELY(player->pflags & PF_NIGHTSMODE)) // NiGHTS damage handling - { - if (!force) - { - if (source == target) - return false; // Don't hit yourself with your own paraloop, baka - if (source && source->player && !cv_friendlyfire.value - && (gametype == GT_COOP - || (G_GametypeHasTeams() && target->player->ctfteam == source->player->ctfteam))) - return false; // Don't run eachother over in special stages and team games and such - } - - if (LUA_HookMobjDamage(target, inflictor, source, damage)) - return true; - - P_NiGHTSDamage(target, source); // -5s :( - return true; - } - if (LUA_HookMobjDamage(target, inflictor, source, damage)) return true; @@ -2594,7 +2463,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) if (player->mo->health <= 1) num_rings = 5; - if (num_rings > 32 && !(player->pflags & PF_NIGHTSFALL)) + if (num_rings > 32) num_rings = 32; if (player->powers[pw_emeralds]) @@ -2627,55 +2496,35 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) // Angle offset by player angle, then slightly offset by amount of rings fa = ((i*FINEANGLES/16) + (player->mo->angle>>ANGLETOFINESHIFT) - ((num_rings-1)*FINEANGLES/32)) & FINEMASK; - // Make rings spill out around the player in 16 directions like SA, but spill like Sonic 2. - // Technically a non-SA way of spilling rings. They just so happen to be a little similar. - if (player->pflags & PF_NIGHTSFALL) + fixed_t momxy, momz; // base horizonal/vertical thrusts + + if (i > 15) { - ns = FixedMul(((i*FRACUNIT)/16)+2*FRACUNIT, mo->scale); - mo->momx = FixedMul(FINECOSINE(fa),ns); - - if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD)))) - mo->momy = FixedMul(FINESINE(fa),ns); - - P_SetObjectMomZ(mo, 8*FRACUNIT, false); - mo->fuse = 20*TICRATE; // Adjust fuse for NiGHTS + momxy = 3*FRACUNIT; + momz = 4*FRACUNIT; } else { - fixed_t momxy, momz; // base horizonal/vertical thrusts - - if (i > 15) - { - momxy = 3*FRACUNIT; - momz = 4*FRACUNIT; - } - else - { - momxy = 28*FRACUNIT; - momz = 3*FRACUNIT; - } - - ns = FixedMul(momxy, mo->scale); - mo->momx = FixedMul(FINECOSINE(fa),ns); - - if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD)))) - mo->momy = FixedMul(FINESINE(fa),ns); - - ns = momz; - P_SetObjectMomZ(mo, ns, false); - - if (i & 1) - P_SetObjectMomZ(mo, ns, true); + momxy = 28*FRACUNIT; + momz = 3*FRACUNIT; } + + ns = FixedMul(momxy, mo->scale); + mo->momx = FixedMul(FINECOSINE(fa),ns); + + if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD)))) + mo->momy = FixedMul(FINESINE(fa),ns); + + ns = momz; + P_SetObjectMomZ(mo, ns, false); + + if (i & 1) + P_SetObjectMomZ(mo, ns, true); + if (player->mo->eflags & MFE_VERTICALFLIP) mo->momz *= -1; } - player->losstime += 10*TICRATE; - - if (P_IsObjectOnGround(player->mo)) - player->pflags &= ~PF_NIGHTSFALL; - return; } diff --git a/src/p_local.h b/src/p_local.h index e82408802..ab782f9a6 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -213,7 +213,6 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings); void P_GivePlayerLives(player_t *player, INT32 numlives); UINT8 P_GetNextEmerald(void); void P_GiveEmerald(boolean spawnObj); -void P_ResetScore(player_t *player); boolean P_AutoPause(void); void P_DoJumpShield(player_t *player); diff --git a/src/p_map.c b/src/p_map.c index dd10e2475..441b1dad1 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -140,12 +140,6 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) if (object->player && object->player->spectator) return false; - if (UNLIKELY(object->player && (object->player->pflags & PF_NIGHTSMODE))) - { - /*Someone want to make these work like bumpers?*/ - return false; - } - object->standingslope = NULL; // Okay, now we can't return - no launching off at silly angles for you. object->eflags |= MFE_SPRUNG; // apply this flag asap! @@ -227,7 +221,6 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) } } - //pflags = object->player->pflags & (PF_JUMPED|PF_SPINNING|PF_THOKKED); // I still need these. P_ResetPlayer(object->player); } return true; @@ -266,8 +259,6 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object) break; if (flipval*object->momz >= FixedMul(speed, spring->scale)) // if object's already moving faster than your best, don't bother break; - if (p && (p->climbing || p->pflags & PF_GLIDING)) // doesn't affect Knux when he's using his abilities! - break; object->momz += flipval*FixedMul(speed/4, spring->scale); @@ -353,11 +344,6 @@ static boolean PIT_CheckThing(mobj_t *thing) if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_PAIN|MF_SHOOTABLE)) || (thing->flags & MF_NOCLIPTHING)) return true; - // Don't collide with your buddies while NiGHTS-flying. - if (UNLIKELY(tmthing->player && thing->player && (maptol & TOL_NIGHTS) - && ((tmthing->player->pflags & PF_NIGHTSMODE) || (thing->player->pflags & PF_NIGHTSMODE)))) - return true; - blockdist = thing->radius + tmthing->radius; if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist) @@ -1393,7 +1379,7 @@ static boolean PIT_CheckThing(mobj_t *thing) && thing->z + thing->height + FixedMul(FRACUNIT, thing->scale) >= tmthing->z) { if (thing->flags & MF_MONITOR - && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)) + && tmthing->player->pflags & PF_JUMPED) { SINT8 flipval = P_MobjFlip(thing); // Save this value in case monitor gets removed. fixed_t *momz = &tmthing->momz; // tmthing gets changed by P_DamageMobj, so we need a new pointer?! X_x;; diff --git a/src/p_mobj.c b/src/p_mobj.c index 39c278b17..18622c4ae 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -971,11 +971,6 @@ static void P_PlayerFlip(mobj_t *mo) camera[i].z += FixedMul(20*FRACUNIT, mo->scale); } } - else if (UNLIKELY(mo->player->pflags & PF_NIGHTSMODE)) // NiGHTS doesn't use flipcam - { - if (mo->tracer) - mo->tracer->eflags ^= MFE_VERTICALFLIP; - } } // @@ -1043,16 +1038,15 @@ fixed_t P_GetMobjGravity(mobj_t *mo) if (mo->player) { - if (UNLIKELY(mo->player->climbing || (mo->player->pflags & PF_NIGHTSMODE))) - return 0; - if (!(mo->flags2 & MF2_OBJECTFLIP) != !(mo->player->powers[pw_gravityboots])) // negated to turn numeric into bool - would be double negated, but not needed if both would be { gravityadd = -gravityadd; mo->eflags ^= MFE_VERTICALFLIP; } + if (wasflip == !(mo->eflags & MFE_VERTICALFLIP)) // note!! == ! is not equivalent to != here - turns numeric into bool this way P_PlayerFlip(mo); + if (mo->player->kartstuff[k_pogospring]) gravityadd = (5*gravityadd)/2; } @@ -1215,16 +1209,9 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy) if (player) // valid only if player avatar { - // spinning friction - if (player->pflags & PF_SPINNING && (player->rmomx || player->rmomy) && !(player->pflags & PF_STARTDASH)) - { - const fixed_t ns = FixedDiv(549*ORIG_FRICTION, 500*FRACUNIT); //const fixed_t ns = FixedDiv(549*FRICTION,500*FRACUNIT); - mo->momx = FixedMul(mo->momx, ns); - mo->momy = FixedMul(mo->momy, ns); - } - else if (abs(player->rmomx) < mo->scale + if (abs(player->rmomx) < mo->scale && abs(player->rmomy) < mo->scale - && (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING)) + && (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove) && !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)) ) { @@ -1662,42 +1649,6 @@ void P_XYMovement(mobj_t *mo) // Check the gravity status. P_CheckGravity(mo, false); - if (UNLIKELY(player && !moved && player->pflags & PF_NIGHTSMODE && mo->target)) - { - angle_t fa; - - P_UnsetThingPosition(mo); - player->angle_pos = player->old_angle_pos; - player->speed = FixedMul(player->speed, 4*FRACUNIT/5); - - if (player->flyangle >= 0 && player->flyangle < 90) - player->flyangle = 135; - else if (player->flyangle >= 90 && player->flyangle < 180) - player->flyangle = 45; - else if (player->flyangle >= 180 && player->flyangle < 270) - player->flyangle = 315; - else - player->flyangle = 225; - - player->flyangle %= 360; - - if (player->pflags & PF_TRANSFERTOCLOSEST) - { - mo->x -= mo->momx; - mo->y -= mo->momy; - } - else - { - fa = player->old_angle_pos>>ANGLETOFINESHIFT; - - mo->x = mo->target->x + FixedMul(FINECOSINE(fa),mo->target->radius); - mo->y = mo->target->y + FixedMul(FINESINE(fa),mo->target->radius); - } - - mo->momx = mo->momy = 0; - P_SetThingPosition(mo); - } - if (mo->flags & MF_NOCLIPHEIGHT) return; // no frictions for objects that can pass through floors @@ -1712,12 +1663,6 @@ void P_XYMovement(mobj_t *mo) if (mo->flags & MF_MISSILE || mo->flags2 & MF2_SKULLFLY || mo->type == MT_SHELL || mo->type == MT_VULTURE) return; // no friction for missiles ever - if (player && player->homing) // no friction for homing - return; - - if (UNLIKELY(player && player->pflags & PF_NIGHTSMODE)) - return; // no friction for NiGHTS players - if ((mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED) && (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)) // Special exception for tumbleweeds on slopes return; @@ -2481,20 +2426,6 @@ static void P_PlayerZMovement(mobj_t *mo) else mo->z = mo->floorz; - if (UNLIKELY(mo->player->pflags & PF_NIGHTSMODE)) - { - // bounce off floor if you were flying towards it - if ((mo->eflags & MFE_VERTICALFLIP && mo->player->flyangle > 0 && mo->player->flyangle < 180) - || (!(mo->eflags & MFE_VERTICALFLIP) && mo->player->flyangle > 180 && mo->player->flyangle <= 359)) - { - if (mo->player->flyangle < 90 || mo->player->flyangle >= 270) - mo->player->flyangle += P_MobjFlip(mo)*90; - else - mo->player->flyangle -= P_MobjFlip(mo)*90; - mo->player->speed = FixedMul(mo->player->speed, 4*FRACUNIT/5); - } - goto nightsdone; - } // Get up if you fell. if ((mo->state == &states[mo->info->painstate] || mo->state == &states[S_KART_SPIN]) && mo->player->kartstuff[k_spinouttimer] == 0 && mo->player->kartstuff[k_squishedtimer] == 0) // SRB2kart @@ -2602,34 +2533,17 @@ static void P_PlayerZMovement(mobj_t *mo) if (mo->health) { - if (mo->player->pflags & PF_GLIDING) // ground gliding - { - mo->player->skidtime = TICRATE; - mo->tics = -1; - } - else if ((mo->player->pflags & PF_JUMPED || (mo->player->pflags & (PF_SPINNING|PF_USEDOWN)) != (PF_SPINNING|PF_USEDOWN) + if ((mo->player->pflags & PF_JUMPED || ((mo->player->pflags & PF_USEDOWN) != PF_USEDOWN) || mo->player->powers[pw_tailsfly]) && (mo->player->kartstuff[k_spinouttimer] == 0)) // SRB2kart { K_KartMoveAnimation(mo->player); } - if (mo->player->pflags & PF_JUMPED) - mo->player->pflags &= ~PF_SPINNING; - else if (!(mo->player->pflags & PF_USEDOWN)) - mo->player->pflags &= ~PF_SPINNING; - - if (!(mo->player->pflags & PF_GLIDING)) - mo->player->pflags &= ~PF_JUMPED; + mo->player->pflags &= ~PF_JUMPED; mo->player->pflags &= ~PF_THOKKED; - mo->player->jumping = 0; - mo->player->secondjump = 0; - mo->player->glidetime = 0; - mo->player->climbing = 0; mo->player->powers[pw_tailsfly] = 0; } } - if (!(mo->player->pflags & PF_SPINNING)) - mo->player->pflags &= ~PF_STARTDASH; if (tmfloorthing && (tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER)) @@ -2661,8 +2575,6 @@ static void P_PlayerZMovement(mobj_t *mo) P_CheckGravity(mo, true); } -nightsdone: - if (((mo->eflags & MFE_VERTICALFLIP && mo->z < mo->floorz) || (!(mo->eflags & MFE_VERTICALFLIP) && mo->z + mo->height > mo->ceilingz)) && !(mo->flags & MF_NOCLIPHEIGHT)) { @@ -2671,21 +2583,6 @@ nightsdone: else mo->z = mo->ceilingz - mo->height; - if (UNLIKELY(mo->player->pflags & PF_NIGHTSMODE)) - { - // bounce off ceiling if you were flying towards it - if ((mo->eflags & MFE_VERTICALFLIP && mo->player->flyangle > 180 && mo->player->flyangle <= 359) - || (!(mo->eflags & MFE_VERTICALFLIP) && mo->player->flyangle > 0 && mo->player->flyangle < 180)) - { - if (mo->player->flyangle < 90 || mo->player->flyangle >= 270) - mo->player->flyangle -= P_MobjFlip(mo)*90; - else - mo->player->flyangle += P_MobjFlip(mo)*90; - mo->player->flyangle %= 360; - mo->player->speed = FixedMul(mo->player->speed, 4*FRACUNIT/5); - } - } - // Check for "Mario" blocks to hit and bounce them if (P_MobjFlip(mo)*mo->momz > 0) { @@ -2719,8 +2616,7 @@ nightsdone: if (UNLIKELY(mariomode)) S_StartSound(mo, sfx_mario1); - if (!mo->player->climbing) - mo->momz = 0; + mo->momz = 0; } } } @@ -3347,7 +3243,7 @@ void P_CalcChasePostImg(player_t *player, camera_t *thiscam) player_flipcam = cv_flipcam[pnum].value; } - const boolean flipcam = (player_flipcam && player->mo->eflags & MFE_VERTICALFLIP && LIKELY(!(player->pflags & PF_NIGHTSMODE))); + const boolean flipcam = (player_flipcam && (player->mo->eflags & MFE_VERTICALFLIP)); UINT8 postimgtype = 0; if (encoremode) @@ -3632,14 +3528,10 @@ static void P_PlayerMobjThinker(mobj_t *mobj) } else { - if (LIKELY(!(mobj->player->pflags & PF_NIGHTSMODE))) // "jumping" is used for drilling - mobj->player->jumping = 0; - mobj->player->pflags &= ~PF_JUMPED; - if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly]) + if (mobj->player->powers[pw_tailsfly]) { - mobj->player->secondjump = 0; mobj->player->powers[pw_tailsfly] = 0; P_SetPlayerMobjState(mobj, S_KART_WALK1); // SRB2kart - was S_PLAY_RUN1 } @@ -5063,7 +4955,7 @@ static void P_Boss9Thinker(mobj_t *mobj) if ((!mobj->target || !(mobj->target->flags & MF_SHOOTABLE))) { P_BossTargetPlayer(mobj, false); - if (mobj->target && (!P_IsObjectOnGround(mobj->target) || mobj->target->player->pflags & PF_SPINNING)) + if (mobj->target && !P_IsObjectOnGround(mobj->target)) P_SetTarget(&mobj->target, NULL); // Wait for them to hit the ground first if (!mobj->target) // Still no target, aww. @@ -5444,7 +5336,7 @@ static void P_Boss9Thinker(mobj_t *mobj) mobj->angle -= InvAngle(angle)/8; // Check if we're being attacked - if (!(mobj->target->player->pflags & (PF_JUMPED|PF_SPINNING) + if (!(mobj->target->player->pflags & PF_JUMPED || mobj->target->player->powers[pw_tailsfly] || mobj->target->player->powers[pw_invulnerability] || mobj->target->player->powers[pw_super])) @@ -5753,7 +5645,6 @@ void P_SetScale(mobj_t *mobj, fixed_t newscale) { G_GhostAddScale((INT32) (player - players), newscale); player->viewheight = FixedMul(FixedDiv(player->viewheight, oldscale), newscale); // Nonono don't calculate viewheight elsewhere, this is the best place for it! - player->dashspeed = FixedMul(FixedDiv(player->dashspeed, oldscale), newscale); // Prevents the player from having to re-charge up spindash if the player grew in size } } @@ -8693,17 +8584,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj) if (mobj->tracer && mobj->tracer->player) { - if (LIKELY(!(mobj->tracer->player->pflags & PF_NIGHTSMODE))) - { - mobj->flags &= ~MF_NOGRAVITY; - mobj->flags2 &= ~MF2_DONTDRAW; - P_SetMobjState(mobj, S_NIGHTSDRONE1); - } - else if (!mobj->tracer->player->bonustime) - { - mobj->flags &= ~MF_NOGRAVITY; - P_SetMobjState(mobj, S_NIGHTSDRONE1); - } + mobj->flags &= ~MF_NOGRAVITY; + mobj->flags2 &= ~MF2_DONTDRAW; + P_SetMobjState(mobj, S_NIGHTSDRONE1); } } else @@ -8717,18 +8600,8 @@ static boolean P_MobjRegularThink(mobj_t *mobj) P_SetTarget(&mobj->target, NULL); } - if (UNLIKELY(mobj->tracer->player->pflags & PF_NIGHTSMODE)) - { - if (mobj->tracer->player->bonustime) - { - P_SetMobjState(mobj, S_NIGHTSDRONE_SPARKLING1); - mobj->flags |= MF_NOGRAVITY; - } - else - mobj->flags2 |= MF2_DONTDRAW; - } - else // Not NiGHTS - mobj->flags2 &= ~MF2_DONTDRAW; + // Not NiGHTS + mobj->flags2 &= ~MF2_DONTDRAW; } mobj->angle += ANG10; @@ -10857,7 +10730,6 @@ void P_SpawnPlayer(INT32 playernum) mobj->health = p->health; p->playerstate = PST_LIVE; - p->bonustime = false; p->realtime = leveltime; //awayview stuff @@ -10964,7 +10836,6 @@ void P_AfterPlayerSpawn(INT32 playernum) p->viewz = p->mo->z + p->viewheight; P_SetPlayerMobjState(p->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND - p->pflags &= ~PF_SPINNING; if (playernum == consoleplayer) { diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 94c808b22..51a7d0589 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1026,7 +1026,9 @@ static void Polyobj_pushThing(polyobj_t *po, line_t *line, mobj_t *mo) // static void Polyobj_slideThing(mobj_t *mo, fixed_t dx, fixed_t dy) { - if (mo->player) { // Do something similar to conveyor movement. -Red + // Do something similar to conveyor movement. -Red + if (mo->player) + { mo->player->cmomx += dx; mo->player->cmomy += dy; @@ -1036,18 +1038,12 @@ static void Polyobj_slideThing(mobj_t *mo, fixed_t dx, fixed_t dy) mo->player->cmomx -= dx; mo->player->cmomy -= dy; - if (mo->player->pflags & PF_SPINNING && (mo->player->rmomx || mo->player->rmomy) && !(mo->player->pflags & PF_STARTDASH)) { -#define SPINMULT 5184 // Consider this a substitute for properly calculating FRACUNIT-friction. I'm tired. -Red - dx = FixedMul(dx, SPINMULT); - dy = FixedMul(dy, SPINMULT); -#undef SPINMULT - } - mo->momx += dx; mo->momy += dy; mo->player->onconveyor = 1; - } else + } + else P_TryMove(mo, mo->x+dx, mo->y+dy, true); } diff --git a/src/p_saveg.c b/src/p_saveg.c index 64686dfd4..104281864 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -137,8 +137,9 @@ static void P_NetArchivePlayers(savebuffer_t *save, boolean resending) WRITEINT32(save->p, player->awayviewtics); WRITEINT32(save->p, player->health); - WRITESINT8(save->p, player->pity); - WRITEINT32(save->p, player->currentweapon); + WRITESINT8(save->p, 0); //player->pity + WRITEINT32(save->p, 0); //player->currentweapon + WRITEINT32(save->p, player->ringweapons); for (j = 0; j < NUMPOWERS; j++) @@ -163,23 +164,23 @@ static void P_NetArchivePlayers(savebuffer_t *save, boolean resending) } WRITEUINT32(save->p, player->score); - WRITEFIXED(save->p, player->dashspeed); - WRITEINT32(save->p, player->dashtime); + WRITEFIXED(save->p, 0); //player->dashspeed + WRITEINT32(save->p, 0); //player->dashtime WRITESINT8(save->p, player->lives); WRITESINT8(save->p, player->continues); - WRITESINT8(save->p, player->xtralife); - WRITEUINT8(save->p, player->gotcontinue); + WRITESINT8(save->p, 0); //player->xtralife + WRITEUINT8(save->p, 0); //player->gotcontinue WRITEFIXED(save->p, player->speed); - WRITEUINT8(save->p, player->jumping); - WRITEUINT8(save->p, player->secondjump); - WRITEUINT8(save->p, player->fly1); - WRITEUINT8(save->p, player->scoreadd); - WRITEUINT32(save->p, player->glidetime); - WRITEUINT8(save->p, player->climbing); + WRITEUINT8(save->p, 0); //player->jumping + WRITEUINT8(save->p, 0); //player->secondjump + WRITEUINT8(save->p, 0); //player->fly1 + WRITEUINT8(save->p, 0); //player->scoreadd + WRITEUINT32(save->p, 0); //player->glidetime + WRITEUINT8(save->p, 0); //player->climbing WRITEINT32(save->p, player->deadtimer); WRITEUINT32(save->p, player->exiting); - WRITEUINT8(save->p, player->homing); - WRITEUINT32(save->p, player->skidtime); + WRITEUINT8(save->p, 0); //player->homing + WRITEUINT32(save->p, 0); //player->skidtime //////////////////////////// // Conveyor Belt Movement // @@ -192,7 +193,7 @@ static void P_NetArchivePlayers(savebuffer_t *save, boolean resending) ///////////////////// // Race Mode Stuff // ///////////////////// - WRITEINT16(save->p, player->numboxes); + WRITEINT16(save->p, 0); //player->numboxes WRITEINT16(save->p, player->totalring); WRITEUINT32(save->p, player->realtime); WRITEUINT8(save->p, player->laps); @@ -203,7 +204,7 @@ static void P_NetArchivePlayers(savebuffer_t *save, boolean resending) WRITEINT32(save->p, player->ctfteam); WRITEUINT16(save->p, player->gotflag); - WRITEINT32(save->p, player->weapondelay); + WRITEINT32(save->p, 0); //player->weapondelay WRITEINT32(save->p, player->tossdelay); WRITEUINT32(save->p, player->starposttime); @@ -213,50 +214,43 @@ static void P_NetArchivePlayers(savebuffer_t *save, boolean resending) WRITEINT32(save->p, player->starpostnum); WRITEANGLE(save->p, player->starpostangle); - WRITEANGLE(save->p, player->angle_pos); - WRITEANGLE(save->p, player->old_angle_pos); + WRITEANGLE(save->p, 0); //player->angle_pos + WRITEANGLE(save->p, 0); //player->old_angle_pos WRITEINT32(save->p, player->flyangle); - WRITEUINT32(save->p, player->drilltimer); + WRITEUINT32(save->p, 0); //player->drilltimer WRITEINT32(save->p, player->linkcount); WRITEUINT32(save->p, player->linktimer); - WRITEINT32(save->p, player->anotherflyangle); + WRITEINT32(save->p, 0); //player->anotherflyangle WRITEUINT32(save->p, player->nightstime); WRITEUINT32(save->p, player->bumpertime); - WRITEINT32(save->p, player->drillmeter); - WRITEUINT8(save->p, player->drilldelay); - WRITEUINT8(save->p, player->bonustime); + WRITEINT32(save->p, 0); //player->drillmeter + WRITEUINT8(save->p, 0); //player->drilldelay + WRITEUINT8(save->p, 0); // player->bonustime WRITEUINT8(save->p, player->mare); - WRITEUINT32(save->p, player->marebegunat); - WRITEUINT32(save->p, player->startedtime); - WRITEUINT32(save->p, player->finishedtime); - WRITEINT16(save->p, player->finishedrings); - WRITEUINT32(save->p, player->marescore); - WRITEUINT32(save->p, player->lastmarescore); - WRITEUINT8(save->p, player->lastmare); - WRITEINT32(save->p, player->maxlink); - WRITEUINT8(save->p, player->texttimer); - WRITEUINT8(save->p, player->textvar); + WRITEUINT32(save->p, 0); // player->marebegunat + WRITEUINT32(save->p, 0); // player->startedtime + WRITEUINT32(save->p, 0); // player->finishedtime + WRITEINT16(save->p, 0); // player->finishedrings - if (player->capsule) - flags |= CAPSULE; + WRITEUINT32(save->p, player->marescore); + + WRITEUINT32(save->p,0); // player->lastmarescore + WRITEUINT8(save->p, 0); // player->lastmare + WRITEINT32(save->p, 0); // player->maxlink + WRITEUINT8(save->p, 0); // player->texttimer + WRITEUINT8(save->p, 0); // player->textvar if (player->awayviewmobj) flags |= AWAYVIEW; - if (player->axis1) - flags |= FIRSTAXIS; + WRITEINT16(save->p, 0); //player->lastsidehit + WRITEINT16(save->p, 0); //player->lastlinehit - if (player->axis2) - flags |= SECONDAXIS; + WRITEUINT32(save->p, 0); // player->losstime - WRITEINT16(save->p, player->lastsidehit); - WRITEINT16(save->p, player->lastlinehit); - - WRITEUINT32(save->p, player->losstime); - - WRITEUINT8(save->p, player->timeshit); + WRITEUINT8(save->p, 0); //player->timeshit WRITEINT32(save->p, player->onconveyor); @@ -270,19 +264,11 @@ static void P_NetArchivePlayers(savebuffer_t *save, boolean resending) WRITEUINT16(save->p, flags); - if (flags & CAPSULE) - WRITEUINT32(save->p, player->capsule->mobjnum); - - if (flags & FIRSTAXIS) - WRITEUINT32(save->p, player->axis1->mobjnum); - - if (flags & SECONDAXIS) - WRITEUINT32(save->p, player->axis2->mobjnum); - if (flags & AWAYVIEW) WRITEUINT32(save->p, player->awayviewmobj->mobjnum); - WRITEUINT32(save->p, player->charflags); + WRITEUINT32(save->p, 0); // player->charflags + // SRB2kart WRITEUINT8(save->p, player->kartspeed); WRITEUINT8(save->p, player->kartweight); @@ -330,8 +316,9 @@ static void P_NetUnArchivePlayers(savebuffer_t *save, boolean reloading) player->awayviewtics = READINT32(save->p); player->health = READINT32(save->p); - player->pity = READSINT8(save->p); - player->currentweapon = READINT32(save->p); + save->p += sizeof(SINT8); // player->pity + save->p += sizeof(INT32); // player->currentweapon + player->ringweapons = READINT32(save->p); for (j = 0; j < NUMPOWERS; j++) @@ -356,23 +343,23 @@ static void P_NetUnArchivePlayers(savebuffer_t *save, boolean reloading) } player->score = READUINT32(save->p); - player->dashspeed = READFIXED(save->p); // dashing speed - player->dashtime = READINT32(save->p); // dashing speed + save->p += sizeof(fixed_t); // player->dashspeed + save->p += sizeof(INT32); // player->dashtime player->lives = READSINT8(save->p); player->continues = READSINT8(save->p); // continues that player has acquired - player->xtralife = READSINT8(save->p); // Ring Extra Life counter - player->gotcontinue = READUINT8(save->p); // got continue from stage + save->p += sizeof(SINT8); // player->xtralife + save->p += sizeof(UINT8); // player->gotcontinue player->speed = READFIXED(save->p); // Player's speed (distance formula of MOMX and MOMY values) - player->jumping = READUINT8(save->p); // Jump counter - player->secondjump = READUINT8(save->p); - player->fly1 = READUINT8(save->p); // Tails flying - player->scoreadd = READUINT8(save->p); // Used for multiple enemy attack bonus - player->glidetime = READUINT32(save->p); // Glide counter for thrust - player->climbing = READUINT8(save->p); // Climbing on the wall + save->p += sizeof(UINT8); // player->jumping + save->p += sizeof(UINT8); // player->secondjump + save->p += sizeof(UINT8); // player->fly1 + save->p += sizeof(UINT8); // player->scoreadd + save->p += sizeof(UINT32); // player->glidetime + save->p += sizeof(UINT8); // player->climbing player->deadtimer = READINT32(save->p); // End game if game over lasts too long player->exiting = READUINT32(save->p); // Exitlevel timer - player->homing = READUINT8(save->p); // Are you homing? - player->skidtime = READUINT32(save->p); // Skid timer + save->p += sizeof(UINT8); // player->homing + save->p += sizeof(UINT32); // player->skidtime //////////////////////////// // Conveyor Belt Movement // @@ -385,7 +372,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save, boolean reloading) ///////////////////// // Race Mode Stuff // ///////////////////// - player->numboxes = READINT16(save->p); // Number of item boxes obtained for Race Mode + save->p += sizeof(INT16); // player->numboxes player->totalring = READINT16(save->p); // Total number of rings obtained for Race Mode player->realtime = READUINT32(save->p); // integer replacement for leveltime player->laps = READUINT8(save->p); // Number of laps (optional) @@ -396,7 +383,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save, boolean reloading) player->ctfteam = READINT32(save->p); // 1 == Red, 2 == Blue player->gotflag = READUINT16(save->p); // 1 == Red, 2 == Blue Do you have the flag? - player->weapondelay = READINT32(save->p); + save->p += sizeof(INT32); // player->weapondelay player->tossdelay = READINT32(save->p); player->starposttime = READUINT32(save->p); @@ -406,38 +393,37 @@ static void P_NetUnArchivePlayers(savebuffer_t *save, boolean reloading) player->starpostnum = READINT32(save->p); player->starpostangle = READANGLE(save->p); - player->angle_pos = READANGLE(save->p); - player->old_angle_pos = READANGLE(save->p); + save->p += sizeof(angle_t); // player->angle_pos + save->p += sizeof(angle_t); // player->old_angle_pos player->flyangle = READINT32(save->p); - player->drilltimer = READUINT32(save->p); + save->p += sizeof(UINT32); // player->drilltimer player->linkcount = READINT32(save->p); player->linktimer = READUINT32(save->p); - player->anotherflyangle = READINT32(save->p); + save->p += sizeof(INT32); // player->anotherflyangle player->nightstime = READUINT32(save->p); player->bumpertime = READUINT32(save->p); - player->drillmeter = READINT32(save->p); - player->drilldelay = READUINT8(save->p); - player->bonustime = (boolean)READUINT8(save->p); + save->p += sizeof(INT32); // player->drillmeter + save->p += sizeof(UINT8); // player->drilldelay + save->p += sizeof(UINT8); // player->bonustime player->mare = READUINT8(save->p); - player->marebegunat = READUINT32(save->p); - player->startedtime = READUINT32(save->p); - player->finishedtime = READUINT32(save->p); - player->finishedrings = READINT16(save->p); + save->p += sizeof(UINT32); // player->marebegunat + save->p += sizeof(UINT32); // player->startedtime + save->p += sizeof(UINT32); // player->finishedtime + save->p += sizeof(INT16); // player->finishedrings + player->marescore = READUINT32(save->p); - player->lastmarescore = READUINT32(save->p); - player->lastmare = READUINT8(save->p); - player->maxlink = READINT32(save->p); - player->texttimer = READUINT8(save->p); - player->textvar = READUINT8(save->p); - player->lastsidehit = READINT16(save->p); - player->lastlinehit = READINT16(save->p); - - player->losstime = READUINT32(save->p); - - player->timeshit = READUINT8(save->p); + save->p += sizeof(UINT32); // player->lastmarescore + save->p += sizeof(UINT8); // player->lastmare + save->p += sizeof(INT32); // player->maxlink + save->p += sizeof(UINT8); // player->texttimer + save->p += sizeof(UINT8); // player->textvar + save->p += sizeof(INT16); // player->lastsidehit + save->p += sizeof(INT16); // player->lastlinehit + save->p += sizeof(UINT32); // player->losstime + save->p += sizeof(UINT8); // player->timeshit player->onconveyor = READINT32(save->p); @@ -451,22 +437,14 @@ static void P_NetUnArchivePlayers(savebuffer_t *save, boolean reloading) flags = READUINT16(save->p); - if (flags & CAPSULE) - player->capsule = (mobj_t *)(size_t)READUINT32(save->p); - - if (flags & FIRSTAXIS) - player->axis1 = (mobj_t *)(size_t)READUINT32(save->p); - - if (flags & SECONDAXIS) - player->axis2 = (mobj_t *)(size_t)READUINT32(save->p); - if (flags & AWAYVIEW) player->awayviewmobj = (mobj_t *)(size_t)READUINT32(save->p); player->viewheight = 32<skin); - player->charflags = READUINT32(save->p); + save->p += sizeof(UINT32); // player->charflags + // SRB2kart player->kartspeed = READUINT8(save->p); player->kartweight = READUINT8(save->p); @@ -3211,9 +3189,6 @@ static void P_RelinkPointers(void) if (player) { - RELINK(player->capsule, "capsule"); - RELINK(player->axis1, "axis1"); - RELINK(player->axis2, "axis2"); RELINK(player->awayviewmobj, "awayviewmobj"); } #undef RELINK @@ -3388,7 +3363,7 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending) WRITEUINT8(save->p, encoremode); WRITEUINT32(save->p, leveltime); - WRITEUINT32(save->p, totalrings); + WRITEUINT32(save->p, 0); // totalrings WRITEINT16(save->p, lastmap); for (i = 0; i < 4; i++) @@ -3602,7 +3577,7 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(savebuffer_t *save, bool // get the time leveltime = READUINT32(save->p); - totalrings = READUINT32(save->p); + save->p += sizeof(UINT32); // totalrings lastmap = READINT16(save->p); for (i = 0; i < 4; i++) diff --git a/src/p_setup.c b/src/p_setup.c index 4e39408ea..0dd98e73e 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2071,7 +2071,6 @@ static void P_LevelInitStuff(boolean reloadinggamestate) // circuit, race and competition stuff circuitmap = false; numstarposts = 0; - totalrings = 0; if (!reloadinggamestate) timeinmap = 0; @@ -2101,28 +2100,17 @@ static void P_LevelInitStuff(boolean reloadinggamestate) player->driftsparkGrowTimer = 0; - player->gotcontinue = false; - - player->xtralife = player->deadtimer = player->numboxes = player->totalring = player->laps = 0; + player->deadtimer = player->totalring = player->laps = 0; player->health = 1; player->aiming = 0; player->pflags &= ~PF_TIMEOVER; - player->losstime = 0; - player->timeshit = 0; - - player->marescore = player->lastmarescore = player->maxlink = 0; - player->startedtime = player->finishedtime = player->finishedrings = 0; - player->lastmare = player->marebegunat = 0; - - // Don't show anything - player->textvar = player->texttimer = 0; + player->marescore = 0; player->linkcount = player->linktimer = 0; - player->flyangle = player->anotherflyangle = 0; + + player->flyangle = 0; player->nightstime = player->mare = 0; - P_SetTarget(&player->capsule, NULL); - player->drillmeter = 40*20; player->exiting = 0; P_ResetPlayer(player); @@ -2130,12 +2118,6 @@ static void P_LevelInitStuff(boolean reloadinggamestate) player->spectatorreentry = 0; // SRB2Kart 1.4 player->mo = NULL; - - // we must unset axis details too - player->axis1 = player->axis2 = NULL; - - // and this stupid flag as a result - player->pflags &= ~PF_TRANSFERTOCLOSEST; } // SRB2Kart: map load variables @@ -2565,11 +2547,6 @@ static void P_SetupPlayer(void) { if (playeringame[i]) { - players[i].pflags &= ~PF_NIGHTSMODE; - - // Start players with pity shields if possible - players[i].pity = -1; - if (!G_RaceGametype()) { players[i].mo = NULL; diff --git a/src/p_slopes.c b/src/p_slopes.c index b3f4592d6..5b2d61a58 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -950,8 +950,8 @@ void P_ButteredSlope(mobj_t *mo) { const int zeedelta = abs(mo->standingslope->zdelta); - if (zeedelta < FRACUNIT/4 && !(mo->player->pflags & PF_SPINNING)) - return; // Don't slide on non-steep slopes unless spinning + if (zeedelta < FRACUNIT/4) + return; // Don't slide on non-steep slopes if (zeedelta < FRACUNIT/2 && !(mo->player->rmomx || mo->player->rmomy)) return; // Allow the player to stand still on slopes below a certain steepness @@ -959,23 +959,6 @@ void P_ButteredSlope(mobj_t *mo) thrust = FINESINE(mo->standingslope->zangle>>ANGLETOFINESHIFT) * 15 / 16 * (mo->eflags & MFE_VERTICALFLIP ? 1 : -1); - if (mo->player && (mo->player->pflags & PF_SPINNING)) - { - fixed_t mult = 0; - - if (mo->momx || mo->momy) - { - angle_t angle = R_PointToAngle2(0, 0, mo->momx, mo->momy) - mo->standingslope->xydirection; - - if (P_MobjFlip(mo) * mo->standingslope->zdelta < 0) - angle ^= ANGLE_180; - - mult = FINECOSINE(angle >> ANGLETOFINESHIFT); - } - - thrust = FixedMul(thrust, FRACUNIT*2/3 + mult/8); - } - if (mo->momx || mo->momy) // Slightly increase thrust based on the object's speed thrust = FixedMul(thrust, FRACUNIT+P_AproxDistance(mo->momx, mo->momy)/16); // This makes it harder to zigzag up steep slopes, as well as allows greater top speed when rolling down diff --git a/src/p_spec.c b/src/p_spec.c index 8f1121062..f97a16c42 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3700,10 +3700,7 @@ DoneSection2: P_SetTarget(&player->mo->tracer, waypoint); player->speed = speed; - player->pflags &= ~PF_SPINNING; // SRB2kart 200117 player->pflags &= ~PF_JUMPED; - player->pflags &= ~PF_GLIDING; - player->climbing = 0; if (!(player->mo->state >= &states[S_KART_RUN1] && player->mo->state <= &states[S_KART_RUN2])) P_SetPlayerMobjState(player->mo, S_KART_RUN1); @@ -3773,7 +3770,6 @@ DoneSection2: P_SetTarget(&player->mo->tracer, waypoint); player->speed = speed; - player->pflags &= ~PF_SPINNING; // SRB2kart 200117 player->pflags &= ~PF_JUMPED; if (!(player->mo->state >= &states[S_KART_RUN1] && player->mo->state <= &states[S_KART_RUN2])) @@ -3820,9 +3816,6 @@ DoneSection2: player->kartstuff[k_lapanimation] = 80; - if (UNLIKELY(player->pflags & PF_NIGHTSMODE)) - player->drillmeter += 48*20; - if (netgame && player->laps >= (UINT8)cv_numlaps.value) CON_LogMessage(va(M_GetText("%s has finished the race.\n"), player_names[player-players])); @@ -4143,9 +4136,8 @@ DoneSection2: S_StartSound(player->mo, sfx_s3k4a); player->pflags &= ~PF_JUMPED; - player->pflags &= ~PF_GLIDING; player->pflags &= ~PF_SLIDING; - player->climbing = 0; + P_SetThingPosition(player->mo); //P_SetPlayerMobjState(player->mo, S_PLAY_CARRY); // SRB2kart } @@ -5249,7 +5241,6 @@ void P_SpawnSpecials(INT32 fromnetsave, boolean reloadinggamestate) // Defaults in case levels don't have them set. sstimer = 90*TICRATE + 6; - totalrings = 1; CheckForBustableBlocks = CheckForBouncySector = CheckForQuicksand = CheckForMarioBlocks = CheckForFloatBob = CheckForReverseGravity = false; @@ -5277,7 +5268,6 @@ void P_SpawnSpecials(INT32 fromnetsave, boolean reloadinggamestate) { case 10: // Time for special stage sstimer = (sector->floorheight>>FRACBITS) * TICRATE + 6; // Time to finish - totalrings = sector->ceilingheight>>FRACBITS; // Ring count for special stage break; case 11: // Custom global gravity! @@ -6290,9 +6280,7 @@ static void P_DoScrollMove(mobj_t *thing, fixed_t dx, fixed_t dy, INT32 exclusiv } } - if (thing->player && (thing->player->pflags & PF_SPINNING) && (thing->player->rmomx || thing->player->rmomy) && !(thing->player->pflags & PF_STARTDASH)) - fuckaj = FixedDiv(549*ORIG_FRICTION,500*FRACUNIT); - else if (thing->friction != ORIG_FRICTION) + if (thing->friction != ORIG_FRICTION) fuckaj = thing->friction; if (fuckaj) @@ -7031,7 +7019,7 @@ static inline boolean PIT_PushThing(mobj_t *thing) return false; // Allow this to affect pushable objects at some point? - if (thing->player && (!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP)) || UNLIKELY(thing->player->pflags & PF_NIGHTSMODE))) + if (thing->player && (!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP)))) { INT32 dist; INT32 speed; @@ -7062,75 +7050,14 @@ static inline boolean PIT_PushThing(mobj_t *thing) // Written with bits and pieces of P_HomingAttack if ((speed > 0) && (P_CheckSight(thing, tmpusher->source))) { - if (LIKELY(!(thing->player->pflags & PF_NIGHTSMODE))) + // only push wrt Z if health & 1 (mapthing has ambush flag) + if (tmpusher->source->health & 1) { - // only push wrt Z if health & 1 (mapthing has ambush flag) - if (tmpusher->source->health & 1) - { - fixed_t tmpmomx, tmpmomy, tmpmomz; - - tmpmomx = FixedMul(FixedDiv(sx - thing->x, dist), speed); - tmpmomy = FixedMul(FixedDiv(sy - thing->y, dist), speed); - tmpmomz = FixedMul(FixedDiv(sz - thing->z, dist), speed); - if (tmpusher->source->type == MT_PUSH) // away! - { - tmpmomx *= -1; - tmpmomy *= -1; - tmpmomz *= -1; - } - - thing->momx += tmpmomx; - thing->momy += tmpmomy; - thing->momz += tmpmomz; - - if (thing->player) - { - thing->player->cmomx += tmpmomx; - thing->player->cmomy += tmpmomy; - thing->player->cmomx = FixedMul(thing->player->cmomx, ORIG_FRICTION); - thing->player->cmomy = FixedMul(thing->player->cmomy, ORIG_FRICTION); - } - } - else - { - angle_t pushangle; - - pushangle = R_PointToAngle2(thing->x, thing->y, sx, sy); - if (tmpusher->source->type == MT_PUSH) - pushangle += ANGLE_180; // away - pushangle >>= ANGLETOFINESHIFT; - thing->momx += FixedMul(speed, FINECOSINE(pushangle)); - thing->momy += FixedMul(speed, FINESINE(pushangle)); - - if (thing->player) - { - thing->player->cmomx += FixedMul(speed, FINECOSINE(pushangle)); - thing->player->cmomy += FixedMul(speed, FINESINE(pushangle)); - thing->player->cmomx = FixedMul(thing->player->cmomx, ORIG_FRICTION); - thing->player->cmomy = FixedMul(thing->player->cmomy, ORIG_FRICTION); - } - } - } - else - { - //NiGHTS-specific handling. - //By default, pushes and pulls only affect the Z-axis. - //By having the ambush flag, it affects the X-axis. - //By having the object special flag, it affects the Y-axis. fixed_t tmpmomx, tmpmomy, tmpmomz; - if (tmpusher->source->health & 1) - tmpmomx = FixedMul(FixedDiv(sx - thing->x, dist), speed); - else - tmpmomx = 0; - - if (tmpusher->source->health & 2) - tmpmomy = FixedMul(FixedDiv(sy - thing->y, dist), speed); - else - tmpmomy = 0; - + tmpmomx = FixedMul(FixedDiv(sx - thing->x, dist), speed); + tmpmomy = FixedMul(FixedDiv(sy - thing->y, dist), speed); tmpmomz = FixedMul(FixedDiv(sz - thing->z, dist), speed); - if (tmpusher->source->type == MT_PUSH) // away! { tmpmomx *= -1; @@ -7150,6 +7077,25 @@ static inline boolean PIT_PushThing(mobj_t *thing) thing->player->cmomy = FixedMul(thing->player->cmomy, ORIG_FRICTION); } } + else + { + angle_t pushangle; + + pushangle = R_PointToAngle2(thing->x, thing->y, sx, sy); + if (tmpusher->source->type == MT_PUSH) + pushangle += ANGLE_180; // away + pushangle >>= ANGLETOFINESHIFT; + thing->momx += FixedMul(speed, FINECOSINE(pushangle)); + thing->momy += FixedMul(speed, FINESINE(pushangle)); + + if (thing->player) + { + thing->player->cmomx += FixedMul(speed, FINECOSINE(pushangle)); + thing->player->cmomy += FixedMul(speed, FINESINE(pushangle)); + thing->player->cmomx = FixedMul(thing->player->cmomx, ORIG_FRICTION); + thing->player->cmomy = FixedMul(thing->player->cmomy, ORIG_FRICTION); + } + } } } diff --git a/src/p_user.c b/src/p_user.c index b62847a4c..a473690a9 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -193,8 +193,8 @@ boolean P_PlayerMoving(INT32 pnum) && (abs(p->rmomx) >= FixedMul(FRACUNIT/2, p->mo->scale) || abs(p->rmomy) >= FixedMul(FRACUNIT/2, p->mo->scale) || abs(p->mo->momz) >= FixedMul(FRACUNIT/2, p->mo->scale) - || p->climbing || p->powers[pw_tailsfly] - || (p->pflags & PF_JUMPED) || (p->pflags & PF_SPINNING)); + || p->powers[pw_tailsfly] + || (p->pflags & PF_JUMPED)); } // P_GetNextEmerald @@ -246,16 +246,6 @@ void P_GiveEmerald(boolean spawnObj) } } -// -// P_ResetScore -// -// This is called when your chain is reset. -void P_ResetScore(player_t *player) -{ - // Formally a host for Chaos mode behavior - player->scoreadd = 0; -} - // // P_FindLowestLap // @@ -398,9 +388,6 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) P_ResetPlayer(player); P_SetPlayerMobjState(player->mo, player->mo->info->painstate); player->powers[pw_flashing] = K_GetKartFlashing(player); - - if (player->timeshit != UINT8_MAX) - ++player->timeshit; } // @@ -409,15 +396,9 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) // Useful when you want to kill everything the player is doing. void P_ResetPlayer(player_t *player) { - player->pflags &= ~(PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN|PF_SPINNING|PF_JUMPED|PF_GLIDING|PF_THOKKED|PF_CARRIED); - player->jumping = 0; - player->secondjump = 0; - player->glidetime = 0; - player->homing = 0; - player->climbing = 0; + player->pflags &= ~(PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN|PF_JUMPED|PF_THOKKED|PF_CARRIED); player->powers[pw_tailsfly] = 0; player->onconveyor = 0; - player->skidtime = 0; } // @@ -434,8 +415,6 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings) if (!player->mo) return; - //player->mo->health += num_rings; - //player->health += num_rings; player->totalring += num_rings; //{ SRB2kart - rings don't really do anything, but we don't want the player spilling them later. @@ -1425,16 +1404,14 @@ static void P_CheckBustableBlocks(player_t *player) { // If it's an FF_SPINBUST, you have to either be jumping, or coming down // onto the top from a spin. - if (rover->flags & FF_SPINBUST && ((!(player->pflags & PF_JUMPED) && !(player->pflags & PF_SPINNING)) || (player->pflags & PF_STARTDASH))) + if (rover->flags & FF_SPINBUST && !(player->pflags & PF_JUMPED)) continue; // if it's not an FF_SHATTER, you must be spinning (and not jumping) // or have Knuckles's abilities (or Super Sonic) // ...or are drilling in NiGHTS (or Metal Sonic) if (!(rover->flags & FF_SHATTER) && !(rover->flags & FF_SPINBUST) - && !((player->pflags & PF_SPINNING) && !(player->pflags & PF_JUMPED)) - && (!player->powers[pw_super]) - && !(player->pflags & PF_DRILLING)) + && (!player->powers[pw_super])) continue; topheight = P_GetFOFTopZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL); @@ -1606,31 +1583,11 @@ static void P_CheckBouncySectors(player_t *player) player->mo->momx = momentum.x; player->mo->momy = momentum.y; player->mo->momz = momentum.z/2; - - if (player->pflags & PF_SPINNING) - { - player->pflags &= ~PF_SPINNING; - player->pflags |= PF_JUMPED; - player->pflags |= PF_THOKKED; - } } else { player->mo->momx = -FixedMul(player->mo->momx,linedist); player->mo->momy = -FixedMul(player->mo->momy,linedist); - - if (player->pflags & PF_SPINNING) - { - player->pflags &= ~PF_SPINNING; - player->pflags |= PF_JUMPED; - player->pflags |= PF_THOKKED; - } - } - - if ((player->pflags & PF_SPINNING) && player->speed < FixedMul(1<mo->scale) && player->mo->momz) - { - player->pflags &= ~PF_SPINNING; - player->pflags |= PF_JUMPED; } goto bouncydone; @@ -1742,7 +1699,7 @@ static void P_DoBubbleBreath(player_t *player) else zh = player->mo->z + FixedDiv(player->mo->height,5*(FRACUNIT/4)); - if (!(player->mo->eflags & MFE_UNDERWATER) || player->spectator || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE))) + if (!(player->mo->eflags & MFE_UNDERWATER) || player->spectator || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)) return; if (P_RandomChance(FRACUNIT/16)) @@ -1822,10 +1779,7 @@ void P_DoJumpShield(player_t *player) player->pflags &= ~PF_JUMPED; //P_DoJump(player, false); - player->secondjump = 0; - player->jumping = 0; player->pflags |= PF_THOKKED; - player->pflags &= ~PF_SPINNING; //P_SetPlayerMobjState(player->mo, S_PLAY_FALL1); S_StartSound(player->mo, sfx_wdjump); } @@ -1914,7 +1868,7 @@ static void P_3dMovement(player_t *player) cmd->forwardmove = 50; } - if (!(player->pflags & PF_FORCESTRAFE) && !player->kartstuff[k_pogospring]) + if (!player->kartstuff[k_pogospring]) cmd->sidemove = 0; if (analogmove) @@ -2206,8 +2160,6 @@ static void P_MovePlayer(player_t *player) // Control relinquishing stuff! if (player->powers[pw_ingoop]) player->pflags |= PF_FULLSTASIS; - else if (player->pflags & PF_GLIDING && player->skidtime) - player->pflags |= PF_FULLSTASIS; else if (player->powers[pw_nocontrol]) { player->pflags |= PF_STASIS; @@ -2233,8 +2185,6 @@ static void P_MovePlayer(player_t *player) if (!(player->pflags & PF_TAGIT)) { forcestasis = true; - if (player->pflags & PF_TAGGED) // Already hit. - player->powers[pw_flashing] = 5; } } @@ -2394,28 +2344,18 @@ static void P_MovePlayer(player_t *player) ////////////////// // Make sure you're not "jumping" on the ground - if (onground && player->pflags & PF_JUMPED && !(player->pflags & PF_GLIDING) + if (onground && player->pflags & PF_JUMPED && P_MobjFlip(player->mo)*player->mo->momz < 0) { player->pflags &= ~PF_JUMPED; - player->jumping = 0; - player->secondjump = 0; player->pflags &= ~PF_THOKKED; P_SetPlayerMobjState(player->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND } - if (UNLIKELY(player->gotflag)) // If you can't glide, then why the heck would you be gliding? - { - player->pflags &= ~PF_GLIDING; - player->glidetime = 0; - player->climbing = 0; - } - // If you're running fast enough, you can create splashes as you run in shallow water. - if (!player->climbing - && ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height >= player->mo->watertop && player->mo->z <= player->mo->watertop) + if (((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height >= player->mo->watertop && player->mo->z <= player->mo->watertop) || (player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height >= player->mo->waterbottom && player->mo->z <= player->mo->waterbottom)) - && (player->speed > runspd || (player->pflags & PF_STARTDASH)) + && (player->speed > runspd) && leveltime % (TICRATE/7) == 0 && player->mo->momz == 0 && !(player->pflags & PF_SLIDING) && !player->spectator) { mobj_t *water = P_SpawnMobj(player->mo->x, player->mo->y, @@ -3527,7 +3467,7 @@ static boolean P_CheckNoclipCameraPosition(player_t *player, camera_t *thiscam, boolean cameranoclip; mobj_t *mo = player->mo; - cameranoclip = ((player->pflags & (PF_NOCLIP|PF_NIGHTSMODE)) + cameranoclip = ((player->pflags & PF_NOCLIP) || (mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)) // Noclipping player camera noclips too!! || (leveltime < introtime)); // Kart intro cam @@ -4113,7 +4053,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall angle -= (angle - thiscam->pitch)/2; } - if (player->playerstate != PST_DEAD && LIKELY(!((player->pflags & PF_NIGHTSMODE) && player->exiting))) + if (player->playerstate != PST_DEAD) angle += (focusaiming < ANGLE_180 ? focusaiming/2 : InvAngle(InvAngle(focusaiming)/2)); // overcomplicated version of '((signed)focusaiming)/2;' if (!camstill && !timeover) // Keep the view still... @@ -4884,8 +4824,7 @@ void P_PlayerThink(player_t *player) } // Even if not NiGHTS, pull in nearby objects when walking around as John Q. Elliot. - if (UNLIKELY(!objectplacing && !((netgame || multiplayer) && player->spectator) - && maptol & TOL_NIGHTS && (!(player->pflags & PF_NIGHTSMODE) || player->powers[pw_nights_helper]))) + if (UNLIKELY(maptol & TOL_NIGHTS && !objectplacing && !((netgame || multiplayer) && player->spectator))) { thinker_t *th; mobj_t *mo2; @@ -4930,7 +4869,6 @@ void P_PlayerThink(player_t *player) { P_DoZoomTube(player); player->rmomx = player->rmomy = 0; // no actual momentum from your controls - P_ResetScore(player); } else { @@ -4987,26 +4925,10 @@ void P_PlayerThink(player_t *player) #endif // check for use - if (LIKELY(!(player->pflags & PF_NIGHTSMODE))) - { - if (cmd->buttons & BT_BRAKE) - player->pflags |= PF_USEDOWN; - else - player->pflags &= ~PF_USEDOWN; - } - else if (player->mo->tracer) // match tracer's position with yours when NiGHTS - { - P_UnsetThingPosition(player->mo->tracer); - player->mo->tracer->x = player->mo->x; - player->mo->tracer->y = player->mo->y; - if (player->mo->eflags & MFE_VERTICALFLIP) - player->mo->tracer->z = player->mo->z + player->mo->height - player->mo->tracer->height; - else - player->mo->tracer->z = player->mo->z; - player->mo->tracer->floorz = player->mo->floorz; - player->mo->tracer->ceilingz = player->mo->ceilingz; - P_SetThingPosition(player->mo->tracer); - } + if (cmd->buttons & BT_BRAKE) + player->pflags |= PF_USEDOWN; + else + player->pflags &= ~PF_USEDOWN; // Counters, time dependent power ups. // Time Bonus & Ring Bonus count settings @@ -5063,34 +4985,9 @@ void P_PlayerThink(player_t *player) if (player->bumpertime) player->bumpertime--; - if (player->skidtime) - player->skidtime--; - - if (player->weapondelay) - player->weapondelay--; - if (player->tossdelay) player->tossdelay--; - if (player->homing) - player->homing--; - - if (player->texttimer) - { - --player->texttimer; - if (!player->texttimer && !player->exiting && player->textvar >= 4) - { - player->texttimer = 4*TICRATE; - player->textvar = 2; // GET n RINGS! - - if (player->capsule && player->capsule->health != player->capsule->spawnpoint->angle) - player->textvar++; // GET n MORE RINGS! - } - } - - if (player->losstime && !player->powers[pw_flashing]) - player->losstime--; - if (cv_squishdance.value && (cmd->buttons & BT_CUSTOM3)) { player->squishdance.countdown++; @@ -5173,11 +5070,6 @@ void P_PlayerAfterThink(player_t *player) } } - if (UNLIKELY(player->pflags & PF_NIGHTSMODE)) - { - player->powers[pw_gravityboots] = 0; - } - if (player->pflags & PF_SLIDING) P_SetPlayerMobjState(player->mo, player->mo->info->painstate); @@ -5190,7 +5082,6 @@ void P_PlayerAfterThink(player_t *player) player->mo->momz = (player->mo->tracer->z - (player->mo->height-player->mo->tracer->height/2) - player->mo->z)*2; P_MoveOrigin(player->mo, player->mo->tracer->x, player->mo->tracer->y, player->mo->tracer->z - (player->mo->height-player->mo->tracer->height/2)); player->pflags |= PF_JUMPED; - player->secondjump = 0; player->pflags &= ~PF_THOKKED; if (cmd->forwardmove > 0) diff --git a/src/r_skins.c b/src/r_skins.c index 41971788c..42daf0763 100644 --- a/src/r_skins.c +++ b/src/r_skins.c @@ -338,8 +338,6 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum) if (player->mo) player->mo->skin = skin; - player->charflags = (UINT32)skin->flags; - // SRB2kart player->kartspeed = skin->kartspeed; player->kartweight = skin->kartweight;