Commit Graph

1234 Commits

Author SHA1 Message Date
nmlgc 05c00287e9 [Decompilation] [th01] HUD: Initial score and card combo rendering
Hey look, this one *does* only render to a single page, and then blits
the area to the other one! Using an unnecessary new function that isn't
even EGC-accelerated…

Completes P0103, funded by Ember2528.
2020-07-27 17:17:22 +02:00
nmlgc b9038be04d [Decompilation] [th01] HUD: Current score and card combo rendering
Part of P0103, funded by Ember2528.
2020-07-27 17:13:35 +02:00
nmlgc b73762ba12 [Decompilation] [th01] HUD: Maximum card combo rendering
Nice and consistent…

Part of P0103, funded by Ember2528.
2020-07-27 17:12:21 +02:00
nmlgc f92c2a637c [Decompilation] [th01] HUD: High score update/render function
The scores are rendered to *both* VRAM pages…? Which means that we
need a separate set of sprites to store the background behind the
numbers. This does not bode well for animated backgrounds…

Part of P0103, funded by Ember2528.
2020-07-27 17:11:43 +02:00
nmlgc 57a2294f7a [Maintenance] Add a Planar<> template for any type of 4-plane value
Part of P0103, funded by Ember2528.
2020-07-27 17:10:00 +02:00
nmlgc 91ff008140 [Maintenance] Define the number of score digits in a consistent place
Even if that place is a one-line header file…?

Part of P0103, funded by Ember2528.
2020-07-27 17:09:07 +02:00
nmlgc 287687b9f4 [Position independence] master.lib Sin8() and Cos8() macros
I'm expecting no PI gains at all from this push, so here's some
quick low-hanging fruit instead.

Part of P0103, funded by Ember2528.
2020-07-27 17:03:59 +02:00
nmlgc b60f38d42d [Decompilation] [th01] Pellets: Delay cloud unblit/update/render function
And with that, we're actually *done* with TH01 pellets, and never have
to look at them again! 🎉

Completes P0102, funded by Yanga.
2020-07-12 16:45:53 +02:00
nmlgc dbc8da99d5 [Decompilation] [th01] Pellets: Player collision
How optimized is TH01? Well, since the player Y is constant, checking
for Y ≥ 368 first would rule out a collision for the majority of
entities during gameplay after just 1 check.

TH01 still checks X first.

Part of P0102, funded by Yanga.
2020-07-12 16:35:31 +02:00
nmlgc 5735c1622e [Decompilation] [th01] Pellets: Reset and decay functions
Or, in more relevant news: That's the function that forced TH01's
pellet sprites to be defined in C land. First sprite to make that jump.

Part of P0102, funded by Yanga.
2020-07-12 16:34:16 +02:00
nmlgc 63dafdb9c7 [Decompilation] [th01] Pellets: Unblit/update/render function
… pellet unblitting uses a *doubly* sloppy 16×8 rectangle. 🤦
The resulting terrible flickering is probably why the Stage 15 and 20
battles enable this weird "interlace" mode that only renders and
hit-tests half of the pellets each frame… except that player shots
are still hit-tested every frame?
So yeah, your eyes aren't deceiving you, the game does effectively drop
its perceived frame rate in the Elis, Kikuri, Sariel, and Konngara
fights, and it does so deliberately.

And *then* you realize that those weird hit tests are actually a
futile attempt to mitigate the disastrous effects of a way too large
unblitting rectangle. Congratulations, you've found the most stupid
piece of code in this game.

Part of P0102, funded by Yanga.
2020-07-12 16:29:51 +02:00
nmlgc d840841a2b [Naming] Rename egc_copy_rect_1_to_0() to emphasize its 16-dot alignment
ZUN might have gotten the impression that the EGC can *only* work with
multiples of 16 pixels per load or store? Which might explain why…

Part of P0102, funded by Yanga.
2020-07-12 16:27:56 +02:00
nmlgc edb70162e0 [Decompilation] [th01] Pellets: Manager class constructor
Note how Turbo C++ auto-generates that call to `operator new`, which
you don't see in the decompilation anymore. So yeah, as soon as you add
a constructor, Turbo C++ enforces heap allocation for any instance of
that class, even function-local ones that would otherwise be
stack-allocated.

