* 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.
This commit is contained in:
toaster 2018-08-11 22:23:40 +01:00
parent c1a2c2fba4
commit a6d1e799f9
17 changed files with 144 additions and 111 deletions

View File

@ -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();

View File

@ -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"))

View File

@ -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 <graue@oceanbase.org>
*/
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;
}
}
}

View File

@ -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);

View File

@ -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"))

View File

@ -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];

View File

@ -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
{

View File

@ -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;

View File

@ -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);

View File

@ -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)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/2, V_FLIP, PictureOfLevel, mappingforencore);
V_DrawFixedPatch((x+w)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/2, V_FLIP, PictureOfLevel, invertmap);
{
static angle_t rubyfloattime = 0;
const fixed_t rubyheight = FINESINE(rubyfloattime>>ANGLETOFINESHIFT);
V_DrawFixedPatch((x+w/2)<<FRACBITS, ((y+i/2)<<FRACBITS) - (rubyheight<<1), FRACUNIT, 0, W_CachePatchName("RUBYICON", PU_CACHE), NULL);
rubyfloattime += (ANGLE_MAX/NEWTICRATE);
}
}
/*V_DrawDiag(x, y, 12, 31);
V_DrawDiag(x, y, 10, G_GetGametypeColor(cv_newgametype.value));*/
@ -6788,8 +6795,6 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
y += i/4;
i = cv_nextmap.value - 1;
trans = (leftfade ? V_TRANSLUCENT : 0);
if (doencore)
trans |= V_FLIP;
#define horizspac 2
do
@ -6820,23 +6825,12 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
x -= horizspac + w/2;
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))<<FRACBITS, (y)<<FRACBITS, FRACUNIT/4, trans, PictureOfLevel, mappingforencore);
}
V_DrawTinyScaledPatch(x, y, trans, PictureOfLevel);
} while (x > 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))<<FRACBITS, (y)<<FRACBITS, FRACUNIT/4, trans, PictureOfLevel, mappingforencore);
}
V_DrawTinyScaledPatch(x, y, trans, PictureOfLevel);
x += horizspac + w/2;
}

View File

@ -136,8 +136,6 @@ mapthing_t *playerstarts[MAXPLAYERS];
mapthing_t *bluectfstarts[MAXPLAYERS];
mapthing_t *redctfstarts[MAXPLAYERS];
boolean prevencoremode = false;
/** Logs an error about a map being corrupt, then terminate.
* This allows reporting highly technical errors for usefulness, without
* confusing a novice map designer who simply needs to run ZenNode.
@ -218,6 +216,8 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->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;
}

View File

@ -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();

View File

@ -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;

View File

@ -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;

View File

@ -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 :(

View File

@ -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)

View File

@ -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)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/2, V_FLIP, pic, invertmap);
V_DrawFixedPatch((BASEVIDWIDTH-60)<<FRACBITS, ((y+25)<<FRACBITS) - (rubyheight<<1), FRACUNIT, 0, rubyicon, NULL);
}
V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 40+y, V_SNAPTORIGHT, str);
if (levelinfo[i].gts)
{
@ -1067,7 +1081,14 @@ void Y_VoteDrawer(void)
}
else
{
V_DrawTinyScaledPatch(BASEVIDWIDTH-60, y, V_SNAPTORIGHT, pic);
if (!levelinfo[i].encore)
V_DrawTinyScaledPatch(BASEVIDWIDTH-60, y, V_SNAPTORIGHT, pic);
else
{
V_DrawFixedPatch((BASEVIDWIDTH-20)<<FRACBITS, y<<FRACBITS, FRACUNIT/4, V_FLIP, pic, invertmap);
V_DrawFixedPatch((BASEVIDWIDTH-40)<<FRACBITS, (y<<FRACBITS) + (25<<(FRACBITS-1)) - rubyheight, FRACUNIT/2, 0, rubyicon, NULL);
}
if (levelinfo[i].gts)
{
V_DrawDiag(BASEVIDWIDTH-60, y, 8, V_SNAPTORIGHT|31);
@ -1105,7 +1126,14 @@ void Y_VoteDrawer(void)
V_DrawFill(x-1, y-1, 42, 27, levelinfo[votes[i]].gtc|V_SNAPTOLEFT);
}
V_DrawTinyScaledPatch(x, y, V_SNAPTOLEFT, pic);
if (!levelinfo[votes[i]].encore)
V_DrawTinyScaledPatch(x, y, V_SNAPTOLEFT, pic);
else
{
V_DrawFixedPatch((x+40)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/4, V_SNAPTOLEFT|V_FLIP, pic, invertmap);
V_DrawFixedPatch((x+20)<<FRACBITS, (y<<FRACBITS) + (25<<(FRACBITS-1)) - rubyheight, FRACUNIT/2, 0, rubyicon, NULL);
}
if (levelinfo[votes[i]].gts)
{
V_DrawDiag(x, y, 8, V_SNAPTOLEFT|31);
@ -1170,6 +1198,8 @@ static void Y_VoteStops(SINT8 pick, SINT8 level)
D_GameTypeChanged(lastgametype);
forceresetplayers = true;
}
deferencoremode = (levelinfo[level].encore);
}
//
@ -1390,6 +1420,7 @@ void Y_StartVote(void)
cursor3 = W_CachePatchName("P3CURSOR", PU_STATIC);
cursor4 = W_CachePatchName("P4CURSOR", PU_STATIC);
randomlvl = W_CachePatchName("RANDOMLV", PU_STATIC);
rubyicon = W_CachePatchName("RUBYICON", PU_STATIC);
timer = cv_votetime.value*TICRATE;
pickedvote = -1;
@ -1413,37 +1444,42 @@ void Y_StartVote(void)
{
lumpnum_t lumpnum;
// set up the encore
levelinfo[i].encore = (votelevels[i][1] & 0x80);
votelevels[i][1] &= ~0x80;
// set up the str
if (i == 4)
levelinfo[i].str[0] = '\0';
else
{
if (strlen(mapheaderinfo[votelevels[i][0]]->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);