2019-12-09 23:01:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "gstrings.h"
|
2019-12-10 16:35:28 +00:00
|
|
|
#include "cmdlib.h"
|
2019-12-10 23:57:53 +00:00
|
|
|
#include "quotemgr.h"
|
|
|
|
#ifdef GetMessage
|
|
|
|
#undef GetMessage // Windows strikes...
|
|
|
|
#endif
|
2019-12-09 23:01:45 +00:00
|
|
|
|
|
|
|
// Localization capable replacement of the game specific solutions.
|
|
|
|
|
|
|
|
inline void MakeStringLocalizable(FString "e)
|
|
|
|
{
|
|
|
|
// Only prepend a quote if the string is localizable.
|
|
|
|
if (quote.Len() > 0 && quote[0] != '$' && GStrings[quote]) quote.Insert(0, "$");
|
|
|
|
}
|
|
|
|
|
2019-12-10 21:22:59 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
MI_FORCEEOG = 1,
|
|
|
|
};
|
|
|
|
|
2019-12-09 23:01:45 +00:00
|
|
|
struct MapRecord
|
|
|
|
{
|
2020-07-01 18:31:29 +00:00
|
|
|
int parTime = 0;
|
|
|
|
int designerTime = 0;
|
2019-12-09 23:01:45 +00:00
|
|
|
FString fileName;
|
2019-12-10 16:35:28 +00:00
|
|
|
FString labelName;
|
2019-12-09 23:01:45 +00:00
|
|
|
FString name;
|
|
|
|
FString music;
|
2019-12-10 23:57:53 +00:00
|
|
|
int cdSongId = -1;
|
2019-12-11 22:41:05 +00:00
|
|
|
int flags = 0;
|
2020-07-01 18:31:29 +00:00
|
|
|
int levelNumber = -1;
|
2019-12-09 23:01:45 +00:00
|
|
|
|
|
|
|
// The rest is only used by Blood
|
2019-12-10 23:57:53 +00:00
|
|
|
int nextLevel = -1;
|
|
|
|
int nextSecret = -1;
|
|
|
|
int messageStart = 0; // messages are stored in the quote array to reduce clutter.
|
2019-12-09 23:01:45 +00:00
|
|
|
FString author;
|
2019-12-10 23:57:53 +00:00
|
|
|
int8_t fog = -1, weather = -1; // Blood defines these but they aren't used.
|
2019-12-09 23:01:45 +00:00
|
|
|
|
|
|
|
const char *DisplayName()
|
|
|
|
{
|
2019-12-10 16:35:28 +00:00
|
|
|
if (name.IsEmpty()) return labelName;
|
2019-12-09 23:01:45 +00:00
|
|
|
return GStrings.localize(name);
|
|
|
|
}
|
|
|
|
void SetName(const char *n)
|
|
|
|
{
|
|
|
|
name = n;
|
|
|
|
MakeStringLocalizable(name);
|
|
|
|
}
|
2019-12-10 16:35:28 +00:00
|
|
|
void SetFileName(const char* n)
|
|
|
|
{
|
|
|
|
fileName = n;
|
2020-03-01 06:28:40 +00:00
|
|
|
FixPathSeperator(fileName);
|
2019-12-10 16:35:28 +00:00
|
|
|
labelName = ExtractFileBase(n);
|
|
|
|
}
|
2019-12-10 23:57:53 +00:00
|
|
|
const char* GetMessage(int num)
|
|
|
|
{
|
|
|
|
return quoteMgr.GetQuote(messageStart + num);
|
|
|
|
}
|
2019-12-10 16:35:28 +00:00
|
|
|
|
2019-12-09 23:01:45 +00:00
|
|
|
};
|
|
|
|
|
2020-06-23 22:40:22 +00:00
|
|
|
|
2019-12-09 23:01:45 +00:00
|
|
|
extern MapRecord mapList[512];
|
2019-12-10 21:22:59 +00:00
|
|
|
extern MapRecord userMapRecord;
|
|
|
|
extern MapRecord *currentLevel;
|
|
|
|
extern MapRecord* lastLevel;
|
|
|
|
|
2020-06-23 22:40:22 +00:00
|
|
|
inline bool SetMusicForMap(const char* mapname, const char* music, bool namehack = false)
|
|
|
|
{
|
|
|
|
static const char* specials[] = { "intro", "briefing", "loading" };
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
if (!stricmp(mapname, specials[i]))
|
|
|
|
{
|
|
|
|
// todo: store this properly.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int index = -1; // = FindMap(mapname);
|
|
|
|
|
|
|
|
// This is for the DEFS parser's MUSIC command which never bothered to check for the real map name.
|
|
|
|
if (index < 0 && namehack)
|
|
|
|
{
|
|
|
|
int lev, ep;
|
|
|
|
signed char b1, b2;
|
|
|
|
|
|
|
|
int numMatches = sscanf(mapname, "%c%d%c%d", &b1, &ep, &b2, &lev);
|
|
|
|
|
|
|
|
if (numMatches != 4 || toupper(b1) != 'E' || toupper(b2) != 'L')
|
|
|
|
return false;
|
|
|
|
|
|
|
|
index = -1; // = FindMapByIndex(ep, lev);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (index >= 0)
|
|
|
|
{
|
|
|
|
mapList[index].music = music;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-12-10 21:22:59 +00:00
|
|
|
|
|
|
|
inline void InitRREndMap()
|
|
|
|
{
|
|
|
|
// RR defines its end map ad-hoc so give it a proper entry to reference (the last one in episode 2 because it needs to be in Ep. 2.)
|
|
|
|
mapList[127].SetName("$TXT_CLOSEENCOUNTERS");
|
2020-01-08 17:58:36 +00:00
|
|
|
mapList[127].SetFileName("endgame.map");
|
2020-07-01 18:31:29 +00:00
|
|
|
mapList[127].levelNumber = 163; // last one in Ep. 2.
|
2019-12-10 21:22:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
RRENDSLOT = 127
|
|
|
|
};
|