Encore mode - a fresh take on mirror mode!

* Palette remaps.
* Branding.

TODO:
* Doesn't work in GL. (Mostly.) I have SOME ideas on how to tackle this, but...
* Transmaps are broken in Encore for some reason.
* I tried to make in-level colormaps shimmy over, but it didn't quite work, so I commented it out and only semi-fixed it.
This commit is contained in:
toaster 2018-07-23 23:50:41 +01:00
parent f820733d9b
commit bd78c34b99
25 changed files with 256 additions and 96 deletions

View file

@ -112,7 +112,7 @@ static void SoundTest_OnChange(void);
static void BaseNumLaps_OnChange(void);
static void KartFrantic_OnChange(void);
static void KartSpeed_OnChange(void);
static void KartMirror_OnChange(void);
static void KartEncore_OnChange(void);
static void KartComeback_OnChange(void);
#ifdef NETGAME_DEVMODE
@ -362,7 +362,7 @@ static CV_PossibleValue_t kartbumpers_cons_t[] = {{1, "MIN"}, {12, "MAX"}, {0, N
consvar_t cv_kartbumpers = {"kartbumpers", "3", CV_NETVAR|CV_CHEAT, kartbumpers_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_kartfrantic = {"kartfrantic", "Off", CV_NETVAR|CV_CHEAT|CV_CALL|CV_NOINIT, CV_OnOff, KartFrantic_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_kartcomeback = {"kartcomeback", "On", CV_NETVAR|CV_CHEAT|CV_CALL|CV_NOINIT, CV_OnOff, KartComeback_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_kartmirror = {"kartmirror", "Off", CV_NETVAR|CV_CHEAT|CV_CALL|CV_NOINIT, CV_OnOff, KartMirror_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_kartencore = {"kartencore", "Off", CV_NETVAR|CV_CHEAT|CV_CALL|CV_NOINIT, CV_OnOff, KartEncore_OnChange, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t kartspeedometer_cons_t[] = {{0, "Off"}, {1, "Kilometers"}, {2, "Miles"}, {3, "Fracunits"}, {0, NULL}};
consvar_t cv_kartspeedometer = {"kartdisplayspeed", "Off", CV_SAVE, kartspeedometer_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // use tics in display
@ -5231,16 +5231,16 @@ static void KartSpeed_OnChange(void)
}
}
static void KartMirror_OnChange(void)
static void KartEncore_OnChange(void)
{
if (G_RaceGametype())
{
if ((boolean)cv_kartmirror.value != mirrormode && gamestate == GS_LEVEL /*&& leveltime > starttime*/)
CONS_Printf(M_GetText("Mirrored tracks will be turned %s next round.\n"), cv_kartmirror.value ? M_GetText("on") : M_GetText("off"));
if ((boolean)cv_kartencore.value != encoremode && gamestate == GS_LEVEL /*&& leveltime > starttime*/)
CONS_Printf(M_GetText("Encore tracks will be turned %s next round.\n"), cv_kartencore.value ? M_GetText("on") : M_GetText("off"));
else
{
CONS_Printf(M_GetText("Mirrored tracks has been turned %s.\n"), cv_kartmirror.value ? M_GetText("on") : M_GetText("off"));
mirrormode = (boolean)cv_kartmirror.value;
CONS_Printf(M_GetText("Encore tracks has been turned %s.\n"), cv_kartencore.value ? M_GetText("on") : M_GetText("off"));
encoremode = (boolean)cv_kartencore.value;
}
}
}

View file

@ -124,7 +124,7 @@ extern consvar_t cv_kartspeed;
extern consvar_t cv_kartbumpers;
extern consvar_t cv_kartfrantic;
extern consvar_t cv_kartcomeback;
extern consvar_t cv_kartmirror;
extern consvar_t cv_kartencore;
extern consvar_t cv_kartspeedometer;
extern consvar_t cv_votetime;

View file

@ -446,7 +446,7 @@ extern INT32 cheats;
// SRB2kart
extern UINT8 gamespeed;
extern boolean franticitems;
extern boolean mirrormode;
extern boolean encoremode;
extern boolean comeback;
extern SINT8 battlewanted[4];

View file

@ -248,7 +248,7 @@ 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 mirrormode; // Mirror Mode currently enabled?
boolean encoremode; // Encore Mode currently enabled?
boolean franticitems; // Frantic items currently enabled?
boolean comeback; // Battle Mode's karma comeback is on/off
@ -1267,7 +1267,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
axis = JoyAxis(AXISTURN, ssplayer);
if (mirrormode)
if (encoremode)
{
turnright ^= turnleft; // swap these using three XORs
turnleft ^= turnright;
@ -1318,8 +1318,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
// Specator mouse turning
if (player->spectator)
{
cmd->angleturn = (INT16)(cmd->angleturn - (mousex*(mirrormode ? -1 : 1)*8));
cmd->driftturn = (INT16)(cmd->driftturn - (mousex*(mirrormode ? -1 : 1)*8));
cmd->angleturn = (INT16)(cmd->angleturn - (mousex*(encoremode ? -1 : 1)*8));
cmd->driftturn = (INT16)(cmd->driftturn - (mousex*(encoremode ? -1 : 1)*8));
}
// Speed bump strafing

View file

@ -109,7 +109,7 @@ typedef struct
FLOAT fovxangle, fovyangle;
UINT8 splitscreen;
boolean flip; // screenflip
boolean mirror; // SRB2Kart: Mirror Mode
boolean mirror; // SRB2Kart: Encore Mode
} FTransform;
// Transformed vector, as passed to HWR API

View file

@ -3147,7 +3147,6 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
v3d->z = FIXED_TO_FLOAT(polysector->vertices[i]->y);
}
if (planecolormap)
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, planecolormap->rgba, planecolormap->fadergba, false, true);
else
@ -5441,7 +5440,11 @@ static void HWR_ProjectSprite(mobj_t *thing)
vis->colormap = R_GetTranslationColormap(TC_DEFAULT, thing->color, GTC_CACHE);
}
else
{
vis->colormap = colormaps;
if (encoremap && (thing->flags & (MF_SCENERY|MF_NOTHINK)))
vis->colormap += (256*32);
}
// set top/bottom coords
vis->ty = gzt;
@ -5545,6 +5548,8 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
vis->mobj = (mobj_t *)thing;
vis->colormap = colormaps;
if (encoremap)
vis->colormap += (256*32);
// set top/bottom coords
vis->ty = FIXED_TO_FLOAT(thing->z + spritecachedinfo[lumpoff].topoffset);
@ -6537,6 +6542,7 @@ static void HWR_RenderWall(wallVert3D *wallVerts, FSurfaceInfo *pSurf, FBITFIE
alpha = pSurf->FlatColor.s.alpha; // retain the alpha
// Lighting is done here instead so that fog isn't drawn incorrectly on transparent walls after sorting
if (wallcolormap)
{
if (fogwall)

View file

@ -13240,7 +13240,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
100, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_SCENERY, // flags
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_SCENERY|MF_SLIDEME, // flags
S_NULL // raisestate
},
@ -14349,7 +14349,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
100, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY|MF_SLIDEME, // flags
S_NULL // raisestate
},

View file

@ -24,7 +24,7 @@
// SOME IMPORTANT VARIABLES DEFINED IN DOOMDEF.H:
// gamespeed is cc (0 for easy, 1 for normal, 2 for hard)
// franticitems is Frantic Mode items, bool
// mirrormode is Mirror Mode (duh), bool
// encoremode is Encore Mode (duh), bool
// comeback is Battle Mode's karma comeback, also bool
// battlewanted is an array of the WANTED player nums, -1 for no player in that slot
// indirectitemcooldown is timer before anyone's allowed another Shrink/SPB
@ -401,7 +401,7 @@ void K_RegisterKartStuff(void)
CV_RegisterVar(&cv_kartbumpers);
CV_RegisterVar(&cv_kartfrantic);
CV_RegisterVar(&cv_kartcomeback);
CV_RegisterVar(&cv_kartmirror);
CV_RegisterVar(&cv_kartencore);
CV_RegisterVar(&cv_kartspeedometer);
CV_RegisterVar(&cv_votetime);
@ -5174,7 +5174,7 @@ fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fixed_t my
else
x = (FixedMul(FINETANGENT(((diff+ANGLE_90)>>ANGLETOFINESHIFT) & 4095), 160<<FRACBITS) + (160<<FRACBITS))>>FRACBITS;
if (mirrormode)
if (encoremode)
x = 320-x;
if (splitscreen > 1)
@ -5383,14 +5383,14 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
amnumxpos = (FixedMul(mo->x, zoom) - FixedMul(xoffset, zoom));
amnumypos = -(FixedMul(mo->y, zoom) - FixedMul(yoffset, zoom));
if (mirrormode)
if (encoremode)
amnumxpos = -amnumxpos;
amxpos = amnumxpos + ((x + AutomapPic->width/2 - (iconprefix[skin]->width/2))<<FRACBITS);
amypos = amnumypos + ((y + AutomapPic->height/2 - (iconprefix[skin]->height/2))<<FRACBITS);
// do we want this? it feels unnecessary. easier to just modify the amnumxpos?
/*if (mirrormode)
/*if (encoremode)
{
flags |= V_FLIP;
amxpos = -amnumxpos + ((x + AutomapPic->width/2 + (iconprefix[skin]->width/2))<<FRACBITS);
@ -5450,7 +5450,7 @@ static void K_drawKartMinimap(void)
minimaptrans = ((10-minimaptrans)<<FF_TRANSSHIFT);
splitflags |= minimaptrans;
if (mirrormode)
if (encoremode)
V_DrawScaledPatch(x+(AutomapPic->width), y, splitflags|V_FLIP, AutomapPic);
else
V_DrawScaledPatch(x, y, splitflags, AutomapPic);
@ -5462,7 +5462,7 @@ static void K_drawKartMinimap(void)
}
// let offsets transfer to the heads, too!
if (mirrormode)
if (encoremode)
x += SHORT(AutomapPic->leftoffset);
else
x -= SHORT(AutomapPic->leftoffset);
@ -5730,7 +5730,7 @@ static void K_drawKartFirstPerson(void)
else // forward
target = 0;
if (mirrormode)
if (encoremode)
target = -target;
if (pn < target)
@ -5797,7 +5797,7 @@ static void K_drawKartFirstPerson(void)
if (stplyr->mo->momz > 0) // TO-DO: Draw more of the kart so we can remove this if!
yoffs += stplyr->mo->momz/3;
if (mirrormode)
if (encoremode)
x -= xoffs;
else
x += xoffs;

View file

@ -1413,7 +1413,7 @@ static menuitem_t OP_GameOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Game Speed", &cv_kartspeed, 30},
{IT_STRING | IT_CVAR, NULL, "Frantic Items", &cv_kartfrantic, 40},
{IT_STRING | IT_CVAR, NULL, "Mirror Mode", &cv_kartmirror, 50},
{IT_STRING | IT_CVAR, NULL, "Encore Mode", &cv_kartencore, 50},
{IT_STRING | IT_CVAR, NULL, "Number of Laps", &cv_basenumlaps, 70},
{IT_STRING | IT_CVAR, NULL, "Exit Countdown Timer", &cv_countdowntime, 80},
@ -1470,7 +1470,7 @@ static menuitem_t OP_ServerOptionsMenu[] =
{
{IT_HEADER, NULL, "RACE", NULL, 2},
{IT_STRING | IT_CVAR, NULL, "Game Speed", &cv_kartspeed, 10},
{IT_STRING | IT_CVAR, NULL, "Mirror Mode", &cv_kartmirror, 18},
{IT_STRING | IT_CVAR, NULL, "Encore Mode", &cv_kartencore, 18},
{IT_STRING | IT_CVAR, NULL, "Number of Laps", &cv_numlaps, 26},
{IT_STRING | IT_CVAR, NULL, "Use Map Lap Counts", &cv_usemapnumlaps, 34},

View file

@ -3643,7 +3643,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|| (thiscam == &camera4 && players[fourthdisplayplayer].mo && (players[fourthdisplayplayer].mo->flags2 & MF2_TWOD)))
itsatwodlevel = true;
if (mirrormode)
if (encoremode)
postimg = postimg_mirror;
else if (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP)
postimg = postimg_flip;

View file

@ -3256,7 +3256,7 @@ static void P_NetArchiveMisc(void)
WRITEINT32(save_p, numgotboxes);
WRITEUINT8(save_p, gamespeed);
WRITEUINT8(save_p, mirrormode);
WRITEUINT8(save_p, encoremode);
WRITEUINT8(save_p, franticitems);
WRITEUINT8(save_p, comeback);
@ -3361,7 +3361,7 @@ static inline boolean P_NetUnArchiveMisc(void)
numgotboxes = READINT32(save_p);
gamespeed = READUINT8(save_p);
mirrormode = (boolean)READUINT8(save_p);
encoremode = (boolean)READUINT8(save_p);
franticitems = (boolean)READUINT8(save_p);
comeback = (boolean)READUINT8(save_p);

View file

@ -2726,7 +2726,35 @@ boolean P_SetupLevel(boolean skipprecip)
// internal game map
lastloadedmaplumpnum = W_GetNumForName(maplumpname = G_BuildMapName(gamemap));
R_ReInitColormaps(mapheaderinfo[gamemap-1]->palette);
// 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;
}
for (i = 0; i < 4; i++)
battlewanted[i] = -1;
R_ReInitColormaps(mapheaderinfo[gamemap-1]->palette,
(encoremode ? W_CheckNumForName(va("%sE", maplumpname)) : LUMPERROR));
CON_SetupBackColormap();
// SRB2 determines the sky texture to be used depending on the map header.
@ -2986,33 +3014,6 @@ boolean P_SetupLevel(boolean skipprecip)
CV_SetValue(&cv_analog, false);
}*/
// SRB2Kart: map load variables
if (modeattacking) // Just play it safe and set everything
{
gamespeed = 2;
mirrormode = false;
franticitems = false;
comeback = true;
}
else
{
if (G_BattleGametype())
{
gamespeed = 0;
mirrormode = false;
}
else
{
gamespeed = (UINT8)cv_kartspeed.value;
mirrormode = (boolean)cv_kartmirror.value;
}
franticitems = (boolean)cv_kartfrantic.value;
comeback = (boolean)cv_kartcomeback.value;
}
for (i = 0; i < 4; i++)
battlewanted[i] = -1;
wantedcalcdelay = wantedfrequency*2;
indirectitemcooldown = 0;
spbincoming = 0;

View file

@ -9015,7 +9015,7 @@ static void P_CalcPostImg(player_t *player)
}
#endif
if (mirrormode) // srb2kart
if (encoremode) // srb2kart
*type = postimg_mirror;
}

View file

@ -37,6 +37,16 @@ drawseg_t *ds_p = NULL;
// indicates doors closed wrt automap bugfix:
INT32 doorclosed;
static boolean R_NoEncore(sector_t *sector)
{
INT32 val = GETSECSPECIAL(sector->special, 3);
if (val == 1 || val == 3)
return true;
if (GETSECSPECIAL(sector->special, 4) == 6)
return true;
return false;
}
//
// R_ClearDrawSegs
//
@ -935,7 +945,7 @@ static void R_Subsector(size_t num, UINT8 viewnumber)
#ifdef ESLOPE
, frontsector->f_slope
#endif
);
, R_NoEncore(frontsector));
}
else
floorplane = NULL;
@ -957,7 +967,7 @@ static void R_Subsector(size_t num, UINT8 viewnumber)
#ifdef ESLOPE
, frontsector->c_slope
#endif
);
, R_NoEncore(frontsector));
}
else
ceilingplane = NULL;
@ -1018,7 +1028,7 @@ static void R_Subsector(size_t num, UINT8 viewnumber)
#ifdef ESLOPE
, *rover->b_slope
#endif
);
, R_NoEncore(rover->master->frontsector));
#ifdef ESLOPE
ffloor[numffloors].slope = *rover->b_slope;
@ -1064,7 +1074,7 @@ static void R_Subsector(size_t num, UINT8 viewnumber)
#ifdef ESLOPE
, *rover->t_slope
#endif
);
, R_NoEncore(rover->master->frontsector));
#ifdef ESLOPE
ffloor[numffloors].slope = *rover->t_slope;
@ -1133,7 +1143,7 @@ static void R_Subsector(size_t num, UINT8 viewnumber)
#ifdef ESLOPE
, NULL // will ffloors be slopable eventually?
#endif
);
, R_NoEncore(polysec));
ffloor[numffloors].height = polysec->floorheight;
ffloor[numffloors].polyobj = po;
@ -1179,7 +1189,7 @@ static void R_Subsector(size_t num, UINT8 viewnumber)
#ifdef ESLOPE
, NULL // will ffloors be slopable eventually?
#endif
);
, R_NoEncore(polysec));
ffloor[numffloors].polyobj = po;
ffloor[numffloors].height = polysec->ceilingheight;

