Commit Graph

2132 Commits

Author SHA1 Message Date
nmlgc 7070e5f1fa [Maintenance] Return random playfield positions as screen-space coordinates
Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:32:35 +02:00
nmlgc 01fb8529ef [Maintenance] [th01] Bosses: Rewrite shot hitboxes in a visually correct way
Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:29:26 +02:00
nmlgc cac520e466 [Maintenance] [th01] Bosses: Rewrite Orb hitboxes in a visually correct way
You know that things are complicated when you have to resort to Unicode
box drawing character art to explain how two hitboxes relate to each
other. I *hope* this makes enough sense, and that I won't be rewriting
this in terms of ORB_W and ORB_H after all in the future. For now
though, it's immediately obvious when the hitbox reaches outside the
entity. In the case of YuugenMagan, it even simplifies the coordinates
so much that we don't need separate constants.

Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:29:04 +02:00
nmlgc 853952b610 [Maintenance] [th01] Boss entities: The hitbox method relates to the *orb*
I keep getting confused when reading the code.

Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:27:47 +02:00
nmlgc c6e51f7545 [Maintenance] [th01] Clean up pellet headers
Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:26:54 +02:00
nmlgc f6d264aa6e [Maintenance] Publicly declare decimal subpixels
They are not exclusive to Sariel after all…

Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:26:06 +02:00
nmlgc 3259190530 [Readme] Update branch overview
`th01_orb_debug` now also shows the frames since the last collision
with every bumper bar.
2022-07-12 07:59:01 +02:00
nmlgc 0ae642056c [Research] [th01] Document the inadequacy of bumper bar collision handling
The flag that blocks collision handling for vertical bars might prevent
some of the potential glitches here, but definitely not all of them.
Thanks to touhou-memories for bringing this to my attention, this was
indeed a glaring omission.
2022-07-12 07:49:54 +02:00
nmlgc 0c682b5bc0 [Maintenance] Declare the optimization_barrier() a single time
And put that single instance into the compiler optimization workaround
section of `decomp.hpp`.

Part of P0204, funded by [Anonymous].
2022-07-10 13:45:18 +02:00
nmlgc 3e79deeb3a [Contributing] Define function brace placement rules
I've been following them pretty consistently for a while now, time to
finally write them down.

Part of P0204, funded by [Anonymous] and Yanga.
2022-07-10 13:45:18 +02:00
nmlgc 7b6090110f [Maintenance] [th01] Cards: Merge segment 30 code into a single source file
The fact that the game insists on this translation unit is already bad
enough – thanks to the static constructor for the CCards and CObstacles
instances, we can't merge it with segment 31. Just `#include`ing
str_val.cpp here is much less bad than having more than one extra
source file.

Part of P0204, funded by [Anonymous] and Yanga.
2022-07-10 13:45:17 +02:00
nmlgc 3a97e3f846 [Maintenance] [th01] Move integer→string conversions to the `math/` directory
The nondescript nature of `core/` has been annoying me for a while, and
these function kind of are number-related after all.

Part of P0204, funded by [Anonymous] and Yanga.
2022-07-10 13:37:56 +02:00
nmlgc 39da5da2ea [Decompilation] [th01] Bomb animation
And that's 50% of all PC-98 Touhou game code RE'd! 🎉

Also, 70 functions remaining in TH01.

Part of P0204, funded by [Anonymous] and Yanga.
2022-07-10 13:36:35 +02:00
nmlgc 9cfb0a791d [Decompilation] [th01] Stage objects: Move all data to C land
Part of P0204, funded by [Anonymous] and Yanga.
2022-07-10 13:31:38 +02:00
nmlgc b539336ed3 [Decompilation] [th01] Stage objects: Portal update/render/reset function
Part of P0204, funded by [Anonymous] and Yanga.
2022-07-10 13:29:11 +02:00
nmlgc 86cdf5f655 [Decompilation] [th01] Stage objects: Turret fire/reset function
Completes P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:28:38 +02:00
nmlgc f85587dda4 [Decompilation] [th01] Stage objects: Main obstacle update/render function
In which ZUN needs a hack to make columns of vertical bumper bars work
at all with the way the Orb's X velocity is implemented… and may have
just deliberately ensured that the Orb can definitely loop infinitely
between two bumpers.

(Those two wrong NOPCALLs aren't worth working around. It would
basically require taking apart the entire function, and they'll be gone
by the next two commits anyway.)

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:28:27 +02:00
nmlgc 8a92de7b27 [Reverse-engineering] [th01] Stage objects: Per-type obstacle frame semantics
Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:14:49 +02:00
nmlgc e86a6ca88b [Naming] [th01] Stage objects: Rename the background+object blitting function
All throughout this codebase, `X_put_8()` implies that just the single
sprite of X is blitted on top of whatever is in VRAM at the given
position. This function blits more than one sprite though. (Also,
portal rendering is going to introduce a helper function that does only
blit a single thing.)

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:13:54 +02:00
nmlgc 05b28f709b [Maintenance] [th01] Orb: Don't make the Y velocity publically available
The fact that it's only mutated internally by applying a force on the
Orb is going to become very relevant.

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:13:15 +02:00
nmlgc 711af96314 [Maintenance] [th01] Move STAGE?.DAT loading declaration to `stages.hpp`
Removes the dependency on the STAGE?.DAT format from some bosses.

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:11:28 +02:00
nmlgc 2113031a27 [Maintenance] [th01] Declare z_text_vputsa()
It's been highly useful for debug output at specific screen positions
for a number of times now.

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:11:20 +02:00
nmlgc 001033d15a [Maintenance] [th01] Remove `extern "C"` from more areas of code
The .GRC and .GRP functions, to be specific.

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:09:12 +02:00
nmlgc 901eda4594 [Maintenance] Consistently indent preprocessor macros
Let's see if anyone ever tries to compile this codebase with a pre-C89
compiler that enforces the # at the beginning of the line.

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:06:26 +02:00
nmlgc bca1b7d38a [Maintenance] Add a `nullptr` polyfill to platform.h
Which allows us to remove <stddef.h> from translation units that just
needed it for `NULL`.

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:02:51 +02:00
nmlgc 4568bf7383 [Decompilation] [th01] Particles / HUD HP / Missiles: Move data to C land
…including those.

