Commit Graph

16 Commits

Author SHA1 Message Date
nmlgc 97dce75446 [Maintenance] Proofread all comments in C land 2020-06-21 22:14:08 +02:00
nmlgc cea3ea6dc7 [Reverse-engineering] [th04/th05] Bullet structure
And since everyone always cares about caps:
• TH04: 240 for the white 8×8 pellets, 220 for 16×16 sprites
• TH05: 180 for the white 8×8 pallets, 240 for 16×16 sprites

Completes P0072, funded by [Anonymous] and -Tom-.
2020-02-16 21:32:30 +01:00
nmlgc 4bb04abb6f [Reverse-engineering] [th03] Player structure
Completes P0071, funded by KirbyComment and -Tom-.
2020-01-29 09:14:00 +01:00
nmlgc 765eae82e8 [Maintenance] [th05] Minimize #includes for the shot type translation units
Since a few annoying alignment bytes suggested more translation units
than previously expected, using many small headers has proved to be
better than one big shared TH04/TH05 header file. Or should we *really*
pepper the code with lots of `#pragma codestring`? 😛

And in case we have multiple translation units which all #include the
same set of headers, we'll just go with situational shared headers,
using a common prefix.

Part of P0062, funded by Touhou Patch Center.
2019-12-22 15:32:44 +01:00
nmlgc c5b07b746e [Maintenance] `#pragma once` has no effect?
Should have remembered this from all the times I've looked at the list
of #pragma directives supported by Turbo C++… Still, I would have at
least expected a warning, but not even the `ill` warning covers this.

Part of P0062, funded by Touhou Patch Center.
2019-12-22 15:31:24 +01:00
nmlgc 9cb6cc527a [Decompilation] Finally declare <stdint.h> types
*Finally*. We already used `(unsigned) int` in quite a few places where
we actually want a 16-bit value, which was bound to annoy future port
developers.
2019-12-17 23:26:58 +01:00
nmlgc 5f4f5d87dc [Decompilation] [th03] Shot update and render functions
Meh, can't overload arithmetic operators that take a Subpixel without
generating a needless load and store, even with -Z. But heck, slightly
uglifying subpixel/subpixel arithmetic is exactly the right trade-off.

Completes P0061, funded by Touhou Patch Center.
2019-12-05 21:41:31 +01:00
nmlgc 296f9f61c2 [Reverse-engineering] [th03] Playfield shaking
Which only applies to the set of sprites considered to be in the
foreground, so no EGC acceleration.

Part of P0061, funded by Touhou Patch Center.
2019-12-05 21:36:02 +01:00
nmlgc 4d3d6acd28 [Decompilation] Templatize subpixels to offer both 16-bit and 8-bit variants
Yup, TH03 actually uses a 4.4 fixed-point format.

Part of P0061, funded by Touhou Patch Center.
2019-12-05 21:27:53 +01:00
nmlgc bb6b0f1cc3 [Maintenance] Move the Subpixel class to a separate header, under TH03
Part of P0061, funded by Touhou Patch Center.
2019-12-05 21:21:56 +01:00
nmlgc 8b627803a3 [Position independence] Vector calls and variables
Raw, uninteresting position independence work. Or maybe not, given that
this was one of the few things that also apply to TH01, and reveal just
how chaotically this game was coded. And so we've got three ways that
ZUN stored regular 2D points: Regularly (X first, Y second), Y first
and X second, and multiple points stored in a structure of arrays…

Completes P0059, funded by [Anonymous] and -Tom-.
2019-11-18 22:24:24 +01:00
nmlgc db4de240e9 [Decompilation] Prepare the C side for the shot type control functions
That should make this convoluted copypasta a bit easier to read. And
sure, I could have done something about the loop as well, but
SHOT_FUNC_INIT already hides enough control flow behind a macro…

Part of P0037, funded by zorg.
2019-10-14 23:42:20 +02:00
nmlgc e65cf0d05d [Maintenance] Change a few ASM .inc files to use 8.3 names
Part of P0035, funded by zorg.
2019-09-24 21:58:18 +02:00
nmlgc 3b7561a711 [Maintenance] Export all pascal functions with their proper uppercase names
Yup, that was one massive screw-up.

Part of P0030, funded by zorg.
2019-09-15 20:29:47 +02:00
nmlgc 4b8baf1413 [Reverse-engineering] [th02/th03/th04/th05] Random number ring buffer
Yes, you're reading that correctly. If the cursor is at 255, reading a
16-bit value will fill the upper 8 bits with the neighboring cursor
value, which always is 0xFF.

Funded by -Tom-.
2018-03-16 18:12:21 +01:00
nmlgc 39c169c30d [Reduction] Separate functions for 1D and 2D vector construction
Look at that TH05 vector2_at_opt function. What the hell, the caller is
supposed to set up the stack frame for the function? How do you even get
a compiler to do this (and no, I haven't found a compiler switch)? No
way around writing a separate "optimizer" as part of the compilation
pipeline, it seems.
2017-01-08 21:01:13 +01:00