mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-21 11:21:47 +00:00
welp
This commit is contained in:
parent
aa7fab06fc
commit
116ef8065f
5 changed files with 45 additions and 34 deletions
|
@ -176,6 +176,7 @@ extern UINT32 totalrings; // Total # of rings in a level
|
|||
|
||||
// Fun extra stuff
|
||||
extern INT16 lastmap; // Last level you were at (returning from special stages).
|
||||
extern INT16 votelevels[4]; // srb2kart
|
||||
extern mobj_t *redflag, *blueflag; // Pointers to physical flags
|
||||
extern mapthing_t *rflagpoint, *bflagpoint; // Pointers to the flag spawn locations
|
||||
#define GF_REDFLAG 1
|
||||
|
|
28
src/g_game.c
28
src/g_game.c
|
@ -120,6 +120,7 @@ tic_t gametic;
|
|||
tic_t levelstarttic; // gametic at level start
|
||||
UINT32 totalrings; // for intermission
|
||||
INT16 lastmap; // last level you were at (returning from special stages)
|
||||
INT16 votelevels[4]; // srb2kart
|
||||
tic_t timeinmap; // Ticker for time spent in level (used for levelcard display)
|
||||
|
||||
INT16 spstage_start;
|
||||
|
@ -3088,7 +3089,7 @@ INT16 G_TOLFlag(INT32 pgametype)
|
|||
* has those flags.
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
*/
|
||||
INT16 RandMap(INT16 tolflags, INT16 pprevmap)
|
||||
static INT16 RandMap(INT16 tolflags, INT16 pprevmap)
|
||||
{
|
||||
INT16 *okmaps = Z_Malloc(NUMMAPS * sizeof(INT16), PU_STATIC, NULL);
|
||||
INT32 numokmaps = 0;
|
||||
|
@ -3105,7 +3106,7 @@ INT16 RandMap(INT16 tolflags, INT16 pprevmap)
|
|||
if (numokmaps == 0)
|
||||
ix = 0; // Sorry, none match. You get MAP01.
|
||||
else
|
||||
ix = okmaps[M_RandomKey(numokmaps)];
|
||||
ix = okmaps[P_RandomKey(numokmaps)];
|
||||
|
||||
Z_Free(okmaps);
|
||||
|
||||
|
@ -3238,6 +3239,28 @@ static void G_DoCompleted(void)
|
|||
nextmap = prevmap;
|
||||
else if (cv_advancemap.value == 2) // Go to random map.
|
||||
nextmap = RandMap(G_TOLFlag(gametype), prevmap);
|
||||
else if (cv_advancemap.value == 3)
|
||||
{
|
||||
INT32 j;
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
INT32 k;
|
||||
votelevels[j] = RandMap(G_TOLFlag(gametype), prevmap);
|
||||
for (k = 0; k < 4; k++) // Compare with others to make sure you don't roll multiple :V
|
||||
{
|
||||
INT32 loopcount = 0;
|
||||
if (j == k)
|
||||
continue;
|
||||
while (votelevels[j] == votelevels[k] && loopcount < 4) // If this needs more than 4 loops, I think it's safe to assume it's not finding anything :VVV
|
||||
{
|
||||
votelevels[j] = RandMap(G_TOLFlag(gametype), prevmap);
|
||||
loopcount++;
|
||||
}
|
||||
}
|
||||
if (votelevels[j] < NUMMAPS && !mapheaderinfo[votelevels[j]])
|
||||
P_AllocMapHeader(votelevels[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We are committed to this map now.
|
||||
|
@ -3937,6 +3960,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
|
|||
// Clear a bunch of variables
|
||||
tokenlist = token = sstimer = redscore = bluescore = lastmap = 0;
|
||||
countdown = countdown2 = 0;
|
||||
votelevels[0] = votelevels[1] = votelevels[2] = votelevels[3] = 0;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
|
|
|
@ -219,6 +219,5 @@ FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics);
|
|||
|
||||
// Don't split up TOL handling
|
||||
INT16 G_TOLFlag(INT32 pgametype);
|
||||
INT16 RandMap(INT16 tolflags, INT16 pprevmap);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3202,6 +3202,9 @@ static void P_NetArchiveMisc(void)
|
|||
WRITEUINT32(save_p, totalrings);
|
||||
WRITEINT16(save_p, lastmap);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
WRITEINT16(save_p, votelevels[i]);
|
||||
|
||||
WRITEUINT16(save_p, emeralds);
|
||||
WRITEUINT8(save_p, stagefailed);
|
||||
|
||||
|
@ -3285,6 +3288,9 @@ static inline boolean P_NetUnArchiveMisc(void)
|
|||
totalrings = READUINT32(save_p);
|
||||
lastmap = READINT16(save_p);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
votelevels[i] = READINT16(save_p);
|
||||
|
||||
emeralds = READUINT16(save_p);
|
||||
stagefailed = READUINT8(save_p);
|
||||
|
||||
|
|
|
@ -172,7 +172,6 @@ typedef struct
|
|||
{
|
||||
char str[40];
|
||||
patch_t *pic;
|
||||
UINT16 num;
|
||||
} y_votelvlinfo_t;
|
||||
|
||||
typedef struct
|
||||
|
@ -2293,14 +2292,14 @@ void Y_VoteTicker(void)
|
|||
if (votedata.playerinfo[i].voted)
|
||||
continue;
|
||||
|
||||
if (votedata.timeleft <= 0 && !votedata.playerinfo[i].voted)
|
||||
/*if (votedata.timeleft <= 0 && !votedata.playerinfo[i].voted)
|
||||
{
|
||||
votedata.votes[votedata.numvotes].level = 3; // too slow? you pick random
|
||||
votedata.votes[votedata.numvotes].playernum = i;
|
||||
votedata.playerinfo[i].voted = true;
|
||||
votedata.numvotes++;
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (votedata.playerinfo[i].delay > 0)
|
||||
{
|
||||
|
@ -2348,7 +2347,7 @@ void Y_VoteTicker(void)
|
|||
if (votedata.timeleft == 0 && voteendtic == -1)
|
||||
{
|
||||
votedata.pickedvote = P_RandomKey(votedata.numvotes);
|
||||
nextmap = (votedata.levels[votedata.votes[votedata.pickedvote].level].num); // oh my god
|
||||
nextmap = (votelevels[votedata.votes[votedata.pickedvote].level]); // oh my god
|
||||
S_StartSound(NULL, sfx_ncitem);
|
||||
voteendtic = votetic+(3*TICRATE);
|
||||
}
|
||||
|
@ -2393,59 +2392,41 @@ void Y_StartVote(void)
|
|||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
INT32 j;
|
||||
lumpnum_t lumpnum;
|
||||
|
||||
votedata.levels[i].num = RandMap(G_TOLFlag(gametype), prevmap);
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
INT32 loopcount = 0;
|
||||
if (i == j)
|
||||
continue;
|
||||
while (votedata.levels[i].num == votedata.levels[j].num && loopcount < 5)
|
||||
{
|
||||
votedata.levels[i].num = RandMap(G_TOLFlag(gametype), prevmap);
|
||||
loopcount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mapheaderinfo[votedata.levels[i].num])
|
||||
P_AllocMapHeader(votedata.levels[i].num);
|
||||
|
||||
// set up the str
|
||||
if (mapheaderinfo[votedata.levels[i].num]->zonttl)
|
||||
if (mapheaderinfo[votelevels[i]]->zonttl)
|
||||
{
|
||||
if (mapheaderinfo[votedata.levels[i].num]->actnum)
|
||||
if (mapheaderinfo[votelevels[i]]->actnum)
|
||||
snprintf(votedata.levels[i].str,
|
||||
sizeof votedata.levels[i].str,
|
||||
"%.32s %.32s %d",
|
||||
mapheaderinfo[votedata.levels[i].num]->lvlttl, mapheaderinfo[votedata.levels[i].num]->zonttl, mapheaderinfo[votedata.levels[i].num]->actnum);
|
||||
mapheaderinfo[votelevels[i]]->lvlttl, mapheaderinfo[votelevels[i]]->zonttl, mapheaderinfo[votelevels[i]]->actnum);
|
||||
else
|
||||
snprintf(votedata.levels[i].str,
|
||||
sizeof votedata.levels[i].str,
|
||||
"%.32s %.32s",
|
||||
mapheaderinfo[votedata.levels[i].num]->lvlttl, mapheaderinfo[votedata.levels[i].num]->zonttl);
|
||||
mapheaderinfo[votelevels[i]]->lvlttl, mapheaderinfo[votelevels[i]]->zonttl);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mapheaderinfo[votedata.levels[i].num]->actnum)
|
||||
if (mapheaderinfo[votelevels[i]]->actnum)
|
||||
snprintf(votedata.levels[i].str,
|
||||
sizeof votedata.levels[i].str,
|
||||
"%.32s %d",
|
||||
mapheaderinfo[votedata.levels[i].num]->lvlttl, mapheaderinfo[votedata.levels[i].num]->actnum);
|
||||
mapheaderinfo[votelevels[i]]->lvlttl, mapheaderinfo[votelevels[i]]->actnum);
|
||||
else
|
||||
snprintf(votedata.levels[i].str,
|
||||
sizeof votedata.levels[i].str,
|
||||
"%.32s",
|
||||
mapheaderinfo[votedata.levels[i].num]->lvlttl);
|
||||
mapheaderinfo[votelevels[i]]->lvlttl);
|
||||
}
|
||||
|
||||
votedata.levels[i].str[sizeof votedata.levels[i].str - 1] = '\0';
|
||||
|
||||
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votedata.levels[i].num+1)));
|
||||
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votelevels[i]+1)));
|
||||
if (lumpnum != LUMPERROR)
|
||||
votedata.levels[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votedata.levels[i].num+1)), PU_STATIC);
|
||||
votedata.levels[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i]+1)), PU_STATIC);
|
||||
else
|
||||
votedata.levels[i].pic = W_CachePatchName("BLANKLVL", PU_STATIC);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue