So, I met with that "Don't rely on execution order" thing far too early to my taste, but that's ok, however it shows another nasty problem and I'd like advice about how any of you handle it. Here is the settings :
- my player character has two "modes" that would change it's parameters. In one mode it can walk on water tiles instead of sinking.
I use two macros to get the ground and the water tilemap id of the current room.
#macro LAYER_GROUND GetTilemapID("ground")
#macro LAYER_WATER GetTilemapID("water")
And then another couple of macros as arrays that I would use in my collision code, one for each modes.
#macro COL_SOLID_A [oSolid, LAYER_GROUND]
#macro COL_SOLID_B [oSolid, LAYER_GROUND, LAYER_WATER]
I have a an array that store two config struct for each mode in the PC object and I switch between those in-game.
In those config struct, I have a variable member that get the proper COL_SOLID macro for each mode.
// in the struct for mode A
col_solid = COL_SOLID_A
// in the struct for mode B
col_solid = COL_SOLID_B
Then my generic collision code has stats[mode].col_solid as he collision to check in place_meeting (and others)
So I think you guessed what would be the problem:
col_solid reference the very first call of those macros and if I change room, it won't be updated to reflect the new room's ground and water's layer id, until I regenerate the whole config structs or call a method in the PC that would update that variable at room change, which is really dumb imho XD.
How would you resolve that ?