General NiGHTS fixes

This commit is contained in:
Zwip-Zwap Zapony 2023-12-29 16:04:03 +01:00
parent 933a96013d
commit c361b732db
4 changed files with 77 additions and 70 deletions

View file

@ -55,7 +55,7 @@ static UINT8 *demobuffer = NULL;
static UINT8 *demo_p, *demotime_p; static UINT8 *demo_p, *demotime_p;
static UINT8 *demoend; static UINT8 *demoend;
static UINT8 demoflags; static UINT8 demoflags;
static UINT16 demoversion; UINT16 demoversion;
boolean singledemo; // quit after playing a demo from cmdline boolean singledemo; // quit after playing a demo from cmdline
boolean demo_start; // don't start playing demo right away boolean demo_start; // don't start playing demo right away
boolean demo_forwardmove_rng; // old demo backwards compatibility boolean demo_forwardmove_rng; // old demo backwards compatibility
@ -98,7 +98,7 @@ demoghost *ghosts = NULL;
// DEMO RECORDING // DEMO RECORDING
// //
#define DEMOVERSION 0x0010 #define DEMOVERSION 0x0011
#define DEMOHEADER "\xF0" "SRB2Replay" "\x0F" #define DEMOHEADER "\xF0" "SRB2Replay" "\x0F"
#define DF_GHOST 0x01 // This demo contains ghost data too! #define DF_GHOST 0x01 // This demo contains ghost data too!

View file

@ -25,6 +25,7 @@
// demoplaying back and demo recording // demoplaying back and demo recording
extern boolean demoplayback, titledemo, demorecording, timingdemo; extern boolean demoplayback, titledemo, demorecording, timingdemo;
extern tic_t demostarttime; extern tic_t demostarttime;
extern UINT16 demoversion;
typedef enum typedef enum
{ {

View file

@ -19,6 +19,7 @@
#include "d_event.h" #include "d_event.h"
#include "netcode/d_net.h" #include "netcode/d_net.h"
#include "netcode/net_command.h" #include "netcode/net_command.h"
#include "g_demo.h" // demoplayback, demoversion
#include "g_game.h" #include "g_game.h"
#include "p_local.h" #include "p_local.h"
#include "r_fps.h" #include "r_fps.h"
@ -7518,49 +7519,46 @@ static void P_NiGHTSMovement(player_t *player)
newangle = 270; newangle = 270;
} }
else // AngleFixed(R_PointToAngle2()) results in slight inaccuracy! Don't use it unless movement is on both axises. else // AngleFixed(R_PointToAngle2()) results in slight inaccuracy! Don't use it unless movement is on both axises.
{
newangle = (INT16)FixedInt(AngleFixed(R_PointToAngle2(0,0, cmd->sidemove*FRACUNIT, cmd->forwardmove*FRACUNIT))); newangle = (INT16)FixedInt(AngleFixed(R_PointToAngle2(0,0, cmd->sidemove*FRACUNIT, cmd->forwardmove*FRACUNIT)));
if (cmd->forwardmove == -36 && cmd->sidemove == 35 && !(demoplayback && demoversion < 0x0011))
newangle = 315; // Hack to compensate for directly down-right returning 314, not 315
}
newangle -= player->viewrollangle / ANG1; newangle -= player->viewrollangle / ANG1;
if (newangle < 0 && moved) if (newangle < 0 && moved)
newangle = (INT16)(360+newangle); newangle = (INT16)(360+newangle);
}
if (player->pflags & PF_DRILLING)
thrustfactor = 2;
else
{
thrustfactor = 8;
// Decelerate while turning normally.
if (moved && player->flyangle != newangle && player->speed > 12000)
player->speed -= 60;
}
for (i = 0; i < thrustfactor; i++)
{
if (moved && player->flyangle != newangle) if (moved && player->flyangle != newangle)
{ {
INT32 anglediff = (((newangle-player->flyangle)+360)%360); // "player->flyangle" is our current angle, "newangle" is where we want to go
INT32 angledif2 = (((player->flyangle-newangle)+360)%360); INT32 anglediff = ((newangle - player->flyangle) + 360) % 360; // "+360" and then "%360" wraps it to 0-359
// player->flyangle is the one to move // How sharply can we turn?
// newangle is the "move to" if (player->pflags & PF_DRILLING)
if (anglediff == 0 && angledif2 == 0) thrustfactor = 2;
break; else
{
thrustfactor = 8;
if (player->speed > 12000) // Decelerate while turning normally
player->speed -= 60;
}
if (anglediff>angledif2) // Now, turn!
player->flyangle--; if (anglediff <= thrustfactor || anglediff >= (360-thrustfactor))
else // if (anglediff<angledif2) player->flyangle = newangle;
player->flyangle++; else if (anglediff <= 180)
player->flyangle += thrustfactor;
else
player->flyangle -= thrustfactor;
player->flyangle = (player->flyangle + 360) % 360; // Buff out negatives, >360 angles...
} }
// Buff out negatives, >360 angles...
player->flyangle = ((player->flyangle + 360) % 360);
} }
if (!(player->speed) if (player->speed == 0 && cmd->forwardmove == 0 && (cmd->sidemove == 0 || (demoplayback && demoversion < 0x0011)))
&& cmd->forwardmove == 0)
still = true; still = true;
// No more bumper braking // No more bumper braking
@ -7721,6 +7719,9 @@ static void P_NiGHTSMovement(player_t *player)
visangle += 180; visangle += 180;
} }
if (player->mo->eflags & MFE_VERTICALFLIP) // Flip the roll angle in reverse gravity
visangle *= -1;
rollangle = FixedAngle(visangle<<FRACBITS); rollangle = FixedAngle(visangle<<FRACBITS);
} }
} }

