mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-28 01:40:41 +00:00
- reworked the main loop.
This commit is contained in:
parent
7889605ff4
commit
5c7b613aa7
19 changed files with 176 additions and 442 deletions
|
@ -47,24 +47,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_PS_NS
|
BEGIN_PS_NS
|
||||||
|
|
||||||
int SyncScreenJob()
|
int selectedlevelnew;
|
||||||
{
|
|
||||||
while (gamestate == GS_INTERMISSION || gamestate == GS_INTRO)
|
|
||||||
{
|
|
||||||
UpdateSounds();
|
|
||||||
HandleAsync();
|
|
||||||
updatePauseStatus();
|
|
||||||
D_ProcessEvents();
|
|
||||||
ControlInfo info;
|
|
||||||
CONTROL_GetInput(&info);
|
|
||||||
C_RunDelayedCommands();
|
|
||||||
|
|
||||||
RunScreenJobFrame(); // This handles continuation through its completion callback.
|
|
||||||
videoNextPage();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
@ -628,8 +611,6 @@ void DoTitle(CompletionFunc completion)
|
||||||
0, {{1, 20, 10}, {1, 20, 10}, {1, 20, 10}}
|
0, {{1, 20, 10}, {1, 20, 10}, {1, 20, 10}}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int gLevelNew; // this is needed to get the chosen level out of the map screen class
|
|
||||||
|
|
||||||
class DMapScreen : public DScreenJob
|
class DMapScreen : public DScreenJob
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -770,7 +751,7 @@ public:
|
||||||
|
|
||||||
nIdleSeconds = 0;
|
nIdleSeconds = 0;
|
||||||
}
|
}
|
||||||
gLevelNew = nLevelNew;
|
selectedlevelnew = nLevelNew + 1;
|
||||||
return skiprequest? -1 : nIdleSeconds < 12? 1 : 0;
|
return skiprequest? -1 : nIdleSeconds < 12? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -826,11 +807,10 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest, std::function<void(int)> completion)
|
void menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest, TArray<JobDesc> &jobs)
|
||||||
{
|
{
|
||||||
if (nLevel > kMap20 || nLevelNew > kMap20) // max single player levels
|
if (nLevel > kMap20 || nLevelNew > kMap20) // max single player levels
|
||||||
{
|
{
|
||||||
completion(-1);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nLevelBest = kMap20;
|
nLevelBest = kMap20;
|
||||||
|
@ -838,14 +818,8 @@ public:
|
||||||
if (nLevel < 1) nLevel = 1;
|
if (nLevel < 1) nLevel = 1;
|
||||||
if (nLevelNew < 1) nLevelNew = nLevel;
|
if (nLevelNew < 1) nLevelNew = nLevel;
|
||||||
|
|
||||||
auto mycompletion = [=](bool)
|
// 0-offset the level numbers
|
||||||
{
|
jobs.Push( { Create<DMapScreen>(nLevel-1, nLevelNew-1, nLevelBest-1) });
|
||||||
completion(gLevelNew+1);
|
|
||||||
};
|
|
||||||
// 0-offset the level numbers
|
|
||||||
gLevelNew = nLevelNew;
|
|
||||||
JobDesc job = { Create<DMapScreen>(nLevel-1, nLevelNew-1, nLevelBest-1) };
|
|
||||||
RunScreenJob(&job, 1, mycompletion);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -937,8 +911,6 @@ static const char * const cinpalfname[] = {
|
||||||
"terror.pal"
|
"terror.pal"
|
||||||
};
|
};
|
||||||
|
|
||||||
extern short nCinemaSeen[30];
|
|
||||||
|
|
||||||
void uploadCinemaPalettes()
|
void uploadCinemaPalettes()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < countof(cinpalfname); i++)
|
for (int i = 0; i < countof(cinpalfname); i++)
|
||||||
|
@ -965,9 +937,10 @@ class DCinema : public DScreenJob
|
||||||
short cinematile;
|
short cinematile;
|
||||||
int currentCinemaPalette;
|
int currentCinemaPalette;
|
||||||
int edx;
|
int edx;
|
||||||
|
int check;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DCinema(int nVal) : DScreenJob(fadein|fadeout)
|
DCinema(int nVal, int checklevel = -1) : DScreenJob(fadein|fadeout)
|
||||||
{
|
{
|
||||||
static const short cinematiles[] = { 3454, 3452, 3449, 3445, 3451, 3448, 3446};
|
static const short cinematiles[] = { 3454, 3452, 3449, 3445, 3451, 3448, 3446};
|
||||||
static const int8_t bxvals[] = { 4, 0, 2, 7, 3, 8, 6 };
|
static const int8_t bxvals[] = { 4, 0, 2, 7, 3, 8, 6 };
|
||||||
|
@ -979,6 +952,7 @@ public:
|
||||||
edx = dxvals[nVal - 1];
|
edx = dxvals[nVal - 1];
|
||||||
text.Start(0);
|
text.Start(0);
|
||||||
text.ReadyCinemaText(bxvals[nVal - 1]);
|
text.ReadyCinemaText(bxvals[nVal - 1]);
|
||||||
|
check = checklevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Frame(uint64_t clock, bool skiprequest) override
|
int Frame(uint64_t clock, bool skiprequest) override
|
||||||
|
@ -986,6 +960,7 @@ public:
|
||||||
|
|
||||||
if (clock == 0)
|
if (clock == 0)
|
||||||
{
|
{
|
||||||
|
if (check > 0 && check != selectedlevelnew) return 0; // immediately abort if the player selected a different level on the map
|
||||||
StopAllSounds();
|
StopAllSounds();
|
||||||
if (edx != -1)
|
if (edx != -1)
|
||||||
{
|
{
|
||||||
|
@ -1280,15 +1255,43 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// player died
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void DoGameOverScene(bool finallevel)
|
||||||
// temporary.
|
|
||||||
void RunCinemaScene(int num)
|
|
||||||
{
|
{
|
||||||
JobDesc job = { num == -1? (DScreenJob*)Create<DExCredits>() : Create<DCinema>(num) };
|
JobDesc job;
|
||||||
RunScreenJob(&job, 1, [](bool) { gamestate = GS_LEVEL; });
|
|
||||||
SyncScreenJob();
|
if (finallevel)
|
||||||
|
{
|
||||||
|
playCDtrack(9, false);
|
||||||
|
//FadeToWhite();
|
||||||
|
job = { Create<DCinema>(4) };
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StopCD();
|
||||||
|
PlayGameOverSound();
|
||||||
|
job = { Create<DImageScreen>(tileGetTexture(kTile3591), DScreenJob::fadein | DScreenJob::fadeout, 0x7fffffff) };
|
||||||
|
}
|
||||||
|
RunScreenJob(&job, 1, [](bool) { gamestate = GS_STARTUP; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DoAfterCinemaScene(int nLevel, TArray<JobDesc>& jobs)
|
||||||
|
{
|
||||||
|
static const uint8_t nAfterScene[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 7, 0, 0, 0, 0, 6 };
|
||||||
|
if (nAfterScene[nLevel]) jobs.Push({ Create<DCinema>(nAfterScene[nLevel]) });
|
||||||
|
if (nLevel == 20) jobs.Push({ Create<DExCredits>() });
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoBeforeCinemaScene(int nLevel, TArray<JobDesc>& jobs)
|
||||||
|
{
|
||||||
|
if (nLevel == 5) jobs.Push({ Create<DCinema>(3) });
|
||||||
|
else if (nLevel == 11) jobs.Push({ Create<DCinema>(1, 11) });
|
||||||
|
}
|
||||||
|
|
||||||
END_PS_NS
|
END_PS_NS
|
||||||
|
|
|
@ -219,7 +219,7 @@ void DoBubbleMachines()
|
||||||
void BuildBubbleMachine(int nSprite)
|
void BuildBubbleMachine(int nSprite)
|
||||||
{
|
{
|
||||||
if (nMachineCount >= kMaxMachines) {
|
if (nMachineCount >= kMaxMachines) {
|
||||||
I_Error("too many bubble machines in level %d\n", levelnew);
|
I_Error("too many bubble machines in level %d\n", levelnum);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,42 +36,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_PS_NS
|
BEGIN_PS_NS
|
||||||
|
|
||||||
int handle1;
|
|
||||||
|
|
||||||
|
|
||||||
int MenuExitCondition;
|
|
||||||
|
|
||||||
int menu_Menu(int nVal)
|
|
||||||
{
|
|
||||||
MenuExitCondition = -2;
|
|
||||||
M_StartControlPanel(false);
|
|
||||||
M_SetMenu(NAME_Mainmenu);
|
|
||||||
while (M_Active())
|
|
||||||
{
|
|
||||||
auto nLogoTile = EXHUMED ? kExhumedLogo : kPowerslaveLogo;
|
|
||||||
int dword_9AB5F = ((int)totalclock / 16) & 3;
|
|
||||||
|
|
||||||
twod->ClearScreen();
|
|
||||||
|
|
||||||
DrawRel(kSkullHead, 160, 100, 32);
|
|
||||||
DrawRel(kSkullJaw, 161, 130, 32);
|
|
||||||
DrawRel(nLogoTile, 160, 40, 32);
|
|
||||||
|
|
||||||
// draw the fire urn/lamp thingies
|
|
||||||
DrawRel(kTile3512 + dword_9AB5F, 50, 150, 32);
|
|
||||||
DrawRel(kTile3512 + ((dword_9AB5F + 2) & 3), 270, 150, 32);
|
|
||||||
|
|
||||||
HandleAsync();
|
|
||||||
D_ProcessEvents();
|
|
||||||
videoNextPage();
|
|
||||||
|
|
||||||
}
|
|
||||||
int me = MenuExitCondition;
|
|
||||||
MenuExitCondition = -2;
|
|
||||||
return me;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Implements the native looking menu used for the main menu
|
// Implements the native looking menu used for the main menu
|
||||||
|
@ -187,7 +151,7 @@ void GameInterface::MenuClosed()
|
||||||
|
|
||||||
void GameInterface::StartGame(FNewGameStartup& gs)
|
void GameInterface::StartGame(FNewGameStartup& gs)
|
||||||
{
|
{
|
||||||
MenuExitCondition = gs.Episode; // Gross hack. The main loop needs to be redone for better handling.
|
GameAction = gs.Episode; // 0 is training, 1 is the regular game
|
||||||
}
|
}
|
||||||
|
|
||||||
FSavegameInfo GameInterface::GetSaveSig()
|
FSavegameInfo GameInterface::GetSaveSig()
|
||||||
|
|
|
@ -95,7 +95,6 @@ int LoadPaletteLookups();
|
||||||
void SetGreenPal();
|
void SetGreenPal();
|
||||||
void RestoreGreenPal();
|
void RestoreGreenPal();
|
||||||
void FixPalette();
|
void FixPalette();
|
||||||
void FadeToWhite();
|
|
||||||
int HavePLURemap();
|
int HavePLURemap();
|
||||||
uint8_t RemapPLU(uint8_t pal);
|
uint8_t RemapPLU(uint8_t pal);
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ int32_t registerosdcommands(void);
|
||||||
void InitFonts();
|
void InitFonts();
|
||||||
|
|
||||||
int htimer = 0;
|
int htimer = 0;
|
||||||
bool EndLevel = false;
|
int EndLevel = false;
|
||||||
|
|
||||||
|
|
||||||
PlayerInput localInput;
|
PlayerInput localInput;
|
||||||
|
@ -112,7 +112,6 @@ void EraseScreen(int nVal);
|
||||||
void LoadStatus();
|
void LoadStatus();
|
||||||
void MySetView(int x1, int y1, int x2, int y2);
|
void MySetView(int x1, int y1, int x2, int y2);
|
||||||
void mysetbrightness(char al);
|
void mysetbrightness(char al);
|
||||||
void FadeIn();
|
|
||||||
|
|
||||||
char sHollyStr[40];
|
char sHollyStr[40];
|
||||||
|
|
||||||
|
@ -127,7 +126,6 @@ short nFreeze;
|
||||||
short nSnakeCam = -1;
|
short nSnakeCam = -1;
|
||||||
|
|
||||||
short nLocalSpr;
|
short nLocalSpr;
|
||||||
short levelnew = 1;
|
|
||||||
|
|
||||||
int nNetPlayerCount = 0;
|
int nNetPlayerCount = 0;
|
||||||
|
|
||||||
|
@ -146,7 +144,6 @@ short nEnergyTowers = 0;
|
||||||
|
|
||||||
short nCfgNetPlayers = 0;
|
short nCfgNetPlayers = 0;
|
||||||
FILE *vcrfp = NULL;
|
FILE *vcrfp = NULL;
|
||||||
short forcelevel = -1;
|
|
||||||
|
|
||||||
int lLocalButtons = 0;
|
int lLocalButtons = 0;
|
||||||
int lLocalCodes = 0;
|
int lLocalCodes = 0;
|
||||||
|
@ -234,10 +231,8 @@ void timerhandler()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int MenuExitCondition;
|
|
||||||
void HandleAsync()
|
void HandleAsync()
|
||||||
{
|
{
|
||||||
MenuExitCondition = -2;
|
|
||||||
handleevents();
|
handleevents();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -388,15 +383,6 @@ void DoRedAlert(int nVal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LockEnergyTiles()
|
|
||||||
{
|
|
||||||
// old loadtilelockmode = 1;
|
|
||||||
tileLoad(kTile3603);
|
|
||||||
tileLoad(kEnergy1);
|
|
||||||
tileLoad(kEnergy2);
|
|
||||||
// old loadtilelockmode = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawClock()
|
void DrawClock()
|
||||||
{
|
{
|
||||||
int ebp = 49;
|
int ebp = 49;
|
||||||
|
@ -474,13 +460,7 @@ void GameMove(void)
|
||||||
{
|
{
|
||||||
if (lCountDown <= 0)
|
if (lCountDown <= 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nTotalPlayers; i++) {
|
DoGameOverScene(true);
|
||||||
nPlayerLives[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
DoFailedFinalScene();
|
|
||||||
levelnew = 100;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Pink section
|
// Pink section
|
||||||
|
@ -578,11 +558,6 @@ void GameTicker()
|
||||||
if (nPlayerLives[nLocalPlayer] <= 0) {
|
if (nPlayerLives[nLocalPlayer] <= 0) {
|
||||||
startmainmenu();
|
startmainmenu();
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if (!bInDemo && levelnew > nBestLevel && levelnew != 0 && levelnew <= kMap20 && SavePosition > -1) {
|
|
||||||
menu_GameSave(SavePosition);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
bInMove = false;
|
bInMove = false;
|
||||||
|
|
||||||
|
@ -669,7 +644,6 @@ void InitGame()
|
||||||
int i;
|
int i;
|
||||||
//int esi = 1;
|
//int esi = 1;
|
||||||
//int edi = esi;
|
//int edi = esi;
|
||||||
levelnew = 1;
|
|
||||||
|
|
||||||
buttonMap.SetButtons(actions, NUM_ACTIONS);
|
buttonMap.SetButtons(actions, NUM_ACTIONS);
|
||||||
|
|
||||||
|
@ -677,20 +651,17 @@ void InitGame()
|
||||||
// Create the global level table. Parts of the engine need it, even though the game itself does not.
|
// Create the global level table. Parts of the engine need it, even though the game itself does not.
|
||||||
for (int i = 0; i <= 32; i++)
|
for (int i = 0; i <= 32; i++)
|
||||||
{
|
{
|
||||||
auto mi = &mapList[i];
|
auto mi = AllocateMap();
|
||||||
mi->fileName.Format("LEV%d.MAP", i);
|
mi->fileName.Format("LEV%d.MAP", i);
|
||||||
mi->labelName.Format("LEV%d", i);
|
mi->labelName.Format("LEV%d", i);
|
||||||
mi->name.Format("$TXT_EX_MAP%02d", i);
|
mi->name.Format("$TXT_EX_MAP%02d", i);
|
||||||
|
mi->levelNumber = i;
|
||||||
|
|
||||||
int nTrack = i;
|
int nTrack = i;
|
||||||
if (nTrack != 0) nTrack--;
|
if (nTrack != 0) nTrack--;
|
||||||
mi->cdSongId = (nTrack % 8) + 11;
|
mi->cdSongId = (nTrack % 8) + 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nNetPlayerCount && forcelevel == -1) {
|
|
||||||
forcelevel = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetCheats(excheats, countof(excheats));
|
SetCheats(excheats, countof(excheats));
|
||||||
registerosdcommands();
|
registerosdcommands();
|
||||||
|
|
||||||
|
@ -812,7 +783,6 @@ static SavegameHelper sgh("exhumed",
|
||||||
SV(nFreeze),
|
SV(nFreeze),
|
||||||
SV(nSnakeCam),
|
SV(nSnakeCam),
|
||||||
SV(nLocalSpr),
|
SV(nLocalSpr),
|
||||||
SV(levelnew),
|
|
||||||
SV(nClockVal), // kTile3603
|
SV(nClockVal), // kTile3603
|
||||||
SV(nRedTicks),
|
SV(nRedTicks),
|
||||||
SV(nAlarmTicks),
|
SV(nAlarmTicks),
|
||||||
|
|
|
@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "tarray.h"
|
#include "tarray.h"
|
||||||
#include "zstring.h"
|
#include "zstring.h"
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
|
#include "screenjob.h"
|
||||||
|
|
||||||
BEGIN_PS_NS
|
BEGIN_PS_NS
|
||||||
|
|
||||||
|
@ -110,14 +111,15 @@ void ShutDown(void);
|
||||||
void DebugOut(const char *fmt, ...);
|
void DebugOut(const char *fmt, ...);
|
||||||
int ExhumedMain(int argc, char *argv[]);
|
int ExhumedMain(int argc, char *argv[]);
|
||||||
|
|
||||||
void FinishLevel();
|
|
||||||
void ResetEngine();
|
void ResetEngine();
|
||||||
|
|
||||||
void SetHiRes();
|
void SetHiRes();
|
||||||
|
|
||||||
void BlackOut();
|
void BlackOut();
|
||||||
|
|
||||||
void DoGameOverScene();
|
void DoGameOverScene(bool finallevel);
|
||||||
|
void DoAfterCinemaScene(int nLevel, TArray<JobDesc> &jobs);
|
||||||
|
void DoBeforeCinemaScene(int nLevel, TArray<JobDesc>& jobs);
|
||||||
|
|
||||||
int Query(short n, short l, ...);
|
int Query(short n, short l, ...);
|
||||||
|
|
||||||
|
@ -129,11 +131,6 @@ void TintPalette(int a, int b, int c);
|
||||||
|
|
||||||
void EraseScreen(int eax);
|
void EraseScreen(int eax);
|
||||||
|
|
||||||
void RestorePalette();
|
|
||||||
|
|
||||||
void FadeIn();
|
|
||||||
void FadeOut(int bFadeMusic);
|
|
||||||
|
|
||||||
void mychangespritesect(int nSprite, int nSector);
|
void mychangespritesect(int nSprite, int nSector);
|
||||||
void mydeletesprite(int nSprite);
|
void mydeletesprite(int nSprite);
|
||||||
|
|
||||||
|
@ -142,7 +139,6 @@ void GrabPalette();
|
||||||
void mysetbrightness(char nBrightness);
|
void mysetbrightness(char nBrightness);
|
||||||
|
|
||||||
void StartFadeIn();
|
void StartFadeIn();
|
||||||
int DoFadeIn();
|
|
||||||
|
|
||||||
void InitSpiritHead();
|
void InitSpiritHead();
|
||||||
|
|
||||||
|
@ -160,11 +156,13 @@ void InitGame();
|
||||||
void InitNewGame();
|
void InitNewGame();
|
||||||
void startmainmenu();
|
void startmainmenu();
|
||||||
|
|
||||||
extern bool EndLevel;
|
extern int EndLevel;
|
||||||
extern int32_t g_commandSetup;
|
extern int32_t g_commandSetup;
|
||||||
extern int32_t g_noSetup;
|
extern int32_t g_noSetup;
|
||||||
|
|
||||||
extern char sHollyStr[];
|
extern char sHollyStr[];
|
||||||
|
extern int selectedlevelnew;
|
||||||
|
extern int GameAction;
|
||||||
|
|
||||||
extern int localclock;
|
extern int localclock;
|
||||||
|
|
||||||
|
@ -200,6 +198,7 @@ extern short nCurBodyNum;
|
||||||
extern short nBodyTotal;
|
extern short nBodyTotal;
|
||||||
|
|
||||||
extern short bSnakeCam;
|
extern short bSnakeCam;
|
||||||
|
extern uint8_t nCinemaSeen;
|
||||||
|
|
||||||
extern short levelnum;
|
extern short levelnum;
|
||||||
//extern short nScreenWidth;
|
//extern short nScreenWidth;
|
||||||
|
@ -216,7 +215,6 @@ extern short lastfps;
|
||||||
extern int flash;
|
extern int flash;
|
||||||
|
|
||||||
extern short nLocalSpr;
|
extern short nLocalSpr;
|
||||||
extern short levelnew;
|
|
||||||
|
|
||||||
extern short nSnakeCam;
|
extern short nSnakeCam;
|
||||||
|
|
||||||
|
|
|
@ -51,24 +51,23 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
BEGIN_PS_NS
|
BEGIN_PS_NS
|
||||||
|
|
||||||
short nBestLevel;
|
short nBestLevel;
|
||||||
int forcelevel = -1;
|
|
||||||
static int32_t nonsharedtimer;
|
static int32_t nonsharedtimer;
|
||||||
|
|
||||||
extern int MenuExitCondition;
|
int GameAction;
|
||||||
|
|
||||||
extern short nCinemaSeen[30];
|
extern uint8_t nCinemaSeen;
|
||||||
extern ClockTicks tclocks;
|
extern ClockTicks tclocks;
|
||||||
|
|
||||||
void RunCinemaScene(int num);
|
void RunCinemaScene(int num);
|
||||||
void GameMove(void);
|
void GameMove(void);
|
||||||
void InitGame();
|
void InitGame();
|
||||||
void LockEnergyTiles();
|
|
||||||
void DrawClock();
|
void DrawClock();
|
||||||
int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk);
|
int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk);
|
||||||
int SyncScreenJob();
|
|
||||||
void DoTitle(CompletionFunc completion);
|
void DoTitle(CompletionFunc completion);
|
||||||
|
|
||||||
void FinishLevel()
|
int levelnew = -1;
|
||||||
|
|
||||||
|
void FinishLevel(TArray<JobDesc> jobs)
|
||||||
{
|
{
|
||||||
if (levelnum > nBestLevel) {
|
if (levelnum > nBestLevel) {
|
||||||
nBestLevel = levelnum - 1;
|
nBestLevel = levelnum - 1;
|
||||||
|
@ -81,135 +80,38 @@ void FinishLevel()
|
||||||
bCamera = false;
|
bCamera = false;
|
||||||
nMapMode = 0;
|
nMapMode = 0;
|
||||||
|
|
||||||
if (levelnum != kMap20)
|
if (levelnum != kMap20 && EndLevel != 2)
|
||||||
{
|
{
|
||||||
EraseScreen(4);
|
// There's really no choice but to enter an active wait loop here to make the sound play out.
|
||||||
PlayLocalSound(StaticSound[59], 0, true, CHANF_UI);
|
PlayLocalSound(StaticSound[59], 0, true, CHANF_UI);
|
||||||
videoNextPage();
|
int nTicks = totalclock + 12;
|
||||||
//WaitTicks(12);
|
while (nTicks > (int)totalclock) { HandleAsync(); }
|
||||||
DrawView(65536);
|
|
||||||
videoNextPage();
|
|
||||||
}
|
}
|
||||||
|
else nPlayerLives[0] = 0;
|
||||||
|
|
||||||
FadeOut(1);
|
DoAfterCinemaScene(levelnum, jobs);
|
||||||
EraseScreen(overscanindex);
|
|
||||||
|
|
||||||
if (levelnum == 0)
|
|
||||||
{
|
|
||||||
nPlayerLives[0] = 0;
|
|
||||||
levelnew = 100;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DoAfterCinemaScene(levelnum);
|
|
||||||
if (levelnum == kMap20)
|
|
||||||
{
|
|
||||||
//DoCredits();
|
|
||||||
nPlayerLives[0] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void showmap(short nLevel, short nLevelNew, short nLevelBest, TArray<JobDesc> jobs)
|
||||||
|
|
||||||
short nBeforeScene[] = { 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
||||||
|
|
||||||
|
|
||||||
void CheckBeforeScene(int nLevel)
|
|
||||||
{
|
{
|
||||||
if (nLevel == kMap20)
|
if (nLevelNew == 5 && !(nCinemaSeen & 1)) {
|
||||||
{
|
nCinemaSeen |= 1;
|
||||||
RunCinemaScene(-1);
|
DoBeforeCinemaScene(5, jobs);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
short nScene = nBeforeScene[nLevel];
|
menu_DrawTheMap(nLevel, nLevelNew, nLevelBest, jobs);
|
||||||
|
|
||||||
if (nScene)
|
if (nLevelNew == 11 && !(nCinemaSeen & 2)) {
|
||||||
{
|
DoBeforeCinemaScene(11, jobs);
|
||||||
if (!nCinemaSeen[nScene])
|
|
||||||
{
|
|
||||||
RunCinemaScene(nScene);
|
|
||||||
nCinemaSeen[nScene] = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SyncScreenJob();
|
|
||||||
|
|
||||||
int showmap(short nLevel, short nLevelNew, short nLevelBest)
|
|
||||||
{
|
|
||||||
FadeOut(0);
|
|
||||||
EraseScreen(overscanindex);
|
|
||||||
GrabPalette();
|
|
||||||
BlackOut();
|
|
||||||
|
|
||||||
if (nLevelNew != 11) {
|
|
||||||
CheckBeforeScene(nLevelNew);
|
|
||||||
}
|
|
||||||
|
|
||||||
int selectedLevel;
|
|
||||||
menu_DrawTheMap(nLevel, nLevelNew, nLevelBest, [&](int lev){
|
|
||||||
gamestate = GS_LEVEL;
|
|
||||||
selectedLevel = lev;
|
|
||||||
if (lev != nLevelNew) STAT_Cancel();
|
|
||||||
});
|
|
||||||
SyncScreenJob();
|
|
||||||
if (selectedLevel == 11) {
|
|
||||||
CheckBeforeScene(selectedLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
return selectedLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DoAfterCinemaScene(int nLevel)
|
|
||||||
{
|
|
||||||
short nAfterScene[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 7, 0, 0, 0, 0, 6 };
|
|
||||||
|
|
||||||
if (nAfterScene[nLevel]) {
|
|
||||||
RunCinemaScene(nAfterScene[nLevel]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DoFailedFinalScene()
|
|
||||||
{
|
|
||||||
videoSetViewableArea(0, 0, xdim - 1, ydim - 1);
|
|
||||||
|
|
||||||
if (CDplaying()) {
|
|
||||||
fadecdaudio();
|
|
||||||
}
|
|
||||||
|
|
||||||
playCDtrack(9, false);
|
|
||||||
FadeToWhite();
|
|
||||||
|
|
||||||
RunCinemaScene(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DoGameOverScene()
|
|
||||||
{
|
|
||||||
FadeOut(0);
|
|
||||||
inputState.ClearAllInput();
|
|
||||||
|
|
||||||
NoClip();
|
|
||||||
overwritesprite(0, 0, kTile3591, 0, 2, kPalNormal, 16);
|
|
||||||
videoNextPage();
|
|
||||||
PlayGameOverSound();
|
|
||||||
//WaitAnyKey(3);
|
|
||||||
FadeOut(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void GameDisplay(void)
|
static void GameDisplay(void)
|
||||||
{
|
{
|
||||||
// End Section B
|
|
||||||
|
|
||||||
SetView1();
|
|
||||||
|
|
||||||
if (levelnum == kMap20)
|
if (levelnum == kMap20)
|
||||||
{
|
{
|
||||||
LockEnergyTiles();
|
|
||||||
DoEnergyTile();
|
DoEnergyTile();
|
||||||
DrawClock();
|
DrawClock();
|
||||||
}
|
}
|
||||||
|
@ -224,12 +126,6 @@ static void GameDisplay(void)
|
||||||
int nStringWidth = SmallFont->StringWidth(tex);
|
int nStringWidth = SmallFont->StringWidth(tex);
|
||||||
DrawText(twod, SmallFont, CR_UNTRANSLATED, 160 - nStringWidth / 2, 100, tex, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, TAG_DONE);
|
DrawText(twod, SmallFont, CR_UNTRANSLATED, 160 - nStringWidth / 2, 100, tex, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, TAG_DONE);
|
||||||
}
|
}
|
||||||
if (M_Active())
|
|
||||||
{
|
|
||||||
D_ProcessEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
videoNextPage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -246,6 +142,12 @@ void startmainmenu()
|
||||||
StopAllSounds();
|
StopAllSounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void drawmenubackground()
|
void drawmenubackground()
|
||||||
{
|
{
|
||||||
auto nLogoTile = EXHUMED ? kExhumedLogo : kPowerslaveLogo;
|
auto nLogoTile = EXHUMED ? kExhumedLogo : kPowerslaveLogo;
|
||||||
|
@ -263,44 +165,90 @@ void drawmenubackground()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void CheckProgression()
|
void CheckProgression()
|
||||||
{
|
{
|
||||||
if (EndLevel)
|
TArray<JobDesc> jobs;
|
||||||
|
bool startlevel = false;
|
||||||
|
int mylevelnew = levelnew;
|
||||||
|
|
||||||
|
levelnew = -1;
|
||||||
|
|
||||||
|
if (GameAction >= 0)
|
||||||
{
|
{
|
||||||
EndLevel = false;
|
if (GameAction < 1000)
|
||||||
FinishLevel();
|
|
||||||
}
|
|
||||||
if (levelnew > -1)
|
|
||||||
{
|
|
||||||
if (levelnew > 99)
|
|
||||||
{
|
{
|
||||||
// end the game (but don't abort like the original game did!)
|
// start a new game on the given level
|
||||||
gamestate = GS_STARTUP;
|
GameAction = -1;
|
||||||
}
|
mylevelnew = GameAction;
|
||||||
else if (levelnew == -2)
|
InitNewGame();
|
||||||
{
|
if (mylevelnew != 0) nBestLevel = mylevelnew - 1;
|
||||||
// A savegame was loaded. Just start the level without any further actions.
|
|
||||||
gamestate = GS_LEVEL;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// start a new game at the given level
|
// A savegame was loaded. Just start the level without any further actions.
|
||||||
if (!nNetPlayerCount && levelnew <= kMap20)
|
GameAction = -1;
|
||||||
{
|
gamestate = GS_LEVEL;
|
||||||
levelnew = showmap(levelnum, levelnew, nBestLevel);
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (levelnew > nBestLevel)
|
|
||||||
{
|
|
||||||
nBestLevel = levelnew;
|
|
||||||
}
|
|
||||||
InitNewGame();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (EndLevel)
|
||||||
|
{
|
||||||
|
if (levelnum == 0) startmainmenu();
|
||||||
|
else FinishLevel(jobs);
|
||||||
|
EndLevel = false;
|
||||||
|
}
|
||||||
|
if (mylevelnew > -1 && mylevelnew < kMap20)
|
||||||
|
{
|
||||||
|
startlevel = true;
|
||||||
|
// start a new game at the given level
|
||||||
|
if (!nNetPlayerCount)
|
||||||
|
{
|
||||||
|
showmap(levelnum, mylevelnew, nBestLevel, jobs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
jobs.Push({ Create<DScreenJob>() }); // we need something in here even in the multiplayer case.
|
||||||
|
}
|
||||||
|
if (jobs.Size() > 0)
|
||||||
|
{
|
||||||
|
selectedlevelnew = mylevelnew;
|
||||||
|
RunScreenJob(jobs.Data(), jobs.Size(), [=](bool)
|
||||||
|
{
|
||||||
|
if (!startlevel) gamestate = GS_STARTUP;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gamestate = GS_LEVEL;
|
||||||
|
|
||||||
|
InitLevel(selectedlevelnew);
|
||||||
|
tclocks = totalclock;
|
||||||
|
#if 0
|
||||||
|
// this would be the place to autosave upon level start
|
||||||
|
if (!bInDemo && selectedlevelnew > nBestLevel && selectedlevelnew != 0 && selectedlevelnew <= kMap20) {
|
||||||
|
menu_GameSave(SavePosition);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (selectedlevelnew > nBestLevel)
|
||||||
|
{
|
||||||
|
nBestLevel = selectedlevelnew;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedlevelnew == 11) nCinemaSeen |= 2;
|
||||||
|
if (mylevelnew != selectedlevelnew) STAT_Cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void GameLoop()
|
void GameLoop()
|
||||||
{
|
{
|
||||||
|
@ -317,7 +265,7 @@ void GameLoop()
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
int app_loop()// GameInterface::app_main()
|
int GameInterface::app_main()
|
||||||
{
|
{
|
||||||
InitGame();
|
InitGame();
|
||||||
gamestate = GS_STARTUP;
|
gamestate = GS_STARTUP;
|
||||||
|
@ -336,6 +284,9 @@ int app_loop()// GameInterface::app_main()
|
||||||
case GS_STARTUP:
|
case GS_STARTUP:
|
||||||
totalclock = 0;
|
totalclock = 0;
|
||||||
ototalclock = 0;
|
ototalclock = 0;
|
||||||
|
levelnew = -1;
|
||||||
|
GameAction = -1;
|
||||||
|
EndLevel = false;
|
||||||
|
|
||||||
if (userConfig.CommandMap.IsNotEmpty())
|
if (userConfig.CommandMap.IsNotEmpty())
|
||||||
{
|
{
|
||||||
|
@ -367,10 +318,13 @@ int app_loop()// GameInterface::app_main()
|
||||||
|
|
||||||
}
|
}
|
||||||
videoNextPage();
|
videoNextPage();
|
||||||
videoSetBrightness(0); // immediately reset this so that the value doesn't stick around in the backend.
|
|
||||||
}
|
}
|
||||||
catch (CRecoverableError& err)
|
catch (CRecoverableError& err)
|
||||||
{
|
{
|
||||||
|
// Clear all progression sensitive variables here.
|
||||||
|
levelnew = -1;
|
||||||
|
GameAction = -1;
|
||||||
|
EndLevel = false;
|
||||||
C_FullConsole();
|
C_FullConsole();
|
||||||
Printf(TEXTCOLOR_RED "%s\n", err.what());
|
Printf(TEXTCOLOR_RED "%s\n", err.what());
|
||||||
}
|
}
|
||||||
|
@ -379,84 +333,6 @@ int app_loop()// GameInterface::app_main()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int GameInterface::app_main()
|
|
||||||
{
|
|
||||||
int nMenu = 0;
|
|
||||||
|
|
||||||
InitGame();
|
|
||||||
if (!userConfig.nologo)
|
|
||||||
{
|
|
||||||
DoTitle([](bool) { gamestate = GS_MENUSCREEN; });
|
|
||||||
SyncScreenJob();
|
|
||||||
gamestate = GS_LEVEL;
|
|
||||||
}
|
|
||||||
// loc_11811:
|
|
||||||
if (forcelevel > -1)
|
|
||||||
{
|
|
||||||
levelnew = forcelevel;
|
|
||||||
goto STARTGAME1;
|
|
||||||
}
|
|
||||||
|
|
||||||
SavePosition = -1;
|
|
||||||
nMenu = menu_Menu(0);
|
|
||||||
switch (nMenu)
|
|
||||||
{
|
|
||||||
case 3:
|
|
||||||
forcelevel = 0;
|
|
||||||
goto STARTGAME2;
|
|
||||||
case 6:
|
|
||||||
goto GAMELOOP;
|
|
||||||
}
|
|
||||||
STARTGAME1:
|
|
||||||
levelnew = 1;
|
|
||||||
levelnum = 1;
|
|
||||||
if (!nNetPlayerCount) {
|
|
||||||
FadeOut(0);
|
|
||||||
}
|
|
||||||
STARTGAME2:
|
|
||||||
|
|
||||||
InitNewGame();
|
|
||||||
|
|
||||||
nBestLevel = levelnew - 1;
|
|
||||||
LOOP1:
|
|
||||||
|
|
||||||
if (!bInDemo && levelnew > nBestLevel && levelnew != 0 && levelnew <= kMap20 && SavePosition > -1) {
|
|
||||||
menu_GameSave(SavePosition);
|
|
||||||
}
|
|
||||||
if (!nNetPlayerCount && levelnew > 0 && levelnew <= kMap20) {
|
|
||||||
levelnew = showmap(levelnum, levelnew, nBestLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (levelnew > nBestLevel) {
|
|
||||||
nBestLevel = levelnew;
|
|
||||||
}
|
|
||||||
InitLevel(levelnew);
|
|
||||||
tclocks = totalclock;
|
|
||||||
levelnew = -1;
|
|
||||||
// Game Loop
|
|
||||||
GAMELOOP:
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
if (levelnew >= 0)
|
|
||||||
{
|
|
||||||
goto LOOP1;
|
|
||||||
}
|
|
||||||
|
|
||||||
HandleAsync();
|
|
||||||
C_RunDelayedCommands();
|
|
||||||
|
|
||||||
updatePauseStatus();
|
|
||||||
GameLoop();
|
|
||||||
GameDisplay();
|
|
||||||
|
|
||||||
if (EndLevel)
|
|
||||||
{
|
|
||||||
EndLevel = false;
|
|
||||||
FinishLevel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
END_PS_NS
|
END_PS_NS
|
||||||
|
|
|
@ -179,6 +179,7 @@ uint8_t LoadLevel(int nMap)
|
||||||
|
|
||||||
void InitLevel(int level)
|
void InitLevel(int level)
|
||||||
{
|
{
|
||||||
|
levelnum = level;
|
||||||
StopCD();
|
StopCD();
|
||||||
if (!LoadLevel(level)) {
|
if (!LoadLevel(level)) {
|
||||||
I_Error("Can't load level %d...\n", level);
|
I_Error("Can't load level %d...\n", level);
|
||||||
|
@ -218,7 +219,7 @@ void InitLevel(int level)
|
||||||
void InitNewGame()
|
void InitNewGame()
|
||||||
{
|
{
|
||||||
bCamera = false;
|
bCamera = false;
|
||||||
ClearCinemaSeen();
|
nCinemaSeen = 0;
|
||||||
PlayerCount = 0;
|
PlayerCount = 0;
|
||||||
|
|
||||||
for (int i = 0; i < nTotalPlayers; i++)
|
for (int i = 0; i < nTotalPlayers; i++)
|
||||||
|
|
|
@ -79,13 +79,11 @@ int LoadPaletteLookups()
|
||||||
|
|
||||||
bGreenPal = 0;
|
bGreenPal = 0;
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
|
||||||
// These 3 tables do not have normal gradients. The others work without adjustment.
|
// These 3 tables do not have normal gradients. The others work without adjustment.
|
||||||
// Other changes than altering the fog gradient are not necessary.
|
// Other changes than altering the fog gradient are not necessary.
|
||||||
lookups.tables[kPalTorch].ShadeFactor = lookups.tables[kPalTorch2].ShadeFactor = (numshades - 2) / 20.f;
|
lookups.tables[kPalTorch].ShadeFactor = lookups.tables[kPalTorch2].ShadeFactor = (numshades - 2) / 20.f;
|
||||||
lookups.tables[kPalNoTorch].ShadeFactor = lookups.tables[kPalNoTorch2].ShadeFactor = (numshades - 2) / 4.f;
|
lookups.tables[kPalNoTorch].ShadeFactor = lookups.tables[kPalNoTorch2].ShadeFactor = (numshades - 2) / 4.f;
|
||||||
lookups.tables[kPalBrite].ShadeFactor = lookups.tables[kPalBrite].ShadeFactor = (numshades - 2) / 128.f;
|
lookups.tables[kPalBrite].ShadeFactor = lookups.tables[kPalBrite].ShadeFactor = (numshades - 2) / 128.f;
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,48 +144,6 @@ void GrabPalette()
|
||||||
videoTintBlood(0, 0, 0);
|
videoTintBlood(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlackOut()
|
|
||||||
{
|
|
||||||
videoTintBlood(0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RestorePalette()
|
|
||||||
{
|
|
||||||
videoTintBlood(0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FadeToWhite()
|
|
||||||
{
|
|
||||||
// fixme
|
|
||||||
videoTintBlood(255, 255, 255);
|
|
||||||
videoNextPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FadeOut(int bFadeMusic)
|
|
||||||
{
|
|
||||||
if (bFadeMusic) StopCD();
|
|
||||||
videoTintBlood(-255, -255, -255);
|
|
||||||
videoNextPage();
|
|
||||||
|
|
||||||
EraseScreen(overscanindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void StartFadeIn()
|
|
||||||
{
|
|
||||||
//fadecurpal = curpal;
|
|
||||||
}
|
|
||||||
|
|
||||||
int DoFadeIn()
|
|
||||||
{
|
|
||||||
videoNextPage();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FadeIn()
|
|
||||||
{
|
|
||||||
videoNextPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FixPalette()
|
void FixPalette()
|
||||||
{
|
{
|
||||||
if (!nPalDiff) {
|
if (!nPalDiff) {
|
||||||
|
|
|
@ -50,12 +50,10 @@ BEGIN_PS_NS
|
||||||
|
|
||||||
GameStat GameStats;
|
GameStat GameStats;
|
||||||
|
|
||||||
short nCinemaSeen[30];
|
uint8_t nCinemaSeen;
|
||||||
|
|
||||||
uint8_t energytile[66 * 66] = {0};
|
uint8_t energytile[66 * 66] = {0};
|
||||||
|
|
||||||
short SavePosition = -1;
|
|
||||||
|
|
||||||
uint8_t *cur;
|
uint8_t *cur;
|
||||||
uint8_t *dest;
|
uint8_t *dest;
|
||||||
|
|
||||||
|
@ -67,11 +65,6 @@ short word_9AB5B = 0;
|
||||||
int keytimer = 0;
|
int keytimer = 0;
|
||||||
|
|
||||||
|
|
||||||
void ClearCinemaSeen()
|
|
||||||
{
|
|
||||||
memset(nCinemaSeen, 0, sizeof(nCinemaSeen));
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int menu_RandomBit2()
|
unsigned int menu_RandomBit2()
|
||||||
{
|
{
|
||||||
unsigned int result = nRandom & 1;
|
unsigned int result = nRandom & 1;
|
||||||
|
@ -300,7 +293,7 @@ void menu_GameSave2(FILE* fp)
|
||||||
{
|
{
|
||||||
memset(&GameStats, 0, sizeof(GameStats));
|
memset(&GameStats, 0, sizeof(GameStats));
|
||||||
|
|
||||||
GameStats.nMap = (uint8_t)levelnew;
|
GameStats.nMap = (uint8_t)levelnum;
|
||||||
GameStats.nWeapons = nPlayerWeapons[nLocalPlayer];
|
GameStats.nWeapons = nPlayerWeapons[nLocalPlayer];
|
||||||
GameStats.nCurrentWeapon = PlayerList[nLocalPlayer].nCurrentWeapon;
|
GameStats.nCurrentWeapon = PlayerList[nLocalPlayer].nCurrentWeapon;
|
||||||
GameStats.clip = nPlayerClip[nLocalPlayer];
|
GameStats.clip = nPlayerClip[nLocalPlayer];
|
||||||
|
|
|
@ -44,11 +44,8 @@ extern GameStat GameStats;
|
||||||
|
|
||||||
extern unsigned char cinemapal[];
|
extern unsigned char cinemapal[];
|
||||||
|
|
||||||
extern short SavePosition;
|
|
||||||
|
|
||||||
int showmap(short nLevel, short nLevelNew, short nLevelBest);
|
int showmap(short nLevel, short nLevelNew, short nLevelBest);
|
||||||
|
|
||||||
void ClearCinemaSeen();
|
|
||||||
void menu_DoPlasma();
|
void menu_DoPlasma();
|
||||||
int menu_Menu(int val);
|
int menu_Menu(int val);
|
||||||
short menu_GameLoad(int nSlot);
|
short menu_GameLoad(int nSlot);
|
||||||
|
@ -56,14 +53,10 @@ void menu_GameLoad2(FILE *fp, bool bIsDemo = false);
|
||||||
void menu_GameSave2(FILE *fp);
|
void menu_GameSave2(FILE *fp);
|
||||||
void menu_GameSave(int nSaveSlot);
|
void menu_GameSave(int nSaveSlot);
|
||||||
|
|
||||||
void menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest, std::function<void(int)> completion);
|
void menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest, TArray<JobDesc> &jobs);
|
||||||
|
|
||||||
void DoEnergyTile();
|
void DoEnergyTile();
|
||||||
|
|
||||||
void DoFailedFinalScene();
|
|
||||||
|
|
||||||
void DoAfterCinemaScene(int nLevel);
|
|
||||||
|
|
||||||
void InitEnergyTile();
|
void InitEnergyTile();
|
||||||
|
|
||||||
END_PS_NS
|
END_PS_NS
|
||||||
|
|
|
@ -2554,7 +2554,7 @@ void PostProcess()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (levelnew != kMap20)
|
if (levelnum != kMap20)
|
||||||
{
|
{
|
||||||
// esi is i
|
// esi is i
|
||||||
for (i = 0; i < numsectors; i++)
|
for (i = 0; i < numsectors; i++)
|
||||||
|
|
|
@ -83,8 +83,7 @@ static int osdcmd_map(CCmdFuncPtr parm)
|
||||||
{
|
{
|
||||||
if (mapList[i].labelName.CompareNoCase(mapname) == 0)
|
if (mapList[i].labelName.CompareNoCase(mapname) == 0)
|
||||||
{
|
{
|
||||||
levelnew = i;
|
GameAction = i;
|
||||||
levelnum = i;
|
|
||||||
return CCMD_OK;
|
return CCMD_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,8 +116,7 @@ static int osdcmd_changelevel(CCmdFuncPtr parm)
|
||||||
return CCMD_SHOWHELP;
|
return CCMD_SHOWHELP;
|
||||||
}
|
}
|
||||||
|
|
||||||
levelnew = nLevel;
|
GameAction = nLevel;
|
||||||
levelnum = nLevel;
|
|
||||||
|
|
||||||
return CCMD_OK;
|
return CCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "buildtiles.h"
|
#include "buildtiles.h"
|
||||||
#include "gstrings.h"
|
#include "gstrings.h"
|
||||||
|
#include "gamestate.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -2960,18 +2961,8 @@ loc_1BD2E:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (CDplaying()) {
|
DoGameOverScene((levelnum == 20));
|
||||||
fadecdaudio();
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (levelnum == 20) {
|
|
||||||
DoFailedFinalScene();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
DoGameOverScene();
|
|
||||||
}
|
|
||||||
|
|
||||||
levelnew = 100;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -489,8 +489,7 @@ int DoSpiritHead()
|
||||||
{
|
{
|
||||||
if (!CDplaying())
|
if (!CDplaying())
|
||||||
{
|
{
|
||||||
levelnew = levelnum + 1;
|
EndLevel = 2;
|
||||||
fadecdaudio();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_PS_NS
|
BEGIN_PS_NS
|
||||||
|
|
||||||
extern int MenuExitCondition;
|
|
||||||
void SaveTextureState();
|
void SaveTextureState();
|
||||||
void LoadTextureState();
|
void LoadTextureState();
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
|
||||||
parallaxtype = 2;
|
parallaxtype = 2;
|
||||||
g_visibility = 2048;
|
g_visibility = 2048;
|
||||||
ototalclock = totalclock;
|
ototalclock = totalclock;
|
||||||
MenuExitCondition = 6;
|
GameAction = 1000;
|
||||||
|
|
||||||
if (levelnum > 15)
|
if (levelnum > 15)
|
||||||
{
|
{
|
||||||
|
|
|
@ -230,11 +230,6 @@ void ResetView()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetView1()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline int interpolate16(int a, int b, int smooth)
|
static inline int interpolate16(int a, int b, int smooth)
|
||||||
{
|
{
|
||||||
return a + mulscale16(b - a, smooth);
|
return a + mulscale16(b - a, smooth);
|
||||||
|
@ -449,7 +444,7 @@ void DrawView(int smoothRatio, bool sceneonly)
|
||||||
if ((bSubTitles && !subtitleOverlay.AdvanceCinemaText(totalclock)) || inputState.CheckAllInput())
|
if ((bSubTitles && !subtitleOverlay.AdvanceCinemaText(totalclock)) || inputState.CheckAllInput())
|
||||||
{
|
{
|
||||||
inputState.ClearAllInput();
|
inputState.ClearAllInput();
|
||||||
levelnew = levelnum + 1;
|
EndLevel = 2;
|
||||||
|
|
||||||
if (CDplaying()) {
|
if (CDplaying()) {
|
||||||
fadecdaudio();
|
fadecdaudio();
|
||||||
|
|
|
@ -28,7 +28,6 @@ extern short besttarget;
|
||||||
extern short bCamera;
|
extern short bCamera;
|
||||||
|
|
||||||
void InitView();
|
void InitView();
|
||||||
void SetView1();
|
|
||||||
void DrawStatusBar();
|
void DrawStatusBar();
|
||||||
void DrawView(int smoothRatio, bool sceneonly = false);
|
void DrawView(int smoothRatio, bool sceneonly = false);
|
||||||
void ResetView();
|
void ResetView();
|
||||||
|
|
|
@ -61,7 +61,7 @@ LISTMENU "MainMenu"
|
||||||
linespacing 22
|
linespacing 22
|
||||||
NativeTextItem "3460", "n", "StartGame", 1
|
NativeTextItem "3460", "n", "StartGame", 1
|
||||||
NativeTextItem "3461", "l", "LoadGameMenu"
|
NativeTextItem "3461", "l", "LoadGameMenu"
|
||||||
NativeTextItem "3462", "m", "StartGame", 3
|
NativeTextItem "3462", "m", "StartGame", 0
|
||||||
NativeTextItem "3463", "v", "OptionsMenu"
|
NativeTextItem "3463", "v", "OptionsMenu"
|
||||||
NativeTextItem "3464", "q", "QuitMenu"
|
NativeTextItem "3464", "q", "QuitMenu"
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ LISTMENU "IngameMenu"
|
||||||
linespacing 22
|
linespacing 22
|
||||||
NativeTextItem "3460", "n", "StartGame", 1
|
NativeTextItem "3460", "n", "StartGame", 1
|
||||||
NativeTextItem "3461", "l", "LoadGameMenu"
|
NativeTextItem "3461", "l", "LoadGameMenu"
|
||||||
NativeTextItem "3462", "m", "StartGame", 3
|
NativeTextItem "3462", "m", "StartGame", 0
|
||||||
NativeTextItem "3463", "v", "OptionsMenu"
|
NativeTextItem "3463", "v", "OptionsMenu"
|
||||||
NativeTextItem "3464", "q", "QuitMenu"
|
NativeTextItem "3464", "q", "QuitMenu"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue