42 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
ultima-soul
d408b56549 Merge branch 'master' of github.com:pret/pokeemerald into item_expansion_sync 2021-12-01 20:18:57 -08:00
ultima-soul
a8f9a54787 Merge branch 'master' of github.com:pret/pokeemerald into item_expansion_sync 2021-11-21 10:41:32 -08:00
GriffinR
e66ea0cb99 Reformat compare + goto_if/call_if to single statements 2021-11-18 23:06:51 -05:00
cbt6
32aaf6912f Rename movement scripts to use Faster over Fastest 2021-11-05 02:22:28 +08:00
ultima-soul
5cb73a012c Merge branch 'item_expansion' of github.com:rh-hideout/pokeemerald-expansion into item_id_revamp 2021-08-30 11:57:27 -07:00
GriffinR
06351bf63c Remove address comments 2021-07-20 15:18:31 -04:00
ultima-soul
ad8cfda831 Add and rearrange Key Items. 2021-07-06 17:03:46 -07:00
ExpoSeed
6a977bdbfc Document second parameter of playbgm 2021-05-21 15:08:00 -05:00
GriffinR
3014241179 Give songs meaningful english names 2020-08-20 19:06:14 -04:00
GriffinR
3ba8cabd80 Fix Brenday typo 2020-08-18 15:56:44 -04:00
GriffinR
fac6288156 Add local object event ids for referenced objects 2020-06-22 17:18:58 -04:00
GriffinR
f2e7b1507e Port some macro/script fixes from pokefirered 2020-01-11 14:12:31 -05:00
Fontbane
31b4656324 Labels better 2019-12-25 22:39:06 -05:00
GriffinR
525ec2025d Document Routes 111-118 2019-11-14 17:41:01 -06:00
GriffinR
dd01942c4f Document aqua/magma hideout scripts 2019-11-01 17:22:45 -05:00
Marcus Huderle
aad430c049 Document route 110 scripts 2019-10-26 12:55:53 -05:00
GriffinR
d914c1d659 Document common movements 2019-10-06 13:55:30 -04:00
GriffinR
1d703e786b move some data out of event_scripts, use game stat constants 2019-09-05 14:56:34 -04:00
GriffinR
0f5d96e5f5
name used and unnamed vars 2019-08-03 14:12:48 -04:00
Fontbane
901a83d249 Fix some labels and include decorations.h
Include decorations.h in shop.c

Include decorations.h in event_scripts.s
2019-04-22 17:23:59 -05:00
Fontbane
2c076f1f3e Doc most OnTransitions 2019-04-22 17:23:59 -05:00
huderlem
84573f1774
Merge pull request #574 from Phlosioneer/event-vars
Event vars
2019-02-25 08:02:28 -06:00
Phlosioneer
8816aa527d Update map script files 2019-02-25 08:01:22 -06:00
Phlosioneer
4e5fae0086 Merge branch 'master' into event-vars 2019-02-25 02:24:20 -05:00
Phlosioneer
0de831fd29 Name some common single-entry movements 2019-02-24 10:10:18 -06:00
Phlosioneer
4582fd1545 Name a ton of commonly used event scripts 2019-02-24 10:10:18 -06:00
Phlosioneer
e12a7790cf Start porting pokeruby vars to pokeemerald 2019-02-22 04:01:38 -05:00
Marcus Huderle
36a1825bbe Document trainer approach funcs, and use movement type constants in scripts 2019-01-29 14:36:02 -06:00
Tetrable
a3ebca4d81 Fix merge conflicts 2019-01-02 21:25:14 +00:00
Tetrable
1e3da62d24 Finish off labelling flags 2019-01-02 21:12:43 +00:00
Melody
6d556f8cf7 improve checkplayergender calls
clean up constant definitions

make tweaks from review
2018-12-28 08:22:21 -06:00
Melody
55005f1588 improve call_if macros 2018-12-21 21:32:45 -05:00
Melody
ac2e4adf2d improve goto_if macros 2018-12-21 20:28:24 -05:00
Melody
2615ece23b Use normal apostrophes like adults 2018-12-07 10:41:08 -05:00
Melody
10725def8e trainerbattle_normal → trainerbattle_single
* trainerbattle_normal → trainerbattle_single
* TRAINER_BATTLE_NORMAL → TRAINER_BATTLE_SINGLE
* improves the macro documentation a little
2018-12-02 15:08:19 -05:00
Melody
bad5323642 cleans up trainer battle scripts
* adds battle type macros
* adds `trainerbattle_normal` macro
* adds `trainerbattle_double` macro
* adds rematch macros
* adds no intro macro
2018-12-02 15:08:19 -05:00
Melody
862265b73a defines register_matchcall macro 2018-12-02 06:04:59 -05:00
Melody
c557ac61ae adds constants, cleans up callstd and msgbox code
* adds some constants for standard script names and messagebox types
* replaces some callstd calls with msgbox calls where equivalent
* replaces msgbox and callstd calls using raw digits with versions that use the constants
2018-12-02 03:37:46 -05:00
Diegoisawesome
90896e38c9 Begin porting/decompiling field_specials 2018-08-08 01:37:12 -07:00
Diegoisawesome
156fb472e1 Clean up files and add entries to charmap 2018-07-24 21:18:23 -07:00
Marcus Huderle
135a11e50e Move events and scripts into map dirs 2018-06-20 19:54:21 -05:00