Commit Graph

2118 Commits

Author SHA1 Message Date
bismurphy
cc08d76652
Decompile weapon 21 (food) func_ptr_80170004 (#1268)
Unfortunately, this required an evil change of the return type, even
though it doesn't return. And since it's one of many weapons that share
the functions, they all had to change.

Otherwise, nice to have the food figured out (this is the last food
function), since food is a somewhat major part of this game.
2024-06-06 20:09:19 +01:00
bismurphy
a744a90c07
Decompile weapon 41 func_ptr_80170004 (#1267)
Another one helped out by PSP :)

Not sure what's going on with the trigtemp and trigresult variables.
They aren't needed on PSP.
2024-06-05 17:26:37 -07:00
Luciano Ciccariello
ad0e2a79e3
Fix a few minor data overflows (#1266)
They were causing overflows at runtime
2024-06-05 17:15:03 -07:00
Luciano Ciccariello
fe0f9fbe81
DRA fix D_800CF324 data type (#1262)
Slightly better representation of some data I previously imported
2024-06-05 17:10:35 -07:00
bismurphy
9a0ccbe43b
Decompile DRA EntitySummonSpirit (#1264)
This one is a nice surprise to get working! DRA is really getting slim
now.
2024-06-05 13:48:32 -07:00
Luciano Ciccariello
bc884aa3d9
DRA func_8010DBFC refactor (#1261)
`func_8010DBFC` now matches on PSP, so it's most likely to be real:
https://decomp.me/scratch/xuNg5

`func_8010DA70` has a reg-swap but it's matching better than the
original: https://decomp.me/scratch/mGIed
I am a bit concerned about this function as it seems to suggst
`AnimationFrame` is a structure that does not exist and it might just be
a `u16` array.
2024-06-05 20:41:38 +01:00
bismurphy
ab0857b9b6
Decompile DRE func_801A2848 (#1263)
Kind of a messy function to match, but it matches. Looks like there are
a few functions in this file with similar structure.
2024-06-05 20:40:23 +01:00
sozud
ed6389750c
Import DRA data (#1259) 2024-06-05 17:48:18 +01:00
bismurphy
12c796fbd0
Decompile DRE Entity3DHouseSpawner (#1260)
This was an old one with a decompme comment in the code that I decided
to tackle. Turned out to be able to make it relatively straightforward!

I think the naming is reasonable and is motivated by the behavior in the
code, but happy to adjust if needed.

Strangely, decompme informed me that the function was matched here:
https://decomp.me/scratch/aEXJO by "NicoVazCan", 3 months ago. Not sure
who that is, but they never submitted it, so I guess it's abandoned.
Either way, I think the code in this PR is more readable.
2024-06-05 09:32:06 -07:00
Luciano Ciccariello
7ea1395567
DRA func_800F0CD8 (#1258)
Plus some refactoring here and there related to the global variables
`func_800F0CD8` uses.

Thanks to @bismurphy for solving the final regswap!
2024-06-04 17:30:28 -07:00
Luciano Ciccariello
151346d62c
Update clang-format as self-contained binary (#1257)
Version 18.1.6 pulled from
https://github.com/xeeynamo/sotn-decomp/releases and compiled with the
following:

```Dockerfile
FROM alpine:latest
RUN apk add --no-cache \
    build-base \
    cmake \
    git \
    ninja \
    libstdc++ \
    zlib-dev \
    python3
ENV LLVM_VERSION=llvmorg-18.1.6
RUN mkdir -p /opt/llvm \
    && cd /opt/llvm \
    && git clone --depth=1 --branch $LLVM_VERSION https://github.com/llvm/llvm-project.git \
    && mkdir -p llvm-project/build \
    && cd llvm-project/build \
    && cmake -G Ninja \
        -DLLVM_ENABLE_PROJECTS=clang \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_CXX_FLAGS="-static-libstdc++ -static-libgcc" \
        -DCMAKE_EXE_LINKER_FLAGS="-static" \
        -DLLVM_ENABLE_RTTI=ON \
        ../llvm \
    && ninja clang-format \
    && strip bin/clang-format
FROM scratch
COPY --from=0 /opt/llvm/llvm-project/build/bin/clang-format /clang-format
ENTRYPOINT ["/usr/local/bin/clang-format"]
```
`docker build --output . .`

Original source code:
https://github.com/llvm/llvm-project/tree/llvmorg-18.1.6
commit: `1118c2e05e67a36ed8ca250524525cdb66a55256`
2024-06-04 21:07:50 +01:00
bismurphy
e62f6c3a64
Decompile weapon 26 func_ptr_80170024 (#1256)
Kind of a crazy one with the way the vectors are dealt with, but
eventually got it to work. Hopefully this can be a nice reference for
some of those SDK functions.
2024-06-04 18:30:04 +01:00
Josh Lory
e02d4f293b
Decompile DRA func_800EA7CC (#1254)
https://decomp.me/scratch/lSGji

Credit to @Xeeynamo for 99% of the initial match, I just fixed up one of
the registers and did some light refactoring. The repetition of `temp_s0
= ptr->desc` makes me think it's actually an array reference but I
couldn't get anything else to fit.
2024-06-04 18:26:11 +01:00
sozud
1261f8e6c2
dra data (#1252)
Going to do a few files, just getting this on the CI for checking as I
go
2024-06-04 01:47:36 +01:00
Luciano Ciccariello
e80168bec4
Link all DRA files (#1251) 2024-06-03 21:47:30 +01:00
bismurphy
547a2b91af
Deprecate the s16_pair struct (#1248)
A while ago, I created the s16_pair struct, and used it in various
functions. As the name implies, it is a pair of s16 variables.

I later found that there already exists a Point16 struct which has the
same data, and is a better description anyway, since its members are `x`
and `y`, and this structure is almost always used to represent x-y
values.

I've gone through the repo for every use of this structure, and changed
it over to be Point16. Therefore, s16_pair will no longer exist in this
project.
2024-06-03 18:23:40 +01:00
Luciano Ciccariello
4fa9382271
DRA func_80109A44 matching (#1246) 2024-06-03 18:10:06 +01:00
sozud
0be3e44634
PSP WRP data (#1249) 2024-06-03 18:08:38 +01:00
bismurphy
ea4d75ef19
Decompile DRA func_8010D2C8 (#1247)
Last one of the set! Cool to have gotten this all done in one night :)

Excited to see the results once the 80109A44 function comes in from
xeeynamo!
2024-06-02 18:13:33 -07:00
bismurphy
a5f7b0dfb8
Decompile DRA func_8010D010 (#1245)
The next one! And yet another renaming struct to Point16.

Almost done!
2024-06-02 18:08:30 -07:00
bismurphy
3b97062b83
Decompile DRA func_8010C9F4 (#1244)
The second in that set of 4 player collision functions.

I also changed D_800ACEC0 to be Point16 instead of s16_pair.
2024-06-02 17:36:16 -07:00
bismurphy
c6de5c311e
Decompile DRA func_8010C36C (#1243)
This is a collision function, similar to the ones that were completed
for Richter a little while ago.

I changed the collision offsets to use Point16, instead of the old
s16_pair struct.
2024-06-03 00:55:10 +01:00
sozud
9cad49bfde
Start importing wrp data (#1242)
The yaml changes were generated with a script.
https://gist.github.com/sozud/ae6837a24bc8bb4e8bcc89d3e14d83f4

The alignment of the yaml seems to be wrong so I had to check if the
address % 16 == 0 and only split at those spots. I put the data in
create_entity since it's the first file in the psp yaml.
2024-06-02 14:55:37 -07:00
Luciano Ciccariello
36e146d275
Fix fake symbols and solve runtime issues (#1241)
Cherry-picking a few floating fixes from a testing branch as they're
good enough to be merged into `master`:

* With cmake 3.29.3 and GCC 14.1.1 I am personally having some
compilation issues. I disabled some error checks to make the executable
running locally on my machine. This might fix potential compilation
issues if we upgrade the CI agent.
* Fix the use of a fake symbol in WRP
* A few signature adjustments
* `HitDetection` with a simulated scratch-pad
2024-06-02 20:52:27 +01:00
Luciano Ciccariello
db2fc27776
DRA import data at 2F324 (#1240)
I think those are a bunch of animation indices? I am not yet sure how to
represent them as structured data, so there you go having them imported
as C files.
2024-06-02 20:37:19 +01:00
Luciano Ciccariello
97c8090b88
DRA import more data (#1239)
Importing some data from `DBD4` with the goal of making the _Sound_ app
more accurate.

I do not know in which file to put this data into, so I created a file
ad-hoc.

EDIT: I kept importing more
2024-06-02 19:29:17 +01:00
sozud
dc101d0ac7
BlitChar (#1237)
The function itself is matching for me locally but wrp.bin doesn't
match. I think it's possibly a wrong file split?
https://decomp.me/scratch/tsOag
2024-06-02 19:17:35 +01:00
bismurphy
d7f107d76f
Decompile Weapon 27 EntityWeaponAttack (#1238)
Started working on this one and then I realized it's identical to the
one on the previous shield, so it was a direct copy-paste, aside from
the names of the D_C1000 variables.

Maybe we'll de-duplicate in the future but for now I think weapons
should just be written individually.
2024-06-02 16:17:26 +01:00
bismurphy
b191658841
Decompile Weapon 27 func_ptr_80170024 (#1234)
I'm pretty sure this has to be the laser beams for the Medusa Shield.
They get spawned by the EntityWeaponShieldSpell.

This function is a pretty big mess. It could probably benefit from a
cleanup pass, potentially using PSP to assist.

But for now, the goal is matching, so hey, this matches :)
2024-06-01 16:50:44 -07:00
sozud
e390b2b9e1
Merge BottomCornerText (#1235) 2024-06-01 23:59:58 +01:00
sozud
d7efc69663
Merge prim_helpers (#1233) 2024-06-01 23:49:41 +01:00
sozud
446a0dfbe5
Factor out CreateEntity (#1236) 2024-06-01 23:48:50 +01:00
Luciano Ciccariello
270d8c6d3b
Add TILE rendering to SDL2 DrawOTag (#1232)
This allows the fade-in / fade-out effect from `func_801027C4` and the
content from `DrawEntitiesHitbox` to be rendered on screen.

The fade-in is a bit weird, it fades out to white instead of black. I
doubt the rendering is accurate at the moment, but better than not
showing anything.
2024-06-01 22:21:26 +01:00
Luciano Ciccariello
c1c39ba701
Fix AnsiToSotnMenuString to not spam logs (#1231)
Now with a much faster start-up
2024-06-01 21:30:12 +01:00
bismurphy
32b0664b5d
Fix args for func_80118B18 (#1230)
The Medusa Shield's laser-beams use this function for finding enemies to
target (I think).

I was reviewing this function and noticed the awkward line `if ((arg2 <<
0x10) != 0) {`, and realized that means `arg2` should be `s16`. It
matches, so I think this is right.

Named it facingLeft since that's what is used in the call that I have so
far. The function graphs indicate that there are 3 functions that use
this one (none decompiled yet), so we will see if this shifts as we
discover more. For now, I think this change makes the most sense.
2024-06-01 12:58:51 -07:00
bismurphy
0876d7d09f
Decompile W27 (Medusa Shield) EntityWeaponShieldSpell (#1229)
Noticing a lot of similarity among the shield spells. Not enough to
de-duplicate them, but enough that decompiling them is a breeze.

Unless there is something else that takes my attention, I will probably
focus on decompiling all the shields next. I'm already done with 2 and
there aren't many in the game.
2024-06-01 12:49:08 -07:00
bismurphy
45d7ab009e
Decompile weapon 28 EntityWeaponAttack (#1228)
This finishes out the Skull Shield.

Nothing too terribly special. I added a new #define for the player
status flag at 0x10000, since that's used here. Hopefully we can find
the function that actually sets that flag; I couldn't find it.
2024-06-01 12:39:28 -07:00
Luciano Ciccariello
a221c614be
WRP PSP e_particles (#1227)
Quite a big one. I merged `EntitySoulStealOrb` across all overlays by
normalising the symbol names. The symbol types was all over the place,
so I had to fix that as well.

I solved the s16/u16 ifdef between PSX and PSP. The only part I couldn't
match without a ifdef was `angle = (angle - 1) * 8;` and `angle = (angle
* 8) - 8;`.

I also decompiled the exclusive PSP functions `func_psp_0923AD68` and
`func_psp_0923B2F0` and merged the PSX and PSP `e_particles.c` code. The
exclusive functions required a file split.
2024-06-01 20:32:59 +01:00
bismurphy
ea0134f497
Decompile Weapon 28 func_ptr_80170024 (#1226)
Secondary function for the Skull Shield. Gets spawned by the ShieldSpell
that just got merged.

I also noticed too late that my previous PR reverted the update to
mwccgap since I hadn't updated that; this PR includes a fix to that
accidental revert.
2024-06-01 11:29:15 -07:00
bismurphy
8947665c9d
Decompile Weapon 28 shield spell (#1225)
This one was a beast, but nice to get it working.

This seemed to match the same entity extension as weapon 29. Weapons 28
and 29 are both shields, so I decided to rename the Weapon29 struct to
be Shield instead. We will see if it continues to match for the future
shields.

This had a ton of FIX(), enums, #defines, etc, so hopefully I got them
all :)
2024-06-01 16:23:14 +01:00
sozud
14d3d9154c
BottomCornerText (#1224)
Seems to use a different character encoding on PSP.
https://decomp.me/scratch/OZfBf
2024-06-01 10:55:44 +01:00
sozud
5b82ab061a
EntitySoulStealOrb (#1222)
I'm having trouble integrating the signedness changes but I figure this
gets us closer anyway
https://decomp.me/scratch/R41nc
2024-06-01 10:45:25 +01:00
Luciano Ciccariello
cec8424a09
WRP PSP merge e_room_fg.c (#1221)
Straightforward PR. Interestingly importing the data doesn't seem to
result to a match ad there's some `0x10` aligned padding added. Either
we know too little about importing data with MWCC or the file split was
wrong and the data belonged together with other functions in another C
file.

For now I had to use a `#ifdef`. It will probably get forgotten until we
decide to import the data from WRP PSP.
2024-05-30 16:18:36 -07:00
sozud
7b8e97898f
EntityMessageBox (#1220)
https://decomp.me/scratch/nMwCS
2024-05-30 16:10:22 -07:00
Luciano Ciccariello
2892fe478b
Merge g_CdVolumeTable with g_VolumeTable (#1219)
I found the variable `distance` in `func_80132A04` can be negative. The
array index will underflow unless the two global variables
`g_CdVolumeTable` and `g_VolumeTable` gets merged
2024-05-31 00:02:21 +01:00
sozud
eaf9e0716f
Factor out EntityIntenseExplosion (#1218) 2024-05-30 23:53:17 +01:00
sozud
24f1a1524a
factor out blinkitem (#1217) 2024-05-30 23:41:37 +01:00
sozud
4ba815e4ef
Factor out CollectHeartVessel (#1216) 2024-05-30 23:27:00 +01:00
sozud
385ad23949
Factor out UpdateRoomPosition (#1214) 2024-05-30 23:26:36 +01:00
Luciano Ciccariello
6cebe27c78
Delete tools/update.h
It was probably created by accident
2024-05-30 22:56:09 +01:00