From 47ac981a3a816ac4cb9a7e56e4aef587fab174e9 Mon Sep 17 00:00:00 2001 From: NY00123 Date: Tue, 14 Apr 2020 18:57:09 +0300 Subject: [PATCH] SW: Let's replace the macro PEDANTIC_MODE with variable PedanticMode --- source/sw/src/draw.cpp | 2 +- source/sw/src/game.cpp | 12 ++++++++---- source/sw/src/game.h | 6 ++---- source/sw/src/player.cpp | 32 ++++++++++++++++---------------- 4 files changed, 27 insertions(+), 25 deletions(-) diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 5dff0bd2e..2ea7805da 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -2013,7 +2013,7 @@ drawscreen(PLAYERp pp) tx = camerapp->oposx + mulscale16(camerapp->posx - camerapp->oposx, smoothratio); ty = camerapp->oposy + mulscale16(camerapp->posy - camerapp->oposy, smoothratio); tz = camerapp->oposz + mulscale16(camerapp->posz - camerapp->oposz, smoothratio); - if (PEDANTIC_MODE || + if (PedanticMode || 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); diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index f8074386a..4c8e64f98 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -185,6 +185,8 @@ short screenpeek = 0; SWBOOL NoDemoStartup = FALSE; SWBOOL FirstTimeIntoGame; +SWBOOL PedanticMode; + SWBOOL BorderAdjust = FALSE; SWBOOL LocationInfo = 0; void drawoverheadmap(int cposx, int cposy, int czoom, short cang); @@ -952,6 +954,8 @@ void InitLevelGlobals(void) sumowasseen = FALSE; zillawasseen = FALSE; memset(BossSpriteNum,-1,sizeof(BossSpriteNum)); + + PedanticMode = (DemoPlaying || DemoRecording || DemoEdit || DemoMode); } void InitLevelGlobals2(void) @@ -2436,7 +2440,7 @@ void MoveLoop(void) } // Get input again to update q16ang/q16horiz. - if (!PEDANTIC_MODE) + if (!PedanticMode) getinput(&loc, TRUE); } @@ -3222,7 +3226,7 @@ getinput(SW_PACKET *loc, SWBOOL tied) if (buttonMap.ButtonDown(gamefunc_Turn_Left)) { turnheldtime += synctics; - if (PEDANTIC_MODE) + if (PedanticMode) { if (turnheldtime >= TURBOTURNTIME) q16angvel -= fix16_from_int(turnamount); @@ -3235,7 +3239,7 @@ getinput(SW_PACKET *loc, SWBOOL tied) else if (buttonMap.ButtonDown(gamefunc_Turn_Right)) { turnheldtime += synctics; - if (PEDANTIC_MODE) + if (PedanticMode) { if (turnheldtime >= TURBOTURNTIME) 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)); q16aimvel = fix16_clamp(q16aimvel, -fix16_from_int(MAXHORIZVEL), fix16_from_int(MAXHORIZVEL)); - if (PEDANTIC_MODE) + if (PedanticMode) { q16angvel = fix16_floor(q16angvel); q16aimvel = fix16_floor(q16aimvel); diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 1baa4f012..da2e45f73 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -186,10 +186,6 @@ int krand1(void); #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" @@ -889,6 +885,8 @@ extern int PlayerYellVocs[MAX_YELLSOUNDS]; void BossHealthMeter(void); +extern SWBOOL PedanticMode; + // Global variables used for modifying variouse things from the Console /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 8c4f3c757..909b31f0e 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1542,7 +1542,7 @@ DoPlayerTurn(PLAYERp pp, fix16_t *pq16ang, fix16_t q16angvel) { #define TURN_SHIFT 2 - if (!PEDANTIC_MODE && (pq16ang == &pp->q16ang)) + if (!PedanticMode && (pq16ang == &pp->q16ang)) { *pq16ang = pp->input.q16ang; 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 // the rest will follow 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))); else // 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; 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))); else *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 = NORM_Q16ANGLE(*pq16ang); - if (PEDANTIC_MODE) + if (PedanticMode) *pq16ang = fix16_floor(*pq16ang); // 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 ((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 { // Get a point, 512 units ahead of player's position @@ -1857,7 +1857,7 @@ PlayerAutoLook(PLAYERp pp) if ((pp->cursectnum == tempsect) || (klabs(getflorzofslope(tempsect, x, y) - k) <= (4 << 8))) { - if (PEDANTIC_MODE) + if (PedanticMode) pp->q16horizoff += fix16_from_int((((j - k) * 160) >> 16)); else 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 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)); else 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 if (pp->q16horizoff > 0) { - if (PEDANTIC_MODE) + if (PedanticMode) pp->q16horizoff -= fix16_from_int(((fix16_to_int(pp->q16horizoff) >> 3) + 1)); else { @@ -1893,7 +1893,7 @@ PlayerAutoLook(PLAYERp pp) } if (pp->q16horizoff < 0) { - if (PEDANTIC_MODE) + if (PedanticMode) pp->q16horizoff += fix16_from_int((((fix16_to_int(-pp->q16horizoff)) >> 3) + 1)); 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)); // MONO_PRINT(ds); - if (!PEDANTIC_MODE && (pq16horiz == &pp->q16horiz)) + if (!PedanticMode && (pq16horiz == &pp->q16horiz)) { *pq16horiz = pp->input.q16horiz; return; @@ -1932,7 +1932,7 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel) if (TEST_SYNC_KEY(pp, SK_CENTER_VIEW)) { - if (PEDANTIC_MODE) + if (PedanticMode) 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 if (TEST_SYNC_KEY(pp, SK_SNAP_DOWN)) { - if (PEDANTIC_MODE) + if (PedanticMode) pp->q16horizbase -= fix16_from_int((HORIZ_SPEED/2)); else 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 if (TEST_SYNC_KEY(pp, SK_SNAP_UP)) { - if (PEDANTIC_MODE) + if (PedanticMode) pp->q16horizbase += fix16_from_int((HORIZ_SPEED/2)); else 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 if (TEST_SYNC_KEY(pp, SK_LOOK_DOWN)) { - if (PEDANTIC_MODE) + if (PedanticMode) pp->q16horizbase -= fix16_from_int(HORIZ_SPEED); else 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 if (TEST_SYNC_KEY(pp, SK_LOOK_UP)) { - if (PEDANTIC_MODE) + if (PedanticMode) pp->q16horizbase += fix16_from_int(HORIZ_SPEED); else 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--) { // 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)); 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)))))));