Separate CustomEntity global positions internally

This makes it so that `CustomEntity`s, at least internally, do not use
global tile position. Instead, they will use room-x and room-y
coordinates, which will be separate from their x- and y- positions.

This makes it much easier to deal with `CustomEntity`s, because you
don't have to divide and modulo everywhere to use them.

Since editorclass::add_entity and editorclass::get_entity_at expect
global tile position in their arguments, I've added room-x and room-y
arguments to these functions too.

Of course, due to compatibility reasons, the XML files will still have
to use global tile position. For the same reason, warp token
destinations are still using global tile position too.
This commit is contained in:
Misa
2023-03-29 00:18:42 -07:00
parent 98feeade02
commit 71dbe95dcb
5 changed files with 75 additions and 70 deletions

View File

@@ -133,11 +133,11 @@ public:
void show_note(const char* text);
void add_entity(int xp, int yp, int tp, int p1 = 0, int p2 = 0, int p3 = 0, int p4 = 0, int p5 = 320, int p6 = 240);
void add_entity(int rx, int ry, int xp, int yp, int tp, int p1 = 0, int p2 = 0, int p3 = 0, int p4 = 0, int p5 = 320, int p6 = 240);
void remove_entity(int t);
int get_entity_at(int xp, int yp);
int get_entity_at(int rx, int ry, int xp, int yp);
void set_tile(int x, int y, int t);