SW: Let's replace the macro PEDANTIC_MODE with variable PedanticMode

This commit is contained in:
NY00123 2020-04-14 18:57:09 +03:00 committed by Christoph Oelckers
parent cc4f1f21f9
commit 47ac981a3a
4 changed files with 27 additions and 25 deletions

View file

@ -2013,7 +2013,7 @@ drawscreen(PLAYERp pp)
tx = camerapp->oposx + mulscale16(camerapp->posx - camerapp->oposx, smoothratio); tx = camerapp->oposx + mulscale16(camerapp->posx - camerapp->oposx, smoothratio);
ty = camerapp->oposy + mulscale16(camerapp->posy - camerapp->oposy, smoothratio); ty = camerapp->oposy + mulscale16(camerapp->posy - camerapp->oposy, smoothratio);
tz = camerapp->oposz + mulscale16(camerapp->posz - camerapp->oposz, smoothratio); tz = camerapp->oposz + mulscale16(camerapp->posz - camerapp->oposz, smoothratio);
if (PEDANTIC_MODE || if (PedanticMode ||
pp == Player+myconnectindex && TEST(pp->Flags, PF_DEAD)) pp == Player+myconnectindex && TEST(pp->Flags, PF_DEAD))
{ {
tq16ang = camerapp->oq16ang + mulscale16(((camerapp->q16ang + fix16_from_int(1024) - camerapp->oq16ang) & 0x7FFFFFF) - fix16_from_int(1024), smoothratio); tq16ang = camerapp->oq16ang + mulscale16(((camerapp->q16ang + fix16_from_int(1024) - camerapp->oq16ang) & 0x7FFFFFF) - fix16_from_int(1024), smoothratio);

View file

@ -185,6 +185,8 @@ short screenpeek = 0;
SWBOOL NoDemoStartup = FALSE; SWBOOL NoDemoStartup = FALSE;
SWBOOL FirstTimeIntoGame; SWBOOL FirstTimeIntoGame;
SWBOOL PedanticMode;
SWBOOL BorderAdjust = FALSE; SWBOOL BorderAdjust = FALSE;
SWBOOL LocationInfo = 0; SWBOOL LocationInfo = 0;
void drawoverheadmap(int cposx, int cposy, int czoom, short cang); void drawoverheadmap(int cposx, int cposy, int czoom, short cang);
@ -952,6 +954,8 @@ void InitLevelGlobals(void)
sumowasseen = FALSE; sumowasseen = FALSE;
zillawasseen = FALSE; zillawasseen = FALSE;
memset(BossSpriteNum,-1,sizeof(BossSpriteNum)); memset(BossSpriteNum,-1,sizeof(BossSpriteNum));
PedanticMode = (DemoPlaying || DemoRecording || DemoEdit || DemoMode);
} }
void InitLevelGlobals2(void) void InitLevelGlobals2(void)
@ -2436,7 +2440,7 @@ void MoveLoop(void)
} }
// Get input again to update q16ang/q16horiz. // Get input again to update q16ang/q16horiz.
if (!PEDANTIC_MODE) if (!PedanticMode)
getinput(&loc, TRUE); getinput(&loc, TRUE);
} }
@ -3222,7 +3226,7 @@ getinput(SW_PACKET *loc, SWBOOL tied)
if (buttonMap.ButtonDown(gamefunc_Turn_Left)) if (buttonMap.ButtonDown(gamefunc_Turn_Left))
{ {
turnheldtime += synctics; turnheldtime += synctics;
if (PEDANTIC_MODE) if (PedanticMode)
{ {
if (turnheldtime >= TURBOTURNTIME) if (turnheldtime >= TURBOTURNTIME)
q16angvel -= fix16_from_int(turnamount); q16angvel -= fix16_from_int(turnamount);
@ -3235,7 +3239,7 @@ getinput(SW_PACKET *loc, SWBOOL tied)
else if (buttonMap.ButtonDown(gamefunc_Turn_Right)) else if (buttonMap.ButtonDown(gamefunc_Turn_Right))
{ {
turnheldtime += synctics; turnheldtime += synctics;
if (PEDANTIC_MODE) if (PedanticMode)
{ {
if (turnheldtime >= TURBOTURNTIME) if (turnheldtime >= TURBOTURNTIME)
q16angvel += fix16_from_int(turnamount); q16angvel += fix16_from_int(turnamount);
@ -3275,7 +3279,7 @@ getinput(SW_PACKET *loc, SWBOOL tied)
q16angvel = fix16_clamp(q16angvel, -fix16_from_int(MAXANGVEL), fix16_from_int(MAXANGVEL)); q16angvel = fix16_clamp(q16angvel, -fix16_from_int(MAXANGVEL), fix16_from_int(MAXANGVEL));
q16aimvel = fix16_clamp(q16aimvel, -fix16_from_int(MAXHORIZVEL), fix16_from_int(MAXHORIZVEL)); q16aimvel = fix16_clamp(q16aimvel, -fix16_from_int(MAXHORIZVEL), fix16_from_int(MAXHORIZVEL));
if (PEDANTIC_MODE) if (PedanticMode)
{ {
q16angvel = fix16_floor(q16angvel); q16angvel = fix16_floor(q16angvel);
q16aimvel = fix16_floor(q16aimvel); q16aimvel = fix16_floor(q16aimvel);

View file

@ -186,10 +186,6 @@ int krand1(void);
#define PRINT(line,str) DebugPrint(line,str) #define PRINT(line,str) DebugPrint(line,str)
// Demo compatibility mode
extern SWBOOL DemoPlaying, DemoRecording, DemoEdit, DemoMode;
#define PEDANTIC_MODE (DemoPlaying || DemoRecording || DemoEdit || DemoMode)
#include "pragmas.h" #include "pragmas.h"
@ -889,6 +885,8 @@ extern int PlayerYellVocs[MAX_YELLSOUNDS];
void BossHealthMeter(void); void BossHealthMeter(void);
extern SWBOOL PedanticMode;
// Global variables used for modifying variouse things from the Console // Global variables used for modifying variouse things from the Console
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -1542,7 +1542,7 @@ DoPlayerTurn(PLAYERp pp, fix16_t *pq16ang, fix16_t q16angvel)
{ {
#define TURN_SHIFT 2 #define TURN_SHIFT 2
if (!PEDANTIC_MODE && (pq16ang == &pp->q16ang)) if (!PedanticMode && (pq16ang == &pp->q16ang))
{ {
*pq16ang = pp->input.q16ang; *pq16ang = pp->input.q16ang;
sprite[pp->PlayerSprite].ang = fix16_to_int(*pq16ang); sprite[pp->PlayerSprite].ang = fix16_to_int(*pq16ang);
@ -1569,7 +1569,7 @@ DoPlayerTurn(PLAYERp pp, fix16_t *pq16ang, fix16_t q16angvel)
// make the first turn in the clockwise direction // make the first turn in the clockwise direction
// the rest will follow // the rest will follow
delta_ang = GetDeltaAngle(pp->turn180_target, fix16_to_int(*pq16ang)); delta_ang = GetDeltaAngle(pp->turn180_target, fix16_to_int(*pq16ang));
if (PEDANTIC_MODE) if (PedanticMode)
*pq16ang = fix16_from_int(NORM_ANGLE(fix16_to_int(*pq16ang) + (labs(delta_ang) >> TURN_SHIFT))); *pq16ang = fix16_from_int(NORM_ANGLE(fix16_to_int(*pq16ang) + (labs(delta_ang) >> TURN_SHIFT)));
else else
// Add at least 1 unit to ensure the turn direction is clockwise // Add at least 1 unit to ensure the turn direction is clockwise
@ -1590,7 +1590,7 @@ DoPlayerTurn(PLAYERp pp, fix16_t *pq16ang, fix16_t q16angvel)
short delta_ang; short delta_ang;
delta_ang = GetDeltaAngle(pp->turn180_target, fix16_to_int(*pq16ang)); delta_ang = GetDeltaAngle(pp->turn180_target, fix16_to_int(*pq16ang));
if (PEDANTIC_MODE) if (PedanticMode)
*pq16ang = fix16_from_int(NORM_ANGLE(fix16_to_int(*pq16ang) + (delta_ang >> TURN_SHIFT))); *pq16ang = fix16_from_int(NORM_ANGLE(fix16_to_int(*pq16ang) + (delta_ang >> TURN_SHIFT)));
else else
*pq16ang = NORM_Q16ANGLE(fix16_sadd(*pq16ang, fix16_from_float(scaleAdjustmentToInterval(delta_ang >> TURN_SHIFT)))); *pq16ang = NORM_Q16ANGLE(fix16_sadd(*pq16ang, fix16_from_float(scaleAdjustmentToInterval(delta_ang >> TURN_SHIFT))));
@ -1626,7 +1626,7 @@ DoPlayerTurn(PLAYERp pp, fix16_t *pq16ang, fix16_t q16angvel)
*pq16ang += fix16_sdiv(fix16_mul(q16angvel, fix16_from_int(synctics)), fix16_from_int(32)); *pq16ang += fix16_sdiv(fix16_mul(q16angvel, fix16_from_int(synctics)), fix16_from_int(32));
*pq16ang = NORM_Q16ANGLE(*pq16ang); *pq16ang = NORM_Q16ANGLE(*pq16ang);
if (PEDANTIC_MODE) if (PedanticMode)
*pq16ang = fix16_floor(*pq16ang); *pq16ang = fix16_floor(*pq16ang);
// update players sprite angle // update players sprite angle
@ -1832,7 +1832,7 @@ PlayerAutoLook(PLAYERp pp)
if (!TEST(pp->Flags, PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING)) if (!TEST(pp->Flags, PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING))
{ {
if ((PEDANTIC_MODE || !TEST(pp->Flags, PF_MOUSE_AIMING_ON)) if ((PedanticMode || !TEST(pp->Flags, PF_MOUSE_AIMING_ON))
&& TEST(sector[pp->cursectnum].floorstat, FLOOR_STAT_SLOPE)) // If the floor is sloped && TEST(sector[pp->cursectnum].floorstat, FLOOR_STAT_SLOPE)) // If the floor is sloped
{ {
// Get a point, 512 units ahead of player's position // Get a point, 512 units ahead of player's position
@ -1857,7 +1857,7 @@ PlayerAutoLook(PLAYERp pp)
if ((pp->cursectnum == tempsect) || if ((pp->cursectnum == tempsect) ||
(klabs(getflorzofslope(tempsect, x, y) - k) <= (4 << 8))) (klabs(getflorzofslope(tempsect, x, y) - k) <= (4 << 8)))
{ {
if (PEDANTIC_MODE) if (PedanticMode)
pp->q16horizoff += fix16_from_int((((j - k) * 160) >> 16)); pp->q16horizoff += fix16_from_int((((j - k) * 160) >> 16));
else else
pp->q16horizoff = fix16_sadd(pp->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(mulscale16((j - k), 160)))); pp->q16horizoff = fix16_sadd(pp->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(mulscale16((j - k), 160))));
@ -1871,7 +1871,7 @@ PlayerAutoLook(PLAYERp pp)
// tilt when climbing but you can't even really tell it // tilt when climbing but you can't even really tell it
if (pp->q16horizoff < fix16_from_int(100)) if (pp->q16horizoff < fix16_from_int(100))
{ {
if (PEDANTIC_MODE) if (PedanticMode)
pp->q16horizoff += fix16_from_int((((100 - fix16_to_int(pp->q16horizoff)) >> 3) + 1)); pp->q16horizoff += fix16_from_int((((100 - fix16_to_int(pp->q16horizoff)) >> 3) + 1));
else else
pp->q16horizoff = fix16_sadd(pp->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(((fix16_from_int(100) - pp->q16horizoff) >> 3) + fix16_one)))); pp->q16horizoff = fix16_sadd(pp->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(((fix16_from_int(100) - pp->q16horizoff) >> 3) + fix16_one))));
@ -1883,7 +1883,7 @@ PlayerAutoLook(PLAYERp pp)
// you're not on a slope // you're not on a slope
if (pp->q16horizoff > 0) if (pp->q16horizoff > 0)
{ {
if (PEDANTIC_MODE) if (PedanticMode)
pp->q16horizoff -= fix16_from_int(((fix16_to_int(pp->q16horizoff) >> 3) + 1)); pp->q16horizoff -= fix16_from_int(((fix16_to_int(pp->q16horizoff) >> 3) + 1));
else else
{ {
@ -1893,7 +1893,7 @@ PlayerAutoLook(PLAYERp pp)
} }
if (pp->q16horizoff < 0) if (pp->q16horizoff < 0)
{ {
if (PEDANTIC_MODE) if (PedanticMode)
pp->q16horizoff += fix16_from_int((((fix16_to_int(-pp->q16horizoff)) >> 3) + 1)); pp->q16horizoff += fix16_from_int((((fix16_to_int(-pp->q16horizoff)) >> 3) + 1));
else else
{ {
@ -1914,7 +1914,7 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
// //DSPRINTF(ds,"fix16_to_int(pp->q16horizoff), %d", fix16_to_int(pp->q16horizoff)); // //DSPRINTF(ds,"fix16_to_int(pp->q16horizoff), %d", fix16_to_int(pp->q16horizoff));
// MONO_PRINT(ds); // MONO_PRINT(ds);
if (!PEDANTIC_MODE && (pq16horiz == &pp->q16horiz)) if (!PedanticMode && (pq16horiz == &pp->q16horiz))
{ {
*pq16horiz = pp->input.q16horiz; *pq16horiz = pp->input.q16horiz;
return; return;
@ -1932,7 +1932,7 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
if (TEST_SYNC_KEY(pp, SK_CENTER_VIEW)) if (TEST_SYNC_KEY(pp, SK_CENTER_VIEW))
{ {
if (PEDANTIC_MODE) if (PedanticMode)
pp->q16horizbase = fix16_from_int(100); pp->q16horizbase = fix16_from_int(100);
else if (pp->q16horizbase > fix16_from_int(100)) else if (pp->q16horizbase > fix16_from_int(100))
{ {
@ -1957,7 +1957,7 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
// adjust *pq16horiz negative // adjust *pq16horiz negative
if (TEST_SYNC_KEY(pp, SK_SNAP_DOWN)) if (TEST_SYNC_KEY(pp, SK_SNAP_DOWN))
{ {
if (PEDANTIC_MODE) if (PedanticMode)
pp->q16horizbase -= fix16_from_int((HORIZ_SPEED/2)); pp->q16horizbase -= fix16_from_int((HORIZ_SPEED/2));
else else
pp->q16horizbase = fix16_ssub(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval((HORIZ_SPEED/2)))); pp->q16horizbase = fix16_ssub(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval((HORIZ_SPEED/2))));
@ -1966,7 +1966,7 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
// adjust *pq16horiz positive // adjust *pq16horiz positive
if (TEST_SYNC_KEY(pp, SK_SNAP_UP)) if (TEST_SYNC_KEY(pp, SK_SNAP_UP))
{ {
if (PEDANTIC_MODE) if (PedanticMode)
pp->q16horizbase += fix16_from_int((HORIZ_SPEED/2)); pp->q16horizbase += fix16_from_int((HORIZ_SPEED/2));
else else
pp->q16horizbase = fix16_sadd(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval((HORIZ_SPEED/2)))); pp->q16horizbase = fix16_sadd(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval((HORIZ_SPEED/2))));
@ -1983,7 +1983,7 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
// adjust *pq16horiz negative // adjust *pq16horiz negative
if (TEST_SYNC_KEY(pp, SK_LOOK_DOWN)) if (TEST_SYNC_KEY(pp, SK_LOOK_DOWN))
{ {
if (PEDANTIC_MODE) if (PedanticMode)
pp->q16horizbase -= fix16_from_int(HORIZ_SPEED); pp->q16horizbase -= fix16_from_int(HORIZ_SPEED);
else else
pp->q16horizbase = fix16_ssub(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval(HORIZ_SPEED))); pp->q16horizbase = fix16_ssub(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval(HORIZ_SPEED)));
@ -1992,7 +1992,7 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
// adjust *pq16horiz positive // adjust *pq16horiz positive
if (TEST_SYNC_KEY(pp, SK_LOOK_UP)) if (TEST_SYNC_KEY(pp, SK_LOOK_UP))
{ {
if (PEDANTIC_MODE) if (PedanticMode)
pp->q16horizbase += fix16_from_int(HORIZ_SPEED); pp->q16horizbase += fix16_from_int(HORIZ_SPEED);
else else
pp->q16horizbase = fix16_sadd(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval(HORIZ_SPEED))); pp->q16horizbase = fix16_sadd(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval(HORIZ_SPEED)));
@ -2012,7 +2012,7 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
for (i = 1; i; i--) for (i = 1; i; i--)
{ {
// this formula does not work for *pq16horiz = 101-103 // this formula does not work for *pq16horiz = 101-103
if (PEDANTIC_MODE) if (PedanticMode)
pp->q16horizbase += fix16_from_int(25 - (fix16_to_int(pp->q16horizbase) >> 2)); pp->q16horizbase += fix16_from_int(25 - (fix16_to_int(pp->q16horizbase) >> 2));
else else
pp->q16horizbase = fix16_sadd(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(fix16_ssub(fix16_from_int(25), fix16_sdiv(pp->q16horizbase, fix16_from_int(4))))))); pp->q16horizbase = fix16_sadd(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(fix16_ssub(fix16_from_int(25), fix16_sdiv(pp->q16horizbase, fix16_from_int(4)))))));