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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 116 additions and 26 deletions

View File

@ -0,0 +1,50 @@
:config:
segments:
- [0x06, 0xA58F60]
header:
code:
- '#include "assets/ast_aquas.h"'
header:
- '#include "gfx.h"'
- '#include "sf64object.h"'
- '#include "structs.h"'
D_6030BFC: {type: SF64:HITBOX, offset: 0x6030BFC, symbol: D_6030BFC}
D_6030C18: {type: SF64:HITBOX, offset: 0x6030C18, symbol: D_6030C18}
D_6030C44: {type: SF64:HITBOX, offset: 0x6030C44, symbol: D_6030C44}
D_6030D20: {type: SF64:HITBOX, offset: 0x6030D20, symbol: D_6030D20}
D_6030D3C: {type: SF64:HITBOX, offset: 0x6030D3C, symbol: D_6030D3C}
D_6030D58: {type: SF64:HITBOX, offset: 0x6030D58, symbol: D_6030D58}
D_6030F74: {type: SF64:HITBOX, offset: 0x6030F74, symbol: D_6030F74}
D_6031398: {type: SF64:HITBOX, offset: 0x6031398, symbol: D_6031398}
D_60313CC: {type: SF64:HITBOX, offset: 0x60313CC, symbol: D_60313CC}
D_6031400: {type: SF64:HITBOX, offset: 0x6031400, symbol: D_6031400}
D_603144C: {type: SF64:HITBOX, offset: 0x603144C, symbol: D_603144C}
D_6031480: {type: SF64:HITBOX, offset: 0x6031480, symbol: D_6031480}
D_60314AC: {type: SF64:HITBOX, offset: 0x60314AC, symbol: D_60314AC}
D_60314C8: {type: SF64:HITBOX, offset: 0x60314C8, symbol: D_60314C8}
D_60314E4: {type: SF64:HITBOX, offset: 0x60314E4, symbol: D_60314E4}
D_6031500: {type: SF64:HITBOX, offset: 0x6031500, symbol: D_6031500}
D_603151C: {type: SF64:HITBOX, offset: 0x603151C, symbol: D_603151C}
D_6031538: {type: SF64:HITBOX, offset: 0x6031538, symbol: D_6031538}
D_6031554: {type: SF64:HITBOX, offset: 0x6031554, symbol: D_6031554}
D_6031570: {type: SF64:HITBOX, offset: 0x6031570, symbol: D_6031570}

View File

@ -0,0 +1,16 @@
:config:
segments:
- [0x06, 0xA8B470]
header:
code:
- '#include "assets/ast_area_6.h"'
header:
- '#include "gfx.h"'
- '#include "sf64object.h"'
- '#include "structs.h"'
D_6028454:
{type: SF64:HITBOX, offset: 0x6028454, symbol: D_6028454}
D_6028578:
{type: SF64:HITBOX, offset: 0x6028578, symbol: D_6028578}

View File

@ -5,4 +5,25 @@
#include "sf64object.h"
#include "structs.h"
extern f32 D_6030BFC[];
extern f32 D_6030C18[];
extern f32 D_6030C44[];
extern f32 D_6030D20[];
extern f32 D_6030D3C[];
extern f32 D_6030D58[];
extern f32 D_6030F74[];
extern f32 D_6031398[];
extern f32 D_60313CC[];
extern f32 D_6031400[];
extern f32 D_603144C[];
extern f32 D_6031480[];
extern f32 D_60314AC[];
extern f32 D_60314C8[];
extern f32 D_60314E4[];
extern f32 D_6031500[];
extern f32 D_603151C[];
extern f32 D_6031538[];
extern f32 D_6031554[];
extern f32 D_6031570[];
#endif

View File

@ -5,4 +5,7 @@
#include "sf64object.h"
#include "structs.h"
extern f32 D_6028454[];
extern f32 D_6028578[];
#endif

View File

@ -4,9 +4,9 @@
#include "libultra/ultra64.h"
#include "sf64math.h"
#define HITBOX_UNK_2 200000.0f
#define HITBOX_UNK_3 300000.0f
#define HITBOX_UNK_4 400000.0f
#define HITBOX_TYPE_2 200000.0f
#define HITBOX_TYPE_3 300000.0f
#define HITBOX_TYPE_4 400000.0f
typedef struct {
/* 0x0 */ f32 offset;

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);

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];

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];

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)) {

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;

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 } },
// },

@ -1 +1 @@
Subproject commit 84b6686f5b051ce729cc03d92dc71c94d0f19537
Subproject commit f1781973bc7bd3fc9b9cc32b4d631f9e1bbc9368