diff options
| author | Mike Lester <themikelester@gmail.com> | 2024-10-31 14:58:37 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-31 16:58:37 -0400 |
| commit | 64cc277d055439456e926e294fc131d91685b6ff (patch) | |
| tree | 671460304df96dc9240deb02d8d55e9e5c0bd562 /src/d/d_tree.cpp | |
| parent | 6f27d32ab148f8e075986b65df8ccdf6bf0801fa (diff) | |
d_wood (bushes) matching (#682)
* d_wood (bushes) 73% matching
* d_wood::Unit_c::set_ground 100% match
Jasper pointed me to the fact that the complicated inv_sqrt function I wrote was indeed just std::sqrtf(), which unlocked the rest of the match
* Replace some bitshifts with multiplies based on PR feedback
* Remove all instances of "this->" from d_wood
* Add missing struct offset comment for mTevStr
* Cleaned up d_tree externs
* Use MTXIdentity instead of PSMTXIdentity
* Remove incorrect TODO rearding cCcD_ObjAtType enum
* Use the mDoAud_seStart inline function
* Remove unnecessary parenthesis
* Fix incorrect branching logic in d_wood::cc_hit_before_cut()
* d_wood data sections fixup
* Re-add "Nonmatching" comments to all nonmatching functions
* Formatting: reformat from 2 to 4 space indentation
This was a local system problem which slipped by me in a previous commit
* 100% match for d_wood::Anm_c::mode_norm()
Thanks Chippy! https://discord.com/channels/727908905392275526/873250400483024976/1298360716964790294
* Use cLib_*Bit() functions for flag checking and setting
Based on the inline functions from the .map
* d_wood: Use AnmID_e according to the .map file
* d_wood: add a couple AnmID_e related inlines from the .map
* d_wood: Name remaining unknowns related to animation
* d_wood: Match cc_hit_before_cut()
* d_wood: Match calc_cc() by using the dComIfGp_roomControl_getStayNo() inline
* d_wood: Match string table and search_anm() by using a constant in assert string
* d_wood: Match mode_to_norm()
Switching normAnim to a const* did most of the work
* d_wood: 100% match for L_attr and the .rodata section
* d_wood: Fill in .data section. Still some extra data from vtables
* d_wood: Match .sbss section
* d_wood: Match .sdata section
* d_wood: 98% match for Packet_c::draw()
The only error is that g_dTree_shadowTexCoord is still using a 32-bit load instead of 16. the only way I know of to fix that is to define the data in this compilation unit. But that can't be right
* d_wood: Various small formatting changes
- No one line function implementations
- Replaced instances of (SomeType*)0x0 (copy/pasted from Ghidra) with NULL
- Replaced a few instances of 0.0 with 0.0f
- Replaced one instance where a number was used instead of an enum value
* d_wood: More formatting fixes
- Removed unused variables from functions
- Removed unnecessary iVar1 loop variables (leftover Ghidra detritus)
- Fixed dtk function comments being wrapped by autoformatter. They now always appear on one line
* d_tree: 100% match of data which is used by d_wood
This moves g_dTree_shadowTexCoord into .sdata which allows d_wood::Packet_c::draw() to load its address with a single instruction. This makes a 100% match for draw()
* d_wood: Removed unnecessary comment now that draw() matches
g_dTree_shadowTexCoord now lives in the d_tree .sdata section, so its instruction can be loaded with a single instruction. This makes a 100% match with draw().
* d_wood: 100% match for mode_cut()
* d_wood: Match mode_push_into()
Also renamed mWindDir to mForceDir as it represents both wind and an actor pushing from a vector
* d_wood: Match mode_push_back
* d_wood: Match __sinit_d_wood_cpp
The l_matDL display list is dynamically patched to reference the l_Txa_swood_bTEX texture at static initialization time. Is there a better way to represent this?
* d_wood: Fix incorrect constant in set_ground()
* d_wood: Simplify dummy data at the top of .data section
* d_wood: Mark as matching in configure.py
Had to move Packet_c destructor to get the functions in the right order. See discussion: https://discord.com/channels/727908905392275526/873250400483024976/1300680009458913280
* d_wood: Add `d/d_cc_d.h` include as some enums have moved
* d_wood: Clean up some types at the top
* Mark d_wood as non-matching for the Japanese version
Diffstat (limited to 'src/d/d_tree.cpp')
| -rw-r--r-- | src/d/d_tree.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/d/d_tree.cpp b/src/d/d_tree.cpp index f0f1a3c6..8a41532f 100644 --- a/src/d/d_tree.cpp +++ b/src/d/d_tree.cpp @@ -5,6 +5,14 @@ #include "d/d_tree.h" #include "dolphin/types.h" +#include "dolphin/mtx/mtx.h" + +u8 g_dTree_shadowPos[12] = { 0xb5, 0x00, 0x4b, 0x4b, 0x00, 0x4b, 0xb5, 0x00, 0xb5, 0x4b, 0x00, 0xb5 }; +u8 g_dTree_shadowTexCoord[8] = { 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01 }; +const u32 g_dTree_Oba_kage_32DL_SIZE = 0x2b; +const u32 g_dTree_shadowMatDL_SIZE = 0x90; +u8 g_dTree_Oba_kage_32DL[g_dTree_Oba_kage_32DL_SIZE] = { 0x98, 0x00, 0x04, 0x01, 0x02, 0x00, 0x03, 0x03, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +u8 g_dTree_shadowMatDL[g_dTree_shadowMatDL_SIZE] = { 0x61, 0x80, 0x00, 0x01, 0x35, 0x61, 0x84, 0x00, 0x00, 0x00, 0x61, 0x88, 0x00, 0x7c, 0x1f, 0x61, 0x94, 0x00, 0x00, 0x00, 0x61, 0x30, 0x00, 0x00, 0x20, 0x61, 0x31, 0x00, 0x00, 0x20, 0x10, 0x00, 0x00, 0x10, 0x40, 0xff, 0xff, 0x42, 0x80, 0x08, 0x30, 0x3c, 0xf3, 0xcf, 0x00, 0x10, 0x00, 0x00, 0x10, 0x18, 0x3c, 0xf3, 0xcf, 0x00, 0x61, 0x28, 0x38, 0x03, 0xc0, 0x61, 0xc0, 0x08, 0xff, 0xff, 0x61, 0xc1, 0x08, 0xe6, 0x70, 0x61, 0x43, 0x00, 0x00, 0x01, 0x61, 0x40, 0x00, 0x00, 0x07, 0x61, 0x41, 0x00, 0x04, 0xad, 0x61, 0xf3, 0x64, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x3f, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x10, 0x09, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; /* 800787BC-80078960 .text WorkCo__12dTree_data_cFP10fopAc_ac_cUli */ void dTree_data_c::WorkCo(fopAc_ac_c*, u32, int) { |
