mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
- use the volumes to find the starting maps for the menu and the clusters for the cutscenes.
This commit is contained in:
parent
825963661b
commit
93bfc35ad6
14 changed files with 51 additions and 78 deletions
|
@ -64,7 +64,7 @@ struct GameInterface
|
|||
virtual void MenuSound(EMenuSounds snd) {}
|
||||
virtual bool CanSave() { return true; }
|
||||
virtual void CustomMenuSelection(int menu, int item) {}
|
||||
virtual bool StartGame(FNewGameStartup& gs) { return false; }
|
||||
virtual bool StartGame(FNewGameStartup& gs) { return true; }
|
||||
virtual FSavegameInfo GetSaveSig() { return { "", 0, 0}; }
|
||||
virtual double SmallFontScale() { return 1; }
|
||||
virtual void SerializeGameState(FSerializer& arc) {}
|
||||
|
|
|
@ -108,8 +108,6 @@ struct VolumeRecord // episodes
|
|||
FString name;
|
||||
FString subtitle;
|
||||
int index = -1;
|
||||
CutsceneDef intro;
|
||||
CutsceneDef outro;
|
||||
int flags = 0;
|
||||
int shortcut = 0;
|
||||
};
|
||||
|
|
|
@ -83,8 +83,31 @@ bool help_disabled;
|
|||
FNewGameStartup NewGameStartupInfo;
|
||||
|
||||
|
||||
|
||||
//FNewGameStartup NewGameStartupInfo;
|
||||
|
||||
static bool DoStartGame(FNewGameStartup& gs)
|
||||
{
|
||||
auto vol = FindVolume(gs.Episode);
|
||||
if (!vol) return false;
|
||||
|
||||
if (isShareware() && (vol->flags & VF_SHAREWARELOCK))
|
||||
{
|
||||
M_StartMessage(GStrings("SHAREWARELOCK"), 1, NAME_None);
|
||||
return false;
|
||||
}
|
||||
|
||||
auto map = FindMapByName(vol->startmap);
|
||||
if (!map) return false;
|
||||
soundEngine->StopAllChannels();
|
||||
|
||||
gi->StartGame(gs); // play game specific effects (like Duke/RR/SW's voice lines when starting a game.)
|
||||
|
||||
DeferedStartGame(map, gs.Skill);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool M_SetSpecialMenu(FName& menu, int param)
|
||||
{
|
||||
|
@ -115,14 +138,14 @@ bool M_SetSpecialMenu(FName& menu, int param)
|
|||
|
||||
case NAME_Startgame:
|
||||
case NAME_StartgameNoSkill:
|
||||
menu = NAME_Startgame;
|
||||
NewGameStartupInfo.Skill = param;
|
||||
if (menu == NAME_StartgameNoSkill)
|
||||
{
|
||||
menu = NAME_Startgame;
|
||||
NewGameStartupInfo.Episode = param;
|
||||
NewGameStartupInfo.Skill = 1;
|
||||
}
|
||||
if (gi->StartGame(NewGameStartupInfo))
|
||||
if (DoStartGame(NewGameStartupInfo))
|
||||
{
|
||||
M_ClearMenus();
|
||||
int ep = NewGameStartupInfo.Episode;
|
||||
|
|
|
@ -120,7 +120,7 @@ void parseDefineCutscene(FScanner& sc, FScriptPosition& pos)
|
|||
while (!sc.FoundEndBrace(eblockend))
|
||||
{
|
||||
sc.MustGetString();
|
||||
auto volume = MustFindVolume(vol);
|
||||
auto volume = MustFindCluster(vol);
|
||||
if (sc.Compare("intro")) parseCutscene(sc, volume->intro);
|
||||
else if (sc.Compare("outro")) parseCutscene(sc, volume->outro);
|
||||
else if (sc.Compare("flags")) sc.GetNumber(volume->flags);
|
||||
|
|
|
@ -78,7 +78,6 @@ extern int blood_globalflags;
|
|||
|
||||
void QuitGame(void);
|
||||
void PreloadCache(void);
|
||||
void StartLevel(MapRecord *gameOptions);
|
||||
void ProcessFrame(void);
|
||||
void ScanINIFiles(void);
|
||||
void EndLevel();
|
||||
|
@ -108,7 +107,6 @@ struct GameInterface : ::GameInterface
|
|||
void MenuOpened() override;
|
||||
void MenuClosed() override;
|
||||
bool CanSave() override;
|
||||
bool StartGame(FNewGameStartup& gs) override;
|
||||
void QuitToTitle() override;
|
||||
FString GetCoordString() override;
|
||||
ReservedSpace GetReservedScreenSpace(int viewsize) override;
|
||||
|
|
|
@ -159,23 +159,6 @@ bool GameInterface::CanSave()
|
|||
return (gamestate == GS_LEVEL && gPlayer[myconnectindex].pXSprite->health != 0);
|
||||
}
|
||||
|
||||
bool GameInterface::StartGame(FNewGameStartup& gs)
|
||||
{
|
||||
if (gs.Episode >= 1)
|
||||
{
|
||||
if (g_gameType & GAMEFLAG_SHAREWARE)
|
||||
{
|
||||
M_StartMessage(GStrings("BUYBLOOD"), 1, NAME_None); // unreachable because we do not support Blood SW versions yet.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
sfxKillAllSounds();
|
||||
auto map = FindMapByLevelNum(makelevelnum(gs.Episode, gs.Level));
|
||||
DeferedStartGame(map, gs.Skill);
|
||||
return true;
|
||||
}
|
||||
|
||||
FSavegameInfo GameInterface::GetSaveSig()
|
||||
{
|
||||
return { SAVESIG_BLD, MINSAVEVER_BLD, SAVEVER_BLD };
|
||||
|
|
|
@ -104,9 +104,9 @@ void levelLoadMapInfo(IniFile *pIni, MapRecord *pLevelInfo, const char *pzSectio
|
|||
pLevelInfo->weather = pIni->GetKeyInt(pzSection, "Weather", -0);
|
||||
for (int i = 0; i < kMaxMessages; i++)
|
||||
{
|
||||
sprintf(buffer, "Message%d", i+1);
|
||||
auto msg = pIni->GetKeyString(pzSection, buffer, "");
|
||||
pLevelInfo->AddMessage(i, msg);
|
||||
sprintf(buffer, "Message%d", i + 1);
|
||||
auto msg = pIni->GetKeyString(pzSection, buffer, "");
|
||||
pLevelInfo->AddMessage(i, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ void levelLoadDefaults(void)
|
|||
if (cutALevel < 0) cutALevel = 0;
|
||||
|
||||
int j;
|
||||
for (j = 0; j < kMaxLevels; j++)
|
||||
for (j = 1; j <= kMaxLevels; j++)
|
||||
{
|
||||
sprintf(buffer2, "Map%d", j);
|
||||
if (!BloodINI->KeyExists(buffer, buffer2))
|
||||
|
@ -190,10 +190,11 @@ void levelLoadDefaults(void)
|
|||
auto pLevelInfo = AllocateMap();
|
||||
const char *pMap = BloodINI->GetKeyString(buffer, buffer2, NULL);
|
||||
CheckSectionAbend(pMap);
|
||||
SetLevelNum(pLevelInfo, makelevelnum(i, j));
|
||||
SetLevelNum(pLevelInfo, makelevelnum(i-1, j-1));
|
||||
pLevelInfo->cluster = i;
|
||||
pLevelInfo->mapindex = j;
|
||||
pLevelInfo->labelName = pMap;
|
||||
if (j == 1) volume->startmap = pLevelInfo->labelName;
|
||||
pLevelInfo->fileName.Format("%s.map", pMap);
|
||||
levelLoadMapInfo(BloodINI, pLevelInfo, pMap, i, j);
|
||||
if (j == cutALevel)
|
||||
|
|
|
@ -97,19 +97,8 @@ bool GameInterface::CanSave()
|
|||
|
||||
bool GameInterface::StartGame(FNewGameStartup& gs)
|
||||
{
|
||||
if (gs.Episode >= 1)
|
||||
{
|
||||
if (g_gameType & GAMEFLAG_SHAREWARE)
|
||||
{
|
||||
M_StartMessage(GStrings("BUYDUKE"), 1, NAME_None);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t skillsound = PISTOL_BODYHIT;
|
||||
|
||||
soundEngine->StopAllChannels();
|
||||
|
||||
static const short sounds_d[] = { JIBBED_ACTOR6, BONUS_SPEECH1, DUKE_GETWEAPON2, JIBBED_ACTOR5, JIBBED_ACTOR5 };
|
||||
static const short sounds_r[] = { 427, 428, 196, 195, 197 };
|
||||
if (gs.Skill >=0 && gs.Skill <= 5) skillsound = isRR()? sounds_r[gs.Skill] : sounds_d[gs.Skill];
|
||||
|
@ -126,15 +115,7 @@ bool GameInterface::StartGame(FNewGameStartup& gs)
|
|||
}
|
||||
Net_ClearFifo();
|
||||
}
|
||||
|
||||
auto map = FindMapByLevelNum(makelevelnum(gs.Episode, gs.Level));
|
||||
if (map)
|
||||
{
|
||||
DeferedStartGame(map, gs.Skill);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
FSavegameInfo GameInterface::GetSaveSig()
|
||||
|
|
|
@ -72,13 +72,6 @@ void GameInterface::QuitToTitle()
|
|||
gameaction = ga_mainmenu;
|
||||
}
|
||||
|
||||
bool GameInterface::StartGame(FNewGameStartup& gs)
|
||||
{
|
||||
auto map = FindMapByLevelNum(gs.Skill); // 0 is training, 1 is the regular game - the game does not have skill levels.
|
||||
DeferedStartGame(map, 1, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
FSavegameInfo GameInterface::GetSaveSig()
|
||||
{
|
||||
return { SAVESIG_PS, MINSAVEVER_PS, SAVEVER_PS };
|
||||
|
|
|
@ -495,6 +495,12 @@ void GameInterface::app_init()
|
|||
#if 0
|
||||
help_disabled = true;
|
||||
#endif
|
||||
|
||||
auto vol0 = MustFindVolume(0);
|
||||
auto vol1 = MustFindVolume(1);
|
||||
if (vol0) vol0->startmap = "LEV1";
|
||||
if (vol1) vol1->startmap = "LEV0";
|
||||
|
||||
// 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++)
|
||||
{
|
||||
|
|
|
@ -221,7 +221,6 @@ struct GameInterface : ::GameInterface
|
|||
bool GenerateSavePic() override;
|
||||
void MenuOpened() override;
|
||||
void MenuSound(EMenuSounds snd) override;
|
||||
bool StartGame(FNewGameStartup& gs) override;
|
||||
FSavegameInfo GetSaveSig() override;
|
||||
void SerializeGameState(FSerializer& arc);
|
||||
bool CanSave() override;
|
||||
|
|
|
@ -102,22 +102,8 @@ bool GameInterface::StartGame(FNewGameStartup& gs)
|
|||
int handle = 0;
|
||||
int zero = 0;
|
||||
|
||||
MapRecord* map;
|
||||
if (gs.Episode >= 1)
|
||||
{
|
||||
if (g_gameType & GAMEFLAG_SHAREWARE)
|
||||
{
|
||||
M_StartMessage(GStrings("BUYSW"), 1, NAME_None);
|
||||
return false;
|
||||
}
|
||||
map = FindMapByLevelNum(5);
|
||||
}
|
||||
else
|
||||
map = FindMapByLevelNum(1);
|
||||
|
||||
if (!map) return false;
|
||||
CameraTestMode = false;
|
||||
StopFX();
|
||||
StopAmbientSound();
|
||||
|
||||
//InitNewGame();
|
||||
|
||||
|
@ -140,7 +126,6 @@ bool GameInterface::StartGame(FNewGameStartup& gs)
|
|||
}
|
||||
Net_ClearFifo();
|
||||
}
|
||||
DeferedStartGame(map, gs.Skill);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -807,6 +807,12 @@ void LoadCustomInfoFromScript(const char *filename)
|
|||
break;
|
||||
}
|
||||
}
|
||||
auto vol0 = MustFindVolume(0);
|
||||
auto vol1 = MustFindVolume(1);
|
||||
auto map1 = FindMapByLevelNum(1);
|
||||
auto map5 = FindMapByLevelNum(5);
|
||||
if (vol0 && map1) vol0->startmap = map1->labelName;
|
||||
if (vol1 && map5) vol1->startmap = map5->labelName;
|
||||
}
|
||||
|
||||
END_SW_NS
|
||||
|
|
|
@ -66,9 +66,9 @@ LISTMENU "MainMenu"
|
|||
Position 160, 65
|
||||
linespacing 22
|
||||
ExhumedPlasma
|
||||
ExhumedTextItem "$MNU_NEWGAME", "n", "StartGameNoSkill", 1
|
||||
ExhumedTextItem "$MNU_NEWGAME", "n", "StartGameNoSkill", 0
|
||||
ExhumedTextItem "$MNU_LOADGAME", "l", "LoadGameMenu"
|
||||
ExhumedTextItem "$TXT_EX_MAP00", "m", "StartGameNoSkill", 0
|
||||
ExhumedTextItem "$TXT_EX_MAP00", "m", "StartGameNoSkill", 1
|
||||
ExhumedTextItem "$MNU_OPTIONS", "v", "OptionsMenu"
|
||||
ExhumedTextItem "$MNU_QUITGAME", "q", "QuitMenu"
|
||||
}
|
||||
|
@ -137,9 +137,9 @@ LISTMENU "IngameMenu"
|
|||
Position 160, 65
|
||||
linespacing 22
|
||||
ExhumedLogo
|
||||
ExhumedTextItem "$MNU_NEWGAME", "n", "StartGameNoSkill", 1
|
||||
ExhumedTextItem "$MNU_NEWGAME", "n", "StartGameNoSkill", 0
|
||||
ExhumedTextItem "$MNU_LOADGAME", "l", "LoadGameMenu"
|
||||
ExhumedTextItem "$TXT_EX_MAP00", "m", "StartGameNoSkill", 0
|
||||
ExhumedTextItem "$TXT_EX_MAP00", "m", "StartGameNoSkill", 1
|
||||
ExhumedTextItem "$MNU_OPTIONS", "v", "OptionsMenu"
|
||||
ExhumedTextItem "$MNU_QUITGAME", "q", "QuitMenu"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue