Hitbox factory and minor hitbox cleanup (#162)

* a start

* some things

* format

* hitboxes
This commit is contained in:
petrie911
2024-03-12 21:21:47 -05:00
committed by GitHub
parent 036e58535b
commit 46ce729392
12 changed files with 116 additions and 26 deletions
+4 -4
View File
@@ -260,10 +260,10 @@ s32 func_80036874(PlayerShot* shot, f32* hitboxData, Object* obj) {
boxRotZ = 0.0f;
boxRotY = 0.0f;
boxRotX = 0.0f;
if (hitboxData[0] >= HITBOX_UNK_3) {
if (hitboxData[0] >= HITBOX_TYPE_3) {
return 0;
}
if (hitboxData[0] == HITBOX_UNK_2) {
if (hitboxData[0] == HITBOX_TYPE_2) {
rotateBox = 1.0f;
boxRotX = hitboxData[1];
boxRotY = hitboxData[2];
@@ -372,7 +372,7 @@ s32 func_80036F88(PlayerShot* shot, Actor* actor) {
shotPy = shot->obj.pos.y;
shotPz = shot->obj.pos.z;
} else {
if (hitboxData[0] == HITBOX_UNK_2) {
if (hitboxData[0] == HITBOX_TYPE_2) {
Matrix_RotateZ(gCalcMatrix, -hitboxData[3] * M_DTOR, 0);
Matrix_RotateX(gCalcMatrix, -hitboxData[1] * M_DTOR, 1);
Matrix_RotateY(gCalcMatrix, -hitboxData[2] * M_DTOR, 1);
@@ -1763,7 +1763,7 @@ void func_8003C008(PlayerShot* shot) {
count = *hitboxData++;
if (count != 0) {
for (j = 0; j < count; j++, hitboxData += 6) {
if (hitboxData[0] == HITBOX_UNK_2) {
if (hitboxData[0] == HITBOX_TYPE_2) {
Matrix_RotateZ(gCalcMatrix, -hitboxData[3] * M_DTOR, 0);
Matrix_RotateX(gCalcMatrix, -hitboxData[1] * M_DTOR, 1);
Matrix_RotateY(gCalcMatrix, -hitboxData[2] * M_DTOR, 1);
+2 -2
View File
@@ -649,10 +649,10 @@ bool func_80062DBC(Vec3f* pos, f32* hitboxData, Object* obj, f32 xRot, f32 yRot,
for (i = 0; i < count; i++, hitboxData += 6) {
rotate = 0.0f;
hitRot.x = hitRot.y = hitRot.z = 0.0f;
if (*hitboxData >= HITBOX_UNK_3) {
if (*hitboxData >= HITBOX_TYPE_3) {
return false;
}
if (*hitboxData == HITBOX_UNK_2) {
if (*hitboxData == HITBOX_TYPE_2) {
rotate = 1.0f;
hitRot.x = hitboxData[1];
hitRot.y = hitboxData[2];
+7 -7
View File
@@ -1062,7 +1062,7 @@ s32 func_800A7974(Player* player, f32* hitboxData, s32* index, f32 xPos, f32 yPo
hitboxData++;
for (i = 0; i < count; i++, hitboxData += 6) {
spA0 = 0;
if (*hitboxData == HITBOX_UNK_2) {
if (*hitboxData == HITBOX_TYPE_2) {
Matrix_RotateZ(gCalcMatrix, -hitboxData[3] * M_DTOR, 0);
Matrix_RotateX(gCalcMatrix, -hitboxData[1] * M_DTOR, 1);
Matrix_RotateY(gCalcMatrix, -hitboxData[2] * M_DTOR, 1);
@@ -1072,7 +1072,7 @@ s32 func_800A7974(Player* player, f32* hitboxData, s32* index, f32 xPos, f32 yPo
hitboxData += 4;
spA0 = 1;
} else {
if (*hitboxData >= HITBOX_UNK_3) {
if (*hitboxData >= HITBOX_TYPE_3) {
hitboxData++;
}
Matrix_RotateZ(gCalcMatrix, -zRot * M_DTOR, 0);
@@ -1099,15 +1099,15 @@ s32 func_800A7974(Player* player, f32* hitboxData, s32* index, f32 xPos, f32 yPo
}
if (func_800A78C4((Hitbox*) hitboxData, xPos, yPos, zPos, var_fv0, var_fv1, var_fa0)) {
*index = i + 1;
if (hitboxData[-1] == HITBOX_UNK_3) {
if (hitboxData[-1] == HITBOX_TYPE_3) {
return -1;
}
if (hitboxData[-1] == HITBOX_UNK_4) {
if (hitboxData[-1] == HITBOX_TYPE_4) {
return -2;
}
return 3;
}
if (hitboxData[-1] < HITBOX_UNK_3) {
if (hitboxData[-1] < HITBOX_TYPE_3) {
if ((yRot == 0.0f) && (zRot == 0.0f) && (xRot == 0.0f) && (spA0 == 0)) {
var_fv0 = player->hit4.x;
var_fv1 = player->hit4.y;
@@ -2264,11 +2264,11 @@ void func_800AA800(Player* player) {
}
hitboxData++;
for (i = 0; i < count; i++, hitboxData += 6) {
if (*hitboxData >= HITBOX_UNK_3) {
if (*hitboxData >= HITBOX_TYPE_3) {
break;
}
if (*hitboxData == HITBOX_UNK_2) {
if (*hitboxData == HITBOX_TYPE_2) {
sp100 = hitboxData[1];
spFC = hitboxData[2];
spF8 = hitboxData[3];
+6 -6
View File
@@ -193,7 +193,7 @@ void func_80043B18(Player* player) {
if (player->unk_12C > -5.0f) {
sp48.x = 36.0f;
Matrix_MultVec3f(gCalcMatrix, &sp48, &sp3C);
if (gCurrentLevel == 0xB) {
if (gCurrentLevel == LEVEL_MACBETH) {
if (gGameFrameCount & 1) {
func_80043AA0(player->pos.x + sp3C.x, player->pos.y + sp3C.y, player->unk_138 + sp3C.z, 0.2f);
}
@@ -211,7 +211,7 @@ void func_80043B18(Player* player) {
if (player->unk_12C < 5.0f) {
sp48.x = -36.0f;
Matrix_MultVec3f(gCalcMatrix, &sp48, &sp3C);
if (gCurrentLevel == 0xB) {
if (gCurrentLevel == LEVEL_MACBETH) {
if (!(gGameFrameCount & 1)) {
func_80043AA0(player->pos.x + sp3C.x, player->pos.y + sp3C.y, player->unk_138 + sp3C.z, 0.2f);
}
@@ -997,7 +997,7 @@ s32 func_80046E40(Player* player, f32* hitboxData, s32* index, f32 xPos, f32 yPo
if (spB4 != 0) {
for (i = 0; i < spB4; i++, hitboxData += 6) {
spA0 = 0;
if (hitboxData[0] == HITBOX_UNK_2) {
if (hitboxData[0] == HITBOX_TYPE_2) {
Matrix_RotateZ(gCalcMatrix, -hitboxData[3] * M_DTOR, 0);
Matrix_RotateX(gCalcMatrix, -hitboxData[1] * M_DTOR, 1);
Matrix_RotateY(gCalcMatrix, -hitboxData[2] * M_DTOR, 1);
@@ -1007,7 +1007,7 @@ s32 func_80046E40(Player* player, f32* hitboxData, s32* index, f32 xPos, f32 yPo
hitboxData += 4;
spA0 = 1.0f;
} else {
if (hitboxData[0] == HITBOX_UNK_3) {
if (hitboxData[0] == HITBOX_TYPE_3) {
hitboxData++;
}
Matrix_RotateZ(gCalcMatrix, -zRot * M_DTOR, 0);
@@ -1068,13 +1068,13 @@ s32 func_80046E40(Player* player, f32* hitboxData, s32* index, f32 xPos, f32 yPo
}
if (func_800A78C4((Hitbox*) hitboxData, xPos, yPos, zPos, var_fv0, var_fv1, var_fa0)) {
*index = i + 1;
if (hitboxData[-1] == HITBOX_UNK_3) {
if (hitboxData[-1] == HITBOX_TYPE_3) {
return -1;
} else {
return 3;
}
}
if (hitboxData[-1] == HITBOX_UNK_3) {
if (hitboxData[-1] == HITBOX_TYPE_3) {
return 0;
}
if ((yRot == 0.0f) && (zRot == 0.0f) && (xRot == 0.0f) && (spA0 == 0)) {
+1 -1
View File
@@ -1212,7 +1212,7 @@ void func_i3_801AC274(Player* player) {
for (i = 0, actor = gActors; i < 60; i++, actor++) {
if ((actor->obj.status == OBJ_ACTIVE) && (actor->obj.id != OBJ_ACTOR_189)) {
var_v1 = 1;
if (actor->info.hitbox[1] == HITBOX_UNK_2) {
if (actor->info.hitbox[1] == HITBOX_TYPE_2) {
var_v1 = 5;
}
tempy1 = actor->obj.pos.y + actor->info.hitbox[var_v1 + 2] + actor->info.hitbox[var_v1 + 3] + 200.0f;
+2 -2
View File
@@ -6,12 +6,12 @@
// { { -397.8f, 130.0f }, { 1284.3999f, 262.59998f }, { 0.0f, 80.6f } },
// { { -223.59999f, 197.59999f }, { 904.8f, 145.59999f }, { 0.0f, 140.4f } },
// {
// HITBOX_UNK_2,
// HITBOX_TYPE_2,
// { 40.0f, 0.0f, 0.0f },
// { { -561.6f, 119.6f }, { 600.6f, 319.8f }, { 338.0f, 104.0f } },
// },
// {
// HITBOX_UNK_2,
// HITBOX_TYPE_2,
// { 40.0f, 0.0f, 0.0f },
// { { -561.6f, 119.6f }, { 600.6f, 319.8f }, { -338.0f, 104.0f } },
// },