Completes P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:09 +02:00
nmlgc 3f52d9a16f [Decompilation] [th01] YuugenMagan: Sprite loading and initial variables
Doing this one now allows us to completely get rid of a bunch of ASM
land declations…

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 988cf64bf3 [Decompilation] [th01] Missiles: Spawn function + Sprite selection by angle
The latter being the dumbest, most decadent piece of FPU abuse in this
game. But it works 🤷

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 68ace9c126 [Decompilation] [th01] SinGyoku: Move all data to C land
6th PC-98 Touhou boss completely decompiled, 25 to go!

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 50f58a6045 [Decompilation] [th01] SinGyoku: Main function
80 functions remaining in TH01, and less than 10,000 ASM instructions
remaining in REIIDEN.EXE!

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 40d9348c86 [Decompilation] [th01] SinGyoku: Transformations for patterns 5 and 6
Then again, this more flexible architecture points towards SinGyoku's
male form potentially having had way more varied patterns earlier in
development… or planned, but never realized.

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc a3364e8f60 [Decompilation] [th01] SinGyoku: Pattern 6/6
The one where SinGyoku's male form fires 3 sets of 10 aimed sling
pellets from random locations within its sprite.

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 1020bbba56 [Decompilation] [th01] SinGyoku: Pattern 5/6
The one where SinGyoku's male form fires 3×10 pellets at random
downwards angles.

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 5447272a2b [Decompilation] [th01] SinGyoku: Transformations for patterns 3 and 4
Why are these separate functions? ☹

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 6508d215bc [Decompilation] [th01] SinGyoku: Pattern 4/6
The one where SinGyoku's female form fires 30 crossing pellets from her
left and right hands.

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc e0e8808530 [Decompilation] [th01] SinGyoku: Pattern 3/6
The one where SinGyoku's female form fires 20 chasing pellets from her
left and right hands.

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 20a8e665de [Decompilation] [th01] SinGyoku: Sphere→person→sphere transformation
Complete with callback function parameters that are completely ignored
by SinGyoku's female-form patterns. That's all the entity
synchronization code in this fight though?! Nice.

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc ff49e9e32b [Decompilation] [th01] SinGyoku: Pattern 2/6
The one where SinGyoku slams their sphere form into Reimu and then
returns to not quite its base Y coordinate.
One big collidable object == technically a pattern, right?

(90 functions remaining in TH01!)

Completes P0201, funded by Ember2528 and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 8edf287eb6 [Decompilation] [th01] SinGyoku: Pattern 1/6
The one where SinGyoku's sphere form sprays a half-circle of pellets
at static downwards angles, randomly selecting either a direction from
right to left or from left to right. First pattern you see in the
fight, and the only pellet pattern in phase 1.

Part of P0201, funded by Ember2528 and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 6c3dc34f9b [Decompilation] [th01] SinGyoku: Rotating sphere movement and rendering
With 3 ZUN bugs, this one small function is technically buggier than
the entirety of Kikuri… or at least *as* buggy, with only two of them
being visible in the original game.

Oh well, that's 80% of REIIDEN.EXE RE'd!

Part of P0201, funded by Ember2528 and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 108714eb1d [Decompilation] [th01] SinGyoku: Accelerating sphere rotation
Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 23:28:19 +02:00
nmlgc 3c7371c2de [Decompilation] [th01] SinGyoku: Sprite loading and initial variables
Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 23:28:19 +02:00
nmlgc 49248f458c [Decompilation] [th01] SinGyoku: Sprite freeing
Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 23:28:19 +02:00
nmlgc 4779a95c95 [Decompilation] [th01] SinGyoku: Sphere rotation and rendering
Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 23:28:19 +02:00
nmlgc b48c03f5cc [Naming] [th01] SinGyoku: Generic pattern state variable
Four semantic meanings… still enough for a single commit.

Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 23:28:19 +02:00
nmlgc 6f2881f056 [Maintenance] Remove `extern "C"` from more areas of code
The .PTN functions, vector functions, and egc_copy_rect_1_to_0_1()
(finally!) from TH01, as well as playfld.hpp from all games(finally!),
together with a bunch of other functions in their vicinity.

Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 23:28:19 +02:00
nmlgc 54fe83513b [Maintenance] Remove the intended type from the -Z -3 inhibition macro
Nobody cares about preserving perfect semantics across a macro whose
only job is to worsen code generation on one specific compiler. And
even aside from semantics, signedness would be the only difference that
types would make, and parameter passing couldn't care less about it.

Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 23:25:08 +02:00
nmlgc f4785a2577 [Maintenance] [th01] Boss entities: Declare dummy clamp parameters as defaults
Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 22:53:28 +02:00
nmlgc 124f68946a [Maintenance] [th01] Boss entities: Force `bos_image` through a getter method
Noooo, SinGyoku will in fact prove the existence of this getter method
via the given code generation detail. Might as well go fully consistent
then and exclusively use the methods, ending the previous party time.

Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 22:50:24 +02:00
nmlgc 7cbe533784 [Maintenance] [th01] Add select_for_rank() subpixel and laser speed wrappers
Another one from the visual noise reduction department.

Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 22:49:52 +02:00