Commit Graph

2692 Commits

Author SHA1 Message Date
Jonathan Hohle
aff02911f9
Enchanced Draw Mode Lint (#1589)
A few updates that didn't make it into the first round:

* masks are now identified and expanded
* AND-EQUALS and OR-EQUALS are supported
* `sotn-lint` is run before `clang-format` to avoid having to run the
`format-src` target twice to catch line breaks
* `.h` files are included in `sotn-lint` since they are being used for
shared code
* `sotn` lint ignores the `mednafen` directory
2024-09-07 13:00:44 -07:00
Luciano Ciccariello
edb4f0ebc0
RIC and Alucard share field docs (#1588)
Not a big PR. The highlights are `g_Player.timers` and
`entity->hitParams`. The last one is a bit weird as it looks like a mix
between `attackElement` and `hitEffect`.

The `var_s4` on `RicMain` is uninitialised and it leads to an undefined
behaviour. Recompiling the code for PSX by moving things around, that
variable will not be `0` at the beginning but some random value. This
prevented Richter's run, blade dash and high jump to work. I added an
`#ifdef` in case people wants to mod the overlay.

This is probably the last batch of changes for RIC for a while.
2024-09-07 18:00:44 +01:00
Jonathan Hohle
41378a3662
Draw Mode Linter (#1587)
Adds a transformer for `drawMode` fields which converts hex or integer
values to an OR'd bitmask.

Like `RelicTransformer`, `DrawModeTransformer` reproduces the values and
names in the linter.
2024-09-07 10:04:37 +01:00
Luciano Ciccariello
f448782618
RIC blueprint docs (#1577)
List of the most important changes:
* The two fields in `FACTORY` are now reversed; what used to be
`FACTORY(0x2000, 44)` is now `FACTORY(44, 0x20)`
* Introduce `WFACTORY` to imply `((g_HandId + 1) << 0xC)` in it
(`((g_HandId + 1) << 0xE)` is not yet cracked)
* Remove `assets/ric/blueprints.json` in favour of baking the info into
a C file to easily link enums
* Add `B_MAKE` to define a blueprint entry
* Document almost all RIC entities
* Document almost all RIC blueprints
2024-09-07 01:29:56 +01:00
Jonathan Hohle
ce69925e22
Decompile func_ptr_80170004 of w_039 (#1586) 2024-09-06 16:26:39 -07:00
Max Clark
ed1689decf
EntityStrongWargDeathBeams (#1585)
Thanks again @joshlory @bismurphy for the help!
2024-09-06 16:16:44 -04:00
Luciano Ciccariello
487007194c
Add AGPL license (#1565)
From the [public
announcement](https://discord.com/channels/1079389589950705684/1079395108501331990/1276310695964835910)
on Discord:

> We've been progressing very far with the project and I started
wondering what would be the best course of action to protect the work of
existing and future contributors. I personally consider contributions to
a decompilation project as creative work. Therefore it is my desire to
protect this creative work from being re-claimed by other people. This
is especially true in the light of the ability of modding the existing
decompiled code and create derivative work.
> 
> I talked privately with the current most active contributors. And me,
@sozud , @bismurphy and @joshlory so far agreed on pushing through the
AGPLv3 license for all the decompiled code in `sotn-decomp/src`,
excluding any third party code and decompiled code from the PSX SDK. But
I've been wanting to ask all of you if you are fine your code to be
licensed and protected under the AGPLv3 terms.
>
>
https://raw.githubusercontent.com/Xeeynamo/sotn-decomp/89686514916cabd0dd88ae0387f749a889c19e05/src/LICENSE
> 
> I put and all the contributors, which can be accessed to the page
https://github.com/Xeeynamo/sotn-decomp/graphs/contributors . Again,
this will work for existing and future contributors. In the license I
put my full name as I will be responsible of any legality. And I
understand not every contributor wants to disclose their identity.
Please give an approval to my latest PR if you do not have any
objection. If not, please write here publicly.
>
> PS. I understand past contributors will either not see the message
above or decide to ignore it. If I do not hear from anyone of the
contributors for more than one week between those who did not interact
with me or the server, I will still go ahead and apply the license. It
is not in my intention to ignore past contributors. But I do not want
contributors who have been inactive for months or years to be a blocker.
Please do not mistake this as an act of malevolence.

---------

Co-authored-by: Joey Murphy <tjmurphy@mit.edu>
2024-09-06 16:14:55 -04:00
Jonathan Hohle
4a471b4583
Decompile func_ptr_80170010 of w_050 (#1583) 2024-09-03 21:47:57 -07:00
Jonathan Hohle
4ad1f53df6
Decompile func_ptr_80170004 of w_050 (#1582)
Finished off work of several decomp.me anons.

`func_162000_8017B784`'s signature didn't seem to match, so I decomped
the PSP version to check. This has been updated to a matching version
which matches both PSP and PSX.
2024-09-02 15:01:06 -07:00
Josh Lory
e697cd5cc1
Decompile EntityWeaponAttack_w_047 (#1581)
https://decomp.me/scratch/MD20i

Thanks @bismurphy for solving the last few swaps!
2024-09-02 14:47:22 -07:00
Josh Lory
870424a6c7
Decompile EntityWeaponAttack_w_014 (#1580)
https://decomp.me/scratch/9Y8Zd
2024-08-31 13:49:36 -07:00
Jonathan Hohle
27e8618e7b
Decompile func_ptr_80170004 of w_038 (#1579) 2024-08-28 18:48:32 -07:00
Jonathan Hohle
3cba98f975
Decompile func_ptr_80170004 in w_055 (#1578) 2024-08-28 09:25:07 -07:00
Jonathan Hohle
a188f7525c
Decompile func_ptr_80170004 in w_001 (#1576) 2024-08-27 14:42:40 -07:00
Luciano Ciccariello
af503baa43
RIC: add more documentation (#1573)
Follow-up to #1569 .

Loads of changes, where the most prominent one is synchronising the
`self->ext.*.subweaponId` field across entities to make it work on
`RicSetSubweaponParams`. I added some static assertions with the new
macro `SYNC_FIELD`, which is easier to read.

The new `enum RicSubweapons` decouples the subweapons of Richter from
those found in DRA. This is important because
`assets/ric/subweapondefs.json` is different from the definition stored
in DRA.

I discovered new entities and renamed them accordingly. I am following
the format `RicEntity` for each entity. Then `RicEntitySubwpn` or
`RicEntityCrash` for the appropriate category.

The BSS section has been assigned to the right places and `ric.h` has
been cleaned as most of the declarations are no longer necessary. More
data and functions have been marked as `static`.

`src/st/st0/2DAC8.c` had a reference to `.ext.agunea`, which was
probably put there by mistake. The fake symbol `D_801758D0` has been
removed and I think I found a way to fix the stopwatch subweapon without
the `#ifdef`.

```c
#ifdef VERSION_PC
#ifdef _MSC_VER
            {
                s32 temp_x = (rcos(primLine->angle) << 8);
                s32 temp_y = (-(rsin(primLine->angle) << 8));
                primLine->velocityX = *(f32*)&temp_x;
                primLine->velocityY = *(f32*)&temp_y;
            }
#else
            primLine->velocityX = (f32)(rcos(primLine->angle) << 8);
            primLine->velocityY = (f32) - (rsin(primLine->angle) << 8);
#endif
#else
            primLine->velocityX = (rcos(primLine->angle) << 8);
            primLine->velocityY = -(rsin(primLine->angle) << 8);
#endif
```
this one has been resolved by just using `velocityX.val`.
2024-08-27 18:18:26 +01:00
bismurphy
38a2cbe9bb
Simplify CLUT fetching system for texture viewer (#1575)
Previous system directly replicated the game's behavior, I realized it
could be simplified way down and not need to generate the full CLUT
table for each fetch. Now we translate between clut number and its
location in VRAM to fetch just the given CLUT. Comments describe the
logic in a way that is hopefully easy to follow.
2024-08-25 18:49:28 -04:00
bismurphy
1b95fd2c18
Add ability for texture viewwer to load from an active PCSX instance (#1574)
Should have thought of this to begin with!

This makes the script fetch the VRAM while PCSX is running. That way you
don't have to deal with keeping files around on your hard drive if you
don't want to.
2024-08-24 20:31:26 -04:00
Jonathan Hohle
5d9cc9a399
Decompile Remaining w_015 Functions (#1571)
* `EntityWeaponAttack`
* `func_ptr_80170010`
* `func_ptr_8017000C`
2024-08-24 17:16:14 -07:00
Josh Lory
0fc37a360b
Decompile func_ptr_80170008_w_050 and func_ptr_8017000C_w_050 (#1567)
* [func_ptr_80170008_w_050](https://decomp.me/scratch/HoEkr)
* [func_ptr_8017000C_w_050](https://decomp.me/scratch/5k56G)
2024-08-24 17:10:30 -07:00
Jonathan Hohle
703bf35fc3
Replace FLAG_UNK_800000 with FLAG_HAS_PRIMS (#1572)
Finishes the migration from `FLAG_UNK_800000` to `FLAG_HAS_PRIMS`.
2024-08-24 19:18:44 +01:00
bismurphy
c56e3dacde
Add texture viewer tool (#1570)
A tool I made that allows you to identify some entities based on the
primitives that they create. Usage is documented at top of the file.
Allows extraction of images, which has already been useful in a few
places.

Happy to provide any assistance with using this; it's come in handy for
me and hopefully will be beneficial for others too.
2024-08-24 15:25:19 +01:00
Luciano Ciccariello
9112ccc88c
RIC: add more documentation (#1569)
I documented all the `PLAYER.step` for Richter and got the meaning of
most of the functions with their parameters. There are some additional
renaming and magic numbers documented that are not worth to mention
individually.

I plan to get rid of `EntityTypes` as it is not sustainable to document
256 combination of entities. Instead I am thinking it would be a better
approach to document the `g_Entities` indices as ranges. For example
from `32` to `47` we have particles, from `48` to `64` we have player
entities that can hit the stage entities and so on.

I re-organised and re-imported some of the data close to the function
that use them. This will allow me to later split entities into their own
units as separate C files.
2024-08-24 09:57:53 +01:00
Josh Lory
985d395b95
Decompile remaining w_049 funcs (#1568)
* [func_ptr_80170004_w_049](https://decomp.me/scratch/zDGOj)
* [func_ptr_8017000C_w_049](https://decomp.me/scratch/1iQj7)
* [func_ptr_80170010_w_049](https://decomp.me/scratch/DarwY)
2024-08-23 17:29:15 +01:00
bismurphy
7ab54b9cce
Eliminate ext.generic.unk88 (#1564)
Gradually removed each use of this variable, now the last one is gone so
it's removed from the ext as well :)
2024-08-22 19:02:05 +01:00
bismurphy
a11c22adef
Decompile ST0 func_801BD8F0 (#1563)
In addition to decompiling the function, two big changes were needed:

- Decompiling this function uncovered a maspsx bug with generating `nop`
padding instructions; that is now fixed and this PR includes a maspsx
update.
- We also discovered (thanks @mkst !) that g_Tilemap.bg was not actually
a member of g_Tilemap. I renamed it to g_BgLayers, and did a
find-and-replace across the repo to change all references. This appears
to have no impact on any existing function, but leads to the correct
register loading on this function.

It's a weird one, and was tricky to get matching (actually, this was a
super old decomp.me browser tab I discovered was still open, which is
why I came back to it), but these tricky ones are great for discovering
where we have mistakes in our structure of the game's data.
2024-08-22 18:19:49 +01:00
bismurphy
5ce562a3ed
Modernize NZ0 skeleton enemy (#1560)
This one was already pretty good, but mostly needed to have
`ext.generic` removed.

I noticed the structure of this file is identical to e_bone_scimitar, so
I decided to change the bone scimitar to use this Skeleton `ext` since
the skeleton is a more generalized enemy. Now that we see two enemies
both using this one, this almost looks something like object
inheritance, if that were a thing that existed.

So far NZ0 is the only overlay with the skeleton enemy, but I'm sure
once we pull in other overlays we'll find more skeletons all over. Then
this will be a .h file, but for now it's a normal .c file.
2024-08-22 18:18:35 +01:00
Jonathan Hohle
0a56e6f60f
Decompile Remaining w_053 & w_056 Functions (#1562)
Decompiles duplicate function `func_ptr_80170004` in `w_053` and `w_056`
and similar function `func_ptr_8017000C` in `w_053`.
2024-08-22 07:50:27 -04:00
Josh Lory
ab5966e75c
Decompile func_ptr_80170004_w_006 (#1561)
https://decomp.me/scratch/Gwx79
2024-08-21 22:43:49 -07:00
bismurphy
a8572f8922
Deduplicate Bone Scimitar enemy (#1559)
After modernizing this, I've gone ahead and pulled out the functions in
this file into a .h, as with other duplicate functions.
2024-08-21 23:19:15 +01:00
bismurphy
55744a1f93
Lots of updating on NZ0/311C0.c (#1558)
This file was all decompiled, but overall had a lot of "old-looking"
traits to it. I went through and updated it in many ways. All the
functions are now named with real names (no `func_whatever`), several
constants are used in different places, I've added names to the list of
entity ID numbers in the .h file, etc.

One thing of interest: I went through starting to document the `.ext`
members, and noticed that they seemed to "keep away" from each other,
even across unrelated entities. Therefore, at least for now, I decided
to create an experimental `ext` which covers all the entities that
needed defining in this file. Maybe down the line we can split them up
to their own individual entities, but I find it interesting that some
entities use the unk80, unk84 offsets, while others only use unk88. I
don't see why you would skip to unk88 unless unk80 and unk84 were taken,
and the only way they're taken is if they share ext members.

The big thing is that nothing uses generic anymore. It looks like this
file was from the era when we were trying to use generic for everything
so there is lots of ugly casting, but that's all gone now, which is
nice.
2024-08-21 21:07:13 +01:00
sozud
6b4254b2fc
More dedupes (#1556) 2024-08-20 20:57:18 -07:00
SestrenExsis
283538a313
Rename unknown members of Zombie Spawner struct (#1557)
A minor PR that only aims to give a meaningful name to two of the
unknown variables in the `ET_ZombieSpawner` struct:
- `spawnDelay`: Number of frames until the next time the Zombie Spawner
will attempt to spawn another zombie
- `spawnSide`: Which side of the player the Zombie Spawner will attempt
to spawn the next zombie (zero for left, non-zero for right)
2024-08-20 23:51:47 -04:00
sozud
88024b24ff
More dedupes (#1555) 2024-08-20 16:02:21 -07:00
Jonathan Hohle
3cf5c09682
Decompile EntityWeaponAttack for w_054 and w_056 (#1554)
Similar weapon attack functions.

Thanks to @bismurphy for the help.
2024-08-20 15:55:33 -07:00
Jonathan Hohle
959ebe41ac
Update Symbol Name, Size Comment (#1553)
Renamed `PLAYER_ext_generic_unk7C` to `PLAYER_ext_player_anim` since we
know the player entity is being referenced.

Added a size comment to `WeaponAnimation` to help me find it next time
I'm looking for an `0x10` sized struct.
2024-08-20 18:21:16 -04:00
Josh Lory
c22cd8f9c7
Decompile func_ptr_8017000C_w_030 (#1545)
https://decomp.me/scratch/uusD5
2024-08-20 14:56:39 -07:00
bismurphy
bac0e55cd2
Modernize NO3/NP3 Bone Scimitar (#1551)
NO3 and NP3 had a weird mix of Bone Scimitar functions where each was
partially complete and missing different parts.

Now both are complete and modernized. Could use another pass to make it
PSP-matching, but for now I'll leave this one at this point where the
code seems nice.
2024-08-20 12:23:51 -07:00
Jonathan Hohle
7025569396
func_ptr_80170008 of w_048 and w_049 (#1552)
These are two nearly identical functions for similar weapons.
2024-08-20 12:12:01 -07:00
sozud
99ef943f6b
More dedupes (#1550)
Merging to prevent more conflicts with other work
2024-08-20 11:24:52 -07:00
Josh Lory
a62e1052e7
Finish two related files: w_012 and w_034 (#1549)
* https://decomp.me/scratch/h62LS
* https://decomp.me/scratch/FhCre
* https://decomp.me/scratch/N3tj5
2024-08-19 22:00:58 -07:00
sozud
f40e9a1639
More dedupes (#1548) 2024-08-19 21:36:45 -07:00
bismurphy
d6eccc923d
Make ext.zombieSpawner for EntityZombieSpawner (#1547)
An old one that was using `generic`, easy swap to bring it up to have
its own dedicated `ext` member.
2024-08-19 20:56:22 -07:00
sozud
62857572c6
Improve sfx docs (#1540) 2024-08-19 23:01:59 +01:00
sozud
7433787b9b
more stage dedupes (#1543) 2024-08-19 23:00:03 +01:00
Josh Lory
f21224fb6f
Import data for w_041 and link (#1546)
Also links `w_052` which I missed in
https://github.com/Xeeynamo/sotn-decomp/pull/1524
2024-08-19 10:51:24 -07:00
bismurphy
b9dab230fd
Update EntitySurfacingWater and ext.waterEffects (#1544)
Next one in my progress of removing `ext.generic.unk88`. This one is
duplicated two places; once we have NO3 and NP3 matching it will be cool
to de-duplicate them and see how many differences are actually left.
2024-08-19 10:42:22 -07:00
SynaMax
1bc839af1a
First group of vabID 0 sfx complete (#1542) 2024-08-18 21:29:24 -07:00
Josh Lory
569e9450b9
Decompile func_ptr_80170010_w_030 (#1541)
https://decomp.me/scratch/TPASg
2024-08-18 18:21:56 -07:00
Josh Lory
247f58f90e
Finish w_007 and import data (#1539)
https://decomp.me/scratch/Zn2uO
2024-08-18 14:52:32 -07:00
bismurphy
e37ebe715b
Improve EntityWargExplosionPuffOpaque (#1538)
Main changes here involve renaming the Ext member from `et38` to
`wargpuff` which seems more descriptive.

Also added entity ID numbers across the overlays, to be used in the
function right before the warg puff function, which spawns the warg
puffs with a call to `CreateEntityFromEntity`.
2024-08-18 14:38:58 -07:00