282 Commits

Author SHA1 Message Date
Léo Lam
e23d45ce1a Fix Inverted Song of Time better
This fixes severe issues with NPCs with the older ISoT fix.

The previous patch used to set the time speed to -2 to stop time
every 6 frames when it should have been done every 3 frames to get
a 1/3 ratio.

However, even with that fixed, scheduled NPCs were affected by a
serious problem: their animations would be very janky looking and
distracting. The reason the previous change broke NPCs is that they
internally use the time speed to determine their walking
animation speed.

The natural fix -- keeping a constant time speed but manually
decreasing the time variable every 3 frames -- does solve that issue,
but causes NPCs to reach their destination too fast and spend a lot
of time waiting in front of doors.

In order to avoid that problem, I hooked the function that is
responsible for moving scheduled NPCs based on the time speed and
manually applied the 1/3 slow time multiplier. Surprisingly, this was
enough to completely fix the waiting issue... and of course this also
introduced yet another glitch.

NPCs were now moving backwards and facing the wrong direction whenever
a loading zone was activated... After one day of debugging I eventually
figured out that this is because the schedule position variable is
truncated every time it is supposed to stop updating (whenever time
is frozen for instance). This would normally not be an issue -- as the
variable only used to store integer values -- but our ISoT fix requires
the use of non-integer speeds, so the truncation becomes an obstacle
to restoring the ISoT.

The fix -- or rather the hacky workaround -- is to try to detect
position truncation and restore the last known good value.

Pointers to positions are registered by the "move scheduled NPC" hook;
every tick our own code hopes that the pointers are still valid,
looks at the current values and overwrites them if needed.
Not proud of this solution, but I don't see a better way to do it
other than manually patching every single NPC actor (which I don't
want to do).

Fixes issue #4
2019-07-14 17:19:06 +02:00
Léo Lam
263efa2c54 readme: Update instructions
Fixes #7
2019-07-14 15:32:48 +02:00
Léo Lam
788d58f790 main: Use string concatenation for build date strings
Using %s is unnecessary here.
2019-07-13 17:32:48 +02:00
Léo Lam
17a23be601 build: Discard unused functions to reduce code size 2019-07-13 15:44:02 +02:00
Léo Lam
87cadeb1ad build: Disable -Werror
It's annoying when trying to test small, temporary changes.
2019-07-13 14:42:10 +02:00
Léo Lam
11e9541ef3 main: Fix global constructors
Add our own minimal implementation of _start that calls constructors
that are listed in .init_array.
2019-07-13 14:39:24 +02:00
Léo Lam
ae41c2b2e9 trampolines: Save all VFP registers as well 2019-07-12 11:41:44 +02:00
Léo Lam
2a3506e2ed game: Update CommonData struct 2019-07-11 23:15:54 +02:00
Léo Lam
38b732856a Make Captain Keeta's chasing game more challenging 2019-07-11 21:44:25 +02:00
Léo Lam
3a10a3c346 readme: Update change list 2019-07-11 20:52:45 +02:00
Léo Lam
4fc01b1b08 Fix bombers being too enthusiastic during cutscenes 2019-07-11 20:46:54 +02:00
Léo Lam
50f4f64247 build: Ensure build time is up-to-date 2019-07-11 20:07:27 +02:00
Léo Lam
1cae57cd17 game: Update actor struct 2019-07-11 18:18:15 +02:00
Léo Lam
4e24bf0eb8 readme: Update instructions again v1.2.0 2019-07-09 22:34:43 +02:00
Léo Lam
026d0d8ef0 Fix Deku Palace / Woodfall moving platforms 2019-07-09 22:25:33 +02:00
Léo Lam
9d7c1a636d main: Print build time
Yes, this makes builds non-deterministic, but this makes it easier for
me to tell when something was built...
2019-07-09 21:54:20 +02:00
Léo Lam
9e6bf0114d Switch to a new release method
This drops support for anything other than 1.0.0 for two reasons:

* It is annoying to have to port patches to two different versions.

* Adding support for the cartridge 1.1 executable would require
  porting all of the patches to a third version, and further
  increase the cost of making new code patches.

Instead, we now only provide an IPS patch for 1.0.0. For other versions
a BPS patch is used to transform the game executable into a patched
1.0.0 executable. The benefits are twofold: all versions are now
supported, but without increasing the maintenance cost!
2019-07-09 21:54:20 +02:00
Léo Lam
3186352144 Add debug code for showing a list of loaded actors
Useful as a quick and dirty way to determine which actors are loaded
in a particular scene or room.
2019-07-09 18:42:31 +02:00
Léo Lam
27cbf49fa0 common: Add StringFromFormat utility for convenience 2019-07-09 16:02:01 +02:00
Léo Lam
0043a5a300 readme: Fix the ice arrow description 2019-07-09 11:25:58 +02:00
Léo Lam
dd8cec0019 readme: Update test results 2019-07-09 11:20:21 +02:00
Léo Lam
f6e8f99ac8 readme: Update instructions again 2019-07-09 11:19:16 +02:00
Léo Lam
677594fc1d readme: Add Bombers 2019-07-08 23:24:47 +02:00
Léo Lam
dda9fbe868 context: Update global context / z_play struct 2019-07-08 14:00:58 +02:00
Léo Lam
4f2e040772 readme: Update setup instructions v1.1.0 2019-07-08 13:29:07 +02:00
Léo Lam
edfed4c5c3 readme: Add Fixed Deku Palace platforms to todo list 2019-07-08 13:22:32 +02:00
Léo Lam
ce8576ac9d main: Log target version for easier debugging 2019-07-07 20:27:12 +02:00
Léo Lam
a34364b241 build: Keep patched code.bin in build dir
Makes it easier to debug issues.
2019-07-07 20:04:06 +02:00
Léo Lam
566bab8877 Revert the changes to ice arrows
* Hide the new sparkle actors.
* Make ice arrows create ice platforms outside of Gyorg's room too.
2019-07-07 17:37:04 +02:00
Léo Lam
c236a0b162 common_data: Update field names 2019-07-07 15:34:17 +02:00
Léo Lam
17a8442fba Temporarily disable ISoT patch
Investigating issues with NPC scheduling.
v1.0.1
2019-07-07 14:13:29 +02:00
Léo Lam
c6859d7e01 Initial commit v1.0.0-hotfix v1.0.0 2019-07-06 22:59:57 +02:00