* Minor documenting
* trackbg_render_flashy cleanup
* Cleanup plane function
* trackmenu_render_names
* Run formatter
* Bitfields for trackmenu_render_names
* Add doc comment to trackmenu_render_names for adeventure two
* Cleanup pads in trackmenu_render_names
* Fix a + 0x1f into a -1
Object-collision resolution routine in objects.c. Compiled from C with
GLOBAL_ASM removed; ROM builds and verifies OK.
The last thing standing in the way was a misreading of the stack traffic
around the facet loop. The target stores f18/f20/f22 to 0xA4/0xA0/0x9C
immediately after the facet-count blez and reloads them after the loop,
which looks like a second set of origin variables being saved and restored
around the guard. It isn't - those are the compiler spilling the origin
values, because f18 is reused inside the loop as the scaled radius. Reading
the origins straight into x2/y2/z2 once per point, with no save/restore,
gives the exact instruction sequence; computing the interpolation deltas in
x, y, z order settles the remaining register allocation.
Two other constructs are load-bearing and are commented in place: var_a2
must be u32 and assigned after the interpolation-factor branch, otherwise
IDO reuses the 1 it hoists into a3 for the k-loop test; and the unused
f32 pad holds the stack slot at 0xEC.
Also drops the now-stale "NON EQUIVALENT" marker on the prototype in
objects.h and the WIP scratch link above the function.
Co-authored-by: akratch <kratch.adam@gmail.com>
Co-authored-by: Ryan Myers <ryan.p.myers@gmail.com>
Plane physics, the largest function in the game.
Two things were needed on top of the existing WIP:
1. Assign the squared magnitude into the same local that receives the
sqrtf result, as two statements. This merges the pre-call input and
the post-call factor into one live range, which is what gets the
normalization factor promoted into f20 and recovers the 248-byte
frame and the whole FP allocation.
2. In the final R_TRIG if/else, hoist the shift into its own statement
at the top of each arm (var_t0 >>= 1) instead of writing
(var_t0 >> 1) * 19 inline. That allocates and releases the shift's
temporary before the damping statement's temporaries, which fixes
the last 19 register differences.
The empty conditions in the wave loop, the dead double-assign into
var_t9, and the (var_v0 ^ 0) comparison are load-bearing for register
allocation.
Co-authored-by: akratch <kratch.adam@gmail.com>
* Match trackbg_render_flashy
Byte-identical on us.v80 (full ROM Verify: OK from C; GLOBAL_ASM removed).
Found by tracing IDO 5.3 uopt's register allocator: priority ties break by
expression-table creation order, so the dead defs (pad_sp100/pad_sp108)
emit no code but reorder the table and flip the f16/f18 tie. The explicit
unary-minus in zPositions[5] forces the target's homed temp (store at
0x2C), scaledXCos = 1280.0f keeps 320.0f register-resident past constant
folding, and pos.f[2] in uCoords[7] flips operand order in the final add.s.
Also resolves the old "@bug? sp78 is never set": it's the compiler's
uninitialized-variable join reload (levelHeader is simply unassigned on
the else path), not a game bug.
* Improve func_80017A18 WIP: frame, k-loop, and named registers now exact
---------
Co-authored-by: akratch <kratch.adam@gmail.com>
* unk14 to attachPoints
* unk18 to numberOfAttachPoints
* unk1C to collisionSpheres
* unk20 to collisionSpheresSize
* unk4A to numberOfAnimatedVertices
* unk4C to animatedVertexIndices
* unk50 to hasAnimatedTexture
* Run `python3 tools/format.py`
* WIP
* makefile up to date
* Get the first match for math_util!
* Do some cleanup and documenting
* slightly better comments now
* Document mtxf_transform_dir
* 2 more hasm docs
* vec3s_reflect
* mtx_to_mtxs_2
* Document mtxs_transform_point
* mtxs_transform_point and mtxs_transform_dir
* Better vec3s_reflect
* Better matches with docs
* Doc mtxf_from_inverse_transform
* Doc func_80070058
* Doc mtxf_billboard
* Doc vec3f_rotate
* Doc vec3f_rotate_ypr
* Doc vec3f_rotate_py
* Doc mtxf_from_translation
* Doc mtxf_from_scale
* Doc atan2s
* Doc arctan2_f
* more docs
* calc_dyn_lighting_for_level_segment cleanup
* fix build
* Document area_triangle_2d
* more docs
* dmacopy_doubleword
* more docs
* work on standardizing some comments
* small cleanup for calc_dyn_lighting_for_level_segment
* sins funcs cleanup and mild docs
* Remove old file
* Fix yamls
* woops, data too