pokeemerald/asm/macros
Martin Griffin bb781f21a1
Arbitrary trainer scripts + map script/trigger softlock prevention (#5033)
Script_RunImmediatelyUntilEffect runs a script until either a specified
effect may occur or it reaches an end.

All existing script commands and natives, and some specials, call
Script_RequestEffects which allows us to analyze them.

Any downstream script commands/natives/specials will be statically known
not to call Script_RequestEffects and treated as if they have all
effects. Manually tagging them with requests_effects=1 and calling
Script_RequestEffects will make them analyzable.

Using these, we're able to execute scripts until they either exit with
no effect, or would possibly have an effect. This allows us to:
1. Not run on frame map scripts or triggers if they would have no
   effect.
2. Immediately run triggers if they only affect flags/vars. This removes
   the lag frames when biking into the Cycling Road, for example.
3. Migrate on load/on transition/on resume/on return to field/on dive
   warp scripts onto the global script context if they would block
   (approximated via SCREFF_HARDWARE).
4. Support arbitrary control flow in trainer scripts. The trainer does
   not see the player if the script has no effect, and the trainer will
   use whichever trainerbattle command is branched to.
5. Support arbitrary scripts in trainer scripts. cant_see and
   cant_see_if_* commands have been introduced so that scripts are able
   to do something when the player interacts with the trainer even if
   that trainer wouldn't see them.
2025-01-08 10:27:00 +00:00
..
battle_frontier Fix partner palette problem (#4736) 2024-06-07 21:05:16 +02:00
asm.inc Merge branch 'battle_engine' of https://github.com/rh-hideout/pokeemerald-expansion into HEAD 2022-04-02 18:45:18 -03:00
battle_anim_script.inc Merge branch '_RHH/master' into _RHH/upcoming 2024-07-27 16:26:37 -04:00
battle_script.inc Converted 2 various to callnative (#5950) 2025-01-05 17:47:49 +01:00
battle_tent.inc Removed trailing spaces in the most relevant files 2021-08-24 19:59:32 -03:00
contest_ai_script.inc Fix incorrect point macros in contest_ai_script.inc 2024-09-08 12:50:35 +03:00
event.inc Arbitrary trainer scripts + map script/trigger softlock prevention (#5033) 2025-01-08 10:27:00 +00:00
field_effect_script.inc Merge branch 'battle_engine' of https://github.com/rh-hideout/pokeemerald-expansion into HEAD 2022-04-02 18:45:18 -03:00
function.inc Merge branch 'battle_engine' of https://github.com/rh-hideout/pokeemerald-expansion into HEAD 2022-04-02 18:45:18 -03:00
m4a.inc Merge branch 'battle_engine' of https://github.com/rh-hideout/pokeemerald-expansion into HEAD 2022-04-02 18:45:18 -03:00
map.inc Merge branch '_RHH/upcoming' into _RHH/pr/upcoming/merrpFollowers 2024-01-17 18:11:35 -03:00
movement.inc Merge branch '_RHH/upcoming' into _RHH/pr/upcoming/merrpFollowers 2024-01-17 18:11:35 -03:00
music_voice.inc Further removed trailing whitespaces 2022-09-13 16:26:36 -03:00
trainer_hill.inc Clean up some trainer hill 2022-03-31 12:54:07 -04:00