Commit Graph

2076 Commits

Author SHA1 Message Date
bismurphy
02e4c62f6a
Add display_animations.py tool for viewing entity animation frames (#1746)
This extends upon my work in display_texture.py. I have used this for
identifying a few entities already. display_texture is suited for
viewing prims, while this one is better for entities that are rendered
by RenderEntities.

I think there's enough documentation at the top of the function for
others to use it. Hopefully it can be helpful, especially as it evolves
over time.

At some point this could be converted to an editor in addition to a
viewer, but for now the viewing capability is the core focus.

Also rewrote some of DRA's sprite data (this should probably be in
sotn-assets though) to fit the standard format so that this tool could
parse the data.
2024-10-06 13:09:33 +01:00
Josh Schreuder
50b8135531
Decompile no0 func_us_801D51EC (#1751)
Some checks are pending
Format code / format (push) Waiting to run
Build C code / extract-assets (push) Waiting to run
Build C code / build-linux (push) Blocked by required conditions
Build C code / build-macos (push) Blocked by required conditions
Build C code / build-windows (push) Blocked by required conditions
Build C code / build-linux-lle (push) Blocked by required conditions
Build Saturn version / build-and-test-saturn (push) Waiting to run
Build Saturn version / function-finder-saturn (push) Waiting to run
Build Debug Module tool / build (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Waiting to run
Build PSX and PSP version / build-and-test (us, us) (push) Waiting to run
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Blocked by required conditions
PSX: https://decomp.me/scratch/7iP9H
PSP: https://decomp.me/scratch/yL9PD
2024-10-05 19:51:17 -07:00
Josh Schreuder
f4bd5ae19e
Decompile no0 func_us_801D4E30 (#1750) 2024-10-05 19:37:13 -07:00
Josh Schreuder
ed7cd94db8
Decompile no0 func_us_801D2318 (#1749) 2024-10-05 19:20:27 -07:00
Josh Schreuder
19750ae8fc
Dedupe no0 EntityRoomForeground (#1748) 2024-10-05 19:10:35 -07:00
H.M. Burger
5b717b4ec4
Importing remainder of ghost data (#1747)
Imported the remainder of the data.
2024-10-05 19:05:22 -07:00
Josh Schreuder
bc71a8940a
Decompile no0 func_us_801C3308 (#1733) 2024-10-05 18:57:35 -07:00
bismurphy
077578210e
Document some stuff with Entrance lightning (#1745)
Some checks are pending
Format code / format (push) Waiting to run
Build C code / extract-assets (push) Waiting to run
Build C code / build-linux (push) Blocked by required conditions
Build C code / build-macos (push) Blocked by required conditions
Build C code / build-windows (push) Blocked by required conditions
Build C code / build-linux-lle (push) Blocked by required conditions
Build Saturn version / build-and-test-saturn (push) Waiting to run
Build Saturn version / function-finder-saturn (push) Waiting to run
Build Debug Module tool / build (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Waiting to run
Build PSX and PSP version / build-and-test (us, us) (push) Waiting to run
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Blocked by required conditions
Mostly just some light renaming.

I used my new entity animation viewer to figure out what this function
was, it's a very subtle cloud effect that would have been hard to
identify otherwise.

The driving factor for this was removing ext.generic from this entity,
which is also complete.

This applies to both NO3 and NP3.
2024-10-05 22:51:28 +01:00
bismurphy
9ce2a3fbf6
Rework sotn-assets animation pointers (#1742)
I was reviewing some of the animations pulled out by sotn-assets.
Speicfically, I found that in `src/st/no3/sprite_banks.h` (a file
created by sotn-assets locally, which does not exist directly in this
repo), we have:

```
extern s16* sprites_no3_0;
extern s16* sprites_no3_1;
extern s16* sprites_no3_2;
extern s16* sprites_no3_3;
extern s16* sprites_no3_4;
extern s16* sprites_no3_5;
extern s16* sprites_no3_6;
extern s16* sprites_no3_7;
extern s16* sprites_no3_8;
static s16* spriteBanks[] = {
    0,
    &sprites_no3_0,
    &sprites_no3_3,
    &sprites_no3_1,
    &sprites_no3_2,
    &sprites_no3_4,
    &sprites_no3_5,
    &sprites_no3_6,
    &sprites_no3_7,
    &sprites_no3_8,
```

However, those are not the right pointer types. `sprites_no3_#` should
have a type of `s16* []`, so I reworked the sotn-assets tool to use the
right pointers for each of these things. Now the sprite_banks.h file
looks like:
```
extern s16* sprites_no3_0[];
extern s16* sprites_no3_1[];
extern s16* sprites_no3_2[];
extern s16* sprites_no3_3[];
extern s16* sprites_no3_4[];
extern s16* sprites_no3_5[];
extern s16* sprites_no3_6[];
extern s16* sprites_no3_7[];
extern s16* sprites_no3_8[];
static s16** spriteBanks[] = {
    0,
    sprites_no3_0,
    sprites_no3_3,
    sprites_no3_1,
    sprites_no3_2,
    sprites_no3_4,
    sprites_no3_5,
    sprites_no3_6,
    sprites_no3_7,
    sprites_no3_8,
```

Which more accurately represents the data within.

Naturally, since this PR mostly just changes the tool, the real changes
are in the tool's output, so feel free to clone this branch and
investigate the sprite_banks.h file if you want to see anything further
about it.

DRA's equivalent of the SpriteBanks array is `D_800A3B70`, and is
currently in the repo as extracted data, without using `sotn-assets`;
this PR makes it so the types in the overlays (which do use
`sotn-assets`) will match the types in DRA.
2024-10-05 21:28:16 +01:00
Aleksandr Shabelnikov
a979d90d9a
NO0: Some deduplications (#1741) 2024-10-05 19:24:11 +01:00
bismurphy
1c1e838d92
Decompile NO3 EntityBackgroundLightning (#1739)
Nice to get more progress in our "old" stages on those last few
difficult functions.

At the end of this function there is a little switch block which
switches around some SFX; this informed me that D_80097910 holds SFX, so
I went back through the repo for other uses of this variable and made it
use SFX enums. This variable appears to hold the SFX ID for the current
background music. Maybe it deserves a name, but I don't want to turn
this PR into too much of a mess of doing different things.
2024-10-05 15:44:42 +01:00
Aleksandr Shabelnikov
57e8245a2e
NO0: decompile func_us_801CC8F8 (#1728) 2024-10-05 14:53:41 +01:00
Josh Schreuder
755675bf5f
Dedupe no0 e_particles (#1736) 2024-10-05 14:09:48 +01:00
Josh Schreuder
f2e3902b5b
Dedupe no0 UpdateStatueTiles (#1735) 2024-10-05 13:44:13 +01:00
Josh Schreuder
6cb2e58fc1
Decompile no0 func_us_801DC754 (#1734) 2024-10-05 13:43:14 +01:00
bismurphy
88134dba3c
More entity cleanup: ET_Generic, renaming, and some Animset improvements (#1723)
This is doing a few different things; I'm sort of finding issues and
fixing them one by one. I've found more, but don't want this PR to get
too bloated.

1) Removal of more uses of ET_Generic, and eliminating a few of its
members

2) Renaming EntityUnk15 to EntityGreyPuff

3) Reworking Animset data. It's s16, not u32, so the data in d_2F324.c
has been adjusted to match that.
2024-10-05 12:37:48 +01:00
Josh Schreuder
b696848c5a
Dedupe some functions in no0 e_collect (#1732)
Some checks are pending
Format code / format (push) Waiting to run
Build C code / extract-assets (push) Waiting to run
Build C code / build-linux (push) Blocked by required conditions
Build C code / build-macos (push) Blocked by required conditions
Build C code / build-windows (push) Blocked by required conditions
Build C code / build-linux-lle (push) Blocked by required conditions
Build Saturn version / build-and-test-saturn (push) Waiting to run
Build Saturn version / function-finder-saturn (push) Waiting to run
Build Debug Module tool / build (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Waiting to run
Build PSX and PSP version / build-and-test (us, us) (push) Waiting to run
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Blocked by required conditions
2024-10-04 22:27:18 -07:00
H.M. Burger
7752094c15
Importing tt_001 animation data (#1731)
Adding animation frame data to tt_001
Renaming file to animationdata for tt_000
2024-10-04 22:20:07 -07:00
H.M. Burger
4d2ccaac2b
Importing tt_001 clut data (#1730)
Again, data is shared with tt_000, so I merged that into a shared
header.
2024-10-04 21:11:15 -07:00
H.M. Burger
4282ac221e
Importing tt_001 data spriteparts (#1729)
Spriteparts data is the same between bat and ghost, so I moved them to a
shared header.
If they are different than other familiars, we'll have to rename the
shared header.
2024-10-04 20:57:04 -07:00
H.M. Burger
bc549c75e6
Small refactor for servant update (#1727)
A small refactor renaming a global variable for when the cutscene has
control of the engine.
In servant, it short cuts the main update function so that your familiar
isn't doing stuff while a cutscene is running.
Also some flag cleanup.

I've figured out quite a bit with the functions and how they are called.
It looks like most of the functions in ServantDesc are actually update
functions called by using the entityId as an offset. I want to update to
make that more clear, but I want to isolate that into it's own PR and I
already had this refactor in flight.
2024-10-04 20:52:23 -07:00
Josh Schreuder
f647b0c26b
Rename g_Player.unk0 to g_Player.status (#1721)
As discussed in
https://github.com/Xeeynamo/sotn-decomp/pull/1709#issuecomment-2386396310
2024-10-04 20:03:16 -07:00
Jonathan Hohle
c1b36a1029
Map HD CEN's e_particles and create_entity (#1726)
Some checks are pending
Format code / format (push) Waiting to run
Build C code / extract-assets (push) Waiting to run
Build C code / build-linux (push) Blocked by required conditions
Build C code / build-macos (push) Blocked by required conditions
Build C code / build-windows (push) Blocked by required conditions
Build C code / build-linux-lle (push) Blocked by required conditions
Build Saturn version / build-and-test-saturn (push) Waiting to run
Build Saturn version / function-finder-saturn (push) Waiting to run
Build Debug Module tool / build (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Waiting to run
Build PSX and PSP version / build-and-test (us, us) (push) Waiting to run
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Blocked by required conditions
And fix some segment offsets.
2024-10-04 14:49:52 -07:00
H.M. Burger
87c23d5cca
Refactoring Servant init code (#1720)
Some checks failed
Format code / format (push) Has been cancelled
Build C code / extract-assets (push) Has been cancelled
Build Saturn version / build-and-test-saturn (push) Has been cancelled
Build Saturn version / function-finder-saturn (push) Has been cancelled
Build Debug Module tool / build (push) Has been cancelled
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Has been cancelled
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Has been cancelled
Build PSX and PSP version / build-and-test (us, us) (push) Has been cancelled
Build C code / build-linux (push) Has been cancelled
Build C code / build-macos (push) Has been cancelled
Build C code / build-windows (push) Has been cancelled
Build C code / build-linux-lle (push) Has been cancelled
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Has been cancelled
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Has been cancelled
Build PSX and PSP version / generate-progress-report (us, us) (push) Has been cancelled
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Has been cancelled
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Has been cancelled
Lots of cleanup here to make the code easier to read.

1. Adding CLUT index defines to avoid magic numbers
2. Adding InitializeMode enum and hooking that up
3. Updating function names for servant init
4. Cleaning up magic numbers used in tt_000 init function

I wanted to add a enum for the EntityId, but both servants share 0xD1.
Looking at the other EntityIDs definitions, there seems to be some
crossover, but it also looks like they may be partly unique across the
different binaries. Probably need more study to figure out how to unify
them (or if it's even possible to unify).

We also may want to look at splitting enum definitions and defining
flags/fixed values into some sort of enum file structure. Having them
all in game.h is making a large file. But we would obviously not want to
fracture the codebase more. Either way, that's way beyond the scope of
what I wanted to do here.
2024-10-03 14:19:11 -07:00
sozud
a1c00767ea
More HD CEN dedupes (#1725) 2024-10-03 11:11:05 -07:00
Aleksandr Shabelnikov
c29c0c6fe8
NO0: deduplication of prim_helpers and popup functions (#1724) 2024-10-03 10:29:45 -07:00
Josh Schreuder
2fe2e117f3
Set some Entity flags to enum values (#1722) 2024-10-03 09:22:33 -07:00
sozud
b6152f5ac8
HD CEN DestroyEntity EntityPrizeDrop (#1718) 2024-10-02 18:04:22 -07:00
sozud
c90cbfaebe
CEN HD CollectHeartVessel/CollectLifeVessel (#1717) 2024-10-02 17:36:30 -07:00
Aleksandr Shabelnikov
6903e8f2bf
Decompile tt_001 func_us_801720E4 (#1713) 2024-10-02 17:26:40 -07:00
sozud
332acfe69a
CEN HD CollectHeart CollectGold (#1716) 2024-10-02 16:09:21 -07:00
sozud
a305fef935
Dedupe PrizeDropFall2 (#1715) 2024-10-02 22:39:01 +01:00
sozud
1117ef0af1
Dedupe PrizeDropFall (#1714)
Progress towards fixing CEN HD
2024-10-02 20:10:44 +01:00
bismurphy
eff7109db4
Move unkB8 out of Ext and into Entity (#1706)
Improved PR compared to #1704 .

We decided that unkB8 shouldn't be part of the Ext since it appears to
apply to all entities.

Also discovered some issues with the ET_GurkhaHammer struct, so resolved
those as well.

Now all accesses to the unkB8 offset go directly to `self->unkB8`.

Unrelated to all this unkB8 stuff, I found that there was an extra C
file in DRE which was not being used. Its code had been moved to
succubus.c, and it looks like the original file was accidentally left in
place. I deleted it here.
2024-10-02 19:16:52 +01:00
Josh Schreuder
939fd7daca
Decompile tt_001 func_us_80171284 (#1712)
PSX: https://decomp.me/scratch/APOek
PSP: https://decomp.me/scratch/T9RKT

Had do some some kinda ugly ifdef PSP stuff here as there is some
differences between the two.
2024-10-02 11:10:35 -07:00
H.M. Burger
ed33e90bd2
Decompiling tt_001.func_us_8017246C (#1711)
Accurate for PSX and PSP

PSP scratch: https://decomp.me/scratch/lZHti

Some of these global variables I've figured out, but I am planning on
doing a refactor of tt_001 next and will rename the vars there.
2024-10-02 11:04:56 -07:00
Jonathan Hohle
11631e1475
Add CEN Overlay to HD (#1705)
Adds the CEN overaly to the HD version of the game.

Resolves #1638.

This uses most, but not all, matching functions. Some were excluded
because due to symbols mapping that has not bee completed yet.

Not all data has been imported, and mapping symbols, and data should
make many of the remaining functions easy to import.
2024-10-01 22:31:18 -07:00
Josh Schreuder
b9d7e3fd57
Use player status flags where possible (#1709)
There's some cases which don't nicely map to the defines in place so
I've left as is

-
cf280c66f5/src/st/dre/succubus.c (L583)
- is this a mask like these?
https://github.com/search?q=repo%3AXeeynamo%2Fsotn-decomp%20PLAYER_UNK0C_READY_MASK&type=code
2024-10-01 17:23:24 -07:00
Aleksandr Shabelnikov
b9f02684ee
Overlay NO0: Deduplicate and split collision data (#1710) 2024-10-01 11:46:56 -07:00
Onenutmcgee
74ce2c49b8
Decompiling function tt_001.func_us_80171624 (#1708) 2024-10-01 09:04:45 -07:00
Onenutmcgee
646cc181cb
Various cleanup to match PSP decomp (#1707)
Ran my code for this function against the PSP assembly and fixed a bunch
of places where it didn't match.

It's pretty close now, but still missing a bit. I think it's mostly
around the number of parameters and the number of temp variables as it's
mostly all in the stack push/pop.

Also removing unnecessary casts.

Scratch
https://decomp.me/scratch/0Gm3x
2024-10-01 08:52:34 -07:00
Aleksandr Shabelnikov
cf280c66f5
Overlay NO0: Deduplicate and split st_update data (#1703)
Co-authored-by: SynaMax <djsynamax@gmail.com>
2024-09-30 16:56:38 -04:00
bismurphy
80d9bd8cc5
Refactor some stuff with subweapons (#1702)
Primary goal here was to eliminate `ext.generic.unkB0`. It turns out
that the only entity that reaches up into this unkB0 region is the
Subweapon entity.

I went through and changed these all to `ext.subweapon.subweaponId`, but
also did some analysis on all the uses to make sure this was an accurate
change to make.

Other highlights:

- Naming CheckSubwpnChainLimit and its RIC counterpart
- Moving the RIC version of that function to the next file, split makes
more sense this way.
- Made both versions of that function `static`
- renamed subweapondef's unk6 to be chainLimit
- Changed g_unkGraphicsStruct.unk0 to be called `pauseEnemies`. It's
true when the stopwatch subweapon is used, and in cutscenes. Found this
due to looking at the stopwatch subweapon setting this value. Also made
it a bool since it's only ever used as a bool.
- Added some playersteps enum uses where they were still using hex
values
- Studied RicEntityStopwatchCrashLightning in order to give it that name

I think that's about it. Overall just some modest cleanup, but continues
to make the game code more readable.
2024-09-30 21:19:51 +01:00
Onenutmcgee
3561526801
Decompile-func_us_80171864 (#1692)
Decompilation of func_us_80171864
Adding ET_Ghost for the Entity.ext union.

Thanks to @sozud for setting up a PSP environment for me.
Thanks to @joshlory for figuring out the last bit.
2024-09-29 21:27:15 -07:00
bismurphy
2e4ebb994e
Add NO0 (Marble Gallery) overlay (#1691)
This adds this overlay to the project.

Importantly, we use a new tool (tools/auto_dedupe_new_overlay) to
process the new overlay and automatically split its C files according to
known duplicate files. As of now, this does not do any decompiling (the
whole overlay is kept as INCLUDE_ASM), but it automatically does all the
file splits and code copying needed. Hopefully this reduces some amount
of duplicated work.

To be clear, this new script is not in any build chain, but is meant to
be used after `make-config` to take the overlay from being a single
giant lump of `us.c` to being individual files, for the sake of easier
deduplicating. It will likely need some revision for future overlays,
but at least it should be a good start toward reducing tedious work.

I'll leave this overlay in place like this for about a week in case
there are any newcomers who would like to try de-duplicating some of
these files and decompiling the new functions; after that week I'll get
into doing things myself.
2024-09-30 00:53:54 +01:00
bismurphy
ac5a03cf4d
Rewrite EntityHolyWater (#1700)
Main motivation here was to eliminate `ext.generic.unkB2`, which no
longer exists and has been removed from the struct. While I was at it, I
modernized the holy water function.

The argument is "self" instead of "entity"

We use FIX() where relevant

Function is adjusted to match on PSP

Variables are renamed

Factory calls are commented

I think those are the main highlights. Mostly small stuff, but
everything comes step by step.
2024-09-29 19:14:53 +01:00
Luciano Ciccariello
04b5019374
Cutscene data and better names (#1698)
Minor follow-up to #1686 . I couldn't de-fake the g_Dialogue symbols in
ST0 like I did with `src/st/dre/bss.c` due some functions that are not
yet fully decompiled.
2024-09-29 17:23:07 +01:00
bismurphy
49de0e3200
Refactor EntityFireWarg in NO3 (#1699)
Various small cleanups on this function.

In the past it was EntityStrongWarg, but I found that this is actually
the Fire Warg.

It is unused in NO3, but is used in RNO3.

Also removed a Multi that was being used that applied across two
different entities.

Various comments, cleanups, renamings, etc
2024-09-29 16:57:56 +01:00
Josh Schreuder
5915b2f2f0
Decompile tt_001 func_us_80170F84 (#1696)
PSX: https://decomp.me/scratch/7RyGs
PSP is not being built currently but should match once that's done too:
https://decomp.me/scratch/Nbn5X

I've called this one `UpdateEntityVelocityTowardsTarget` based on what
it appears to be doing
2024-09-29 15:15:44 +01:00
Josh Schreuder
5c287ce528
Deduplicate tt_000 tt_001 SFX function (#1695)
Thought this was going to be more work as duplicate report had it at 93%
and with a jump table, as it turns out I think they're the same besides
a single global memory address
2024-09-29 15:13:53 +01:00