diff --git a/source/games/duke/src/d_menu.cpp b/source/games/duke/src/d_menu.cpp index 473c03938..7df808484 100644 --- a/source/games/duke/src/d_menu.cpp +++ b/source/games/duke/src/d_menu.cpp @@ -275,7 +275,6 @@ void GameInterface::MenuClosed() cameradist = 65536; } - updateviewport(); S_PauseSounds(false); } } diff --git a/source/games/duke/src/game.h b/source/games/duke/src/game.h index ef5470e16..22464e2f7 100644 --- a/source/games/duke/src/game.h +++ b/source/games/duke/src/game.h @@ -36,80 +36,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_DUKE_NS -#ifndef ONLY_USERDEFS - -// Compile game-side legacy Room over Room code? -#define LEGACY_ROR 1 - -enum GametypeFlags_t { - GAMETYPE_COOP = 0x00000001, - GAMETYPE_WEAPSTAY = 0x00000002, - GAMETYPE_FRAGBAR = 0x00000004, - GAMETYPE_SCORESHEET = 0x00000008, - GAMETYPE_DMSWITCHES = 0x00000010, - GAMETYPE_COOPSPAWN = 0x00000020, - GAMETYPE_ACCESSCARDSPRITES = 0x00000040, - GAMETYPE_COOPVIEW = 0x00000080, - GAMETYPE_COOPSOUND = 0x00000100, - GAMETYPE_OTHERPLAYERSINMAP = 0x00000200, - GAMETYPE_ITEMRESPAWN = 0x00000400, - GAMETYPE_MARKEROPTION = 0x00000800, - GAMETYPE_PLAYERSFRIENDLY = 0x00001000, - GAMETYPE_FIXEDRESPAWN = 0x00002000, - GAMETYPE_ACCESSATSTART = 0x00004000, - GAMETYPE_PRESERVEINVENTORYDEATH = 0x00008000, - GAMETYPE_TDM = 0x00010000, - GAMETYPE_TDMSPAWN = 0x00020000 -}; - -// logo control -enum LogoFlags_t { - LOGO_ENABLED = 0x00000001, - LOGO_PLAYANIM = 0x00000002, - LOGO_PLAYMUSIC = 0x00000004, - LOGO_3DRSCREEN = 0x00000008, - LOGO_TITLESCREEN = 0x00000010, - LOGO_DUKENUKEM = 0x00000020, - LOGO_THREEDEE = 0x00000040, - LOGO_PLUTOPAKSPRITE = 0x00000080, - LOGO_SHAREWARESCREENS = 0x00000100, - LOGO_TENSCREEN = 0x00000200, - LOGO_STOPANIMSOUNDS = 0x00000400, - LOGO_NOE4CUTSCENE = 0x00000800, - LOGO_NOE1BONUSSCENE = 0x00001000, - LOGO_NOE2BONUSSCENE = 0x00002000, - LOGO_NOE3BONUSSCENE = 0x00004000, - LOGO_NOE4BONUSSCENE = 0x00008000, - LOGO_NOE1ENDSCREEN = 0x00010000, - LOGO_NOE2ENDSCREEN = 0x00020000, - LOGO_NOE3RADLOGO = 0x00040000, - LOGO_NODUKETEAMTEXT = 0x00080000, - LOGO_NODUKETEAMPIC = 0x00100000, - LOGO_STOPMISCSOUNDS = 0x00200000, - LOGO_NOGAMETITLE = 0x00400000, - LOGO_NOTITLEBAR = 0x00800000, - LOGO_HIDEEPISODE = 0x01000000, - LOGO_NOHELP = 0x02000000, - LOGO_NOCREDITS = 0x04000000, -}; - -enum { - STATUSBAR_NONONE = 0x00000001, - STATUSBAR_NOMINI = 0x00000002, - STATUSBAR_NOFULL = 0x00000004, - STATUSBAR_NOSHRINK = 0x00000008, - STATUSBAR_NOFRAGBAR = 0x00000010, - STATUSBAR_NOOVERLAY = 0x00000020, - STATUSBAR_NOMODERN = 0x00000040, -}; - - -# define CAMERA(Membname) (ud.camera ## Membname) -# define CAMERADIST cameradist -# define CAMERACLOCK cameraclock - -#endif - #define MAXSAVEGAMENAMESTRUCT 32 #define MAXSAVEGAMENAME (MAXSAVEGAMENAMESTRUCT-1) #define MAXPWLOCKOUT 128 @@ -129,7 +55,7 @@ typedef struct { int32_t statusbarmode; int32_t noexits,automsg; int32_t althud; - int32_t statusbarflags, statusbarrange; + int32_t statusbarrange; int32_t entered_name,screen_tilting; int32_t coop,screen_size,lockout,crosshair; diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 12a4a69e2..479a6bdbb 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -291,46 +291,6 @@ void drawbackground(void) DrawTexture(twod, tex, 0, 0, DTA_VirtualWidth, twod->GetWidth(), DTA_VirtualHeight, twod->GetHeight(), DTA_KeepRatio, true, DTA_Color, color, TAG_DONE); return; } - - auto tex = tileGetTexture(TILE_SCREENBORDER); - if (tex != nullptr && tex->isValid()) - { - if (windowxy1.y > 0) - { - twod->AddFlatFill(0, 0, twod->GetWidth(), windowxy1.y, tex, false, 1); - } - if (windowxy2.y + 1 < twod->GetHeight()) - { - twod->AddFlatFill(0, windowxy2.y + 1, twod->GetWidth(), twod->GetHeight(), tex, false, 1); - } - if (windowxy1.x > 0) - { - twod->AddFlatFill(0, windowxy1.y, windowxy1.x, windowxy2.y + 1, tex, false, 1); - } - if (windowxy2.x + 1 < twod->GetWidth()) - { - twod->AddFlatFill(windowxy2.x + 1, windowxy1.y, twod->GetWidth(), windowxy2.y + 1, tex, false, 1); - } - auto vb = tileGetTexture(TILE_VIEWBORDER); - auto ve = tileGetTexture(TILE_VIEWBORDER + 1); - int x1 = windowxy1.x - 4; - int y1 = windowxy1.y - 4; - int x2 = windowxy2.x + 5; - int y2 = windowxy2.y + 5; - twod->AddFlatFill(x1, y1, x2, y1 + 4, vb, 5); - twod->AddFlatFill(x1, y2 - 4, x2, y2, vb, 6); - twod->AddFlatFill(x1, y1, x1 + 4, y2, vb, 1); - twod->AddFlatFill(x2 - 4, y1, x2, y2, vb, 3); - twod->AddFlatFill(x1, y1, x1 + 4, y1 + 4, ve, 1); - twod->AddFlatFill(x2 - 4, y1, x2, y1 + 4, ve, 3); - twod->AddFlatFill(x1, y2 - 4, x1 + 4, y2, ve, 2); - twod->AddFlatFill(x2 - 4, y2 - 4, x2, y2, ve, 4); - } - else - { - // If we got no frame just clear the screen. - twod->ClearScreen(); - } } //--------------------------------------------------------------------------- @@ -665,57 +625,6 @@ void cameratext(int i) } } -//--------------------------------------------------------------------------- -// -// calculate size of 3D viewport. -// Fixme: this needs to be adjusted to the new status bar code, -// once the status bar is a persistent queriable object -// (it should also be moved out of the game code then. -// -//--------------------------------------------------------------------------- - -void updateviewport(void) -{ - ud.screen_size = clamp(ud.screen_size, 0, 64); - int ss = std::max(ud.screen_size - 8, 0); - - int x1 = scale(ss, xdim, 160); - int x2 = xdim - x1; - - int y1 = scale(ss, (200 * 100) - ((tilesiz[TILE_BOTTOMSTATUSBAR].y >> (RR ? 1 : 0)) * ud.statusbarscale), 200 - tilesiz[TILE_BOTTOMSTATUSBAR].y); - int y2 = 200 * 100 - y1; - - if (isRR() && ud.screen_size <= 12) - { - x1 = 0; - x2 = xdim; - y1 = 0; - if (ud.statusbarmode) - y2 = 200 * 100; - } - - int fbh = 0; - if (ud.screen_size > 0 && ud.coop != 1 && ud.multimode > 1) - { - int j = 0; - for (int i = connecthead; i >= 0; i = connectpoint2[i]) - if (i > j) j = i; - - if (j >= 1) fbh += 8; - if (j >= 4) fbh += 8; - if (j >= 8) fbh += 8; - if (j >= 12) fbh += 8; - } - - y1 += fbh * 100; - if (ud.screen_size >= 8 && ud.statusbarmode == 0) - y2 -= (tilesiz[TILE_BOTTOMSTATUSBAR].y >> (isRR() ? 1 : 0)) * ud.statusbarscale; - y1 = scale(y1, ydim, 200 * 100); - y2 = scale(y2, ydim, 200 * 100); - - videoSetViewableArea(x1, y1, x2 - 1, y2 - 1); -} - END_DUKE_NS diff --git a/source/games/duke/src/macros.h b/source/games/duke/src/macros.h index bd4e116c7..bcf1ef86f 100644 --- a/source/games/duke/src/macros.h +++ b/source/games/duke/src/macros.h @@ -44,8 +44,6 @@ static FORCE_INLINE int32_t krand2(void) TILE_SCRAP6+(r4&15),-8,RR?16:48,RR?16:48,r3&2047,(r2&63)+64,-512-(r1&2047),i,5); \ } -#define GTFLAGS(x) (g_gametypeFlags[ud.coop] & x) - #define TRAVERSE_SPRITE_SECT(l, o, n) (o) = (l); ((o) != -1) && ((n) = nextspritesect[o]); (o) = (n) #define TRAVERSE_SPRITE_STAT(l, o, n) (o) = (l); ((o) != -1) && ((n) = nextspritestat[o]); (o) = (n) #define TRAVERSE_CONNECT(i) i = 0; i != -1; i = connectpoint2[i] diff --git a/source/games/duke/src/premap.h b/source/games/duke/src/premap.h index ac35d7c2f..75204bf62 100644 --- a/source/games/duke/src/premap.h +++ b/source/games/duke/src/premap.h @@ -33,7 +33,6 @@ int G_FindLevelByFile(const char *fileName); void G_CacheMapData(void); void G_NewGame(int volumeNum, int levelNum, int skillNum); void G_ResetTimers(uint8_t keepgtics); -void updateviewport(void); void pickrandomspot(int playerNum); void resetinventory(int playerNum); void P_ResetPlayer(int playerNum); diff --git a/source/games/duke/src/premap_d.cpp b/source/games/duke/src/premap_d.cpp index bba0c586b..1473fe911 100644 --- a/source/games/duke/src/premap_d.cpp +++ b/source/games/duke/src/premap_d.cpp @@ -177,15 +177,12 @@ static void cachegoodsprites(void) { int i; - if (ud.screen_size >= 8) + tloadtile(BOTTOMSTATUSBAR); + if (ud.multimode > 1) { - tloadtile(BOTTOMSTATUSBAR); - if (ud.multimode > 1) - { - tloadtile(FRAGBAR); - for (i = MINIFONT; i < MINIFONT + 63; i++) - tloadtile(i); - } + tloadtile(FRAGBAR); + for (i = MINIFONT; i < MINIFONT + 63; i++) + tloadtile(i); } tloadtile(VIEWSCREEN); @@ -547,11 +544,8 @@ void enterlevel(char g) clearsoundlocks(); FX_SetReverb(0); - i = ud.screen_size; - ud.screen_size = 0; dofrontscreens(); vscrn(); - ud.screen_size = i; #ifndef VOLUMEONE @@ -684,8 +678,8 @@ void enterlevel(char g) palto(0,0,0,0); vscrn(); clearview(0L); - drawbackground(); displayrooms(myconnectindex,65536); + displayrest(screenpeek); clearbufbyte(playerquitflag,MAXPLAYERS,0x01010101); ps[myconnectindex].over_shoulder_on = 0; diff --git a/source/games/duke/src/premap_r.cpp b/source/games/duke/src/premap_r.cpp index 021b06728..e2099f985 100644 --- a/source/games/duke/src/premap_r.cpp +++ b/source/games/duke/src/premap_r.cpp @@ -327,13 +327,10 @@ static void cachegoodsprites(void) { short i; - if (ud.screen_size >= 8) + tloadtile(BOTTOMSTATUSBAR); + if (ud.multimode > 1) { - tloadtile(BOTTOMSTATUSBAR); - if (ud.multimode > 1) - { - tloadtile(FRAGBAR); - } + tloadtile(FRAGBAR); } //tloadtile(VIEWSCREEN); @@ -840,12 +837,9 @@ void enterlevel(char g) if ((g & MODE_DEMO) == 0 && ud.recstat == 2) ud.recstat = 0; - i = ud.screen_size; - ud.screen_size = 0; dofrontscreens(); vscrn(); - ud.screen_size = i; - + if (lastlevel) { if (loadboard("endgame.map", &ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang, &ps[0].cursectnum) == -1) @@ -991,7 +985,6 @@ void loadlevel(const char *filename) palto(0,0,0,0); vscrn(); clearview(0L); - drawbackground(); displayrooms(screenpeek,65536); displayrest(screenpeek); nextpage(); diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index ebaa150c4..f2a7c1658 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -33,6 +33,8 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) BEGIN_DUKE_NS +void DrawBorder(); + //--------------------------------------------------------------------------- // // Floor Over Floor @@ -469,8 +471,7 @@ void displayrooms(int snum, int smoothratio) int tiltcs = 0; // JBF 20030807 p = &ps[snum]; - - if (ud.screen_size >= 8) drawbackground(); + DrawBorder(); if (ud.overhead_on == 2 || p->cursectnum == -1) return; diff --git a/source/games/duke/src/sbar.cpp b/source/games/duke/src/sbar.cpp index e8a44333e..70cefac0a 100644 --- a/source/games/duke/src/sbar.cpp +++ b/source/games/duke/src/sbar.cpp @@ -170,6 +170,7 @@ PalEntry DDukeCommonStatusBar::LightForShade(int shade) return PalEntry(255, ll, ll, ll); } + //========================================================================== // // Statistics output @@ -220,4 +221,141 @@ void DDukeCommonStatusBar::PrintLevelStats(int bottomy) } } +//========================================================================== +// +// 3D viewport size management +// +//========================================================================== + +void DrawBorder() +{ + auto tex = tileGetTexture(TILE_SCREENBORDER); + if (tex != nullptr && tex->isValid()) + { + if (windowxy1.y > 0) + { + twod->AddFlatFill(0, 0, twod->GetWidth(), windowxy1.y, tex, false, 1); + } + if (windowxy2.y + 1 < twod->GetHeight()) + { + twod->AddFlatFill(0, windowxy2.y + 1, twod->GetWidth(), twod->GetHeight(), tex, false, 1); + } + if (windowxy1.x > 0) + { + twod->AddFlatFill(0, windowxy1.y, windowxy1.x, windowxy2.y + 1, tex, false, 1); + } + if (windowxy2.x + 1 < twod->GetWidth()) + { + twod->AddFlatFill(windowxy2.x + 1, windowxy1.y, twod->GetWidth(), windowxy2.y + 1, tex, false, 1); + } + auto vb = tileGetTexture(TILE_VIEWBORDER); + auto ve = tileGetTexture(TILE_VIEWBORDER + 1); + int x1 = windowxy1.x - 4; + int y1 = windowxy1.y - 4; + int x2 = windowxy2.x + 5; + int y2 = windowxy2.y + 5; + twod->AddFlatFill(x1, y1, x2, y1 + 4, vb, 5); + twod->AddFlatFill(x1, y2 - 4, x2, y2, vb, 6); + twod->AddFlatFill(x1, y1, x1 + 4, y2, vb, 1); + twod->AddFlatFill(x2 - 4, y1, x2, y2, vb, 3); + twod->AddFlatFill(x1, y1, x1 + 4, y1 + 4, ve, 1); + twod->AddFlatFill(x2 - 4, y1, x2, y1 + 4, ve, 3); + twod->AddFlatFill(x1, y2 - 4, x1 + 4, y2, ve, 2); + twod->AddFlatFill(x2 - 4, y2 - 4, x2, y2, ve, 4); + } + else + { + // If we got no frame just clear the screen. + twod->ClearScreen(); + } +} + +//--------------------------------------------------------------------------- +// +// calculate size of 3D viewport. +// Fixme: this needs to be adjusted to the new status bar code, +// once the status bar is a persistent queriable object +// (it should also be moved out of the game code then. +// +//--------------------------------------------------------------------------- + +void updateviewport(void) +{ + ud.screen_size = clamp(ud.screen_size, 0, 64); + int ss = std::max(ud.screen_size - 8, 0); + + int x1 = scale(ss, xdim, 160); + int x2 = xdim - x1; + + int y1 = scale(ss, (200 * 100) - ((tilesiz[TILE_BOTTOMSTATUSBAR].y >> (RR ? 1 : 0)) * ud.statusbarscale), 200 - tilesiz[TILE_BOTTOMSTATUSBAR].y); + int y2 = 200 * 100 - y1; + + if (isRR() && ud.screen_size <= 12) + { + x1 = 0; + x2 = xdim; + y1 = 0; + if (ud.statusbarmode) + y2 = 200 * 100; + } + + int fbh = 0; + if (ud.screen_size > 0 && ud.coop != 1 && ud.multimode > 1) + { + int j = 0; + for (int i = connecthead; i >= 0; i = connectpoint2[i]) + if (i > j) j = i; + + if (j >= 1) fbh += 8; + if (j >= 4) fbh += 8; + if (j >= 8) fbh += 8; + if (j >= 12) fbh += 8; + } + + y1 += fbh * 100; + if (ud.screen_size >= 8 && ud.statusbarmode == 0) + y2 -= (tilesiz[TILE_BOTTOMSTATUSBAR].y >> (isRR() ? 1 : 0)) * ud.statusbarscale; + y1 = scale(y1, ydim, 200 * 100); + y2 = scale(y2, ydim, 200 * 100); + + videoSetViewableArea(x1, y1, x2 - 1, y2 - 1); +} + +//========================================================================== +// +// view sizing game interface +// +//========================================================================== + +bool GameInterface::validate_hud(int layout) +{ + return layout <= 11; +} + +void GameInterface::set_hud_layout(int layout) +{ + static const uint8_t screen_size_vals[] = { 60, 54, 48, 40, 32, 24, 16, 8, 8, 4, 4, 0 }; + static const uint8_t screen_size_vals_rr[] = { 56, 48, 40, 32, 24, 16, 12, 8, 8, 4, 4, 0 }; + if (validate_hud(layout)) + { + ud.screen_size = isRR()? screen_size_vals_rr[layout] : screen_size_vals[layout]; + ud.statusbarmode = layout >= 8; + ud.althud = layout >= 10; + updateviewport(); + } +} + +void GameInterface::set_hud_scale(int scale) +{ + ud.statusbarscale = clamp(scale, 36, 100); + updateviewport(); +} + +void GameInterface::UpdateScreenSize() +{ + updateviewport(); +} + + + END_DUKE_NS diff --git a/source/games/duke/src/sbar_d.cpp b/source/games/duke/src/sbar_d.cpp index add1f830c..18bec25bd 100644 --- a/source/games/duke/src/sbar_d.cpp +++ b/source/games/duke/src/sbar_d.cpp @@ -353,7 +353,7 @@ public: FString format; - if (ud.multimode > 1 && (g_gametypeFlags[ud.coop] & GAMETYPE_FRAGBAR)) + if (ud.multimode > 1 && !ud.coop) { DrawGraphic(tileGetTexture(KILLSICON), 228, top + 8, DI_ITEM_OFFSETS, 1, 0, 0, 1, 1); format.Format("%d", max(p->frag - p->fraggedself, 0)); diff --git a/source/games/duke/src/sbar_r.cpp b/source/games/duke/src/sbar_r.cpp index 2d5d724b5..49aaf867c 100644 --- a/source/games/duke/src/sbar_r.cpp +++ b/source/games/duke/src/sbar_r.cpp @@ -297,7 +297,7 @@ public: FString format; - if (ud.multimode > 1 && (g_gametypeFlags[ud.coop] & GAMETYPE_FRAGBAR)) + if (ud.multimode > 1 && !ud.coop) { DrawGraphic(tileGetTexture(KILLSICON), 228, top + 8, DI_ITEM_OFFSETS, 1, 0, 0, 1, 1); format.Format("%d", max(p->frag - p->fraggedself, 0)); diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index 22232a484..a0517694c 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -87,20 +87,6 @@ static void gameTimerHandler(void) } } -static int G_MaybeTakeOnFloorPal(tspritetype *pSprite, int sectNum) -{ - int const floorPal = sector[sectNum].floorpal; - - if (floorPal && !lookups.noFloorPal(floorPal) && !actorflag(pSprite->owner, SFLAG_NOPAL)) - { - pSprite->pal = floorPal; - return 1; - } - - return 0; -} - - void G_InitTimer(int32_t ticspersec) { if (g_timerTicsPerSecond != ticspersec) @@ -132,56 +118,6 @@ int G_StartRTS(int lumpNum, int localPlayer) return 0; } -// Trying to sanitize the mess of options and the mess of variables the mess was stored in. (Did I say this was a total mess before...? >) ) -// Hopefully this is more comprehensible, at least it neatly stores everything useful in a single linear value... -bool GameInterface::validate_hud(int layout) -{ - if (layout <= (RR? 5: 6)) // Status bar with border - { - return !(ud.statusbarflags & STATUSBAR_NOSHRINK); - } - else if (layout <= 7) // Status bar fullscreen - { - return (!(ud.statusbarflags & STATUSBAR_NOFULL) || !(ud.statusbarflags & STATUSBAR_NOOVERLAY)); - } - else if (layout == 8) // Status bar overlay - { - return !(ud.statusbarflags & STATUSBAR_NOOVERLAY); - } - else if (layout == 9) // Fullscreen HUD - { - return (!(ud.statusbarflags & STATUSBAR_NOMINI) || !(ud.statusbarflags & STATUSBAR_NOMODERN)); - } - else if (layout == 10) - { - return !(ud.statusbarflags & STATUSBAR_NOMODERN); - } - else if (layout == 11) - { - return !(ud.statusbarflags & STATUSBAR_NONONE); - } - return false; -} - -void GameInterface::set_hud_layout(int layout) -{ - static const uint8_t screen_size_vals[] = { 60, 54, 48, 40, 32, 24, 16, 8, 8, 4, 4, 0 }; - static const uint8_t screen_size_vals_rr[] = { 56, 48, 40, 32, 24, 16, 12, 8, 8, 4, 4, 0 }; - if (validate_hud(layout)) - { - ud.screen_size = RR? screen_size_vals_rr[layout] : screen_size_vals[layout]; - ud.statusbarmode = layout >= 8; - ud.althud = layout >= 10; - updateviewport(); - } -} - -void GameInterface::set_hud_scale(int scale) -{ - ud.statusbarscale = clamp(scale, 36, 100); - updateviewport(); -} - void G_HandleLocalKeys(void) { // CONTROL_ProcessBinds(); @@ -209,8 +145,6 @@ void G_HandleLocalKeys(void) { hud_scale = hud_scale + 4; } - - updateviewport(); } if (buttonMap.ButtonDown(gamefunc_Shrink_Screen)) @@ -228,15 +162,13 @@ void G_HandleLocalKeys(void) { hud_scale = hud_scale - 4; } - - updateviewport(); } } if (g_player[myconnectindex].ps->cheat_phase == 1 || (g_player[myconnectindex].ps->gm&(MODE_MENU|MODE_TYPE)) || System_WantGuiCapture()) return; - if (buttonMap.ButtonDown(gamefunc_See_Coop_View) && (GTFLAGS(GAMETYPE_COOPVIEW) || ud.recstat == 2)) + if (buttonMap.ButtonDown(gamefunc_See_Coop_View) && (ud.coop || ud.recstat == 2)) { buttonMap.ClearButton(gamefunc_See_Coop_View); screenpeek = connectpoint2[screenpeek]; @@ -318,8 +250,8 @@ void G_HandleLocalKeys(void) { g_player[myconnectindex].ps->over_shoulder_on = !g_player[myconnectindex].ps->over_shoulder_on; - CAMERADIST = 0; - CAMERACLOCK = (int32_t) totalclock; + cameradist = 0; + cameraclock = (int32_t) totalclock; FTA(QUOTE_VIEW_MODE_OFF + g_player[myconnectindex].ps->over_shoulder_on, g_player[myconnectindex].ps); } @@ -347,7 +279,6 @@ void G_HandleLocalKeys(void) ud.last_overhead = ud.overhead_on; ud.overhead_on = 0; ud.scrollmode = 0; - updateviewport(); } #endif @@ -367,7 +298,6 @@ void G_HandleLocalKeys(void) } restorepalette = 1; - updateviewport(); } } @@ -431,14 +361,6 @@ static void G_CompileScripts(void) VM_OnEvent(EVENT_INIT); } -static inline void G_CheckGametype(void) -{ - m_coop = clamp(*m_coop, 0, g_gametypeCnt-1); - Printf("%s\n",g_gametypeNames[m_coop]); - if (g_gametypeFlags[m_coop] & GAMETYPE_ITEMRESPAWN) - ud.m_respawn_items = ud.m_respawn_inventory = 1; -} - inline int G_CheckPlayerColor(int color) { static int32_t player_pals[] = { 0, 9, 10, 11, 12, 13, 14, 15, 16, 21, 23, }; @@ -464,7 +386,6 @@ static void G_Startup(void) // These depend on having the dynamic tile and/or sound mappings set up: G_InitMultiPsky(TILE_CLOUDYOCEAN, TILE_MOONSKY1, TILE_BIGORBIT1, TILE_LA); Net_SendClientInfo(); - if (g_netServer || ud.multimode > 1) G_CheckGametype(); if (userConfig.CommandMap.IsNotEmpty()) { @@ -574,11 +495,6 @@ static int G_EndOfLevel(void) if (ud.display_bonus_screen == 1) { - int32_t i = ud.screen_size; - ud.screen_size = 0; - updateviewport(); - ud.screen_size = i; - G_BonusScreen(0); } @@ -703,7 +619,6 @@ int32_t SetDefaults(void) ud.camera_time = 0;//4; ud.screen_tilting = 1; - ud.statusbarflags = 0;// STATUSBAR_NOSHRINK; playerteam = 0; ud.angleinterpolation = 0; @@ -901,19 +816,13 @@ MAIN_LOOP_RESTART: goto MAIN_LOOP_RESTART; } } - else updateviewport(); ud.showweapons = ud.config.ShowOpponentWeapons; P_SetupMiscInputSettings(); g_player[myconnectindex].pteam = playerteam; - if (g_gametypeFlags[ud.coop] & GAMETYPE_TDM) - g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = G_GetTeamPalette(g_player[myconnectindex].pteam); - else - { - if (playercolor) g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = G_CheckPlayerColor(playercolor); - else g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor; - } + if (playercolor) g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = G_CheckPlayerColor(playercolor); + else g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor; ud.warp_on = 0; inputState.ClearKeyStatus(sc_Pause); // JBF: I hate the pause key @@ -1001,8 +910,6 @@ MAIN_LOOP_RESTART: drawtime.Reset(); drawtime.Clock(); displayrooms(screenpeek, smoothRatio); - if (videoGetRenderMode() >= REND_POLYMOST) - drawbackground(); G_DisplayRest(smoothRatio); drawtime.Unclock(); videoNextPage(); @@ -1084,14 +991,7 @@ int G_DoMoveThings(void) if (g_player[i].input->extbits&(1<<6)) { g_player[i].ps->team = g_player[i].pteam; - if (g_gametypeFlags[ud.coop] & GAMETYPE_TDM) - { - actor[g_player[i].ps->i].picnum = TILE_APLAYERTOP; - quickkill(g_player[i].ps); - } } - if (g_gametypeFlags[ud.coop] & GAMETYPE_TDM) - g_player[i].ps->palookup = g_player[i].pcolor = G_GetTeamPalette(g_player[i].ps->team); if (sprite[g_player[i].ps->i].pal != 1) sprite[g_player[i].ps->i].pal = g_player[i].pcolor; @@ -1139,11 +1039,6 @@ void GameInterface::FreeGameData() G_Cleanup(); } -void GameInterface::UpdateScreenSize() -{ - updateviewport(); -} - ::GameInterface* CreateInterface() { return new GameInterface; diff --git a/source/games/duke/src/zz_global.cpp b/source/games/duke/src/zz_global.cpp index 4c2935944..da7549519 100644 --- a/source/games/duke/src/zz_global.cpp +++ b/source/games/duke/src/zz_global.cpp @@ -34,49 +34,6 @@ const char *s_buildDate = "20120522"; char g_gametypeNames[MAXGAMETYPES][33] = { "DukeMatch (Spawn)", "Cooperative Play", "DukeMatch (No Spawn)", "Team DM (Spawn)", "Team DM (No Spawn)" }; -int32_t g_gametypeFlags[MAXGAMETYPES] = -{ - GAMETYPE_FRAGBAR | - GAMETYPE_SCORESHEET | - GAMETYPE_DMSWITCHES | - GAMETYPE_ITEMRESPAWN | - GAMETYPE_MARKEROPTION | - GAMETYPE_ACCESSATSTART, - - GAMETYPE_COOP | - GAMETYPE_WEAPSTAY | - GAMETYPE_COOPSPAWN | - GAMETYPE_ACCESSCARDSPRITES | - GAMETYPE_COOPVIEW | - GAMETYPE_COOPSOUND | - GAMETYPE_OTHERPLAYERSINMAP | - GAMETYPE_PLAYERSFRIENDLY | - GAMETYPE_FIXEDRESPAWN | - GAMETYPE_PRESERVEINVENTORYDEATH, - - GAMETYPE_WEAPSTAY | - GAMETYPE_FRAGBAR | - GAMETYPE_SCORESHEET | - GAMETYPE_DMSWITCHES | - GAMETYPE_ACCESSATSTART, - - GAMETYPE_FRAGBAR | - GAMETYPE_SCORESHEET | - GAMETYPE_DMSWITCHES | - GAMETYPE_ITEMRESPAWN | - GAMETYPE_MARKEROPTION | - GAMETYPE_ACCESSATSTART | - GAMETYPE_TDM | - GAMETYPE_TDMSPAWN, - - GAMETYPE_WEAPSTAY | - GAMETYPE_FRAGBAR | - GAMETYPE_SCORESHEET | - GAMETYPE_DMSWITCHES | - GAMETYPE_ACCESSATSTART | - GAMETYPE_TDM | - GAMETYPE_TDMSPAWN, -}; float g_gameUpdateAvgTime = -1.f; diff --git a/source/games/duke/src/zz_premap.cpp b/source/games/duke/src/zz_premap.cpp index af7687232..2b2b03041 100644 --- a/source/games/duke/src/zz_premap.cpp +++ b/source/games/duke/src/zz_premap.cpp @@ -370,20 +370,13 @@ int G_EnterLevel(int gameMode) return 1; } - i = ud.screen_size; - ud.screen_size = 0; - FStringf msg("%s . . .", GStrings("TXT_LOADMAP")); - - ud.screen_size = i; - DukePlayer_t *const pPlayer = g_player[0].ps; /* G_DoLoadScreen(msg, -1); */ - updateviewport(); int res = LoadTheMap(mi, pPlayer, gameMode); if (res != 0) return res; @@ -477,10 +470,9 @@ int G_EnterLevel(int gameMode) restorepalette = -1; - updateviewport(); videoClearViewableArea(0L); - drawbackground(); displayrooms(myconnectindex,65536); + G_DisplayRest(65536); Net_WaitForEverybody(); return 0; diff --git a/source/games/duke/src/zz_savegame.cpp b/source/games/duke/src/zz_savegame.cpp index 6bc7eb46f..c7b50ec11 100644 --- a/source/games/duke/src/zz_savegame.cpp +++ b/source/games/duke/src/zz_savegame.cpp @@ -1429,7 +1429,6 @@ static void postloadplayer(int32_t savegamep) T1(i) = 0; } - updateviewport(); FX_SetReverb(0); } diff --git a/source/games/duke/src/zz_screens.cpp b/source/games/duke/src/zz_screens.cpp index 240899e33..0bbf32b9e 100644 --- a/source/games/duke/src/zz_screens.cpp +++ b/source/games/duke/src/zz_screens.cpp @@ -285,7 +285,6 @@ void G_DisplayRest(int32_t smoothratio) if (ud.overhead_on == 2) { twod->ClearScreen(); - drawbackground(); renderDrawMapView(cposx, cposy, pp->zoom, cang); } drawoverheadmap(cposx, cposy, pp->zoom, cang);