mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
Move all temporary variables off of entityclass
This is a refactor that simply moves all temporary variables off of entityclass, and makes it so they are no longer global variables. This makes the resulting code easier to understand as it is less entangled with global state. These attributes were: - colpoint1 - colpoint2 - tempx - tempy - tempw - temph - temp - temp2 - tpx1 - tpy1 - tpx2 - tpy2 - temprect - temprect2 - x (actually unused) - dx - dy - dr - px - py - linetemp - activetrigger - skipblocks - skipdirblocks Most of these attributes were assigned before any of the times they were used, so it's easy to prove that ungloballing them won't change any behaviors. However, dx, dy, dr, and skipblocks are a bit more tricky to analyze. They relate to blocks, with dx, dy, and dr more specifically relating to one-way tiles. So after some testing with the quirks of one-way tiles, it seems that the jankiness of one-way tiles haven't changed at all, either. Unfortunately, the attribute k is clearly used without being assigned beforehand, so I can't move it off of entityclass. It's the same story with the attribute k that Graphics has, too.
This commit is contained in:
@@ -2096,20 +2096,23 @@ void mapclass::twoframedelayfix()
|
||||
// and when the script gets loaded script.run() has already ran for that frame, too.
|
||||
// A bit kludge-y, but it's the least we can do without changing the frame ordering.
|
||||
|
||||
int block_idx = -1;
|
||||
if (game.glitchrunnermode
|
||||
|| !custommode
|
||||
|| game.deathseq != -1
|
||||
// obj.checktrigger() sets obj.activetrigger and block_idx
|
||||
|| obj.checktrigger(&block_idx) <= -1
|
||||
|| game.deathseq != -1)
|
||||
return;
|
||||
|
||||
int block_idx = -1;
|
||||
// obj.checktrigger() sets block_idx
|
||||
int activetrigger = obj.checktrigger(&block_idx);
|
||||
if (activetrigger <= -1
|
||||
|| !INBOUNDS_VEC(block_idx, obj.blocks)
|
||||
|| obj.activetrigger < 300)
|
||||
|| activetrigger < 300)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
game.newscript = obj.blocks[block_idx].script;
|
||||
obj.removetrigger(obj.activetrigger);
|
||||
obj.removetrigger(activetrigger);
|
||||
game.state = 0;
|
||||
game.statedelay = 0;
|
||||
script.load(game.newscript);
|
||||
|
||||
Reference in New Issue
Block a user