2021-02-20 08:21:58 +01:00
|
|
|
#ifndef CUSTOMLEVELS_H
|
|
|
|
#define CUSTOMLEVELS_H
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-07-19 21:05:41 +02:00
|
|
|
#include <SDL.h>
|
2020-07-19 21:43:29 +02:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2021-02-21 00:56:59 +01:00
|
|
|
class CustomEntity
|
|
|
|
{
|
2020-01-01 21:29:24 +01:00
|
|
|
public:
|
2023-03-29 09:18:42 +02:00
|
|
|
int rx, ry;
|
2021-02-21 00:43:16 +01:00
|
|
|
int x, y, t;
|
|
|
|
//parameters
|
|
|
|
int p1, p2, p3, p4, p5, p6;
|
|
|
|
std::string scriptname;
|
2020-01-01 21:29:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-03-24 19:59:36 +01:00
|
|
|
#define ROOM_PROPERTIES \
|
2021-02-21 00:43:16 +01:00
|
|
|
FOREACH_PROP(tileset, int) \
|
|
|
|
FOREACH_PROP(tilecol, int) \
|
|
|
|
FOREACH_PROP(roomname, std::string) \
|
|
|
|
FOREACH_PROP(warpdir, int) \
|
|
|
|
FOREACH_PROP(platx1, int) \
|
|
|
|
FOREACH_PROP(platy1, int) \
|
|
|
|
FOREACH_PROP(platx2, int) \
|
|
|
|
FOREACH_PROP(platy2, int) \
|
|
|
|
FOREACH_PROP(platv, int) \
|
|
|
|
FOREACH_PROP(enemyx1, int) \
|
|
|
|
FOREACH_PROP(enemyy1, int) \
|
|
|
|
FOREACH_PROP(enemyx2, int) \
|
|
|
|
FOREACH_PROP(enemyy2, int) \
|
|
|
|
FOREACH_PROP(enemytype, int) \
|
2024-08-26 01:19:07 +02:00
|
|
|
FOREACH_PROP(enemyv, int) \
|
2021-02-21 00:43:16 +01:00
|
|
|
FOREACH_PROP(directmode, int)
|
2021-03-24 19:59:36 +01:00
|
|
|
|
2021-02-21 00:45:48 +01:00
|
|
|
class RoomProperty
|
|
|
|
{
|
2020-01-01 21:29:24 +01:00
|
|
|
public:
|
2021-02-21 00:45:48 +01:00
|
|
|
RoomProperty(void);
|
2021-03-24 19:59:36 +01:00
|
|
|
#define FOREACH_PROP(NAME, TYPE) TYPE NAME;
|
2021-02-21 00:43:16 +01:00
|
|
|
ROOM_PROPERTIES
|
2021-03-24 19:59:36 +01:00
|
|
|
#undef FOREACH_PROP
|
2020-01-01 21:29:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct LevelMetaData
|
|
|
|
{
|
2021-02-21 00:43:16 +01:00
|
|
|
std::string title;
|
|
|
|
std::string creator;
|
|
|
|
std::string Desc1;
|
|
|
|
std::string Desc2;
|
|
|
|
std::string Desc3;
|
|
|
|
std::string website;
|
|
|
|
std::string filename;
|
|
|
|
|
|
|
|
std::string modifier;
|
|
|
|
std::string timeCreated;
|
|
|
|
std::string timeModified;
|
|
|
|
|
|
|
|
int version;
|
2023-01-19 20:15:17 +01:00
|
|
|
|
|
|
|
/* true if a system "Untitled Level"/"Unknown"
|
|
|
|
* was stored in this struct (for the levels list) */
|
|
|
|
bool title_is_gettext;
|
|
|
|
bool creator_is_gettext;
|
2023-01-20 03:56:17 +01:00
|
|
|
|
|
|
|
/* This is for the metadata in the levels list,
|
|
|
|
* so it will only be a main font (no custom ones). */
|
|
|
|
uint8_t level_main_font_idx;
|
2024-01-03 20:09:23 +01:00
|
|
|
bool rtl;
|
2020-01-01 21:29:24 +01:00
|
|
|
};
|
|
|
|
|
2022-06-19 22:41:48 +02:00
|
|
|
struct CliPlaytestArgs
|
|
|
|
{
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int rx;
|
|
|
|
int ry;
|
|
|
|
int gc;
|
|
|
|
int music;
|
|
|
|
bool valid;
|
|
|
|
};
|
|
|
|
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2021-02-21 01:01:39 +01:00
|
|
|
extern std::vector<CustomEntity> customentities;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2021-02-21 01:04:50 +01:00
|
|
|
class customlevelclass
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
2021-02-21 01:04:50 +01:00
|
|
|
public:
|
|
|
|
customlevelclass(void);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2021-02-21 00:43:16 +01:00
|
|
|
std::string title;
|
|
|
|
std::string creator;
|
|
|
|
std::string modifier;
|
|
|
|
std::string Desc1;
|
|
|
|
std::string Desc2;
|
|
|
|
std::string Desc3;
|
|
|
|
std::string website;
|
2021-09-25 01:36:54 +02:00
|
|
|
|
2021-02-21 00:43:16 +01:00
|
|
|
std::vector<LevelMetaData> ListOfMetaData;
|
2021-09-25 01:36:54 +02:00
|
|
|
|
2021-02-21 00:43:16 +01:00
|
|
|
void loadZips(void);
|
|
|
|
void getDirectoryData(void);
|
2022-06-19 22:41:48 +02:00
|
|
|
bool getLevelMetaDataAndPlaytestArgs(const std::string& filename, LevelMetaData& _data, CliPlaytestArgs* pt_args);
|
|
|
|
bool getLevelMetaData(const std::string& filename, LevelMetaData& _data);
|
2021-09-25 01:36:54 +02:00
|
|
|
|
2021-02-21 00:43:16 +01:00
|
|
|
void reset(void);
|
|
|
|
const int* loadlevel(int rxi, int ryi);
|
2021-09-25 01:36:54 +02:00
|
|
|
|
2021-02-21 00:43:16 +01:00
|
|
|
int gettileidx(
|
|
|
|
const int rx,
|
|
|
|
const int ry,
|
|
|
|
const int x,
|
|
|
|
const int y
|
|
|
|
);
|
|
|
|
void settile(
|
|
|
|
const int rx,
|
|
|
|
const int ry,
|
|
|
|
const int x,
|
|
|
|
const int y,
|
|
|
|
const int t
|
|
|
|
);
|
|
|
|
int gettile(
|
|
|
|
const int rx,
|
|
|
|
const int ry,
|
|
|
|
const int x,
|
|
|
|
const int y
|
|
|
|
);
|
|
|
|
int getabstile(const int x, const int y);
|
2021-09-25 01:36:54 +02:00
|
|
|
|
2021-02-21 00:43:16 +01:00
|
|
|
int getroompropidx(const int rx, const int ry);
|
2021-02-21 00:45:48 +01:00
|
|
|
const RoomProperty* getroomprop(const int rx, const int ry);
|
2021-03-24 19:59:36 +01:00
|
|
|
#define FOREACH_PROP(NAME, TYPE) \
|
2021-02-21 00:43:16 +01:00
|
|
|
void setroom##NAME(const int rx, const int ry, const TYPE NAME);
|
|
|
|
ROOM_PROPERTIES
|
2021-03-24 19:59:36 +01:00
|
|
|
#undef FOREACH_PROP
|
|
|
|
|
2021-02-21 00:43:16 +01:00
|
|
|
int absfree(int x, int y);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2023-03-17 05:09:41 +01:00
|
|
|
bool load(std::string _path);
|
2021-09-07 00:41:49 +02:00
|
|
|
bool save(const std::string& _path);
|
2023-08-23 19:51:11 +02:00
|
|
|
|
2021-02-21 00:43:16 +01:00
|
|
|
void generatecustomminimap(void);
|
2021-09-25 01:36:54 +02:00
|
|
|
|
2021-02-21 00:43:16 +01:00
|
|
|
int findtrinket(int t);
|
|
|
|
int findcrewmate(int t);
|
|
|
|
int findwarptoken(int t);
|
|
|
|
void findstartpoint(void);
|
|
|
|
int getlevelcol(const int tileset, const int tilecol);
|
|
|
|
int getenemycol(int t);
|
2021-09-25 01:36:54 +02:00
|
|
|
|
2021-02-21 00:43:16 +01:00
|
|
|
//Colouring stuff
|
|
|
|
int getwarpbackground(int rx, int ry);
|
2021-09-25 01:36:54 +02:00
|
|
|
|
2021-02-21 00:43:16 +01:00
|
|
|
static const int maxwidth = 20, maxheight = 20; //Special; the physical max the engine allows
|
|
|
|
static const int numrooms = maxwidth * maxheight;
|
|
|
|
int contents[40 * 30 * numrooms];
|
|
|
|
int numtrinkets(void);
|
|
|
|
int numcrewmates(void);
|
2021-02-21 00:54:24 +01:00
|
|
|
RoomProperty roomproperties[numrooms]; //Maxwidth*maxheight
|
2021-02-21 00:45:48 +01:00
|
|
|
|
2021-02-21 00:43:16 +01:00
|
|
|
int levmusic;
|
|
|
|
int mapwidth, mapheight; //Actual width and height of stage
|
2021-09-25 01:36:54 +02:00
|
|
|
|
2023-01-20 03:56:17 +01:00
|
|
|
std::string level_font_name;
|
2024-01-03 20:09:23 +01:00
|
|
|
bool rtl;
|
2023-01-20 03:56:17 +01:00
|
|
|
|
2021-02-21 00:43:16 +01:00
|
|
|
int version;
|
2021-09-25 01:36:54 +02:00
|
|
|
|
2023-01-02 01:36:43 +01:00
|
|
|
SDL_Color getonewaycol(int rx, int ry);
|
|
|
|
SDL_Color getonewaycol(void);
|
2021-02-21 00:43:16 +01:00
|
|
|
bool onewaycol_override;
|
2020-01-01 21:29:24 +01:00
|
|
|
};
|
|
|
|
|
2024-02-03 00:58:46 +01:00
|
|
|
bool translate_title(const std::string& title);
|
2022-12-30 22:57:24 +01:00
|
|
|
|
2024-02-03 00:58:46 +01:00
|
|
|
bool translate_creator(const std::string& creator);
|
2022-12-30 22:57:24 +01:00
|
|
|
|
2021-02-21 00:40:11 +01:00
|
|
|
#ifndef CL_DEFINITION
|
|
|
|
extern customlevelclass cl;
|
2020-09-28 04:15:06 +02:00
|
|
|
#endif
|
2020-05-18 19:14:12 +02:00
|
|
|
|
2021-02-20 08:21:58 +01:00
|
|
|
#endif /* CUSTOMLEVELS_H */
|
2020-02-10 01:53:01 +01:00
|
|
|
|