diff --git a/src/doomstat.h b/src/doomstat.h index a9bd9bbac..80f86b974 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -542,7 +542,7 @@ extern mapthing_t *redctfstarts[MAXPLAYERS]; // CTF #else #define DEBUGFILE #ifdef DEBUGFILE -#define DEBFILE(msg) { if (debugfile) { fputs(msg, debugfile); fflush(debugfile); } } +#define DEBFILE(msg) { if (UNLIKELY(debugfile)) { fputs(msg, debugfile); fflush(debugfile); } } #else #define DEBFILE(msg) {} #endif diff --git a/src/k_kart.c b/src/k_kart.c index 201438234..767e041a1 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5179,6 +5179,24 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source) return wtarg; } +static INT32 K_GetEngineClass(const player_t *player) +{ + INT32 speed, weight; + + speed = (player->kartspeed - 1) / 3; + weight = (player->kartweight - 1) / 3; + +#define LOCKSTAT(stat) \ + if (stat < 0) { stat = 0; } \ + if (stat > 2) { stat = 2; } + LOCKSTAT(speed); + LOCKSTAT(weight); +#undef LOCKSTAT + + return (speed + (3*weight)); +} + + // Engine Sounds. static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd) { @@ -5189,7 +5207,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd) static const UINT8 dampenval = 48; // 255 * 48 = close enough to FRACUNIT/6 - INT32 class, s, w; // engine class number + INT32 class; // engine class number UINT8 volume = 255; fixed_t volumedampen = FRACUNIT; @@ -5225,7 +5243,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd) targetsnd = (((6 * cmd->forwardmove) / 25) + ((player->speed / mapobjectscale) / 5)) / 2; } - if (targetsnd < 0) { targetsnd = 0; } + if (targetsnd < 0) { targetsnd = 0; } if (targetsnd > 12) { targetsnd = 12; } if (player->kartstuff[k_enginesnd] < targetsnd) { player->kartstuff[k_enginesnd]++; } @@ -5302,17 +5320,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd) return; } - s = (player->kartspeed - 1) / 3; - w = (player->kartweight - 1) / 3; - -#define LOCKSTAT(stat) \ - if (stat < 0) { stat = 0; } \ - if (stat > 2) { stat = 2; } - LOCKSTAT(s); - LOCKSTAT(w); -#undef LOCKSTAT - - class = s + (3*w); + class = K_GetEngineClass(player); S_StartSoundAtVolume(player->mo, (sfx_krta00 + player->kartstuff[k_enginesnd]) + (class * numsnds), volume); } @@ -5731,7 +5739,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) K_UpdateInvincibilitySounds(player); // Also thanks, VAda! // Plays the music during and after the starting countdown. - if (P_IsLocalPlayer(player)) + if ((leveltime <= MUSICSTARTTIME) && P_IsLocalPlayer(player)) S_StartMapMusic(); } @@ -5911,45 +5919,33 @@ static void K_KartDrift(player_t *player, boolean onground) // Holding the Jump button will enable drifting. // Drift Release (Moved here so you can't "chain" drifts) - if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5) - // || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1)) - && player->kartstuff[k_driftcharge] < dsone - && onground) + if (onground && player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5) { - player->kartstuff[k_driftcharge] = 0; - } - else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5) - // || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1)) - && (player->kartstuff[k_driftcharge] >= dsone && player->kartstuff[k_driftcharge] < dstwo) - && onground) - { - if (player->kartstuff[k_driftboost] < 20) - player->kartstuff[k_driftboost] = 20; - S_StartSound(player->mo, sfx_s23c); - //K_SpawnDashDustRelease(player); - player->kartstuff[k_driftcharge] = 0; - } - else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5) - // || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1)) - && player->kartstuff[k_driftcharge] < dsthree - && onground) - { - if (player->kartstuff[k_driftboost] < 50) - player->kartstuff[k_driftboost] = 50; - S_StartSound(player->mo, sfx_s23c); - //K_SpawnDashDustRelease(player); - player->kartstuff[k_driftcharge] = 0; - } - else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5) - // || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1)) - && player->kartstuff[k_driftcharge] >= dsthree - && onground) - { - if (player->kartstuff[k_driftboost] < 125) - player->kartstuff[k_driftboost] = 125; - S_StartSound(player->mo, sfx_s23c); - //K_SpawnDashDustRelease(player); - player->kartstuff[k_driftcharge] = 0; + if (player->kartstuff[k_driftcharge] < dsone) + { + player->kartstuff[k_driftcharge] = 0; + } + else if (player->kartstuff[k_driftcharge] >= dsone && player->kartstuff[k_driftcharge] < dstwo) + { + if (player->kartstuff[k_driftboost] < 20) + player->kartstuff[k_driftboost] = 20; + S_StartSound(player->mo, sfx_s23c); + player->kartstuff[k_driftcharge] = 0; + } + else if (player->kartstuff[k_driftcharge] < dsthree) + { + if (player->kartstuff[k_driftboost] < 50) + player->kartstuff[k_driftboost] = 50; + S_StartSound(player->mo, sfx_s23c); + player->kartstuff[k_driftcharge] = 0; + } + else if (player->kartstuff[k_driftcharge] >= dsthree) + { + if (player->kartstuff[k_driftboost] < 125) + player->kartstuff[k_driftboost] = 125; + S_StartSound(player->mo, sfx_s23c); + player->kartstuff[k_driftcharge] = 0; + } } // Drifting: left or right? @@ -6027,8 +6023,8 @@ static void K_KartDrift(player_t *player, boolean onground) // Sound whenever you get a different tier of sparks if (driftblue - || driftred - || driftrainbow) + || driftred + || driftrainbow) { //S_StartSound(player->mo, sfx_s3ka2); if (P_IsLocalPlayer(player)) // UGHGHGH... diff --git a/src/p_mobj.h b/src/p_mobj.h index 781b86390..38bbe2e37 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -285,7 +285,7 @@ typedef struct mobj_s // Info for drawing: position. fixed_t x, y, z; fixed_t old_x, old_y, old_z; // position interpolation - fixed_t old_x2, old_y2, old_z2; + fixed_t old_z2; // ok guess we need that... // More list: links in sector (if needed) struct mobj_s *bnext; @@ -297,7 +297,6 @@ typedef struct mobj_s // More drawing info: to determine current sprite. angle_t angle, pitch, roll; // orientation angle_t old_angle, old_pitch, old_roll; // orientation interpolation - angle_t old_angle2, old_pitch2, old_roll2; angle_t rollangle; spritenum_t sprite; // used to find patch_t and flip value UINT32 frame; // frame number, plus bits see p_pspr.h @@ -307,9 +306,7 @@ typedef struct mobj_s fixed_t spritexscale, spriteyscale; fixed_t spritexoffset, spriteyoffset; fixed_t old_spritexscale, old_spriteyscale; - fixed_t old_spritexscale2, old_spriteyscale2; fixed_t old_spritexoffset, old_spriteyoffset; - fixed_t old_spritexoffset2, old_spriteyoffset2; INT16 lightlevel; // Add to sector lightlevel, -255 - 255 fixed_t realxscale, realyscale; // funn-E streeetch @@ -320,7 +317,6 @@ typedef struct mobj_s //sloperollangle angle_t sloperoll, slopepitch; angle_t old_sloperoll, old_slopepitch; - angle_t old_sloperoll2, old_slopepitch2; angle_t pitch_sprite, roll_sprite; struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears @@ -395,7 +391,6 @@ typedef struct mobj_s fixed_t scale; fixed_t old_scale; // interpolation - fixed_t old_scale2; fixed_t destscale; fixed_t scalespeed; diff --git a/src/p_setup.c b/src/p_setup.c index a04751ac9..bf40afe9d 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -680,11 +680,11 @@ INT32 P_AddLevelFlat(const char *flatname, levelflat_t *levelflat) if (i == numlevelflats) { // store the name - strlcpy(levelflat->name, flatname, sizeof (levelflat->name)); + strlcpy(levelflat->name, flatname, sizeof(levelflat->name)); strupr(levelflat->name); // store the flat lump number - levelflat->lumpnum = R_GetFlatNumForName(flatname); + levelflat->lumpnum = R_GetFlatNumForName(levelflat->name); levelflat->baselumpnum = LUMPERROR; P_CheckCyanFlat(levelflat); @@ -727,11 +727,11 @@ INT32 P_AddLevelFlatRuntime(const char *flatname) levelflat = levelflats+i; // store the name - strlcpy(levelflat->name, flatname, sizeof (levelflat->name)); + strlcpy(levelflat->name, flatname, sizeof(levelflat->name)); strupr(levelflat->name); // store the flat lump number - levelflat->lumpnum = R_GetFlatNumForName(flatname); + levelflat->lumpnum = R_GetFlatNumForName(levelflat->name); levelflat->baselumpnum = LUMPERROR; P_CheckCyanFlat(levelflat); diff --git a/src/p_spec.c b/src/p_spec.c index 7cf2694d0..66901d234 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -53,7 +53,7 @@ mobj_t *skyboxmo[2] = {}; #define MAXFLATSIZE (2048<speed = animdefs[i].speed; - else - lastanim->speed = LONG(animdefs[i].speed); + lastanim->speed = LONG(animdefs[i].speed); lastanim++; } @@ -330,8 +226,7 @@ void P_InitPicAnims(void) // Clear animdefs now that we're done with it. // We'll only be using anims from now on. - if (animdefs != harddefs) - Z_Free(animdefs); + Z_Free(animdefs); animdefs = NULL; } diff --git a/src/p_user.c b/src/p_user.c index 448a2ff8c..2a3ccc300 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -78,7 +78,6 @@ void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move) mo->momy += FixedMul(move, FINESINE(angle)); } - // // P_InstaThrust // Moves the given origin along a given angle instantly. @@ -239,10 +238,11 @@ void P_GiveEmerald(boolean spawnObj) if (spawnObj) { for (i = 0; i < MAXPLAYERS; i++) + { if (playeringame[i]) P_SetMobjState(P_SpawnMobj(players[i].mo->x, players[i].mo->y, players[i].mo->z + players[i].mo->info->height, MT_GOTEMERALD), mobjinfo[MT_GOTEMERALD].spawnstate + em); - + } } } @@ -352,9 +352,9 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) player->mo->z++; if (player->mo->eflags & MFE_UNDERWATER) - P_SetObjectMomZ(player->mo, FixedDiv(10511*FRACUNIT,2600*FRACUNIT), false); + P_SetObjectMomZ(player->mo, FixedDiv(10511*FRACUNIT, 2600*FRACUNIT), false); else - P_SetObjectMomZ(player->mo, FixedDiv(69*FRACUNIT,10*FRACUNIT), false); + P_SetObjectMomZ(player->mo, FixedDiv(69*FRACUNIT, 10*FRACUNIT), false); } ang = R_PointToAngle2(inflictor->x, inflictor->y, player->mo->x, player->mo->y); // SRB2kart @@ -619,11 +619,11 @@ boolean P_EndingMusic(player_t *player) // Check for if this is valid or not if (splitscreen) { - if (!((players[displayplayers[0]].exiting || (players[displayplayers[0]].pflags & PF_TIMEOVER)) - || (players[displayplayers[1]].exiting || (players[displayplayers[1]].pflags & PF_TIMEOVER)) - || ((splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_TIMEOVER))) - || ((splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_TIMEOVER))))) - return false; + for (UINT8 i = 0; i <= splitscreen; i++) + { + if (!(players[displayplayers[i]].exiting || (players[displayplayers[i]].pflags & PF_TIMEOVER))) + return false; + } bestlocalplayer = &players[displayplayers[0]]; bestlocalpos = ((players[displayplayers[0]].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : getPlayerPos(&players[displayplayers[0]])); @@ -703,71 +703,74 @@ void P_RestoreMusic(player_t *player) // Event - Level Start if (leveltime < MUSICSTARTTIME) - S_StartMapMusic(); - else // see also where time overs are handled - search for "lives = 2" in this file { - INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow + S_StartMapMusic(); + return; + } - if (splitscreen) - { - INT32 bestlocaltimer = 1; + // see also where time overs are handled - search for "lives = 2" in this file + INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow + + if (splitscreen) + { + INT32 bestlocaltimer = 1; #define setbests(p) \ - if (players[p].playerstate == PST_LIVE) \ - { \ - if (players[p].kartstuff[k_growshrinktimer] > bestlocaltimer) \ - { wantedmus = 2; bestlocaltimer = players[p].kartstuff[k_growshrinktimer]; } \ - else if (players[p].kartstuff[k_invincibilitytimer] > bestlocaltimer) \ - { wantedmus = 1; bestlocaltimer = players[p].kartstuff[k_invincibilitytimer]; } \ - } - setbests(displayplayers[0]); - setbests(displayplayers[1]); - if (splitscreen > 1) - setbests(displayplayers[2]); - if (splitscreen > 2) - setbests(displayplayers[3]); + if (players[p].playerstate == PST_LIVE) \ + { \ + if (players[p].kartstuff[k_growshrinktimer] > bestlocaltimer) \ + { wantedmus = 2; bestlocaltimer = players[p].kartstuff[k_growshrinktimer]; } \ + else if (players[p].kartstuff[k_invincibilitytimer] > bestlocaltimer) \ + { wantedmus = 1; bestlocaltimer = players[p].kartstuff[k_invincibilitytimer]; } \ + } + + setbests(displayplayers[0]); + setbests(displayplayers[1]); + if (splitscreen > 1) + setbests(displayplayers[2]); + if (splitscreen > 2) + setbests(displayplayers[3]); #undef setbests - } - else + } + else + { + if (player->playerstate == PST_LIVE) { - if (player->playerstate == PST_LIVE) - { - if (player->kartstuff[k_growshrinktimer] > 1) - wantedmus = 2; - else if (player->kartstuff[k_invincibilitytimer] > 1) - wantedmus = 1; - } + if (player->kartstuff[k_growshrinktimer] > 1) + wantedmus = 2; + else if (player->kartstuff[k_invincibilitytimer] > 1) + wantedmus = 1; } + } - // Item - Grow - if (wantedmus == 2 && cv_growmusic.value == 1) - { - S_ChangeMusicInternal("kgrow", true); - S_SetRestoreMusicFadeInCvar(&cv_growmusicfade); - } - // Item - Invincibility - else if (wantedmus == 1 && cv_supermusic.value == 1) - { - S_ChangeMusicInternal("kinvnc", true); - S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade); - } - else - { + // Item - Grow + if (wantedmus == 2 && cv_growmusic.value == 1) + { + S_ChangeMusicInternal("kgrow", true); + S_SetRestoreMusicFadeInCvar(&cv_growmusicfade); + } + // Item - Invincibility + else if (wantedmus == 1 && cv_supermusic.value == 1) + { + S_ChangeMusicInternal("kinvnc", true); + S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade); + } + else + { #if 0 - // Event - Final Lap - // Still works for GME, but disabled for consistency - if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1)) - S_SpeedMusic(1.2f); + // Event - Final Lap + // Still works for GME, but disabled for consistency + if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1)) + S_SpeedMusic(1.2f); #endif - if (mapmusic.resume && cv_resume.value) // mapmusresume will be 0 anyways when birdmusic stuff is disabled - position = mapmusic.resume; - else - position = mapmusic.position; + if (mapmusic.resume && cv_resume.value) // mapmusresume will be 0 anyways when birdmusic stuff is disabled + position = mapmusic.resume; + else + position = mapmusic.position; - S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, position, 0, S_GetRestoreMusicFadeIn()); - S_ClearRestoreMusicFadeInCvar(); - mapmusic.resume = 0; - } + S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, position, 0, S_GetRestoreMusicFadeIn()); + S_ClearRestoreMusicFadeInCvar(); + mapmusic.resume = 0; } } @@ -971,7 +974,7 @@ fixed_t P_GetPlayerHeight(player_t *player) // fixed_t P_GetPlayerSpinHeight(player_t *player) { - return FixedMul(FixedMul(player->mo->info->height, player->mo->scale),2*FRACUNIT/3); + return FixedMul(FixedMul(player->mo->info->height, player->mo->scale), 2*FRACUNIT/3); } // @@ -1022,7 +1025,9 @@ boolean P_IsLocalPlayer(const player_t *player) for (i = 0; i <= splitscreen; i++) { if (player == P_GetLocalPlayerForNum(i)) + { return true; + } } return false; @@ -1041,7 +1046,9 @@ boolean P_IsLocalPlayerNum(UINT8 pnum) for (i = 0; i <= splitscreen; i++) { if (pnum == P_GetLocalPlayerNumForNum(i)) + { return true; + } } return false; @@ -1069,7 +1076,9 @@ boolean P_IsDisplayPlayer(const player_t *player) } if (player == &players[displayplayers[i]]) + { return true; + } } return false; @@ -1229,19 +1238,20 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj) mobj->flags &= ~MF_DONTENCOREMAP; // Copy interpolation data :) - ghost->old_x = mobj->old_x2; - ghost->old_y = mobj->old_y2; - ghost->old_z = mobj->old_z2; - ghost->old_angle = (mobj->player ? mobj->player->old_frameangle2 : mobj->old_angle2); - ghost->old_pitch = mobj->old_pitch2; - ghost->old_roll = mobj->old_roll2; - ghost->old_sloperoll = mobj->old_sloperoll2; - ghost->old_slopepitch = mobj->old_slopepitch2; - ghost->old_scale = mobj->old_scale2; - ghost->old_spritexscale = mobj->old_spritexscale2; - ghost->old_spriteyscale = mobj->old_spriteyscale2; - ghost->old_spritexoffset = mobj->old_spritexoffset2; - ghost->old_spriteyoffset = mobj->old_spriteyoffset2; + // old_x - mobj->momx - hack to preserve vanilla look + ghost->old_x = mobj->old_x - mobj->momx; + ghost->old_y = mobj->old_y - mobj->momy; + ghost->old_z = mobj->old_z2; // Slopes..... + ghost->old_angle = (mobj->player ? mobj->player->old_frameangle : mobj->old_angle); + ghost->old_pitch = mobj->old_pitch; + ghost->old_roll = mobj->old_roll; + ghost->old_sloperoll = mobj->old_sloperoll; + ghost->old_slopepitch = mobj->old_slopepitch; + ghost->old_scale = mobj->old_scale; + ghost->old_spritexscale = mobj->old_spritexscale; + ghost->old_spriteyscale = mobj->old_spriteyscale; + ghost->old_spritexoffset = mobj->old_spritexoffset; + ghost->old_spriteyoffset = mobj->old_spriteyoffset; return ghost; } @@ -1255,7 +1265,9 @@ void P_DoPlayerExit(player_t *player) if (player->exiting || mapreset) return; - if (P_IsLocalPlayer(player) && (!player->spectator && !demo.playback)) + const boolean islocalplayer = P_IsLocalPlayer(player); + + if (islocalplayer && (!player->spectator && !demo.playback)) legitimateexit = true; if (player->griefstrikes > 0) @@ -1270,7 +1282,7 @@ void P_DoPlayerExit(player_t *player) { const int soundid = K_IsPlayerLosing(player) ? sfx_klose: sfx_kwin; // fix godjjsa win sounds - if (P_IsLocalPlayer(player)) + if (islocalplayer) { sfxenum_t sfx_id = K_GetMobjSkin(player->mo)->soundsid[S_sfx[soundid].skinsound]; S_StartSound(NULL, sfx_id); @@ -1324,12 +1336,13 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL) continue; - topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y); - bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y); + topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y); if (mo->z + (mo->height/2) > topheight) continue; + bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y); + if (mo->z + (mo->height/2) < bottomheight) continue; @@ -1360,12 +1373,13 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand if (!(rover->flags & FF_QUICKSAND)) continue; - topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y); - bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y); + topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y); if (mo->z + flipoffset > topheight) continue; + bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y); + if (mo->z + (mo->height/2) + flipoffset < bottomheight) continue; @@ -1547,13 +1561,12 @@ static void P_CheckBouncySectors(player_t *player) if (top) { fixed_t newmom; - pslope_t *slope; - if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) { // Hit top + + if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) // Hit top slope = *rover->t_slope; - } else { // Hit bottom + else // Hit bottom slope = *rover->b_slope; - } momentum.x = player->mo->momx; momentum.y = player->mo->momy; @@ -1644,7 +1657,8 @@ static void P_CheckQuicksand(player_t *player) for (rover = player->mo->subsector->sector->ffloors; rover; rover = rover->next) { - if (!(rover->flags & FF_EXISTS)) continue; + if (!(rover->flags & FF_EXISTS)) + continue; if (!(rover->flags & FF_QUICKSAND)) continue; @@ -1702,10 +1716,8 @@ static void P_CheckInvincibilityTimer(player_t *player) { if (!player->powers[pw_super]) { - { - player->mo->color = player->skincolor; - G_GhostAddColor((INT32) (player - players), GHC_NORMAL); - } + player->mo->color = player->skincolor; + G_GhostAddColor((INT32)(player - players), GHC_NORMAL); // If you had a shield, restore its visual significance P_SpawnShieldOrb(player); @@ -1730,7 +1742,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->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE)) || player->spectator) + if (!(player->mo->eflags & MFE_UNDERWATER) || player->spectator || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE))) return; if (P_RandomChance(FRACUNIT/16)) @@ -1744,9 +1756,6 @@ static void P_DoBubbleBreath(player_t *player) bubble->destscale = player->mo->scale; P_SetScale(bubble, bubble->destscale); } - - //if (player->pflags & PF_NIGHTSMODE) // NiGHTS Super doesn't spawn flight bubbles - //return; } // @@ -1859,10 +1868,10 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range) if (!P_CheckSight(player->mo, mo2)) continue; // if your psychic powers can't "see" it don't bother - an = R_PointToAngle2(player->mo->x, player->mo->y, mo2->x, mo2->y); - if (mo2->health > 0) { + an = R_PointToAngle2(player->mo->x, player->mo->y, mo2->x, mo2->y); + P_Thrust(mo2, an, thrust); if (mo2->type == MT_GOLDBUZZ || mo2->type == MT_REDBUZZ) @@ -2012,12 +2021,17 @@ static void P_3dMovement(player_t *player) // The rest is unaffected. angle_t thrustangle = R_PointToAngle2(0, 0, totalthrust.x, totalthrust.y)-player->mo->standingslope->xydirection; - if (player->mo->standingslope->zdelta < 0) { // Direction goes down, so thrustangle needs to face toward - if (thrustangle < ANGLE_90 || thrustangle > ANGLE_270) { + if (player->mo->standingslope->zdelta < 0) // Direction goes down, so thrustangle needs to face toward + { + if (thrustangle < ANGLE_90 || thrustangle > ANGLE_270) + { P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope); } - } else { // Direction goes up, so thrustangle needs to face away - if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270) { + } + else // Direction goes up, so thrustangle needs to face away + { + if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270) + { P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope); } } @@ -2100,10 +2114,6 @@ static void P_SpectatorMovement(player_t *player) // Quake-style flying spectators :D player->mo->momz += FixedMul(cmd->forwardmove*mapobjectscale, AIMINGTOSLOPE(player->aiming)); } - /*if (cmd->sidemove != 0) -- was disabled in practice anyways, since sidemove was suppressed - { - P_Thrust(player->mo, player->mo->angle-ANGLE_90, cmd->sidemove*mapobjectscale); - }*/ } void P_BlackOw(player_t *player) @@ -2732,6 +2742,9 @@ boolean P_LookForEnemies(player_t *player) if (!(mo->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR|MF_SPRING))) continue; // not a valid enemy + if (mo->type == MT_PLAYER) // Don't chase after other players! + continue; + if (mo->health <= 0) // dead continue; @@ -2759,9 +2772,6 @@ boolean P_LookForEnemies(player_t *player) && abs(player->mo->y-mo->y) > player->mo->radius)) continue; // not in your 2d plane - if (mo->type == MT_PLAYER) // Don't chase after other players! - continue; - if (closestmo && P_AproxDistance(P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y), player->mo->z-mo->z) > P_AproxDistance(P_AproxDistance(player->mo->x-closestmo->x, player->mo->y-closestmo->y), player->mo->z-closestmo->z)) diff --git a/src/r_fps.cpp b/src/r_fps.cpp index 98bfaf68b..7ccebf8e5 100644 --- a/src/r_fps.cpp +++ b/src/r_fps.cpp @@ -722,6 +722,10 @@ void R_AddMobjInterpolator(mobj_t *mobj) interpolated_mobjs.push_back(mobj); + // Maybe not the best place for it, but for first tic this old_z is 0, + // so when R_ResetMobjInterpolationState is called old_z2 will be set to 0 + mobj->old_z = mobj->z; + R_ResetMobjInterpolationState(mobj); mobj->resetinterp = true; } @@ -763,22 +767,7 @@ void R_ResetMobjInterpolationState(mobj_t *mobj) if (rendermode == render_none) return; - mobj->old_x2 = mobj->old_x; - mobj->old_y2 = mobj->old_y; mobj->old_z2 = mobj->old_z; - mobj->old_angle2 = mobj->old_angle; - mobj->old_scale2 = mobj->old_scale; - - // rotation humor - mobj->old_pitch2 = mobj->old_pitch; - mobj->old_roll2 = mobj->old_roll; - mobj->old_slopepitch2 = mobj->old_slopepitch; - mobj->old_sloperoll2 = mobj->old_sloperoll; - - mobj->old_spritexscale2 = mobj->old_spritexscale; - mobj->old_spriteyscale2 = mobj->old_spriteyscale; - mobj->old_spritexoffset2 = mobj->old_spritexoffset; - mobj->old_spriteyoffset2 = mobj->old_spriteyoffset; mobj->old_x = mobj->x; mobj->old_y = mobj->y;