Document effects and define magic values (#733)

* Document projection matrix function

Document function for computing a projection matrix. Used for camera and graphics.

* Fix loop index bug

Fix straightforward loop index bug introduced in last commit

* Style guide updates

Changes to match style recommendations
* Update function variables to camelCase
* Use dOxygen tags
* Use block comment

* Document math functions

* Give all functions in src\racing\math_util.c descriptive names

* Improve documentation for math_util

Improves a number of functions by giving descriptive argument names and comments

* Additional merge

* Fix style issues

update variables / parameters to use camelCase instead of snakeCase

* doxygen and other documentation

* Add doxygen documentation
* Rename mat -> mtx for consistency among matrices
* Theta -> Angle for angles
* Give some arguments more descriptive names

* Partial documentation for calculate_orientation_matrix

Documentation for when cosAxisY is 1 and observations that things break when if it does not equal 1.

* Rename functions

Renamed multiple functions for accuracy or clarity

* doxygen whitespace alignment

Improve readability of doxygen info by aligning text

* Make format check

Formatting updates suggested by make format

* Make skyboxes static

* Change function name

angle_from_coords -> get_angle_between_coords

* Math values renamed

Functions:
render_distance_squared -> distance_if_visible
mtxf_rotation_zxy_translate -> mtxf_rotate_zxy_translate

Arguments:
vecTrans -> translate

* Document many effects

Define effects for
* Braking
* Drifting
* Spinning out (driving and bananas)
* Mini turbos
* Losing at GP
* Tumbling on terrain
* CPU rubberbanding

And substitute some pre-existing defined effect names in place of bit flags

* Replace effect magic numbers with defined values

* Separate effect bit-flags into components

* Document more effects

* Rename some effects

* Replace effect bit_flags with defined values

* Formatting fixes

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
This commit is contained in:
Jed Grabman
2025-07-17 22:53:11 -04:00
committed by GitHub
parent 0a27fbbba0
commit a5526cc5bf
20 changed files with 776 additions and 668 deletions
+7 -7
View File
@@ -3152,7 +3152,7 @@ void func_80079860(s32 playerId) {
player = &gPlayerOne[playerId];
if ((func_80072354(objectIndex, 1) != 0) &&
(((func_802ABDF4(player->collision.meshIndexZX) != 0) && (player->collision.surfaceDistance[2] <= 3.0f)) ||
(player->unk_0CA & 1) || ((player->surfaceType == OUT_OF_BOUNDS) && !(player->effects & 8)))) {
(player->unk_0CA & 1) || ((player->surfaceType == OUT_OF_BOUNDS) && !(player->effects & MIDAIR_EFFECT)))) {
func_80090778(player);
func_800797AC(playerId);
}
@@ -3476,7 +3476,7 @@ void update_object_lakitu_reverse(s32 objectIndex, s32 playerId) {
}
switch (gObjectList[objectIndex].unk_0D6) { /* switch 1; irregular */
case 1: /* switch 1 */
if ((gObjectList[objectIndex].state >= 3) && (!(sp2C->effects & 0x400000))) {
if ((gObjectList[objectIndex].state >= 3) && (!(sp2C->effects & REVERSE_EFFECT))) {
func_80086F10(objectIndex, 6, &D_800E69F4);
gObjectList[objectIndex].unk_0D6 = 2;
gObjectList[objectIndex].unk_04C = 0x00000050;
@@ -3536,7 +3536,7 @@ void func_8007A88C(s32 playerId) {
objectIndex = gIndexLakituList[playerId];
player = &gPlayerOne[playerId];
if ((gObjectList[objectIndex].state == 0) && (player->effects & 0x400000)) {
if ((gObjectList[objectIndex].state == 0) && (player->effects & REVERSE_EFFECT)) {
func_800790E4(playerId);
}
}
@@ -5983,10 +5983,10 @@ void func_80080B28(s32 objectIndex, s32 playerId) {
if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) {
if (!(temp_s0->soundEffects & 0x100)) {
temp_f0 = func_80088F54(objectIndex, temp_s0);
if ((temp_f0 <= 9.0) && !(temp_s0->effects & 0x04000000) &&
if ((temp_f0 <= 9.0) && !(temp_s0->effects & SQUISH_EFFECT) &&
(has_collided_horizontally_with_player(objectIndex, temp_s0) != 0)) {
if ((temp_s0->type & PLAYER_EXISTS) && !(temp_s0->type & 0x100)) {
if (!(temp_s0->effects & 0x200)) {
if (!(temp_s0->effects & STAR_EFFECT)) {
func_80089474(objectIndex, playerId, 1.4f, 1.1f, SOUND_ARG_LOAD(0x19, 0x00, 0xA0, 0x4C));
} else if (func_80072354(objectIndex, 0x00000040) != 0) {
if (temp_s0->type & 0x1000) {
@@ -6386,7 +6386,7 @@ void func_80081D34(s32 objectIndex) {
player = gPlayerOne;
var_s4 = camera1;
for (playerIndex = 0; playerIndex < D_8018D158; playerIndex++, player++, var_s4++) {
if ((is_obj_flag_status_active(objectIndex, 0x00000200) != 0) && !(player->effects & 0x80000000) &&
if ((is_obj_flag_status_active(objectIndex, 0x00000200) != 0) && !(player->effects & BOO_EFFECT) &&
(has_collided_with_player(objectIndex, player) != 0)) {
if ((player->type & PLAYER_EXISTS) && !(player->type & 0x100)) {
var_s5 = 1;
@@ -6394,7 +6394,7 @@ void func_80081D34(s32 objectIndex) {
if (is_obj_flag_status_active(objectIndex, 0x04000000) != 0) {
func_80072180();
}
if (player->effects & 0x200) {
if (player->effects & STAR_EFFECT) {
func_800C9060(playerIndex, 0x1900A046U);
} else {
player->soundEffects |= 2;