From 2bc170887027384d4ff1efc6259dd5e9f70dca36 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 18 Jan 2020 16:13:39 +0100 Subject: [PATCH] - removed the complete crosshair color hackery. The code needs to be refactored anyway to allow better crosshair control but this also seemed to affect global render state, considering how poorly it was all implemented. --- source/blood/src/blood.cpp | 1 - source/blood/src/osdcmd.cpp | 31 ----------- source/blood/src/view.cpp | 52 +------------------ source/blood/src/view.h | 5 -- source/build/src/mdsprite.cpp | 4 +- source/build/src/polymost.cpp | 4 +- source/build/src/voxmodel.cpp | 4 +- source/common/2d/v_draw.cpp | 4 +- source/duke3d/src/anim.cpp | 3 -- source/duke3d/src/game.cpp | 6 --- source/duke3d/src/game.h | 7 --- source/duke3d/src/osdcmds.cpp | 23 --------- source/duke3d/src/premap.cpp | 3 -- source/duke3d/src/premap.h | 2 - source/duke3d/src/screens.cpp | 86 +------------------------------ source/exhumed/src/osdcmds.cpp | 1 - source/glbackend/gl_renderstate.h | 2 +- source/rr/src/game.cpp | 6 --- source/rr/src/game.h | 7 --- source/rr/src/osdcmds.cpp | 21 -------- source/rr/src/premap.cpp | 3 -- source/rr/src/premap.h | 2 - source/rr/src/screens.cpp | 79 +--------------------------- 23 files changed, 13 insertions(+), 343 deletions(-) diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index acc799692..7cb521331 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -1223,7 +1223,6 @@ RESTART: UpdateNetworkMenus(); if (!gDemo.at0 && gDemo.at59ef > 0 && gGameOptions.nGameType == 0 && !bNoDemo) gDemo.SetupPlayback(NULL); - viewSetCrosshairColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b); gQuitGame = 0; gRestartGame = 0; if (gGameOptions.nGameType > 0) diff --git a/source/blood/src/osdcmd.cpp b/source/blood/src/osdcmd.cpp index 115e5a63f..718902875 100644 --- a/source/blood/src/osdcmd.cpp +++ b/source/blood/src/osdcmd.cpp @@ -102,35 +102,6 @@ static int osdcmd_demo(osdcmdptr_t parm) } -static int osdcmd_crosshaircolor(osdcmdptr_t parm) -{ - if (parm->numparms != 3) - { - OSD_Printf("crosshaircolor: r:%d g:%d b:%d\n",CrosshairColors.r,CrosshairColors.g,CrosshairColors.b); - return OSDCMD_SHOWHELP; - } - - uint8_t const r = Batol(parm->parms[0]); - uint8_t const g = Batol(parm->parms[1]); - uint8_t const b = Batol(parm->parms[2]); - - g_isAlterDefaultCrosshair = true; - viewSetCrosshairColor(r,g,b); - - OSD_Printf("%s\n", parm->raw); - - return OSDCMD_OK; -} - -static int osdcmd_resetcrosshair(osdcmdptr_t UNUSED(parm)) -{ - UNREFERENCED_CONST_PARAMETER(parm); - g_isAlterDefaultCrosshair = false; - viewResetCrosshairToDefault(); - - return OSDCMD_OK; -} - static int osdcmd_give(osdcmdptr_t parm) { if (numplayers != 1 || !gGameStarted || gMe->pXSprite->health == 0) @@ -236,8 +207,6 @@ int32_t registerosdcommands(void) { OSD_RegisterFunction("map","map : loads the given user map", osdcmd_map); OSD_RegisterFunction("demo","demo : starts the given demo", osdcmd_demo); - OSD_RegisterFunction("crosshaircolor","crosshaircolor: changes the crosshair color", osdcmd_crosshaircolor); - OSD_RegisterFunction("crosshairreset", "crosshairreset: restores the original crosshair", osdcmd_resetcrosshair); OSD_RegisterFunction("give","give : gives requested item", osdcmd_give); OSD_RegisterFunction("god","god: toggles god mode", osdcmd_god); diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index a030850ef..2d48d450c 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -1857,7 +1857,6 @@ void viewResizeView(int size) } videoSetViewableArea(gViewX0, gViewY0, gViewX1, gViewY1); gGameMessageMgr.SetCoordinates(gViewX0S + 1, gViewY0S + 1); - viewSetCrosshairColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b); viewUpdatePages(); } @@ -3484,7 +3483,7 @@ void viewDrawScreen(bool sceneonly) { if (cl_crosshair) { - rotatesprite(160<<16, defaultHoriz<<16, 65536, 0, kCrosshairTile, 0, g_isAlterDefaultCrosshair ? CROSSHAIR_PAL : 0, 2, gViewX0, gViewY0, gViewX1, gViewY1); + rotatesprite(160<<16, defaultHoriz<<16, 65536, 0, kCrosshairTile, 0, 0, 2, gViewX0, gViewY0, gViewX1, gViewY1); } cX = (v4c >> 8) + 160; cY = (v48 >> 8) + 220 + (zDelta >> 7); @@ -3689,55 +3688,6 @@ void viewLoadingScreen(int nTile, const char *pText, const char *pText2, const c viewLoadingScreenUpdate(NULL, -1); } -palette_t CrosshairColors = { 255, 255, 255, 0 }; -bool g_isAlterDefaultCrosshair = false; - -void viewSetCrosshairColor(int32_t r, int32_t g, int32_t b) -{ - if (!g_isAlterDefaultCrosshair) - return; - - CrosshairColors.r = r; - CrosshairColors.g = g; - CrosshairColors.b = b; - - auto ptr = TileFiles.tileMakeWritable(kCrosshairTile); - if (!ptr) return; - - int32_t ii = tilesiz[kCrosshairTile].x * tilesiz[kCrosshairTile].y; - - dassert(ii > 0); - - int32_t i = (videoGetRenderMode() == REND_CLASSIC) - ? paletteGetClosestColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b) - : paletteGetClosestColor(255, 255, 255); // use white in GL so we can tint it to the right color - - do - { - if (*ptr != 255) - *ptr = i; - ptr++; - } while (--ii); - - paletteMakeLookupTable(CROSSHAIR_PAL, NULL, CrosshairColors.r, CrosshairColors.g, CrosshairColors.b, 1); - -#ifdef USE_OPENGL - // XXX: this makes us also load all hightile textures tinted with the crosshair color! - polytint_t & crosshairtint = hictinting[CROSSHAIR_PAL]; - crosshairtint.tint.r = CrosshairColors.r; - crosshairtint.tint.g = CrosshairColors.g; - crosshairtint.tint.b = CrosshairColors.b; - crosshairtint.f = HICTINT_USEONART | HICTINT_GRAYSCALE; -#endif - tileInvalidate(kCrosshairTile, -1, -1); -} - -void viewResetCrosshairToDefault(void) -{ - paletteFreeLookupTable(CROSSHAIR_PAL); - tileLoad(kCrosshairTile); -} - #define COLOR_RED redcol #define COLOR_WHITE whitecol diff --git a/source/blood/src/view.h b/source/blood/src/view.h index 804b1d598..342dc1a3f 100644 --- a/source/blood/src/view.h +++ b/source/blood/src/view.h @@ -63,7 +63,6 @@ enum INTERPOLATE_TYPE { INTERPOLATE_TYPE_SHORT, }; -#define CROSSHAIR_PAL (MAXPALOOKUPS-RESERVEDPALS-1) #define kCrosshairTile 2319 #define kLoadScreen 2049 #define kLoadScreenCRC -2051908571 @@ -98,8 +97,6 @@ extern CGameMessageMgr gGameMessageMgr; extern int gViewXCenter, gViewYCenter; extern int gViewX0, gViewY0, gViewX1, gViewY1; extern int gViewX0S, gViewY0S, gViewX1S, gViewY1S; -extern palette_t CrosshairColors; -extern bool g_isAlterDefaultCrosshair; extern int gLastPal; @@ -150,8 +147,6 @@ void viewLoadingScreenUpdate(const char *pzText4 = NULL, int nPercent = -1); void viewLoadingScreen(int nTile, const char *pText, const char *pText2, const char *pText3); void viewUpdateDelirium(void); void viewUpdateShake(void); -void viewSetCrosshairColor(int32_t r, int32_t g, int32_t b); -void viewResetCrosshairToDefault(void); void viewSetSystemMessage(const char* pMessage, ...); void viewPrecacheTiles(void); diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index 4d123d47d..c6cd880cb 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -1792,8 +1792,8 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr) VSMatrix identity(0); GLInterface.SetIdentityMatrix(Matrix_ModelView); - GLInterface.SetTinting(0, 0, PalEntry(255, 255, 255)); - GLInterface.SetClamp(prevClamp); + GLInterface.SetTinting(-1, 0xffffff, 0xffffff); + GLInterface.SetClamp(prevClamp); globalnoeffect=0; return 1; diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index da1111e86..b577934d3 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -601,8 +601,8 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 } GLInterface.DrawIm(DT_TRIANGLE_FAN, data.first, npoints); - GLInterface.SetTinting(0, 0, PalEntry(255, 255, 255)); - GLInterface.UseDetailMapping(false); + GLInterface.SetTinting(-1, 0xffffff, 0xffffff); + GLInterface.UseDetailMapping(false); GLInterface.UseGlowMapping(false); GLInterface.SetNpotEmulation(false, 1.f, 0.f); diff --git a/source/build/src/voxmodel.cpp b/source/build/src/voxmodel.cpp index 9862e1396..1e2123e14 100644 --- a/source/build/src/voxmodel.cpp +++ b/source/build/src/voxmodel.cpp @@ -1194,8 +1194,8 @@ int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr) VSMatrix identity(0); GLInterface.SetIdentityMatrix(Matrix_ModelView); GLInterface.SetFadeDisable(false); - GLInterface.SetTinting(0, 0, PalEntry(255, 255, 255)); - return 1; + GLInterface.SetTinting(-1, 0xffffff, 0xffffff); + return 1; } #endif diff --git a/source/common/2d/v_draw.cpp b/source/common/2d/v_draw.cpp index 8a0a03da9..a46003805 100644 --- a/source/common/2d/v_draw.cpp +++ b/source/common/2d/v_draw.cpp @@ -655,14 +655,16 @@ bool ParseDrawTextureTags(FTexture *img, double x, double y, uint32_t tag, Va_Li parms->style = STYLE_Stencil; } } - else if (parms->Alpha < 1.f) + else //if (parms->Alpha < 1.f) { parms->style = STYLE_Translucent; } + /* else { parms->style = STYLE_Normal; } + */ } return true; } diff --git a/source/duke3d/src/anim.cpp b/source/duke3d/src/anim.cpp index 7fa7cee52..28c9b1674 100644 --- a/source/duke3d/src/anim.cpp +++ b/source/duke3d/src/anim.cpp @@ -305,9 +305,6 @@ int32_t Anim_Play(const char *fn) GLInterface.EnableNonTransparent255(true); - // Dummy rotatesprite call. Without this the movie won't render. Apparently some state isn't initialized properly and gets reset by this. - // Needs to be investigated. Leave this in as a workaround for now... - rotatesprite_fs(int(160 * 65536), int(100 * 65536) + ((28) << 16), 65536L, 0, 2499, 0, 0, 10); do { nextframetime += msecsperframe; diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index e3fe74915..81c43fc57 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -5880,12 +5880,6 @@ MAIN_LOOP_RESTART: } - if (g_networkMode != NET_DEDICATED_SERVER) - { - G_GetCrosshairColor(); - G_SetCrosshairColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b); - } - if (ud.warp_on == 1) { G_NewGame_EnterLevel(); diff --git a/source/duke3d/src/game.h b/source/duke3d/src/game.h index 1983cde1d..9735115e4 100644 --- a/source/duke3d/src/game.h +++ b/source/duke3d/src/game.h @@ -236,11 +236,6 @@ extern int32_t voting; //extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen; -#define CROSSHAIR_PAL (MAXPALOOKUPS-RESERVEDPALS-1) - -extern palette_t CrosshairColors; -extern palette_t DefaultCrosshairColors; - int32_t A_CheckInventorySprite(spritetype *s); int32_t A_InsertSprite(int16_t whatsect, int32_t s_x, int32_t s_y, int32_t s_z, int16_t s_pn, int8_t s_s, uint8_t s_xr, uint8_t s_yr, int16_t s_a, int16_t s_ve, int16_t s_zv, int16_t s_ow, int16_t s_ss); @@ -282,12 +277,10 @@ void G_DrawRooms(int32_t playerNum,int32_t smoothratio); void G_DrawTXDigiNumZ(int32_t starttile,int32_t x,int32_t y,int32_t n,int32_t s,int32_t pal,int32_t cs,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z); void G_GameExit(const char *msg) ATTRIBUTE((noreturn)); void G_GameQuit(void); -void G_GetCrosshairColor(void); void G_HandleLocalKeys(void); void G_HandleSpecialKeys(void); void G_PrintGameQuotes(int32_t snum); //void G_SE40(int32_t smoothratio); -void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b); void G_Shutdown(void); void G_UpdatePlayerFromMenu(void); void P_DoQuote(int32_t q,DukePlayer_t *p); diff --git a/source/duke3d/src/osdcmds.cpp b/source/duke3d/src/osdcmds.cpp index b4a7e2f69..6f838eaa0 100644 --- a/source/duke3d/src/osdcmds.cpp +++ b/source/duke3d/src/osdcmds.cpp @@ -370,27 +370,6 @@ static int osdcmd_setactorvar(osdcmdptr_t parm) } - - -static int osdcmd_crosshaircolor(osdcmdptr_t parm) -{ - if (parm->numparms != 3) - { - OSD_Printf("crosshaircolor: r:%d g:%d b:%d\n",CrosshairColors.r,CrosshairColors.g,CrosshairColors.b); - return OSDCMD_SHOWHELP; - } - - uint8_t const r = Batol(parm->parms[0]); - uint8_t const g = Batol(parm->parms[1]); - uint8_t const b = Batol(parm->parms[2]); - - G_SetCrosshairColor(r,g,b); - - OSD_Printf("%s\n", parm->raw); - - return OSDCMD_OK; -} - static int osdcmd_give(osdcmdptr_t parm) { int32_t i; @@ -739,8 +718,6 @@ int32_t registerosdcommands(void) OSD_RegisterFunction("demo","demo : starts the given demo", osdcmd_demo); } - OSD_RegisterFunction("crosshaircolor","crosshaircolor: changes the crosshair color", osdcmd_crosshaircolor); - OSD_RegisterFunction("give","give : gives requested item", osdcmd_give); OSD_RegisterFunction("god","god: toggles god mode", osdcmd_god); OSD_RegisterFunction("activatecheat","activatecheat : activates a cheat code", osdcmd_activatecheat); diff --git a/source/duke3d/src/premap.cpp b/source/duke3d/src/premap.cpp index 2f40194a7..c7da84b34 100644 --- a/source/duke3d/src/premap.cpp +++ b/source/duke3d/src/premap.cpp @@ -534,9 +534,6 @@ void G_UpdateScreenArea(void) videoSetViewableArea(v1.x, v1.y, v2.x-1, v2.y-1); - G_GetCrosshairColor(); - G_SetCrosshairColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b); - pub = NUMPAGES; pus = NUMPAGES; } diff --git a/source/duke3d/src/premap.h b/source/duke3d/src/premap.h index a0888a05f..5c1292e45 100644 --- a/source/duke3d/src/premap.h +++ b/source/duke3d/src/premap.h @@ -27,7 +27,6 @@ BEGIN_DUKE_NS extern int32_t g_levelTextTime; extern int32_t voting,vote_map,vote_episode; -extern palette_t CrosshairColors; void G_SetupFilenameBasedMusic(char *nameBuf, const char *fileName); int G_EnterLevel(int gameMode); int G_FindLevelByFile(const char *fileName); @@ -35,7 +34,6 @@ void G_CacheMapData(void); void G_FreeMapState(int levelNum); void G_NewGame(int volumeNum, int levelNum, int skillNum); void G_ResetTimers(bool saveMoveCnt); -void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b); void G_UpdateScreenArea(void); void P_MoveToRandomSpawnPoint(int playerNum); void P_ResetInventory(int playerNum); diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index 5436ed35f..218499502 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -43,8 +43,6 @@ BEGIN_DUKE_NS #define quotepulseshade (sintable[((uint32_t)totalclock<<5)&2047]>>11) -palette_t CrosshairColors = { 255, 255, 255, 0 }; -palette_t DefaultCrosshairColors = { 0, 0, 0, 0 }; int32_t g_crosshairSum = -1; // yxaspect and viewingrange just before the 'main' drawrooms call int32_t dr_yxaspect, dr_viewingrange; @@ -93,86 +91,6 @@ void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, int32_t set) videoSetPalette(0, palid, set); } -void G_GetCrosshairColor(void) -{ - if (FURY) - return; - - if (DefaultCrosshairColors.f) - return; - - tileLoad(CROSSHAIR); - - auto ptr = tilePtr(CROSSHAIR); - if (!ptr) return; - - // find the brightest color in the original 8-bit tile - int32_t ii = tilesiz[CROSSHAIR].x * tilesiz[CROSSHAIR].y; - int32_t bri = 0, j = 0, i; - - Bassert(ii > 0); - - do - { - if (*ptr != 255) - { - i = curpalette[(int32_t) *ptr].r+curpalette[(int32_t) *ptr].g+curpalette[(int32_t) *ptr].b; - if (i > j) { j = i; bri = *ptr; } - } - ptr++; - } while (--ii); - - Bmemcpy(&CrosshairColors, &curpalette[bri], sizeof(palette_t)); - Bmemcpy(&DefaultCrosshairColors, &curpalette[bri], sizeof(palette_t)); - DefaultCrosshairColors.f = 1; // this flag signifies that the color has been detected -} - -void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b) -{ - if (FURY) - return; - - if (g_crosshairSum == r+(g<<8)+(b<<16)) - return; - - auto ptr = TileFiles.tileMakeWritable(CROSSHAIR); - if (!ptr) return; - - if (!DefaultCrosshairColors.f) - G_GetCrosshairColor(); - - g_crosshairSum = r+(g<<8)+(b<<16); - CrosshairColors.r = r; - CrosshairColors.g = g; - CrosshairColors.b = b; - - int32_t ii = tilesiz[CROSSHAIR].x * tilesiz[CROSSHAIR].y; - - Bassert(ii > 0); - - int32_t i = (videoGetRenderMode() == REND_CLASSIC) - ? paletteGetClosestColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b) - : paletteGetClosestColor(255, 255, 255); // use white in GL so we can tint it to the right color - - do - { - if (*ptr != 255) - *ptr = i; - ptr++; - } while (--ii); - - paletteMakeLookupTable(CROSSHAIR_PAL, NULL, CrosshairColors.r, CrosshairColors.g, CrosshairColors.b, 1); - -#ifdef USE_OPENGL - // XXX: this makes us also load all hightile textures tinted with the crosshair color! - polytint_t & crosshairtint = hictinting[CROSSHAIR_PAL]; - crosshairtint.tint.r = CrosshairColors.r; - crosshairtint.tint.g = CrosshairColors.g; - crosshairtint.tint.b = CrosshairColors.b; - crosshairtint.f = HICTINT_USEONART | HICTINT_GRAYSCALE; -#endif - tileInvalidate(CROSSHAIR, -1, -1); -} #define SCORESHEETOFFSET -20 static void G_ShowScores(void) @@ -956,7 +874,6 @@ void G_DisplayRest(int32_t smoothratio) if ((unsigned) a < MAXTILES) { vec2_t crosshairpos = { ud.returnvar[0], ud.returnvar[1] }; - uint8_t crosshair_pal = CROSSHAIR_PAL; uint32_t crosshair_o = 1|2; uint32_t crosshair_scale = divscale16(cl_crosshairscale, 100); @@ -966,12 +883,11 @@ void G_DisplayRest(int32_t smoothratio) crosshairpos.x = scale(crosshairpos.x - (320<<15), ydim << 2, xdim * 3) + (320<<15); crosshairpos.y = scale(crosshairpos.y - (200<<15), (ydim << 2) * 6, (xdim * 3) * 5) + (200<<15); crosshair_scale = scale(crosshair_scale, ydim << 2, xdim * 3) >> 1; - crosshair_pal = 0; crosshair_o |= 1024; renderSetAspect(viewingrange, 65536); } - rotatesprite_win(crosshairpos.x, crosshairpos.y, crosshair_scale, 0, a, 0, crosshair_pal, crosshair_o); + rotatesprite_win(crosshairpos.x, crosshairpos.y, crosshair_scale, 0, a, 0, 0, crosshair_o); if (FURY) renderSetAspect(viewingrange, oyxaspect); diff --git a/source/exhumed/src/osdcmds.cpp b/source/exhumed/src/osdcmds.cpp index 2e6598703..06a1f205f 100644 --- a/source/exhumed/src/osdcmds.cpp +++ b/source/exhumed/src/osdcmds.cpp @@ -105,7 +105,6 @@ int32_t registerosdcommands(void) //} //OSD_RegisterFunction("cmenu","cmenu <#>: jumps to menu", osdcmd_cmenu); - //OSD_RegisterFunction("crosshaircolor","crosshaircolor: changes the crosshair color", osdcmd_crosshaircolor); //OSD_RegisterFunction("give","give : gives requested item", osdcmd_give); diff --git a/source/glbackend/gl_renderstate.h b/source/glbackend/gl_renderstate.h index 997bea5bf..ea912f20f 100644 --- a/source/glbackend/gl_renderstate.h +++ b/source/glbackend/gl_renderstate.h @@ -69,7 +69,7 @@ struct PolymostRenderState bool AlphaTest = true; float Color[4] = { 1,1,1,1 }; short matrixIndex[NUMMATRICES] = { -1,-1,-1,-1,-1 }; - PalEntry fullscreenTint = 0xffffff, hictint = 0, hictint_overlay = 0xffffff; + PalEntry fullscreenTint = 0xffffff, hictint = 0xffffff, hictint_overlay = 0xffffff; int hictint_flags = 0; int StateFlags = STF_COLORMASK|STF_DEPTHMASK; diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index f33952647..8a55cfed3 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -7332,12 +7332,6 @@ MAIN_LOOP_RESTART: for (int & q : user_quote_time) q = 0; - //if (g_networkMode != NET_DEDICATED_SERVER) - { - G_GetCrosshairColor(); - G_SetCrosshairColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b); - } - if (ud.warp_on == 1) { G_NewGame_EnterLevel(); diff --git a/source/rr/src/game.h b/source/rr/src/game.h index 66a364508..1109cf492 100644 --- a/source/rr/src/game.h +++ b/source/rr/src/game.h @@ -235,11 +235,6 @@ extern int32_t voting; //extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen; -#define CROSSHAIR_PAL (MAXPALOOKUPS-RESERVEDPALS-1) - -extern palette_t CrosshairColors; -extern palette_t DefaultCrosshairColors; - int32_t A_CheckInventorySprite(spritetype *s); int32_t A_InsertSprite(int16_t whatsect, int32_t s_x, int32_t s_y, int32_t s_z, int16_t s_pn, int8_t s_s, uint8_t s_xr, uint8_t s_yr, int16_t s_a, int16_t s_ve, int16_t s_zv, int16_t s_ow, int16_t s_ss); @@ -280,12 +275,10 @@ void G_DrawRooms(int32_t playerNum,int32_t smoothratio); void G_DrawTXDigiNumZ(int32_t starttile,int32_t x,int32_t y,int32_t n,int32_t s,int32_t pal,int32_t cs,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z); void G_GameExit(const char *msg) ATTRIBUTE((noreturn)); void G_GameQuit(void); -void G_GetCrosshairColor(void); void G_HandleLocalKeys(void); void G_HandleSpecialKeys(void); void G_PrintGameQuotes(int32_t snum); //void G_SE40(int32_t smoothratio); -void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b); void G_Shutdown(void); void G_UpdatePlayerFromMenu(void); void P_DoQuote(int32_t q,DukePlayer_t *p); diff --git a/source/rr/src/osdcmds.cpp b/source/rr/src/osdcmds.cpp index 27bd8f795..a7f6ec6ef 100644 --- a/source/rr/src/osdcmds.cpp +++ b/source/rr/src/osdcmds.cpp @@ -274,25 +274,6 @@ static int osdcmd_spawn(osdcmdptr_t parm) } -static int osdcmd_crosshaircolor(osdcmdptr_t parm) -{ - if (parm->numparms != 3) - { - OSD_Printf("crosshaircolor: r:%d g:%d b:%d\n",CrosshairColors.r,CrosshairColors.g,CrosshairColors.b); - return OSDCMD_SHOWHELP; - } - - uint8_t const r = Batol(parm->parms[0]); - uint8_t const g = Batol(parm->parms[1]); - uint8_t const b = Batol(parm->parms[2]); - - G_SetCrosshairColor(r,g,b); - - OSD_Printf("%s\n", parm->raw); - - return OSDCMD_OK; -} - static int osdcmd_give(osdcmdptr_t parm) { int32_t i; @@ -577,8 +558,6 @@ int32_t registerosdcommands(void) OSD_RegisterFunction("demo","demo : starts the given demo", osdcmd_demo); } - OSD_RegisterFunction("crosshaircolor","crosshaircolor: changes the crosshair color", osdcmd_crosshaircolor); - #if !defined NETCODE_DISABLE OSD_RegisterFunction("connect","connect: connects to a multiplayer game", osdcmd_connect); OSD_RegisterFunction("disconnect","disconnect: disconnects from the local multiplayer game", osdcmd_disconnect); diff --git a/source/rr/src/premap.cpp b/source/rr/src/premap.cpp index 73a4ed2db..693e132cb 100644 --- a/source/rr/src/premap.cpp +++ b/source/rr/src/premap.cpp @@ -720,9 +720,6 @@ void G_UpdateScreenArea(void) videoSetViewableArea(x1,y1,x2-1,y2-1); } - G_GetCrosshairColor(); - G_SetCrosshairColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b); - pub = NUMPAGES; pus = NUMPAGES; } diff --git a/source/rr/src/premap.h b/source/rr/src/premap.h index 73854f4aa..53117c2d4 100644 --- a/source/rr/src/premap.h +++ b/source/rr/src/premap.h @@ -29,7 +29,6 @@ extern int16_t g_ambientLotag[64]; extern int16_t g_ambientHitag[64]; extern int32_t g_levelTextTime; extern int32_t voting,vote_map,vote_episode; -extern palette_t CrosshairColors; void G_SetupFilenameBasedMusic(char *nameBuf, const char *fileName, int levelNum); int G_EnterLevel(int gameMode); int G_FindLevelByFile(const char *fileName); @@ -37,7 +36,6 @@ void G_CacheMapData(void); void G_FreeMapState(int levelNum); void G_NewGame(int volumeNum, int levelNum, int skillNum); void G_ResetTimers(uint8_t keepgtics); -void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b); void G_UpdateScreenArea(void); void P_RandomSpawnPoint(int playerNum); void P_ResetInventory(int playerNum); diff --git a/source/rr/src/screens.cpp b/source/rr/src/screens.cpp index f5e4bc01e..908193256 100644 --- a/source/rr/src/screens.cpp +++ b/source/rr/src/screens.cpp @@ -43,8 +43,6 @@ BEGIN_RR_NS #define quotepulseshade (sintable[((uint32_t)totalclock<<5)&2047]>>11) -palette_t CrosshairColors = { 255, 255, 255, 0 }; -palette_t DefaultCrosshairColors = { 0, 0, 0, 0 }; int32_t g_crosshairSum = -1; // yxaspect and viewingrange just before the 'main' drawrooms call int32_t dr_yxaspect, dr_viewingrange; @@ -92,80 +90,6 @@ void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, int32_t set) videoSetPalette(0, palid, set); } -void G_GetCrosshairColor(void) -{ - if (DefaultCrosshairColors.f) - return; - - tileLoad(CROSSHAIR); - - auto ptr = tilePtr(CROSSHAIR); - if (!ptr) return; - - // find the brightest color in the original 8-bit tile - int32_t ii = tilesiz[CROSSHAIR].x * tilesiz[CROSSHAIR].y; - int32_t bri = 0, j = 0, i; - - Bassert(ii > 0); - - do - { - if (*ptr != 255) - { - i = curpalette[(int32_t) *ptr].r+curpalette[(int32_t) *ptr].g+curpalette[(int32_t) *ptr].b; - if (i > j) { j = i; bri = *ptr; } - } - ptr++; - } while (--ii); - - Bmemcpy(&CrosshairColors, &curpalette[bri], sizeof(palette_t)); - Bmemcpy(&DefaultCrosshairColors, &curpalette[bri], sizeof(palette_t)); - DefaultCrosshairColors.f = 1; // this flag signifies that the color has been detected -} - -void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b) -{ - if (g_crosshairSum == r+(g<<8)+(b<<16)) - return; - - auto ptr = TileFiles.tileMakeWritable(CROSSHAIR); - if (!ptr) return; - - if (!DefaultCrosshairColors.f) - G_GetCrosshairColor(); - - g_crosshairSum = r+(g<<8)+(b<<16); - CrosshairColors.r = r; - CrosshairColors.g = g; - CrosshairColors.b = b; - - int32_t ii = tilesiz[CROSSHAIR].x * tilesiz[CROSSHAIR].y; - - Bassert(ii > 0); - - int32_t i = (videoGetRenderMode() == REND_CLASSIC) - ? paletteGetClosestColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b) - : paletteGetClosestColor(255, 255, 255); // use white in GL so we can tint it to the right color - - do - { - if (*ptr != 255) - *ptr = i; - ptr++; - } while (--ii); - - paletteMakeLookupTable(CROSSHAIR_PAL, NULL, CrosshairColors.r, CrosshairColors.g, CrosshairColors.b, 1); - -#ifdef USE_OPENGL - // XXX: this makes us also load all hightile textures tinted with the crosshair color! - polytint_t & crosshairtint = hictinting[CROSSHAIR_PAL]; - crosshairtint.tint.r = CrosshairColors.r; - crosshairtint.tint.g = CrosshairColors.g; - crosshairtint.tint.b = CrosshairColors.b; - crosshairtint.f = HICTINT_USEONART | HICTINT_GRAYSCALE; -#endif - tileInvalidate(CROSSHAIR, -1, -1); -} #define SCORESHEETOFFSET -20 static void G_ShowScores(void) @@ -979,13 +903,12 @@ void G_DisplayRest(int32_t smoothratio) if ((unsigned) a < MAXTILES) { vec2_t crosshairpos = { (160<<16) - (g_player[myconnectindex].ps->look_ang<<15), 100<<16 }; - uint8_t crosshair_pal = CROSSHAIR_PAL; uint32_t crosshair_o = 1|2; uint32_t crosshair_scale = divscale16(cl_crosshairscale, 100); if (RR) crosshair_scale >>= 1; - rotatesprite_win(crosshairpos.x, crosshairpos.y, crosshair_scale, 0, a, 0, crosshair_pal, crosshair_o); + rotatesprite_win(crosshairpos.x, crosshairpos.y, crosshair_scale, 0, a, 0, 0, crosshair_o); } }