Commit Graph

7 Commits

Author SHA1 Message Date
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
GriffinR
4439253f39 Add include guards for assembly constants files 2023-09-03 20:57:54 -04:00
aaaaaa123456789
7dc95a0103 Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.

Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 06:30:55 -03:00
PokeCodec
cbb94035e3 Cleaned up the libraries. 2020-08-22 00:52:45 -04:00
GriffinR
347d1e20b6 Use constants in io_reg.s 2019-11-04 16:26:09 -06:00
Diegoisawesome
f5743c7d6f Ported libmks4agb from pokeruby 2016-11-01 21:48:22 -05:00
YamaArashi
a793e62d83 .s -> .inc 2016-11-01 08:29:13 -07:00