From af2c836e541f1cfb0116430ce8aefba1d3cdd5cb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 16 Aug 2020 09:04:24 +0200 Subject: [PATCH] - unused code cleanup. --- source/sw/src/draw.cpp | 156 ++------------------------------------ source/sw/src/game.cpp | 2 - source/sw/src/game.h | 1 - source/sw/src/jsector.cpp | 27 ------- source/sw/src/menus.cpp | 88 +-------------------- source/sw/src/network.cpp | 3 +- source/sw/src/player.cpp | 47 +++++------- 7 files changed, 31 insertions(+), 293 deletions(-) diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index c8654713f..bdde79b53 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -60,7 +60,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS static int OverlapDraw = FALSE; -extern SWBOOL QuitFlag, LocationInfo, ConPanel, SpriteInfo; +extern SWBOOL QuitFlag, LocationInfo, SpriteInfo; extern SWBOOL Voxel; extern char buffer[]; SWBOOL DrawScreen; @@ -194,34 +194,6 @@ SetActorRotation(short tSpriteNum, int viewx, int viewy) // thats a big deal tsp->picnum = State->Pic; - //sprintf(ds,"SetActorRotation:tsp->picnum: %d",tsp->picnum); - //CON_Message(ds); - - /* - - !AIC KEY - For actor states EVERY rotation needs to have the same tics - animators. The only thing different can be the picnum. If not then sync bugs - will occur. This code attempts to check to the best of its ability for this - problem. Should go away with shipped compile. - - */ - -#if DEBUG - { - short i; - - for (i = 0; i < tu->RotNum; i++) - { - STATEp TestStateStart, TestState; - - TestStateStart = tu->Rot[i]; - TestState = TestStateStart + StateOffset; - - ASSERT(State->Tics == TestState->Tics); - ASSERT(State->Animator == TestState->Animator); - } - } -#endif return 0; } @@ -283,83 +255,6 @@ DoShadowFindGroundPoint(tspriteptr_t sp) return loz; } -#if 0 -#define GENERIC_SHADOW_PIC 66 -extern SWBOOL bVoxelsOn; -void -DoVoxelShadow(SPRITEp tspr) -{ - // Check for voxels - if (bVoxelsOn) - { - switch (tspr->picnum) - { - case ICON_STAR: // 1793 - case ICON_UZI: // 1797 - case ICON_UZIFLOOR: // 1807 - case ICON_LG_UZI_AMMO: // 1799 - case ICON_HEART: // 1824 - case ICON_HEART_LG_AMMO: // 1820 - case ICON_GUARD_HEAD: // 1814 - case ICON_FIREBALL_LG_AMMO: // 3035 - case ICON_ROCKET: // 1843 - case ICON_SHOTGUN: // 1794 - case ICON_LG_ROCKET: // 1796 - case ICON_LG_SHOTSHELL: // 1823 - case ICON_MICRO_GUN: // 1818 - case ICON_MICRO_BATTERY: // 1800 - case ICON_GRENADE_LAUNCHER: // 1817 - case ICON_LG_GRENADE: // 1831 - case ICON_LG_MINE: // 1842 - case ICON_RAIL_GUN: // 1811 - case ICON_RAIL_AMMO: // 1812 - case ICON_SM_MEDKIT: // 1802 - case ICON_MEDKIT: // 1803 - case ICON_CHEMBOMB: // 1808 - case ICON_FLASHBOMB: // 1805 - case ICON_NUKE: // 1809 - case ICON_CALTROPS: - case ICON_BOOSTER: // 1810 - case ICON_HEAT_CARD: // 1819 - case ICON_REPAIR_KIT: // 1813 - case ICON_EXPLOSIVE_BOX: // 1801 - case ICON_ENVIRON_SUIT: // 1837 - case ICON_FLY: // 1782 - case ICON_CLOAK: // 1826 - case ICON_NIGHT_VISION: // 3031 - case ICON_NAPALM: // 3046 - case ICON_RING: // 3050 - //case ICON_GOROAMMO: // 3035 - //case ICON_HEARTAMMO: // 1820 - case ICON_RINGAMMO: // 3054 - case ICON_NAPALMAMMO: // 3058 - case ICON_GRENADE: // 3059 - //case ICON_OXYGEN: // 1800 - case ICON_ARMOR: // 3030 - case BLUE_KEY: // 1766 - case RED_KEY: // 1770 - case GREEN_KEY: // 1774 - case YELLOW_KEY: // 1778 - case GOLD_SKELKEY: - case SILVER_SKELKEY: - case BRONZE_SKELKEY: - case RED_SKELKEY: - case BLUE_CARD: - case RED_CARD: - case GREEN_CARD: - case YELLOW_CARD: -// tspr->picnum = GENERIC_SHADOW_PIC; - tspr->xrepeat = 0; // For now, don't do voxel shadows - tspr->yrepeat = 0; -// tspr->xrepeat = 27; -// tspr->yrepeat = 4; - //tspr->z+=(sintable[(rotang*2)%2047]/16); - break; - } - } -} -#endif - void DoShadows(tspriteptr_t tsp, int viewz, SWBOOL mirror) { @@ -412,13 +307,6 @@ DoShadows(tspriteptr_t tsp, int viewz, SWBOOL mirror) } } -#if 0 - if (SectUser[tsp->sectnum] && SectUser[tsp->sectnum]->depth) - { - loz -= Z(SectUser[tsp->sectnum]->depth); - } -#endif - // need to find the ground here New->z = loz; @@ -677,6 +565,8 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror) PLAYERp pp = Player + screenpeek; short newshade=0; + const int DART_PIC = 2526; + const int DART_REPEAT = 16; ang = NORM_ANGLE(ang + 12); @@ -689,9 +579,6 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror) tspriteptr_t tsp = &tsprite[tSpriteNum]; tu = User[SpriteNum]; - //if(tsp->statnum == STAT_GENERIC_QUEUE) - // Printf("tsp->pal = %d",tsp->pal); - #if 0 // Brighten up the sprite if set somewhere else to do so if (tu && tu->Vis > 0) @@ -779,12 +666,11 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror) tsp->yrepeat = 29; } -#define DART_PIC 2526 -#define DART_REPEAT 16 if (tu->ID == STAR1) { if (sw_darts) { + tsp->picnum = DART_PIC; tsp->ang = NORM_ANGLE(tsp->ang - 512 - 24); tsp->xrepeat = tsp->yrepeat = DART_REPEAT; @@ -1374,7 +1260,7 @@ FString GameInterface::GetCoordString() void PrintSpriteInfo(PLAYERp pp) { -#define Y_STEP 7 + const int Y_STEP = 7; int x = windowxy1.x+2; int y = windowxy1.y+2; SPRITEp sp; @@ -1447,8 +1333,6 @@ void SpriteSortList2D(int tx, int ty) void DrawCheckKeys(PLAYERp pp) { - if (ConPanel) return; - if (!InputMode) ResizeView(pp); } @@ -1617,15 +1501,6 @@ PostDraw(void) User[i] = NULL; } -#if DEBUG - SPRITEp sp = &sprite[i]; - short statnum = sp->statnum; - short sectnum = sp->sectnum; - memset(sp, 0xCC, sizeof(SPRITE)); - sp->statnum = statnum; - sp->sectnum = sectnum; -#endif - deletesprite(i); } } @@ -1888,23 +1763,9 @@ drawscreen(PLAYERp pp) } tsectnum = camerapp->cursectnum; - //ASSERT(tsectnum >= 0 && tsectnum <= MAXSECTORS); - // if updatesectorz is to sensitive try COVERupdatesector - //updatesectorz(tx, ty, tz, &tsectnum); - COVERupdatesector(tx, ty, &tsectnum); - if (tsectnum < 0) - { -#if 0 - // if we hit an invalid sector move to the last valid position for drawing - tsectnum = lv_sectnum; - tx = lv_x; - ty = lv_y; - tz = lv_z; -#endif - } - else + if (tsectnum >= 0) { // last valid stuff lv_sectnum = tsectnum; @@ -1913,9 +1774,6 @@ drawscreen(PLAYERp pp) lv_z = tz; } - // with "last valid" code this should never happen - // ASSERT(tsectnum >= 0 && tsectnum <= MAXSECTORS); - if (pp->sop_riding || pp->sop_control) { if (pp->sop_control && @@ -1951,7 +1809,6 @@ drawscreen(PLAYERp pp) tq16ang = GetQ16AngleFromVect(pp->sop_remote->xmid - tx, pp->sop_remote->ymid - ty); } - //if (TEST(camerapp->Flags, PF_VIEW_FROM_OUTSIDE)) if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE)) { BackView(&tx, &ty, &tz, &tsectnum, &tq16ang, fix16_to_int(tq16horiz)); @@ -1973,7 +1830,6 @@ drawscreen(PLAYERp pp) pp->obob_z + mulscale16(pp->bob_z - pp->obob_z, smoothratio); // recoil only when not in camera - //tq16horiz = tq16horiz + fix16_from_int(camerapp->recoil_horizoff); tq16horiz = tq16horiz + fix16_from_int(pp->recoil_horizoff); tq16horiz = fix16_max(tq16horiz, fix16_from_int(PLAYER_HORIZ_MIN)); tq16horiz = fix16_min(tq16horiz, fix16_from_int(PLAYER_HORIZ_MAX)); diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 61c3a29d4..66c687fd1 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -94,7 +94,6 @@ void pClearSpriteList(PLAYERp pp); signed char MNU_InputSmallString(char*, short); signed char MNU_InputString(char*, short); SWBOOL IsCommand(const char* str); -SWBOOL MNU_StartNetGame(void); extern SWBOOL mapcheat; extern SWBOOL MultiPlayQuitFlag; @@ -144,7 +143,6 @@ SWBOOL MultiPlayQuitFlag = FALSE; char MessageInputString[256]; char MessageOutputString[256]; SWBOOL ConInputMode = FALSE; -SWBOOL ConPanel = FALSE; SWBOOL FinishedLevel = FALSE; SWBOOL PanelUpdateMode = TRUE; short HelpPage = 0; diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 090a6d350..ae8172ee7 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -199,7 +199,6 @@ y++ extern SWBOOL MenuInputMode; extern SWBOOL ConInputMode; -extern SWBOOL ConPanel; extern SWBOOL InputMode; extern char MessageInputString[256]; extern char MessageOutputString[256]; diff --git a/source/sw/src/jsector.cpp b/source/sw/src/jsector.cpp index cc9e14f83..fe515fdf9 100644 --- a/source/sw/src/jsector.cpp +++ b/source/sw/src/jsector.cpp @@ -277,19 +277,6 @@ JS_SpriteSetup(void) SET(wall[i].extra, WALLFX_DONT_STICK); break; } - -#if 0 - short sndnum; - if ((sndnum = CheckTileSound(picnum)) != -1) - { - SpawnWallSound(sndnum, i); - } - picnum = wall[i].overpicnum; - if ((sndnum = CheckTileSound(picnum)) != -1) - { - SpawnWallSound(sndnum, i); - } -#endif } } @@ -796,12 +783,6 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fix16_t tpq16ang, fix16 dist = j; } - - -// //DSPRINTF(ds,"mirror.tics == %ul", mirror[i].tics); -// MONO_PRINT(ds); - - if (mirror[cnt].ismagic) { SPRITEp sp=NULL; @@ -816,14 +797,6 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fix16_t tpq16ang, fix16 ASSERT(sp); - // char tvisibility; - // tvisibility = g_visibility; -// g_visibility <<= 1; // Make mirror darker - - // Make TV cam style mirror seem to shimmer -// if (mirror[cnt].ismagic && STD_RANDOM_P2(256) > 128) -// g_visibility -= STD_RANDOM_P2(128); - // Calculate the angle of the mirror wall w = mirror[cnt].mirrorwall; diff --git a/source/sw/src/menus.cpp b/source/sw/src/menus.cpp index 9c2b8ad4c..7664cefd5 100644 --- a/source/sw/src/menus.cpp +++ b/source/sw/src/menus.cpp @@ -52,93 +52,10 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS - -//#define PLOCK_VERSION TRUE - extern SWBOOL ExitLevel, NewGame; -short TimeLimitTable[9] = {0,3,5,10,15,20,30,45,60}; - -SWBOOL -MNU_StartNetGame(void) -{ - extern SWBOOL ExitLevel, ShortGameMode, FirstTimeIntoGame; - extern short Level, Skill; - // CTW REMOVED - //extern int gTenActivated; - // CTW REMOVED END - int pnum; - - // always assumed that a demo is playing - - ready2send = 0; - // Skill can go negative here - Skill = gs.NetMonsters - 1; - Level = gs.NetLevel + 1; - ExitLevel = TRUE; - NewGame = TRUE; - // restart demo for multi-play mode - - // TENSW: return if a joiner - if (/* CTW REMOVED gTenActivated && */ !AutoNet && FirstTimeIntoGame) - return TRUE; - - // need to set gNet vars for self - // everone else gets a packet to set them - gNet.AutoAim = cl_autoaim; - gNet.SpawnMarkers = gs.NetSpawnMarkers; - gNet.HurtTeammate = gs.NetHurtTeammate; - gNet.Nuke = gs.NetNuke; - gNet.KillLimit = gs.NetKillLimit * 10; - gNet.TimeLimit = TimeLimitTable[gs.NetTimeLimit] * 60 * 120; - - if (ShortGameMode) - { - gNet.KillLimit /= 10; - gNet.TimeLimit /= 2; - } - - gNet.TimeLimitClock = gNet.TimeLimit; - gNet.TeamPlay = gs.NetTeamPlay; - gNet.MultiGameType = gs.NetGameType + 1; - - if (gNet.MultiGameType == MULTI_GAME_COMMBAT_NO_RESPAWN) - { - gNet.MultiGameType = MULTI_GAME_COMMBAT; - gNet.NoRespawn = TRUE; - } - else - { - gNet.NoRespawn = FALSE; - } - - if (CommEnabled) - { - PACKET_NEW_GAME p; - - p.PacketType = PACKET_TYPE_NEW_GAME; - p.Level = Level; - p.Skill = Skill; - p.GameType = gs.NetGameType; - p.AutoAim = cl_autoaim; - p.HurtTeammate = gs.NetHurtTeammate; - p.TeamPlay = gs.NetTeamPlay; - p.SpawnMarkers = gs.NetSpawnMarkers; - p.KillLimit = gs.NetKillLimit; - p.TimeLimit = gs.NetTimeLimit; - p.Nuke = gs.NetNuke; - - netbroadcastpacket((uint8_t*)(&p), sizeof(p)); // TENSW - } - - - return TRUE; -} - - ////////////////////////////////////////////////////////////////////////////// -#define FADE_DAMAGE_FACTOR 3 // 100 health / 32 shade cycles = 3.125 // Fades from 100% to 62.5% somewhat quickly, // then from 62.5% to 37.5% slowly, @@ -177,6 +94,8 @@ typedef struct RGB_color_typ ////////////////////////////////////////// void SetFadeAmt(PLAYERp pp, short damage, unsigned char startcolor) { + const int FADE_DAMAGE_FACTOR = 3; // 100 health / 32 shade cycles = 3.125 + short fadedamage = 0; RGB_color color; @@ -239,9 +158,10 @@ void SetFadeAmt(PLAYERp pp, short damage, unsigned char startcolor) ////////////////////////////////////////// // Do the screen reddness based on damage ////////////////////////////////////////// -#define MAXFADETICS 5 void DoPaletteFlash(PLAYERp pp) { + const int MAXFADETICS = 5; + if (pp->FadeAmt <= 1) { pp->FadeAmt = 0; diff --git a/source/sw/src/network.cpp b/source/sw/src/network.cpp index f97df204e..d5b8fdc38 100644 --- a/source/sw/src/network.cpp +++ b/source/sw/src/network.cpp @@ -1339,7 +1339,8 @@ getpackets(void) { extern SWBOOL NewGame, ShortGameMode; PACKET_NEW_GAMEp p; - extern short TimeLimitTable[]; + static const short TimeLimitTable[9] = { 0,3,5,10,15,20,30,45,60 }; + pp = Player + otherconnectindex; diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 272fddb53..8271746d2 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -2503,42 +2503,33 @@ MoveScrollMode2D(PLAYERp pp) keymove = NORMALKEYMOVE; } - if (!ConPanel) + if (buttonMap.ButtonDown(gamefunc_Turn_Left)) { - if (buttonMap.ButtonDown(gamefunc_Turn_Left)) - { - mfsvel -= -keymove; - } - if (buttonMap.ButtonDown(gamefunc_Turn_Right)) - { - mfsvel -= keymove; - } + mfsvel -= -keymove; + } + if (buttonMap.ButtonDown(gamefunc_Turn_Right)) + { + mfsvel -= keymove; } - if (!ConPanel) + if (buttonMap.ButtonDown(gamefunc_Strafe_Left)) { - if (buttonMap.ButtonDown(gamefunc_Strafe_Left)) - { - mfsvel += keymove; - } - - if (buttonMap.ButtonDown(gamefunc_Strafe_Right)) - { - mfsvel += -keymove; - } + mfsvel += keymove; } - if (!ConPanel) + if (buttonMap.ButtonDown(gamefunc_Strafe_Right)) { - if (buttonMap.ButtonDown(gamefunc_Move_Forward)) - { - mfvel += keymove; - } + mfsvel += -keymove; + } - if (buttonMap.ButtonDown(gamefunc_Move_Backward)) - { - mfvel += -keymove; - } + if (buttonMap.ButtonDown(gamefunc_Move_Forward)) + { + mfvel += keymove; + } + + if (buttonMap.ButtonDown(gamefunc_Move_Backward)) + { + mfvel += -keymove; } if (mfvel < -MAXVEL)