mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 07:22:28 +00:00
Merge branch 'nonightsbot2' into 'master'
Properly fix bot showing up in NiGHTS stages (resolves #261 for real). Closes #261 See merge request STJr/SRB2Internal!417
This commit is contained in:
commit
b04452f7de
2 changed files with 98 additions and 94 deletions
|
@ -1646,7 +1646,31 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pultmode, boolean rese
|
|||
// The supplied data are assumed to be good.
|
||||
I_Assert(delay >= 0 && delay <= 2);
|
||||
if (mapnum != -1)
|
||||
{
|
||||
CV_SetValue(&cv_nextmap, mapnum);
|
||||
// Kick bot from special stages
|
||||
if (botskin)
|
||||
{
|
||||
if (G_IsSpecialStage(mapnum) || (mapheaderinfo[mapnum-1] && (mapheaderinfo[mapnum-1]->typeoflevel & TOL_NIGHTS)))
|
||||
{
|
||||
if (botingame)
|
||||
{
|
||||
//CL_RemoveSplitscreenPlayer();
|
||||
botingame = false;
|
||||
playeringame[1] = false;
|
||||
}
|
||||
}
|
||||
else if (!botingame)
|
||||
{
|
||||
//CL_AddSplitscreenPlayer();
|
||||
botingame = true;
|
||||
secondarydisplayplayer = 1;
|
||||
playeringame[1] = true;
|
||||
players[1].bot = 1;
|
||||
SendNameAndColor2();
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
if ((netgame || multiplayer) && !((gametype == newgametype) && (newgametype == GT_COOP)))
|
||||
|
@ -1689,29 +1713,6 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pultmode, boolean rese
|
|||
return;
|
||||
}
|
||||
|
||||
// Kick bot from special stages
|
||||
if (botskin)
|
||||
{
|
||||
if (G_IsSpecialStage(mapnum) || (mapheaderinfo[mapnum-1] && (mapheaderinfo[mapnum-1]->typeoflevel & TOL_NIGHTS)))
|
||||
{
|
||||
if (botingame)
|
||||
{
|
||||
//CL_RemoveSplitscreenPlayer();
|
||||
botingame = false;
|
||||
playeringame[1] = false;
|
||||
}
|
||||
}
|
||||
else if (!botingame)
|
||||
{
|
||||
//CL_AddSplitscreenPlayer();
|
||||
botingame = true;
|
||||
secondarydisplayplayer = 1;
|
||||
playeringame[1] = true;
|
||||
players[1].bot = 1;
|
||||
SendNameAndColor2();
|
||||
}
|
||||
}
|
||||
|
||||
chmappending++;
|
||||
if (netgame)
|
||||
WRITEUINT32(buf_p, M_RandomizedSeed()); // random seed
|
||||
|
|
145
src/m_menu.c
145
src/m_menu.c
|
@ -6560,7 +6560,7 @@ static void M_LevelSelectWarp(INT32 choice)
|
|||
|
||||
if (W_CheckNumForName(G_BuildMapName(cv_nextmap.value)) == LUMPERROR)
|
||||
{
|
||||
// CONS_Alert(CONS_WARNING, "Internal game map '%s' not found\n", G_BuildMapName(cv_nextmap.value));
|
||||
CONS_Alert(CONS_WARNING, "Internal game map '%s' not found\n", G_BuildMapName(cv_nextmap.value));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -7977,81 +7977,80 @@ static void M_SetupChoosePlayer(INT32 choice)
|
|||
char *and;
|
||||
(void)choice;
|
||||
|
||||
SP_PlayerMenu[0].status &= ~IT_DYBIGSPACE; // Correcting a hack that may be made below.
|
||||
|
||||
for (i = 0; i < 32; i++) // Handle charsels, availability, and unlocks.
|
||||
if (!(mapheaderinfo[startmap-1]
|
||||
&& (mapheaderinfo[startmap-1]->forcecharacter[0] != '\0'
|
||||
|| (mapheaderinfo[startmap-1]->typeoflevel & TOL_NIGHTS)) // remove this later when everyone gets their own nights sprites, maybe
|
||||
))
|
||||
{
|
||||
if (description[i].used) // If the character's disabled through SOC, there's nothing we can do for it.
|
||||
for (i = 0; i < 32; i++) // Handle charsels, availability, and unlocks.
|
||||
{
|
||||
and = strchr(description[i].skinname, '&');
|
||||
if (and)
|
||||
if (description[i].used) // If the character's disabled through SOC, there's nothing we can do for it.
|
||||
{
|
||||
char firstskin[SKINNAMESIZE+1];
|
||||
strncpy(firstskin, description[i].skinname, (and - description[i].skinname));
|
||||
firstskin[(and - description[i].skinname)] = '\0';
|
||||
description[i].skinnum[0] = R_SkinAvailable(firstskin);
|
||||
description[i].skinnum[1] = R_SkinAvailable(and+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
description[i].skinnum[0] = R_SkinAvailable(description[i].skinname);
|
||||
description[i].skinnum[1] = -1;
|
||||
}
|
||||
skinnum = description[i].skinnum[0];
|
||||
if ((skinnum != -1) && (R_SkinUsable(-1, skinnum)))
|
||||
{
|
||||
// Handling order.
|
||||
if (firstvalid == 255)
|
||||
firstvalid = i;
|
||||
and = strchr(description[i].skinname, '&');
|
||||
if (and)
|
||||
{
|
||||
char firstskin[SKINNAMESIZE+1];
|
||||
strncpy(firstskin, description[i].skinname, (and - description[i].skinname));
|
||||
firstskin[(and - description[i].skinname)] = '\0';
|
||||
description[i].skinnum[0] = R_SkinAvailable(firstskin);
|
||||
description[i].skinnum[1] = R_SkinAvailable(and+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
description[i].prev = lastvalid;
|
||||
description[lastvalid].next = i;
|
||||
description[i].skinnum[0] = R_SkinAvailable(description[i].skinname);
|
||||
description[i].skinnum[1] = -1;
|
||||
}
|
||||
lastvalid = i;
|
||||
|
||||
if (i == char_on)
|
||||
allowed = true;
|
||||
|
||||
if (!(description[i].picname[0]))
|
||||
skinnum = description[i].skinnum[0];
|
||||
if ((skinnum != -1) && (R_SkinUsable(-1, skinnum)))
|
||||
{
|
||||
if (skins[skinnum].sprites[SPR2_XTRA].numframes >= XTRA_CHARSEL+1)
|
||||
// Handling order.
|
||||
if (firstvalid == 255)
|
||||
firstvalid = i;
|
||||
else
|
||||
{
|
||||
spritedef_t *sprdef = &skins[skinnum].sprites[SPR2_XTRA];
|
||||
spriteframe_t *sprframe = &sprdef->spriteframes[XTRA_CHARSEL];
|
||||
description[i].charpic = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
|
||||
description[i].prev = lastvalid;
|
||||
description[lastvalid].next = i;
|
||||
}
|
||||
lastvalid = i;
|
||||
|
||||
if (i == char_on)
|
||||
allowed = true;
|
||||
|
||||
if (!(description[i].picname[0]))
|
||||
{
|
||||
if (skins[skinnum].sprites[SPR2_XTRA].numframes >= XTRA_CHARSEL+1)
|
||||
{
|
||||
spritedef_t *sprdef = &skins[skinnum].sprites[SPR2_XTRA];
|
||||
spriteframe_t *sprframe = &sprdef->spriteframes[XTRA_CHARSEL];
|
||||
description[i].charpic = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
|
||||
}
|
||||
else
|
||||
description[i].charpic = W_CachePatchName("MISSING", PU_CACHE);
|
||||
}
|
||||
else
|
||||
description[i].charpic = W_CachePatchName("MISSING", PU_CACHE);
|
||||
}
|
||||
else
|
||||
description[i].charpic = W_CachePatchName(description[i].picname, PU_CACHE);
|
||||
description[i].charpic = W_CachePatchName(description[i].picname, PU_CACHE);
|
||||
|
||||
if (description[i].nametag[0])
|
||||
{
|
||||
const char *nametag = description[i].nametag;
|
||||
description[i].namepic = NULL;
|
||||
if (W_LumpExists(nametag))
|
||||
description[i].namepic = W_CachePatchName(nametag, PU_CACHE);
|
||||
if (description[i].nametag[0])
|
||||
{
|
||||
const char *nametag = description[i].nametag;
|
||||
description[i].namepic = NULL;
|
||||
if (W_LumpExists(nametag))
|
||||
description[i].namepic = W_CachePatchName(nametag, PU_CACHE);
|
||||
}
|
||||
}
|
||||
// else -- Technically, character select icons without corresponding skins get bundled away behind this too. Sucks to be them.
|
||||
}
|
||||
// else -- Technically, character select icons without corresponding skins get bundled away behind this too. Sucks to be them.
|
||||
}
|
||||
}
|
||||
|
||||
if ((firstvalid != 255)
|
||||
&& !(mapheaderinfo[startmap-1]
|
||||
&& (mapheaderinfo[startmap-1]->forcecharacter[0] != '\0')
|
||||
)
|
||||
)
|
||||
if (firstvalid != 255)
|
||||
{ // One last bit of order we can't do in the iteration above.
|
||||
description[firstvalid].prev = lastvalid;
|
||||
description[lastvalid].next = firstvalid;
|
||||
}
|
||||
else // We're being forced into a specific character, so might as well.
|
||||
else // We're being forced into a specific character, so might as well just skip it.
|
||||
{
|
||||
SP_PlayerMenu[0].status |= IT_DYBIGSPACE; // This is a dummy flag hack to make a non-IT_CALL character in slot 0 not softlock the game.
|
||||
M_ChoosePlayer(0);
|
||||
M_ChoosePlayer(-1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -8378,38 +8377,42 @@ static void M_DrawSetupChoosePlayerMenu(void)
|
|||
static void M_ChoosePlayer(INT32 choice)
|
||||
{
|
||||
boolean ultmode = (ultimate_selectable && SP_PlayerDef.prevMenu == &SP_LoadDef && saveSlotSelected == NOSAVESLOT);
|
||||
UINT8 skinnum;
|
||||
|
||||
// skip this if forcecharacter or no characters available
|
||||
if (!(SP_PlayerMenu[0].status & IT_DYBIGSPACE))
|
||||
if (choice == -1)
|
||||
{
|
||||
skinnum = botskin = 0;
|
||||
botingame = false;
|
||||
}
|
||||
// M_SetupChoosePlayer didn't call us directly, that means we've been properly set up.
|
||||
else
|
||||
{
|
||||
// M_SetupChoosePlayer didn't call us directly, that means we've been properly set up.
|
||||
char_scroll = 0; // finish scrolling the menu
|
||||
M_DrawSetupChoosePlayerMenu(); // draw the finally selected character one last time for the fadeout
|
||||
// Is this a hack?
|
||||
charseltimer = 0;
|
||||
}
|
||||
M_ClearMenus(true);
|
||||
|
||||
if (description[choice].skinnum[1] != -1) {
|
||||
// this character has a second skin
|
||||
botingame = true;
|
||||
botskin = (UINT8)(description[choice].skinnum[1]+1);
|
||||
botcolor = skins[description[choice].skinnum[1]].prefcolor;
|
||||
}
|
||||
else
|
||||
{
|
||||
botingame = false;
|
||||
botskin = 0;
|
||||
botcolor = 0;
|
||||
skinnum = description[choice].skinnum[0];
|
||||
|
||||
if ((botingame = (description[choice].skinnum[1] != -1))) {
|
||||
// this character has a second skin
|
||||
botskin = (UINT8)(description[choice].skinnum[1]+1);
|
||||
botcolor = skins[description[choice].skinnum[1]].prefcolor;
|
||||
}
|
||||
else
|
||||
botskin = botcolor = 0;
|
||||
}
|
||||
|
||||
M_ClearMenus(true);
|
||||
|
||||
if (startmap != spstage_start)
|
||||
cursaveslot = 0;
|
||||
|
||||
//lastmapsaved = 0;
|
||||
gamecomplete = false;
|
||||
|
||||
G_DeferedInitNew(ultmode, G_BuildMapName(startmap), (UINT8)description[choice].skinnum[0], false, fromlevelselect);
|
||||
G_DeferedInitNew(ultmode, G_BuildMapName(startmap), skinnum, false, fromlevelselect);
|
||||
COM_BufAddText("dummyconsvar 1\n"); // G_DeferedInitNew doesn't do this
|
||||
|
||||
if (levelselect.rows)
|
||||
|
|
Loading…
Reference in a new issue