View file

@ -112,6 +112,7 @@ INT32 *texturetranslation;
sprcache_t *spritecachedinfo;
lighttable_t *colormaps;
lighttable_t *encoremap;
// for debugging/info purposes
static size_t flatmemory, spritememory, texturememory;
@ -932,7 +933,7 @@ static inline lumpnum_t R_CheckNumForNameList(const char *name, lumplist_t *list
return LUMPERROR;
}
static lumplist_t *colormaplumps = NULL; ///\todo free leak
/*static lumplist_t *colormaplumps = NULL; ///\todo free leak
static size_t numcolormaplumps = 0;
static void R_InitExtraColormaps(void)
@ -966,7 +967,7 @@ static void R_InitExtraColormaps(void)
numcolormaplumps++;
}
CONS_Printf(M_GetText("Number of Extra Colormaps: %s\n"), sizeu1(numcolormaplumps));
}
}*/
// 12/14/14 -- only take flats in F_START/F_END
lumpnum_t R_GetFlatNumForName(const char *name)
@ -1010,15 +1011,17 @@ static void R_InitColormaps(void)
// Load in the light tables
lump = W_GetNumForName("COLORMAP");
colormaps = Z_MallocAlign(W_LumpLength (lump), PU_STATIC, NULL, 8);
//Z_MallocAlign(W_LumpLength (lump), PU_STATIC, NULL, 8);
colormaps = Z_MallocAlign((256 * 64), PU_STATIC, NULL, 8);
W_ReadLump(lump, colormaps);
// no need to init encoremap at this stage
// Init Boom colormaps.
R_ClearColormaps();
R_InitExtraColormaps();
//R_InitExtraColormaps();
}
void R_ReInitColormaps(UINT16 num)
void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap)
{
char colormap[9] = "COLORMAP";
lumpnum_t lump;
@ -1032,6 +1035,30 @@ void R_ReInitColormaps(UINT16 num)
lump = W_GetNumForName("COLORMAP");
W_ReadLump(lump, colormaps);
// Encore mode.
if (newencoremap != LUMPERROR)
{
lighttable_t *colormap_p, *colormap_p2;
size_t p, i;
encoremap = Z_MallocAlign(256 + 10, PU_LEVEL, NULL, 8);
W_ReadLump(newencoremap, encoremap);
colormap_p = colormap_p2 = colormaps;
colormap_p += (256 * 32);
for (p = 0; p < 32; p++)
{
for (i = 0; i < 256; i++)
{
*colormap_p = colormap_p2[encoremap[i]];
colormap_p++;
}
colormap_p2 += 256;
}
}
else
encoremap = NULL;
// Init Boom colormaps.
R_ClearColormaps();
}
@ -1060,7 +1087,7 @@ void R_ClearColormaps(void)
memset(extra_colormaps, 0, sizeof (extra_colormaps));
}
INT32 R_ColormapNumForName(char *name)
/*INT32 R_ColormapNumForName(char *name)
{
lumpnum_t lump, i;
@ -1092,7 +1119,7 @@ INT32 R_ColormapNumForName(char *name)
num_extra_colormaps++;
return (INT32)num_extra_colormaps - 1;
}
}*/
//
// R_CreateColormap
@ -1121,10 +1148,20 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
if (p1[0] == '#')
{
cr = ((HEX2INT(p1[1]) * 16) + HEX2INT(p1[2]));
cmaskr = cr;
cg = ((HEX2INT(p1[3]) * 16) + HEX2INT(p1[4]));
cmaskg = cg;
cb = ((HEX2INT(p1[5]) * 16) + HEX2INT(p1[6]));
// i don't know why this doesn't work...
/*if (encoremap)
{
i = NearestColor(cr, cg, cb);
cr = pLocalPalette[encoremap[i]].s.red;
cg = pLocalPalette[encoremap[i]].s.green;
cb = pLocalPalette[encoremap[i]].s.blue;
}*/
cmaskr = cr;
cmaskg = cg;
cmaskb = cb;
// Create a rough approximation of the color (a 16 bit color)
maskcolor = ((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11);
@ -1167,9 +1204,22 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
if (p3[0] == '#')
{
cdestr = cr = ((HEX2INT(p3[1]) * 16) + HEX2INT(p3[2]));
cdestg = cg = ((HEX2INT(p3[3]) * 16) + HEX2INT(p3[4]));
cdestb = cb = ((HEX2INT(p3[5]) * 16) + HEX2INT(p3[6]));
cr = ((HEX2INT(p3[1]) * 16) + HEX2INT(p3[2]));
cg = ((HEX2INT(p3[3]) * 16) + HEX2INT(p3[4]));
cb = ((HEX2INT(p3[5]) * 16) + HEX2INT(p3[6]));
// i don't know why this doesn't work...
/*if (encoremap)
{
i = NearestColor(cr, cg, cb);
cr = pLocalPalette[encoremap[i]].s.red;
cg = pLocalPalette[encoremap[i]].s.green;
cb = pLocalPalette[encoremap[i]].s.blue;
}*/
cdestr = cr;
cdestg = cg;
cdestb = cb;
fadecolor = (((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11));
}
else
@ -1257,10 +1307,10 @@ void R_CreateColormap2(char *p1, char *p2, char *p3)
double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb;
double r, g, b, cbrightness;
double maskamt = 0, othermask = 0;
int mask, p, fog = 0;
INT32 mask, p, fog = 0;
size_t mapnum = num_extra_colormaps;
size_t i;
char *colormap_p;
lighttable_t *colormap_p, *colormap_p2;
UINT32 cr, cg, cb, maskcolor, fadecolor;
UINT32 fadestart = 0, fadeend = 33, fadedist = 33;
@ -1268,10 +1318,20 @@ void R_CreateColormap2(char *p1, char *p2, char *p3)
if (p1[0] == '#')
{
cr = ((HEX2INT(p1[1]) * 16) + HEX2INT(p1[2]));
cmaskr = cr;
cg = ((HEX2INT(p1[3]) * 16) + HEX2INT(p1[4]));
cmaskg = cg;
cb = ((HEX2INT(p1[5]) * 16) + HEX2INT(p1[6]));
// i don't know why this doesn't work...
/*if (encoremap)
{
i = NearestColor(cr, cg, cb);
cr = pLocalPalette[encoremap[i]].s.red;
cg = pLocalPalette[encoremap[i]].s.green;
cb = pLocalPalette[encoremap[i]].s.blue;
}*/
cmaskr = cr;
cmaskg = cg;
cmaskb = cb;
// Create a rough approximation of the color (a 16 bit color)
maskcolor = ((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11);
@ -1314,9 +1374,22 @@ void R_CreateColormap2(char *p1, char *p2, char *p3)
if (p3[0] == '#')
{
cdestr = cr = ((HEX2INT(p3[1]) * 16) + HEX2INT(p3[2]));
cdestg = cg = ((HEX2INT(p3[3]) * 16) + HEX2INT(p3[4]));
cdestb = cb = ((HEX2INT(p3[5]) * 16) + HEX2INT(p3[6]));
cr = ((HEX2INT(p3[1]) * 16) + HEX2INT(p3[2]));
cg = ((HEX2INT(p3[3]) * 16) + HEX2INT(p3[4]));
cb = ((HEX2INT(p3[5]) * 16) + HEX2INT(p3[6]));
// i don't know why this doesn't work...
/*if (encoremap)
{
i = NearestColor(cr, cg, cb);
cr = pLocalPalette[encoremap[i]].s.red;
cg = pLocalPalette[encoremap[i]].s.green;
cb = pLocalPalette[encoremap[i]].s.blue;
}*/
cdestr = cr;
cdestg = cg;
cdestb = cb;
fadecolor = (((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11));
}
else
@ -1383,10 +1456,10 @@ void R_CreateColormap2(char *p1, char *p2, char *p3)
#define ABS2(x) ((x) < 0 ? -(x) : (x))
if (rendermode == render_soft)
{
colormap_p = Z_MallocAlign((256 * 34) + 10, PU_LEVEL, NULL, 8);
colormap_p = Z_MallocAlign((256 * (encoremap ? 64 : 32)) + 10, PU_LEVEL, NULL, 8);
extra_colormaps[mapnum].colormap = (UINT8 *)colormap_p;
for (p = 0; p < 34; p++)
for (p = 0; p < 32; p++)
{
for (i = 0; i < 256; i++)
{
@ -1414,6 +1487,21 @@ void R_CreateColormap2(char *p1, char *p2, char *p3)
map[i][2] = cdestb;
}
}
if (!encoremap)
return;
colormap_p2 = extra_colormaps[mapnum].colormap;
for (p = 0; p < 32; p++)
{
for (i = 0; i < 256; i++)
{
*colormap_p = colormap_p2[encoremap[i]];
colormap_p++;
}
colormap_p2 += 256;
}
}
#undef ABS2

View file

@ -89,7 +89,7 @@ void R_ClearTextureNumCache(boolean btell);
INT32 R_TextureNumForName(const char *name);
INT32 R_CheckTextureNumForName(const char *name);
void R_ReInitColormaps(UINT16 num);
void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap);
void R_ClearColormaps(void);
INT32 R_ColormapNumForName(char *name);
INT32 R_CreateColormap(char *p1, char *p2, char *p3);

View file

@ -1379,6 +1379,8 @@ void R_DrawColumnShadowed_8(void)
if (height <= dc_yl)
{
dc_colormap = dc_lightlist[i].rcolormap;
if (encoremap)
dc_colormap += (256*32);
if (solid && dc_yl < bheight)
dc_yl = bheight;
continue;
@ -1395,6 +1397,8 @@ void R_DrawColumnShadowed_8(void)
dc_yl = dc_yh + 1;
dc_colormap = dc_lightlist[i].rcolormap;
if (encoremap)
dc_colormap += (256*32);
}
dc_yh = realyh;
if (dc_yl <= realyh)

View file

@ -335,6 +335,8 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
else
#endif
ds_colormap = planezlight[pindex];
if (encoremap && !currentplane->noencore)
ds_colormap += (256*32);
if (currentplane->extra_colormap)
ds_colormap = currentplane->extra_colormap->colormap + (ds_colormap - colormaps);
@ -437,7 +439,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
#ifdef ESLOPE
, pslope_t *slope
#endif
)
, boolean noencore)
{
visplane_t *check;
unsigned hash;
@ -486,7 +488,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
#ifdef ESLOPE
&& check->slope == slope
#endif
)
&& check->noencore == noencore)
{
return check;
}
@ -514,6 +516,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
#ifdef ESLOPE
check->slope = slope;
#endif
check->noencore = noencore;
memset(check->top, 0xff, sizeof (check->top));
memset(check->bottom, 0x00, sizeof (check->bottom));
@ -586,6 +589,7 @@ visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop)
#ifdef ESLOPE
new_pl->slope = pl->slope;
#endif
new_pl->noencore = pl->noencore;
pl = new_pl;
pl->minx = start;
pl->maxx = stop;
@ -703,6 +707,8 @@ void R_DrawPlanes(void)
// Because of this hack, sky is not affected
// by INVUL inverse mapping.
dc_colormap = colormaps;
if (encoremap)
dc_colormap += (256*32);
dc_texturemid = skytexturemid;
dc_texheight = textureheight[skytexture]
>>FRACBITS;

View file

@ -65,6 +65,8 @@ typedef struct visplane_s
#ifdef ESLOPE
pslope_t *slope;
#endif
boolean noencore;
} visplane_t;
extern visplane_t *floorplane;
@ -103,7 +105,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t
#ifdef ESLOPE
, pslope_t *slope
#endif
);
, boolean noencore);
visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop);
void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop);
void R_PlaneBounds(visplane_t *plane);

