From c46b22e52ef0b3e3144fee451088e696dbaeb827 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 5 Nov 2019 20:16:53 +0100 Subject: [PATCH] - more cleanup of obsolete OSD code. --- source/blood/src/blood.cpp | 6 ---- source/blood/src/common_game.h | 8 +---- source/blood/src/osdcmd.cpp | 16 +--------- source/build/src/baselayer.cpp | 3 +- source/build/src/engine.cpp | 53 ++------------------------------- source/build/src/mdsprite.cpp | 25 ++++------------ source/build/src/screenshot.cpp | 5 ++-- source/common/2d/v_text.h | 10 +++++++ source/duke3d/src/common_game.h | 10 +------ source/duke3d/src/osdcmds.cpp | 18 ++--------- source/rr/src/common_game.h | 9 +----- source/rr/src/osdcmds.cpp | 16 +--------- source/sw/src/game.cpp | 11 ------- source/sw/src/menus.cpp | 4 --- 14 files changed, 30 insertions(+), 164 deletions(-) diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index b08d84ed6..05945b2e8 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -168,11 +168,6 @@ void G_Polymer_UnInit(void) // NUKE-TODO: } -void M32RunScript(const char *s) -{ - UNREFERENCED_PARAMETER(s); -} - void ShutDown(void) { if (!in3dmode()) @@ -183,7 +178,6 @@ void ShutDown(void) sfxTerm(); scrUnInit(); CONTROL_Shutdown(); - OSD_Cleanup(); // PORT_TODO: Check argument if (syncstate) printf("A packet was lost! (syncstate)\n"); diff --git a/source/blood/src/common_game.h b/source/blood/src/common_game.h index 25216260d..2e0b6b43f 100644 --- a/source/blood/src/common_game.h +++ b/source/blood/src/common_game.h @@ -487,15 +487,9 @@ enum { // ------------------------------- // NUKE-TODO: -#define OSDTEXT_DEFAULT "^00" -#define OSDTEXT_DARKRED "^00" -#define OSDTEXT_GREEN "^00" -#define OSDTEXT_RED "^00" -#define OSDTEXT_YELLOW "^00" +#include "v_text.h" -#define OSDTEXT_BRIGHT "^S0" -#define OSD_ERROR OSDTEXT_DARKRED OSDTEXT_BRIGHT enum BLOOD_GLOBALFLAGS { BLOOD_FORCE_WIDELOADSCREEN = 1<<0, diff --git a/source/blood/src/osdcmd.cpp b/source/blood/src/osdcmd.cpp index eef35e3e1..bd20b478a 100644 --- a/source/blood/src/osdcmd.cpp +++ b/source/blood/src/osdcmd.cpp @@ -153,18 +153,6 @@ static int osdcmd_demo(osdcmdptr_t parm) return OSDCMD_OK; } -int osdcmd_restartvid(osdcmdptr_t UNUSED(parm)) -{ - UNREFERENCED_CONST_PARAMETER(parm); - videoResetMode(); - if (videoSetGameMode(ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP,0)) - ThrowError("restartvid: Reset failed...\n"); - onvideomodechange(ScreenBPP>8); - viewResizeView(gViewSize); - - return OSDCMD_OK; -} - static int osdcmd_music(osdcmdptr_t parm) { char buffer[128]; @@ -266,8 +254,7 @@ static int osdcmd_crosshaircolor(osdcmdptr_t parm) g_isAlterDefaultCrosshair = true; viewSetCrosshairColor(r,g,b); - if (!OSD_ParsingScript()) - OSD_Printf("%s\n", parm->raw); + OSD_Printf("%s\n", parm->raw); return OSDCMD_OK; } @@ -498,7 +485,6 @@ int32_t registerosdcommands(void) OSD_RegisterFunction("quicksave","quicksave: performs a quick save", osdcmd_quicksave); OSD_RegisterFunction("quickload","quickload: performs a quick load", osdcmd_quickload); OSD_RegisterFunction("restartsound","restartsound: reinitializes the sound system",osdcmd_restartsound); - OSD_RegisterFunction("restartvid","restartvid: reinitializes the video mode",osdcmd_restartvid); OSD_RegisterFunction("screenshot","screenshot [format]: takes a screenshot.", osdcmd_screenshot); OSD_RegisterFunction("vidmode","vidmode : change the video mode",osdcmd_vidmode); diff --git a/source/build/src/baselayer.cpp b/source/build/src/baselayer.cpp index 6f7262871..e300d4fb6 100644 --- a/source/build/src/baselayer.cpp +++ b/source/build/src/baselayer.cpp @@ -22,6 +22,7 @@ extern "C" #endif // _WIN32 int32_t g_borderless=2; +bool GUICapture = false; // input char inputdevices = 0; @@ -34,7 +35,7 @@ bool g_mouseLockedToWindow = 1; int32_t mouseReadAbs(vec2_t * const pResult, vec2_t const * const pInput) { - if (!g_mouseEnabled || !appactive || !g_mouseInsideWindow || (osd && osd->flags & OSD_CAPTURE)) + if (!g_mouseEnabled || !appactive || !g_mouseInsideWindow || GUICapture) return 0; int32_t const xwidth = max(scale(240<<16, xdim, ydim), 320<<16); diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index b1df1e98b..d17fee1e6 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -9574,13 +9574,13 @@ static void check_sprite(int32_t i) { if ((unsigned)sprite[i].statnum >= MAXSTATUS) { - initprintf("%sMap error: sprite #%d (%d,%d) with illegal statnum (%d) REMOVED.\n", osd->draw.errorfmt, + initprintf("Map error: sprite #%d (%d,%d) with illegal statnum (%d) REMOVED.\n", i, TrackerCast(sprite[i].x), TrackerCast(sprite[i].y), TrackerCast(sprite[i].statnum)); remove_sprite(i); } else if ((unsigned)sprite[i].picnum >= MAXTILES) { - initprintf("%sMap error: sprite #%d (%d,%d) with illegal picnum (%d) REMOVED.\n", osd->draw.errorfmt, + initprintf("Map error: sprite #%d (%d,%d) with illegal picnum (%d) REMOVED.\n", i, TrackerCast(sprite[i].x), TrackerCast(sprite[i].y), TrackerCast(sprite[i].sectnum)); remove_sprite(i); } @@ -9594,7 +9594,7 @@ static void check_sprite(int32_t i) if (sprite[i].sectnum < 0) remove_sprite(i); - initprintf("%sMap error: sprite #%d (%d,%d) with illegal sector (%d) ", osd->draw.errorfmt, + initprintf("Map error: sprite #%d (%d,%d) with illegal sector (%d) ", i, TrackerCast(sprite[i].x), TrackerCast(sprite[i].y), osectnum); if (sprite[i].statnum != MAXSTATUS) @@ -12773,35 +12773,6 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const } -#ifdef POLYMER -static void PolymerProcessModels(void) -{ - // potentially deferred MD3 postprocessing - for (bssize_t i=0; imdnum==3 && ((md3model_t *)models[i])->head.surfs[0].geometry == NULL) - { - static int32_t warned=0; - - if (!warned) - { - OSD_Printf("Post-processing MD3 models for Polymer. This may take a while...\n"); - videoNextPage(); - warned = 1; - } - - if (!md3postload_polymer((md3model_t *)models[i])) - OSD_Printf("INTERNAL ERROR: mdmodel %s failed postprocessing!\n", - ((md3model_t *)models[i])->head.nam); - - if (((md3model_t *)models[i])->head.surfs[0].geometry == NULL) - OSD_Printf("INTERNAL ERROR: wtf?\n"); - } -// else -// OSD_Printf("mdmodel %d already postprocessed.\n", i); - } -} -#endif // // setrendermode @@ -12817,26 +12788,8 @@ int32_t videoSetRenderMode(int32_t renderer) GLInterface.EnableAlphaTest(false); renderer = REND_CLASSIC; } -# ifdef POLYMER - else - renderer = clamp(renderer, REND_POLYMOST, REND_POLYMER); - if (renderer == REND_POLYMER) - { - PolymerProcessModels(); - - if (!polymer_init()) - renderer = REND_POLYMOST; - } - else if (videoGetRenderMode() == REND_POLYMER) // going from Polymer to another renderer - { - engineClearLightsFromMHK(); - G_Polymer_UnInit(); - polymer_uninit(); - } -# else else renderer = REND_POLYMOST; -# endif basepalreset = 1; diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index 0846dec5c..695be96a1 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -593,19 +593,13 @@ void updateanimation(md2model_t *m, tspriteptr_t tspr, uint8_t lpal) if (!smoothdurationp) { m->cframe = m->nframe = anim->startframe; -#ifdef DEBUGGINGAIDS - if (m->cframe >= m->numframes) - OSD_Printf("2: c > n\n"); -#endif + goto prep_return; } m->nframe = anim->startframe; m->cframe = smooth->mdoldframe; -#ifdef DEBUGGINGAIDS - if (m->cframe >= m->numframes) - OSD_Printf("3: c > n\n"); -#endif + smooth->mdsmooth = 1; goto prep_return; } @@ -633,10 +627,7 @@ void updateanimation(md2model_t *m, tspriteptr_t tspr, uint8_t lpal) { m->nframe = anim ? anim->startframe : smooth->mdcurframe; m->cframe = smooth->mdoldframe; -#ifdef DEBUGGINGAIDS - if (m->cframe >= m->numframes) - OSD_Printf("4: c > n\n"); -#endif + //OSD_Printf("smoothing... cframe %i nframe %i\n", m->cframe, m->nframe); if (k > 65535) { @@ -644,10 +635,7 @@ void updateanimation(md2model_t *m, tspriteptr_t tspr, uint8_t lpal) m->interpol = 0; smooth->mdsmooth = 0; m->cframe = m->nframe; // = anim ? anim->startframe : smooth->mdcurframe; -#ifdef DEBUGGINGAIDS - if (m->cframe >= m->numframes) - OSD_Printf("5: c > n\n"); -#endif + smooth->mdoldframe = m->cframe; //OSD_Printf("smooth stopped !\n"); goto prep_return; @@ -658,10 +646,7 @@ void updateanimation(md2model_t *m, tspriteptr_t tspr, uint8_t lpal) if (anim) m->cframe = (i>>16)+anim->startframe; -#ifdef DEBUGGINGAIDS - if (m->cframe >= m->numframes) - OSD_Printf("6: c > n\n"); -#endif + m->nframe = m->cframe+1; if (anim && m->nframe > anim->endframe) // VERIFY: (!(hw_animsmoothing && smooth->mdsmooth)) implies (anim!=NULL) ? diff --git a/source/build/src/screenshot.cpp b/source/build/src/screenshot.cpp index 46a403e09..973077093 100644 --- a/source/build/src/screenshot.cpp +++ b/source/build/src/screenshot.cpp @@ -7,6 +7,7 @@ #include "m_argv.h" #include "cmdlib.h" #include "gamecontrol.h" +#include "printf.h" #include "vfs.h" #include "../../glbackend/glbackend.h" @@ -75,7 +76,7 @@ void WritePNGfile(FileWriter* file, const uint8_t* buffer, const PalEntry* palet !M_AppendPNGText(file, "Software", software) || !M_FinishPNG(file)) { - OSD_Printf("Failed writing screenshot\n"); + Printf("Failed writing screenshot\n"); } } @@ -159,7 +160,7 @@ int videoCaptureScreen() WritePNGfile(&writer, imgBuf, Palette, HICOLOR ? SS_RGB : SS_PAL, xdim, ydim, HICOLOR? xdim*3 : xdim, png_gamma); Xfree(imgBuf); - OSD_Printf("Saved screenshot to %s\n", fn); + Printf("Saved screenshot to %s\n", fn); capturecounter.count++; return 0; diff --git a/source/common/2d/v_text.h b/source/common/2d/v_text.h index d6ecd51e6..29714d317 100644 --- a/source/common/2d/v_text.h +++ b/source/common/2d/v_text.h @@ -82,6 +82,16 @@ struct FBrokenLines #define TEXTCOLOR_CHAT "\034*" #define TEXTCOLOR_TEAMCHAT "\034!" +#define OSDTEXT_DEFAULT TEXTCOLOR_GRAY +#define OSDTEXT_DARKRED TEXTCOLOR_DARKRED +#define OSDTEXT_GREEN TEXTCOLOR_GREEN +#define OSDTEXT_RED TEXTCOLOR_RED +#define OSDTEXT_YELLOW TEXTCOLOR_GOLD + +#define OSDTEXT_BRIGHT "" + +#define OSD_ERROR TEXTCOLOR_RED + extern int NumTextColors; diff --git a/source/duke3d/src/common_game.h b/source/duke3d/src/common_game.h index fbe435b15..b0a58ac6e 100644 --- a/source/duke3d/src/common_game.h +++ b/source/duke3d/src/common_game.h @@ -43,15 +43,7 @@ typedef enum basepal_ { BASEPALCOUNT } basepal_t; -#define OSDTEXT_DEFAULT "^00" -#define OSDTEXT_DARKRED "^10" -#define OSDTEXT_GREEN "^11" -#define OSDTEXT_RED "^21" -#define OSDTEXT_YELLOW "^23" - -#define OSDTEXT_BRIGHT "^S0" - -#define OSD_ERROR OSDTEXT_DARKRED OSDTEXT_BRIGHT +#include "v_text.h" extern int loaddefinitions_game(const char *fn, int32_t preload); diff --git a/source/duke3d/src/osdcmds.cpp b/source/duke3d/src/osdcmds.cpp index 060b69e4e..d32febc05 100644 --- a/source/duke3d/src/osdcmds.cpp +++ b/source/duke3d/src/osdcmds.cpp @@ -372,18 +372,6 @@ static int osdcmd_music(osdcmdptr_t parm) return OSDCMD_SHOWHELP; } -int osdcmd_restartvid(osdcmdptr_t UNUSED(parm)) -{ - UNREFERENCED_CONST_PARAMETER(parm); - videoResetMode(); - if (videoSetGameMode(ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP,ud.detail)) - G_GameExit("restartvid: Reset failed...\n"); - onvideomodechange(ScreenBPP>8); - G_UpdateScreenArea(); - - return OSDCMD_OK; -} - int osdcmd_restartmap(osdcmdptr_t UNUSED(parm)) { UNREFERENCED_CONST_PARAMETER(parm); @@ -712,8 +700,7 @@ static int osdcmd_crosshaircolor(osdcmdptr_t parm) G_SetCrosshairColor(r,g,b); - if (!OSD_ParsingScript()) - OSD_Printf("%s\n", parm->raw); + OSD_Printf("%s\n", parm->raw); return OSDCMD_OK; } @@ -1152,8 +1139,7 @@ int32_t registerosdcommands(void) OSD_RegisterFunction("restartmap", "restartmap: restarts the current map", osdcmd_restartmap); OSD_RegisterFunction("restartsound","restartsound: reinitializes the sound system",osdcmd_restartsound); - OSD_RegisterFunction("restartvid","restartvid: reinitializes the video mode",osdcmd_restartvid); - OSD_RegisterFunction("addlogvar","addlogvar : prints the value of a gamevar", osdcmd_addlogvar); + OSD_RegisterFunction("addlogvar","addlogvar : prints the value of a gamevar", osdcmd_addlogvar); OSD_RegisterFunction("setvar","setvar : sets the value of a gamevar", osdcmd_setvar); OSD_RegisterFunction("setvarvar","setvarvar : sets the value of to ", osdcmd_setvar); OSD_RegisterFunction("setactorvar","setactorvar : sets the value of 's to ", osdcmd_setactorvar); diff --git a/source/rr/src/common_game.h b/source/rr/src/common_game.h index a669d5c0b..f39dae046 100644 --- a/source/rr/src/common_game.h +++ b/source/rr/src/common_game.h @@ -46,15 +46,8 @@ typedef enum basepal_ { BASEPALCOUNT } basepal_t; -#define OSDTEXT_DEFAULT "^00" -#define OSDTEXT_DARKRED "^10" -#define OSDTEXT_GREEN "^11" -#define OSDTEXT_RED "^21" -#define OSDTEXT_YELLOW "^23" +#include "v_text.h" -#define OSDTEXT_BRIGHT "^S0" - -#define OSD_ERROR OSDTEXT_DARKRED OSDTEXT_BRIGHT extern int loaddefinitions_game(const char *fn, int32_t preload); diff --git a/source/rr/src/osdcmds.cpp b/source/rr/src/osdcmds.cpp index 697c00feb..0f864801a 100644 --- a/source/rr/src/osdcmds.cpp +++ b/source/rr/src/osdcmds.cpp @@ -367,18 +367,6 @@ static int osdcmd_music(osdcmdptr_t parm) return OSDCMD_SHOWHELP; } -int osdcmd_restartvid(osdcmdptr_t UNUSED(parm)) -{ - UNREFERENCED_CONST_PARAMETER(parm); - videoResetMode(); - if (videoSetGameMode(ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP,ud.detail)) - G_GameExit("restartvid: Reset failed...\n"); - onvideomodechange(ScreenBPP>8); - G_UpdateScreenArea(); - - return OSDCMD_OK; -} - int osdcmd_restartmap(osdcmdptr_t UNUSED(parm)) { UNREFERENCED_CONST_PARAMETER(parm); @@ -567,8 +555,7 @@ static int osdcmd_crosshaircolor(osdcmdptr_t parm) G_SetCrosshairColor(r,g,b); - if (!OSD_ParsingScript()) - OSD_Printf("%s\n", parm->raw); + OSD_Printf("%s\n", parm->raw); return OSDCMD_OK; } @@ -962,7 +949,6 @@ int32_t registerosdcommands(void) OSD_RegisterFunction("restartmap", "restartmap: restarts the current map", osdcmd_restartmap); OSD_RegisterFunction("restartsound","restartsound: reinitializes the sound system",osdcmd_restartsound); - OSD_RegisterFunction("restartvid","restartvid: reinitializes the video mode",osdcmd_restartvid); OSD_RegisterFunction("screenshot","screenshot [format]: takes a screenshot.", osdcmd_screenshot); diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 91954c987..4e3f79980 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -4990,19 +4990,8 @@ StdRandomRange(int range) } // [JM] Probably will need some doing over. !CHECKME! -void M32RunScript(const char *s) { UNREFERENCED_PARAMETER(s); } void G_Polymer_UnInit(void) { } -int osdcmd_restartvid(const osdfuncparm_t *parm) -{ - UNREFERENCED_PARAMETER(parm); - - videoResetMode(); - if (videoSetGameMode(fullscreen, xdim, ydim, bpp, upscalefactor)) - buildputs("restartvid: Reset failed...\n"); - - return OSDCMD_OK; -} #include "saveable.h" diff --git a/source/sw/src/menus.cpp b/source/sw/src/menus.cpp index f6ea10855..8dac286aa 100644 --- a/source/sw/src/menus.cpp +++ b/source/sw/src/menus.cpp @@ -690,10 +690,6 @@ SWBOOL MNU_KeySetupCustom(UserCall call, MenuItem *item) KeyboardKeys[currentkey][1]); #endif } - else - { - OSD_CaptureKey(inputState.GetLastScanCode()); - } currentmode = 0; }