Skip to content

Commit

Permalink
more renames
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaMech committed Jun 27, 2024
1 parent d0f7836 commit 65615cf
Show file tree
Hide file tree
Showing 22 changed files with 315 additions and 313 deletions.
12 changes: 5 additions & 7 deletions include/common_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ typedef struct {
/* 0x00 */ u16 unk30;
/* 0x02 */ u16 unk32;
/* 0x04 */ u16 unk34;
/* 0x06 */ u16 unk36;
/* 0x08 */ u16 unk38;
/* 0x06 */ u16 meshIndexYX;
/* 0x08 */ u16 meshIndexZY;
// This may be an index to the tilemap?
/* 0x0A */ u16 unk3A;
/* 0x0A */ u16 meshIndexZX;
/* 0x0C */ Vec3f surfaceDistance; // Appears to be distance from actor to surface for zx, yx, and zy planes.
/* 0x18 */ Vec3f unk48;
/* 0x24 */ Vec3f unk54;
Expand Down Expand Up @@ -185,7 +185,6 @@ typedef struct {
s16 ob[3]; /* x, y, z */
s16 tc[2]; /* texture coord */
s8 ca[4]; /* color & alpha */

} CourseVtx;

/*
Expand Down Expand Up @@ -214,9 +213,8 @@ typedef struct {
/* 0x10 */ Vtx *vtx1; //pointer to the 3 vertices of this poly
Vtx *vtx2;
Vtx *vtx3;

// Face normal. Should really be Vec3f normal
/* 0x1C */ f32 normalX;
// Used to calculate the height that Lakitu drops players at.
/* 0x20 */ f32 normalY;
/* 0x24 */ f32 normalZ;
/* 0x28 */ f32 distance;
Expand Down Expand Up @@ -331,7 +329,7 @@ typedef struct {
/* 0x0108 */ f32 unk_108;
/* 0x010C */ s16 unk_10C;
/* 0x010E */ char unk_10E[0x2];
/* 0x0110 */ Collision unk_110;
/* 0x0110 */ Collision collision;
/* 0x0150 */ Mat3 unk_150;
/* 0x0174 */ Mat3 orientationMatrix;
/* 0x0198 */ KartTyre tyres[4];
Expand Down
4 changes: 3 additions & 1 deletion include/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,4 +394,6 @@ enum KART_AI_BEHAVIOURS {

#define GRID_SIZE 32

#define HORIZONTAL_SURFACE 0x2000
#define FACING_Y_AXIS 0x4000
#define FACING_X_AXIS 0x8000
#define FACING_Z_AXIS 0x2000
4 changes: 2 additions & 2 deletions src/actors/blue_and_red_shells/update.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,15 @@ void update_actor_red_blue_shell(struct ShellActor *shell) {
switch (shell->state) {
case HELD_SHELL:
player = &gPlayers[shell->playerId];
copy_collision(&player->unk_110, &shell->unk30);
copy_collision(&player->collision, &shell->unk30);
somePosVel[0] = 0.0f;
somePosVel[1] = player->boundingBoxSize;
somePosVel[2] = -(player->boundingBoxSize + shell->boundingBoxSize + 2.0f);
mtxf_translate_vec3f_mat3(somePosVel, player->orientationMatrix);
shell->pos[0] = player->pos[0] + somePosVel[0];
pad7 = player->pos[1] - somePosVel[1];
shell->pos[2] = player->pos[2] + somePosVel[2];
height = calculate_surface_height(shell->pos[0], pad7, shell->pos[2], player->unk_110.unk3A);
height = calculate_surface_height(shell->pos[0], pad7, shell->pos[2], player->collision.meshIndexZX);
temp_f2 = pad7 - height;

if ((temp_f2 < 5.0f) && (temp_f2 > -5.0f)) {
Expand Down
2 changes: 1 addition & 1 deletion src/actors/falling_rock/render.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void render_actor_falling_rock(Camera *camera, struct FallingRock *rock) {
if (rock->unk30.unk34 == 1) {
sp8C[0] = rock->pos[0];
sp8C[2] = rock->pos[2];
height = calculate_surface_height(sp8C[0], rock->pos[1], sp8C[2], rock->unk30.unk3A);
height = calculate_surface_height(sp8C[0], rock->pos[1], sp8C[2], rock->unk30.meshIndexZX);
sp98[0] = 0;
sp98[1] = 0;
sp98[2] = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/actors/green_shell/update.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ void update_actor_green_shell(struct ShellActor *shell) {
switch (shell->state) {
case HELD_SHELL:
player = &gPlayers[shell->playerId];
copy_collision(&player->unk_110, &shell->unk30);
copy_collision(&player->collision, &shell->unk30);
somePosVel[0] = 0.0f;
somePosVel[1] = player->boundingBoxSize;
somePosVel[2] = -(player->boundingBoxSize + shell->boundingBoxSize + 2.0f);
mtxf_translate_vec3f_mat3(somePosVel, player->orientationMatrix);
shell->pos[0] = player->pos[0] + somePosVel[0];
pad2 = player->pos[1] - somePosVel[1];
shell->pos[2] = player->pos[2] + somePosVel[2];
height = calculate_surface_height(shell->pos[0], pad2, shell->pos[2], player->unk_110.unk3A);
height = calculate_surface_height(shell->pos[0], pad2, shell->pos[2], player->collision.meshIndexZX);
z = pad2 - height;
if ((z < 5.0f) && (z > -5.0f)) {
shell->pos[1] = shell->boundingBoxSize + height;
Expand Down
4 changes: 2 additions & 2 deletions src/actors/kiwano_fruit/update.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ void update_actor_kiwano_fruit(struct KiwanoFruit *fruit) {
s32 nearestWaypoint;

player = &gPlayers[fruit->targetPlayer];
if (((player->type & PLAYER_KART_AI) != 0) || (player->unk_110.unk34 == 0)) {
if (((player->type & PLAYER_KART_AI) != 0) || (player->collision.unk34 == 0)) {
fruit->state = 0;
return;
}
switch (fruit->state) { /* irregular */
case 0:
if ((get_surface_type(player->unk_110.unk3A) & 0xFF) != GRASS) {
if ((get_surface_type(player->collision.meshIndexZX) & 0xFF) != GRASS) {
return;
}
fruit->state = 1;
Expand Down
4 changes: 2 additions & 2 deletions src/camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ void func_8001E45C(Camera *camera, Player *player, s8 arg2) {
if (((player->effects & 0x80) == 0x80) || ((player->effects & 0x40) == 0x40) ||
((player->effects & 0x4000) == 0x4000) || ((player->effects & 0x80000) == 0x80000) ||
((player->effects & 0x800000) == 0x800000) || (((player->effects & 0x20) == 0x20) && (player->unk_078 != 0)) ||
(player->unk_110.surfaceDistance[0] <= 0.0f) || (player->unk_110.surfaceDistance[1] <= 0.0f) || ((player->effects & 0x20000) == 0x20000)) {
(player->collision.surfaceDistance[0] <= 0.0f) || (player->collision.surfaceDistance[1] <= 0.0f) || ((player->effects & 0x20000) == 0x20000)) {
func_8001CCEC(player, camera, sp64, &sp84, &sp80, &sp7C, &sp58, (s32) camera->unk_2C, (s32) arg2);
} else {
adjust_angle(&camera->unk_2C, (s16) (player->rotation[1] + camera->unk_B0), var_a3);
Expand Down Expand Up @@ -862,7 +862,7 @@ void func_8001EA0C(Camera *camera, Player *player, s8 arg2) {
if (((player->effects & 0x80) == 0x80) || ((player->effects & 0x40) == 0x40) ||
((player->effects & 0x4000) == 0x4000) || ((player->effects & 0x80000) == 0x80000) ||
((player->effects & 0x800000) == 0x800000) || (((player->effects & 0x20) == 0x20) && (player->unk_078 != 0)) ||
(player->unk_110.surfaceDistance[0] <= 0.0f) || (player->unk_110.surfaceDistance[1] <= 0.0f) || ((player->effects & 0x20000) == 0x20000)) {
(player->collision.surfaceDistance[0] <= 0.0f) || (player->collision.surfaceDistance[1] <= 0.0f) || ((player->effects & 0x20000) == 0x20000)) {
func_8001D944(player, camera, sp64, &sp84, &sp80, &sp7C, &sp58, (s32) camera->unk_2C, (s32) arg2);
} else {
adjust_angle(&camera->unk_2C, (s16) (player->rotation[1] + camera->unk_B0), var_a3);
Expand Down
20 changes: 10 additions & 10 deletions src/code_80005FD0.c
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ s32 func_80008E58(s32 payerId, s32 pathIndex) {
posY = player->pos[1];
posZ = player->pos[2];
stackPadding = pathIndex;
trackSegment = func_802ABD40(player->unk_110.unk3A);
trackSegment = get_section_id(player->collision.meshIndexZX);
D_80163318[payerId] = trackSegment;
sSomeNearestWaypoint = func_8000C0BC(posX, posY, posZ, trackSegment, &pathIndex);
gNearestWaypointByPlayerId[payerId] = sSomeNearestWaypoint;
Expand Down Expand Up @@ -2484,7 +2484,7 @@ s16 func_8000CC88(f32 posX, f32 posY, f32 posZ, Player *player, s32 playerId, s3
u16 trackSegment;
s16 ret;

trackSegment = func_802ABD40(player->unk_110.unk3A);
trackSegment = get_section_id(player->collision.meshIndexZX);
if ((trackSegment <= 0) || (trackSegment >= 0x33)) {
trackSegment = D_80163318[playerId];
}
Expand All @@ -2502,7 +2502,7 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, Player *playe
TrackWaypoint *temp_v1;

if ((player->type & 0x4000) && !(player->type & 0x1000)) {
sp5E = func_8000C884(posX, posY, posZ, waypointIndex, pathIndex, (u16) func_802ABD40(player->unk_110.unk3A));
sp5E = func_8000C884(posX, posY, posZ, waypointIndex, pathIndex, (u16) get_section_id(player->collision.meshIndexZX));
if (sp5E == -1) {
sp5E = func_8000CC88(posX, posY, posZ, player, playerId, &pathIndex);
}
Expand All @@ -2517,8 +2517,8 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, Player *playe
return waypointIndex;
}
if (playerId == ((s32) D_80163488 % 8)) {
check_bounding_collision(&player->unk_110, 10.0f, posX, posY, posZ);
D_80163318[playerId] = func_802ABD40(player->unk_110.unk3A);
check_bounding_collision(&player->collision, 10.0f, posX, posY, posZ);
D_80163318[playerId] = get_section_id(player->collision.meshIndexZX);
sp5E = func_8000C884(posX, posY, posZ, waypointIndex, pathIndex, D_80163318[playerId]);
if (sp5E == -1) {
sp5E = func_8000C9DC(posX, posY, posZ, waypointIndex, pathIndex);
Expand All @@ -2541,8 +2541,8 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, Player *playe
player->pos[0] = posX;
player->pos[1] = posY;
player->pos[2] = posZ;
check_bounding_collision(&player->unk_110, 10.0f, posX, posY, posZ);
D_80163318[playerId] = func_802ABD40(player->unk_110.unk3A);
check_bounding_collision(&player->collision, 10.0f, posX, posY, posZ);
D_80163318[playerId] = get_section_id(player->collision.meshIndexZX);
}
}
} else {
Expand Down Expand Up @@ -2595,7 +2595,7 @@ s16 func_8000D24C(f32 posX, f32 posY, f32 posZ, s32 *pathIndex) {
Collision sp24;

check_bounding_collision(&sp24, 10.0f, posX, posY, posZ);
return func_8000C0BC(posX, posY, posZ, func_802ABD40(sp24.unk3A), pathIndex);
return func_8000C0BC(posX, posY, posZ, get_section_id(sp24.meshIndexZX), pathIndex);
}

s16 func_8000D2B4(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, s32 pathIndex) {
Expand Down Expand Up @@ -3149,7 +3149,7 @@ void func_8000DF8C(s32 bombKartId) {
var_f24 += temp_f16 / 5.0f;
}
temp_a0_4 = &D_80164038[bombKartId];
var_f20 = calculate_surface_height(var_f22, 2000.0f, var_f24, temp_a0_4->unk3A) + 3.5f;
var_f20 = calculate_surface_height(var_f22, 2000.0f, var_f24, temp_a0_4->meshIndexZX) + 3.5f;
if (var_f20 < (-1000.0)) {
var_f20 = bombKart->bombPos[1];
}
Expand Down Expand Up @@ -3980,7 +3980,7 @@ s32 func_80011014(TrackWaypoint *pathDest, TrackWaypoint *path, s32 numPathPoint


pathDest->posZ = (s16) temp_f22;
pathDest->trackSegment = func_802ABD40(D_80162E70.unk3A);
pathDest->trackSegment = get_section_id(D_80162E70.meshIndexZX);

if (var_f20_2 < -500.0) {
var_f20_2 = var_f28;
Expand Down
Loading

0 comments on commit 65615cf

Please sign in to comment.