Commit Graph

60 Commits

Author SHA1 Message Date
sozud
3ad9c50b71
Document some sfx variables (#1533) 2024-08-18 01:49:32 -07:00
SynaMax
2bfd6cb6f9
Updated sfx script symbols (#1528) 2024-08-16 23:25:36 -07:00
SynaMax
8fe46d2b87
g_SfxAttackGrunts, g_SfxPainGrunts, and sfxID enum up to 0x668 (#1491)
Thanks to @joshlory for figuring out these tables in #1403.
2024-08-08 19:12:58 -07:00
SynaMax
b5429e0ae8
More SFX reference updates (#1488)
I think we're all caught up with the current sfx enum so the next PR
will have some new sfx IDs added.
2024-08-08 15:55:29 -07:00
SynaMax
e34f2c3ada
Added MAD and e_red_door SFX (#1482)
By looking at how the gold pickup sfx are handled using `#ifdef`, I
chose to do the same thing here with swapping the sfx references in
`e_red_door.h`.

`SFX_METAL_CLANG_E` is the only sound effect that seems to be the same
between MAD and the final collision handler.
2024-08-07 19:07:29 +01:00
SynaMax
455a97c9e8
Major SFX reference update (#1479)
We've hit the first beta sound ID `0x640`, which is the old door open
sound effect (final is `0x642`). How do we want to implement the beta
sfx IDs in the enum?
2024-08-06 13:41:09 -07:00
bismurphy
e44d51186b
Decompile Iron Shield func_ptr_80170024 (#1475)
Most important note on this one is that it uses the 0xA0 entity offset.
We already had `shield.unkA0` being used in a different shield. However,
on this shield it's accessed as a half-word, while the other one
accesses as a word.

I looked into it a bit, and realized that the other shield uses it as a
change in Y velocity, and ET_Weapon already uses 0xA0 as an
accelerationY. Therefore, I changed that shield to use ext.weapon for
that entry, and this allows us to change Shields to use 0xA0 as a
halfword.

In general, it looks like shields use a mix of the normal ET_Weapon and
the specific ET_Shield. Maybe we can work out what's what at some point
in the future, especially once all the weapons are done and we can start
truly digging into the purpose of every unkXX value in there.
2024-08-04 20:05:50 -07:00
SynaMax
22d3bc5ad3
Added and updated SFX references (#1469)
Stopping at 0x633 (`SFX_UI_SELECT`) for now, but will continue to add
and update more sfx references soon.

So far we have 51 out of a potential 736 sfx IDs (`0x8E0` - `0x600`).  

For what it's worth, the last valid sound ID I have listed in my
spreadsheet is `0x8D2` found in `DRA`, `RIC`, `BO4`, `BO6`, and `RBO5`
so the actual number might be 722 enum IDs, but we'll see what happens
since the last sfx group in the list belongs to vabid 3.
2024-08-03 11:50:03 -07:00
SynaMax
8bdde29673
More SFX additions to enum (#1468)
I decided to rename `SFX_SKULL_HIT` to `SFX_METAL_CLANG`, as well as
`SFX_SWORD_SWISH` to `SFX_WEAPON_SWISH`.

These are more generic names that better match up with the actual sound.
While `SFX_SWORD` is mainly used for sword weapon cues, it is used for
other weapon entities so I renamed it.

Same idea also applied to `METAL_CLANG`; it's mainly used for the CGI
spinning Stone Skull enemies but it also shows up in CEN as an elevator
sound cue.

I also used `SFX_RIC_RSTONE_TINK` as an abbreviation for the Rebound
Stone "tink" sfx, to help keep these names short.
2024-08-02 18:58:30 -07:00
bismurphy
50f5ad9dca
Decompile Herald Shield EntityWeaponShieldSpell (#1464)
Nothing super special, pretty similar structure to some other shield
spells.
2024-08-02 09:25:32 +01:00
SynaMax
1eceab45db
More SFX added to enum (#1465)
Slowly adding more sounds and updating all the references in the
codebase.
2024-08-02 09:24:13 +01:00
SynaMax
e0647f9ade
Added SFX enum and SFX_RIC_WHIP_RATTLE_A (#1458)
Starting off with something simple. Per
[sozud](https://github.com/sozud)'s suggestion in #1441 , I put in a new
enum for sounds. There's only one reference to Richter's whip sound in
the codebase so far. According to my research, BO6 and RBO1 reference
this ID as well.

There's several other whip rattle sounds (0x603-0x606) immediately
following the commonly heard 0x602 cue. Unless BO6 or RBO1 uses random
sound calls (like Alucard's randomized grunts), I don't believe these
are referenced in the game and are unused.
2024-08-01 07:49:36 -07:00
bismurphy
3491326b00
Decompile Dark Shield func_ptr_80170024 (#1453)
Yet another one, seems many of these shields are padding out the struct
as we go since we now have an unkA0.
2024-07-29 13:36:48 -04:00
bismurphy
93c51db4fd
Decompile Shaman Shield EntityWeaponShieldSpell (#1448)
Alucard/Alucart shields are done, next is Shaman Shield. Lots of these
shield spells are very similar.
2024-07-28 07:37:33 -04:00
Josh Lory
a473a1fed0
More weapon funcs (#1443)
Includes:

* [func_ptr_80170004_w_010](https://decomp.me/scratch/SH0iK)
* [func_ptr_80170008_w_043](https://decomp.me/scratch/LeMEl)
* [EntityWeaponAttack_w_045](https://decomp.me/scratch/4oeHu)
2024-07-27 15:26:32 -04:00
Josh Lory
42107e8bb8
Various weapon pointer funcs (#1442) 2024-07-26 21:32:40 -04:00
bismurphy
12f8f7149d
Decompile w58 (Alucart Shield) Shield Spell (#1439)
This modifies a variable at 0x80097420, I noticed that was in the
g_UnkGraphicsStruct, so I went through all the uses of that variable and
made them all use the struct.
2024-07-26 19:13:51 +01:00
bismurphy
4b425c4cd0
Decompile RIC func_8015A9B0 (#1438)
This finishes RIC.

Very similar to the most recent DRA function 80115394, so noted that
here.
2024-07-26 12:29:12 -04:00
SynaMax
e81fbf3ca1
SFX defines for Karma Coin (#1423) 2024-07-26 08:44:27 -04:00
Josh Lory
3e7c376143
Decompile DRA EntityStopWatch (#1383)
PSX: https://decomp.me/scratch/eMQyN
PSP: https://decomp.me/scratch/1Ktyt
2024-07-12 00:32:13 -07:00
Josh Lory
d756e28f77
Use SFX constants (#1403)
Open to suggestions for how to break this change up to make it easier to
review. The data extraction necessary for naming values in `D_800ACF60`
and `D_800ACF84` could be a separate commit... but I'm not sure it's
worth it.
2024-07-11 10:03:39 -07:00
bismurphy
86af165e69
Decompile NP3 TestCollisions (#1186)
Well here we are, TestCollisions matching!

I'm going to start with this one, and once it's in, I will follow up by
de-duplicating it.

Please review this closely, especially the changes that are happening in
other files than the main C file.

I suspect we will learn a lot from studying this function; I've already
made some changes (including to the Entity struct) but there will surely
be more.

Nice that this was possible with only two `goto` statements.

I expect a fair bit of revision here, especially related to any
enums/defines I might not be aware of. Please be liberal with comments
:)
2024-05-26 20:30:40 -04:00
Luciano Ciccariello
0b9e94c4d3
EntityRedDoor matching (#1167)
Another One Bites the Dust

It matches 1:1 with the PSP counterpart too:
https://decomp.me/scratch/z1VlU
2024-05-24 19:41:07 +01:00
Luciano Ciccariello
15865c38ba
Completes w_051 (#1122)
All the stuff marked as `static` does not have the `g_` prepended as by
definition they are not global
2024-05-12 18:31:16 +01:00
Luciano Ciccariello
819e91c77b
SEL import banks and fix headers (#951) 2024-01-07 20:41:47 +00:00
bismurphy
839f42433c
Decompile EntitySubwpnBible (DRA and RIC) (#831)
Next entity function in the same file I've been chewing through. Only
one left in here!

There's a really weird block with a bunch of trig functions that I can't
make sense of. Might be doing some kind of weird 3D transformation? Not
sure, but it matches. Would have never gotten it without the permuter.

Scratch here if you want to play with anything, especially if you can
remove the temp_a1 being used in the block of trig.
https://decomp.me/scratch/xdNx7

temp_v0 is also a bit funny, not sure why it would use lhu to load a
variable which is explicitly an s16 and we're negating, but whatever.
Everything matches so submitting now.
2023-12-11 15:01:25 -08:00
bismurphy
7aef355571
Decompile DRA EntitySubwpnThrownVibhuti (#792)
This is a cool one to have working.

It uses the FakePrim struct which we discovered a little while ago. It
is only the second one we've found to use it, and happily, the fields in
it match.

I'm wondering if FakePrim might represent a single pixel. The Vibhuti is
a set of white pixels that get thrown out, and therefore they don't need
a full set of multiple r,g,b values. Once we find a couple more users
for FakePrim, we might be able to give it a proper name. We may need to
consider making Primitive a union. But that's a decision for the future.

Very interestingly, this function and `func_8011E4BC` (the previous
function which used FakePrim) both call func_800EDB58 in the manner that
other functions call AllocPrimitives. This function seems to allocate
FakePrims.
2023-11-19 20:18:16 +00:00
bismurphy
95c2558f97
Decompile DRA EntitySubwpnReboundStone (#788)
Primarily decompiling the entity function for the rebound stone, but
also some slight cleanups here and there for things that relate to it.
Very nice to be able to understand things better! Seems that subweapon
entities aren't very well decompiled so that might be nice to dig into.
2023-11-18 23:53:38 +00:00
sozud
650541ab52
Sound docs 5 (#770)
This depends on the previous PR, I will rebase when it's merged.
2023-11-12 09:55:38 -08:00
Luciano Ciccariello
fbf23f1894
DRA HandleMenu (#701)
Decompiles HandleMenu. The HD version is not yet in and I will submit it
with another commit in this same PR. I wanted to collect some feedback
before decompiling the HD counterpart.
2023-10-25 10:54:33 -07:00
SynaMax
06afab9147
Added several new sound defines (#634) 2023-09-25 00:18:37 +01:00
SynaMax
2627652e74
Added NZ1 and Shared Sound sections (#632)
Added sound effect defines for NZ1 overlay and Shared sounds
2023-09-24 00:40:13 +01:00
bismurphy
7cbbe90e5c
Decompile DRA func_80116B0C (#600)
This is a pretty cool function. It seems to handle most of the logic for
the bat transformation, including the wing smash spell, fireballs,
echos, and normal movement.

I am not sure what to call it - maybe ControlBatForm? Very open to
suggestions.

This is a large one, so please do double check what I have here to make
sure I'm not introducing code that will need to be fixed later. I
suspect this function might be helpful for understanding some behavioral
details.

There are a few really weird version differences between US and HD here.
It makes parts of the code come out really ugly, but I guess that's the
price we have to pay for representing two codebases in one.

Looking forward to any and all feedback for this one!
2023-09-17 15:16:31 +01:00
Alejandro Asenjo Nitti
ebe5b67cb3
NP3 NO3 EntityShuttingWindow (#460) 2023-08-10 22:29:32 -07:00
Alejandro Asenjo Nitti
9bd3d18609
DRE EntitySuccubus (#388)
Matching this one was tough, so many reused variables and strange array
uses.

![image](https://github.com/Xeeynamo/sotn-decomp/assets/96613413/a1297919-50e3-4302-b43b-749bf0ecd5ad)

Special thanks:
Co-authored-by: @bismurphy (for tackling those messy loops)
Co-authored-by: @MottZilla (for docs research)
2023-07-23 14:22:16 +01:00
Luciano Ciccariello
be1b53f268
DRA HandlePlay matching (#367)
Very happy of this one. I tried decompiling it two months ago without
success but I decided to give it another try less than 24 hours ago. It
is the function called on every frame while the normal gameplay is
running. This also manages how to transition from a stage to another,
which files to load, set specific random seeds when playing a Tactics
recording.

Note that I refactored `func_800EAF28` as it is used by `HandlePlay`. I
also moved `GameSteps` out of `gameover.c` as it is started to be used
in another handler too. I do not know what `SET_UNK_0B` or `SET_UNK_12`
do, but I added in case at some point we want to explore their meaning.

`func_800F298C` is the function that handles the whole gameplay. That is
the biggest DRA function and the second biggest function of the game. I
hope one day we will manage to decompile that too.

In `case Play_LoadStageChr` there seems to be a hidden loading screen
populated by that `for` loop right after `D_8013640C =
AllocPrimitives(PRIM_GT4, 16);`. It is hidden because `blendMode` is set
to `0`. Setting it to either `8` or `0x88` shows a black screen rather
than showing Alucard frozen in the CD room for those two seconds. I do
not believe it was supposed to be black as X2, Y2, X3 and Y3 have some
kind of rotation and the U/V coords hints the fact some textures were
supposed to be loaded.
2023-07-17 20:51:26 +01:00
Alejandro Asenjo Nitti
0967c56bf7
ST0 EntityDracula (#271)
EntityDracula is the the actor for the first form of Dracula.

![image](https://github.com/Xeeynamo/sotn-decomp/assets/96613413/3509486b-423c-494c-b5d5-118aa6df91d4)
Documentation will be made when other entities of this file are
decompiled so we can have a full pictore.

Scratch: https://decomp.me/scratch/N0sJ1
Special thanks to @SestrenExsis for providing docs for the Sound effects
2023-06-21 23:58:22 +01:00
Alejandro Asenjo Nitti
34b39c2497
NP3 - Mermans (#239)
Enemy: Merman (2 variants)

![image](https://github.com/Xeeynamo/sotn-decomp/assets/96613413/9e1650a6-bb8d-4c4d-889f-7479cff60724)

![image](https://github.com/Xeeynamo/sotn-decomp/assets/96613413/2bbc77c2-dcce-4fef-a546-33f9e76745a8)

Scratches:
https://decomp.me/scratch/8wa56
https://decomp.me/scratch/pjVr0

Co-authored-by @MottZilla
2023-06-13 13:44:32 +01:00
Alejandro Asenjo Nitti
1b0e1ea60c
NZ0 & NP3 - Slogra & Gaibon Boss decompiled and documented (#230)
It's been a wild ride with this one, but i'm proud to present the first
Boss decompilation of the project.


![image](https://github.com/Xeeynamo/sotn-decomp/assets/96613413/d0ed35a9-7032-42b8-b237-3cdc2a4d5db6)

However, this contribution doesn't come without problems. I managed to
match EntitySlogra 100% but the local assembler is skipping a NOP, so
this makes it a NON_MATCHING until the compiler combo is fixed.
As for EntityGaibon, i couldn't get a perfect match, some regalloc and
instruction reordering persist in the assembler output, nevertheless the
behaviour has been extensively tested in-game for days using two
emulators simultaneously side by side to ensure it's equivalent.

If you want to try the functions, you'd have to change
splat.us.stnz0.yaml to exclude rodata extraction like this:
- [0x305FC, .rodata, 33FCC] # EntitySlogra
- [0x30618, .rodata, 33FCC] # EntityGaibon
and remember to change the #ifndef to #ifdef to be able to compile them.

Scratches:
NZ0_EntitySlogra: https://decomp.me/scratch/vaRJR
NZ0_EntityGaibon: https://decomp.me/scratch/QGtpG
NP3_EntitySlogra: https://decomp.me/scratch/DGetH
NP3_EntityGaibon: https://decomp.me/scratch/wUo18

Co-authored by the great @MottZilla, who actively provided his
dynamic-analysis and code interpretation skills to achieve the perfect
behaviour and documentation of the code.
2023-05-27 10:25:44 +01:00
sozud
87880246b9
Document some SFX (#228)
I was curious about the SFX used in the game over screen, but it turns
out that they have mostly been moved around/replaced in the US version.
I documented these for the US version and put them in an ifdef.
2023-05-17 18:23:36 +01:00
Alejandro Asenjo Nitti
d4db5d9dd6
NZ0 EntitySpittleBoneSpit (#226)
co-authored-by: @nim-ka
2023-05-12 08:53:24 +01:00
Alejandro Asenjo Nitti
dcb3dfc5e2
NZ0 EntityAxeKnight Documentation (#220)
co-authored-by: @MottZilla
2023-05-05 23:31:52 +01:00
Alejandro Asenjo Nitti
fc6bdf056e
EntityBoneScimitar + Docs (#213)
![image](https://user-images.githubusercontent.com/96613413/235360592-560968ec-7e4e-4f99-884c-7c370fd71e26.png)
Co-Authored-by: @Xeeynamo
Co-Authored-by: @pixel-stuck
Co-Authored-by: @MottZilla
2023-04-30 21:04:00 +01:00
Alejandro Asenjo Nitti
f18717a352
NZ0 EntityBloodSkeleton (#212)
Matching with some docs.

![image](https://user-images.githubusercontent.com/96613413/235321225-1109fc80-51c2-4355-811d-925218d6a3cf.png)

Special thanks to @pixel-stuck for his help on this function.
2023-04-29 20:57:30 +01:00
Alejandro Asenjo Nitti
2a4e3d6f0d
NP3 EntityBloodyZombie + docs (#203)
Enemy: Bloody Zombie

![image](https://user-images.githubusercontent.com/96613413/235222802-a693edc6-c5f3-430c-a5be-85ae1337fa53.png)
It turns out that this enemy was already decompiled by me in NZ0
(Alchemy Laboratory), but it was incorrectly labeled as
EntityBloodDrips. I did get a chance to document and understand it
better this time though.
2023-04-29 08:25:11 +01:00
Alejandro Asenjo Nitti
12e0d299cb
NZ0 EntitySkeleton (#201)
Yet another Enemy decompiled:

**EntitySkeleton**

![image](https://user-images.githubusercontent.com/96613413/234043404-d682b2ca-7635-4d4f-ad66-ae8f94e055d2.png)

Special thanks to @nim-ka, who actively helped be resolve the facing
issue that i was having with this function.
2023-04-29 07:56:42 +01:00
Alejandro Asenjo Nitti
61373e862c
NZ0 + NP3 Functions (#181)
NZ0:
EntityAxeKnight (I'm proud to present the first enemy decompiled in the
project perhaps?)
Here is the scratch in case somebody wants to tune it and provide
changes:
https://decomp.me/scratch/LKkYQ

EntitySubWeaponContainer
EntityBloodSplatter
func_801B69E8
func_801C0D08
func_801C9E98

NP3:
EntityBloodSplatter
EntityZombie
func_801B8CC0
2023-04-12 23:20:57 +01:00
mrsinistar64
2b3c348276
Update sfx.h (#184)
Added a couple of definitions for sound effects
2023-04-12 23:10:45 +01:00
Alejandro Asenjo Nitti
5da4df4468
EntityEnemyBlood co-authored-by @nim-ka, @Xeeynamo, @pixel-stuck (#175)
This function is weird in various ways, for starters, i needed to remove
the void type from the prototype argument of MoveEntity(), because the
function needed 'self' to be passed to it for matching, that could have
been a mistake from the dev, since DestroyEntity() takes an Entity* for
example, so it's very likely someone made that mistake, and like we have
been encountering a lot of times, it seems like the devs weren't care
about doing prototypes for functions so the compiler would assume
MoveEntity(s32), making it possible to receive an argument without
erroring out. There's no other way that i or @nim-ka found to match the
function. The other possibility is that the function actually takes an
Entity* but it's unused, but i think this is unlikely.

The other thing is that the function needs to use 'x2' for the last
member used below to match, but in decomp.me compiler it needs to be
'y2' for the offset to be correct in the asm, i couldn't figure out why.

I'm leaving the already cleaned up scratch in case someone wants to mess
with it and try to figure out a solution for the MoveEntity() argument
needed, and once we're all sure this is what we want, i'll make the
other duplicates in another PR.

https://decomp.me/scratch/sPUOP
2023-04-06 09:48:24 +01:00
Alejandro Asenjo Nitti
12023a8ae9
NP3 & NO3 Functions (#156) 2023-03-21 21:47:21 +00:00