Commit Graph

2576 Commits

Author SHA1 Message Date
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
bismurphy
7f176c3f1e
Eliminate remaining uses of ext.generic.unk8C (#1537)
My last few PRs have been targeting `ext.generic.unk8C` and removing
them one by one. This finishes the job. Next I'll start digging into
`unk88` :)
2024-08-18 19:17:28 +01:00
bismurphy
0f8e2a988e
Update NZ0 EntityBloodSplatter (#1536)
This was an ugly old function with lots of casts and `ext.generic`. I
found an identical function in NP3 and copied it out.

I left a comment in the other file about this, for the sake of future
potential de-duplication. For now, at least both functions are modern.
2024-08-18 16:42:30 +01:00
bismurphy
506d76280d
Modernize NO3 cavern door code (#1535)
Lots of little changes here. Getting away from using `ext.generic`,
using various enums/macros, using `prim` instead of `POLY_GT4`, making
variables have useful names, etc.

Also, these  functions both match on PSP now.

One interesting thing is that these functions don't overlap in their use
of the `ext`, so I had them share one. Kind of interesting.
2024-08-18 16:09:18 +01:00
Luciano Ciccariello
991d839291
Enforce ext.*.anim alignment (#1534)
`#ifdef` ugliness, but there is not much we can do if some of the `ext`
structs use 64-bit pointers. With _Static_assert we can ensure, at
compile time, that structs are aligned for `g_api.PlayAnimation` to work
correctly.

I removed a bit more of `ext.generic` here and there too.

cc. @bismurphy our weapon blacksmith xD
2024-08-18 14:03:35 +01:00
sozud
3ad9c50b71
Document some sfx variables (#1533) 2024-08-18 01:49:32 -07:00
sozud
d290af9dfb
More stage dedupes (#1531) 2024-08-18 01:44:01 -07:00
bismurphy
0dddb4bed8
Improve some TT_000 code quality (#1532)
- Rename func_801733D4 to BatFamiliarBlueTrail
- Add PSP symbols for several various variables used in `func_80172120`
- Attempt to get `func_80172120` closer to matching on PSP. Almost got
it but not quite working; this is at least an improvement. Scratch:
https://decomp.me/scratch/QBytP
- Create `Ext` for BatFamiliarBlueTrail; all it uses is the parent which
is the same as Factory, but still better to have its own until we know
the real situation for entities.
- General commenting to make flow of functions clearer.
2024-08-18 09:38:13 +01:00
Josh Lory
c939079eab
Finish w_045 and import data (#1521)
Unfortunately this build will fail until the fix is merged to decouple
`func_ptr_*` signatures.

* [func_ptr_80170004_w_045](https://decomp.me/scratch/OmJXk)
* [func_ptr_8017000C_w_045](https://decomp.me/scratch/c5Qrm)
2024-08-18 09:22:14 +01:00
bismurphy
c4c84eb4e4
Near-decompile leather shield EntityWeaponShieldSpell (#1518)
This is my attempted decompilation of the leather shield, but the return
type mismatch makes it fail.

Scratch here (matching, by using s32 return type):
https://decomp.me/scratch/SN7d3
2024-08-18 09:19:53 +01:00
sozud
434a530fd7
Dedupe CheckFieldCollision (#1530) 2024-08-17 13:36:55 -07:00
Jonathan Hohle
dc92c84193
Port EntityMerman & EntityMerman from NP3 to NO3 (#1529)
Copied the `EnttityMerman` and `EntityMerman2` implementations from NP3
to NO3. These are identical, however, rely on too many things which
require renaming to share at this point.

NO3's `EntityMerman2` was previously `EntityMerman3`, but is identical
to NP3's Merman2, so it was renamed to match.

A small amount of cleanup was done to the implementations to bring them
closer to current standards.
2024-08-17 11:41:47 -07:00
Josh Lory
912153bed3
Import data for w_044 (#1526)
Might try replacing the clut with actual 16 bit colors. Is this the
right macro to use?

```
#define COLOR16(r, g, b, a) (r) + ((g) << 5) + ((b) << 10) + ((a) << 15)
```
2024-08-17 11:09:13 -07:00
sozud
4f78ac7675
Document ANIM_FRAME_LOAD (#1523)
I don't think this is the same as ANIMSET_OVL_FLAG, see RenderEntities.
2024-08-17 11:02:56 -07:00
SynaMax
2bfd6cb6f9
Updated sfx script symbols (#1528) 2024-08-16 23:25:36 -07:00
SynaMax
03b1059c1a
Renaming func_80134714 to PlaySfxVolPan (#1527) 2024-08-16 14:22:08 -07:00
Jonathan Hohle
ec33f90170
Rename Entity unk4C to anim (#1522)
`unk4c` is used to store a reference to the entity's current animation.
Renaming the field to `anim` match the purpose.
2024-08-16 16:11:14 +01:00