That's where the bad reputation of C++ comes from, I guess?

Part of P0102, funded by Yanga.
2020-07-12 16:23:12 +02:00
nmlgc c11a95666b [Decompilation] [th01] Pellets: Shot/Orb/deflecting player collision
First off: 👏 Just 👏 pass 👏 a 👏 reference 👏 to 👏 the 👏
currently 👏 iterated 👏 pellet 👏 if 👏 you 👏 need 👏 to 👏
modify 👏 it 👏
Second: Don't we hit-test pellets vs. shots already, in the CShots
class? So what is this garbage…?!

Completes P0101, funded by Yanga and Ember2528.
2020-07-12 16:21:17 +02:00
nmlgc b422618ca7 [Position independence] [th01] Pellets: Spawn function calls
Again, separate commit, because it's a lot! Got almost 5% more
position independence just from their parameters.

Part of P0101, funded by Yanga and Ember2528.
2020-07-12 16:19:18 +02:00
nmlgc 8328905f46 [Decompilation] [th01] Pellets: Multi-pellet patterns
Actually quite cute with their hardcoded limitations, since the created
patterns do follow a clear logic.
But yeah, no 6-way spreads for you, we only support 2-, 3-, 4-, and
5-way ones here :zunpet:

Part of P0101, funded by Yanga and Ember2528.
2020-07-12 16:15:24 +02:00
nmlgc ceb81db49c [Decompilation] [th01] Pellets: Spawn functions
Completes P0100, funded by Yanga.
2020-07-12 16:14:01 +02:00
nmlgc 8f33b9717c [Decompilation] [th01] Pellets: Motion types
Look, an unused pellet motion type! Which doesn't work as intended
thanks to no fewer than 3 ZUN bugs in one single if() expression.

Part of P0100, funded by Yanga.
2020-07-12 16:13:33 +02:00
nmlgc 2fdaa35535 [Reverse-engineering] [th01] Pellets: Manager class
A 4227-byte structure, with 100 pellet_t instances followed by a few
other data members. A textbook example of why you can't just quickly
get full position independence by parsing individual lines of ASM.

Part of P0100, funded by Yanga.
2020-07-12 16:06:36 +02:00
nmlgc 1b25830786 [Reverse-engineering] [th01] Pellets: Single pellet structure
Completes P0099, funded by Ember2528.
2020-07-12 16:03:19 +02:00
nmlgc 2d0b4a5b06 [Maintenance] Add generic overlap test macros for collision detection
Part of P0099, funded by Ember2528.
2020-07-12 16:02:04 +02:00
nmlgc a207d6a494 [Decompilation] Add screen-space assignment overloads for Subpixels
Also great news for those people who want to remove any and all C++ in
their mods, because this forces us to spell out subpixel literals as
actual floats, every time. And with that, you're back to being able to
simply search-replace for all the instances you'll have to change.

Part of P0099, funded by Ember2528.
2020-07-12 16:00:59 +02:00
nmlgc f0baf27c04 [Reverse-engineering] [th01] REIIDEN.CFG variables in REIIDEN.EXE
Part of P0099, funded by Ember2528.
2020-07-12 16:00:09 +02:00
nmlgc e3a78bd19b [Maintenance] Fix vector creation function declarations and calls
Part of P0099, funded by Ember2528.
2020-07-12 15:22:50 +02:00
nmlgc 8f8940801d [Maintenance] Move the Subpixel class to TH01
At least pellets are moved at a decent precision in this game.

Part of P0099, funded by Ember2528.
2020-07-12 15:16:03 +02:00
nmlgc 3e3129567c [Decompilation] [th01] Pellet delay cloud blitting and unblitting
And immediately, we discover another two hardcoded sprites, with, of
course, another set of functions for blitting and unblitting them…

