mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-07 14:50:15 +00:00
z_bgcheck.c, 800430A0.c, 80043480.c (#256)
* beginning of migrating changes * got matching * changed order a bit * clean up bgcheck * fix conflict * fix conflict again * first stab at identifying types, some oks * Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs * more OKs, z_bgcheck.bss migration, update some sys_math3d.c args * couple more OKs * pushing some OKs * fix compilation issues * code_800430A0.c OK, more files decomp'd * 8003A3E0 big OK :) * Decomp most of func_8003C614, decomp helper funcs * Decomp SurfaceType, CamData, and WaterBox property related functions * more OKs, big OK in 8003C078 * more OKs, more progress, move a function definition in z_collision_check to functions.h * more clean-ups, more OKs, dyn_vtx is now defined as u8* * 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better * data migrated, more OKs * 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled * func_80040284, 800409A8 non_matching, add IS_ZERO macro * All asm files have C representations, some big OKs, lots of minor tweaks * More OKs, non-matching code cleanup * 8003FBF4 and 80040BE4 OK, improve codegen for most functions * format z_bgcheck.c * fix warnings, compile errors on NON_MATCHING * func_8003EE80 is now NON_MATCHING * begin documenting some functions * formatting * more documentation, func_8003A95C OK * fix PHYSICAL_TO_VIRTUAL changes * fix var rename * More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP * func_8004239C ok, more NON_MATCHING improvements, more documentation * Implement most suggested changes * Convert comments to slower comments * /** * Implement ZAP2 changes * my anti-virus ate my format.sh results * Rename a couple hundred functions, fix minor stuff * rename var so that clang formats correctly * run format.sh * implement Petrie's matches/suggestions * format * matches * and the asm * slight error * Add SSList * two more matches * stuff * implement code changes * clean up Petrie's matchings Co-authored-by: Arthur <arthurtilly413@gmail.com> Co-authored-by: fig02 <fig02srl@gmail.com> Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
This commit is contained in:
parent
209f0d21b8
commit
3cef03f5ff
416 changed files with 6610 additions and 13487 deletions
|
@ -25,7 +25,7 @@ void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx);
|
|||
void ObjOshihiki_SetupFall(ObjOshihiki* this, GlobalContext* globalCtx);
|
||||
void ObjOshihiki_Fall(ObjOshihiki* this, GlobalContext* globalCtx);
|
||||
|
||||
extern ColHeader D_05004E98;
|
||||
extern CollisionHeader D_05004E98;
|
||||
extern UNK_TYPE D_05003350;
|
||||
extern UNK_TYPE D_05003B50;
|
||||
extern UNK_TYPE D_05004350;
|
||||
|
@ -90,18 +90,17 @@ static Vec2f sFaceDirection[] = {
|
|||
{ -1.0f, -1.0f },
|
||||
};
|
||||
|
||||
void ObjOshihiki_InitDynapoly(ObjOshihiki* this, GlobalContext* globalCtx, ColHeader* collision,
|
||||
void ObjOshihiki_InitDynapoly(ObjOshihiki* this, GlobalContext* globalCtx, CollisionHeader* collision,
|
||||
DynaPolyMoveFlag moveFlag) {
|
||||
s32 pad;
|
||||
ColHeader* colHeader = NULL;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
s32 pad2;
|
||||
|
||||
DynaPolyInfo_SetActorMove(&this->dyna, moveFlag);
|
||||
DynaPolyInfo_Alloc(collision, &colHeader);
|
||||
this->dyna.dynaPolyId =
|
||||
DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
DynaPolyActor_Init(&this->dyna, moveFlag);
|
||||
CollisionHeader_GetVirtual(collision, &colHeader);
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
|
||||
if (this->dyna.dynaPolyId == 50) {
|
||||
if (this->dyna.bgId == BG_ACTOR_MAX) {
|
||||
// Warning : move BG registration failure
|
||||
osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_oshihiki.c", 280,
|
||||
this->dyna.actor.id, this->dyna.actor.params);
|
||||
|
@ -144,17 +143,17 @@ void ObjOshihiki_ResetFloors(ObjOshihiki* this) {
|
|||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(this->floorBgIds); i++) {
|
||||
this->floorBgIds[i] = 50;
|
||||
this->floorBgIds[i] = BGCHECK_SCENE;
|
||||
}
|
||||
}
|
||||
|
||||
ObjOshihiki* ObjOshihiki_GetBlockUnder(ObjOshihiki* this, GlobalContext* globalCtx) {
|
||||
DynaPolyActor* dyna;
|
||||
Actor* dyna;
|
||||
|
||||
if ((this->floorBgIds[this->highestFloor] != 50) &&
|
||||
if ((this->floorBgIds[this->highestFloor] != BGCHECK_SCENE) &&
|
||||
(fabsf(this->dyna.actor.groundY - this->dyna.actor.posRot.pos.y) < 0.001f)) {
|
||||
dyna = DynaPolyInfo_GetActor(&globalCtx->colCtx, this->floorBgIds[this->highestFloor]);
|
||||
if ((dyna != NULL) && (dyna->actor.id == ACTOR_OBJ_OSHIHIKI)) {
|
||||
dyna = DynaPoly_GetActor(&globalCtx->colCtx, this->floorBgIds[this->highestFloor]);
|
||||
if ((dyna != NULL) && (dyna->id == ACTOR_OBJ_OSHIHIKI)) {
|
||||
return (ObjOshihiki*)dyna;
|
||||
}
|
||||
}
|
||||
|
@ -319,7 +318,7 @@ void ObjOshihiki_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
|||
s32 pad;
|
||||
ObjOshihiki* this = THIS;
|
||||
|
||||
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
|
||||
void ObjOshihiki_SetFloors(ObjOshihiki* this, GlobalContext* globalCtx) {
|
||||
|
@ -341,8 +340,8 @@ void ObjOshihiki_SetFloors(ObjOshihiki* this, GlobalContext* globalCtx) {
|
|||
|
||||
floorPoly = &this->floorPolys[i];
|
||||
floorBgId = &this->floorBgIds[i];
|
||||
this->floorHeights[i] =
|
||||
func_8003CA64(&globalCtx->colCtx, floorPoly, floorBgId, &this->dyna.actor, &colCheckPoint, 0.0f);
|
||||
this->floorHeights[i] = BgCheck_EntityRaycastFloor6(&globalCtx->colCtx, floorPoly, floorBgId, &this->dyna.actor,
|
||||
&colCheckPoint, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -353,24 +352,24 @@ s16 ObjOshihiki_GetHighestFloor(ObjOshihiki* this) {
|
|||
|
||||
if (phi_f0 > this->floorHeights[highestFloor]) {
|
||||
highestFloor = temp;
|
||||
} else if ((this->floorBgIds[temp] == 50) && ((phi_f0 - this->floorHeights[highestFloor]) > -0.001f)) {
|
||||
} else if ((this->floorBgIds[temp] == BGCHECK_SCENE) && ((phi_f0 - this->floorHeights[highestFloor]) > -0.001f)) {
|
||||
highestFloor = temp;
|
||||
}
|
||||
if (this->floorHeights[temp + 1] > this->floorHeights[highestFloor]) {
|
||||
highestFloor = temp + 1;
|
||||
} else if ((this->floorBgIds[temp + 1] == 50) &&
|
||||
} else if ((this->floorBgIds[temp + 1] == BGCHECK_SCENE) &&
|
||||
((this->floorHeights[temp + 1] - this->floorHeights[highestFloor]) > -0.001f)) {
|
||||
highestFloor = temp + 1;
|
||||
}
|
||||
if (this->floorHeights[temp + 2] > this->floorHeights[highestFloor]) {
|
||||
highestFloor = temp + 2;
|
||||
} else if ((this->floorBgIds[temp + 2] == 50) &&
|
||||
} else if ((this->floorBgIds[temp + 2] == BGCHECK_SCENE) &&
|
||||
((this->floorHeights[temp + 2] - this->floorHeights[highestFloor]) > -0.001f)) {
|
||||
highestFloor = temp + 2;
|
||||
}
|
||||
if (this->floorHeights[temp + 3] > this->floorHeights[highestFloor]) {
|
||||
highestFloor = temp + 3;
|
||||
} else if ((this->floorBgIds[temp + 3] == 50) &&
|
||||
} else if ((this->floorBgIds[temp + 3] == BGCHECK_SCENE) &&
|
||||
((this->floorHeights[temp + 3] - this->floorHeights[highestFloor]) > -0.001f)) {
|
||||
highestFloor = temp + 3;
|
||||
}
|
||||
|
@ -421,7 +420,7 @@ s32 ObjOshihiki_CheckWall(GlobalContext* globalCtx, s16 angle, f32 direction, Ob
|
|||
Vec3f faceVtxNext;
|
||||
Vec3f posResult;
|
||||
Vec3f faceVtxOffset;
|
||||
u32 bgId;
|
||||
s32 bgId;
|
||||
CollisionPoly* outPoly;
|
||||
|
||||
faceVtxOffset.x = (sFaceVtx[i].x * this->dyna.actor.scale.x * 10.0f) + sFaceDirection[i].x;
|
||||
|
@ -434,8 +433,8 @@ s32 ObjOshihiki_CheckWall(GlobalContext* globalCtx, s16 angle, f32 direction, Ob
|
|||
faceVtxNext.x = faceVtx.x + maxDist * sn;
|
||||
faceVtxNext.y = faceVtx.y;
|
||||
faceVtxNext.z = faceVtx.z + maxDist * cs;
|
||||
if (func_8003DFA0(&globalCtx->colCtx, &faceVtx, &faceVtxNext, &posResult, &outPoly, 1, 0, 0, 1, &bgId,
|
||||
&this->dyna.actor, 0.0f)) {
|
||||
if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &faceVtx, &faceVtxNext, &posResult, &outPoly, 1, 0, 0, 1, &bgId,
|
||||
&this->dyna.actor, 0.0f)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -512,10 +511,10 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, GlobalContext* globalCtx) {
|
|||
|
||||
if (ObjOshihiki_CheckFloor(this, globalCtx)) {
|
||||
bgId = this->floorBgIds[this->highestFloor];
|
||||
if (bgId == 50) {
|
||||
if (bgId == BGCHECK_SCENE) {
|
||||
ObjOshihiki_SetupOnScene(this, globalCtx);
|
||||
} else {
|
||||
dynaActor = DynaPolyInfo_GetActor(&globalCtx->colCtx, bgId);
|
||||
dynaActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId);
|
||||
if (dynaActor != NULL) {
|
||||
func_800434A8(dynaActor);
|
||||
func_80043538(dynaActor);
|
||||
|
@ -540,10 +539,10 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
} else {
|
||||
bgId = this->floorBgIds[this->highestFloor];
|
||||
if (bgId == 50) {
|
||||
if (bgId == BGCHECK_SCENE) {
|
||||
ObjOshihiki_SetupFall(this, globalCtx);
|
||||
} else {
|
||||
dynaActor = DynaPolyInfo_GetActor(&globalCtx->colCtx, bgId);
|
||||
dynaActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId);
|
||||
|
||||
if ((dynaActor != NULL) && (dynaActor->unk_15C & 1)) {
|
||||
func_800434A8(dynaActor);
|
||||
|
@ -597,7 +596,7 @@ void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) {
|
|||
this->pushDist = 0.0f;
|
||||
this->pushSpeed = 0.0f;
|
||||
this->timer = 10;
|
||||
if (this->floorBgIds[this->highestFloor] == 50) {
|
||||
if (this->floorBgIds[this->highestFloor] == BGCHECK_SCENE) {
|
||||
ObjOshihiki_SetupOnScene(this, globalCtx);
|
||||
} else {
|
||||
ObjOshihiki_SetupOnActor(this, globalCtx);
|
||||
|
@ -624,15 +623,16 @@ void ObjOshihiki_Fall(ObjOshihiki* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
Actor_MoveForward(&this->dyna.actor);
|
||||
if (ObjOshihiki_CheckGround(this, globalCtx)) {
|
||||
if (this->floorBgIds[this->highestFloor] == 50) {
|
||||
if (this->floorBgIds[this->highestFloor] == BGCHECK_SCENE) {
|
||||
ObjOshihiki_SetupOnScene(this, globalCtx);
|
||||
} else {
|
||||
ObjOshihiki_SetupOnActor(this, globalCtx);
|
||||
}
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
|
||||
Audio_PlayActorSound2(&this->dyna.actor, func_80041F34(&globalCtx->colCtx, this->floorPolys[this->highestFloor],
|
||||
this->floorBgIds[this->highestFloor]) +
|
||||
SFX_FLAG);
|
||||
Audio_PlayActorSound2(&this->dyna.actor,
|
||||
SurfaceType_GetSfx(&globalCtx->colCtx, this->floorPolys[this->highestFloor],
|
||||
this->floorBgIds[this->highestFloor]) +
|
||||
SFX_FLAG);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue