mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- Moved message storage to the map records.
This commit is contained in:
parent
35a5c4e23c
commit
724c811de3
4 changed files with 21 additions and 29 deletions
|
@ -127,15 +127,15 @@ void levelLoadMapInfo(IniFile *pIni, MapRecord *pLevelInfo, const char *pzSectio
|
|||
pLevelInfo->author = pIni->GetKeyString(pzSection, "Author", "");
|
||||
pLevelInfo->music = pIni->GetKeyString(pzSection, "Song", ""); DefaultExtension(pLevelInfo->music, ".mid");
|
||||
pLevelInfo->cdSongId = pIni->GetKeyInt(pzSection, "Track", -1);
|
||||
pLevelInfo->nextLevel = pIni->GetKeyInt(pzSection, "EndingA", -1); //if (pLevelInfo->nextLevel >= 0) pLevelInfo->nextLevel +epinum * kMaxLevels;
|
||||
pLevelInfo->nextSecret = pIni->GetKeyInt(pzSection, "EndingB", -1); //if (pLevelInfo->nextSecret >= 0) pLevelInfo->nextSecret + epinum * kMaxLevels;
|
||||
pLevelInfo->nextLevel = pIni->GetKeyInt(pzSection, "EndingA", -1);
|
||||
pLevelInfo->nextSecret = pIni->GetKeyInt(pzSection, "EndingB", -1);
|
||||
pLevelInfo->fog = pIni->GetKeyInt(pzSection, "Fog", -0);
|
||||
pLevelInfo->weather = pIni->GetKeyInt(pzSection, "Weather", -0);
|
||||
pLevelInfo->messageStart = 1024 + ((epinum * kMaxLevels) + mapnum) * kMaxMessages;
|
||||
for (int i = 0; i < kMaxMessages; i++)
|
||||
{
|
||||
sprintf(buffer, "Message%d", i+1);
|
||||
quoteMgr.InitializeQuote(pLevelInfo->messageStart + i, pIni->GetKeyString(pzSection, buffer, ""), true);
|
||||
auto msg = pIni->GetKeyString(pzSection, buffer, "");
|
||||
pLevelInfo->AddMessage(i, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,22 +291,6 @@ void levelRestart(void)
|
|||
gStartNewGame = true;
|
||||
}
|
||||
|
||||
int levelGetMusicIdx(const char *str)
|
||||
{
|
||||
int32_t lev, ep;
|
||||
signed char b1, b2;
|
||||
|
||||
int numMatches = sscanf(str, "%c%d%c%d", &b1, &ep, &b2, &lev);
|
||||
|
||||
if (numMatches != 4 || Btoupper(b1) != 'E' || Btoupper(b2) != 'L')
|
||||
return -1;
|
||||
|
||||
if ((unsigned)--lev >= kMaxLevels || (unsigned)--ep >= kMaxEpisodes)
|
||||
return -2;
|
||||
|
||||
return (ep * kMaxLevels) + lev;
|
||||
}
|
||||
|
||||
bool levelTryPlayMusic(int nEpisode, int nLevel, bool bSetLevelSong)
|
||||
{
|
||||
auto level = FindMapByLevelNum(levelnum(nEpisode, nLevel));
|
||||
|
|
|
@ -63,10 +63,8 @@ struct GAMEOPTIONS {
|
|||
#pragma pack(pop)
|
||||
|
||||
enum {
|
||||
MUS_FIRST_SPECIAL = kMaxEpisodes*kMaxLevels,
|
||||
|
||||
MUS_INTRO = MUS_FIRST_SPECIAL,
|
||||
MUS_LOADING = MUS_FIRST_SPECIAL + 1,
|
||||
MUS_INTRO = 0,
|
||||
MUS_LOADING = 1,
|
||||
};
|
||||
|
||||
struct EPISODEINFO
|
||||
|
@ -110,7 +108,6 @@ void levelGetNextLevels(int nEpisode, int nLevel, int *pnEndingA, int *pnEndingB
|
|||
// arg: 0 is normal exit, 1 is secret level
|
||||
void levelEndLevel(int arg);
|
||||
void levelRestart(void);
|
||||
int levelGetMusicIdx(const char *str);
|
||||
bool levelTryPlayMusic(int nEpisode, int nlevel, bool bSetLevelSong = false);
|
||||
void levelTryPlayMusicOrNothing(int nEpisode, int nLevel);
|
||||
|
||||
|
|
|
@ -61,8 +61,8 @@ static int osdcmd_map(CCmdFuncPtr parm)
|
|||
{
|
||||
if (mapList[i].labelName.CompareNoCase(mapname) == 0)
|
||||
{
|
||||
int e = i / kMaxLevels;
|
||||
int m = i % kMaxLevels;
|
||||
int e = volfromlevelnum(mapList[i].levelNumber);
|
||||
int m = mapfromlevelnum(mapList[i].levelNumber);
|
||||
LevelWarp(e, m);
|
||||
return CCMD_OK;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,10 @@ enum
|
|||
MI_USERMAP = 2,
|
||||
};
|
||||
|
||||
enum {
|
||||
MAX_MESSAGES = 32
|
||||
};
|
||||
|
||||
struct MapRecord
|
||||
{
|
||||
int parTime = 0;
|
||||
|
@ -36,7 +40,7 @@ struct MapRecord
|
|||
// The rest is only used by Blood
|
||||
int nextLevel = -1;
|
||||
int nextSecret = -1;
|
||||
int messageStart = 0; // messages are stored in the quote array to reduce clutter.
|
||||
FString messages[MAX_MESSAGES];
|
||||
FString author;
|
||||
int8_t fog = -1, weather = -1; // Blood defines these but they aren't used.
|
||||
|
||||
|
@ -63,8 +67,15 @@ struct MapRecord
|
|||
}
|
||||
const char* GetMessage(int num)
|
||||
{
|
||||
return quoteMgr.GetQuote(messageStart + num);
|
||||
if (num < 0 || num>= MAX_MESSAGES) return "";
|
||||
return GStrings(messages[num]);
|
||||
}
|
||||
|
||||
void AddMessage(int num, const FString &msg)
|
||||
{
|
||||
messages[num] = msg;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue