Add enums for level entrances

This commit is contained in:
Anders Jenbo 2020-10-26 01:39:06 +01:00
commit 6580222d1c
9 changed files with 46 additions and 35 deletions

View file

@ -1830,7 +1830,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir)
IncProgress();
InitAutomap();
if (leveltype != DTYPE_TOWN && lvldir != 4) {
if (leveltype != DTYPE_TOWN && lvldir != ENTRY_LOAD) {
InitLighting();
InitVision();
}
@ -1854,9 +1854,9 @@ void LoadGameLevel(BOOL firstflag, int lvldir)
IncProgress();
if (lvldir == 3)
if (lvldir == ENTRY_RTNLVL)
GetReturnLvlPos();
if (lvldir == 5)
if (lvldir == ENTRY_WARPLVL)
GetPortalLvlPos();
IncProgress();
@ -1864,7 +1864,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir)
for (i = 0; i < MAX_PLRS; i++) {
if (plr[i].plractive && currlevel == plr[i].plrlevel) {
InitPlayerGFX(i);
if (lvldir != 4)
if (lvldir != ENTRY_LOAD)
InitPlayer(i, firstflag);
}
}
@ -1882,7 +1882,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir)
SetRndSeed(glSeedTbl[currlevel]);
if (leveltype != DTYPE_TOWN) {
if (firstflag || lvldir == 4 || !plr[myplr]._pLvlVisited[currlevel] || gbMaxPlayers != 1) {
if (firstflag || lvldir == ENTRY_LOAD || !plr[myplr]._pLvlVisited[currlevel] || gbMaxPlayers != 1) {
HoldThemeRooms();
glMid1Seed[currlevel] = GetRndSeed();
InitMonsters();
@ -1922,7 +1922,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir)
InitMissiles();
IncProgress();
if (!firstflag && lvldir != 4 && plr[myplr]._pLvlVisited[currlevel] && gbMaxPlayers == 1)
if (!firstflag && lvldir != ENTRY_LOAD && plr[myplr]._pLvlVisited[currlevel] && gbMaxPlayers == 1)
LoadLevel();
if (gbMaxPlayers != 1)
DeltaLoadLevel();
@ -1946,13 +1946,13 @@ void LoadGameLevel(BOOL firstflag, int lvldir)
FillSolidBlockTbls();
IncProgress();
if (lvldir == 5)
if (lvldir == ENTRY_WARPLVL)
GetPortalLvlPos();
for (i = 0; i < MAX_PLRS; i++) {
if (plr[i].plractive && currlevel == plr[i].plrlevel) {
InitPlayerGFX(i);
if (lvldir != 4)
if (lvldir != ENTRY_LOAD)
InitPlayer(i, firstflag);
}
}
@ -1960,7 +1960,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir)
InitMultiView();
IncProgress();
if (firstflag || lvldir == 4 || !plr[myplr]._pSLvlVisited[setlvlnum]) {
if (firstflag || lvldir == ENTRY_LOAD || !plr[myplr]._pSLvlVisited[setlvlnum]) {
InitItems();
SavePreLighting();
} else {

View file

@ -2620,7 +2620,7 @@ static void DRLG_L5(int entry)
doneflag = TRUE;
if (QuestStatus(Q_PWATER)) {
if (entry == 0) {
if (entry == ENTRY_MAIN) {
if (DRLG_PlaceMiniSet(PWATERIN, 1, 1, 0, 0, TRUE, -1, 0) < 0)
doneflag = FALSE;
} else {
@ -2630,13 +2630,13 @@ static void DRLG_L5(int entry)
}
}
if (QuestStatus(Q_LTBANNER)) {
if (entry == 0) {
if (entry == ENTRY_MAIN) {
if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, TRUE, -1, 0) < 0)
doneflag = FALSE;
} else {
if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, FALSE, -1, 0) < 0)
doneflag = FALSE;
if (entry == 1) {
if (entry == ENTRY_PREV) {
ViewX = 2 * setpc_x + 20;
ViewY = 2 * setpc_y + 28;
} else {
@ -2725,7 +2725,7 @@ static void DRLG_L5(int entry)
}
}
#else
} else if (entry == 0) {
} else if (entry == ENTRY_MAIN) {
if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, TRUE, -1, 0) < 0)
doneflag = FALSE;
else if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, FALSE, -1, 1) < 0)

View file

@ -3169,7 +3169,7 @@ static void DRLG_L2(int entry)
}
DRLG_L2FloodTVal();
DRLG_L2TransFix();
if (entry == 0) {
if (entry == ENTRY_MAIN) {
doneflag = DRLG_L2PlaceMiniSet(USTAIRS, 1, 1, -1, -1, TRUE, 0);
if (doneflag) {
doneflag = DRLG_L2PlaceMiniSet(DSTAIRS, 1, 1, -1, -1, FALSE, 1);
@ -3178,7 +3178,7 @@ static void DRLG_L2(int entry)
}
}
ViewY -= 2;
} else if (entry == 1) {
} else if (entry == ENTRY_PREV) {
doneflag = DRLG_L2PlaceMiniSet(USTAIRS, 1, 1, -1, -1, FALSE, 0);
if (doneflag) {
doneflag = DRLG_L2PlaceMiniSet(DSTAIRS, 1, 1, -1, -1, TRUE, 1);

View file

@ -2352,7 +2352,7 @@ static void DRLG_L3(int entry)
}
} while (!found);
DRLG_L3MakeMegas();
if (entry == 0) {
if (entry == ENTRY_MAIN) {
#ifdef HELLFIRE
if (currlevel < 17) {
#endif
@ -2380,7 +2380,7 @@ static void DRLG_L3(int entry)
genok = DRLG_L3PlaceMiniSet(L3HOLDWARP, 1, 1, -1, -1, FALSE, 6);
}
}
} else if (entry == 1) {
} else if (entry == ENTRY_PREV) {
#ifdef HELLFIRE
if (currlevel < 17) {
#endif

View file

@ -1615,13 +1615,13 @@ static void DRLG_L4(int entry)
DRLG_LoadDiabQuads(TRUE);
}
if (QuestStatus(Q_WARLORD)) {
if (entry == 0) {
if (entry == ENTRY_MAIN) {
doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, TRUE, 0);
if (doneflag && currlevel == 13) {
doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, FALSE, 6);
}
ViewX++;
} else if (entry == 1) {
} else if (entry == ENTRY_PREV) {
doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, FALSE, 0);
if (doneflag && currlevel == 13) {
doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, FALSE, 6);
@ -1636,7 +1636,7 @@ static void DRLG_L4(int entry)
ViewX++;
}
} else if (currlevel != 15) {
if (entry == 0) {
if (entry == ENTRY_MAIN) {
doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, TRUE, 0);
if (doneflag && currlevel != 16) {
doneflag = DRLG_L4PlaceMiniSet(L4DSTAIRS, 1, 1, -1, -1, FALSE, 1);
@ -1645,7 +1645,7 @@ static void DRLG_L4(int entry)
doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, FALSE, 6);
}
ViewX++;
} else if (entry == 1) {
} else if (entry == ENTRY_PREV) {
doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, FALSE, 0);
if (doneflag && currlevel != 16) {
doneflag = DRLG_L4PlaceMiniSet(L4DSTAIRS, 1, 1, -1, -1, TRUE, 1);
@ -1665,7 +1665,7 @@ static void DRLG_L4(int entry)
ViewX++;
}
} else {
if (entry == 0) {
if (entry == ENTRY_MAIN) {
doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, TRUE, 0);
if (doneflag) {
if (gbMaxPlayers == 1 && quests[Q_DIABLO]._qactive != QUEST_ACTIVE) {

View file

@ -101,7 +101,7 @@ void ShowProgress(unsigned int uMsg)
FreeGameMem();
IncProgress();
pfile_remove_temp_files();
LoadGameLevel(TRUE, 0);
LoadGameLevel(TRUE, ENTRY_MAIN);
IncProgress();
break;
case WM_DIABNEXTLVL:
@ -116,7 +116,7 @@ void ShowProgress(unsigned int uMsg)
leveltype = gnLevelTypeTbl[currlevel];
assert(plr[myplr].plrlevel == currlevel);
IncProgress();
LoadGameLevel(FALSE, 0);
LoadGameLevel(FALSE, ENTRY_MAIN);
IncProgress();
break;
case WM_DIABPREVLVL:
@ -132,7 +132,7 @@ void ShowProgress(unsigned int uMsg)
leveltype = gnLevelTypeTbl[currlevel];
assert(plr[myplr].plrlevel == currlevel);
IncProgress();
LoadGameLevel(FALSE, 1);
LoadGameLevel(FALSE, ENTRY_PREV);
IncProgress();
break;
case WM_DIABSETLVL:
@ -146,7 +146,7 @@ void ShowProgress(unsigned int uMsg)
leveltype = setlvltype;
FreeGameMem();
IncProgress();
LoadGameLevel(FALSE, 2);
LoadGameLevel(FALSE, ENTRY_SETLVL);
IncProgress();
break;
case WM_DIABRTNLVL:
@ -159,7 +159,7 @@ void ShowProgress(unsigned int uMsg)
FreeGameMem();
IncProgress();
GetReturnLvlPos();
LoadGameLevel(FALSE, 3);
LoadGameLevel(FALSE, ENTRY_RTNLVL);
IncProgress();
break;
case WM_DIABWARPLVL:
@ -172,7 +172,7 @@ void ShowProgress(unsigned int uMsg)
FreeGameMem();
GetPortalLevel();
IncProgress();
LoadGameLevel(FALSE, 5);
LoadGameLevel(FALSE, ENTRY_WARPLVL);
IncProgress();
break;
case WM_DIABTOWNWARP:
@ -187,7 +187,7 @@ void ShowProgress(unsigned int uMsg)
leveltype = gnLevelTypeTbl[currlevel];
assert(plr[myplr].plrlevel == currlevel);
IncProgress();
LoadGameLevel(FALSE, 6);
LoadGameLevel(FALSE, ENTRY_TWARPDN);
IncProgress();
break;
case WM_DIABTWARPUP:
@ -202,7 +202,7 @@ void ShowProgress(unsigned int uMsg)
leveltype = gnLevelTypeTbl[currlevel];
assert(plr[myplr].plrlevel == currlevel);
IncProgress();
LoadGameLevel(FALSE, 7);
LoadGameLevel(FALSE, ENTRY_TWARPUP);
IncProgress();
break;
case WM_DIABRETOWN:
@ -217,7 +217,7 @@ void ShowProgress(unsigned int uMsg)
leveltype = gnLevelTypeTbl[currlevel];
assert(plr[myplr].plrlevel == currlevel);
IncProgress();
LoadGameLevel(FALSE, 0);
LoadGameLevel(FALSE, ENTRY_MAIN);
IncProgress();
break;
}

View file

@ -62,7 +62,7 @@ void LoadGame(BOOL firstflag)
for (i = 0; i < MAXPORTAL; i++)
LoadPortal(i);
LoadGameLevel(firstflag, 4);
LoadGameLevel(firstflag, ENTRY_LOAD);
SyncInitPlr(myplr);
SyncPlrAnim(myplr);

View file

@ -1829,13 +1829,13 @@ void CreateTown(int entry)
dmaxx = 84;
dmaxy = 84;
if (entry == 0) {
if (entry == ENTRY_MAIN) { // New game
ViewX = 75;
ViewY = 68;
} else if (entry == 1) {
} else if (entry == ENTRY_PREV) { // Cathedral
ViewX = 25;
ViewY = 31;
} else if (entry == 7) {
} else if (entry == ENTRY_TWARPUP) {
if (TWarpFrom == 5) {
ViewX = 49;
ViewY = 22;

11
enums.h
View file

@ -2570,6 +2570,17 @@ typedef enum interface_mode {
// WM_DIAVNEWLVL = 0x40D, // psx only
} interface_mode;
typedef enum lvl_entry {
ENTRY_MAIN = 0,
ENTRY_PREV = 1,
ENTRY_SETLVL = 2,
ENTRY_RTNLVL = 3,
ENTRY_LOAD = 4,
ENTRY_WARPLVL = 5,
ENTRY_TWARPDN = 6,
ENTRY_TWARPUP = 7,
} lvl_entry;
typedef enum game_info {
GAMEINFO_NAME = 1,
GAMEINFO_PASSWORD = 2,