Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e13ba89f1a | ||
|
|
d8b2134aef | ||
|
|
c168832f8e | ||
|
|
448a603a56 | ||
|
|
2a95201c6d | ||
|
|
a73de55f96 | ||
|
|
e4a4496be6 | ||
|
|
a8f3a8dfb0 | ||
|
|
e19b9d1c60 | ||
|
|
e28ec4e7cb | ||
|
|
d0f09b467b |
No files matched your search
+2
-2
@@ -1812,7 +1812,7 @@ void D_SRB2Main(void)
|
||||
{
|
||||
name = lumpinfo->name;
|
||||
|
||||
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
|
||||
if (memcmp(name, "MAP", 3) == 0) // Ignore the headers
|
||||
{
|
||||
INT16 num;
|
||||
if (name[5] != '\0')
|
||||
@@ -1842,7 +1842,7 @@ void D_SRB2Main(void)
|
||||
{
|
||||
name = lumpinfo->name;
|
||||
|
||||
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
|
||||
if (memcmp(name, "MAP", 3) == 0) // Ignore the headers
|
||||
{
|
||||
INT16 num;
|
||||
if (name[5] != '\0')
|
||||
|
||||
@@ -259,8 +259,6 @@ INT32 HU_FallBackFrSpecialLetter(INT32 key)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static char cechotext[1024];
|
||||
static tic_t cechotimer = 0;
|
||||
static tic_t cechoduration = 5*TICRATE;
|
||||
|
||||
+4
-16
@@ -1260,15 +1260,10 @@ extern int lib_hudadd(lua_State *L);
|
||||
|
||||
static int lib_hudsetvotebackground(lua_State *L)
|
||||
{
|
||||
memset(VoteScreen.luaPrefix, 0, sizeof(VoteScreen.luaPrefix));
|
||||
|
||||
if (lua_isnoneornil(L, 1))
|
||||
{
|
||||
if (luaVoteScreen)
|
||||
{
|
||||
free(luaVoteScreen);
|
||||
}
|
||||
|
||||
luaVoteScreen = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1279,15 +1274,8 @@ static int lib_hudsetvotebackground(lua_State *L)
|
||||
return luaL_argerror(L, 1, "prefix should 4 characters wide");
|
||||
}
|
||||
|
||||
if (!luaVoteScreen)
|
||||
{
|
||||
luaVoteScreen = (char*)malloc(5);
|
||||
luaVoteScreen[4] = 0;
|
||||
}
|
||||
|
||||
strncpy(luaVoteScreen, prefix, 4);
|
||||
|
||||
strupr(luaVoteScreen);
|
||||
strncpy(VoteScreen.luaPrefix, prefix, 4);
|
||||
strupr(VoteScreen.luaPrefix);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+141
-109
@@ -67,6 +67,8 @@
|
||||
#include "lua_script.h"
|
||||
#include "lua_hook.h"
|
||||
|
||||
#include "y_inter.h"
|
||||
|
||||
#if !defined (UNDER_CE)
|
||||
#include <time.h>
|
||||
#endif
|
||||
@@ -3106,11 +3108,128 @@ boolean P_AddWadFile(const char *wadfilename, boolean local)
|
||||
return true;
|
||||
}
|
||||
|
||||
// check for replacement votescreen backgrounds
|
||||
boolean wideracereplaced = false;
|
||||
boolean racereplaced = false;
|
||||
boolean widebattlereplaced = false;
|
||||
boolean battlereplaced = false;
|
||||
static size_t sreplaces = 0, mreplaces = 0, digmreplaces = 0;
|
||||
|
||||
//
|
||||
// search for sound replacements
|
||||
//
|
||||
static boolean P_CheckSoundReplacements(UINT16 wadnum, char *name, size_t i)
|
||||
{
|
||||
size_t j;
|
||||
lumpnum_t lumpnum = (i|(wadnum<<16));
|
||||
|
||||
if (name[0] == 'D')
|
||||
{
|
||||
if (name[1] == 'S')
|
||||
{
|
||||
for (j = 1; j < NUMSFX; j++)
|
||||
{
|
||||
if (S_sfx[j].name && !strnicmp(S_sfx[j].name, name + 2, 6)
|
||||
&& (S_sfx[j].lumpnum != lumpnum) && (S_sfx[j].lumpnum != LUMPERROR))
|
||||
{
|
||||
// the sound will be reloaded when needed,
|
||||
// since sfx->data will be NULL
|
||||
CONS_Debug(DBG_SETUP, "Sound %.8s replaced\n", name);
|
||||
|
||||
I_FreeSfx(&S_sfx[j]);
|
||||
|
||||
// Re-cache it
|
||||
if (S_PrecacheSound())
|
||||
S_sfx[j].data = I_GetSfx(&S_sfx[j]);
|
||||
|
||||
sreplaces++;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (name[1] == '_')
|
||||
{
|
||||
CONS_Debug(DBG_SETUP, "Music %.8s ignored\n", name);
|
||||
mreplaces++;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (name[0] == 'O' && name[1] == '_')
|
||||
{
|
||||
CONS_Debug(DBG_SETUP, "Music %.8s replaced\n", name);
|
||||
digmreplaces++;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// search for maps
|
||||
//
|
||||
static boolean P_CheckMapReplacements(char *name)
|
||||
{
|
||||
if (memcmp(name, "MAP", 3) == 0) // Ignore the headers
|
||||
{
|
||||
INT16 num;
|
||||
|
||||
if (name[5] != '\0')
|
||||
return false;
|
||||
|
||||
num = (INT16)M_MapNumber(name[3], name[4]);
|
||||
|
||||
// we want to record whether this map exists. if it doesn't have a header, we can assume it's not relephant
|
||||
if (num <= NUMMAPS && mapheaderinfo[num-1])
|
||||
{
|
||||
if (mapheaderinfo[num-1]->menuflags & LF2_EXISTSHACK)
|
||||
G_SetGameModified(multiplayer, true); // oops, double-defined - no record attack privileges for you
|
||||
mapheaderinfo[num-1]->menuflags |= LF2_EXISTSHACK;
|
||||
}
|
||||
|
||||
if (num == gamemap)
|
||||
partadd_replacescurrentmap = true;
|
||||
|
||||
CONS_Printf("%s\n", name);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// check for non Lua votescreen replacements
|
||||
//
|
||||
static boolean P_CheckVoteReplacements(char *name)
|
||||
{
|
||||
// widescreen patch Race
|
||||
if (!VoteScreen.replaced.widerace && !memcmp(name, "INTERSCW", 8))
|
||||
{
|
||||
VoteScreen.replaced.widerace = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!VoteScreen.replaced.race && !memcmp(name, "INTERSCR", 8))
|
||||
{
|
||||
VoteScreen.replaced.race = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// widescreen patch Battle
|
||||
if (!VoteScreen.replaced.widebattle && !memcmp(name, "BATTLSCW", 8))
|
||||
{
|
||||
VoteScreen.replaced.widebattle = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!VoteScreen.replaced.battle && !memcmp(name, "BATTLSCR", 8))
|
||||
{
|
||||
VoteScreen.replaced.battle = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (VoteScreen.replaced.widerace && VoteScreen.replaced.race
|
||||
&& VoteScreen.replaced.widebattle && VoteScreen.replaced.battle)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Add a WAD file and do the per-WAD setup stages.
|
||||
@@ -3118,12 +3237,15 @@ boolean battlereplaced = false;
|
||||
//
|
||||
UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
{
|
||||
size_t i, j, sreplaces = 0, mreplaces = 0, digmreplaces = 0;
|
||||
size_t i;
|
||||
UINT16 numlumps, wadnum;
|
||||
char *name;
|
||||
boolean mapsadded = false;
|
||||
static boolean allvotereplaced = false;
|
||||
lumpinfo_t *lumpinfo;
|
||||
|
||||
sreplaces = mreplaces = digmreplaces = 0;
|
||||
|
||||
if ((numlumps = W_InitFile(wadfilename, local)) == INT16_MAX)
|
||||
{
|
||||
refreshdirmenu |= REFRESHDIR_NOTLOADED;
|
||||
@@ -3138,46 +3260,24 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
|
||||
wadfiles[wadnum]->localfile = local;
|
||||
|
||||
//
|
||||
// search for sound replacements
|
||||
//
|
||||
lumpinfo = wadfiles[wadnum]->lumpinfo;
|
||||
for (i = 0; i < numlumps; i++, lumpinfo++)
|
||||
{
|
||||
name = lumpinfo->name;
|
||||
lumpnum_t lumpnum = i|(wadnum<<16);
|
||||
|
||||
if (name[0] == 'D')
|
||||
if (P_CheckSoundReplacements(wadnum, name, i))
|
||||
continue;
|
||||
|
||||
if (P_CheckMapReplacements(name))
|
||||
{
|
||||
if (name[1] == 'S') for (j = 1; j < NUMSFX; j++)
|
||||
{
|
||||
if (S_sfx[j].name && !strnicmp(S_sfx[j].name, name + 2, 6) && S_sfx[j].lumpnum != lumpnum && S_sfx[j].lumpnum != LUMPERROR)
|
||||
{
|
||||
// the sound will be reloaded when needed,
|
||||
// since sfx->data will be NULL
|
||||
CONS_Debug(DBG_SETUP, "Sound %.8s replaced\n", name);
|
||||
|
||||
I_FreeSfx(&S_sfx[j]);
|
||||
|
||||
// Re-cache it
|
||||
if (S_PrecacheSound())
|
||||
S_sfx[j].data = I_GetSfx(&S_sfx[j]);
|
||||
|
||||
sreplaces++;
|
||||
}
|
||||
}
|
||||
else if (name[1] == '_')
|
||||
{
|
||||
CONS_Debug(DBG_SETUP, "Music %.8s ignored\n", name);
|
||||
mreplaces++;
|
||||
}
|
||||
}
|
||||
else if (name[0] == 'O' && name[1] == '_')
|
||||
{
|
||||
CONS_Debug(DBG_SETUP, "Music %.8s replaced\n", name);
|
||||
digmreplaces++;
|
||||
mapsadded = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!allvotereplaced && P_CheckVoteReplacements(name))
|
||||
allvotereplaced = true;
|
||||
}
|
||||
|
||||
if (!devparm && sreplaces)
|
||||
CONS_Printf(M_GetText("%s sounds replaced\n"), sizeu1(sreplaces));
|
||||
if (!devparm && mreplaces)
|
||||
@@ -3185,6 +3285,9 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
if (!devparm && digmreplaces)
|
||||
CONS_Printf(M_GetText("%s digital musics replaced\n"), sizeu1(digmreplaces));
|
||||
|
||||
if (!mapsadded)
|
||||
CONS_Printf(M_GetText("No maps added\n"));
|
||||
|
||||
//
|
||||
// search for sprite replacements
|
||||
//
|
||||
@@ -3209,80 +3312,9 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
//
|
||||
S_LoadMusicDefs(wadnum);
|
||||
|
||||
//
|
||||
// search for maps
|
||||
//
|
||||
lumpinfo = wadfiles[wadnum]->lumpinfo;
|
||||
for (i = 0; i < numlumps; i++, lumpinfo++)
|
||||
{
|
||||
name = lumpinfo->name;
|
||||
|
||||
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
|
||||
{
|
||||
INT16 num;
|
||||
if (name[5]!='\0')
|
||||
continue;
|
||||
num = (INT16)M_MapNumber(name[3], name[4]);
|
||||
|
||||
// we want to record whether this map exists. if it doesn't have a header, we can assume it's not relephant
|
||||
if (num <= NUMMAPS && mapheaderinfo[num-1])
|
||||
{
|
||||
if (mapheaderinfo[num-1]->menuflags & LF2_EXISTSHACK)
|
||||
G_SetGameModified(multiplayer, true); // oops, double-defined - no record attack privileges for you
|
||||
mapheaderinfo[num-1]->menuflags |= LF2_EXISTSHACK;
|
||||
}
|
||||
|
||||
if (num == gamemap)
|
||||
partadd_replacescurrentmap = true;
|
||||
|
||||
CONS_Printf("%s\n", name);
|
||||
mapsadded = true;
|
||||
}
|
||||
}
|
||||
if (!mapsadded)
|
||||
CONS_Printf(M_GetText("No maps added\n"));
|
||||
|
||||
// TODO: Experimental SPRTINFO support, test first
|
||||
R_LoadSpriteInfoLumps(wadnum, wadfiles[wadnum]->numlumps);
|
||||
|
||||
//
|
||||
// check for votescreen replacements
|
||||
//
|
||||
if (!wideracereplaced && !racereplaced && !widebattlereplaced && !battlereplaced)
|
||||
{
|
||||
lumpinfo = wadfiles[wadnum]->lumpinfo;
|
||||
for (i = 0; i < numlumps; i++, lumpinfo++)
|
||||
{
|
||||
name = lumpinfo->name;
|
||||
|
||||
// widescreen patch Race
|
||||
if (!wideracereplaced && !strncmp(name, "INTERSCW", 8))
|
||||
{
|
||||
wideracereplaced = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!racereplaced && !strncmp(name, "INTERSCR", 8))
|
||||
{
|
||||
racereplaced = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// widescreen patch Battle
|
||||
if (!widebattlereplaced && !strncmp(name, "BATTLSCW", 8))
|
||||
{
|
||||
widebattlereplaced = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!battlereplaced && !strncmp(name, "BATTLSCR", 8))
|
||||
{
|
||||
battlereplaced = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
refreshdirmenu &= ~REFRESHDIR_GAMEDATA; // Under usual circumstances we'd wait for REFRESHDIR_GAMEDATA to disappear the next frame, but it's a bit too dangerous for that...
|
||||
partadd_stage = 0;
|
||||
return wadnum;
|
||||
|
||||
@@ -68,11 +68,6 @@ void HWR_LoadLevel(boolean reloadinggamestate);
|
||||
|
||||
boolean P_AddWadFile(const char *wadfilename, boolean local);
|
||||
|
||||
extern boolean wideracereplaced;
|
||||
extern boolean racereplaced;
|
||||
extern boolean widebattlereplaced;
|
||||
extern boolean battlereplaced;
|
||||
|
||||
// WARNING: The following functions should be grouped as follows:
|
||||
// any amount of PartialAdds followed by MultiSetups until returned true,
|
||||
// as soon as possible.
|
||||
|
||||
+145
-133
@@ -57,30 +57,15 @@ typedef struct
|
||||
|
||||
static y_data_t data;
|
||||
|
||||
|
||||
// graphics
|
||||
static patch_t *bgpatch = NULL; // INTERSCR
|
||||
static patch_t *widebgpatch = NULL; // INTERSCW
|
||||
static patch_t *bgtile = NULL; // SPECTILE/SRB2BACK
|
||||
|
||||
static INT32 timer;
|
||||
|
||||
static INT32 intertic;
|
||||
static INT32 endtic = -1;
|
||||
static INT32 sorttic = -1;
|
||||
|
||||
patch_t *animVoteFramesPatches = NULL;
|
||||
// VEXTRN - Vote (V) Extra (EXT) Race (R) Normal (N - Normal sized patch)
|
||||
// VEXTBN - Vote (V) Extra (EXT) Battle (B) Normal (N - Normal sized patch)
|
||||
// VEXTBW - Vote (V) Extra (EXT) Battle (B) Normal (W - Wide patch used in software)
|
||||
// VEXTRW - Vote (V) Extra (EXT) Race (R) Normal (W - Wide patch used in software)
|
||||
char animPrefix[] = "INTSC";
|
||||
char animWidePrefix[] = "INTSW";
|
||||
char *luaVoteScreen = NULL;
|
||||
|
||||
INT32 currentAnimFrame = 0;
|
||||
static INT32 foundAnimVoteFrames = 0;
|
||||
static INT32 foundAnimVoteWideFrames = 0;
|
||||
|
||||
intertype_t intertype = int_none;
|
||||
|
||||
static huddrawlist_h luahuddrawlist_intermission = NULL;
|
||||
@@ -118,17 +103,13 @@ typedef struct
|
||||
boolean loaded;
|
||||
} y_voteclient;
|
||||
|
||||
// votescreen stuff
|
||||
votescreen_t VoteScreen = {0};
|
||||
|
||||
static y_votelvlinfo levelinfo[5];
|
||||
static y_voteclient voteclient;
|
||||
static INT32 votetic;
|
||||
static INT32 voteendtic = -1;
|
||||
static patch_t *cursor = NULL;
|
||||
static patch_t *cursor1 = NULL;
|
||||
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);
|
||||
|
||||
@@ -287,49 +268,6 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Y_AnimatedVoteScreenCheck
|
||||
//
|
||||
// Check if the lumps exist (checking for VEXTR(N|W)xx for race and VEXTRB(N|W)xx for battle)
|
||||
static void Y_AnimatedVoteScreenCheck(void)
|
||||
{
|
||||
char tmpPrefix[] = "INTS";
|
||||
|
||||
if (luaVoteScreen)
|
||||
strncpy(tmpPrefix, luaVoteScreen, 4);
|
||||
else if (G_BattleGametype())
|
||||
strcpy(tmpPrefix, "BTLS");
|
||||
|
||||
strncpy(animPrefix, tmpPrefix, 4);
|
||||
animPrefix[4] = 'C';
|
||||
strncpy(animWidePrefix, tmpPrefix, 4);
|
||||
animWidePrefix[4] = 'W';
|
||||
|
||||
foundAnimVoteFrames = foundAnimVoteWideFrames = 0;
|
||||
currentAnimFrame = 0;
|
||||
|
||||
INT32 i = 1;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
boolean normalLumpExists = W_LumpExists(va("%sC%d", tmpPrefix, i));
|
||||
boolean wideLumpExists = W_LumpExists(va("%sW%d", tmpPrefix, i));
|
||||
|
||||
if (normalLumpExists || wideLumpExists)
|
||||
{
|
||||
if (normalLumpExists)
|
||||
foundAnimVoteFrames++;
|
||||
|
||||
if (wideLumpExists)
|
||||
foundAnimVoteWideFrames++;
|
||||
}
|
||||
else // If we don't find at least frame 1 (e.g VEXTRN1), let's just stop looking
|
||||
break;
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// Y_PlayerStandingsDrawer
|
||||
//
|
||||
// Handles drawing the center-of-screen player standings.
|
||||
@@ -863,7 +801,8 @@ void Y_StartIntermission(void)
|
||||
//
|
||||
void Y_EndIntermission(void)
|
||||
{
|
||||
Y_UnloadData();
|
||||
if (!dedicated)
|
||||
Y_UnloadData();
|
||||
|
||||
endtic = -1;
|
||||
sorttic = -1;
|
||||
@@ -881,28 +820,72 @@ static void Y_FollowIntermission(void)
|
||||
G_AfterIntermission();
|
||||
}
|
||||
|
||||
#define UNLOAD(x) if (x) {Patch_Free(x);} x = NULL;
|
||||
#define UNLOAD(x) {if ((x) != NULL) {Patch_Free(x);} x = NULL;}
|
||||
|
||||
//
|
||||
// Y_UnloadData
|
||||
//
|
||||
static void Y_UnloadData(void)
|
||||
{
|
||||
// In hardware mode, don't Z_ChangeTag a pointer returned by W_CachePatchName().
|
||||
// It doesn't work and is unnecessary.
|
||||
if (rendermode != render_soft)
|
||||
return;
|
||||
|
||||
// unload the background patches
|
||||
UNLOAD(bgpatch);
|
||||
UNLOAD(widebgpatch);
|
||||
UNLOAD(VoteScreen.bgpatch);
|
||||
UNLOAD(VoteScreen.widebgpatch);
|
||||
UNLOAD(bgtile);
|
||||
//UNLOAD(interpic);
|
||||
}
|
||||
|
||||
// SRB2Kart: Voting!
|
||||
|
||||
static void Y_DrawVoteBackground(patch_t *patch)
|
||||
//
|
||||
// Y_VoteScreenCheck
|
||||
//
|
||||
static void Y_VoteScreenCheck(void)
|
||||
{
|
||||
strcpy(VoteScreen.Prefix, "INTS");
|
||||
|
||||
if (VoteScreen.luaPrefix[0] != 0)
|
||||
strlcpy(VoteScreen.Prefix, VoteScreen.luaPrefix, sizeof(VoteScreen.Prefix));
|
||||
else if (G_BattleGametype())
|
||||
strcpy(VoteScreen.Prefix, "BTLS");
|
||||
|
||||
VoteScreen.foundLuaVoteFrames = VoteScreen.foundLuaVoteWideFrames = 0;
|
||||
VoteScreen.currentAnimFrame = 0;
|
||||
|
||||
INT32 i = 1;
|
||||
|
||||
// check for lua vote background replacements
|
||||
for (;;)
|
||||
{
|
||||
// Check if the lumps exist (checking for VEXTR(N|W)xx for race and VEXTRB(N|W)xx for battle)
|
||||
boolean normalLumpExists = W_LumpExists(va("%sC%d", VoteScreen.Prefix, i));
|
||||
boolean wideLumpExists = W_LumpExists(va("%sW%d", VoteScreen.Prefix, i));
|
||||
|
||||
if (normalLumpExists || wideLumpExists)
|
||||
{
|
||||
if (normalLumpExists)
|
||||
VoteScreen.foundLuaVoteFrames++;
|
||||
|
||||
if (wideLumpExists)
|
||||
VoteScreen.foundLuaVoteWideFrames++;
|
||||
}
|
||||
else // If we don't find at least frame 1 (e.g VEXTRN1), let's just stop looking
|
||||
break;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
// non lua vote background handling
|
||||
boolean prefbattletype = ((votelevels[0][1] & ~0x80) == GT_MATCH);
|
||||
VoteScreen.widebgpatch = W_CachePatchName((prefbattletype ? "BATTLSCW" : "INTERSCW"), PU_PATCH);
|
||||
VoteScreen.bgpatch = W_CachePatchName((prefbattletype ? "BATTLSCR" : "INTERSCR"), PU_PATCH);
|
||||
}
|
||||
|
||||
//
|
||||
// Y_VoteBackgroundDrawer
|
||||
//
|
||||
// Determines which patch drawer to use for scaling
|
||||
//
|
||||
static void Y_VoteBackgroundDrawer(patch_t *patch)
|
||||
{
|
||||
switch (cv_votebgscaling.value)
|
||||
{
|
||||
@@ -924,57 +907,74 @@ static void Y_DrawVoteBackground(patch_t *patch)
|
||||
}
|
||||
}
|
||||
|
||||
// Y_DrawAnimatedVoteScreenPatch
|
||||
//
|
||||
// Draw animated patch based on frame counter on vote screen
|
||||
// Y_DrawLuaVoteScreenPatch
|
||||
//
|
||||
static void Y_DrawAnimatedVoteScreenPatch(boolean widePatch)
|
||||
// Handles votebackgrounds set by "setVoteBackground"
|
||||
// Aswell as animated patches
|
||||
//
|
||||
static void Y_DrawLuaVoteScreenPatch(boolean widePatch)
|
||||
{
|
||||
INT32 nextframe = 0;
|
||||
patch_t *votebg = NULL;
|
||||
char tempAnimPrefix[7];
|
||||
const INT32 tempFoundAnimVoteFrames = ((widePatch ? foundAnimVoteWideFrames : foundAnimVoteFrames) - 1);
|
||||
char tempPrefix[6];
|
||||
const INT32 tempfoundAnimLuaVoteFrames = ((widePatch ? VoteScreen.foundLuaVoteWideFrames : VoteScreen.foundLuaVoteFrames) - 1);
|
||||
|
||||
strcpy(tempAnimPrefix, (widePatch ? animWidePrefix : animPrefix));
|
||||
strcpy(tempPrefix, va("%s%s", VoteScreen.Prefix, (widePatch ? "W" : "C")));
|
||||
|
||||
// Draw non animated patch
|
||||
if (!tempfoundAnimLuaVoteFrames)
|
||||
{
|
||||
votebg = W_CachePatchName(va("%s1", tempPrefix), PU_PATCH);
|
||||
Y_VoteBackgroundDrawer(votebg);
|
||||
return;
|
||||
}
|
||||
|
||||
// Draw animated patch based on frame counter on vote screen
|
||||
|
||||
// Just in case someone provides LESS widescreen frames than normal frames or vice versa, reset the frame counter to 0
|
||||
if (currentAnimFrame > tempFoundAnimVoteFrames)
|
||||
currentAnimFrame = 0;
|
||||
if (VoteScreen.currentAnimFrame > tempfoundAnimLuaVoteFrames)
|
||||
VoteScreen.currentAnimFrame = 0;
|
||||
|
||||
nextframe = (currentAnimFrame + 1);
|
||||
nextframe = (VoteScreen.currentAnimFrame + 1);
|
||||
|
||||
votebg = W_CachePatchName(va("%s%d", (widePatch ? animWidePrefix : animPrefix), nextframe), PU_PATCH);
|
||||
votebg = W_CachePatchName(va("%s%d", tempPrefix, nextframe), PU_PATCH);
|
||||
|
||||
Y_DrawVoteBackground(votebg);
|
||||
Y_VoteBackgroundDrawer(votebg);
|
||||
|
||||
if (renderisnewtic && (votetic % 2 == 0) && !paused)
|
||||
currentAnimFrame = (nextframe > tempFoundAnimVoteFrames) ? 0 : nextframe;
|
||||
VoteScreen.currentAnimFrame = (nextframe > tempfoundAnimLuaVoteFrames) ? 0 : nextframe;
|
||||
}
|
||||
|
||||
//
|
||||
// Y_DrawVoteScreenPatch
|
||||
//
|
||||
static void Y_DrawVoteScreenPatch(void)
|
||||
{
|
||||
patch_t *votebg = NULL;
|
||||
const boolean widescreen = (vid.width / vid.dupx > 320);
|
||||
|
||||
if (foundAnimVoteWideFrames || foundAnimVoteFrames)
|
||||
if (VoteScreen.foundLuaVoteWideFrames || VoteScreen.foundLuaVoteFrames)
|
||||
{
|
||||
Y_DrawAnimatedVoteScreenPatch((foundAnimVoteWideFrames && widescreen));
|
||||
Y_DrawLuaVoteScreenPatch(((widescreen && VoteScreen.foundLuaVoteWideFrames) || !VoteScreen.foundLuaVoteFrames));
|
||||
return;
|
||||
}
|
||||
|
||||
votebg = bgpatch; // non widescreen patch
|
||||
// non widescreen patch
|
||||
votebg = VoteScreen.bgpatch;
|
||||
|
||||
UINT8 prefgametype = (votelevels[0][1] & ~0x80);
|
||||
const boolean widebgreplaced = (prefgametype == GT_MATCH) ? widebattlereplaced : wideracereplaced;
|
||||
const boolean bgreplaced = (prefgametype == GT_MATCH) ? battlereplaced : racereplaced;
|
||||
const boolean widebgreplaced = (prefgametype == GT_MATCH) ? VoteScreen.replaced.widebattle : VoteScreen.replaced.widerace;
|
||||
const boolean bgreplaced = (prefgametype == GT_MATCH) ? VoteScreen.replaced.battle : VoteScreen.replaced.race;
|
||||
|
||||
// we check a bunch of stuff to always have a "valid" fallback
|
||||
if ((widescreen && (widebgreplaced || !bgreplaced))
|
||||
|| (!widescreen && (widebgreplaced && !bgreplaced)))
|
||||
{
|
||||
votebg = widebgpatch;
|
||||
votebg = VoteScreen.widebgpatch; // widescreen patch
|
||||
}
|
||||
|
||||
Y_DrawVoteBackground(votebg);
|
||||
Y_VoteBackgroundDrawer(votebg);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1037,7 +1037,7 @@ void Y_VoteDrawer(void)
|
||||
if (i == 3)
|
||||
{
|
||||
str = "RANDOM";
|
||||
pic = randomlvl;
|
||||
pic = VoteScreen.randomlvl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1061,7 +1061,7 @@ void Y_VoteDrawer(void)
|
||||
|
||||
if (!splitscreen)
|
||||
{
|
||||
thiscurs = cursor;
|
||||
thiscurs = VoteScreen.cursor[0];
|
||||
p = consoleplayer;
|
||||
color = levelinfo[i].gtc;
|
||||
colormap = NULL;
|
||||
@@ -1071,19 +1071,19 @@ void Y_VoteDrawer(void)
|
||||
switch (j)
|
||||
{
|
||||
case 1:
|
||||
thiscurs = cursor2;
|
||||
thiscurs = VoteScreen.cursor[2];
|
||||
p = displayplayers[1];
|
||||
break;
|
||||
case 2:
|
||||
thiscurs = cursor3;
|
||||
thiscurs = VoteScreen.cursor[3];
|
||||
p = displayplayers[2];
|
||||
break;
|
||||
case 3:
|
||||
thiscurs = cursor4;
|
||||
thiscurs = VoteScreen.cursor[4];
|
||||
p = displayplayers[3];
|
||||
break;
|
||||
default:
|
||||
thiscurs = cursor1;
|
||||
thiscurs = VoteScreen.cursor[1];
|
||||
p = displayplayers[0];
|
||||
break;
|
||||
}
|
||||
@@ -1111,7 +1111,7 @@ void Y_VoteDrawer(void)
|
||||
else
|
||||
{
|
||||
V_DrawFixedPatch((BASEVIDWIDTH-20)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/2, V_FLIP|V_SNAPTORIGHT, pic, 0);
|
||||
V_DrawFixedPatch((BASEVIDWIDTH-60)<<FRACBITS, ((y+25)<<FRACBITS) - (rubyheight<<1), FRACUNIT, V_SNAPTORIGHT, rubyicon, NULL);
|
||||
V_DrawFixedPatch((BASEVIDWIDTH-60)<<FRACBITS, ((y+25)<<FRACBITS) - (rubyheight<<1), FRACUNIT, V_SNAPTORIGHT, VoteScreen.rubyicon, NULL);
|
||||
}
|
||||
|
||||
V_DrawRightAlignedThinString(BASEVIDWIDTH-21, 40+y, V_SNAPTORIGHT|V_6WIDTHSPACE, str);
|
||||
@@ -1135,7 +1135,7 @@ void Y_VoteDrawer(void)
|
||||
else
|
||||
{
|
||||
V_DrawFixedPatch((BASEVIDWIDTH-20)<<FRACBITS, y<<FRACBITS, FRACUNIT/4, V_FLIP|V_SNAPTORIGHT, pic, 0);
|
||||
V_DrawFixedPatch((BASEVIDWIDTH-40)<<FRACBITS, (y<<FRACBITS) + (25<<(FRACBITS-1)) - rubyheight, FRACUNIT/2, V_SNAPTORIGHT, rubyicon, NULL);
|
||||
V_DrawFixedPatch((BASEVIDWIDTH-40)<<FRACBITS, (y<<FRACBITS) + (25<<(FRACBITS-1)) - rubyheight, FRACUNIT/2, V_SNAPTORIGHT, VoteScreen.rubyicon, NULL);
|
||||
}
|
||||
|
||||
if (levelinfo[i].gts)
|
||||
@@ -1164,13 +1164,13 @@ void Y_VoteDrawer(void)
|
||||
patch_t *pic;
|
||||
|
||||
if (votes[i] >= 3 && (i != pickedvote || voteendtic == -1))
|
||||
pic = randomlvl;
|
||||
pic = VoteScreen.randomlvl;
|
||||
else
|
||||
pic = levelinfo[votes[i]].pic;
|
||||
|
||||
if (!timer && i == voteclient.ranim)
|
||||
{
|
||||
V_DrawScaledPatch(x-18, y+9, V_SNAPTOLEFT, cursor);
|
||||
V_DrawScaledPatch(x-18, y+9, V_SNAPTOLEFT, VoteScreen.cursor[0]);
|
||||
if (voteendtic != -1 && !(votetic % 4))
|
||||
V_DrawFill(x-1, y-1, 42, 27, 120|V_SNAPTOLEFT);
|
||||
else
|
||||
@@ -1182,7 +1182,7 @@ void Y_VoteDrawer(void)
|
||||
else
|
||||
{
|
||||
V_DrawFixedPatch((x+40)<<FRACBITS, (y)<<FRACBITS, FRACUNIT/4, V_SNAPTOLEFT|V_FLIP, pic, 0);
|
||||
V_DrawFixedPatch((x+20)<<FRACBITS, (y<<FRACBITS) + (25<<(FRACBITS-1)) - rubyheight, FRACUNIT/2, V_SNAPTOLEFT, rubyicon, NULL);
|
||||
V_DrawFixedPatch((x+20)<<FRACBITS, (y<<FRACBITS) + (25<<(FRACBITS-1)) - rubyheight, FRACUNIT/2, V_SNAPTOLEFT, VoteScreen.rubyicon, NULL);
|
||||
}
|
||||
|
||||
if (levelinfo[votes[i]].gts)
|
||||
@@ -1471,10 +1471,28 @@ void Y_VoteTicker(void)
|
||||
//
|
||||
// MK online style voting screen, appears after intermission
|
||||
//
|
||||
|
||||
static void Y_InitVoteDrawing(void)
|
||||
{
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
// setup the background patches
|
||||
Y_VoteScreenCheck();
|
||||
|
||||
VoteScreen.cursor[0] = W_CachePatchName("M_CURSOR", PU_PATCH);
|
||||
VoteScreen.cursor[1] = W_CachePatchName("P1CURSOR", PU_PATCH);
|
||||
VoteScreen.cursor[2] = W_CachePatchName("P2CURSOR", PU_PATCH);
|
||||
VoteScreen.cursor[3] = W_CachePatchName("P3CURSOR", PU_PATCH);
|
||||
VoteScreen.cursor[4] = W_CachePatchName("P4CURSOR", PU_PATCH);
|
||||
|
||||
VoteScreen.randomlvl = W_CachePatchName("RANDOMLV", PU_PATCH);
|
||||
VoteScreen.rubyicon = W_CachePatchName("RUBYICON", PU_PATCH);
|
||||
}
|
||||
|
||||
void Y_StartVote(void)
|
||||
{
|
||||
INT32 i = 0;
|
||||
UINT8 prefgametype = (votelevels[0][1] & ~0x80);
|
||||
|
||||
votetic = -1;
|
||||
|
||||
@@ -1483,17 +1501,8 @@ void Y_StartVote(void)
|
||||
I_Error("voteendtic is dirty");
|
||||
#endif
|
||||
|
||||
Y_AnimatedVoteScreenCheck();
|
||||
|
||||
widebgpatch = W_CachePatchName(((prefgametype == GT_MATCH) ? "BATTLSCW" : "INTERSCW"), PU_PATCH);
|
||||
bgpatch = W_CachePatchName(((prefgametype == GT_MATCH) ? "BATTLSCR" : "INTERSCR"), PU_PATCH);
|
||||
cursor = W_CachePatchName("M_CURSOR", PU_PATCH);
|
||||
cursor1 = W_CachePatchName("P1CURSOR", PU_PATCH);
|
||||
cursor2 = W_CachePatchName("P2CURSOR", PU_PATCH);
|
||||
cursor3 = W_CachePatchName("P3CURSOR", PU_PATCH);
|
||||
cursor4 = W_CachePatchName("P4CURSOR", PU_PATCH);
|
||||
randomlvl = W_CachePatchName("RANDOMLV", PU_PATCH);
|
||||
rubyicon = W_CachePatchName("RUBYICON", PU_PATCH);
|
||||
// cache vote patches
|
||||
Y_InitVoteDrawing();
|
||||
|
||||
timer = cv_votetime.value*TICRATE;
|
||||
pickedvote = -1;
|
||||
@@ -1559,11 +1568,14 @@ void Y_StartVote(void)
|
||||
levelinfo[i].gts = NULL;
|
||||
|
||||
// set up the pic
|
||||
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votelevels[i][0]+1)));
|
||||
if (lumpnum != LUMPERROR)
|
||||
levelinfo[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH);
|
||||
else
|
||||
levelinfo[i].pic = W_CachePatchName("BLANKLVL", PU_PATCH);
|
||||
if (!dedicated)
|
||||
{
|
||||
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votelevels[i][0]+1)));
|
||||
if (lumpnum != LUMPERROR)
|
||||
levelinfo[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH);
|
||||
else
|
||||
levelinfo[i].pic = W_CachePatchName("BLANKLVL", PU_PATCH);
|
||||
}
|
||||
}
|
||||
|
||||
voteclient.loaded = true;
|
||||
@@ -1588,18 +1600,18 @@ static void Y_UnloadVoteData(void)
|
||||
{
|
||||
voteclient.loaded = false;
|
||||
|
||||
if (rendermode != render_soft)
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
UNLOAD(widebgpatch);
|
||||
UNLOAD(bgpatch);
|
||||
UNLOAD(cursor);
|
||||
UNLOAD(cursor1);
|
||||
UNLOAD(cursor2);
|
||||
UNLOAD(cursor3);
|
||||
UNLOAD(cursor4);
|
||||
UNLOAD(randomlvl);
|
||||
UNLOAD(rubyicon);
|
||||
UNLOAD(VoteScreen.widebgpatch);
|
||||
UNLOAD(VoteScreen.bgpatch);
|
||||
UNLOAD(VoteScreen.cursor[0]);
|
||||
UNLOAD(VoteScreen.cursor[1]);
|
||||
UNLOAD(VoteScreen.cursor[2]);
|
||||
UNLOAD(VoteScreen.cursor[3]);
|
||||
UNLOAD(VoteScreen.cursor[4]);
|
||||
UNLOAD(VoteScreen.randomlvl);
|
||||
UNLOAD(VoteScreen.rubyicon);
|
||||
|
||||
UNLOAD(levelinfo[3].pic);
|
||||
UNLOAD(levelinfo[2].pic);
|
||||
|
||||
+34
-1
@@ -10,7 +10,6 @@
|
||||
/// \brief Tally screens, or "Intermissions" as they were formally called in Doom
|
||||
|
||||
extern boolean usebuffer;
|
||||
extern char *luaVoteScreen;
|
||||
|
||||
void Y_IntermissionDrawer(void);
|
||||
void Y_Ticker(void);
|
||||
@@ -55,3 +54,37 @@ typedef enum
|
||||
int_classicrace, // Competition
|
||||
} intertype_t;
|
||||
extern intertype_t intertype;
|
||||
|
||||
// Votescreen stuff
|
||||
typedef struct
|
||||
{
|
||||
boolean race; // non lua race patch replaced
|
||||
boolean widerace; // non lua widescreen race patch replaced
|
||||
boolean battle; // non lua battle patch replaced
|
||||
boolean widebattle; // non lua widescreen battle patch replaced
|
||||
} votereplace_t;
|
||||
|
||||
// VEXTRN - Vote (V) Extra (EXT) Race (R) Normal (N - Normal sized patch)
|
||||
// VEXTRW - Vote (V) Extra (EXT) Race (R) Normal (W - Wide patch)
|
||||
// VEXTBN - Vote (V) Extra (EXT) Battle (B) Normal (N - Normal sized patch)
|
||||
// VEXTBW - Vote (V) Extra (EXT) Battle (B) Normal (W - Wide patch)
|
||||
typedef struct
|
||||
{
|
||||
char Prefix[5]; // Race = INTSX, Battle = BTLSX
|
||||
char luaPrefix[5]; // prefix for lua votescreens
|
||||
|
||||
INT32 currentAnimFrame; // current animated background frame
|
||||
|
||||
INT32 foundLuaVoteFrames; // normal lua patch frames
|
||||
INT32 foundLuaVoteWideFrames; // widescreen lua patch frames
|
||||
|
||||
votereplace_t replaced; // checks which non lua patch has been replaced
|
||||
|
||||
patch_t *bgpatch; // votebackground patch
|
||||
patch_t *widebgpatch; // wide votebackground patch
|
||||
|
||||
patch_t *cursor[5]; // cursor patches
|
||||
patch_t *randomlvl; // randomlevel patch
|
||||
patch_t *rubyicon; // encore ruby patch
|
||||
} votescreen_t;
|
||||
extern votescreen_t VoteScreen;
|
||||
Reference in new issue
Block a user