mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-11-24 06:19:25 +03:00
Directly execute scripts if script boxes have a non-empty script field
Instead of using gamestates, just directly use the 'script' attribute of a script box if it is non-empty. This is accomplished by having to return the index of the block that the player collides with, so callers can inspect the 'script' attribute of the block themselves, and do their logic accordingly.
This commit is contained in:
1 parent
ca9e4c8f6e
commit
2506127a17
3 files changed
+23
-7
No files matched your search
@@ -2062,16 +2062,18 @@ 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
|
||||
|| game.deathseq != -1
|
||||
// obj.checktrigger() sets obj.activetrigger
|
||||
|| obj.checktrigger() <= -1
|
||||
// obj.checktrigger() sets obj.activetrigger and block_idx
|
||||
|| obj.checktrigger(&block_idx) <= -1
|
||||
|| block_idx <= -1
|
||||
|| obj.activetrigger < 300)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
game.newscript = "custom_" + game.customscript[obj.activetrigger - 300];
|
||||
game.newscript = obj.blocks[block_idx].script;
|
||||
obj.removetrigger(obj.activetrigger);
|
||||
game.state = 0;
|
||||
game.statedelay = 0;
|
||||
|
||||
Reference in new issue
Block a user