mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
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:
@@ -429,10 +429,7 @@ void mapclass::initcustommapdata(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
const int rx = ent.x / 40;
|
||||
const int ry = ent.y / 30;
|
||||
|
||||
settrinket(rx, ry);
|
||||
settrinket(ent.rx, ent.ry);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1807,16 +1804,13 @@ void mapclass::loadlevel(int rx, int ry)
|
||||
{
|
||||
// If entity is in this room, create it
|
||||
const CustomEntity& ent = customentities[edi];
|
||||
const int tsx = ent.x / 40;
|
||||
const int tsy = ent.y / 30;
|
||||
|
||||
if (tsx != rx-100 || tsy != ry-100)
|
||||
if (ent.rx != rx - 100 || ent.ry != ry - 100)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const int ex = (ent.x % 40) * 8;
|
||||
const int ey = (ent.y % 30) * 8;
|
||||
const int ex = ent.x * 8;
|
||||
const int ey = ent.y * 8;
|
||||
|
||||
// Platform and enemy bounding boxes
|
||||
int bx1 = 0, by1 = 0, bx2 = 0, by2 = 0;
|
||||
|
||||
Reference in New Issue
Block a user