Commit Graph

8 Commits

Author SHA1 Message Date
nmlgc 9b28791c7f [Maintenance] [th03] Add a separate type for SPRITE16 sprite area offsets
Part of P0182, funded by Lmocinemod and [Anonymous].
2022-02-18 09:36:34 +01:00
nmlgc 84baa1d477 [Maintenance] Rename the `_FORCE_INT` enum members to indicate signedness
Part of P0116, funded by [Anonymous] and Lmocinemod.
2020-09-12 12:09:30 +02:00
nmlgc 50b17d640b [Reverse-engineering] [th03] SPRITE16 setup for double-buffered blitting
Part of P0114, funded by Lmocinemod.
2020-09-07 21:18:39 +02:00
nmlgc d6f634631f [Maintenance] Declare distinct types for pixel and VRAM sizes
Oh wait, we also need one of those for an upcoming structure!

Part of P0111, funded by [Anonymous] and Blue Bolt.
2020-08-28 14:53:33 +02:00
nmlgc 368f151759 [Maintenance] Declare distinct types for screen, VRAM, and TRAM coordinates
Whew, time to look at every `int` variable we ever declared! The best
moment to do this would have been a year ago, but well, better late
than never. No need to communicate that in comments anymore.

These shouldn't be used for widths, heights, or sprite-space
coordinates. Maybe we'll cover that another time, this commit is
already large enough.

Part of P0111, funded by [Anonymous] and Blue Bolt.
2020-08-28 14:53:30 +02:00
nmlgc ffad8cc897 [Build] Use the minimum possible size for enums by default
5 enums where code generation wants an `int`, vs. 11 cases where using
the minimum size is exactly the right default. So it's way more
idiomatic to force those 5 to 16 bits via a dummy element… except that
we can't give it a single, consistent name, because you can't redeclare
the same element in a different enum later.

Oh well, let's have this ugly naming convention instead, which makes it
totally clear that the force element not, in fact, a valid value of
that enum.

Part of P0085, funded by -Tom-.
2020-04-03 17:33:58 +02:00
nmlgc b6e0330ff6 [Decompilation] [th03] Sprite display calls
Yes, decompilation, of something that was so obviously originally
written in ASM. We're still left with two un-decompilable instructions
here, but I'm amazed at how nicely I was able to abstract away all of
the gory register details, leading to pretty clear, readable, and dare
I say *portable* code?! Turbo C++ was once again pretty helpful here:

• `static_cast<char>(_BX) = _AL` actually compiles into `MOV BL, AL`,
  as you would have intended,
• and no-op assignments like _DI = _DI are optimized away, allowing
  us to leave them in for clarity, so that we can have all parameter
  assignments for the SPRITE16 display call in a single place.

I love this compiler.

Part of P0060, funded by Touhou Patch Center.
2019-11-28 23:14:21 +01:00
nmlgc 2269d0c29c [Reverse-engineering] [th03] Playfield sprite clipping coordinates
Part of P0060, funded by Touhou Patch Center.
2019-11-28 23:12:10 +01:00