View file

@ -202,6 +202,8 @@ static void R_DrawWallSplats(void)
if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE - 1;
dc_colormap = walllights[pindex];
if (encoremap)
dc_colormap += (256*32);
if (frontsector->extra_colormap)
dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps);
@ -596,6 +598,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
if (height <= windowtop)
{
dc_colormap = rlight->rcolormap;
if (encoremap)
dc_colormap += (256*32);
continue;
}
@ -615,6 +619,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
colfunc_2s(col);
windowtop = windowbottom + 1;
dc_colormap = rlight->rcolormap;
if (encoremap)
dc_colormap += (256*32);
}
windowbottom = realbot;
if (windowtop < windowbottom)
@ -631,6 +637,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
pindex = MAXLIGHTSCALE - 1;
dc_colormap = walllights[pindex];
if (encoremap)
dc_colormap += (256*32);
if (frontsector->extra_colormap)
dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps);
@ -1210,7 +1218,11 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
if (height <= windowtop)
{
if (lighteffect)
{
dc_colormap = rlight->rcolormap;
if (encoremap)
dc_colormap += (256*32);
}
if (solid && windowtop < bheight)
windowtop = bheight;
continue;
@ -1236,7 +1248,11 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
else
windowtop = windowbottom + 1;
if (lighteffect)
{
dc_colormap = rlight->rcolormap;
if (encoremap)
dc_colormap += (256*32);
}
}
windowbottom = sprbotscreen;
if (windowtop < windowbottom)
@ -1253,6 +1269,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
pindex = MAXLIGHTSCALE - 1;
dc_colormap = walllights[pindex];
if (encoremap)
dc_colormap += (256*32);
if (frontsector->extra_colormap)
dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps);
if (pfloor->flags & FF_FOG && pfloor->master->frontsector->extra_colormap)
@ -1483,6 +1501,8 @@ static void R_RenderSegLoop (void)
pindex = MAXLIGHTSCALE-1;
dc_colormap = walllights[pindex];
if (encoremap)
dc_colormap += (256*32);
dc_x = rw_x;
dc_iscale = 0xffffffffu / (unsigned)rw_scale;

