diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-07-22 15:37:45 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-07-22 15:37:45 -0400 |
commit | 58dccf62d00d3875dd4becf3061130f8c13aa53d (patch) | |
tree | 962e8b149f1353c4ec819fa761e5afc18d725b2b | |
parent | 78bf5912c46d3421e2bf6b14be6effe8a08b2500 (diff) |
std
-rw-r--r-- | Improve-the-event-initialization-system.md | 20 | ||||
-rw-r--r-- | Lose-money-proportional-to-badges-and-level.md | 2 | ||||
-rw-r--r-- | Wall-to-wall-carpeting-in-your-room.md | 2 |
3 files changed, 8 insertions, 16 deletions
diff --git a/Improve-the-event-initialization-system.md b/Improve-the-event-initialization-system.md index 4c0225d..3b0f370 100644 --- a/Improve-the-event-initialization-system.md +++ b/Improve-the-event-initialization-system.md @@ -1,8 +1,8 @@ When you start a new game, the memory is zeroed out. But some things need to be initialized to nonzero values. -This is done with a callback script in [maps/PlayersHouse2F.asm](../blob/master/maps/PlayersHouse2F.asm), the map you first start in: if the `EVENT_INITIALIZED_EVENTS` event is not set yet, it does `jumpstd initializeevents`. That command actually calls the `InitializeEventsScript` script, which is defined in [engine/events/std_scripts.asm](../blob/master/engine/events/std_scripts.asm). It sets a lot of events, a couple of engine flags, initializes variable sprites, and finally sets the `EVENT_INITIALIZED_EVENTS` event so it won't repeat every time you enter PlayersHouse2F. +This is done with a callback script in [maps/PlayersHouse2F.asm](../blob/master/maps/PlayersHouse2F.asm), the map you first start in: if the `EVENT_INITIALIZED_EVENTS` event is not set yet, it does `jumpstd InitializeEventsScript`. That command actually calls the `InitializeEventsScript` script, which is defined in [engine/events/std_scripts.asm](../blob/master/engine/events/std_scripts.asm). It sets a lot of events, a couple of engine flags, initializes variable sprites, and finally sets the `EVENT_INITIALIZED_EVENTS` event so it won't repeat every time you enter PlayersHouse2F. -There are a few problems with this approach. One, it's tied to a particular map: if you change which map the player starts in, you have to remember to move the `initializeevents` callback. Two, it's hard to find: every time you need to add another initially-set event, you have to scroll halfway through an engine file to the right script. Three, it wastes ROM space: every single `setevent`, `setflag`, or `variablesprite` line spends one byte to identify the command. +There are a few problems with this approach. One, it's tied to a particular map: if you change which map the player starts in, you have to remember to move the `InitializeEventsScript` callback. Two, it's hard to find: every time you need to add another initially-set event, you have to scroll halfway through an engine file to the right script. Three, it wastes ROM space: every single `setevent`, `setflag`, or `variablesprite` line spends one byte to identify the command. This tutorial (using code originally by [ISSOtm](https://github.com/ISSOtm)) will solve all of those problems. It's recommended for if you want your project to be a base for other hacks, since they'll all need their own initializations. @@ -149,26 +149,18 @@ The code uses 73 bytes—67 to define `InitializeEvents` and 6 to `farcall` it†## 3. Remove the scripts that initialized everything -Edit [constants/std_constants.asm](../blob/master/constants/std_constants.asm): +Edit [data/events/std_scripts.asm](../blob/master/data/events/std_scripts.asm): ```diff - ; StdScripts indexes (see engine/events/std_scripts.asm) - ; also used in TileCollisionStdScripts (see data/events/collision_stdscripts.asm) - enum_start + StdScripts:: ... -- enum initializeevents +- add_stdscript InitializeEventsScript ... ``` Edit [engine/events/std_scripts.asm](../blob/master/engine/events/std_scripts.asm): ```diff - StdScripts:: - ; entries correspond to constants/std_constants.asm - ... -- dba InitializeEventsScript - ... - -InitializeEventsScript: - setevent EVENT_EARLS_ACADEMY_EARL - ... @@ -184,7 +176,7 @@ And edit [maps/PlayersHouse2F.asm](../blob/master/maps/PlayersHouse2F.asm): setevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_8 - checkevent EVENT_INITIALIZED_EVENTS - iftrue .SkipInitialization -- jumpstd initializeevents +- jumpstd InitializeEventsScript - endcallback - -.SkipInitialization: diff --git a/Lose-money-proportional-to-badges-and-level.md b/Lose-money-proportional-to-badges-and-level.md index 7a74931..bca9b78 100644 --- a/Lose-money-proportional-to-badges-and-level.md +++ b/Lose-money-proportional-to-badges-and-level.md @@ -131,7 +131,7 @@ Edit [engine/events/whiteout.asm](../blob/master/engine/events/whiteout.asm): + special FadeOutPalettes + pause 40 + special HealParty - jumpstd bugcontestresultswarp + jumpstd BugContestResultsWarpScript .WhitedOutText: ; is out of useable #MON! whited out! diff --git a/Wall-to-wall-carpeting-in-your-room.md b/Wall-to-wall-carpeting-in-your-room.md index 660caa9..1867236 100644 --- a/Wall-to-wall-carpeting-in-your-room.md +++ b/Wall-to-wall-carpeting-in-your-room.md @@ -99,7 +99,7 @@ And edit [maps/PlayersHouse2F.asm](../blob/master/maps/PlayersHouse2F.asm): setevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_8 checkevent EVENT_INITIALIZED_EVENTS iftrue .SkipInitialization - jumpstd initializeevents + jumpstd InitializeEventsScript endcallback .SkipInitialization: |