2020-02-10 03:21:19 +01:00
|
|
|
#if !defined(NO_CUSTOM_LEVELS)
|
2020-02-10 01:53:01 +01:00
|
|
|
|
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
|
|
|
|
|
|
|
class edentities{
|
|
|
|
public:
|
2020-06-12 02:57:04 +02: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 \
|
|
|
|
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) \
|
|
|
|
FOREACH_PROP(directmode, int)
|
|
|
|
|
2020-01-01 21:29:24 +01:00
|
|
|
class edlevelclass{
|
|
|
|
public:
|
Explicitly declare void for all void parameter functions (#628)
Apparently in C, if you have `void test();`, it's completely okay to do
`test(2);`. The function will take in the argument, but just discard it
and throw it away. It's like a trash can, and a rude one at that. If you
declare it like `void test(void);`, this is prevented.
This is not a problem in C++ - doing `void test();` and `test(2);` is
guaranteed to result in a compile error (this also means that right now,
at least in all `.cpp` files, nobody is ever calling a void parameter
function with arguments and having their arguments be thrown away).
However, we may not be using C++ in the future, so I just want to lay
down the precedent that if a function takes in no arguments, you must
explicitly declare it as such.
I would've added `-Wstrict-prototypes`, but it produces an annoying
warning message saying it doesn't work in C++ mode if you're compiling
in C++ mode. So it can be added later.
2021-02-25 23:23:59 +01:00
|
|
|
edlevelclass(void);
|
2021-03-24 19:59:36 +01:00
|
|
|
#define FOREACH_PROP(NAME, TYPE) TYPE NAME;
|
|
|
|
ROOM_PROPERTIES
|
|
|
|
#undef FOREACH_PROP
|
2020-01-01 21:29:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct LevelMetaData
|
|
|
|
{
|
2020-06-12 02:57:04 +02: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;
|
2020-01-01 21:29:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-03-01 21:24:43 +01:00
|
|
|
extern std::vector<edentities> edentity;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
class EditorData
|
|
|
|
{
|
2020-06-12 02:57:04 +02:00
|
|
|
public:
|
2020-01-01 21:29:24 +01:00
|
|
|
|
Explicitly declare void for all void parameter functions (#628)
Apparently in C, if you have `void test();`, it's completely okay to do
`test(2);`. The function will take in the argument, but just discard it
and throw it away. It's like a trash can, and a rude one at that. If you
declare it like `void test(void);`, this is prevented.
This is not a problem in C++ - doing `void test();` and `test(2);` is
guaranteed to result in a compile error (this also means that right now,
at least in all `.cpp` files, nobody is ever calling a void parameter
function with arguments and having their arguments be thrown away).
However, we may not be using C++ in the future, so I just want to lay
down the precedent that if a function takes in no arguments, you must
explicitly declare it as such.
I would've added `-Wstrict-prototypes`, but it produces an annoying
warning message saying it doesn't work in C++ mode if you're compiling
in C++ mode. So it can be added later.
2021-02-25 23:23:59 +01:00
|
|
|
static EditorData& GetInstance(void)
|
2020-06-12 02:57:04 +02:00
|
|
|
{
|
|
|
|
static EditorData instance; // Guaranteed to be destroyed.
|
|
|
|
// Instantiated on first use.
|
|
|
|
return instance;
|
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
|
2020-06-12 02:57:04 +02:00
|
|
|
std::string title;
|
|
|
|
std::string creator;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-06-12 02:57:04 +02:00
|
|
|
std::string modifier;
|
2020-01-01 21:29:24 +01:00
|
|
|
};
|
|
|
|
|
2021-02-21 00:40:11 +01:00
|
|
|
class customlevelclass
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
customlevelclass(void);
|
2020-01-01 21:29:24 +01:00
|
|
|
std::string Desc1;
|
|
|
|
std::string Desc2;
|
|
|
|
std::string Desc3;
|
2020-06-12 02:57:04 +02:00
|
|
|
std::string website;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
std::vector<LevelMetaData> ListOfMetaData;
|
|
|
|
|
Explicitly declare void for all void parameter functions (#628)
Apparently in C, if you have `void test();`, it's completely okay to do
`test(2);`. The function will take in the argument, but just discard it
and throw it away. It's like a trash can, and a rude one at that. If you
declare it like `void test(void);`, this is prevented.
This is not a problem in C++ - doing `void test();` and `test(2);` is
guaranteed to result in a compile error (this also means that right now,
at least in all `.cpp` files, nobody is ever calling a void parameter
function with arguments and having their arguments be thrown away).
However, we may not be using C++ in the future, so I just want to lay
down the precedent that if a function takes in no arguments, you must
explicitly declare it as such.
I would've added `-Wstrict-prototypes`, but it produces an annoying
warning message saying it doesn't work in C++ mode if you're compiling
in C++ mode. So it can be added later.
2021-02-25 23:23:59 +01:00
|
|
|
void loadZips(void);
|
|
|
|
void getDirectoryData(void);
|
2020-01-01 21:29:24 +01:00
|
|
|
bool getLevelMetaData(std::string& filename, LevelMetaData& _data );
|
|
|
|
|
Explicitly declare void for all void parameter functions (#628)
Apparently in C, if you have `void test();`, it's completely okay to do
`test(2);`. The function will take in the argument, but just discard it
and throw it away. It's like a trash can, and a rude one at that. If you
declare it like `void test(void);`, this is prevented.
This is not a problem in C++ - doing `void test();` and `test(2);` is
guaranteed to result in a compile error (this also means that right now,
at least in all `.cpp` files, nobody is ever calling a void parameter
function with arguments and having their arguments be thrown away).
However, we may not be using C++ in the future, so I just want to lay
down the precedent that if a function takes in no arguments, you must
explicitly declare it as such.
I would've added `-Wstrict-prototypes`, but it produces an annoying
warning message saying it doesn't work in C++ mode if you're compiling
in C++ mode. So it can be added later.
2021-02-25 23:23:59 +01:00
|
|
|
void reset(void);
|
2021-08-23 06:30:53 +02:00
|
|
|
const int* loadlevel(int rxi, int ryi);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2021-03-24 19:26:19 +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-03-24 19:59:36 +01:00
|
|
|
int getroompropidx(const int rx, const int ry);
|
|
|
|
const edlevelclass* getroomprop(const int rx, const int ry);
|
|
|
|
#define FOREACH_PROP(NAME, TYPE) \
|
|
|
|
void setroom##NAME(const int rx, const int ry, const TYPE NAME);
|
|
|
|
ROOM_PROPERTIES
|
|
|
|
#undef FOREACH_PROP
|
|
|
|
|
2020-01-01 21:29:24 +01:00
|
|
|
int absfree(int x, int y);
|
|
|
|
|
2020-06-02 12:59:54 +02:00
|
|
|
bool load(std::string& _path);
|
2021-02-21 00:40:11 +01:00
|
|
|
#ifndef NO_EDITOR
|
2020-06-02 12:59:54 +02:00
|
|
|
bool save(std::string& _path);
|
2021-02-21 00:40:11 +01:00
|
|
|
#endif
|
Explicitly declare void for all void parameter functions (#628)
Apparently in C, if you have `void test();`, it's completely okay to do
`test(2);`. The function will take in the argument, but just discard it
and throw it away. It's like a trash can, and a rude one at that. If you
declare it like `void test(void);`, this is prevented.
This is not a problem in C++ - doing `void test();` and `test(2);` is
guaranteed to result in a compile error (this also means that right now,
at least in all `.cpp` files, nobody is ever calling a void parameter
function with arguments and having their arguments be thrown away).
However, we may not be using C++ in the future, so I just want to lay
down the precedent that if a function takes in no arguments, you must
explicitly declare it as such.
I would've added `-Wstrict-prototypes`, but it produces an annoying
warning message saying it doesn't work in C++ mode if you're compiling
in C++ mode. So it can be added later.
2021-02-25 23:23:59 +01:00
|
|
|
void generatecustomminimap(void);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
int findtrinket(int t);
|
|
|
|
int findcrewmate(int t);
|
|
|
|
int findwarptoken(int t);
|
Explicitly declare void for all void parameter functions (#628)
Apparently in C, if you have `void test();`, it's completely okay to do
`test(2);`. The function will take in the argument, but just discard it
and throw it away. It's like a trash can, and a rude one at that. If you
declare it like `void test(void);`, this is prevented.
This is not a problem in C++ - doing `void test();` and `test(2);` is
guaranteed to result in a compile error (this also means that right now,
at least in all `.cpp` files, nobody is ever calling a void parameter
function with arguments and having their arguments be thrown away).
However, we may not be using C++ in the future, so I just want to lay
down the precedent that if a function takes in no arguments, you must
explicitly declare it as such.
I would've added `-Wstrict-prototypes`, but it produces an annoying
warning message saying it doesn't work in C++ mode if you're compiling
in C++ mode. So it can be added later.
2021-02-25 23:23:59 +01:00
|
|
|
void findstartpoint(void);
|
2021-03-24 19:59:36 +01:00
|
|
|
int getlevelcol(const int tileset, const int tilecol);
|
2020-01-01 21:29:24 +01:00
|
|
|
int getenemycol(int t);
|
|
|
|
|
|
|
|
//Colouring stuff
|
|
|
|
int getwarpbackground(int rx, int ry);
|
|
|
|
|
2020-07-03 11:54:31 +02:00
|
|
|
static const int maxwidth = 20, maxheight = 20; //Special; the physical max the engine allows
|
|
|
|
static const int numrooms = maxwidth * maxheight;
|
2021-08-23 06:30:53 +02:00
|
|
|
int contents[40 * 30 * numrooms];
|
2020-07-03 11:54:31 +02:00
|
|
|
int vmult[30 * maxheight];
|
Explicitly declare void for all void parameter functions (#628)
Apparently in C, if you have `void test();`, it's completely okay to do
`test(2);`. The function will take in the argument, but just discard it
and throw it away. It's like a trash can, and a rude one at that. If you
declare it like `void test(void);`, this is prevented.
This is not a problem in C++ - doing `void test();` and `test(2);` is
guaranteed to result in a compile error (this also means that right now,
at least in all `.cpp` files, nobody is ever calling a void parameter
function with arguments and having their arguments be thrown away).
However, we may not be using C++ in the future, so I just want to lay
down the precedent that if a function takes in no arguments, you must
explicitly declare it as such.
I would've added `-Wstrict-prototypes`, but it produces an annoying
warning message saying it doesn't work in C++ mode if you're compiling
in C++ mode. So it can be added later.
2021-02-25 23:23:59 +01:00
|
|
|
int numtrinkets(void);
|
|
|
|
int numcrewmates(void);
|
2020-07-03 11:54:31 +02:00
|
|
|
edlevelclass level[numrooms]; //Maxwidth*maxheight
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
int levmusic;
|
|
|
|
int mapwidth, mapheight; //Actual width and height of stage
|
|
|
|
|
|
|
|
int version;
|
|
|
|
|
2020-06-30 20:47:22 +02:00
|
|
|
Uint32 getonewaycol(const int rx, const int ry);
|
Explicitly declare void for all void parameter functions (#628)
Apparently in C, if you have `void test();`, it's completely okay to do
`test(2);`. The function will take in the argument, but just discard it
and throw it away. It's like a trash can, and a rude one at that. If you
declare it like `void test(void);`, this is prevented.
This is not a problem in C++ - doing `void test();` and `test(2);` is
guaranteed to result in a compile error (this also means that right now,
at least in all `.cpp` files, nobody is ever calling a void parameter
function with arguments and having their arguments be thrown away).
However, we may not be using C++ in the future, so I just want to lay
down the precedent that if a function takes in no arguments, you must
explicitly declare it as such.
I would've added `-Wstrict-prototypes`, but it produces an annoying
warning message saying it doesn't work in C++ mode if you're compiling
in C++ mode. So it can be added later.
2021-02-25 23:23:59 +01:00
|
|
|
Uint32 getonewaycol(void);
|
2020-06-30 23:08:14 +02:00
|
|
|
bool onewaycol_override;
|
2020-01-01 21:29: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
|
|
|
|
2020-03-01 21:24:43 +01:00
|
|
|
#endif /* NO_CUSTOM_LEVELS */
|