mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-22 20:01:14 +00:00
Added "Random" to the level selection list, for those days when you know you *want* to race but don't have any idea what to do.
This commit is contained in:
parent
1156da88c2
commit
485cb3f308
3 changed files with 69 additions and 34 deletions
|
@ -1482,14 +1482,12 @@ void CV_AddValue(consvar_t *var, INT32 increment)
|
||||||
{
|
{
|
||||||
if(increment > 0) // Going up!
|
if(increment > 0) // Going up!
|
||||||
{
|
{
|
||||||
newvalue++;
|
if (++newvalue == NUMMAPS)
|
||||||
if (newvalue == NUMMAPS)
|
newvalue = -1;
|
||||||
newvalue = 0;
|
|
||||||
}
|
}
|
||||||
else // Going down!
|
else // Going down!
|
||||||
{
|
{
|
||||||
newvalue--;
|
if (--newvalue == -2)
|
||||||
if (newvalue == -1)
|
|
||||||
newvalue = NUMMAPS-1;
|
newvalue = NUMMAPS-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
src/g_game.c
16
src/g_game.c
|
@ -765,9 +765,20 @@ const char *G_BuildMapName(INT32 map)
|
||||||
{
|
{
|
||||||
static char mapname[10] = "MAPXX"; // internal map name (wad resource name)
|
static char mapname[10] = "MAPXX"; // internal map name (wad resource name)
|
||||||
|
|
||||||
I_Assert(map > 0);
|
I_Assert(map >= 0);
|
||||||
I_Assert(map <= NUMMAPS);
|
I_Assert(map <= NUMMAPS);
|
||||||
|
|
||||||
|
if (map == 0) // hack???
|
||||||
|
{
|
||||||
|
if (gamestate == GS_TITLESCREEN)
|
||||||
|
map = -1;
|
||||||
|
else if (gamestate == GS_LEVEL)
|
||||||
|
map = gamemap;
|
||||||
|
else
|
||||||
|
map = prevmap;
|
||||||
|
map = G_RandMap(G_TOLFlag(cv_newgametype.value), map, false, false, 0, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (map < 100)
|
if (map < 100)
|
||||||
sprintf(&mapname[3], "%.2d", map);
|
sprintf(&mapname[3], "%.2d", map);
|
||||||
else
|
else
|
||||||
|
@ -4260,6 +4271,9 @@ char *G_BuildMapTitle(INT32 mapnum)
|
||||||
{
|
{
|
||||||
char *title = NULL;
|
char *title = NULL;
|
||||||
|
|
||||||
|
if (mapnum == 0)
|
||||||
|
return Z_StrDup("Random");
|
||||||
|
|
||||||
if (strcmp(mapheaderinfo[mapnum-1]->lvlttl, ""))
|
if (strcmp(mapheaderinfo[mapnum-1]->lvlttl, ""))
|
||||||
{
|
{
|
||||||
size_t len = 1;
|
size_t len = 1;
|
||||||
|
|
55
src/m_menu.c
55
src/m_menu.c
|
@ -383,7 +383,7 @@ static void Dummystaff_OnChange(void);
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
static CV_PossibleValue_t map_cons_t[] = {
|
static CV_PossibleValue_t map_cons_t[] = {
|
||||||
{1,"MIN"},
|
{0,"MIN"},
|
||||||
{NUMMAPS, "MAX"},
|
{NUMMAPS, "MAX"},
|
||||||
{0, NULL}
|
{0, NULL}
|
||||||
};
|
};
|
||||||
|
@ -2147,7 +2147,7 @@ static void Dummystaff_OnChange(void)
|
||||||
// Newgametype. Used for gametype changes.
|
// Newgametype. Used for gametype changes.
|
||||||
static void Newgametype_OnChange(void)
|
static void Newgametype_OnChange(void)
|
||||||
{
|
{
|
||||||
if (menuactive)
|
if (cv_nextmap.value && menuactive)
|
||||||
{
|
{
|
||||||
if (!mapheaderinfo[cv_nextmap.value-1])
|
if (!mapheaderinfo[cv_nextmap.value-1])
|
||||||
P_AllocMapHeader((INT16)(cv_nextmap.value-1));
|
P_AllocMapHeader((INT16)(cv_nextmap.value-1));
|
||||||
|
@ -3852,6 +3852,10 @@ static void M_PrepareLevelSelect(void)
|
||||||
//
|
//
|
||||||
boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt)
|
boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt)
|
||||||
{
|
{
|
||||||
|
// Random map!
|
||||||
|
if (mapnum == -1)
|
||||||
|
return (gamestate != GS_TIMEATTACK && !modeattacking);
|
||||||
|
|
||||||
// Does the map exist?
|
// Does the map exist?
|
||||||
if (!mapheaderinfo[mapnum])
|
if (!mapheaderinfo[mapnum])
|
||||||
return false;
|
return false;
|
||||||
|
@ -5874,11 +5878,16 @@ static void M_TimeAttack(INT32 choice)
|
||||||
|
|
||||||
M_PrepareLevelSelect();
|
M_PrepareLevelSelect();
|
||||||
M_SetupNextMenu(&SP_TimeAttackDef);
|
M_SetupNextMenu(&SP_TimeAttackDef);
|
||||||
|
|
||||||
|
G_SetGamestate(GS_TIMEATTACK);
|
||||||
|
|
||||||
|
if (cv_nextmap.value)
|
||||||
Nextmap_OnChange();
|
Nextmap_OnChange();
|
||||||
|
else
|
||||||
|
CV_AddValue(&cv_nextmap, 1);
|
||||||
|
|
||||||
itemOn = tastart; // "Start" is selected.
|
itemOn = tastart; // "Start" is selected.
|
||||||
|
|
||||||
G_SetGamestate(GS_TIMEATTACK);
|
|
||||||
S_ChangeMusicInternal("racent", true);
|
S_ChangeMusicInternal("racent", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6689,7 +6698,10 @@ static INT32 M_FindFirstMap(INT32 gtype)
|
||||||
|
|
||||||
for (i = 0; i < NUMMAPS; i++)
|
for (i = 0; i < NUMMAPS; i++)
|
||||||
{
|
{
|
||||||
if (mapheaderinfo[i] && (mapheaderinfo[i]->typeoflevel & gtype))
|
if (!mapheaderinfo[i])
|
||||||
|
continue;
|
||||||
|
if (!(mapheaderinfo[i]->typeoflevel & gtype))
|
||||||
|
continue;
|
||||||
return i + 1;
|
return i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6722,6 +6734,9 @@ static void M_StartServer(INT32 choice)
|
||||||
if (metalrecording)
|
if (metalrecording)
|
||||||
G_StopMetalDemo();
|
G_StopMetalDemo();
|
||||||
|
|
||||||
|
if (!cv_nextmap.value)
|
||||||
|
CV_SetValue(&cv_nextmap, G_RandMap(G_TOLFlag(cv_newgametype.value), -1, false, false, 0, false));
|
||||||
|
|
||||||
if (ssplayers < 1)
|
if (ssplayers < 1)
|
||||||
{
|
{
|
||||||
D_MapChange(cv_nextmap.value, cv_newgametype.value, (boolean)cv_kartencore.value, 1, 1, false, false);
|
D_MapChange(cv_nextmap.value, cv_newgametype.value, (boolean)cv_kartencore.value, 1, 1, false, false);
|
||||||
|
@ -6749,16 +6764,18 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
||||||
lumpnum_t lumpnum;
|
lumpnum_t lumpnum;
|
||||||
patch_t *PictureOfLevel;
|
patch_t *PictureOfLevel;
|
||||||
INT32 x, y, w, i, oldval, trans, dupadjust = ((vid.width/vid.dupx) - BASEVIDWIDTH)>>1;
|
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);
|
|
||||||
|
|
||||||
// A 160x100 image of the level as entry MAPxxP
|
// A 160x100 image of the level as entry MAPxxP
|
||||||
lumpnum = W_CheckNumForName(va("%sP", mapname));
|
if (cv_nextmap.value)
|
||||||
|
{
|
||||||
|
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(cv_nextmap.value)));
|
||||||
if (lumpnum != LUMPERROR)
|
if (lumpnum != LUMPERROR)
|
||||||
PictureOfLevel = W_CachePatchNum(lumpnum, PU_CACHE);
|
PictureOfLevel = W_CachePatchNum(lumpnum, PU_CACHE);
|
||||||
else
|
else
|
||||||
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE);
|
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
PictureOfLevel = W_CachePatchName("RANDOMLV", PU_CACHE);
|
||||||
|
|
||||||
w = SHORT(PictureOfLevel->width)/2;
|
w = SHORT(PictureOfLevel->width)/2;
|
||||||
i = SHORT(PictureOfLevel->height)/2;
|
i = SHORT(PictureOfLevel->height)/2;
|
||||||
|
@ -6803,7 +6820,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
i--;
|
i--;
|
||||||
if (i == -1)
|
if (i == -2)
|
||||||
i = NUMMAPS-1;
|
i = NUMMAPS-1;
|
||||||
|
|
||||||
if (i == oldval)
|
if (i == oldval)
|
||||||
|
@ -6815,13 +6832,16 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
||||||
} while (!M_CanShowLevelInList(i, cv_newgametype.value));
|
} while (!M_CanShowLevelInList(i, cv_newgametype.value));
|
||||||
|
|
||||||
// A 160x100 image of the level as entry MAPxxP
|
// A 160x100 image of the level as entry MAPxxP
|
||||||
mapname = G_BuildMapName(i+1);
|
if (i+1)
|
||||||
lumpnum = W_CheckNumForName(va("%sP", mapname));
|
{
|
||||||
|
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(i+1)));
|
||||||
if (lumpnum != LUMPERROR)
|
if (lumpnum != LUMPERROR)
|
||||||
PictureOfLevel = W_CachePatchNum(lumpnum, PU_CACHE);
|
PictureOfLevel = W_CachePatchNum(lumpnum, PU_CACHE);
|
||||||
else
|
else
|
||||||
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE);
|
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
PictureOfLevel = W_CachePatchName("RANDOMLV", PU_CACHE);
|
||||||
|
|
||||||
x -= horizspac + w/2;
|
x -= horizspac + w/2;
|
||||||
|
|
||||||
|
@ -6839,7 +6859,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
if (i == NUMMAPS)
|
if (i == NUMMAPS)
|
||||||
i = 0;
|
i = -1;
|
||||||
|
|
||||||
if (i == oldval)
|
if (i == oldval)
|
||||||
return;
|
return;
|
||||||
|
@ -6850,13 +6870,16 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
||||||
} while (!M_CanShowLevelInList(i, cv_newgametype.value));
|
} while (!M_CanShowLevelInList(i, cv_newgametype.value));
|
||||||
|
|
||||||
// A 160x100 image of the level as entry MAPxxP
|
// A 160x100 image of the level as entry MAPxxP
|
||||||
mapname = G_BuildMapName(i+1);
|
if (i+1)
|
||||||
lumpnum = W_CheckNumForName(va("%sP", mapname));
|
{
|
||||||
|
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(i+1)));
|
||||||
if (lumpnum != LUMPERROR)
|
if (lumpnum != LUMPERROR)
|
||||||
PictureOfLevel = W_CachePatchNum(lumpnum, PU_CACHE);
|
PictureOfLevel = W_CachePatchNum(lumpnum, PU_CACHE);
|
||||||
else
|
else
|
||||||
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE);
|
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
PictureOfLevel = W_CachePatchName("RANDOMLV", PU_CACHE);
|
||||||
|
|
||||||
V_DrawTinyScaledPatch(x, y, trans, PictureOfLevel);
|
V_DrawTinyScaledPatch(x, y, trans, PictureOfLevel);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue