mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
Refactor room properties to use setter and getter funcs
This replaces all raw ed.level accesses with new setter and getter funcs, which makes it easier to add bounds checks later. And I've also removed all the manually-written bounds checks, since they will go into the new getter and setter. To get the room properties of a specific room, you use editorclass::getroomprop(), which returns a pointer to the room properties - then you just read off of that pointer. To set a room property, you use editorclass::setroom<PROP>(), where <PROP> is the name of the property. These are maintained using X macros to avoid copy-pasting. editorclass::getroompropidx() is a helper function and shouldn't be used directly.
This commit is contained in:
@@ -1726,9 +1726,8 @@ void Graphics::drawentity(const int i, const int yoff)
|
||||
|
||||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
// Special case for gray Warp Zone tileset!
|
||||
const int room = game.roomx-100 + (game.roomy-100) * ed.maxwidth;
|
||||
const bool custom_gray = INBOUNDS_ARR(room, ed.level)
|
||||
&& ed.level[room].tileset == 3 && ed.level[room].tilecol == 6;
|
||||
const edlevelclass* const room = ed.getroomprop(game.roomx - 100, game.roomy - 100);
|
||||
const bool custom_gray = room->tileset == 3 && room->tilecol == 6;
|
||||
#else
|
||||
const bool custom_gray = false;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user