View file

@ -1784,46 +1784,49 @@ static void ST_drawNightsRecords(void)
static void ST_drawNiGHTSLink(void) static void ST_drawNiGHTSLink(void)
{ {
static INT32 prevsel[2] = {0, 0}, prevtime[2] = {0, 0}; if (stplyr->linkcount != 0) // Don't show a faint 4294967295 link, even when debugging
const UINT8 q = ((splitscreen && stplyr == &players[secondarydisplayplayer]) ? 1 : 0);
INT32 sel = ((stplyr->linkcount-1) / 5) % NUMLINKCOLORS, aflag = V_PERPLAYER, mag = ((stplyr->linkcount-1 >= 300) ? (stplyr->linkcount-1 >= 600) ? 2 : 1 : 0);
skincolornum_t colornum;
fixed_t x, y, scale;
if (sel != prevsel[q])
{ {
prevsel[q] = sel; static INT32 prevsel[2] = {0, 0}, prevtime[2] = {0, 0};
prevtime[q] = 2 + mag; const UINT8 q = ((splitscreen && stplyr == &players[secondarydisplayplayer]) ? 1 : 0);
INT32 sel = ((stplyr->linkcount-1) / 5) % NUMLINKCOLORS, aflag = V_PERPLAYER, mag = ((stplyr->linkcount-1 >= 300) ? (stplyr->linkcount-1 >= 600) ? 2 : 1 : 0);
skincolornum_t colornum;
fixed_t x, y, scale;
if (sel != prevsel[q])
{
prevsel[q] = sel;
prevtime[q] = 2 + mag;
}
if (stplyr->powers[pw_nights_linkfreeze] && (!(stplyr->powers[pw_nights_linkfreeze] & 2) || (stplyr->powers[pw_nights_linkfreeze] > flashingtics)))
colornum = SKINCOLOR_ICY;
else
colornum = linkColor[mag][sel];
aflag |= ((stplyr->linktimer < (UINT32)nightslinktics/3)
? (9 - 9*stplyr->linktimer/(nightslinktics/3)) << V_ALPHASHIFT
: 0);
y = (160+11)<<FRACBITS;
aflag |= V_SNAPTOBOTTOM;
x = (160+4)<<FRACBITS;
if (prevtime[q])
{
scale = ((32 + prevtime[q])<<FRACBITS)/32;
prevtime[q]--;
}
else
scale = FRACUNIT;
y -= (11*scale);
ST_DrawNightsOverlayNum(x-(4*scale), y, scale, aflag, (stplyr->linkcount-1), nightsnum, colornum);
V_DrawFixedPatch(x+(4*scale), y, scale, aflag, nightslink,
colornum == 0 ? colormaps : R_GetTranslationColormap(TC_DEFAULT, colornum, GTC_CACHE));
} }
if (stplyr->powers[pw_nights_linkfreeze] && (!(stplyr->powers[pw_nights_linkfreeze] & 2) || (stplyr->powers[pw_nights_linkfreeze] > flashingtics)))
colornum = SKINCOLOR_ICY;
else
colornum = linkColor[mag][sel];
aflag |= ((stplyr->linktimer < (UINT32)nightslinktics/3)
? (9 - 9*stplyr->linktimer/(nightslinktics/3)) << V_ALPHASHIFT
: 0);
y = (160+11)<<FRACBITS;
aflag |= V_SNAPTOBOTTOM;
x = (160+4)<<FRACBITS;
if (prevtime[q])
{
scale = ((32 + prevtime[q])<<FRACBITS)/32;
prevtime[q]--;
}
else
scale = FRACUNIT;
y -= (11*scale);
ST_DrawNightsOverlayNum(x-(4*scale), y, scale, aflag, (stplyr->linkcount-1), nightsnum, colornum);
V_DrawFixedPatch(x+(4*scale), y, scale, aflag, nightslink,
colornum == 0 ? colormaps : R_GetTranslationColormap(TC_DEFAULT, colornum, GTC_CACHE));
// Show remaining link time left in debug // Show remaining link time left in debug
if (cv_debug & DBG_NIGHTSBASIC) if (cv_debug & DBG_NIGHTSBASIC)
V_DrawCenteredString(BASEVIDWIDTH/2, 180, V_SNAPTOBOTTOM, va("End in %d.%02d", stplyr->linktimer/TICRATE, G_TicsToCentiseconds(stplyr->linktimer))); V_DrawCenteredString(BASEVIDWIDTH/2, 180, V_SNAPTOBOTTOM, va("End in %d.%02d", stplyr->linktimer/TICRATE, G_TicsToCentiseconds(stplyr->linktimer)));
@ -1853,13 +1856,15 @@ static void ST_drawNiGHTSHUD(void)
for (dfill = 0; dfill < stplyr->drillmeter/20 && dfill < 96; ++dfill) for (dfill = 0; dfill < stplyr->drillmeter/20 && dfill < 96; ++dfill)
V_DrawScaledPatch(locx + 2 + dfill, locy + 3, V_PERPLAYER|V_SNAPTOLEFT|V_SNAPTOBOTTOM|V_HUDTRANS, drillfill[fillpatch]); V_DrawScaledPatch(locx + 2 + dfill, locy + 3, V_PERPLAYER|V_SNAPTOLEFT|V_SNAPTOBOTTOM|V_HUDTRANS, drillfill[fillpatch]);
// Display actual drill amount and bumper time // Display actual flyangle, drill amount, and bumper time
if (!splitscreen && (cv_debug & DBG_NIGHTSBASIC)) if (!splitscreen && (cv_debug & DBG_NIGHTSBASIC))
{ {
V_DrawString(locx, locy - 16, V_MONOSPACE, va("ANGLE: %3d", stplyr->flyangle));
if (stplyr->bumpertime) if (stplyr->bumpertime)
V_DrawString(locx, locy - 8, V_REDMAP|V_MONOSPACE, va("BUMPER: 0.%02d", G_TicsToCentiseconds(stplyr->bumpertime))); V_DrawString(locx, locy - 8, V_REDMAP|V_MONOSPACE, va("BUMPER: 0.%02d", G_TicsToCentiseconds(stplyr->bumpertime)));
else else
V_DrawString(locx, locy - 8, V_MONOSPACE, va("Drill: %3d%%", (stplyr->drillmeter*100)/(96*20))); V_DrawString(locx, locy - 8, V_MONOSPACE, va("DRILL: %3d%%", (stplyr->drillmeter*100)/(96*20)));
} }
} }