View file

@ -38,6 +38,7 @@ typedef struct
extern sprcache_t *spritecachedinfo;
extern lighttable_t *colormaps;
extern lighttable_t *encoremap;
// Boom colormaps.
// Had to put a limit on colormaps :(

View file

@ -873,6 +873,11 @@ static void R_DrawVisSprite(vissprite_t *vis)
if (!dc_colormap)
dc_colormap = colormaps;
if (encoremap && !vis->mobj->color
&& (vis->mobj->flags & (MF_SCENERY|MF_NOTHINK))
&& !(vis->mobj->flags & ~(MF_SCENERY|MF_NOTHINK|MF_NOCLIP|MF_NOBLOCKMAP|MF_NOGRAVITY)))
dc_colormap += (256*32);
dc_texturemid = vis->texturemid;
dc_texheight = 0;
@ -973,6 +978,8 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
}
dc_colormap = colormaps;
if (encoremap)
dc_colormap += (256*32);
dc_iscale = FixedDiv(FRACUNIT, vis->scale);
dc_texturemid = vis->texturemid;

View file

@ -391,7 +391,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
{
INT32 sep, pitch, priority, cnum;
sfxinfo_t *sfx;
const boolean reverse = (stereoreverse.value ^ mirrormode);
const boolean reverse = (stereoreverse.value ^ encoremode);
const mobj_t *origin = (const mobj_t *)origin_p;
listener_t listener = {0,0,0,0};
@ -1198,7 +1198,7 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v
listener_t listensource;
const boolean reverse = (stereoreverse.value ^ mirrormode);
const boolean reverse = (stereoreverse.value ^ encoremode);
(void)pitch;
if (!listener)

View file

@ -797,15 +797,24 @@ static void ST_drawLevelTitle(void)
}
{
const char *subttlstr;
dupcalc = (dupcalc - BASEVIDWIDTH)>>1;
V_DrawFill(sub - dupcalc, bary+9, ttlnumxpos+dupcalc + 1, 2, 31);
V_DrawDiag(sub + ttlnumxpos + 1, bary, 11, 31);
V_DrawFill(sub - dupcalc, bary, ttlnumxpos+dupcalc, 10, gtc);
V_DrawDiag(sub + ttlnumxpos, bary, 10, gtc);
if (subttl[0])
V_DrawRightAlignedString(sub + zonexpos - 8, bary+1, V_ALLOWLOWERCASE, subttl);
if (encoremode)
subttlstr = "Encore Mode";
else if (subttl[0])
subttlstr = subttl;
else if (mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU)
subttlstr = "MAP HELL";
else
V_DrawRightAlignedString(sub + zonexpos - 8, bary+1, V_ALLOWLOWERCASE, va("%s Mode", gametype_cons_t[gametype].strvalue));
subttlstr = va("%s Mode", gametype_cons_t[gametype].strvalue);
V_DrawRightAlignedString(sub + zonexpos - 8, bary+1, V_ALLOWLOWERCASE, subttlstr);
}
ttlnumxpos += sub;

View file

@ -93,6 +93,7 @@ typedef union
UINT32 val[MAXPLAYERS]; //Gametype-specific value
UINT8 pos[MAXPLAYERS]; // player positions. used for ties
boolean rankingsmode; // rankings mode
boolean encore; // encore mode
} match;
} y_data;
@ -204,6 +205,8 @@ static void Y_CalculateMatchData(boolean rankingsmode, void (*comparison)(INT32)
if ((data.match.rankingsmode = rankingsmode))
sprintf(data.match.levelstring, "* Total Rankings *");
data.match.encore = (!rankingsmode && encoremode);
for (i = 0; i < MAXPLAYERS; i++)
{
data.match.val[i] = UINT32_MAX;
@ -379,6 +382,9 @@ void Y_IntermissionDrawer(void)
V_DrawCenteredString(-4 + x + BASEVIDWIDTH/2, 20, 0, data.match.levelstring);
V_DrawFill(x, 42, 312, 1, 0);
if (data.match.encore)
V_DrawCenteredString(-4 + x + BASEVIDWIDTH/2, 20-8, hilicol, "ENCORE MODE");
if (data.match.numplayers > 8)
{
V_DrawFill(160, 32, 1, 152, 0);