From a6d1e799f926a3a851bce8592b4a05cb83358946 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 11 Aug 2018 22:23:40 +0100 Subject: [PATCH] * Encore on the voting screen! Appears randomly once unlocked in the same slot as that which sometimes represents a gametype change (odds inflated for testing purposes). * A better representation of an Encore level, now with inverted graphics (a special remapping we can now use elsewhere whenever if we want!) and a floating Ruby! * Decouple encore's setting from cv_kartencore on mapload. Instead, bake it into D_MapChange and related, which will only some of the time be fed by cv_kartencore's value. * Encore mode now has a special mapheader palette setting, "encorepal", rather than using the same one as non-encore. --- src/d_clisrv.c | 2 +- src/d_main.c | 2 +- src/d_netcmd.c | 40 ++++++++++++------------ src/d_netcmd.h | 2 +- src/dehacked.c | 2 ++ src/doomstat.h | 5 +-- src/f_finale.c | 2 +- src/g_game.c | 26 ++++++++------- src/g_game.h | 4 +-- src/m_menu.c | 51 +++++++++++------------------- src/p_setup.c | 13 ++------ src/p_tick.c | 2 +- src/r_data.c | 12 ++++++- src/r_data.h | 1 + src/r_state.h | 3 +- src/v_video.c | 3 +- src/y_inter.c | 85 ++++++++++++++++++++++++++++++++++++-------------- 17 files changed, 144 insertions(+), 111 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 13650c59..63393690 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4758,7 +4758,7 @@ void TryRunTics(tic_t realtics) { COM_BufExecute(); if (mapchangepending) - D_MapChange(-1, 0, ultimatemode, false, 2, false, fromlevelselect); // finish the map change + D_MapChange(-1, 0, encoremode, false, 2, false, fromlevelselect); // finish the map change } NetUpdate(); diff --git a/src/d_main.c b/src/d_main.c index 0100db38..bf6af7ea 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1489,7 +1489,7 @@ void D_SRB2Main(void) else if (!dedicated && M_MapLocked(pstartmap)) I_Error("You need to unlock this level before you can warp to it!\n"); else - D_MapChange(pstartmap, gametype, ultimatemode, true, 0, false, false); + D_MapChange(pstartmap, gametype, (boolean)cv_kartencore.value, true, 0, false, false); } } else if (M_CheckParm("-skipintro")) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index c157f21c..28d33be9 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -446,6 +446,7 @@ consvar_t cv_sleep = {"cpusleep", "-1", CV_SAVE, sleeping_cons_t, NULL, -1, NULL INT16 gametype = GT_RACE; // SRB2kart boolean forceresetplayers = false; +boolean deferencoremode = false; UINT8 splitscreen = 0; boolean circuitmap = true; // SRB2kart INT32 adminplayers[MAXPLAYERS]; @@ -1872,7 +1873,7 @@ INT32 mapchangepending = 0; * * \param mapnum Map number to change to. * \param gametype Gametype to switch to. - * \param pultmode Is this 'Ultimate Mode'? + * \param pencoremode Is this 'Encore Mode'? * \param resetplayers 1 to reset player scores and lives and such, 0 not to. * \param delay Determines how the function will be executed: 0 to do * it all right now (must not be done from a menu), 1 to @@ -1881,18 +1882,16 @@ INT32 mapchangepending = 0; * \sa D_GameTypeChanged, Command_Map_f * \author Graue */ -void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pultmode, boolean resetplayers, INT32 delay, boolean skipprecutscene, boolean FLS) +void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pencoremode, boolean resetplayers, INT32 delay, boolean skipprecutscene, boolean FLS) { static char buf[2+MAX_WADPATH+1+4]; static char *buf_p = buf; - forceresetplayers = false; - // The supplied data are assumed to be good. I_Assert(delay >= 0 && delay <= 2); - CONS_Debug(DBG_GAMELOGIC, "Map change: mapnum=%d gametype=%d ultmode=%d resetplayers=%d delay=%d skipprecutscene=%d\n", - mapnum, newgametype, pultmode, resetplayers, delay, skipprecutscene); + CONS_Debug(DBG_GAMELOGIC, "Map change: mapnum=%d gametype=%d encoremode=%d resetplayers=%d delay=%d skipprecutscene=%d\n", + mapnum, newgametype, pencoremode, resetplayers, delay, skipprecutscene); if (netgame || multiplayer) FLS = false; @@ -1905,7 +1904,7 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pultmode, boolean rese I_Assert(W_CheckNumForName(mapname) != LUMPERROR); buf_p = buf; - if (pultmode) + if (pencoremode) flags |= 1; if (!resetplayers) flags |= 1<<1; @@ -1973,8 +1972,12 @@ void D_SetupVote(void) INT32 i; UINT8 secondgt = G_SometimesGetDifferentGametype(); - WRITEUINT8(p, gametype); + if (cv_kartencore.value && G_RaceGametype()) + WRITEUINT8(p, (gametype|0x80)); + else + WRITEUINT8(p, gametype); WRITEUINT8(p, secondgt); + secondgt &= ~0x80; for (i = 0; i < 5; i++) { @@ -2109,10 +2112,6 @@ static void Command_Map_f(void) return; } - // Ultimate Mode only in SP via menu - if (netgame || multiplayer) - ultimatemode = false; - // new gametype value // use current one by default i = COM_CheckParm("-gametype"); @@ -2177,7 +2176,7 @@ static void Command_Map_f(void) } fromlevelselect = false; - D_MapChange(newmapnum, newgametype, false, newresetplayers, 0, false, false); + D_MapChange(newmapnum, newgametype, (boolean)cv_kartencore.value, newresetplayers, 0, false, false); } /** Receives a map command and changes the map. @@ -2193,6 +2192,9 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) UINT8 flags; INT32 resetplayer = 1, lastgametype; UINT8 skipprecutscene, FLS; + boolean pencoremode; + + forceresetplayers = deferencoremode = false; if (playernum != serverplayer && !IsPlayerAdmin(playernum)) { @@ -2213,9 +2215,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) flags = READUINT8(*cp); - ultimatemode = ((flags & 1) != 0); - if (netgame || multiplayer) - ultimatemode = false; + pencoremode = ((flags & 1) != 0); resetplayer = ((flags & (1<<1)) == 0); @@ -2225,6 +2225,9 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) if (gametype != lastgametype) D_GameTypeChanged(lastgametype); // emulate consvar_t behavior for gametype + if (!G_RaceGametype()) + pencoremode = false; + skipprecutscene = ((flags & (1<<2)) != 0); FLS = ((flags & (1<<3)) != 0); @@ -2256,7 +2259,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) LUAh_MapChange(); #endif - G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene); + G_InitNew(pencoremode, mapname, resetplayer, skipprecutscene); if (demoplayback && !timingdemo) precache = true; CON_ToggleOff(); @@ -5250,10 +5253,7 @@ static void KartEncore_OnChange(void) if ((boolean)cv_kartencore.value != encoremode && gamestate == GS_LEVEL /*&& leveltime > starttime*/) CONS_Printf(M_GetText("Encore Mode will be turned %s next round.\n"), cv_kartencore.value ? M_GetText("on") : M_GetText("off")); else - { CONS_Printf(M_GetText("Encore Mode has been turned %s.\n"), cv_kartencore.value ? M_GetText("on") : M_GetText("off")); - //encoremode = (boolean)cv_kartencore.value; - } } } diff --git a/src/d_netcmd.h b/src/d_netcmd.h index b7721b79..5238c44e 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -251,7 +251,7 @@ void D_SendPlayerConfig(void); void Command_ExitGame_f(void); void Command_Retry_f(void); void D_GameTypeChanged(INT32 lastgametype); // not a real _OnChange function anymore -void D_MapChange(INT32 pmapnum, INT32 pgametype, boolean pultmode, boolean presetplayers, INT32 pdelay, boolean pskipprecutscene, boolean pfromlevelselect); +void D_MapChange(INT32 pmapnum, INT32 pgametype, boolean pencoremode, boolean presetplayers, INT32 pdelay, boolean pskipprecutscene, boolean pfromlevelselect); void D_SetupVote(void); void D_ModifyClientVote(SINT8 voted, UINT8 splitplayer); void D_PickVote(void); diff --git a/src/dehacked.c b/src/dehacked.c index af72719b..cd013148 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1221,6 +1221,8 @@ static void readlevelheader(MYFILE *f, INT32 num) mapheaderinfo[num-1]->countdown = (INT16)i; else if (fastcmp(word, "PALETTE")) mapheaderinfo[num-1]->palette = (UINT16)i; + else if (fastcmp(word, "ENCOREPAL")) + mapheaderinfo[num-1]->encorepal = (UINT16)i; else if (fastcmp(word, "NUMLAPS")) mapheaderinfo[num-1]->numlaps = (UINT8)i; else if (fastcmp(word, "UNLOCKABLE")) diff --git a/src/doomstat.h b/src/doomstat.h index dbe9fa34..f54abebc 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -80,7 +80,7 @@ extern INT16 gametype; extern UINT8 splitscreen; extern boolean circuitmap; // Does this level have 'circuit mode'? extern boolean fromlevelselect; -extern boolean forceresetplayers; +extern boolean forceresetplayers, deferencoremode; // ======================================== // Internal parameters for sound rendering. @@ -243,6 +243,7 @@ typedef struct UINT8 cutscenenum; ///< Cutscene number to use, 0 for none. INT16 countdown; ///< Countdown until level end? UINT16 palette; ///< PAL lump to use on this map + UINT16 encorepal; ///< PAL for encore mode UINT8 numlaps; ///< Number of laps in circuit mode, unless overridden. SINT8 unlockrequired; ///< Is an unlockable required to play this level? -1 if no. UINT8 levelselect; ///< Is this map available in the level select? If so, which map list is it available in? @@ -448,7 +449,7 @@ extern INT32 cheats; // SRB2kart extern UINT8 gamespeed; extern boolean franticitems; -extern boolean encoremode; +extern boolean encoremode, prevencoremode; extern boolean comeback; extern SINT8 battlewanted[4]; diff --git a/src/f_finale.c b/src/f_finale.c index ab79fa78..e5d342ad 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1252,7 +1252,7 @@ void F_EndCutScene(void) if (runningprecutscene) { if (server) - D_MapChange(gamemap, gametype, ultimatemode, precutresetplayer, 0, true, false); + D_MapChange(gamemap, gametype, false, precutresetplayer, 0, true, false); } else { diff --git a/src/g_game.c b/src/g_game.c index 48ba8724..cb7f276c 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -248,7 +248,8 @@ INT32 cheats; //for multiplayer cheat commands // SRB2Kart // Cvars that we don't want changed mid-game UINT8 gamespeed; // Game's current speed (or difficulty, or cc, or etc); 0 for easy, 1 for normal, 2 for hard -boolean encoremode; // Encore Mode currently enabled? +boolean encoremode = false; // Encore Mode currently enabled? +boolean prevencoremode; boolean franticitems; // Frantic items currently enabled? boolean comeback; // Battle Mode's karma comeback is on/off @@ -3097,13 +3098,16 @@ boolean G_BattleGametype(void) // // G_SometimesGetDifferentGametype // -// I pity the fool who adds more gametypes later, because it'll require some element of randomisation which needs to be synched... -// Although given this only gets called for the host, you could probably get away with M_Random. +// Oh, yeah, and we sometimes flip encore mode on here too. // INT16 G_SometimesGetDifferentGametype(void) { if (randmapbuffer[NUMMAPS] != -1) + { + if (M_SecretUnlocked(SECRET_ENCORE) && (M_RandomChance(FRACUNIT/2/*56*/) != cv_kartencore.value) && G_RaceGametype()) + return (gametype|0x80); return gametype; + } randmapbuffer[NUMMAPS] = gametype; @@ -3477,6 +3481,7 @@ void G_NextLevel(void) } forceresetplayers = false; + deferencoremode = (boolean)cv_kartencore.value; } gameaction = ga_worlddone; @@ -3489,7 +3494,7 @@ static void G_DoWorldDone(void) // SRB2Kart D_MapChange(nextmap+1, gametype, - ultimatemode, + deferencoremode, forceresetplayers, 0, false, @@ -3561,7 +3566,7 @@ static void G_DoContinued(void) // Reset # of lives pl->lives = (ultimatemode) ? 1 : 3; - D_MapChange(gamemap, gametype, ultimatemode, false, 0, false, false); + D_MapChange(gamemap, gametype, false, false, 0, false, false); gameaction = ga_nothing; } @@ -4075,7 +4080,7 @@ void G_SaveGame(UINT32 savegameslot) // Can be called by the startup code or the menu task, // consoleplayer, displayplayer, playeringame[] should be set. // -void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, UINT8 ssplayers, boolean FLS) +void G_DeferedInitNew(boolean pencoremode, const char *mapname, INT32 pickedchar, UINT8 ssplayers, boolean FLS) { INT32 i; UINT8 color = 0; @@ -4120,14 +4125,14 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, U CV_StealthSetValue(&cv_playercolor, color); if (mapname) - D_MapChange(M_MapNumber(mapname[3], mapname[4]), gametype, pultmode, true, 1, false, FLS); + D_MapChange(M_MapNumber(mapname[3], mapname[4]), gametype, pencoremode, true, 1, false, FLS); } // // This is the map command interpretation something like Command_Map_f // // called at: map cmd execution, doloadgame, doplaydemo -void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean skipprecutscene) +void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, boolean skipprecutscene) { INT32 i; @@ -4137,8 +4142,8 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean S_ResumeAudio(); } - if (netgame || multiplayer) // Nice try, haxor. - ultimatemode = false; + prevencoremode = ((gamestate == GS_TITLESCREEN) ? false : encoremode); + encoremode = pencoremode; legitimateexit = false; // SRB2Kart comebackshowninfo = false; @@ -4227,7 +4232,6 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean // Don't carry over custom music change to another map. mapmusflags |= MUSIC_RELOADRESET; - ultimatemode = pultmode; playerdeadview = false; automapactive = false; imcontinuing = false; diff --git a/src/g_game.h b/src/g_game.h index ad099bf2..10eb4c68 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -107,7 +107,7 @@ extern boolean camspin, camspin2, camspin3, camspin4; // SRB2Kart void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo); void G_DoReborn(INT32 playernum); void G_PlayerReborn(INT32 player); -void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, +void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, boolean skipprecutscene); char *G_BuildMapTitle(INT32 mapnum); @@ -119,7 +119,7 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost); // Can be called by the startup code or M_Responder. // A normal game starts at map 1, but a warp test can start elsewhere -void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, +void G_DeferedInitNew(boolean pencoremode, const char *mapname, INT32 pickedchar, UINT8 ssplayers, boolean FLS); void G_DoLoadLevel(boolean resetplayer); diff --git a/src/m_menu.c b/src/m_menu.c index 18bdf09e..5d557f89 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -5420,7 +5420,7 @@ static void M_ChoosePlayer(INT32 choice) { char *skin1,*skin2; INT32 skinnum; - boolean ultmode = (ultimate_selectable && SP_PlayerDef.prevMenu == &SP_LoadDef && saveSlotSelected == NOSAVESLOT); + //boolean ultmode = (ultimate_selectable && SP_PlayerDef.prevMenu == &SP_LoadDef && saveSlotSelected == NOSAVESLOT); // skip this if forcecharacter if (mapheaderinfo[startmap-1] && mapheaderinfo[startmap-1]->forcecharacter[0] == '\0') @@ -5457,7 +5457,7 @@ static void M_ChoosePlayer(INT32 choice) lastmapsaved = 0; gamecomplete = false; - G_DeferedInitNew(ultmode, G_BuildMapName(startmap), (UINT8)skinnum, 0, fromlevelselect); + G_DeferedInitNew(false, G_BuildMapName(startmap), (UINT8)skinnum, 0, fromlevelselect); COM_BufAddText("dummyconsvar 1\n"); // G_DeferedInitNew doesn't do this } @@ -6724,7 +6724,7 @@ static void M_StartServer(INT32 choice) if (ssplayers < 1) { - D_MapChange(cv_nextmap.value, cv_newgametype.value, false, 1, 1, false, false); + D_MapChange(cv_nextmap.value, cv_newgametype.value, (boolean)cv_kartencore.value, 1, 1, false, false); COM_BufAddText("dummyconsvar 1\n"); } else // split screen @@ -6738,7 +6738,7 @@ static void M_StartServer(INT32 choice) SplitScreen_OnChange(); } - D_MapChange(cv_nextmap.value, cv_newgametype.value, false, 1, 1, false, false); + D_MapChange(cv_nextmap.value, cv_newgametype.value, (boolean)cv_kartencore.value, 1, 1, false, false); } M_ClearMenus(true); @@ -6750,7 +6750,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade) patch_t *PictureOfLevel; INT32 x, y, w, i, oldval, trans, dupadjust = ((vid.width/vid.dupx) - BASEVIDWIDTH)>>1; const char *mapname = G_BuildMapName(cv_nextmap.value); - boolean doencore = (cv_kartencore.value && cv_newgametype.value == GT_RACE); + //boolean doencore = (cv_kartencore.value && cv_newgametype.value == GT_RACE); // A 160x100 image of the level as entry MAPxxP lumpnum = W_CheckNumForName(va("%sP", mapname)); @@ -6772,15 +6772,22 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade) V_DrawFill(x-1, y-1, w+2, i+2, trans); // variable reuse... - if (!doencore) + if (!cv_kartencore.value || cv_newgametype.value != GT_RACE) V_DrawSmallScaledPatch(x, y, 0, PictureOfLevel); else { - UINT8 *mappingforencore = NULL; + /*UINT8 *mappingforencore = NULL; if ((lumpnum = W_CheckNumForName(va("%sE", mapname))) != LUMPERROR) - mappingforencore = W_CachePatchNum(lumpnum, PU_CACHE); + mappingforencore = W_CachePatchNum(lumpnum, PU_CACHE);*/ - V_DrawFixedPatch((x+w)<>ANGLETOFINESHIFT); + V_DrawFixedPatch((x+w/2)< horizspac-dupadjust); x = (BASEVIDWIDTH + w)/2 + horizspac; i = cv_nextmap.value - 1; trans = (rightfade ? V_TRANSLUCENT : 0); - if (doencore) - trans |= V_FLIP; while (x < BASEVIDWIDTH+dupadjust-horizspac) { @@ -6864,16 +6858,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade) else PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE); - if (!doencore) - V_DrawTinyScaledPatch(x, y, trans, PictureOfLevel); - else - { - UINT8 *mappingforencore = NULL; - if ((lumpnum = W_CheckNumForName(va("%sE", mapname))) != LUMPERROR) - mappingforencore = W_CachePatchNum(lumpnum, PU_CACHE); - - V_DrawFixedPatch((x+(w/2))<countdown = 0; DEH_WriteUndoline("PALLETE", va("%u", mapheaderinfo[num]->palette), UNDO_NONE); mapheaderinfo[num]->palette = UINT16_MAX; + DEH_WriteUndoline("ENCOREPAL", va("%u", mapheaderinfo[num]->encorepal), UNDO_NONE); + mapheaderinfo[num]->encorepal = UINT16_MAX; DEH_WriteUndoline("NUMLAPS", va("%u", mapheaderinfo[num]->numlaps), UNDO_NONE); mapheaderinfo[num]->numlaps = NUMLAPS_DEFAULT; DEH_WriteUndoline("UNLOCKABLE", va("%s", mapheaderinfo[num]->unlockrequired), UNDO_NONE); @@ -2247,28 +2247,19 @@ static void P_LevelInitStuff(void) players[i].pflags &= ~PF_TRANSFERTOCLOSEST; } - prevencoremode = ((wipegamestate == GS_TITLESCREEN) ? false : encoremode); - // SRB2Kart: map load variables if (modeattacking) // Just play it safe and set everything { gamespeed = 2; - encoremode = false; franticitems = false; comeback = true; } else { if (G_BattleGametype()) - { gamespeed = 0; - encoremode = false; - } else - { gamespeed = (UINT8)cv_kartspeed.value; - encoremode = (boolean)cv_kartencore.value; - } franticitems = (boolean)cv_kartfrantic.value; comeback = (boolean)cv_kartcomeback.value; } diff --git a/src/p_tick.c b/src/p_tick.c index b9aaccf7..bf0777aa 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -744,7 +744,7 @@ void P_Ticker(boolean run) if (mapreset > 1 && --mapreset <= 1 && server) // Remember: server uses it for mapchange, but EVERYONE ticks down for the animation - D_MapChange(gamemap, gametype, ultimatemode, true, 0, false, false); + D_MapChange(gamemap, gametype, encoremode, true, 0, false, false); } P_MapEnd(); diff --git a/src/r_data.c b/src/r_data.c index 1e2bc628..e3d23dd7 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -112,7 +112,8 @@ INT32 *texturetranslation; sprcache_t *spritecachedinfo; lighttable_t *colormaps; -lighttable_t *encoremap; +UINT8 *encoremap; +UINT8 invertmap[256]; // for debugging/info purposes static size_t flatmemory, spritememory, texturememory; @@ -1019,6 +1020,7 @@ static void R_InitColormaps(void) // Init Boom colormaps. R_ClearColormaps(); //R_InitExtraColormaps(); + R_MakeInvertmap(); // this isn't the BEST place to do it the first time, but whatever } void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap) @@ -1301,6 +1303,14 @@ void R_MakeColormaps(void) colormapFixingArray[i][2]); } +void R_MakeInvertmap(void) +{ + size_t i; + + for (i = 0; i < 256; i++) + invertmap[i] = NearestColor(256 - pLocalPalette[i].s.red, 256 - pLocalPalette[i].s.green, 256 - pLocalPalette[i].s.blue); +} + void R_CreateColormap2(char *p1, char *p2, char *p3) { double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb; diff --git a/src/r_data.h b/src/r_data.h index fb8756df..4cc6f206 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -95,6 +95,7 @@ INT32 R_ColormapNumForName(char *name); INT32 R_CreateColormap(char *p1, char *p2, char *p3); void R_CreateColormap2(char *p1, char *p2, char *p3); void R_MakeColormaps(void); +void R_MakeInvertmap(void); const char *R_ColormapNameForNum(INT32 num); extern INT32 numtextures; diff --git a/src/r_state.h b/src/r_state.h index a651bda7..88a38f25 100644 --- a/src/r_state.h +++ b/src/r_state.h @@ -38,7 +38,8 @@ typedef struct extern sprcache_t *spritecachedinfo; extern lighttable_t *colormaps; -extern lighttable_t *encoremap; +extern UINT8 *encoremap; +extern UINT8 invertmap[256]; // Boom colormaps. // Had to put a limit on colormaps :( diff --git a/src/v_video.c b/src/v_video.c index 8013ae82..6f9ff219 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -207,7 +207,7 @@ const char *R_GetPalname(UINT16 num) const char *GetPalette(void) { if (gamestate == GS_LEVEL) - return R_GetPalname(mapheaderinfo[gamemap-1]->palette); + return R_GetPalname((encoremode ? mapheaderinfo[gamemap-1]->encorepal : mapheaderinfo[gamemap-1]->palette)); return "PLAYPAL"; } @@ -248,6 +248,7 @@ void V_SetPaletteLump(const char *pal) #endif if (rendermode != render_none) I_SetPalette(pLocalPalette); + R_MakeInvertmap(); } static void CV_usegamma_OnChange(void) diff --git a/src/y_inter.c b/src/y_inter.c index 14421ad7..d34e5d59 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -126,6 +126,7 @@ typedef struct UINT8 gtc; const char *gts; patch_t *pic; + boolean encore; } y_votelvlinfo; // Clientside & splitscreen player info. @@ -156,6 +157,7 @@ static patch_t *cursor2 = NULL; static patch_t *cursor3 = NULL; static patch_t *cursor4 = NULL; static patch_t *randomlvl = NULL; +static patch_t *rubyicon = NULL; static void Y_UnloadVoteData(void); @@ -930,6 +932,7 @@ void Y_VoteDrawer(void) { INT32 i, x, y = 0, height = 0; UINT8 selected[4]; + fixed_t rubyheight = 0; if (rendermode == render_none) return; @@ -940,6 +943,11 @@ void Y_VoteDrawer(void) if (!voteclient.loaded) return; + { + angle_t rubyfloattime = (ANGLE_MAX/NEWTICRATE)*(votetic % NEWTICRATE); + rubyheight = FINESINE(rubyfloattime>>ANGLETOFINESHIFT); + } + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); if (widebgpatch && rendermode == render_soft && vid.width / vid.dupx > 320) @@ -974,19 +982,18 @@ void Y_VoteDrawer(void) y = (200-height)/2; for (i = 0; i < 4; i++) { - char str[40]; + const char *str; patch_t *pic; UINT8 j, color; if (i == 3) { - snprintf(str, sizeof str, "%.32s", "RANDOM"); - str[sizeof str - 1] = '\0'; + str = "RANDOM"; pic = randomlvl; } else { - strcpy(str, levelinfo[i].str); + str = levelinfo[i].str; pic = levelinfo[i].pic; } @@ -1051,7 +1058,14 @@ void Y_VoteDrawer(void) sizeadd--; } - V_DrawSmallScaledPatch(BASEVIDWIDTH-100, y, V_SNAPTORIGHT, pic); + if (!levelinfo[i].encore) + V_DrawSmallScaledPatch(BASEVIDWIDTH-100, y, V_SNAPTORIGHT, pic); + else + { + V_DrawFixedPatch((BASEVIDWIDTH-20)<zonttl) > 0) + // set up the levelstring + if (mapheaderinfo[votelevels[i][0]]->levelflags & LF_NOZONE || !mapheaderinfo[votelevels[i][0]]->zonttl[0]) { - if (strlen(mapheaderinfo[votelevels[i][0]]->actnum) > 0) + if (mapheaderinfo[votelevels[i][0]]->actnum[0]) snprintf(levelinfo[i].str, sizeof levelinfo[i].str, - "%.32s %.32s %s", + "%s %s", + mapheaderinfo[prevmap]->lvlttl, mapheaderinfo[votelevels[i][0]]->actnum); + else + snprintf(levelinfo[i].str, + sizeof levelinfo[i].str, + "%s", + mapheaderinfo[votelevels[i][0]]->lvlttl); + } + else + { + if (mapheaderinfo[votelevels[i][0]]->actnum[0]) + snprintf(levelinfo[i].str, + sizeof levelinfo[i].str, + "%s %s %s", mapheaderinfo[votelevels[i][0]]->lvlttl, mapheaderinfo[votelevels[i][0]]->zonttl, mapheaderinfo[votelevels[i][0]]->actnum); else snprintf(levelinfo[i].str, sizeof levelinfo[i].str, - "%.32s %.32s", + "%s %s", mapheaderinfo[votelevels[i][0]]->lvlttl, mapheaderinfo[votelevels[i][0]]->zonttl); } - else - { - if (strlen(mapheaderinfo[votelevels[i][0]]->actnum) > 0) - snprintf(levelinfo[i].str, - sizeof levelinfo[i].str, - "%.32s %s", - mapheaderinfo[votelevels[i][0]]->lvlttl, mapheaderinfo[votelevels[i][0]]->actnum); - else - snprintf(levelinfo[i].str, - sizeof levelinfo[i].str, - "%.32s", - mapheaderinfo[votelevels[i][0]]->lvlttl); - } levelinfo[i].str[sizeof levelinfo[i].str - 1] = '\0'; } @@ -1493,6 +1529,7 @@ static void Y_UnloadVoteData(void) UNLOAD(cursor3); UNLOAD(cursor4); UNLOAD(randomlvl); + UNLOAD(rubyicon); UNLOAD(levelinfo[4].pic); UNLOAD(levelinfo[3].pic);