Part of P0099, funded by Ember2528.
2020-07-12 15:15:05 +02:00
nmlgc f612c40dce [Maintenance] Move generic VRAM macros from REIIDEN.EXE's PTN code to planar.h
C++ templates would be *so nice* here, but code generation… 😢

Part of P0099, funded by Ember2528.
2020-07-12 15:08:38 +02:00
nmlgc 1799d67782 [Build] Convert all known hardcoded sprites during the 32-bit build part
You can now mod them by simply editing .BMP files!
2020-07-09 22:28:15 +02:00
nmlgc c9eef45724 [Maintenance] Fix inconsistencies in sprite declarations 2020-07-09 22:28:14 +02:00
nmlgc 42c66117b5 [Build] Compile bmp2arr as a 32-bit binary 2020-07-09 22:28:14 +02:00
nmlgc 8cbaaf0b45 [Build] Add a dependency on Borland C++ 5.5 for the 32-bit build part
Yup. Lengthy justification and official download link in the README.
It's also been added to the DevKit.
2020-07-09 22:28:13 +02:00
nmlgc 6529cc970e [Readme] Explain the rationale behind all required build tools 2020-07-09 22:28:13 +02:00
nmlgc cda4c618aa [Readme] Fix the mzdiff link 2020-07-09 16:31:01 +02:00
nmlgc dfc153ccaa [Pipeline] Merge Jonathan Campbell's sprite converter
Original code at

	https://github.com/joncampbell123/doslib/tree/master/tool/rec98/touhou

Thanks a lot! Almost completes issue #8.
2020-07-09 13:14:44 +02:00
Jonathan Campbell 3e0f8286df [Pipeline] bmp2arr: use malloc/free in a way that would make C++ compilers and their type checking happy 2020-07-09 00:39:06 -07:00
Jonathan Campbell 86c4d541a8 [Pipeline] bmp2arr: __BORLANDC__ and __TURBOC__ case 2020-07-09 00:37:00 -07:00
Jonathan Campbell 44b0313b38 [Pipeline] bmp2arr: write_sprite inner function should be private 2020-07-06 15:16:05 -07:00
Jonathan Campbell 2e4d0b3b8f [Pipeline] bmp2arr: conversion to lib finish 2020-07-06 15:14:50 -07:00
Jonathan Campbell feba961470 [Pipeline] bmp2arr: begin moving to lib 2020-07-06 15:09:42 -07:00
Jonathan Campbell 7afb28dc06 [Pipeline] bmp2arr: Follow MSVC 1.5 warnings 2020-06-27 17:42:55 -07:00
Jonathan Campbell bd7e028609 [Pipeline] bmp2arr: Complete changes. I can now compile bmp2arr.c using Microsoft Visual C++ 1.5 (the 16-bit compiler) 2020-06-27 17:39:45 -07:00
Jonathan Campbell e1e8be3d0d [Pipeline] bmp2arr: Try to work for Borland C and Microsoft C++ 2020-06-27 17:36:46 -07:00
Jonathan Campbell 80a1c99318 [Pipeline] bmp2arr: Remove OMF 2020-06-27 17:17:52 -07:00
Jonathan Campbell 2ac9e7c970 [Pipeline] bmp2arr: preshift grouping 2020-06-26 20:16:32 -07:00
Jonathan Campbell c3b46f6e5d [Pipeline] bmp2arr: Fix C commas 2020-06-26 20:14:35 -07:00
Jonathan Campbell 00da4aa422 [Pipeline] bmp2arr: preshift for sparks, begin 2020-06-26 20:12:46 -07:00
Jonathan Campbell 6485b8c88d [Pipeline] bmp2arr: Fix preshift, do not use data from sprite following the current 2020-06-26 19:58:50 -07:00
Jonathan Campbell 54288cfe60 [Pipeline] bmp2arr: preshift BMP 2020-06-26 19:51:02 -07:00
Jonathan Campbell 1ff658c307 [Pipeline] bmp2arr: more preshift 2020-06-26 19:50:09 -07:00
Jonathan Campbell d857f579e2 [Pipeline] bmp2arr: Begin preshift 2020-06-26 19:43:12 -07:00