From 9c02c810954e2daec88c04309e47e9fddc8fc33f Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 12 Aug 2016 14:42:22 +0100 Subject: [PATCH] Now that it's not 3am, here's some fixes to what I pushed last night. * That hacky anti-NiGHTS-deaxisment code I commented out because I thought it was visual only? Reimplemented in a way that is both more and less hacky. It's identical in result to the original code, but takes a roundabout method to get there. * Sprite references for SUPE, SUPZ and NDRL are removed because they are now unused. * Helper's flashing conditional is restructured to do less flag swapping. * The check for super setting FF_FULLBRIGHT is limited to MAXTRANSLATIONS now, and also correctly takes into account MAXSKINCOLORS == SKINCOLOR_SUPERSILVER1. * NiGHTS collision bounds aren't hardcoded anymore. * NiGHTS link will never display when leaving stage. * Slightly tweaked rules for the supercolor setting when doing a NiGHTS transformation, but only meaningful for setting FF_FULLBRIGHT. --- src/hardware/hw_light.c | 4 -- src/info.c | 22 ++++----- src/info.h | 4 -- src/p_enemy.c | 14 +++--- src/p_mobj.c | 2 +- src/p_user.c | 105 ++++++++++++++++++++++------------------ 6 files changed, 79 insertions(+), 72 deletions(-) diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 96f79f807..0145c88fe 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -438,16 +438,12 @@ light_t *t_lspr[NUMSPRITES] = // NiGHTS Stuff &lspr[SUPERSONIC_L], // SPR_NDRN // NiGHTS drone - &lspr[SUPERSONIC_L], // SPR_SUPE // NiGHTS character flying - &lspr[SUPERSONIC_L], // SPR_SUPZ // NiGHTS hurt - &lspr[SUPERSONIC_L], // SPR_NDRL // NiGHTS character drilling &lspr[NOLIGHT], // SPR_NSPK &lspr[NOLIGHT], // SPR_NBMP &lspr[NOLIGHT], // SPR_HOOP &lspr[NOLIGHT], // SPR_HSCR &lspr[NOLIGHT], // SPR_NPRU &lspr[NOLIGHT], // SPR_CAPS - &lspr[SUPERSONIC_L], // SPR_SUPT // Debris &lspr[RINGSPARK_L], // SPR_SPRK diff --git a/src/info.c b/src/info.c index aeba7dcab..9d9f02d67 100644 --- a/src/info.c +++ b/src/info.c @@ -49,11 +49,11 @@ char sprnames[NUMSPRITES + 1][5] = "RNGR","RNGI","RNGA","RNGE","RNGS","RNGG","PIKB","PIKR","PIKA","PIKE", "PIKS","PIKG","TAUT","TGRE","TSCR","COIN","CPRK","GOOM","BGOM","FFWR", "FBLL","SHLL","PUMA","HAMM","KOOP","BFLM","MAXE","MUS1","MUS2","TOAD", - "NDRN","SUPE","SUPZ","NDRL","NSPK","NBMP","HOOP","NSCR","NPRU","CAPS", - "SUPT","SPRK","BOM1","BOM2","BOM3","BOM4","ROIA","ROIB","ROIC","ROID", - "ROIE","ROIF","ROIG","ROIH","ROII","ROIJ","ROIK","ROIL","ROIM","ROIN", - "ROIO","ROIP","BBAL","GWLG","GWLR","SRBA","SRBB","SRBC","SRBD","SRBE", - "SRBF","SRBG","SRBH","SRBI","SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO", + "NDRN","NSPK","NBMP","HOOP","NSCR","NPRU","CAPS","SPRK","BOM1","BOM2", + "BOM3","BOM4","ROIA","ROIB","ROIC","ROID","ROIE","ROIF","ROIG","ROIH", + "ROII","ROIJ","ROIK","ROIL","ROIM","ROIN","ROIO","ROIP","BBAL","GWLG", + "GWLR","SRBA","SRBB","SRBC","SRBD","SRBE","SRBF","SRBG","SRBH","SRBI", + "SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO", }; char spr2names[NUMPLAYERSPRITES][5] = @@ -250,12 +250,12 @@ state_t states[NUMSTATES] = {SPR_PLAY, SPR2_NTRN, 4, {A_Scream}, 0, 0, S_PLAY_NIGHTS_TRANS2}, // S_PLAY_NIGHTS_TRANS {SPR_PLAY, SPR2_NTRN, 4, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS3}, // S_PLAY_NIGHTS_TRANS2 {SPR_PLAY, SPR2_NTRN|FF_FULLBRIGHT, 4, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS4}, // S_PLAY_NIGHTS_TRANS3 - {SPR_PLAY, SPR2_NTRN|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS5}, // S_PLAY_NIGHTS_TRANS4 - {SPR_PLAY, SPR2_NTRN|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS6}, // S_PLAY_NIGHTS_TRANS5 - {SPR_PLAY, SPR2_NTRN|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS7}, // S_PLAY_NIGHTS_TRANS6 - {SPR_PLAY, SPR2_NTRN|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS8}, // S_PLAY_NIGHTS_TRANS7 - {SPR_PLAY, SPR2_NTRN|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS9}, // S_PLAY_NIGHTS_TRANS8 - {SPR_PLAY, SPR2_NTRN|FF_FULLBRIGHT, 16, {NULL}, 0, 0, S_PLAY_NIGHTS_FLOAT}, // S_PLAY_NIGHTS_TRANS9 + {SPR_PLAY, SPR2_NTRN, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS5}, // S_PLAY_NIGHTS_TRANS4 + {SPR_PLAY, SPR2_NTRN, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS6}, // S_PLAY_NIGHTS_TRANS5 + {SPR_PLAY, SPR2_NTRN, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS7}, // S_PLAY_NIGHTS_TRANS6 + {SPR_PLAY, SPR2_NTRN, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS8}, // S_PLAY_NIGHTS_TRANS7 + {SPR_PLAY, SPR2_NTRN, 3, {NULL}, 0, 0, S_PLAY_NIGHTS_TRANS9}, // S_PLAY_NIGHTS_TRANS8 + {SPR_PLAY, SPR2_NTRN, 16, {NULL}, 0, 0, S_PLAY_NIGHTS_FLOAT}, // S_PLAY_NIGHTS_TRANS9 // NiGHTS Player, Stand, Floating, Pain, Pull and Attack {SPR_PLAY, SPR2_NSTD, 7, {NULL}, 0, 0, S_PLAY_NIGHTS_STAND}, // S_PLAY_NIGHTS_STAND diff --git a/src/info.h b/src/info.h index a700ad24e..f1366c441 100644 --- a/src/info.h +++ b/src/info.h @@ -514,16 +514,12 @@ typedef enum sprite // NiGHTS Stuff SPR_NDRN, // NiGHTS drone - SPR_SUPE, // NiGHTS character flying - SPR_SUPZ, // NiGHTS hurt - SPR_NDRL, // NiGHTS character drilling SPR_NSPK, // NiGHTS sparkle SPR_NBMP, // NiGHTS Bumper SPR_HOOP, // NiGHTS hoop sprite SPR_NSCR, // NiGHTS score sprite SPR_NPRU, // Nights Powerups SPR_CAPS, // Capsule thingy for NiGHTS - SPR_SUPT, // Super Sonic Transformation (NiGHTS) // Debris SPR_SPRK, // spark diff --git a/src/p_enemy.c b/src/p_enemy.c index 07246d69b..3790633ea 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -8067,12 +8067,14 @@ void A_OrbitNights(mobj_t* actor) } P_SetThingPosition(actor); - if (ishelper // Flash a helper that's about to be removed. - && (actor->target->player->powers[pw_nights_helper] < TICRATE) - && (actor->target->player->powers[pw_nights_helper] & 1)) - actor->flags2 |= MF2_DONTDRAW; - else - actor->flags2 &= ~MF2_DONTDRAW; + if (ishelper) // Flash a helper that's about to be removed. + { + if ((actor->target->player->powers[pw_nights_helper] < TICRATE) + && (actor->target->player->powers[pw_nights_helper] & 1)) + actor->flags2 |= MF2_DONTDRAW; + else + actor->flags2 &= ~MF2_DONTDRAW; + } } } diff --git a/src/p_mobj.c b/src/p_mobj.c index 730af9003..8de79fe92 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -597,7 +597,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) mobj->sprite2 = spr2; mobj->frame = frame|(st->frame&~FF_FRAMEMASK); - if (mobj->color > MAXSKINCOLORS) // Super colours? Super bright! + if (mobj->color >= MAXSKINCOLORS && mobj->color < MAXTRANSLATIONS) // Super colours? Super bright! mobj->frame |= FF_FULLBRIGHT; } // Regular sprites diff --git a/src/p_user.c b/src/p_user.c index cf265b645..6cc32c89a 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -56,6 +56,39 @@ static void P_NukeAllPlayers(player_t *player); #endif +// +// P_GetPlayerRadius +// +// Returns the radius +// of the player. +// +fixed_t P_GetPlayerRadius(player_t *player) +{ + return FixedMul(skins[player->skin].radius, player->mo->scale); +} + +// +// P_GetPlayerHeight +// +// Returns the height +// of the player. +// +fixed_t P_GetPlayerHeight(player_t *player) +{ + return FixedMul(skins[player->skin].height, player->mo->scale); +} + +// +// P_GetPlayerSpinHeight +// +// Returns the 'spin height' +// of the player. +// +fixed_t P_GetPlayerSpinHeight(player_t *player) +{ + return FixedMul(skins[player->skin].spinheight, player->mo->scale); +} + // // Movement. // @@ -650,10 +683,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) return; if (!(player->pflags & PF_NIGHTSMODE)) - { - player->mo->radius = 16*FRACUNIT; - player->mo->height = 48*FRACUNIT; - } + player->mo->height = P_GetPlayerHeight(player); // Just to make sure jumping into the drone doesn't result in a squashed hitbox. player->pflags &= ~(PF_USEDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_THOKKED|PF_SPINNING|PF_DRILLING); player->homing = 0; @@ -1298,39 +1328,6 @@ void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative) mo->momz = value; } -// -// P_GetPlayerRadius -// -// Returns the radius -// of the player. -// -fixed_t P_GetPlayerRadius(player_t *player) -{ - return FixedMul(skins[player->skin].radius, player->mo->scale); -} - -// -// P_GetPlayerHeight -// -// Returns the height -// of the player. -// -fixed_t P_GetPlayerHeight(player_t *player) -{ - return FixedMul(skins[player->skin].height, player->mo->scale); -} - -// -// P_GetPlayerSpinHeight -// -// Returns the 'spin height' -// of the player. -// -fixed_t P_GetPlayerSpinHeight(player_t *player) -{ - return FixedMul(skins[player->skin].spinheight, player->mo->scale); -} - // // P_IsLocalPlayer // @@ -5000,14 +4997,30 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad if (player->exiting) return; - // You're welcome, Rob. (Now with slightly less horrendous hacking -Red - /*player->mo->tracer->flags &= ~MF_NOCLIP; - player->mo->tracer->z = player->mo->z; - if (!P_TryMove(player->mo->tracer, player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, true)) { - player->mo->tracer->flags |= MF_NOCLIP; - return; + /* + In some ways worse, in some ways better. + I did the following this way because the player object has to deal with touchspecials too, not just solids. + There were all sorts of fun bugs when the player got to touch the goal a frame earlier than it should've. + We could've applied MF_NOCLIPTHING, but then we'd lose out on clipping against MF_SOLIDs. Which is bad. + Instead, the object TEMPORARILY LOSES ITS PLAYER STATUS. Is that nuts? It's probably a little nuts. I know + we probably could've kept around MT_NIGHTSCHAR in some fashion, having an invisible hitbox following the + player around... but I'd already removed all its references, restructured the way the chaos emerald follows + the player around to fill the player->mo->tracer gap left behind, and NiGHTS is a lag magnet (lagnet?) + enough as it is... so whatever. You're welcome to tell me I'm terrible, but at least it works. + ~toast + */ + { + fixed_t prevx = player->mo->x; + fixed_t prevy = player->mo->y; + boolean notallowed; + player->mo->player = NULL; // YIKES + notallowed = (!(P_TryMove(player->mo, player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, true))); + P_TeleportMove(player->mo, prevx, prevy, player->mo->z); + player->mo->player = player; // unyikes + if (notallowed) + return; } - player->mo->tracer->flags |= MF_NOCLIP;*/ + { const INT32 sequence = player->mo->target->threshold; mobj_t *transfer1 = NULL; @@ -5768,7 +5781,7 @@ static void P_NiGHTSMovement(player_t *player) return; } - if (player->exiting > 0 && player->exiting < 2*TICRATE) + if (player->exiting > 0) //&& player->exiting < 2*TICRATE) { player->mo->momx = player->mo->momy = 0; @@ -6409,7 +6422,7 @@ static void P_MovePlayer(player_t *player) { if ((player->pflags & PF_NIGHTSMODE) && !(player->mo->state >= &states[S_PLAY_NIGHTS_TRANS] - && player->mo->state <= &states[S_PLAY_NIGHTS_TRANS9] + && player->mo->state <= &states[S_PLAY_NIGHTS_TRANS6] // NOT 9 - it's 6 when the player turns their supercolor. && !(player->exiting))) { skin_t *skin = ((skin_t *)(player->mo->skin));