2019-12-10 00:01:45 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "gstrings.h"
|
2019-12-10 17:35:28 +01:00
|
|
|
#include "cmdlib.h"
|
2019-12-11 00:57:53 +01:00
|
|
|
#include "quotemgr.h"
|
|
|
|
#ifdef GetMessage
|
|
|
|
#undef GetMessage // Windows strikes...
|
|
|
|
#endif
|
2019-12-10 00:01:45 +01:00
|
|
|
|
2020-10-04 18:31:48 +02:00
|
|
|
|
|
|
|
enum EMax
|
|
|
|
{
|
|
|
|
MAXSKILLS = 7,
|
|
|
|
MAXVOLUMES = 7,
|
|
|
|
MAXMENUGAMEPLAYENTRIES = 7,
|
|
|
|
};
|
|
|
|
|
2020-10-07 01:31:41 +02:00
|
|
|
enum EVolFlags
|
|
|
|
{
|
|
|
|
EF_HIDEFROMSP = 1,
|
|
|
|
};
|
|
|
|
|
2020-10-04 18:31:48 +02:00
|
|
|
// These get filled in by the map definition parsers of the front ends.
|
|
|
|
extern FString gSkillNames[MAXSKILLS];
|
|
|
|
extern FString gVolumeNames[MAXVOLUMES];
|
|
|
|
extern FString gVolumeSubtitles[MAXVOLUMES];
|
|
|
|
extern int32_t gVolumeFlags[MAXVOLUMES];
|
|
|
|
extern int gDefaultVolume, gDefaultSkill;
|
|
|
|
|
|
|
|
|
2019-12-10 00:01:45 +01: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 22:22:59 +01:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
MI_FORCEEOG = 1,
|
2020-07-07 13:19:09 +02:00
|
|
|
MI_USERMAP = 2,
|
2019-12-10 22:22:59 +01:00
|
|
|
};
|
|
|
|
|
2020-08-03 20:12:33 +02:00
|
|
|
enum {
|
|
|
|
MAX_MESSAGES = 32
|
|
|
|
};
|
|
|
|
|
2019-12-10 00:01:45 +01:00
|
|
|
struct MapRecord
|
|
|
|
{
|
2020-07-01 20:31:29 +02:00
|
|
|
int parTime = 0;
|
|
|
|
int designerTime = 0;
|
2019-12-10 00:01:45 +01:00
|
|
|
FString fileName;
|
2019-12-10 17:35:28 +01:00
|
|
|
FString labelName;
|
2019-12-10 00:01:45 +01:00
|
|
|
FString name;
|
|
|
|
FString music;
|
2019-12-11 00:57:53 +01:00
|
|
|
int cdSongId = -1;
|
2019-12-11 23:41:05 +01:00
|
|
|
int flags = 0;
|
2020-07-01 20:31:29 +02:00
|
|
|
int levelNumber = -1;
|
2019-12-10 00:01:45 +01:00
|
|
|
|
|
|
|
// The rest is only used by Blood
|
2019-12-11 00:57:53 +01:00
|
|
|
int nextLevel = -1;
|
|
|
|
int nextSecret = -1;
|
2020-08-03 20:12:33 +02:00
|
|
|
FString messages[MAX_MESSAGES];
|
2019-12-10 00:01:45 +01:00
|
|
|
FString author;
|
2019-12-11 00:57:53 +01:00
|
|
|
int8_t fog = -1, weather = -1; // Blood defines these but they aren't used.
|
2019-12-10 00:01:45 +01:00
|
|
|
|
2020-07-07 13:19:09 +02:00
|
|
|
const char* LabelName() const
|
|
|
|
{
|
|
|
|
if (flags & MI_USERMAP) return GStrings("TXT_USERMAP");
|
|
|
|
return labelName;
|
|
|
|
}
|
|
|
|
const char *DisplayName() const
|
2019-12-10 00:01:45 +01:00
|
|
|
{
|
2019-12-10 17:35:28 +01:00
|
|
|
if (name.IsEmpty()) return labelName;
|
2019-12-10 00:01:45 +01:00
|
|
|
return GStrings.localize(name);
|
|
|
|
}
|
|
|
|
void SetName(const char *n)
|
|
|
|
{
|
|
|
|
name = n;
|
|
|
|
MakeStringLocalizable(name);
|
|
|
|
}
|
2019-12-10 17:35:28 +01:00
|
|
|
void SetFileName(const char* n)
|
|
|
|
{
|
2020-09-03 23:10:28 +02:00
|
|
|
if (*n == '/' || *n == '\\') n++;
|
2019-12-10 17:35:28 +01:00
|
|
|
fileName = n;
|
2020-03-01 07:28:40 +01:00
|
|
|
FixPathSeperator(fileName);
|
2019-12-10 17:35:28 +01:00
|
|
|
labelName = ExtractFileBase(n);
|
|
|
|
}
|
2019-12-11 00:57:53 +01:00
|
|
|
const char* GetMessage(int num)
|
|
|
|
{
|
2020-08-03 20:12:33 +02:00
|
|
|
if (num < 0 || num>= MAX_MESSAGES) return "";
|
|
|
|
return GStrings(messages[num]);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddMessage(int num, const FString &msg)
|
|
|
|
{
|
|
|
|
messages[num] = msg;
|
2019-12-11 00:57:53 +01:00
|
|
|
}
|
2020-08-03 20:12:33 +02:00
|
|
|
|
2019-12-10 17:35:28 +01:00
|
|
|
|
2019-12-10 00:01:45 +01:00
|
|
|
};
|
|
|
|
|
2020-06-24 00:40:22 +02:00
|
|
|
|
2019-12-10 00:01:45 +01:00
|
|
|
extern MapRecord mapList[512];
|
2019-12-10 22:22:59 +01:00
|
|
|
extern MapRecord *currentLevel;
|
2020-06-24 00:40:22 +02:00
|
|
|
|
2020-07-07 13:19:09 +02:00
|
|
|
bool SetMusicForMap(const char* mapname, const char* music, bool namehack = false);
|
2020-06-24 00:40:22 +02:00
|
|
|
|
2020-07-07 13:19:09 +02:00
|
|
|
MapRecord *FindMapByName(const char *nm);
|
|
|
|
MapRecord *FindMapByLevelNum(int num);
|
|
|
|
MapRecord *FindNextMap(MapRecord *thismap);
|
2020-07-07 20:27:21 +02:00
|
|
|
MapRecord* SetupUserMap(const char* boardfilename, const char *defaultmusic = nullptr);
|
|
|
|
MapRecord* AllocateMap();
|
2019-12-10 22:22:59 +01:00
|
|
|
|
2020-08-03 20:11:30 +02:00
|
|
|
// These should be the only places converting between level numbers and volume/map pairs
|
|
|
|
constexpr inline int levelnum(int vol, int map)
|
|
|
|
{
|
|
|
|
return vol * 1000 + map;
|
|
|
|
}
|
|
|
|
|
|
|
|
constexpr inline int volfromlevelnum(int num)
|
|
|
|
{
|
2020-08-18 20:12:04 +02:00
|
|
|
return num >= 0 ? num / 1000 : 0;
|
2020-08-03 20:11:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
constexpr inline int mapfromlevelnum(int num)
|
|
|
|
{
|
2020-08-18 20:12:04 +02:00
|
|
|
return num >= 0 ? num % 1000 : -1;
|
2020-08-03 20:11:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-12-10 22:22:59 +01:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
RRENDSLOT = 127
|
2020-08-03 20:11:30 +02:00
|
|
|
};
|