diff options
| author | mzxrules <mzxrules@gmail.com> | 2020-04-25 22:43:35 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-25 22:43:35 -0400 |
| commit | aa91a7ee321fa27c409b2bb8e8ac5e026bdb6365 (patch) | |
| tree | 87c6367fcd98cd06170e64c7fcd7362aaf4e252d /src | |
| parent | f9bdb1d58a1600e8d0e96c8c7bba0c6907e4b77c (diff) | |
z_collision_check.c (#73)
* func_8005B280 ok
* func_8005B65C OK
* split out func_8005BD50
* func_8005B7C0 OK
* func_8005B7F4 OK
* func_8005B824 OK
* func_8005B860 ok
* improve sanity
* func_8005B6B0 ok, ColliderInit_Actor structs added
* func_8005B884 ok
* func_8005BBF8 ok, split out func_8005BF50
* split more stuff out of func_8005C050.s
* func_8005C050 OK
* func_8005BA30 fakish OK, func_8005BAD8 real OK
* func_8005BB48 OK, func_8005BA84 almost decomp'd, but type issues
* func_8005BB10 Ok
* func_8005BF50 OK
* func_8005BE50 OK
* func_8005BD50 OK
* func_8005BCC8 Ok
* func_8005BC28
* func_8005BB8C func_8005BBB0 func_8005BBD4 Ok
* save my work commit
* func_8005C2BC fake OK
* func_8005C5B0 ok
* func_8005C608 ok
* func_8005C6C0 ok
* func_8005C6F8 ok
* func_8005C730 ok
* func_8005C774 func_8005C798 func_8005C7BC OK
* func_8005C7E0 ok, func_8005C810 split
* func_8005C810 OK
* func_8005C8C8 ok
* func_8005C964 OK
* func_8005CA88 ok
* func_8005CBAC ok
* func_8005C124 func_8005C1AC func_8005C234 func_8005CC98 OK
* func_8005CD34 func_8005CDD0 Ok
* func_8005CE6C ok
* func_8005CEC4 ok
* func_8005CEDC ok
* func_8005CF90 Ok
* standardize type names/vars more
* func_8005D3BC ok
* func_8005D40C OK, z64.h CollisionCheckContext
* func_8005D4B4 func_8005D4C8 ok
* partial data section migration
* improve function documentation, OT->OC
* Actor_CollisionCheck_SetOC ok
* Actor_CollisionCheck_SetAT Actor_CollisionCheck_SetAC Ok
* func_8005BA84 ok
* func_800611A0 ok
* func_80061274 ok
* clean up func_80061274
* func_8006139C ok
* func_8005E9C0 and dependencies OK
* minor cleanup to func_8005E9C0
* func_8005EC6C OK!
* func_8005E81C ok
* func_8005E604 ok
* func_8005E2EC func_8005E4F8 OK
* func_8005DE9C OK func_8005D8AC disassembled
* func_8006146C func_8006268C ok
* func_8005EEE0 ok
* func_8005F17C
* func_8005F39C ok
* func_8005F5B0 decompiled, not matching
* func_8005F7D0 decomp, func_8005D218 and func_8005D324 OK
* func_8005FA30 ok, split more functions
* func_8005FC04 ok
* func_8005FDCC k
* func_8005FF90 OK OK OK
* func_80060204 dead
* func_800604B0 ok
* func_80060704 func_80060994 ok, func_80060C2C somewhat disassembled. AT to AC matrix doneish
* func_800635D0 ok, func_80062ECC not so much
* OcLine oks
* D_8011DF28 functions disassembled
* D_8011DF5C functions OK
* setAT_SAC. setAC_SAC, setOC_SAC OK
* func_80061C98 decompiled, func_80061BF4, func_80061C18 OK
* func_800617D4 ok, func_800614A4 disassembled
* CollisionCheck_OC D_8011DFAC functions OK
* func_80062530 ok
* CollisionCheck_generalLineOcCheck subfunctions OK
* func_800622E4 ok
* after a long fought battle, func_80061F64 has fallen.
* func_800628A4 disassembled
* func_800627A0 func_8006285C OK
* ActorCollider_Cylinder_Update, func_80062718, func_80062734 ok
* func_80062CD4 decompiled, import EffShield/EffSpark types from MM
* various SubActor98 struct functions OK
* func_8005D4DC func_8005D62C ok
* .data section migrated, more OKs, fix NON_MATCHINGs to use effect structs
* func_80060C2C ok
* minor code tweaks
* func_80061C98 ok somehow
* Attempt to fix some unknowns, move types out of z64actor, add set3 ColliderInit types
* Apply changes
* formatting
* tweak a couple function names
* krim changes, func naming
* missed some things
* function renames
* Implement GenColliderInit.py utility
* Implement pr changes, GenColliderInit.py, DamageTable.py, z_collision_btltbls.c fully matching
* func_800614A4 ok
* Implement Roman's fixes, name Collider unknowns, rename COLTYPE -> COLSHAPE and define new COLTYPE
* collisionCheckCtx -> colChkCtx, fix small things
Diffstat (limited to 'src')
49 files changed, 3661 insertions, 642 deletions
diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index 7a2aa4331..64f4a0d4c 100755 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -1709,8 +1709,8 @@ s32 func_800D0560(Sphere16* arg0, f32 arg1, f32 arg2) { return 0; } -void func_800D05D0(s32 arg0, s32 arg1) { +void func_800D05D0(GlobalContext* gctx, Sphere16* sph) { } -void func_800D05DC(s32 arg0, s32 arg1) { +void func_800D05DC(GlobalContext* gctx, Cylinder16* cyl) { } diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 149959ac5..61a9d7d9f 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -842,7 +842,7 @@ void Actor_Init(Actor* actor, GlobalContext* globalCtx) { actor->unk_F4 = 1000.0f; actor->unk_F8 = 350.0f; actor->unk_FC = 700.0f; - func_80061E48(&actor->sub_98); + func_80061E48(&actor->colChkInfo); actor->floorPolySource = 0x32; ActorShape_Init(&actor->shape, 0.0f, NULL, 0.0f); if (Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { @@ -870,9 +870,9 @@ void Actor_Destroy(Actor* actor, GlobalContext* globalCtx) { void func_8002D7EC(Actor* actor) { f32 speedRate = R_UPDATE_RATE * 0.5f; - actor->posRot.pos.x += (actor->velocity.x * speedRate) + actor->sub_98.displacement.x; - actor->posRot.pos.y += (actor->velocity.y * speedRate) + actor->sub_98.displacement.y; - actor->posRot.pos.z += (actor->velocity.z * speedRate) + actor->sub_98.displacement.z; + actor->posRot.pos.x += (actor->velocity.x * speedRate) + actor->colChkInfo.displacement.x; + actor->posRot.pos.y += (actor->velocity.y * speedRate) + actor->colChkInfo.displacement.y; + actor->posRot.pos.z += (actor->velocity.z * speedRate) + actor->colChkInfo.displacement.z; } void func_8002D868(Actor* actor) { @@ -1540,7 +1540,7 @@ s32 func_8002F2CC(Actor* actor, GlobalContext* globalCtx, f32 arg2) { } s32 func_8002F2F4(Actor* actor, GlobalContext* globalCtx) { - f32 var1 = 50.0f + actor->sub_98.unk_10; + f32 var1 = 50.0f + actor->colChkInfo.unk_10; return func_8002F2CC(actor, globalCtx, var1); } @@ -2097,7 +2097,7 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { } else if ((unkFlag && !(actor->flags & unkFlag)) || (!unkFlag && unkCondition && (sp74 != actor) && (actor != player->unk_68C) && (actor != player->heldActor) && (&player->actor != actor->attachedA))) { - func_80061E8C(&actor->sub_98); + func_80061E8C(&actor->colChkInfo); actor = actor->next; } else if (actor->update == NULL) { if (!actor->activelyDrawn) { @@ -2134,7 +2134,7 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { func_8003F8EC(globalCtx, &globalCtx->colCtx.dyna, actor); } - func_80061E8C(&actor->sub_98); + func_80061E8C(&actor->colChkInfo); actor = actor->next; } @@ -2484,7 +2484,7 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { } if ((HREG(64) != 1) || (HREG(76) != 0)) { - func_8005D62C(globalCtx, &globalCtx->sub_11E60); + CollisionCheck_Draw(globalCtx, &globalCtx->colChkCtx); } Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 6563); @@ -2542,7 +2542,7 @@ void func_80031B14(GlobalContext* globalCtx, ActorContext* actorCtx) { } } - func_8005D40C(globalCtx, &globalCtx->sub_11E60); + CollisionCheck_InitContext(globalCtx, &globalCtx->colChkCtx); actorCtx->flags.tempClear = 0; actorCtx->flags.tempSwch &= 0xFFFFFF; globalCtx->msgCtx.unk_E3F4 = 0; @@ -3262,8 +3262,8 @@ void func_80033480(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, s32 arg3, s1 } Actor* func_80033640(GlobalContext* globalCtx, Collider* collider) { - if ((collider->collideFlags & 0x2) && (collider->ac->type == ACTORTYPE_EXPLOSIVES)) { - collider->collideFlags &= ~0x2; + if ((collider->acFlags & 0x2) && (collider->ac->type == ACTORTYPE_EXPLOSIVES)) { + collider->acFlags &= ~0x2; return collider->ac; } @@ -3331,7 +3331,7 @@ Actor_80033780* func_80033780(GlobalContext* globalCtx, Actor* refActor, f32 arg spA8.y = itemActor->actor.posRot.pos.y + deltaY; spA8.z = itemActor->actor.posRot.pos.z + deltaZ; - if (func_80062ECC(refActor->sub_98.unk_10, refActor->sub_98.unk_12, 0.0f, &refActor->posRot.pos, + if (func_80062ECC(refActor->colChkInfo.unk_10, refActor->colChkInfo.unk_12, 0.0f, &refActor->posRot.pos, &itemActor->actor.posRot.pos, &spA8, &sp90, &sp84)) { return itemActor; } else { @@ -3982,7 +3982,7 @@ s32 func_80035124(Actor* actor, GlobalContext* globalCtx) { break; } - func_8002E4B4(globalCtx, actor, actor->sub_98.unk_12, actor->sub_98.unk_10, actor->sub_98.unk_10, 0x1D); + func_8002E4B4(globalCtx, actor, actor->colChkInfo.unk_12, actor->colChkInfo.unk_10, actor->colChkInfo.unk_10, 0x1D); return ret; } @@ -4061,11 +4061,10 @@ void func_800355B8(GlobalContext* globalCtx, Vec3f* arg1) { func_8003555C(globalCtx, arg1, &D_80116268, &D_80116274); } -u8 func_800355E4(GlobalContext* globalCtx, ColliderCylinderInit* colCylinderInit) { +u8 func_800355E4(GlobalContext* globalCtx, Collider* collider) { Player* player = PLAYER; - if ((colCylinderInit->inner.toucherDamage & 0x08) && (player->swordState != 0) && - (player->swordAnimation == 0x16)) { + if ((collider->acFlags & 0x08) && (player->swordState != 0) && (player->swordAnimation == 0x16)) { return 1; } else { return 0; @@ -4073,36 +4072,36 @@ u8 func_800355E4(GlobalContext* globalCtx, ColliderCylinderInit* colCylinderInit } u8 Actor_ApplyDamage(Actor* actor) { - if (actor->sub_98.damage >= actor->sub_98.health) { - actor->sub_98.health = 0; + if (actor->colChkInfo.damage >= actor->colChkInfo.health) { + actor->colChkInfo.health = 0; } else { - actor->sub_98.health -= actor->sub_98.damage; + actor->colChkInfo.health -= actor->colChkInfo.damage; } - return actor->sub_98.health; + return actor->colChkInfo.health; } void func_80035650(Actor* actor, ColliderBody* colBody, s32 freezeFlag) { - if (colBody->colliding == NULL) { + if (colBody->acHitItem == NULL) { actor->unk_116 = 0x00; - } else if (freezeFlag && (colBody->colliding->toucher.flags & 0x10060000)) { - actor->freeze = colBody->colliding->toucher.damage; + } else if (freezeFlag && (colBody->acHitItem->toucher.flags & 0x10060000)) { + actor->freeze = colBody->acHitItem->toucher.damage; actor->unk_116 = 0x00; - } else if (colBody->colliding->toucher.flags & 0x0800) { + } else if (colBody->acHitItem->toucher.flags & 0x0800) { actor->unk_116 = 0x01; - } else if (colBody->colliding->toucher.flags & 0x1000) { + } else if (colBody->acHitItem->toucher.flags & 0x1000) { actor->unk_116 = 0x02; - } else if (colBody->colliding->toucher.flags & 0x4000) { + } else if (colBody->acHitItem->toucher.flags & 0x4000) { actor->unk_116 = 0x04; - } else if (colBody->colliding->toucher.flags & 0x8000) { + } else if (colBody->acHitItem->toucher.flags & 0x8000) { actor->unk_116 = 0x08; - } else if ((colBody->colliding->toucher.flags << 0xF) < 0) { + } else if ((colBody->acHitItem->toucher.flags << 0xF) < 0) { actor->unk_116 = 0x10; - } else if (colBody->colliding->toucher.flags & 0x2000) { + } else if (colBody->acHitItem->toucher.flags & 0x2000) { actor->unk_116 = 0x20; - } else if ((colBody->colliding->toucher.flags << 0xC) < 0) { + } else if ((colBody->acHitItem->toucher.flags << 0xC) < 0) { if (freezeFlag) { - actor->freeze = colBody->colliding->toucher.damage; + actor->freeze = colBody->acHitItem->toucher.damage; } actor->unk_116 = 0x40; } else { @@ -4110,35 +4109,35 @@ void func_80035650(Actor* actor, ColliderBody* colBody, s32 freezeFlag) { } } -void func_8003573C(Actor* actor, ColliderBody* colBody, s32 freezeFlag) { +void func_8003573C(Actor* actor, ColliderJntSph* jntSph, s32 freezeFlag) { ColliderBody* curColBody; s32 flag; s32 i; actor->unk_116 = 0x00; - for (i = colBody->unk_18 - 1; i >= 0; i--) { - curColBody = &colBody->colBuf[i].c; - if (curColBody->colliding == NULL) { + for (i = jntSph->count - 1; i >= 0; i--) { + curColBody = &jntSph->list[i].body; + if (curColBody->acHitItem == NULL) { flag = 0x00; - } else if (freezeFlag && (curColBody->colliding->toucher.flags & 0x10060000)) { - actor->freeze = curColBody->colliding->toucher.damage; + } else if (freezeFlag && (curColBody->acHitItem->toucher.flags & 0x10060000)) { + actor->freeze = curColBody->acHitItem->toucher.damage; flag = 0x00; - } else if (curColBody->colliding->toucher.flags & 0x0800) { + } else if (curColBody->acHitItem->toucher.flags & 0x0800) { flag = 0x01; - } else if (curColBody->colliding->toucher.flags & 0x1000) { + } else if (curColBody->acHitItem->toucher.flags & 0x1000) { flag = 0x02; - } else if (curColBody->colliding->toucher.flags & 0x4000) { + } else if (curColBody->acHitItem->toucher.flags & 0x4000) { flag = 0x04; - } else if (curColBody->colliding->toucher.flags & 0x8000) { + } else if (curColBody->acHitItem->toucher.flags & 0x8000) { flag = 0x08; - } else if (curColBody->colliding->toucher.flags & 0x10000) { + } else if (curColBody->acHitItem->toucher.flags & 0x10000) { flag = 0x10; - } else if (curColBody->colliding->toucher.flags & 0x2000) { + } else if (curColBody->acHitItem->toucher.flags & 0x2000) { flag = 0x20; - } else if (curColBody->colliding->toucher.flags & 0x80000) { + } else if (curColBody->acHitItem->toucher.flags & 0x80000) { if (freezeFlag) { - actor->freeze = curColBody->colliding->toucher.damage; + actor->freeze = curColBody->acHitItem->toucher.damage; } flag = 0x40; } else { diff --git a/src/code/z_collision_btltbls.c b/src/code/z_collision_btltbls.c index b0485a562..c56347e9a 100644 --- a/src/code/z_collision_btltbls.c +++ b/src/code/z_collision_btltbls.c @@ -1,6 +1,112 @@ #include <ultra64.h> #include <global.h> -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_btltbls/CollisionBtlTbl_Get.s") +DamageTable D_8011DB20[] = { + { { + 0x10, 0x01, 0x01, 0x02, 0xE0, 0x01, 0xF2, 0x10, 0xF1, 0xF2, 0xF2, 0x22, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x10, 0x01, 0x01, 0x02, 0xE0, 0x01, 0xF2, 0x10, 0xF1, 0xF2, 0xF2, 0x22, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x10, 0x02, 0x01, 0x02, 0x10, 0x02, 0x02, 0x02, 0x01, 0x02, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, + 0x00, 0x04, 0x03, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x10, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x10, 0x02, 0x01, 0x02, 0x01, 0x02, 0x02, 0x02, 0x01, 0x02, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x10, 0x01, 0x01, 0x00, 0x10, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x31, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x00, 0x03, 0x00, 0x06, 0x00, 0x04, 0x04, 0x00, 0x02, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x00, 0x03, 0x00, 0x06, 0x00, 0x04, 0x04, 0x00, 0x02, 0x06, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x02, 0x02, 0x01, 0x02, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x10, 0x01, 0x00, 0xE2, 0x10, 0x01, 0x02, 0x10, 0xF1, 0xF2, 0xF2, 0x22, 0x32, 0x01, 0x00, 0x00, + 0x00, 0x22, 0x32, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x02, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x10, 0x01, 0x01, 0x02, 0x10, 0x01, 0x02, 0x10, 0x01, 0x02, 0x02, 0x22, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x02, 0x02, 0x01, 0x02, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x00, 0x02, 0x01, 0x02, 0x01, 0x02, 0x02, 0x02, 0x01, 0x02, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x10, 0x01, 0x00, 0x02, 0x10, 0x01, 0x02, 0x10, 0xF1, 0xF2, 0xF2, 0x22, 0x32, 0x01, 0x00, 0x00, + 0x00, 0x22, 0x32, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x10, 0x01, 0x01, 0xF2, 0xE0, 0x01, 0xD2, 0x10, 0x01, 0x02, 0x02, 0x00, 0x32, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x10, 0x01, 0x00, 0xF0, 0x10, 0x01, 0xF0, 0x10, 0x01, 0x02, 0x02, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, + { { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_btltbls/func_8005B248.s") +DamageTable* DamageTable_Get(s32 index) { + if (index < 0 || index >= 23) { + osSyncPrintf("CollisionBtlTbl_get():インデックスオーバー\n"); + return 0; + } + return &D_8011DB20[index]; +} + +void func_8005B248(DamageTable* table) { + s32 i; + for (i = 0; i < 32; i++) { + table->table[i] = 0; + } +} diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 5b6561232..a8bd723a4 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -1,392 +1,3355 @@ #include <ultra64.h> #include <global.h> +#include <vt.h> -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B280.s") +void func_8005B2AC(GraphicsContext* gfx, Vec3f* vA, Vec3f* vB, Vec3f* vC, u8 r, u8 g, u8 b); +// draw red poly +void func_8005B280(GraphicsContext* gfx, Vec3f* vA, Vec3f* vB, Vec3f* vC) { + func_8005B2AC(gfx, vA, vB, vC, 255, 0, 0); +} + +// draw poly #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B2AC.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B65C.s") +s32 Collider_InitBase(GlobalContext* globalCtx, Collider* collider) { + static Collider init = { NULL, NULL, NULL, NULL, 0, 0, 0, 0, COLTYPE_UNK3, COLSHAPE_INVALID }; + *collider = init; + return 1; +} -s32 func_8005B6A0(GlobalContext* globalCtx, Collider* collision) { +s32 Collider_DestroyBase(GlobalContext* globalCtx, Collider* collider) { return 1; } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B6B0.s") +s32 Collider_SetBase_Actor(GlobalContext* globalCtx, Collider* collider, ColliderInit_Actor* src) { + collider->actor = src->actor; + collider->atFlags = src->atFlags; + collider->acFlags = src->acFlags; + collider->maskA = src->maskA; + collider->maskB = 0x10; + collider->shape = src->shape; + return 1; +} -s32 func_8005B6EC(GlobalContext* globalCtx, Collider* collision, Actor* actor, ColliderBodyInfo* src) { - collision->actor = actor; - collision->unk_14 = src->unk_00; - collision->colliderFlags = src->colliderFlags; - collision->collideFlags = src->collideFlags; - collision->maskA = src->maskA; - collision->maskB = 0x10; - collision->type = src->maskB; +// maskB = 0x10 +s32 Collider_SetBase_Set3(GlobalContext* globalCtx, Collider* collider, Actor* actor, ColliderInit_Set3* src) { + collider->actor = actor; + collider->type = src->type; + collider->atFlags = src->atFlags; + collider->acFlags = src->acFlags; + collider->maskA = src->maskA; + collider->maskB = 0x10; + collider->shape = src->shape; return 1; } -s32 func_8005B72C(GlobalContext* globalCtx, Collider* collision, Actor* actor, ColliderBodyInfo* src) { - collision->actor = actor; - collision->unk_14 = src->unk_00; - collision->colliderFlags = src->colliderFlags; - collision->collideFlags = src->collideFlags; - collision->maskA = src->maskA; - collision->maskB = src->maskB; - collision->type = src->type; +// maskB = src->maskB +s32 Collider_SetBase(GlobalContext* globalCtx, Collider* collider, Actor* actor, ColliderInit* src) { + collider->actor = actor; + collider->type = src->type; + collider->atFlags = src->atFlags; + collider->acFlags = src->acFlags; + collider->maskA = src->maskA; + collider->maskB = src->maskB; + collider->shape = src->shape; return 1; } -void func_8005B76C(GlobalContext* globalCtx, Collider* collision) { - collision->at = NULL; - collision->colliderFlags &= ~0x6; +void Collider_BaseSetAT(GlobalContext* globalCtx, Collider* collider) { + collider->at = NULL; + collider->atFlags &= ~0x6; } -void func_8005B784(GlobalContext* globalCtx, Collider* collision) { - collision->ac = NULL; - collision->collideFlags &= ~0x82; +void Collider_BaseSetAC(GlobalContext* globalCtx, Collider* collider) { + collider->ac = NULL; + collider->acFlags &= ~0x82; } -void func_8005B79C(GlobalContext* globalCtx, Collider* collision) { - collision->ot = NULL; - collision->maskA &= ~0x2; - collision->maskB &= ~0x1; +void Collider_BaseSetOC(GlobalContext* globalCtx, Collider* collider) { + collider->oc = NULL; + collider->maskA &= ~0x2; + collider->maskB &= ~0x1; } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B7C0.s") +s32 Collider_InitTouch(GlobalContext* globalCtx, ColliderTouch* touch) { + static ColliderTouch init = { 0, 0, 0 }; + *touch = init; + return 1; +} -s32 func_8005B7E4(GlobalContext* globalCtx, ColliderTouch* touch) { +s32 Collider_DestroyTouch(GlobalContext* globalCtx, ColliderTouch* touch) { return 1; } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B7F4.s") +// src might actually be a different type +s32 Collider_SetTouch(GlobalContext* globalCtx, ColliderTouch* dest, ColliderTouch* src) { + dest->flags = src->flags; + dest->effect = src->effect; + dest->damage = src->damage; + return 1; +} -void func_8005B818(GlobalContext* globalCtx, ColliderBody* body) { +void Collider_BodySetAT_Unk(GlobalContext* globalCtx, ColliderBody* body) { } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B824.s") +s32 Collider_InitBump(GlobalContext* globalCtx, ColliderBump* bump) { + static ColliderBump init = { 0xFFCFFFFF, 0, 0, { 0, 0, 0 } }; + *bump = init; + return 1; +} -s32 func_8005B850(GlobalContext* globalCtx, ColliderBump* bump) { +s32 Collider_DestroyBump(GlobalContext* globalCtx, ColliderBump* bump) { return 1; } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B860.s") +s32 Collider_SetBump(GlobalContext* globalCtx, ColliderBump* bump, ColliderBumpInit* init) { + bump->flags = init->flags; + bump->effect = init->effect; + bump->defense = init->defense; + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B884.s") +s32 Collider_InitBody(GlobalContext* globalCtx, ColliderBody* body) { + static ColliderBody init = { + { 0, 0, 0 }, { 0xFFCFFFFF, 0, 0, { 0, 0, 0 } }, 0, 0, 0, 0, NULL, NULL, NULL, NULL, + }; + *body = init; + Collider_InitTouch(globalCtx, &body->toucher); + Collider_InitBump(globalCtx, &body->bumper); + return 1; +} -s32 func_8005B904(GlobalContext* globalCtx, ColliderBody* body) { - func_8005B7E4(globalCtx, &body->toucher); - func_8005B850(globalCtx, &body->bumper); +s32 Collider_DestroyBody(GlobalContext* globalCtx, ColliderBody* body) { + Collider_DestroyTouch(globalCtx, &body->toucher); + Collider_DestroyBump(globalCtx, &body->bumper); return 1; } -s32 func_8005B93C(GlobalContext* globalCtx, ColliderBody* body, ColliderBodyInfoInner* bodyInfoInner) { - body->flags = bodyInfoInner->bodyFlags; - func_8005B7F4(globalCtx, &body->toucher, &bodyInfoInner->toucherMask); - func_8005B860(globalCtx, &body->bumper, &bodyInfoInner->bumperMask); - body->toucherFlags = bodyInfoInner->toucherFlags; - body->bumperFlags = bodyInfoInner->bumperFlags; - body->flags2 = bodyInfoInner->bodyFlags2; +s32 Collider_SetBody(GlobalContext* globalCtx, ColliderBody* body, ColliderBodyInit* bodyInit) { + body->flags = bodyInit->bodyFlags; + Collider_SetTouch(globalCtx, &body->toucher, &bodyInit->toucher); + Collider_SetBump(globalCtx, &body->bumper, &bodyInit->bumper); + body->toucherFlags = bodyInit->toucherFlags; + body->bumperFlags = bodyInit->bumperFlags; + body->ocFlags = bodyInit->bodyFlags2; return 1; } -void func_8005B9B0(GlobalContext* globalCtx, ColliderBody* body) { - body->unk_18 = 0; - body->unk_20 = 0; +void Collider_BodySetAT(GlobalContext* globalCtx, ColliderBody* body) { + body->atHit = NULL; + body->atHitItem = NULL; body->toucherFlags &= ~0x2; body->toucherFlags &= ~0x40; - func_8005B818(globalCtx, body); + Collider_BodySetAT_Unk(globalCtx, body); } -void func_8005B9E8(GlobalContext* globalCtx, ColliderBody* body) { - body->bumper.unk_0A = 0; +void Collider_BodySetAC(GlobalContext* globalCtx, ColliderBody* body) { + body->bumper.unk_06.z = 0; body->bumperFlags &= ~0x2; body->bumperFlags &= ~0x80; - body->colBuf = NULL; - body->colliding = NULL; - body->bumper.unk_08 = body->bumper.unk_0A; - body->bumper.unk_06 = body->bumper.unk_0A; + body->acHit = NULL; + body->acHitItem = NULL; + body->bumper.unk_06.y = body->bumper.unk_06.z; + body->bumper.unk_06.x = body->bumper.unk_06.z; +} + +void Collider_BodySetOC(GlobalContext* globalCtx, ColliderBody* body) { + body->ocFlags &= ~0x2; +} + +s32 Collider_InitJntSphItemDim(GlobalContext* globalCtx, ColliderJntSphItemDim* dim) { + static ColliderJntSphItemDim init = { 0 }; + *dim = init; + return 1; +} + +s32 Collider_DestroyJntSphItemDim(GlobalContext* globalCtx, ColliderJntSphItemDim* item) { + return 1; +} + +s32 Collider_SetJntSphItemDim(GlobalContext* globalCtx, ColliderJntSphItemDim* dest, ColliderJntSphItemDimInit* src) { + dest->joint = src->joint; + dest->modelSphere = src->modelSphere; + dest->scale = src->scale * 0.01f; + return 1; +} + +s32 Collider_InitJntSphItem(GlobalContext* globalCtx, ColliderJntSphItem* item) { + Collider_InitBody(globalCtx, &item->body); + Collider_InitJntSphItemDim(globalCtx, &item->dim); + return 1; +} + +s32 Collider_DestroyJntSphItem(GlobalContext* globalCtx, ColliderJntSphItem* item) { + Collider_DestroyBody(globalCtx, &item->body); + Collider_DestroyJntSphItemDim(globalCtx, &item->dim); + return 1; +} + +s32 Collider_SetJntSphItem(GlobalContext* globalCtx, ColliderJntSphItem* dest, ColliderJntSphItemInit* src) { + Collider_SetBody(globalCtx, &dest->body, &src->body); + Collider_SetJntSphItemDim(globalCtx, &dest->dim, &src->dim); + return 1; +} + +s32 Collider_JntSphItemSetAT(GlobalContext* globalCtx, ColliderJntSphItem* collider) { + Collider_BodySetAT(globalCtx, &collider->body); + return 1; } -void func_8005BA1C(GlobalContext* globalCtx, ColliderBody* body) { - body->flags2 &= ~0x2; +s32 Collider_JntSphItemSetAC(GlobalContext* globalCtx, ColliderJntSphItem* collider) { + Collider_BodySetAC(globalCtx, &collider->body); + return 1; } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BA30.s") +s32 Collider_JntSphItemSetOC(GlobalContext* globalCtx, ColliderJntSphItem* collider) { + Collider_BodySetOC(globalCtx, &collider->body); + return 1; +} -s32 func_8005BA74(UNK_TYPE arg0, UNK_TYPE arg1) { +s32 Collider_InitJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) { + Collider_InitBase(globalCtx, &collider->base); + collider->count = 0; + collider->list = NULL; return 1; } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BA84.s") +// Destruct ColliderJntSph (malloc) +s32 Collider_FreeJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) { + ColliderJntSphItem* next; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BAD8.s") + Collider_DestroyBase(globalCtx, &collider->base); + next = collider->list; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BB10.s") + while (next < collider->list + collider->count) { + Collider_DestroyJntSphItem(globalCtx, next); + next++; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BB48.s") + collider->count = 0; + if (collider->list != NULL) { + ZeldaArena_FreeDebug(collider->list, "../z_collision_check.c", 1393); + } + collider->list = NULL; + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BB8C.s") +// Destruct ColliderJntSph (no malloc) +s32 Collider_DestroyJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) { + ColliderJntSphItem* next; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BBB0.s") + Collider_DestroyBase(globalCtx, &collider->base); + next = collider->list; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BBD4.s") + while (next < collider->list + collider->count) { -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BBF8.s") + Collider_DestroyJntSphItem(globalCtx, next); + next++; + } + collider->count = 0; + collider->list = NULL; + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BC28.s") +// ClObjJntSph +s32 Collider_SetJntSph_Set(GlobalContext* globalCtx, ColliderJntSph* dest, ColliderJntSphInit_Actor* src) { + ColliderJntSphItem* destNext; + ColliderJntSphItemInit* srcNext; + + Collider_SetBase_Actor(globalCtx, &dest->base, &src->base); + dest->count = src->count; + dest->list = ZeldaArena_MallocDebug(src->count * sizeof(ColliderJntSphItem), "../z_collision_check.c", 1443); + + if (dest->list == NULL) { + dest->count = 0; + osSyncPrintf(VT_FGCOL(RED)); + osSyncPrintf("ClObjJntSph_set():zelda_malloc()出来ません。\n"); // EUC-JP: 出来ません。 | Can not. + osSyncPrintf(VT_RST); + return 0; + } + + destNext = dest->list; + srcNext = src->list; + + while (destNext < dest->list + dest->count) { + Collider_InitJntSphItem(globalCtx, destNext); + Collider_SetJntSphItem(globalCtx, destNext, srcNext); + destNext++; + srcNext++; + } + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BCC8.s") +// ClObjJntSph_set3 (maskB = 0x10) +// called by En_Nwc +s32 Collider_SetJntSph_Set3(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* actor, + ColliderJntSphInit_Set3* src) { + ColliderJntSphItem* destNext; + ColliderJntSphItemInit* srcNext; + + Collider_SetBase_Set3(globalCtx, &dest->base, actor, &src->base); + dest->count = src->count; + dest->list = ZeldaArena_MallocDebug(src->count * sizeof(ColliderJntSphItem), "../z_collision_check.c", 1490); + + if (dest->list == NULL) { + dest->count = 0; + osSyncPrintf(VT_FGCOL(RED)); + osSyncPrintf("ClObjJntSph_set3():zelda_malloc_出来ません。\n"); // EUC-JP: 出来ません。 | Can not. + osSyncPrintf(VT_RST); + return 0; + } + + destNext = dest->list; + srcNext = src->list; + + while (destNext < dest->list + dest->count) { + Collider_InitJntSphItem(globalCtx, destNext); + Collider_SetJntSphItem(globalCtx, destNext, srcNext); + destNext++; + srcNext++; + } + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BE50.s") +// ClObjJntSph_set5 (maskB = src->maskB) +s32 Collider_SetJntSph_Set5(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src) { + ColliderJntSphItem* destNext; + ColliderJntSphItemInit* srcNext; + + Collider_SetBase(globalCtx, &dest->base, actor, &src->base); + dest->count = src->count; + dest->list = ZeldaArena_MallocDebug(src->count * sizeof(ColliderJntSphItem), "../z_collision_check.c", 1551); + + if (dest->list == NULL) { + dest->count = 0; + osSyncPrintf(VT_FGCOL(RED)); + osSyncPrintf("ClObjJntSph_set5():zelda_malloc出来ません\n"); // EUC-JP: 出来ません。 | Can not. + osSyncPrintf(VT_RST); + return 0; + } + + destNext = dest->list; + srcNext = src->list; + + while (destNext < dest->list + dest->count) { + Collider_InitJntSphItem(globalCtx, destNext); + Collider_SetJntSphItem(globalCtx, destNext, srcNext); + destNext++; + srcNext++; + } + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C050.s") +s32 Collider_SetJntSph(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* actor, ColliderJntSphInit* src, + ColliderJntSphItem* list) { + ColliderJntSphItem* destNext; + ColliderJntSphItemInit* srcNext; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C2BC.s") + Collider_SetBase(globalCtx, &dest->base, actor, &src->base); + dest->count = src->count; + dest->list = list; -s32 func_8005C318(GlobalContext* globalCtx, ColliderDimensions* dim) { + if (dest->list == NULL) { + __assert("pclobj_jntsph->elem_tbl != NULL", "../z_collision_check.c", 1603); + } + + destNext = dest->list; + srcNext = src->list; + + while (destNext < dest->list + dest->count) { + Collider_InitJntSphItem(globalCtx, destNext); + Collider_SetJntSphItem(globalCtx, destNext, srcNext); + destNext++; + srcNext++; + } return 1; } -s32 func_8005C328(GlobalContext* globalCtx, ColliderDimensions* dest, ColliderDimensions* src) { +s32 Collider_JntSphSetAT(GlobalContext* globalCtx, Collider* collider) { + ColliderJntSphItem* next; + ColliderJntSph* col = (ColliderJntSph*)collider; + GlobalContext* gctx = globalCtx; + + Collider_BaseSetAT(gctx, &col->base); + next = col->list; + + while (next < col->list + col->count) { + Collider_JntSphItemSetAT(gctx, next); + next++; + } + return 1; +} + +s32 Collider_JntSphSetAC(GlobalContext* globalCtx, Collider* collider) { + ColliderJntSphItem* next; + ColliderJntSph* col = (ColliderJntSph*)collider; + GlobalContext* gctx = globalCtx; + + Collider_BaseSetAC(gctx, &col->base); + next = col->list; + + while (next < col->list + col->count) { + Collider_JntSphItemSetAC(gctx, next); + next++; + } + return 1; +} + +s32 Collider_JntSphSetOC(GlobalContext* globalCtx, Collider* collider) { + ColliderJntSphItem* next; + ColliderJntSph* col = (ColliderJntSph*)collider; + GlobalContext* gctx = globalCtx; + + Collider_BaseSetOC(gctx, &col->base); + next = col->list; + while (next < col->list + col->count) { + Collider_JntSphItemSetOC(gctx, next); + next++; + } + return 1; +} + +s32 Collider_InitCylinderDim(GlobalContext* globalCtx, Cylinder16* dim) { + Cylinder16 init = { 0 }; + *dim = init; + return 1; +} + +s32 Collider_DestroyCylinderDim(GlobalContext* globalCtx, Cylinder16* dim) { + return 1; +} + +s32 Collider_SetCylinderDim(GlobalContext* globalCtx, Cylinder16* dest, Cylinder16* src) { *dest = *src; return 1; } -s32 ActorCollider_AllocCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision) { - func_8005B65C(globalCtx, &collision->base); - func_8005B884(globalCtx, &collision->body); - func_8005C2BC(globalCtx, &collision->dim); +s32 Collider_InitCylinder(GlobalContext* globalCtx, ColliderCylinder* collider) { + Collider_InitBase(globalCtx, &collider->base); + Collider_InitBody(globalCtx, &collider->body); + Collider_InitCylinderDim(globalCtx, &collider->dim); + return 1; +} + +s32 Collider_DestroyCylinder(GlobalContext* globalCtx, ColliderCylinder* collider) { + Collider_DestroyBase(globalCtx, &collider->base); + Collider_DestroyBody(globalCtx, &collider->body); + Collider_DestroyCylinderDim(globalCtx, &collider->dim); + return 1; +} + +// used only by DekuJr, D_80B92A00 +s32 Collider_SetCylinder_Actor(GlobalContext* globalCtx, ColliderCylinder* collider, ColliderCylinderInit_Actor* src) { + Collider_SetBase_Actor(globalCtx, &collider->base, &src->base); + Collider_SetBody(globalCtx, &collider->body, &src->body); + Collider_SetCylinderDim(globalCtx, &collider->dim, &src->dim); return 1; } -s32 ActorCollider_FreeCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision) { - func_8005B6A0(globalCtx, &collision->base); - func_8005B904(globalCtx, &collision->body); - func_8005C318(globalCtx, &collision->dim); +// maskB = 0x10 +s32 Collider_SetCylinder_Set3(GlobalContext* globalCtx, ColliderCylinder* collider, Actor* actor, + ColliderCylinderInit_Set3* src) { + Collider_SetBase_Set3(globalCtx, &collider->base, actor, &src->base); + Collider_SetBody(globalCtx, &collider->body, &src->body); + Collider_SetCylinderDim(globalCtx, &collider->dim, &src->dim); return 1; } -s32 func_8005C3F4(GlobalContext* globalCtx, ColliderCylinderMain* collision, ColliderCylinderInit* src) { - func_8005B6B0(globalCtx, &collision->base, &src->body); - func_8005B93C(globalCtx, &collision->body, &src->inner); - func_8005C328(globalCtx, &collision->dim, &src->dim); +// maskB = src->maskB +s32 Collider_SetCylinder(GlobalContext* globalCtx, ColliderCylinder* collider, Actor* actor, + ColliderCylinderInit* src) { + Collider_SetBase(globalCtx, &collider->base, actor, &src->base); + Collider_SetBody(globalCtx, &collider->body, &src->body); + Collider_SetCylinderDim(globalCtx, &collider->dim, &src->dim); return 1; } -s32 func_8005C450(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, ColliderCylinderInit* src) { - func_8005B6EC(globalCtx, &collision->base, actor, &src->body); - func_8005B93C(globalCtx, &collision->body, &src->inner); - func_8005C328(globalCtx, &collision->dim, &src->dim); +s32 Collider_CylinderSetAT(GlobalContext* globalCtx, Collider* collider) { + ColliderCylinder* col = (ColliderCylinder*)collider; + Collider_BaseSetAT(globalCtx, &col->base); + Collider_BodySetAT(globalCtx, &col->body); return 1; } -s32 ActorCollider_InitCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, - ColliderCylinderInit* src) { - func_8005B72C(globalCtx, &collision->base, actor, &src->body); - func_8005B93C(globalCtx, &collision->body, &src->inner); - func_8005C328(globalCtx, &collision->dim, &src->dim); +s32 Collider_CylinderSetAC(GlobalContext* globalCtx, Collider* collider) { + ColliderCylinder* col = (ColliderCylinder*)collider; + Collider_BaseSetAC(globalCtx, &col->base); + Collider_BodySetAC(globalCtx, &col->body); return 1; } -s32 func_8005C508(GlobalContext* globalCtx, ColliderCylinderMain* collision) { - func_8005B76C(globalCtx, &collision->base); - func_8005B9B0(globalCtx, &collision->body); +s32 Collider_CylinderSetOC(GlobalContext* globalCtx, Collider* collider) { + ColliderCylinder* col = (ColliderCylinder*)collider; + Collider_BaseSetOC(globalCtx, &col->base); + Collider_BodySetOC(globalCtx, &col->body); return 1; } -s32 func_8005C540(GlobalContext* globalCtx, ColliderCylinderMain* collision) { - func_8005B784(globalCtx, &collision->base); - func_8005B9E8(globalCtx, &collision->body); +s32 Collider_InitTrisItemDim(GlobalContext* globalCtx, TriNorm* dim) { + static TriNorm init = { 0 }; + *dim = init; return 1; } -s32 func_8005C578(GlobalContext* globalCtx, ColliderCylinderMain* collision) { - func_8005B79C(globalCtx, &collision->base); - func_8005BA1C(globalCtx, &collision->body); +s32 Collider_DestroyTrisItemDim(GlobalContext* globalCtx, TriNorm* dim) { + return 1; +} + +s32 Collider_SetTrisItemDim(GlobalContext* globalCtx, TriNorm* dest, ColliderTrisItemDimInit* src) { + Vec3f* d; + Vec3f* s; + float nx, ny, nz, nd; + + d = dest->vtx; + s = src->vtx; + while (d < dest->vtx + 3) { + *d++ = *s++; + } + + func_800CC8B4(&src->vtx[0], &src->vtx[1], &src->vtx[2], &nx, &ny, &nz, &nd); + + dest->plane.normal.x = nx; + dest->plane.normal.y = ny; + dest->plane.normal.z = nz; + dest->plane.originDist = nd; + return 1; +} + +s32 Collider_InitTrisItem(GlobalContext* globalCtx, ColliderTrisItem* collider) { + Collider_InitBody(globalCtx, &collider->body); + Collider_InitTrisItemDim(globalCtx, &collider->dim); + return 1; +} + +s32 Collider_DestroyTrisItem(GlobalContext* globalCtx, ColliderTrisItem* collider) { + Collider_DestroyBody(globalCtx, &collider->body); + Collider_DestroyTrisItemDim(globalCtx, &collider->dim); + return 1; +} + +s32 Collider_SetTrisItem(GlobalContext* globalCtx, ColliderTrisItem* dest, ColliderTrisItemInit* src) { + Collider_SetBody(globalCtx, &dest->body, &src->body); + Collider_SetTrisItemDim(globalCtx, &dest->dim, &src->dim); + return 1; +} + +s32 Collider_TrisItemSetAT(GlobalContext* globalCtx, ColliderTrisItem* item) { + Collider_BodySetAT(globalCtx, &item->body); + return 1; +} + +s32 Collider_TrisItemSetAC(GlobalContext* globalCtx, ColliderTrisItem* item) { + Collider_BodySetAC(globalCtx, &item->body); + return 1; +} + +s32 Collider_TrisItemSetOC(GlobalContext* globalCtx, ColliderTrisItem* item) { + Collider_BodySetOC(globalCtx, &item->body); + return 1; +} + +s32 Collider_InitTris(GlobalContext* globalCtx, ColliderTris* tris) { + Collider_InitBase(globalCtx, &tris->base); + tris->count = 0; + tris->list = 0; + return 1; +} + +// zelda malloc +s32 Collider_FreeTris(GlobalContext* globalCtx, ColliderTris* tris) { + ColliderTrisItem* next; + + Collider_DestroyBase(globalCtx, &tris->base); + next = tris->list; + + while (next < tris->list + tris->count) { + Collider_DestroyTrisItem(globalCtx, next); + next++; + } + + tris->count = 0; + if (tris->list != NULL) { + ZeldaArena_FreeDebug(tris->list, "../z_collision_check.c", 2099); + } + tris->list = NULL; return 1; } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C5B0.s") +// no malloc +s32 Collider_DestroyTris(GlobalContext* globalCtx, ColliderTris* tris) { + ColliderTrisItem* next; + + Collider_DestroyBase(globalCtx, &tris->base); + next = tris->list; -s32 func_8005C5F8(UNK_TYPE arg0, UNK_TYPE arg1) { + while (next < tris->list + tris->count) { + Collider_DestroyTrisItem(globalCtx, next); + next++; + } + tris->count = 0; + tris->list = NULL; return 1; } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C608.s") +// ClObjTris_set3 (maskB = 0x10) +s32 Collider_SetTris_Set3(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, ColliderTrisInit_Set3* src) { + ColliderTrisItem* destNext; + ColliderTrisItemInit* srcNext; + + Collider_SetBase_Set3(globalCtx, &dest->base, actor, &src->base); + dest->count = src->count; + dest->list = ZeldaArena_MallocDebug(dest->count * sizeof(ColliderTrisItem), "../z_collision_check.c", 2156); + if (dest->list == NULL) { + dest->count = 0; + osSyncPrintf(VT_FGCOL(RED)); + osSyncPrintf("ClObjTris_set3():zelda_malloc()出来ません\n"); // EUC-JP: 出来ません。 | Can not. + osSyncPrintf(VT_RST); + return 0; + } + destNext = dest->list; + srcNext = src->list; + + while (destNext < dest->list + dest->count) { + Collider_InitTrisItem(globalCtx, destNext); + Collider_SetTrisItem(globalCtx, destNext, srcNext); + destNext++; + srcNext++; + } + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C6C0.s") +// ClObjTris_set5 (maskB = src->maskB) +s32 Collider_SetTris_Set5(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, ColliderTrisInit* src) { + ColliderTrisItem* destNext; + ColliderTrisItemInit* srcNext; + + Collider_SetBase(globalCtx, &dest->base, actor, &src->base); + dest->count = src->count; + dest->list = ZeldaArena_MallocDebug(dest->count * sizeof(ColliderTrisItem), "../z_collision_check.c", 2207); + + if (dest->list == NULL) { + osSyncPrintf(VT_FGCOL(RED)); + osSyncPrintf("ClObjTris_set5():zelda_malloc出来ません\n"); // EUC-JP: 出来ません。 | Can not. + osSyncPrintf(VT_RST); + dest->count = 0; + return 0; + } + + destNext = dest->list; + srcNext = src->list; + + while (destNext < dest->list + dest->count) { + Collider_InitTrisItem(globalCtx, destNext); + Collider_SetTrisItem(globalCtx, destNext, srcNext); + destNext++; + srcNext++; + } + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C6F8.s") +s32 Collider_SetTris(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, ColliderTrisInit* src, + ColliderTrisItem* list) { + ColliderTrisItem* destNext; + ColliderTrisItemInit* srcNext; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C730.s") + Collider_SetBase(globalCtx, &dest->base, actor, &src->base); + dest->count = src->count; + dest->list = list; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C774.s") + if (dest->list == NULL) { + __assert("pclobj_tris->elem_tbl != NULL", "../z_collision_check.c", 2258); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C798.s") + destNext = dest->list; + srcNext = src->list; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C7BC.s") + while (destNext < dest->list + dest->count) { + Collider_InitTrisItem(globalCtx, destNext); + Collider_SetTrisItem(globalCtx, destNext, srcNext); + destNext++; + srcNext++; + } + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C7E0.s") +s32 Collider_TrisSetAT(GlobalContext* globalCtx, Collider* collider) { + ColliderTrisItem* next; + ColliderTris* col = (ColliderTris*)collider; + GlobalContext* gctx = globalCtx; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C8C8.s") + Collider_BaseSetAT(gctx, &col->base); + next = col->list; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005CBAC.s") + while (next < col->list + col->count) { + Collider_TrisItemSetAT(gctx, next); + next++; + } + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005CE6C.s") +s32 Collider_TrisSetAC(GlobalContext* globalCtx, Collider* collider) { + ColliderTrisItem* next; + ColliderTris* col = (ColliderTris*)collider; + GlobalContext* gctx = globalCtx; -s32 func_8005CEB4(GlobalContext* globalCtx, ColliderDimensions* dim) { + Collider_BaseSetAC(gctx, &col->base); + next = col->list; + + while (next < col->list + col->count) { + Collider_TrisItemSetAC(gctx, next); + next++; + } return 1; } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005CEC4.s") +s32 Collider_TrisSetOC(GlobalContext* globalCtx, Collider* collider) { + ColliderTrisItem* next; + ColliderTris* col = (ColliderTris*)collider; + GlobalContext* gctx = globalCtx; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005CEDC.s") + Collider_BaseSetOC(gctx, &col->base); + next = col->list; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005CF90.s") + while (next < col->list + col->count) { + Collider_TrisItemSetOC(gctx, next); + next++; + } + return 1; +} -s32 func_8005D018(GlobalContext* globalCtx, ColliderCylinderMain* collision) { - func_8005B65C(globalCtx, &collision->base); - func_8005B884(globalCtx, &collision->body); - func_8005CE6C(globalCtx, &collision->dim); +s32 Collider_InitQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dim) { + static ColliderQuadDim init = { + { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, + { 0, 0, 0 }, + { 0, 0, 0 }, + 1.0E38f, + }; + *dim = init; return 1; } -s32 func_8005D060(GlobalContext* globalCtx, ColliderCylinderMain* collision) { - func_8005B6A0(globalCtx, &collision->base); - func_8005B904(globalCtx, &collision->body); - func_8005CEB4(globalCtx, &collision->dim); +s32 Collider_DestroyQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dim) { return 1; } -s32 func_8005D0A8(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, ColliderCylinderInit* src) { - func_8005B6EC(globalCtx, &collision->base, actor, &src->body); - func_8005B93C(globalCtx, &collision->body, &src->inner); - func_8005CF90(globalCtx, &collision->dim, &src->dim); +// Set ColliderQuadDim unk_3C +s32 func_8005CEC4(GlobalContext* globalCtx, ColliderQuadDim* dim) { + dim->unk_3C = 1.0E38f; return 1; } -s32 func_8005D104(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, ColliderCylinderInit* src) { - func_8005B72C(globalCtx, &collision->base, actor, &src->body); - func_8005B93C(globalCtx, &collision->body, &src->inner); - func_8005CF90(globalCtx, &collision->dim, &src->dim); +// ColliderQuadDim compute dc ba midpoints +void func_8005CEDC(ColliderQuadDim* dim) { + dim->dcMid.x = (dim->quad[3].x + dim->quad[2].x) * 0.5f; + dim->dcMid.y = (dim->quad[3].y + dim->quad[2].y) * 0.5f; + dim->dcMid.z = (dim->quad[3].z + dim->quad[2].z) * 0.5f; + dim->baMid.x = (dim->quad[1].x + dim->quad[0].x) * 0.5f; + dim->baMid.y = (dim->quad[1].y + dim->quad[0].y) * 0.5f; + dim->baMid.z = (dim->quad[1].z + dim->quad[0].z) * 0.5f; +} + +s32 Collider_SetQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dest, ColliderQuadDimInit* src) { + dest->quad[0] = src->quad[0]; + dest->quad[1] = src->quad[1]; + dest->quad[2] = src->quad[2]; + dest->quad[3] = src->quad[3]; + func_8005CEDC(dest); return 1; } -s32 func_8005D160(GlobalContext* globalCtx, ColliderCylinderMain* collision) { - func_8005B76C(globalCtx, &collision->base); - func_8005B9B0(globalCtx, &collision->body); - func_8005CEC4(globalCtx, &collision->dim); +s32 Collider_InitQuad(GlobalContext* globalCtx, ColliderQuad* collider) { + Collider_InitBase(globalCtx, &collider->base); + Collider_InitBody(globalCtx, &collider->body); + Collider_InitQuadDim(globalCtx, &collider->dim); return 1; } -s32 func_8005D1A8(GlobalContext* globalCtx, ColliderCylinderMain* collision) { - func_8005B784(globalCtx, &collision->base); - func_8005B9E8(globalCtx, &collision->body); +s32 Collider_DestroyQuad(GlobalContext* globalCtx, ColliderQuad* collider) { + Collider_DestroyBase(globalCtx, &collider->base); + Collider_DestroyBody(globalCtx, &collider->body); + Collider_DestroyQuadDim(globalCtx, &collider->dim); return 1; } -s32 func_8005D1E0(GlobalContext* globalCtx, ColliderCylinderMain* collision) { - func_8005B79C(globalCtx, &collision->base); - func_8005BA1C(globalCtx, &collision->body); +// maskB = 0x10 +s32 Collider_SetQuad_Set3(GlobalContext* globalCtx, ColliderQuad* collider, Actor* actor, ColliderQuadInit_Set3* src) { + Collider_SetBase_Set3(globalCtx, &collider->base, actor, &src->base); + Collider_SetBody(globalCtx, &collider->body, &src->body); + Collider_SetQuadDim(globalCtx, &collider->dim, &src->dim); return 1; } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D218.s") +// maskB = src->maskB +s32 Collider_SetQuad(GlobalContext* globalCtx, ColliderQuad* collider, Actor* actor, ColliderQuadInit* src) { + Collider_SetBase(globalCtx, &collider->base, actor, &src->base); + Collider_SetBody(globalCtx, &collider->body, &src->body); + Collider_SetQuadDim(globalCtx, &collider->dim, &src->dim); + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D334.s") +s32 Collider_QuadSetAT(GlobalContext* globalCtx, Collider* collider) { + ColliderQuad* col = (ColliderQuad*)collider; + Collider_BaseSetAT(globalCtx, &col->base); + Collider_BodySetAT(globalCtx, &col->body); + func_8005CEC4(globalCtx, &col->dim); + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D3A4.s") +s32 Collider_QuadSetAC(GlobalContext* globalCtx, Collider* collider) { + ColliderQuad* col = (ColliderQuad*)collider; + Collider_BaseSetAC(globalCtx, &col->base); + Collider_BodySetAC(globalCtx, &col->body); + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D3BC.s") +s32 Collider_QuadSetOC(GlobalContext* globalCtx, Collider* collider) { + ColliderQuad* col = (ColliderQuad*)collider; + Collider_BaseSetOC(globalCtx, &col->base); + Collider_BodySetOC(globalCtx, &col->body); + return 1; +} -void func_8005D400(GlobalContext* globalCtx, SubGlobalContext11E60* sub_11E60) { +s32 func_8005D218(GlobalContext* globalCtx, ColliderQuad* quad, Vec3f* arg2) { + f32 temp; + Vec3f sp20; + + if (!(quad->body.toucherFlags & 4)) { + return 1; + } + Math_Vec3s_ToVec3f(&sp20, &quad->dim.dcMid); + temp = func_800CB650(&sp20, arg2); + if (temp < quad->dim.unk_3C) { + quad->dim.unk_3C = temp; + if (quad->body.atHit != NULL) { + Collider_BaseSetAC(globalCtx, quad->body.atHit); + } + if (quad->body.atHitItem != NULL) { + Collider_BodySetAC(globalCtx, quad->body.atHitItem); + } + return 1; + } + return 0; } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D40C.s") +s32 Collider_InitOcLine(GlobalContext* globalCtx, OcLine* line) { + static Vec3f init = { 0, 0, 0 }; + Vec3f temp; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D4DC.s") + temp = init; + Math_Vec3f_Copy(&line->line.a, &temp); + Math_Vec3f_Copy(&line->line.b, &temp); + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D62C.s") +s32 Collider_DestroyOcLine(GlobalContext* globalCtx, OcLine* line) { + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D79C.s") +s32 func_8005D334(UNK_TYPE arg0, OcLine* arg1, Vec3f* arg2, Vec3f* arg3) { + Math_Vec3f_Copy(&arg1->line.a, arg2); + Math_Vec3f_Copy(&arg1->line.b, arg3); + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D9F4.s") +s32 func_8005D378(UNK_TYPE arg0, OcLine* arg1, OcLine* arg2) { + arg1->unk_18 = arg2->unk_18; + func_8005D334(arg0, arg1, &arg2->line.a, &arg2->line.b); + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005DC4C.s") +s32 func_8005D3A4(GlobalContext* globalCtx, OcLine* line) { + line->unk_18 &= 0xFFFE; + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005DF2C.s") +void func_8005D3BC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { + colChkCtx->sacFlags = 0; + CollisionCheck_InitContext(globalCtx, colChkCtx); + AREG(21) = 1; + AREG(22) = 1; + AREG(23) = 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005DF50.s") +void CollisionCheck_DestroyContext(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005DF74.s") +// Initialize CollisionCheckContext +void CollisionCheck_InitContext(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { + Collider** c; + OcLine** d; + + if (!(colChkCtx->sacFlags & 1)) { + colChkCtx->colAtCount = 0; + colChkCtx->colAcCount = 0; + colChkCtx->colOcCount = 0; + colChkCtx->colOcLineCount = 0; + for (c = colChkCtx->colAt; c < colChkCtx->colAt + COLLISION_CHECK_AT_MAX; c++) { + *c = NULL; + } + + for (c = colChkCtx->colAc; c < colChkCtx->colAc + COLLISION_CHECK_AC_MAX; c++) { + *c = NULL; + } + + for (c = colChkCtx->colOc; c < colChkCtx->colOc + COLLISION_CHECK_OC_MAX; c++) { + *c = NULL; + } + + for (d = colChkCtx->colOcLine; d < colChkCtx->colOcLine + COLLISION_CHECK_OC_LINE_MAX; d++) { + *d = NULL; + } + } +} +// Unused +void CollisionCheck_EnableSAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { + colChkCtx->sacFlags |= 1; +} + +// Unused +void CollisionCheck_DisableSAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { + colChkCtx->sacFlags &= ~1; +} + +// Draw Collider +void func_8005D4DC(GlobalContext* globalCtx, Collider* collider) { + ColliderJntSph* jntSph; + ColliderCylinder* cylinder; + ColliderTris* tris; + ColliderTrisItem* trisItem; + ColliderQuad* quad; + s32 i; + + if (collider == NULL) { + return; + } + switch (collider->shape) { + case COLSHAPE_JNTSPH: + jntSph = (ColliderJntSph*)collider; + for (i = 0; i < jntSph->count; i++) { + func_800D05D0(globalCtx, &jntSph->list[i].dim.worldSphere); + } + break; + case COLSHAPE_CYLINDER: + cylinder = (ColliderCylinder*)collider; + func_800D05DC(globalCtx, &cylinder->dim); + break; + case COLSHAPE_TRIS: + tris = (ColliderTris*)collider; + for (i = 0; i < tris->count; i++) { + trisItem = &tris->list[i]; + func_8005B280(globalCtx->state.gfxCtx, &trisItem->dim.vtx[0], &trisItem->dim.vtx[1], + &trisItem->dim.vtx[2]); + } + break; + case COLSHAPE_QUAD: + quad = (ColliderQuad*)collider; + func_8005B280(globalCtx->state.gfxCtx, &quad->dim.quad[2], &quad->dim.quad[3], &quad->dim.quad[1]); + func_8005B280(globalCtx->state.gfxCtx, &quad->dim.quad[1], &quad->dim.quad[0], &quad->dim.quad[2]); + break; + } +} + +void CollisionCheck_Draw(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { + Collider* collider; + s32 i; + + if (AREG(15)) { + if (AREG(21)) { + for (i = 0; i < colChkCtx->colAtCount; i++) { + func_8005D4DC(globalCtx, colChkCtx->colAt[i]); + } + } + if (AREG(22)) { + for (i = 0; i < colChkCtx->colAcCount; i++) { + func_8005D4DC(globalCtx, colChkCtx->colAc[i]); + } + } + if (AREG(23)) { + for (i = 0; i < colChkCtx->colOcCount; i++) { + collider = colChkCtx->colOc[i]; + if (collider->maskA & 1) { + func_8005D4DC(globalCtx, collider); + } + } + } + if (AREG(24)) { + func_80042C3C(globalCtx, &globalCtx->colCtx); + } + if (AREG(25)) { + func_80042FC4(globalCtx, &globalCtx->colCtx); + } + } +} + +s32 (*D_8011DEF8[])(GlobalContext*, Collider*) = { Collider_JntSphSetAT, Collider_CylinderSetAT, Collider_TrisSetAT, + Collider_QuadSetAT }; + +// Sets collider as an AT (attack) for the current frame, which will be checked against ACs (attack colliders) +s32 CollisionCheck_SetAT(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { + s32 index; + + if (func_800C0D28(globalCtx) == 1) { + return -1; + } + if (!(collider->shape < COLSHAPE_INVALID)) { + __assert("pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 2997); + } + D_8011DEF8[collider->shape](globalCtx, collider); + if (collider->actor != NULL) { + if (collider->actor->update == NULL) { + return -1; + } + } + if (colChkCtx->colAtCount >= COLLISION_CHECK_AT_MAX) { + osSyncPrintf("CollisionCheck_setAT():インデックスがオーバーして追加不能\n"); + // EUC-JP: インデックスがオーバーして追加不能 | Index exceeded and cannot be added + return -1; + } + if (colChkCtx->sacFlags & 1) { + return -1; + } + index = colChkCtx->colAtCount; + colChkCtx->colAt[colChkCtx->colAtCount++] = collider; + return index; +} + +// Unused. Sets collider as an AT (attack) for the current frame, which will be checked against ACs (attack colliders). +// If CollisionCheck_SAC is enabled, the collider will be inserted into the list at the specified index, otherwise it +// will be inserted into the next slot +s32 CollisionCheck_SetAT_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, + s32 index) { + + if (!(collider->shape < COLSHAPE_INVALID)) { + __assert("pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3037); + } + if (func_800C0D28(globalCtx) == 1) { + return -1; + } + D_8011DEF8[collider->shape](globalCtx, collider); + if (collider->actor != NULL && collider->actor->update == NULL) { + return -1; + } + if (colChkCtx->sacFlags & 1) { + if (!(index < colChkCtx->colAtCount)) { + osSyncPrintf("CollisionCheck_setAT_SAC():全データ数より大きいところに登録しようとしている。\n"); + // EUC-JP: 全データ数より大きいところに登録しようとしている。 | You are trying to register a location that + // is larger than the total number of data. + return -1; + } + colChkCtx->colAt[index] = collider; + } else { + if (!(colChkCtx->colAtCount < COLLISION_CHECK_AT_MAX)) { + osSyncPrintf("CollisionCheck_setAT():インデックスがオーバーして追加不能\n"); + return -1; + } + index = colChkCtx->colAtCount; + colChkCtx->colAt[colChkCtx->colAtCount++] = collider; + } + return index; +} + +s32 (*D_8011DF08[])(GlobalContext*, Collider*) = { Collider_JntSphSetAC, Collider_CylinderSetAC, Collider_TrisSetAC, + Collider_QuadSetAC }; + +// Sets collider as an AC (attack collider) for the current frame, allowing it to detect ATs (attacks) +s32 CollisionCheck_SetAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { + s32 index; + + if (func_800C0D28(globalCtx) == 1) { + return -1; + } + if (!(collider->shape < COLSHAPE_INVALID)) { + __assert("pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3114); + } + D_8011DF08[collider->shape](globalCtx, collider); + if (collider->actor != NULL) { + if (collider->actor->update == NULL) { + return -1; + } + } + if (colChkCtx->colAcCount >= COLLISION_CHECK_AC_MAX) { + osSyncPrintf("CollisionCheck_setAC():インデックスがオーバして追加不能\n"); + // EUC-JP: インデックスがオーバして追加不能 | Index exceeded and cannot be added + return -1; + } + if (colChkCtx->sacFlags & 1) { + return -1; + } + index = colChkCtx->colAcCount; + colChkCtx->colAc[colChkCtx->colAcCount++] = collider; + return index; +} + +// Unused. Sets collider as an AC (attack collider) for the current frame, allowing it to detect ATs (attacks). +// If CollisionCheck_SAC is enabled, the collider will be inserted into the list at the specified index, otherwise it +// will be inserted into the next slot +s32 CollisionCheck_SetAC_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, + s32 index) { + + if (!(collider->shape < COLSHAPE_INVALID)) { + __assert("pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3153); + } + if (func_800C0D28(globalCtx) == 1) { + return -1; + } + D_8011DF08[collider->shape](globalCtx, collider); + if (collider->actor != NULL && collider->actor->update == NULL) { + return -1; + } + if (colChkCtx->sacFlags & 1) { + if (!(index < colChkCtx->colAcCount)) { + osSyncPrintf("CollisionCheck_setAC_SAC():全データ数より大きいところに登録しようとしている。\n"); + // EUC-JP: 全データ数より大きいところに登録しようとしている。| You are trying to register a location that is + // larger than the total number of data. + return -1; + } + colChkCtx->colAc[index] = collider; + } else { + if (!(colChkCtx->colAcCount < COLLISION_CHECK_AC_MAX)) { + osSyncPrintf("CollisionCheck_setAC():インデックスがオーバして追加不能\n"); + // EUC-JP: インデックスがオーバして追加不能 | Index exceeded and cannot be added + return -1; + } + index = colChkCtx->colAcCount; + colChkCtx->colAc[colChkCtx->colAcCount++] = collider; + } + return index; +} + +s32 (*D_8011DF18[])(GlobalContext*, Collider*) = { + Collider_JntSphSetOC, + Collider_CylinderSetOC, + Collider_TrisSetOC, + Collider_QuadSetOC, +}; + +// Sets collider as an OC (object collider) for the current frame, allowing it to detect other OCs +s32 CollisionCheck_SetOC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { + s32 index; + + if (func_800C0D28(globalCtx) == 1) { + return -1; + } + if (!(collider->shape < COLSHAPE_INVALID)) { + __assert("pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3229); + } + D_8011DF18[collider->shape](globalCtx, collider); + if (collider->actor != NULL) { + if (collider->actor->update == NULL) { + return -1; + } + } + if (colChkCtx->colOcCount >= COLLISION_CHECK_OC_MAX) { + osSyncPrintf("CollisionCheck_setOC():インデックスがオーバして追加不能\n"); + // EUC-JP: インデックスがオーバして追加不能 | Index exceeded and cannot be added + return -1; + } + if (colChkCtx->sacFlags & 1) { + return -1; + } + index = colChkCtx->colOcCount; + colChkCtx->colOc[colChkCtx->colOcCount++] = collider; + return index; +} + +// Unused. Sets collider as an OC (object collider) for the current frame, allowing it to detect other OCs +// If CollisionCheck_SAC is enabled, the collider will be inserted into the list at the specified index, otherwise it +// will be inserted into the next slot +s32 CollisionCheck_SetOC_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, + s32 index) { + + if (func_800C0D28(globalCtx) == 1) { + return -1; + } + if (!(collider->shape < COLSHAPE_INVALID)) { + __assert("pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3274); + } + D_8011DF18[collider->shape](globalCtx, collider); + if (collider->actor != NULL && collider->actor->update == NULL) { + return -1; + } + if (colChkCtx->sacFlags & 1) { + if (!(index < colChkCtx->colOcCount)) { + osSyncPrintf("CollisionCheck_setOC_SAC():全データ数より大きいところに登録しようとしている。\n"); + // EUC-JP: 全データ数より大きいところに登録しようとしている。| You are trying to register a location that is + // larger than the total number of data. + return -1; + } + // BUG: Should be colOc + colChkCtx->colAt[index] = collider; + } else { + if (!(colChkCtx->colOcCount < COLLISION_CHECK_OC_MAX)) { + osSyncPrintf("CollisionCheck_setOC():インデックスがオーバして追加不能\n"); + // EUC-JP: インデックスがオーバして追加不能 | Index exceeded and cannot be added + return -1; + } + index = colChkCtx->colOcCount; + colChkCtx->colOc[colChkCtx->colOcCount++] = collider; + } + return index; +} + +s32 CollisionCheck_SetOCLine(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, OcLine* collider) { + s32 index; + + if (func_800C0D28(globalCtx) == 1) { + return -1; + } + func_8005D3A4(globalCtx, collider); + if (!(colChkCtx->colOcLineCount < COLLISION_CHECK_OC_LINE_MAX)) { + osSyncPrintf("CollisionCheck_setOCLine():インデックスがオーバして追加不能\n"); + return -1; + } + index = colChkCtx->colOcLineCount; + colChkCtx->colOcLine[colChkCtx->colOcLineCount++] = collider; + return index; +} + +s32 func_8005DF2C(ColliderBody* body) { + if (!(body->toucherFlags & 1)) { + return 1; + } + return 0; +} + +s32 func_8005DF50(ColliderBody* body) { + if (!(body->bumperFlags & 1)) { + return 1; + } + return 0; +} + +s32 func_8005DF74(ColliderBody* left, ColliderBody* right) { + if (!(left->toucher.flags & right->bumper.flags)) { + return 1; + } + return 0; +} + +void func_8005DF9C(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { +} + +#ifdef NON_MATCHING +// Blue EffSpark +//.bss problems +void func_8005DFAC(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { + s32 sp24; + static EffSparkParams D_8015D8A0; + + D_8015D8A0.position.x = (s32)v->x; + D_8015D8A0.position.y = (s32)v->y; + D_8015D8A0.position.z = (s32)v->z; + D_8015D8A0.particleFactor1 = 5; + D_8015D8A0.particleFactor2 = 5; + D_8015D8A0.colorStart[0].r = 0x0A; + D_8015D8A0.colorStart[0].g = 0x0A; + D_8015D8A0.colorStart[0].b = 0xC8; + D_8015D8A0.colorStart[0].a = 0xFF; + D_8015D8A0.colorStart[1].r = 0x00; + D_8015D8A0.colorStart[1].g = 0x00; + D_8015D8A0.colorStart[1].b = 0x80; + D_8015D8A0.colorStart[1].a = 0xFF; + D_8015D8A0.colorStart[2].r = 0x00; + D_8015D8A0.colorStart[2].g = 0x00; + D_8015D8A0.colorStart[2].b = 0x80; + D_8015D8A0.colorStart[2].a = 0xFF; + D_8015D8A0.colorStart[3].r = 0x00; + D_8015D8A0.colorStart[3].g = 0x00; + D_8015D8A0.colorStart[3].b = 0x80; + D_8015D8A0.colorStart[3].a = 0xFF; + D_8015D8A0.colorEnd[0].r = 0x00; + D_8015D8A0.colorEnd[0].g = 0x00; + D_8015D8A0.colorEnd[0].b = 0x20; + D_8015D8A0.colorEnd[0].a = 0x00; + D_8015D8A0.colorEnd[1].r = 0x00; + D_8015D8A0.colorEnd[1].g = 0x00; + D_8015D8A0.colorEnd[1].b = 0x20; + D_8015D8A0.colorEnd[1].a = 0x00; + D_8015D8A0.colorEnd[2].r = 0x00; + D_8015D8A0.colorEnd[2].g = 0x00; + D_8015D8A0.colorEnd[2].b = 0x40; + D_8015D8A0.colorEnd[2].a = 0x00; + D_8015D8A0.colorEnd[3].r = 0x00; + D_8015D8A0.colorEnd[3].g = 0x00; + D_8015D8A0.colorEnd[3].b = 0x40; + D_8015D8A0.colorEnd[3].a = 0x00; + D_8015D8A0.age = 0; + D_8015D8A0.duration = 16; + D_8015D8A0.velocity = 8.0f; + D_8015D8A0.gravity = -1.0f; + Effect_Add(globalCtx, &sp24, 0, 0, 1, &D_8015D8A0); +} +#else +void func_8005DFAC(GlobalContext* globalCtx, Collider* collider, Vec3f* v); #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005DFAC.s") +#endif // NON_MATCHING + +#ifdef NON_MATCHING +// Green EffSpark +//.bss problems +void func_8005E10C(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { + s32 sp24; + static EffSparkParams D_8015DD68; + // D_8015DD68 + D_8015DD68.position.x = (s32)v->x; + D_8015DD68.position.y = (s32)v->y; + D_8015DD68.position.z = (s32)v->z; + D_8015DD68.particleFactor1 = 5; + D_8015DD68.particleFactor2 = 5; + D_8015DD68.colorStart[0].r = 0x0A; + D_8015DD68.colorStart[0].g = 0xC8; + D_8015DD68.colorStart[0].b = 0x0A; + D_8015DD68.colorStart[0].a = 0xFF; + D_8015DD68.colorStart[1].r = 0x00; + D_8015DD68.colorStart[1].g = 0x80; + D_8015DD68.colorStart[1].b = 0x00; + D_8015DD68.colorStart[1].a = 0xFF; + D_8015DD68.colorStart[2].r = 0x00; + D_8015DD68.colorStart[2].g = 0x80; + D_8015DD68.colorStart[2].b = 0x00; + D_8015DD68.colorStart[2].a = 0xFF; + D_8015DD68.colorStart[3].r = 0x00; + D_8015DD68.colorStart[3].g = 0x80; + D_8015DD68.colorStart[3].b = 0x00; + D_8015DD68.colorStart[3].a = 0xFF; + D_8015DD68.colorEnd[0].r = 0x00; + D_8015DD68.colorEnd[0].g = 0x20; + D_8015DD68.colorEnd[0].b = 0x00; + D_8015DD68.colorEnd[0].a = 0x00; + D_8015DD68.colorEnd[1].r = 0x00; + D_8015DD68.colorEnd[1].g = 0x20; + D_8015DD68.colorEnd[1].b = 0x00; + D_8015DD68.colorEnd[1].a = 0x00; + D_8015DD68.colorEnd[2].r = 0x00; + D_8015DD68.colorEnd[2].g = 0x40; + D_8015DD68.colorEnd[2].b = 0x00; + D_8015DD68.colorEnd[2].a = 0x00; + D_8015DD68.colorEnd[3].r = 0x00; + D_8015DD68.colorEnd[3].g = 0x40; + D_8015DD68.colorEnd[3].b = 0x00; + D_8015DD68.colorEnd[3].a = 0x00; + D_8015DD68.age = 0; + D_8015DD68.duration = 16; + D_8015DD68.velocity = 8.0f; + D_8015DD68.gravity = -1.0f; + Effect_Add(globalCtx, &sp24, 0, 0, 1, &D_8015DD68); +} +#else +void func_8005E10C(GlobalContext* globalCtx, Collider* collider, Vec3f* v); +#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005E10C.s") +#endif // NON_MATCHING + +void func_8005E26C(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { + func_800299AC(globalCtx, v); + func_80062B80(globalCtx, v); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005E2EC.s") +void func_8005E2A4(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { + func_80062A28(globalCtx, v); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005E4F8.s") +void func_8005E2C8(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { + func_80062A28(globalCtx, v); +} + +void func_8005E2EC(GlobalContext* globalCtx, ColliderBody* colliderBody, Collider* collider, Vec3f* arg3) { + s32 flags; + + flags = colliderBody->toucherFlags & 0x18; + if (flags == 0 && collider->type != COLTYPE_METAL_SHIELD) { + func_80029CA4(globalCtx, 0, arg3); + if (collider->actor == NULL) { + Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_BOUND, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + return; + } + Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_BOUND, &collider->actor->unk_E4, 4, &D_801333E0, &D_801333E0, + &D_801333E8); + return; + } + if (flags == 0) { + func_80029CA4(globalCtx, 3, arg3); + if (collider->actor == NULL) { + func_80062D60(globalCtx, arg3); + return; + } + func_80062DAC(globalCtx, arg3, &collider->actor->unk_E4); + return; + } + if (flags == 8) { + func_80029CA4(globalCtx, 0, arg3); + if (collider->actor == NULL) { + Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_BOUND, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + return; + } + Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_BOUND, &collider->actor->unk_E4, 4, &D_801333E0, &D_801333E0, + &D_801333E8); + return; + } + if (flags == 0x10) { + func_80029CA4(globalCtx, 1, arg3); + if (collider->actor == NULL) { + Audio_PlaySoundGeneral(NA_SE_IT_REFLECTION_WOOD, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + return; + } + Audio_PlaySoundGeneral(NA_SE_IT_REFLECTION_WOOD, &collider->actor->unk_E4, 4, &D_801333E0, &D_801333E0, + &D_801333E8); + return; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005E604.s") +s32 func_8005E4F8(Collider* left, ColliderBody* rightBody) { + if (left->actor != NULL) { + if (ACTORTYPE_PLAYER == left->actor->type) { + if (rightBody->flags == 0) { + Audio_PlaySoundGeneral(NA_SE_IT_SWORD_STRIKE, &left->actor->unk_E4, 4, &D_801333E0, &D_801333E0, + &D_801333E8); + } else if (rightBody->flags == 1) { + Audio_PlaySoundGeneral(NA_SE_IT_SWORD_STRIKE_HARD, &left->actor->unk_E4, 4, &D_801333E0, &D_801333E0, + &D_801333E8); + } else if (2 == rightBody->flags) { + Audio_PlaySoundGeneral(NA_SE_PL_WALK_GROUND, &left->actor->unk_E4, 4, &D_801333E0, &D_801333E0, + &D_801333E8); + } else if (rightBody->flags == 3) { + Audio_PlaySoundGeneral(NA_SE_PL_WALK_GROUND, &left->actor->unk_E4, 4, &D_801333E0, &D_801333E0, + &D_801333E8); + } + } + } + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005E800.s") +typedef struct { + u8 unk00; + u8 unk01; +} D_8011DF40_s; + +void func_8005E604(GlobalContext* globalCtx, Collider* left, ColliderBody* leftBody, Collider* right, + ColliderBody* rightBody, Vec3f* arg5) { + + static void (*D_8011DF28[])(GlobalContext*, Collider*, Vec3f*) = { + func_8005DF9C, func_8005DFAC, func_8005E10C, func_8005E26C, func_8005E2A4, func_8005E2C8, + }; + + static D_8011DF40_s D_8011DF40[] = { + { 1, 0 }, { 0, 1 }, { 2, 1 }, { 0, 0 }, { 3, 5 }, { 0, 2 }, { 2, 0 }, + { 4, 0 }, { 1, 2 }, { 0, 3 }, { 0, 5 }, { 0, 3 }, { 0, 3 }, { 0, 4 }, + }; + + if (rightBody->bumperFlags & 0x40) { + return; + } + if (!(leftBody->toucherFlags & 0x20) && leftBody->toucherFlags & 0x40) { + return; + } + if (right->actor != NULL) { + (*D_8011DF28[D_8011DF40[right->type].unk00])(globalCtx, right, arg5); + } + if (right->actor != NULL) { + if (D_8011DF40[right->type].unk01 == 3) { + func_8005E2EC(globalCtx, leftBody, right, arg5); + } else if (D_8011DF40[right->type].unk01 == 4) { + if (left->actor == NULL) { + func_80062CD4(globalCtx, arg5); + Audio_PlaySoundGeneral(NA_SE_IT_REFLECTION_WOOD, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + } else { + func_80062E14(globalCtx, arg5, &left->actor->unk_E4); + } + } else if (D_8011DF40[right->type].unk01 != 5) { + func_80029CA4(globalCtx, D_8011DF40[right->type].unk01, arg5); + if ((rightBody->bumperFlags & 0x20) == 0) { + func_8005E4F8(left, rightBody); + } + } + } else { + func_80029CA4(globalCtx, 0, arg5); + if (right->actor == NULL) { + Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_BOUND, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + } else { + Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_BOUND, &right->actor->unk_E4, 4, &D_801333E0, &D_801333E0, + &D_801333E8); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005E81C.s") +void func_8005E800(Collider* left, Collider* right) { + left->atFlags |= 4; + right->acFlags |= 0x80; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800611A0.s") +// Set AT to AC collision +s32 func_8005E81C(GlobalContext* globalCtx, Collider* left, ColliderBody* leftBody, Vec3f* leftv, Collider* right, + ColliderBody* rightBody, Vec3f* rightv, Vec3f* arg7) { + + if (right->acFlags & 4 && left->actor != NULL && right->actor != NULL) { + func_8005E800(left, right); + } + if (!(rightBody->bumperFlags & 8)) { + left->atFlags |= 2; + left->at = right->actor; + leftBody->atHit = right; + leftBody->atHitItem = rightBody; + leftBody->toucherFlags |= 2; + if (left->actor != NULL) { + left->actor->colChkInfo.atHitEffect = rightBody->bumper.effect; + } + } + right->acFlags |= 2; + right->ac = left->actor; + rightBody->acHit = left; + rightBody->acHitItem = leftBody; + rightBody->bumperFlags |= 2; + if (right->actor != NULL) { + right->actor->colChkInfo.acHitEffect = leftBody->toucher.effect; + } + rightBody->bumper.unk_06.x = (s16)arg7->x; + rightBody->bumper.unk_06.y = (s16)arg7->y; + rightBody->bumper.unk_06.z = (s16)arg7->z; + if (!(leftBody->toucherFlags & 0x20) && right->type != COLTYPE_METAL_SHIELD && + right->type != COLTYPE_WOODEN_SHIELD && right->type != COLTYPE_UNK12) { + rightBody->bumperFlags |= 0x80; + } else { + func_8005E604(globalCtx, left, leftBody, right, rightBody, arg7); + leftBody->toucherFlags |= 0x40; + } + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061274.s") +void CollisionCheck_AC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, + Collider* r) { + ColliderJntSph* left; + ColliderJntSph* right; + ColliderJntSphItem* lItem; + ColliderJntSphItem* rItem; + f32 sp8C; + f32 sp88; + f32 temp_f0; + Vec3f sp78; + Vec3f sp6C; + Vec3f sp60; + + left = (ColliderJntSph*)l; + right = (ColliderJntSph*)r; + if (left->count <= 0 || left->list == NULL || right->count <= 0 || right->list == NULL) { + return; + } + for (lItem = left->list; lItem < left->list + left->count; lItem++) { + if (func_8005DF2C(&lItem->body) == 1) { + continue; + } + for (rItem = right->list; rItem < right->list + right->count; rItem++) { + if (func_8005DF50(&rItem->body) == 1) { + continue; + } + if (func_8005DF74(&lItem->body, &rItem->body) == 1) { + continue; + } + if (Math3D_SpheresTouchingSurfaceCenter(&lItem->dim.worldSphere, &rItem->dim.worldSphere, &sp8C, &sp88) == + 1) { + sp6C.x = lItem->dim.worldSphere.center.x; + sp6C.y = lItem->dim.worldSphere.center.y; + sp6C.z = lItem->dim.worldSphere.center.z; + sp60.x = rItem->dim.worldSphere.center.x; + sp60.y = rItem->dim.worldSphere.center.y; + sp60.z = rItem->dim.worldSphere.center.z; + if (!(fabsf(sp88) < 0.008f)) { + temp_f0 = rItem->dim.worldSphere.radius / sp88; + sp78.x = (((sp6C.x - sp60.x) * temp_f0) + sp60.x); + sp78.y = (((sp6C.y - sp60.y) * temp_f0) + sp60.y); + sp78.z = (((sp6C.z - sp60.z) * temp_f0) + sp60.z); + } else { + Math_Vec3f_Copy(&sp78, &sp6C); + } + func_8005E81C(globalCtx, &left->base, &lItem->body, &sp6C, &right->base, &rItem->body, &sp60, &sp78); + if (!(right->base.maskB & 0x40)) { + return; + } + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8006139C.s") +void CollisionCheck_AC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, + Collider* r) { + ColliderJntSph* left = (ColliderJntSph*)l; + ColliderCylinder* right = (ColliderCylinder*)r; + ColliderJntSphItem* lItem; + f32 sp80; + f32 sp7C; + Vec3f sp70; + Vec3f sp64; + Vec3f sp58; + f32 temp_f0; + + if (left->count <= 0 || left->list == NULL || right->dim.radius <= 0 || right->dim.height <= 0) { + return; + } + if (func_8005DF50(&right->body) == 1) { + return; + } + for (lItem = left->list; lItem < left->list + left->count; lItem++) { + if (func_8005DF2C(&lItem->body) == 1) { + continue; + } + if (func_8005DF74(&lItem->body, &right->body) == 1) { + continue; + } + if (func_800CFDA4(&lItem->dim.worldSphere, &right->dim, &sp80, &sp7C) != 0) { + sp64.x = lItem->dim.worldSphere.center.x; + sp64.y = lItem->dim.worldSphere.center.y; + sp64.z = lItem->dim.worldSphere.center.z; + sp58.x = right->dim.pos.x; + sp58.y = right->dim.pos.y; + sp58.z = right->dim.pos.z; + if (!(fabsf(sp7C) < 0.008f)) { + temp_f0 = right->dim.radius / sp7C; + if (temp_f0 <= 1.0f) { + sp70.x = ((sp64.x - sp58.x) * temp_f0) + sp58.x; + sp70.y = ((sp64.y - sp58.y) * temp_f0) + sp58.y; + sp70.z = ((sp64.z - sp58.z) * temp_f0) + sp58.z; + } else { + Math_Vec3f_Copy(&sp70, &sp64); + } + } else { + Math_Vec3f_Copy(&sp70, &sp64); + } + func_8005E81C(globalCtx, &left->base, &lItem->body, &sp64, &right->base, &right->body, &sp58, &sp70); + return; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8006146C.s") +void CollisionCheck_AC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, + Collider* r) { + ColliderCylinder* left = (ColliderCylinder*)l; + ColliderJntSph* right = (ColliderJntSph*)r; + f32 sp9C; + f32 sp98; + ColliderJntSphItem* rItem; + Vec3f sp88; + Vec3f sp7C; + Vec3f sp70; + f32 temp_f0; + + if (right->count <= 0 || right->list == NULL || left->dim.radius <= 0 || left->dim.height <= 0) { + return; + } + if (func_8005DF2C(&left->body) == 1) { + return; + } + for (rItem = right->list; rItem < right->list + right->count; rItem++) { + if (func_8005DF50(&rItem->body) == 1) { + continue; + } + if (func_8005DF74(&left->body, &rItem->body) == 1) { + continue; + } + if (func_800CFDA4(&rItem->dim.worldSphere, &left->dim, &sp9C, &sp98) != 0) { + sp7C.x = left->dim.pos.x; + sp7C.y = left->dim.pos.y; + sp7C.z = left->dim.pos.z; + sp70.x = rItem->dim.worldSphere.center.x; + sp70.y = rItem->dim.worldSphere.center.y; + sp70.z = rItem->dim.worldSphere.center.z; + if (!(fabsf(sp98) < 0.008f)) { + temp_f0 = (f32)rItem->dim.worldSphere.radius / sp98; + if (temp_f0 <= 1.0f) { + sp88.x = ((sp7C.x - sp70.x) * temp_f0) + sp70.x; + sp88.y = ((sp7C.y - sp70.y) * temp_f0) + sp70.y; + sp88.z = ((sp7C.z - sp70.z) * temp_f0) + sp70.z; + } else { + Math_Vec3f_Copy(&sp88, &sp7C); + } + } else { + Math_Vec3f_Copy(&sp88, &sp7C); + } + func_8005E81C(globalCtx, &left->base, &left->body, &sp7C, &right->base, &rItem->body, &sp70, &sp88); + if (!(right->base.maskB & 0x40)) { + break; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800614A4.s") +void CollisionCheck_AC_JntSphVsTris(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, + Collider* r) { + ColliderJntSph* left = (ColliderJntSph*)l; + ColliderTris* right = (ColliderTris*)r; + ColliderJntSphItem* lItem; + ColliderTrisItem* rItem; + Vec3f sp6C; + Vec3f sp60; + Vec3f sp54; + + if (left->count <= 0 || left->list == NULL || right->count <= 0 || right->list == NULL) { + return; + } + for (lItem = left->list; lItem < left->list + left->count; lItem++) { + if (func_8005DF2C(&lItem->body) == 1) { + continue; + } + for (rItem = right->list; rItem < right->list + right->count; rItem++) { + if (func_8005DF50(&rItem->body) == 1) { + continue; + } + if (func_8005DF74(&lItem->body, &rItem->body) == 1) { + continue; + } + if (func_800CE934(&lItem->dim.worldSphere, &rItem->dim, &sp6C) == 1) { + sp60.x = lItem->dim.worldSphere.center.x; + sp60.y = lItem->dim.worldSphere.center.y; + sp60.z = lItem->dim.worldSphere.center.z; + sp54.x = (rItem->dim.vtx[0].x + rItem->dim.vtx[1].x + rItem->dim.vtx[2].x) * (1.0f / 3); + sp54.y = (rItem->dim.vtx[0].y + rItem->dim.vtx[1].y + rItem->dim.vtx[2].y) * (1.0f / 3); + sp54.z = (rItem->dim.vtx[0].z + rItem->dim.vtx[1].z + rItem->dim.vtx[2].z) * (1.0f / 3); + func_8005E81C(globalCtx, &left->base, &lItem->body, &sp60, &right->base, &rItem->body, &sp54, &sp6C); + return; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8006199C.s") +void CollisionCheck_AC_TrisVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, + Collider* r) { + ColliderTris* left = (ColliderTris*)l; + ColliderTrisItem* lItem; + ColliderJntSph* right = (ColliderJntSph*)r; + ColliderJntSphItem* rItem; + Vec3f sp7C; + Vec3f sp70; + Vec3f sp64; + + if (right->count > 0 && right->list != NULL) { + if (left->count > 0 && left->list != NULL) { + for (rItem = right->list; rItem < right->list + right->count; rItem++) { + if (func_8005DF50(&rItem->body) == 1) { + continue; + } + for (lItem = left->list; lItem < left->list + left->count; lItem++) { + if (func_8005DF2C(&lItem->body) == 1) { + continue; + } + if (func_8005DF74(&lItem->body, &rItem->body) == 1) { + continue; + } + if (func_800CE934(&rItem->dim.worldSphere, &lItem->dim, &sp7C) == 1) { + Math_Vec3s_ToVec3f(&sp64, &rItem->dim.worldSphere.center); + sp70.x = (lItem->dim.vtx[0].x + lItem->dim.vtx[1].x + lItem->dim.vtx[2].x) * (1.0f / 3); + sp70.y = (lItem->dim.vtx[0].y + lItem->dim.vtx[1].y + lItem->dim.vtx[2].y) * (1.0f / 3); + sp70.z = (lItem->dim.vtx[0].z + lItem->dim.vtx[1].z + lItem->dim.vtx[2].z) * (1.0f / 3); + func_8005E81C(globalCtx, &left->base, &lItem->body, &sp70, &right->base, &rItem->body, &sp64, + &sp7C); + if (!(right->base.maskB & 0x40)) { + return; + } + } + } + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061BF4.s") +extern TriNorm D_8015E230; +extern TriNorm D_8015E268; + +void CollisionCheck_AC_JntSphVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, + Collider* r) { + ColliderJntSph* left = (ColliderJntSph*)l; + ColliderQuad* right = (ColliderQuad*)r; + Vec3f sp7C; + ColliderJntSphItem* lItem; + Vec3f sp6C; + Vec3f sp60; + + if (left->count > 0 && left->list != NULL) { + if (func_8005DF50(&right->body) == 1) { + return; + } + Math3D_TriNorm(&D_8015E230, &right->dim.quad[2], &right->dim.quad[3], &right->dim.quad[1]); + Math3D_TriNorm(&D_8015E268, &right->dim.quad[1], &right->dim.quad[0], &right->dim.quad[2]); + for (lItem = left->list; lItem < left->list + left->count; lItem++) { + if (func_8005DF2C(&lItem->body) == 1) { + continue; + } + if (func_8005DF74(&lItem->body, &right->body) == 1) { + continue; + } + if (func_800CE934(&lItem->dim.worldSphere, &D_8015E230, &sp7C) == 1 || + func_800CE934(&lItem->dim.worldSphere, &D_8015E268, &sp7C) == 1) { + Math_Vec3s_ToVec3f(&sp6C, &lItem->dim.worldSphere.center); + + sp60.x = + (right->dim.quad[0].x + (right->dim.quad[1].x + (right->dim.quad[3].x + right->dim.quad[2].x))) * + (1.0f / 4); + sp60.y = + (right->dim.quad[0].y + (right->dim.quad[1].y + (right->dim.quad[3].y + right->dim.quad[2].y))) * + (1.0f / 4); + sp60.z = + (right->dim.quad[0].z + (right->dim.quad[1].z + (right->dim.quad[3].z + right->dim.quad[2].z))) * + (1.0f / 4); + func_8005E81C(globalCtx, &left->base, &lItem->body, &sp6C, &right->base, &right->body, &sp60, &sp7C); + return; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061C18.s") +extern TriNorm D_8015E2A0; +extern TriNorm D_8015E2D8; + +void CollisionCheck_AC_QuadVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, + Collider* r) { + ColliderJntSph* right = (ColliderJntSph*)r; + Vec3f sp88; + ColliderQuad* left = (ColliderQuad*)l; + ColliderJntSphItem* rItem; + Vec3f sp74; + Vec3f sp68; + + if (right->count > 0 && right->list != NULL) { + if (func_8005DF2C(&left->body) != 1) { + Math3D_TriNorm(&D_8015E2A0, &left->dim.quad[2], &left->dim.quad[3], &left->dim.quad[1]); + Math3D_TriNorm(&D_8015E2D8, &left->dim.quad[2], &left->dim.quad[1], &left->dim.quad[0]); + for (rItem = right->list; rItem < right->list + right->count; rItem++) { + if (func_8005DF50(&rItem->body) == 1) { + continue; + } + if (func_8005DF74(&left->body, &rItem->body) == 1) { + continue; + } + if (func_800CE934(&rItem->dim.worldSphere, &D_8015E2A0, &sp88) != 1 && + func_800CE934(&rItem->dim.worldSphere, &D_8015E2D8, &sp88) != 1) { + continue; + } + if (func_8005D218(globalCtx, left, &sp88) != 0) { + sp68.x = rItem->dim.worldSphere.center.x; + sp68.y = rItem->dim.worldSphere.center.y; + sp68.z = rItem->dim.worldSphere.center.z; + + sp74.x = + (left->dim.quad[0].x + (left->dim.quad[1].x + (left->dim.quad[3].x + left->dim.quad[2].x))) * + (1.0f / 4); + sp74.y = + (left->dim.quad[0].y + (left->dim.quad[1].y + (left->dim.quad[3].y + left->dim.quad[2].y))) * + (1.0f / 4); + sp74.z = + (left->dim.quad[0].z + (left->dim.quad[1].z + (left->dim.quad[3].z + left->dim.quad[2].z))) * + (1.0f / 4); + func_8005E81C(globalCtx, &left->base, &left->body, &sp74, &right->base, &rItem->body, &sp68, &sp88); + if ((right->base.maskB & 0x40) == 0) { + return; + } + } + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061C98.s") +void CollisionCheck_AC_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { + ColliderCylinder* left = (ColliderCylinder*)l; + ColliderCylinder* right = (ColliderCylinder*)r; + f32 sp6C; + f32 sp68; + Vec3f sp5C; + Vec3f sp50; + Vec3f sp44; + f32 temp_f0; + + if (left->dim.radius <= 0 || left->dim.height <= 0 || right->dim.radius <= 0 || right->dim.height <= 0) { + return; + } + if (func_8005DF50(&right->body) == 1) { + return; + } + if (func_8005DF2C(&left->body) == 1) { + return; + } + if (func_8005DF74(&left->body, &right->body) == 1) { + return; + } + if (Math3D_CylinderOutCylinderDist(&left->dim, &right->dim, &sp6C, &sp68) == 1) { + Math_Vec3s_ToVec3f(&sp50, &left->dim.pos); + Math_Vec3s_ToVec3f(&sp44, &right->dim.pos); + if (!(fabsf(sp68) < 0.008f)) { + temp_f0 = (f32)right->dim.radius / sp68; + sp5C.y = (f32)right->dim.pos.y + (f32)right->dim.yShift + (f32)right->dim.height * 0.5f; + sp5C.x = ((f32)left->dim.pos.x - right->dim.pos.x) * temp_f0 + right->dim.pos.x; + sp5C.z = ((f32)left->dim.pos.z - right->dim.pos.z) * temp_f0 + right->dim.pos.z; + } else { + Math_Vec3s_ToVec3f(&sp5C, &right->dim.pos); + } + func_8005E81C(globalCtx, &left->base, &left->body, &sp50, &right->base, &right->body, &sp44, &sp5C); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061E48.s") +void CollisionCheck_AC_CylVsTris(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { + ColliderCylinder* left = (ColliderCylinder*)l; + ColliderTris* right = (ColliderTris*)r; + ColliderTrisItem* rItem; + Vec3f sp68; + Vec3f sp5C; + Vec3f sp50; + + if (left->dim.radius > 0 && left->dim.height > 0 && right->count > 0 && right->list != NULL) { + if (func_8005DF2C(&left->body) == 1) { + return; + } + for (rItem = right->list; rItem < right->list + right->count; rItem++) { + if (func_8005DF50(&rItem->body) == 1) { + continue; + } + if (func_8005DF74(&left->body, &rItem->body) == 1) { + continue; + } + if (Math3D_CylTriTouchingIntersect(&left->dim, &rItem->dim, &sp68) == 1) { + Math_Vec3s_ToVec3f(&sp5C, &left->dim.pos); + + sp50.x = (rItem->dim.vtx[0].x + rItem->dim.vtx[1].x + rItem->dim.vtx[2].x) * (1.0f / 3); + sp50.y = (rItem->dim.vtx[0].y + rItem->dim.vtx[1].y + rItem->dim.vtx[2].y) * (1.0f / 3); + sp50.z = (rItem->dim.vtx[0].z + rItem->dim.vtx[1].z + rItem->dim.vtx[2].z) * (1.0f / 3); + func_8005E81C(globalCtx, &left->base, &left->body, &sp5C, &right->base, &rItem->body, &sp50, &sp68); + return; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061E8C.s") +extern Vec3f D_8015E310; + +void CollisionCheck_AC_TrisVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { + ColliderTris* left = (ColliderTris*)l; + ColliderCylinder* right = (ColliderCylinder*)r; + ColliderTrisItem* lItem; + Vec3f sp60; + Vec3f sp54; + + if (right->dim.radius > 0 && right->dim.height > 0 && left->count > 0 && left->list != NULL) { + if (func_8005DF50(&right->body) == 1) { + return; + } + for (lItem = left->list; lItem < left->list + left->count; lItem++) { + if (func_8005DF2C(&lItem->body) == 1) { + continue; + } + if (func_8005DF74(&lItem->body, &right->body) == 1) { + continue; + } + + if (Math3D_CylTriTouchingIntersect(&right->dim, &lItem->dim, &D_8015E310) == 1) { + sp60.x = (lItem->dim.vtx[0].x + lItem->dim.vtx[1].x + lItem->dim.vtx[2].x) * (1.0f / 3); + sp60.y = (lItem->dim.vtx[0].y + lItem->dim.vtx[1].y + lItem->dim.vtx[2].y) * (1.0f / 3); + sp60.z = (lItem->dim.vtx[0].z + lItem->dim.vtx[1].z + lItem->dim.vtx[2].z) * (1.0f / 3); + Math_Vec3s_ToVec3f(&sp54, &right->dim.pos); + func_8005E81C(globalCtx, &left->base, &lItem->body, &sp60, &right->base, &right->body, &sp54, + &D_8015E310); + return; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061ED4.s") +extern TriNorm D_8015E320; +extern TriNorm D_8015E358; +extern Vec3f D_8015E390; + +void CollisionCheck_AC_CylVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { + ColliderCylinder* left = (ColliderCylinder*)l; + ColliderQuad* right = (ColliderQuad*)r; + Vec3f sp64; + Vec3f sp58; + Vec3f sp4C; + Vec3f sp40; + + if (left->dim.height <= 0 || left->dim.radius <= 0) { + return; + } + if (func_8005DF2C(&left->body) == 1 || func_8005DF50(&right->body) == 1) { + return; + } + if (func_8005DF74(&left->body, &right->body) == 1) { + return; + } + Math3D_TriNorm(&D_8015E320, &right->dim.quad[2], &right->dim.quad[3], &right->dim.quad[1]); + Math3D_TriNorm(&D_8015E358, &right->dim.quad[1], &right->dim.quad[0], &right->dim.quad[2]); + if (Math3D_CylTriTouchingIntersect(&left->dim, &D_8015E320, &D_8015E390) == 1) { + Math_Vec3s_ToVec3f(&sp64, &left->dim.pos); + sp58.x = + (right->dim.quad[0].x + (right->dim.quad[1].x + (right->dim.quad[3].x + right->dim.quad[2].x))) * 0.25f; + sp58.y = + (right->dim.quad[0].y + (right->dim.quad[1].y + (right->dim.quad[3].y + right->dim.quad[2].y))) * 0.25f; + sp58.z = + (right->dim.quad[0].z + (right->dim.quad[1].z + (right->dim.quad[3].z + right->dim.quad[2].z))) * 0.25f; + func_8005E81C(globalCtx, &left->base, &left->body, &sp64, &right->base, &right->body, &sp58, &D_8015E390); + return; + } + if (Math3D_CylTriTouchingIntersect(&left->dim, &D_8015E358, &D_8015E390) == 1) { + Math_Vec3s_ToVec3f(&sp4C, &left->dim.pos); + sp40.x = (right->dim.quad[0].x + (right->dim.quad[1].x + (right->dim.quad[3].x + right->dim.quad[2].x))) * + (1.0f / 4); + sp40.y = (right->dim.quad[0].y + (right->dim.quad[1].y + (right->dim.quad[3].y + right->dim.quad[2].y))) * + (1.0f / 4); + sp40.z = (right->dim.quad[0].z + (right->dim.quad[1].z + (right->dim.quad[3].z + right->dim.quad[2].z))) * + (1.0f / 4); + func_8005E81C(globalCtx, &left->base, &left->body, &sp4C, &right->base, &right->body, &sp40, &D_8015E390); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061EFC.s") +extern TriNorm D_8015E3A0; +extern TriNorm D_8015E3D8; +extern Vec3f D_8015E410; + +void CollisionCheck_AC_QuadVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { + ColliderQuad* left = (ColliderQuad*)l; + ColliderCylinder* right = (ColliderCylinder*)r; + Vec3f sp64; + Vec3f sp58; + Vec3f sp4C; + Vec3f sp40; + + if (right->dim.height <= 0 || right->dim.radius <= 0) { + return; + } + if (func_8005DF50(&right->body) == 1 || func_8005DF2C(&left->body) == 1) { + return; + } + if (func_8005DF74(&left->body, &right->body) == 1) { + return; + } + Math3D_TriNorm(&D_8015E3A0, &left->dim.quad[2], &left->dim.quad[3], &left->dim.quad[1]); + Math3D_TriNorm(&D_8015E3D8, &left->dim.quad[2], &left->dim.quad[1], &left->dim.quad[0]); + if (Math3D_CylTriTouchingIntersect(&right->dim, &D_8015E3A0, &D_8015E410) == 1) { + if (func_8005D218(globalCtx, left, &D_8015E410) != 0) { + sp64.x = (left->dim.quad[0].x + (left->dim.quad[1].x + (left->dim.quad[3].x + left->dim.quad[2].x))) * + (1.0f / 4); + sp64.y = (left->dim.quad[0].y + (left->dim.quad[1].y + (left->dim.quad[3].y + left->dim.quad[2].y))) * + (1.0f / 4); + sp64.z = (left->dim.quad[0].z + (left->dim.quad[1].z + (left->dim.quad[3].z + left->dim.quad[2].z))) * + (1.0f / 4); + Math_Vec3s_ToVec3f(&sp58, &right->dim.pos); + func_8005E81C(globalCtx, &left->base, &left->body, &sp64, &right->base, &right->body, &sp58, &D_8015E410); + return; + } + } + if (Math3D_CylTriTouchingIntersect(&right->dim, &D_8015E3D8, &D_8015E410) == 1) { + if (func_8005D218(globalCtx, left, &D_8015E410) != 0) { + sp4C.x = (left->dim.quad[0].x + (left->dim.quad[1].x + (left->dim.quad[3].x + left->dim.quad[2].x))) * + (1.0f / 4); + sp4C.y = (left->dim.quad[0].y + (left->dim.quad[1].y + (left->dim.quad[3].y + left->dim.quad[2].y))) * + (1.0f / 4); + sp4C.z = (left->dim.quad[0].z + (left->dim.quad[1].z + (left->dim.quad[3].z + left->dim.quad[2].z))) * + (1.0f / 4); + Math_Vec3s_ToVec3f(&sp40, &right->dim.pos); + func_8005E81C(globalCtx, &left->base, &left->body, &sp4C, &right->base, &right->body, &sp40, &D_8015E410); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061F64.s") +extern Vec3f D_8015E420; + +void CollisionCheck_AC_TrisVsTris(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, + Collider* r) { + ColliderTris* left = (ColliderTris*)l; + ColliderTris* right = (ColliderTris*)r; + ColliderTrisItem* lItem; + ColliderTrisItem* rItem; + + Vec3f sp5C; + Vec3f sp50; + + if (right->count > 0 && right->list != NULL && left->count > 0 && left->list != NULL) { + for (rItem = right->list; rItem < right->list + right->count; rItem++) { + if (func_8005DF50(&rItem->body) == 1) { + continue; + } + for (lItem = left->list; lItem < left->list + left->count; lItem++) { + if (func_8005DF2C(&lItem->body) == 1) { + continue; + } + if (func_8005DF74(&lItem->body, &rItem->body) == 1) { + continue; + } + if (Math3D_TrisIntersect(&lItem->dim, &rItem->dim, &D_8015E420) == 1) { + sp5C.x = (lItem->dim.vtx[0].x + lItem->dim.vtx[1].x + lItem->dim.vtx[2].x) * (1.0f / 3); + sp5C.y = (lItem->dim.vtx[0].y + lItem->dim.vtx[1].y + lItem->dim.vtx[2].y) * (1.0f / 3); + sp5C.z = (lItem->dim.vtx[0].z + lItem->dim.vtx[1].z + lItem->dim.vtx[2].z) * (1.0f / 3); + sp50.x = (rItem->dim.vtx[0].x + rItem->dim.vtx[1].x + rItem->dim.vtx[2].x) * (1.0f / 3); + sp50.y = (rItem->dim.vtx[0].y + rItem->dim.vtx[1].y + rItem->dim.vtx[2].y) * (1.0f / 3); + sp50.z = (rItem->dim.vtx[0].z + rItem->dim.vtx[1].z + rItem->dim.vtx[2].z) * (1.0f / 3); + func_8005E81C(globalCtx, &left->base, &lItem->body, &sp5C, &right->base, &rItem->body, &sp50, + &D_8015E420); + return; + } + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800622E4.s") +extern Vec3f D_8015E430; +extern TriNorm D_8015E440; +extern TriNorm D_8015E478; + +void CollisionCheck_AC_TrisVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, + Collider* r) { + ColliderTris* left = (ColliderTris*)l; + ColliderQuad* right = (ColliderQuad*)r; + ColliderTrisItem* lItem; + Vec3f sp68; + Vec3f sp5C; + + if (left->count > 0 && left->list != NULL) { + if (func_8005DF50(&right->body) != 1) { + Math3D_TriNorm(&D_8015E440, &right->dim.quad[2], &right->dim.quad[3], &right->dim.quad[1]); + Math3D_TriNorm(&D_8015E478, &right->dim.quad[1], &right->dim.quad[0], &right->dim.quad[2]); + for (lItem = left->list; lItem < left->list + left->count; lItem++) { + if (func_8005DF2C(&lItem->body) == 1) { + continue; + } + if (func_8005DF74(&lItem->body, &right->body) == 1) { + continue; + } + if (Math3D_TrisIntersect(&D_8015E440, &lItem->dim, &D_8015E430) == 1 || + Math3D_TrisIntersect(&D_8015E478, &lItem->dim, &D_8015E430) == 1) { + sp68.x = (lItem->dim.vtx[0].x + lItem->dim.vtx[1].x + lItem->dim.vtx[2].x) * (1.0f / 3); + sp68.y = (lItem->dim.vtx[0].y + lItem->dim.vtx[1].y + lItem->dim.vtx[2].y) * (1.0f / 3); + sp68.z = (lItem->dim.vtx[0].z + lItem->dim.vtx[1].z + lItem->dim.vtx[2].z) * (1.0f / 3); + sp5C.x = (right->dim.quad[0].x + + (right->dim.quad[1].x + (right->dim.quad[3].x + right->dim.quad[2].x))) * + (1.0f / 4); + sp5C.y = (right->dim.quad[0].y + + (right->dim.quad[1].y + (right->dim.quad[3].y + right->dim.quad[2].y))) * + (1.0f / 4); + sp5C.z = (right->dim.quad[0].z + + (right->dim.quad[1].z + (right->dim.quad[3].z + right->dim.quad[2].z))) * + (1.0f / 4); + func_8005E81C(globalCtx, &left->base, &lItem->body, &sp68, &right->base, &right->body, &sp5C, + &D_8015E430); + return; + } + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062530.s") +extern Vec3f D_8015E4B0; +extern TriNorm D_8015E4C0; +extern TriNorm D_8015E4F8; + +void CollisionCheck_AC_QuadVsTris(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, + Collider* r) { + ColliderQuad* left = (ColliderQuad*)l; + ColliderTris* right = (ColliderTris*)r; + ColliderTrisItem* rItem; + Vec3f sp68; + Vec3f sp5C; + + if (right->count > 0 && right->list != NULL) { + if (func_8005DF2C(&left->body) != 1) { + Math3D_TriNorm(&D_8015E4C0, &left->dim.quad[2], &left->dim.quad[3], &left->dim.quad[1]); + Math3D_TriNorm(&D_8015E4F8, &left->dim.quad[1], &left->dim.quad[0], &left->dim.quad[2]); + for (rItem = right->list; rItem < right->list + right->count; rItem++) { + if (func_8005DF50(&rItem->body) == 1) { + continue; + } + if (func_8005DF74(&left->body, &rItem->body) == 1) { + continue; + } + if (Math3D_TrisIntersect(&D_8015E4C0, &rItem->dim, &D_8015E4B0) == 1 || + Math3D_TrisIntersect(&D_8015E4F8, &rItem->dim, &D_8015E4B0) == 1) { + if (func_8005D218(globalCtx, left, &D_8015E4B0) != 0) { + sp5C.x = (rItem->dim.vtx[0].x + rItem->dim.vtx[1].x + rItem->dim.vtx[2].x) * (1.0f / 3); + sp5C.y = (rItem->dim.vtx[0].y + rItem->dim.vtx[1].y + rItem->dim.vtx[2].y) * (1.0f / 3); + sp5C.z = (rItem->dim.vtx[0].z + rItem->dim.vtx[1].z + rItem->dim.vtx[2].z) * (1.0f / 3); + sp68.x = (left->dim.quad[0].x + + (left->dim.quad[1].x + (left->dim.quad[3].x + left->dim.quad[2].x))) * + (1.0f / 4); + sp68.y = (left->dim.quad[0].y + + (left->dim.quad[1].y + (left->dim.quad[3].y + left->dim.quad[2].y))) * + (1.0f / 4); + sp68.z = (left->dim.quad[0].z + + (left->dim.quad[1].z + (left->dim.quad[3].z + left->dim.quad[2].z))) * + (1.0f / 4); + func_8005E81C(globalCtx, &left->base, &left->body, &sp68, &right->base, &rItem->body, &sp5C, + &D_8015E4B0); + return; + } + } + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800626B0.s") +extern TriNorm D_8015E530[2]; +extern Vec3f D_8015E598; +extern TriNorm D_8015E5A8[2]; + +void CollisionCheck_AC_QuadVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, + Collider* r) { + ColliderQuad* left = (ColliderQuad*)l; + ColliderQuad* right = (ColliderQuad*)r; + s32 i; + s32 j; + Vec3f sp6C; + Vec3f sp60; + + if (func_8005DF2C(&left->body) == 1) { + return; + } + if (func_8005DF50(&right->body) == 1) { + return; + } + if (func_8005DF74(&left->body, &right->body) == 1) { + return; + } + Math3D_TriNorm(&D_8015E5A8[0], &left->dim.quad[2], &left->dim.quad[3], &left->dim.quad[1]); + Math3D_TriNorm(&D_8015E5A8[1], &left->dim.quad[2], &left->dim.quad[1], &left->dim.quad[0]); + Math3D_TriNorm(&D_8015E530[0], &right->dim.quad[2], &right->dim.quad[3], &right->dim.quad[1]); + Math3D_TriNorm(&D_8015E530[1], &right->dim.quad[2], &right->dim.quad[1], &right->dim.quad[0]); + for (i = 0; i < 2; i++) { + for (j = 0; j < 2; j++) { + if (Math3D_TrisIntersect(&D_8015E5A8[j], &D_8015E530[i], &D_8015E598) == 1) { + if (func_8005D218(globalCtx, left, &D_8015E598) != 0) { + sp6C.x = + (left->dim.quad[0].x + (left->dim.quad[1].x + (left->dim.quad[3].x + left->dim.quad[2].x))) * + (1.0f / 4); + sp6C.y = + (left->dim.quad[0].y + (left->dim.quad[1].y + (left->dim.quad[3].y + left->dim.quad[2].y))) * + (1.0f / 4); + sp6C.z = + (left->dim.quad[0].z + (left->dim.quad[1].z + (left->dim.quad[3].z + left->dim.quad[2].z))) * + (1.0f / 4); + sp60.x = (right->dim.quad[0].x + + (right->dim.quad[1].x + (right->dim.quad[3].x + right->dim.quad[2].x))) * + (1.0f / 4); + sp60.y = (right->dim.quad[0].y + + (right->dim.quad[1].y + (right->dim.quad[3].y + right->dim.quad[2].y))) * + (1.0f / 4); + sp60.z = (right->dim.quad[0].z + + (right->dim.quad[1].z + (right->dim.quad[3].z + right->dim.quad[2].z))) * + (1.0f / 4); + func_8005E81C(globalCtx, &left->base, &left->body, &sp6C, &right->base, &right->body, &sp60, + &D_8015E598); + return; + } + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800626DC.s") +// D_8011DF5C ColliderJntSph +void func_80060EBC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { + ColliderJntSph* col = (ColliderJntSph*)collider; + ColliderJntSphItem* item; + Vec3f sp24; + + for (item = col->list; item < col->list + col->count; item++) { + if (item->body.bumperFlags & 0x80) { + if (item->body.acHitItem != NULL) { + if (!(item->body.acHitItem->toucherFlags & 0x40)) { + Math_Vec3s_ToVec3f(&sp24, &item->body.bumper.unk_06); + func_8005E604(globalCtx, item->body.acHit, item->body.acHitItem, &col->base, &item->body, &sp24); + item->body.acHitItem->toucherFlags |= 0x40; + return; + } + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062734.s") +// D_8011DF5C ColliderCylinder +void func_80060F94(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { + ColliderCylinder* item = (ColliderCylinder*)collider; + Vec3f sp28; + + if (item->body.bumperFlags & 0x80) { + if (item->body.acHitItem != NULL) { + if (!(item->body.acHitItem->toucherFlags & 0x40)) { + Math_Vec3s_ToVec3f(&sp28, &item->body.bumper.unk_06); + func_8005E604(globalCtx, item->body.acHit, item->body.acHitItem, &item->base, &item->body, &sp28); + item->body.acHitItem->toucherFlags |= 0x40; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800627A0.s") +// D_8011DF5C ColliderTris +void func_80061028(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { + ColliderTris* col = (ColliderTris*)collider; + ColliderTrisItem* item; + Vec3f sp24; + + for (item = col->list; item < col->list + col->count; item++) { + if (item->body.bumperFlags & 0x80) { + if (item->body.acHitItem != NULL) { + if (!(item->body.acHitItem->toucherFlags & 0x40)) { + Math_Vec3s_ToVec3f(&sp24, &item->body.bumper.unk_06); + func_8005E604(globalCtx, item->body.acHit, item->body.acHitItem, &col->base, &item->body, &sp24); + item->body.acHitItem->toucherFlags |= 0x40; + return; + } + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800628A4.s") +// D_8011DF5C ColliderQuad +void func_8006110C(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { + ColliderQuad* item = (ColliderQuad*)collider; + Vec3f sp28; + + if (item->body.bumperFlags & 0x80) { + if (item->body.acHitItem != NULL) { + if (!(item->body.acHitItem->toucherFlags & 0x40)) { + Math_Vec3s_ToVec3f(&sp28, &item->body.bumper.unk_06); + func_8005E604(globalCtx, item->body.acHit, item->body.acHitItem, &item->base, &item->body, &sp28); + item->body.acHitItem->toucherFlags |= 0x40; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062A28.s") +void func_800611A0(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { + Collider** col; + Collider* temp; + + static void (*D_8011DF5C[4])(GlobalContext*, CollisionCheckContext*, Collider*) = { + func_80060EBC, + func_80060F94, + func_80061028, + func_8006110C, + }; + + for (col = colChkCtx->colAc; col < colChkCtx->colAc + colChkCtx->colAcCount; col++) { + temp = *col; + if (temp != NULL) { + if (temp->acFlags & 1) { + if (temp->actor == NULL || temp->actor->update != NULL) { + (*D_8011DF5C[temp->shape])(globalCtx, colChkCtx, temp); + } + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062B80.s") +void CollisionCheck_AC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { + Collider** col; + Collider* temp; + + static void (*D_8011DF6C[4][4])(GlobalContext*, CollisionCheckContext*, Collider*, Collider*) = { + { CollisionCheck_AC_JntSphVsJntSph, CollisionCheck_AC_JntSphVsCyl, CollisionCheck_AC_JntSphVsTris, + CollisionCheck_AC_JntSphVsQuad }, + { CollisionCheck_AC_CylVsJntSph, CollisionCheck_AC_CylVsCyl, CollisionCheck_AC_CylVsTris, + CollisionCheck_AC_CylVsQuad }, + { CollisionCheck_AC_TrisVsJntSph, CollisionCheck_AC_TrisVsCyl, CollisionCheck_AC_TrisVsTris, + CollisionCheck_AC_TrisVsQuad }, + { CollisionCheck_AC_QuadVsJntSph, CollisionCheck_AC_QuadVsCyl, CollisionCheck_AC_QuadVsTris, + CollisionCheck_AC_QuadVsQuad }, + }; + for (col = colChkCtx->colAc; col < colChkCtx->colAc + colChkCtx->colAcCount; col++) { + temp = *col; + if (temp == NULL) { + continue; + } else if (!(temp->acFlags & 1)) { + continue; + } else if (temp->actor != NULL && temp->actor->update == NULL) { + continue; + } else if (!((temp->acFlags & collider->atFlags) & 0x38)) { + continue; + } else if (collider == temp) { + continue; + } + + else if ((collider->atFlags & 0x40) || collider->actor == NULL || temp->actor != collider->actor) { + D_8011DF6C[collider->shape][temp->shape](globalCtx, colChkCtx, collider, temp); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062CD4.s") +// Test Attack Collisions +void func_8006139C(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { + Collider** colAt; + Collider* colliderAt; + + if (colChkCtx->colAtCount != 0) { + if (colChkCtx->colAcCount != 0) { + for (colAt = colChkCtx->colAt; colAt < colChkCtx->colAt + colChkCtx->colAtCount; colAt++) { + colliderAt = *colAt; + if (colliderAt != NULL) { + if (colliderAt->atFlags & 1) { + if ((colliderAt->actor == NULL) || (colliderAt->actor->update != NULL)) { + CollisionCheck_AC(globalCtx, colChkCtx, colliderAt); + } + } + } + } + func_800611A0(globalCtx, colChkCtx); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062D60.s") +// Get mass type +s32 func_8006146C(u8 mass) { + if (mass == 0xFF) { + return 0; + } + if (mass == 0xFE) { + return 1; + } + return 2; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062DAC.s") +// SetOC collision, perform elastic collision +void func_800614A4(Collider* left, ColliderBody* leftBody, Vec3f* leftv, Collider* right, ColliderBody* rightBody, + Vec3f* rightv, f32 arg6) { + f32 temp_f0; + f32 leftDisplacementFactor; + f32 rightDisplacementFactor; + f32 xzDist; + f32 leftMass; + f32 rightMass; + f32 totalMass; + f32 inverseTotalMass; + f32 xDelta; + f32 zDelta; + Actor* leftActor; + Actor* rightActor; + s32 rightMassType; + s32 leftMassType; + + leftActor = left->actor; + rightActor = right->actor; + left->maskA |= 2; + left->oc = rightActor; + leftBody->ocFlags |= 2; + if ((right->maskB & 8) != 0) { + left->maskB |= 1; + } + right->oc = leftActor; + right->maskA |= 2; + rightBody->ocFlags |= 2; + if ((left->maskB & 8) != 0) { + right->maskB |= 1; + } + if (leftActor == NULL || rightActor == NULL || (left->maskA & 4) || (right->maskA & 4)) { + return; + } + leftMassType = func_8006146C(leftActor->colChkInfo.mass); + rightMassType = func_8006146C(rightActor->colChkInfo.mass); + leftMass = leftActor->colChkInfo.mass; + rightMass = rightActor->colChkInfo.mass; + totalMass = leftMass + rightMass; + if (fabsf(totalMass) < 0.008f) { + totalMass = (leftMass = rightMass = 1.0f) * 2; + } + xDelta = rightv->x - leftv->x; + zDelta = rightv->z - leftv->z; + xzDist = sqrtf(SQ(xDelta) + SQ(zDelta)); + + if (leftMassType == 0) { + if (rightMassType == 0) { + return; + } else { + leftDisplacementFactor = 0; + rightDisplacementFactor = 1; + } + } else if (leftMassType == 1) { + if (rightMassType == 0) { + leftDisplacementFactor = 1; + rightDisplacementFactor = 0; + } else if (rightMassType == 1) { + leftDisplacementFactor = 0.5f; + rightDisplacementFactor = 0.5f; + } else { + leftDisplacementFactor = 0; + rightDisplacementFactor = 1; + } + } else { + if (rightMassType == 2) { + inverseTotalMass = 1 / totalMass; + leftDisplacementFactor = rightMass * inverseTotalMass; + rightDisplacementFactor = leftMass * inverseTotalMass; + } else { + leftDisplacementFactor = 1; + rightDisplacementFactor = 0; + } + } + + if (!(fabsf(xzDist) < 0.008f)) { + temp_f0 = arg6 / xzDist; + xDelta *= temp_f0; + zDelta *= temp_f0; + leftActor->colChkInfo.displacement.x += -xDelta * leftDisplacementFactor; + leftActor->colChkInfo.displacement.z += -zDelta * leftDisplacementFactor; + rightActor->colChkInfo.displacement.x += xDelta * rightDisplacementFactor; + rightActor->colChkInfo.displacement.z += zDelta * rightDisplacementFactor; + } else if (!(arg6 == 0.0f)) { + leftActor->colChkInfo.displacement.x += -arg6 * leftDisplacementFactor; + rightActor->colChkInfo.displacement.x += arg6 * rightDisplacementFactor; + } else { + leftActor->colChkInfo.displacement.x -= leftDisplacementFactor; + rightActor->colChkInfo.displacement.x += rightDisplacementFactor; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062DF4.s") +void CollisionCheck_OC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, + Collider* r) { + ColliderJntSph* left = (ColliderJntSph*)l; + ColliderJntSph* right = (ColliderJntSph*)r; + ColliderJntSphItem* lItem; + ColliderJntSphItem* rItem; + f32 sp74; + Vec3f sp68; + Vec3f sp5C; + + if (left->count > 0 && left->list != NULL && right->count > 0 && right->list != NULL) { + for (lItem = left->list; lItem < left->list + left->count; lItem++) { + if (!(lItem->body.ocFlags & 1)) { + continue; + } + for (rItem = right->list; rItem < right->list + right->count; rItem++) { + if (!(rItem->body.ocFlags & 1)) { + continue; + } + if (Math3D_SpheresTouchingSurface(&lItem->dim.worldSphere, &rItem->dim.worldSphere, &sp74) == 1) { + Math_Vec3s_ToVec3f(&sp68, &lItem->dim.worldSphere.center); + Math_Vec3s_ToVec3f(&sp5C, &rItem->dim.worldSphere.center); + func_800614A4(&left->base, &lItem->body, &sp68, &right->base, &rItem->body, &sp5C, sp74); + } + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062E14.s") +void CollisionCheck_OC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, + Collider* r) { + ColliderJntSph* left = (ColliderJntSph*)l; + ColliderCylinder* right = (ColliderCylinder*)r; + ColliderJntSphItem* lItem; + f32 sp78; + Vec3f sp6C; + Vec3f sp60; + + if (left->count > 0 && left->list != NULL) { + if (!(right->base.maskA & 1)) { + return; + } + if (!(right->body.ocFlags & 1)) { + return; + } + for (lItem = left->list; lItem < left->list + left->count; lItem++) { + if (!(lItem->body.ocFlags & 1)) { + continue; + } + if (func_800CFD84(&lItem->dim.worldSphere, &right->dim, &sp78) == 1) { + Math_Vec3s_ToVec3f(&sp6C, &lItem->dim.worldSphere.center); + Math_Vec3s_ToVec3f(&sp60, &right->dim.pos); + func_800614A4(&left->base, &lItem->body, &sp6C, &right->base, &right->body, &sp60, sp78); + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062ECC.s") +void CollisionCheck_OC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, + Collider* r) { + CollisionCheck_OC_JntSphVsCyl(globalCtx, colChkCtx, r, l); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800635D0.s") +void CollisionCheck_OC_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* l, Collider* r) { + ColliderCylinder* left = (ColliderCylinder*)l; + ColliderCylinder* right = (ColliderCylinder*)r; + f32 sp4C; + Vec3f sp40; + Vec3f sp34; + + if (!(left->base.maskA & 1) || !(right->base.maskA & 1)) { + return; + } + if (!(left->body.ocFlags & 1) || !(right->body.ocFlags & 1)) { + return; + } + if (Math3D_CylinderOutCylinder(&left->dim, &right->dim, &sp4C) == 1) { + Math_Vec3s_ToVec3f(&sp40, &left->dim.pos); + Math_Vec3s_ToVec3f(&sp34, &right->dim.pos); + func_800614A4(&left->base, &left->body, &sp40, &right->base, &right->body, &sp34, sp4C); + } +} + +// CollisionCheck_OC test ? +s32 func_80061BF4(Collider* collider) { + if (!(collider->maskA & 1)) { + return 1; + } + return 0; +} + +// CollisionCheck_OC test ? +s32 func_80061C18(Collider* arg0, Collider* arg1) { + if (!((arg0->maskA & arg1->maskB) & 0x38) || !((arg0->maskB & arg1->maskA) & 0x38) || + ((arg0->maskB & 2) && (arg1->maskB & 4)) || ((arg1->maskB & 2) && (arg0->maskB & 4))) { + return 1; + } + if (arg0->actor == arg1->actor) { + return 1; + } + return 0; +} + +void CollisionCheck_OC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { + Collider** phi_s2; + Collider** phi_s0; + Collider** new_var; + Collider** new_var2; + void (*test)(GlobalContext*, CollisionCheckContext*, Collider*, Collider*); + + static void (*D_8011DFAC[4][4])(GlobalContext*, CollisionCheckContext*, Collider*, Collider*) = { + { CollisionCheck_OC_JntSphVsJntSph, CollisionCheck_OC_JntSphVsCyl, NULL, NULL }, + { CollisionCheck_OC_CylVsJntSph, CollisionCheck_OC_CylVsCyl, NULL, NULL }, + { NULL, NULL, NULL, NULL }, + { NULL, NULL, NULL, NULL }, + }; + + for (phi_s2 = colChkCtx->colOc; phi_s2 < colChkCtx->colOc + colChkCtx->colOcCount; phi_s2++) { + if (*phi_s2 == NULL || func_80061BF4(*phi_s2) == 1) { + continue; + } + for (phi_s0 = phi_s2 + 1; phi_s0 < colChkCtx->colOc + colChkCtx->colOcCount; phi_s0++) { + if (*phi_s0 == NULL || func_80061BF4(*phi_s0) == 1 || func_80061C18(*phi_s2, *phi_s0) == 1) { + continue; + } + new_var2 = phi_s0; + new_var = phi_s2; + test = D_8011DFAC[(*new_var)->shape][(*new_var2)->shape]; + if (test == NULL) { + osSyncPrintf("CollisionCheck_OC():未対応 %d, %d\n", (*new_var)->shape, (*new_var2)->shape); + // EUC-JP: 未対応 | Not compatible + continue; + } + (*test)(globalCtx, colChkCtx, *new_var, *new_var2); + } + } +} + +// Initialize CollisionCheckInfo +void func_80061E48(CollisionCheckInfo* info) { + static CollisionCheckInfo init = { NULL, { 0, 0, 0 }, 10, 10, 0, 50, 8, 0, 0, 0, 0 }; + *info = init; +} + +void func_80061E8C(CollisionCheckInfo* info) { + info->damage = 0; + info->damageEffect = 0; + info->atHitEffect = 0; + info->acHitEffect = 0; + info->displacement.z = 0.0f; + info->displacement.y = 0.0f; + info->displacement.x = 0.0f; +} + +void func_80061EB0(CollisionCheckInfo* info, CollisionCheckInfoInit* init) { + info->health = init->health; + info->unk_10 = init->unk_02; + info->unk_12 = init->unk_04; + info->mass = init->mass; +} + +void func_80061ED4(CollisionCheckInfo* info, DamageTable* damageTable, CollisionCheckInfoInit* init) { + info->health = init->health; + info->damageTable = damageTable; + info->unk_10 = init->unk_02; + info->unk_12 = init->unk_04; + info->mass = init->mass; +} + +void func_80061EFC(CollisionCheckInfo* info, DamageTable* damageTable, CollisionCheckInfoInit2* init) { + info->health = init->health; + info->damageTable = damageTable; + info->unk_10 = init->unk_02; + info->unk_12 = init->unk_04; + info->unk_14 = init->unk_06; + info->mass = init->mass; +} + +void func_80061F2C(CollisionCheckInfo* info, s32 index, CollisionCheckInfoInit2* init) { + func_80061EFC(info, DamageTable_Get(index), init); +} + +// Apply AC damage effect +void func_80061F64(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, ColliderBody* body) { + DamageTable* tbl; + u32 flags; + s32 i; + f32 damage; + int tblLookup; + + if (collider->actor == NULL || !(collider->acFlags & 2)) { + return; + } + if (!(body->bumperFlags & 2) || (body->bumperFlags & 0x10)) { + return; + } + if (body->acHitItem == NULL) { + __assert("pclobj_elem->ac_hit_elem != NULL", "../z_collision_check.c", 6493); + } + tbl = collider->actor->colChkInfo.damageTable; + if (tbl == NULL) { + damage = (f32)body->acHitItem->toucher.damage - (f32)body->bumper.defense; + if (damage < 0) { + damage = 0; + } + } else { + for (i = 0, flags = body->acHitItem->toucher.flags; i < 0x20; i++, flags >>= 1) { + if (flags == 1) { + break; + } + } + + tblLookup = tbl->table[i]; + damage = tblLookup & 0xF; + collider->actor->colChkInfo.damageEffect = tblLookup >> 4 & 0xF; + } + if (!(collider->acFlags & 4)) { + collider->actor->colChkInfo.damage = (u32)(collider->actor->colChkInfo.damage + damage); + } +} + +// Apply ColliderJntSph AC damage effect +void func_8006216C(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { + ColliderJntSph* jntSph = (ColliderJntSph*)collider; + s32 i; + + if (!(jntSph->count > 0) || jntSph->list == NULL) { + return; + } + for (i = 0; i < jntSph->count; i++) { + func_80061F64(globalCtx, colChkCtx, &jntSph->base, &jntSph->list[i].body); + } +} + +// Apply ColliderCylinder AC damage effect +void func_80062210(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { + ColliderCylinder* cylinder = (ColliderCylinder*)collider; + func_80061F64(globalCtx, colChkCtx, &cylinder->base, &cylinder->body); +} + +// Apply ColliderTris AC damage effect +void func_80062230(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { + ColliderTris* tris = (ColliderTris*)collider; + s32 i; + + for (i = 0; i < tris->count; i++) { + func_80061F64(globalCtx, colChkCtx, collider, &tris->list[i].body); + } +} + +// Apply ColliderQuad AC damage effect +void func_800622C4(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider) { + ColliderQuad* quad = (ColliderQuad*)collider; + func_80061F64(globalCtx, colChkCtx, &quad->base, &quad->body); +} + +// Apply all AC damage effects +void func_800622E4(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) { + Collider* collider; + s32 i; + + static void (*D_8011E008[4])(GlobalContext*, CollisionCheckContext*, Collider*) = { + func_8006216C, + func_80062210, + func_80062230, + func_800622C4, + }; + + for (i = 0; i < colChkCtx->colAcCount; i++) { + collider = colChkCtx->colAc[i]; + if (collider == 0) { + continue; + } + if ((collider->acFlags & 0x40)) { + continue; + } + D_8011E008[collider->shape](globalCtx, colChkCtx, collider); + } +} + +extern Linef D_8015E610; + +s32 CollisionCheck_generalLineOcCheck_JntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, + Collider* collider, Vec3f* arg3, Vec3f* arg4) { + ColliderJntSph* jntSph = (ColliderJntSph*)collider; + ColliderJntSphItem* item; + s32 phi_s0; + for (phi_s0 = 0; phi_s0 < jntSph->count; phi_s0++) { + item = &jntSph->list[phi_s0]; + if (!(item->body.ocFlags & 1)) { + continue; + } + D_8015E610.a = *arg3; + D_8015E610.b = *arg4; + if (func_800CE600(&item->dim.worldSphere, &D_8015E610) == 1) { + return 1; + } + } + return 0; +} + +extern Vec3f D_8015E628; +extern Vec3f D_8015E638; + +s32 CollisionCheck_generalLineOcCheck_Cyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, + Collider* collider, Vec3f* arg3, Vec3f* arg4) { + ColliderCylinder* cylinder = (ColliderCylinder*)collider; + if (!(cylinder->body.ocFlags & 1)) { + return 0; + } + if (func_800CEE0C(&cylinder->dim, arg3, arg4, &D_8015E628, &D_8015E638) != 0) { + return 1; + } + return 0; +} + +s32 CollisionCheck_GeneralLineOcCheck(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Vec3f* camera_3C, + Vec3f* arg3, Actor** arg4, s32 arg5) { + Collider* collider; + s32 (*t)(GlobalContext*, CollisionCheckContext*, Collider*, Vec3f*, Vec3f*); + Collider** c; + s32 i; + s32 test; + s32 result; + + static s32 (*D_8011E018[4])(GlobalContext*, CollisionCheckContext*, Collider*, Vec3f*, Vec3f*) = { + CollisionCheck_generalLineOcCheck_JntSph, + CollisionCheck_generalLineOcCheck_Cyl, + NULL, + NULL, + }; + + result = 0; + for (c = colChkCtx->colOc; c < colChkCtx->colOc + colChkCtx->colOcCount; c++) { + if (func_80061BF4(*c) == 1) { + continue; + } + test = 0; + for (i = 0; i < arg5; i++) { + if ((*c)->actor == arg4[i]) { + test = 1; + break; + } + } + if (test == 1) { + continue; + } + collider = *c; + t = D_8011E018[collider->shape]; + if (t == NULL) { + osSyncPrintf("CollisionCheck_generalLineOcCheck():未対応 %dタイプ\n", collider->shape); + // EUC-JP: 未対応 %dタイプ | %d's type is not supported + } else { + result = (*t)(globalCtx, colChkCtx, collider, camera_3C, arg3); + if (result != 0) { + break; + } + } + } + return result; +} + +s32 func_8006268C(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Vec3f* arg2, Vec3f* arg3) { + CollisionCheck_GeneralLineOcCheck(globalCtx, colChkCtx, arg2, arg3, NULL, 0); +} + +s32 func_800626B0(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Vec3f* camera_3C, Vec3f* arg3, + Actor** arg4, s32 arg5) { + CollisionCheck_GeneralLineOcCheck(globalCtx, colChkCtx, camera_3C, arg3, arg4, arg5); +} + +void Collider_CylinderUpdate(Actor* actor, ColliderCylinder* collider) { + collider->dim.pos.x = (s32)actor->posRot.pos.x; + collider->dim.pos.y = (s32)actor->posRot.pos.y; + collider->dim.pos.z = (s32)actor->posRot.pos.z; +} + +// Set ColliderCylinder position +void func_80062718(ColliderCylinder* collider, Vec3s* pos) { + collider->dim.pos.x = pos->x; + collider->dim.pos.y = pos->y; + collider->dim.pos.z = pos->z; +} + +// Set ColliderQuad vertices +void func_80062734(ColliderQuad* collider, Vec3f* a, Vec3f* b, Vec3f* c, Vec3f* d) { + Math_Vec3f_Copy(&collider->dim.quad[2], c); + Math_Vec3f_Copy(&collider->dim.quad[3], d); + Math_Vec3f_Copy(&collider->dim.quad[0], a); + Math_Vec3f_Copy(&collider->dim.quad[1], b); + func_8005CEDC(&collider->dim); +} + +// Set ColliderTrisItem at index +void func_800627A0(ColliderTris* collider, s32 index, Vec3f* a, Vec3f* b, Vec3f* c) { + ColliderTrisItem* item; + f32 sp40; + f32 sp3C; + f32 sp38; + f32 sp34; + + item = &collider->list[index]; + Math_Vec3f_Copy(&item->dim.vtx[0], a); + Math_Vec3f_Copy(&item->dim.vtx[1], b); + Math_Vec3f_Copy(&item->dim.vtx[2], c); + func_800CC8B4(a, b, c, &sp40, &sp3C, &sp38, &sp34); + item->dim.plane.normal.x = sp40; + item->dim.plane.normal.y = sp3C; + item->dim.plane.normal.z = sp38; + item->dim.plane.originDist = sp34; +} + +// Set ColliderTrisItem at index +void func_8006285C(GlobalContext* globalCtx, ColliderTris* collider, s32 index, ColliderTrisItemDimInit* init) { + ColliderTrisItem* item = &collider->list[index]; + Collider_SetTrisItemDim(globalCtx, &item->dim, init); +} + +#ifdef NON_MATCHING +// Codegen OK, .bss section problems +void func_800628A4(s32 arg0, ColliderJntSph* collider) { + s32 phi_s3; + + static Vec3f D_8015CF00; + static Vec3f D_8015E648; + + for (phi_s3 = 0; phi_s3 < collider->count; phi_s3++) { + if (arg0 == collider->list[phi_s3].dim.joint) { + D_8015E648.x = collider->list[phi_s3].dim.modelSphere.center.x; + D_8015E648.y = collider->list[phi_s3].dim.modelSphere.center.y; + D_8015E648.z = collider->list[phi_s3].dim.modelSphere.center.z; + Matrix_MultVec3f(&D_8015E648, &D_8015CF00); + collider->list[phi_s3].dim.worldSphere.center.x = (s32)D_8015CF00.x; + collider->list[phi_s3].dim.worldSphere.center.y = (s32)D_8015CF00.y; + collider->list[phi_s3].dim.worldSphere.center.z = (s32)D_8015CF00.z; + collider->list[phi_s3].dim.worldSphere.radius = + (s32)((f32)collider->list[phi_s3].dim.modelSphere.radius * collider->list[phi_s3].dim.scale); + } + } +} +#else +#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800628A4.s") +#endif // NON_MATCHING + +#ifdef NON_MATCHING +// Purple EffSpark +//.bss section problems +void func_80062A28(GlobalContext* globalCtx, Vec3f* v) { + s32 sp24; + static EffSparkParams D_8015CF10; + + D_8015CF10.position.x = (s32)v->x; + D_8015CF10.position.y = (s32)v->y; + D_8015CF10.position.z = (s32)v->z; + D_8015CF10.particleFactor1 = 5; + D_8015CF10.particleFactor2 = 5; + D_8015CF10.colorStart[0].r = 0x80; + D_8015CF10.colorStart[0].g = 0x00; + D_8015CF10.colorStart[0].b = 0x40; + D_8015CF10.colorStart[0].a = 0xFF; + D_8015CF10.colorStart[1].r = 0x80; + D_8015CF10.colorStart[1].g = 0x00; + D_8015CF10.colorStart[1].b = 0x40; + D_8015CF10.colorStart[1].a = 0xFF; + D_8015CF10.colorStart[2].r = 0xFF; + D_8015CF10.colorStart[2].g = 0x80; + D_8015CF10.colorStart[2].b = 0x00; + D_8015CF10.colorStart[2].a = 0xFF; + D_8015CF10.colorStart[3].r = 0xFF; + D_8015CF10.colorStart[3].g = 0x80; + D_8015CF10.colorStart[3].b = 0x00; + D_8015CF10.colorStart[3].a = 0xFF; + D_8015CF10.colorEnd[0].r = 0x40; + D_8015CF10.colorEnd[0].g = 0x00; + D_8015CF10.colorEnd[0].b = 0x20; + D_8015CF10.colorEnd[0].a = 0x00; + D_8015CF10.colorEnd[1].r = 0x40; + D_8015CF10.colorEnd[1].g = 0x00; + D_8015CF10.colorEnd[1].b = 0x20; + D_8015CF10.colorEnd[1].a = 0x00; + D_8015CF10.colorEnd[2].r = 0x80; + D_8015CF10.colorEnd[2].g = 0x00; + D_8015CF10.colorEnd[2].b = 0x40; + D_8015CF10.colorEnd[2].a = 0x00; + D_8015CF10.colorEnd[3].r = 0x80; + D_8015CF10.colorEnd[3].g = 0x00; + D_8015CF10.colorEnd[3].b = 0x40; + D_8015CF10.colorEnd[3].a = 0x00; + D_8015CF10.age = 0; + D_8015CF10.duration = 16; + D_8015CF10.velocity = 8.0f; + D_8015CF10.gravity = -1.0f; + Effect_Add(globalCtx, &sp24, 0, 0, 1, &D_8015CF10); +} +#else +#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062A28.s") +#endif // NON_MATCHING + +#ifdef NON_MATCHING +// White EffSpark (Bubbles?) +//.bss section problems +void func_80062B80(GlobalContext* globalCtx, Vec3f* v) { + s32 sp24; + static EffSparkParams D_8015D3D8; + + D_8015D3D8.position.x = (s32)v->x; + D_8015D3D8.position.y = (s32)v->y; + D_8015D3D8.position.z = (s32)v->z; + D_8015D3D8.particleFactor1 = 5; + D_8015D3D8.particleFactor2 = 5; + D_8015D3D8.colorStart[0].r = 0xFF; + D_8015D3D8.colorStart[0].g = 0xFF; + D_8015D3D8.colorStart[0].b = 0xFF; + D_8015D3D8.colorStart[0].a = 0xFF; + D_8015D3D8.colorStart[1].r = 0x64; + D_8015D3D8.colorStart[1].g = 0x64; + D_8015D3D8.colorStart[1].b = 0x64; + D_8015D3D8.colorStart[1].a = 0x64; + D_8015D3D8.colorStart[2].r = 0x64; + D_8015D3D8.colorStart[2].g = 0x64; + D_8015D3D8.colorStart[2].b = 0x64; + D_8015D3D8.colorStart[2].a = 0x64; + D_8015D3D8.colorStart[3].r = 0x64; + D_8015D3D8.colorStart[3].g = 0x64; + D_8015D3D8.colorStart[3].b = 0x64; + D_8015D3D8.colorStart[3].a = 0x64; + D_8015D3D8.colorEnd[0].r = 0x32; + D_8015D3D8.colorEnd[0].g = 0x32; + D_8015D3D8.colorEnd[0].b = 0x32; + D_8015D3D8.colorEnd[0].a = 0x32; + D_8015D3D8.colorEnd[1].r = 0x32; + D_8015D3D8.colorEnd[1].g = 0x32; + D_8015D3D8.colorEnd[1].b = 0x32; + D_8015D3D8.colorEnd[1].a = 0x32; + D_8015D3D8.colorEnd[2].r = 0x32; + D_8015D3D8.colorEnd[2].g = 0x32; + D_8015D3D8.colorEnd[2].b = 0x32; + D_8015D3D8.colorEnd[2].a = 0x32; + D_8015D3D8.colorEnd[3].r = 0x00; + D_8015D3D8.colorEnd[3].g = 0x00; + D_8015D3D8.colorEnd[3].b = 0x00; + D_8015D3D8.colorEnd[3].a = 0x00; + D_8015D3D8.age = 0; + D_8015D3D8.duration = 16; + D_8015D3D8.velocity = 8.0f; + D_8015D3D8.gravity = -1.0f; + Effect_Add(globalCtx, &sp24, 0, 0, 1, &D_8015D3D8); +} +#else +#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062B80.s") +#endif // NON_MATCHING + +void func_80062CD4(GlobalContext* globalCtx, Vec3f* v) { + s32 sp24; + static EffShieldParticleInit init = { + 16, + { 0, 0, 0 }, + { { 0x00, 0xC8, 0xFF, 0xFF } }, + { { 0xFF, 0xFF, 0xFF, 0xFF } }, + { { 0xFF, 0xFF, 0x80, 0xFF } }, + { { 0xFF, 0xFF, 0x00, 0xFF } }, + { { 0xFF, 0x40, 0x00, 0xC8 } }, + { { 0xFF, 0x00, 0x00, 0xFF } }, + 2.1f, + 35.0f, + 30.0f, + 8, + { 0, 0, 0, 0x00, 0x80, 0xFF, 0x00, 300 }, + 1, + }; + + init.position.x = (s32)v->x; + init.position.y = (s32)v->y; + init.position.z = (s32)v->z; + init.lightParams.posX = init.position.x; + init.lightParams.posY = init.position.y; + init.lightParams.posZ = init.position.z; + Effect_Add(globalCtx, &sp24, 3, 0, 1, &init); +} + +void func_80062D60(GlobalContext* globalCtx, Vec3f* v) { + func_80062CD4(globalCtx, v); + Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_REFLECT_SW, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); +} + +void func_80062DAC(GlobalContext* globalCtx, Vec3f* v, Vec3f* arg2) { + func_80062CD4(globalCtx, v); + Audio_PlaySoundGeneral(NA_SE_IT_SHIELD_REFLECT_SW, arg2, 4, &D_801333E0, &D_801333E0, &D_801333E8); +} + +void func_80062DF4(GlobalContext* globalCtx, Vec3f* v) { + func_80062D60(globalCtx, v); +} + +void func_80062E14(GlobalContext* globalCtx, Vec3f* v, Vec3f* arg2) { + s32 sp24; + static EffShieldParticleInit init = { + 16, + { 0, 0, 0 }, + { { 0x00, 0xC8, 0xFF, 0xFF } }, + { { 0xFF, 0xFF, 0xFF, 0xFF } }, + { { 0xFF, 0xFF, 0x80, 0xFF } }, + { { 0xFF, 0xFF, 0x00, 0xFF } }, + { { 0xFF, 0x40, 0x00, 0xC8 } }, + { { 0xFF, 0x00, 0x00, 0xFF } }, + 2.1f, + 35.0f, + 30.0f, + 8, + { 0, 0, 0, 0x00, 0x80, 0xFF, 0x00, 300 }, + 0, + }; + + init.position.x = (s32)v->x; + init.position.y = (s32)v->y; + init.position.z = (s32)v->z; + init.lightParams.posX = init.position.x; + init.lightParams.posY = init.position.y; + init.lightParams.posZ = init.position.z; + + Effect_Add(globalCtx, &sp24, 3, 0, 1, &init); + Audio_PlaySoundGeneral(NA_SE_IT_REFLECTION_WOOD, arg2, 4, &D_801333E0, &D_801333E0, &D_801333E8); +} + +#if 0 // NON_MATCHING +// Incomplete, possibly not using the same logic +s32 func_80062ECC(f32 actor_ac_98_10, f32 actor_ac_98_12, f32 arg2, Vec3f* ac_actor_pos, Vec3f* at_actor_pos, Vec3f* arg5, Vec3f* arg6, + Vec3f* arg7) { + // arg5 = SP + 0xA8, unk input + // arg6 = SP + 0x90, unk output + // arg7 = SP + 0x84, unk output2 + // sp -0x78 + + Vec3f delta_a3_a4_sp6C; + Vec3f delta_a3_a5_sp60; + Vec3f delta_a4_a5_sp54; + f32 sp50; + f32 sp4C; + f32 temp_f0; + f32 temp_f0_3; + f32 temp_f12; + f32 temp_f14; + f32 sp38; + f32 temp_f16_2; + f32 temp_f2; + s32 phi_v0; + s32 phi_v1; + s32 phi_a0; + s32 phi_a1; + s32 phi_a2; + + delta_a3_a4_sp6C.x = at_actor_pos->x - ac_actor_pos->x; + delta_a3_a4_sp6C.y = at_actor_pos->y - ac_actor_pos->y - arg2; // temp_f14 + delta_a3_a4_sp6C.z = at_actor_pos->z - ac_actor_pos->z; + + delta_a3_a5_sp60.x = arg5->x - ac_actor_pos->x; + delta_a3_a5_sp60.y = arg5->y - ac_actor_pos->y - arg2; // temp_f6 + delta_a3_a5_sp60.z = arg5->z - ac_actor_pos->z; + + delta_a4_a5_sp54.x = delta_a3_a5_sp60.x - delta_a3_a4_sp6C.x; // temp_f16; + delta_a4_a5_sp54.y = delta_a3_a5_sp60.y - delta_a3_a4_sp6C.y; // sp18; // temp_f8; + delta_a4_a5_sp54.z = delta_a3_a5_sp60.z - delta_a3_a4_sp6C.z; // temp_f18; + + phi_v0 = 0; + // ada12c: bc1f 0xada138 ~> + if (0.0f < delta_a3_a4_sp6C.y) { + phi_v0 = 1; + } + // ada138: beqzl v0,0xada188 ~> + if (phi_v0 && delta_a3_a4_sp6C.y < actor_ac_98_12) { + if (sqrtf(SQ(delta_a3_a4_sp6C.x) + SQ(delta_a3_a4_sp6C.z)) < actor_ac_98_10) { + return 3; + } + } + + phi_v1 = 0; + if (0.0f < delta_a3_a5_sp60.y) { //ada19c: bc1f 0xada1a8 ~> + phi_v1 = 1; + } + //ada1a8: beqzl v1,0xada1f4 ~> + if (phi_v1 && delta_a3_a5_sp60.y < actor_ac_98_12) { + if (sqrtf(SQ(delta_a3_a5_sp60.x) + SQ(delta_a3_a5_sp60.z)) < actor_ac_98_10) { + return 3; + } + } + + //ada1f4 + sp38 = SQ(delta_a3_a4_sp6C.x) + SQ(delta_a3_a4_sp6C.z) - SQ(actor_ac_98_10); // temp_f12; + temp_f2 = SQ(delta_a4_a5_sp54.x) + SQ(delta_a4_a5_sp54.z); + if (!(fabsf(temp_f2) < 0.008f)) { // ada23c: bc1t 0xada2f0 ~> + temp_f14 = (delta_a4_a5_sp54.x + delta_a4_a5_sp54.x) * delta_a3_a4_sp6C.x + (delta_a4_a5_sp54.z + delta_a4_a5_sp54.z) * delta_a3_a4_sp6C.z; + temp_f0 = SQ(temp_f14); + temp_f12 = (4.0f * temp_f2) * sp38; + if (temp_f0 < temp_f12) { // ada280: bc1f 0xada290 ~> + return 0; + } + //ada290 + temp_f16_2 = temp_f0 - temp_f12; + temp_f0 = sqrtf(temp_f16_2); + if (0.0f < temp_f16_2) { + phi_v0 = 1; + phi_v1 = 1; + } else { + phi_v0 = 0; + phi_v1 = 1; + } + + sp50 = (temp_f0 - temp_f14) / (temp_f2 + temp_f2); // temp_f16_3; + if (phi_v0 == 1) { + sp4C = (-temp_f14 - temp_f0) / (temp_f2 + temp_f2); + } + } else { // 0xada2f0 + temp_f14 = ((delta_a4_a5_sp54.x + delta_a4_a5_sp54.x) * delta_a3_a4_sp6C.x) + ((delta_a4_a5_sp54.z + delta_a4_a5_sp54.z) * delta_a3_a4_sp6C.z); + if (!(fabsf(temp_f14) < 0.008f)) { // ada324 + phi_v0 = 0; + sp50 = -sp38 / temp_f14; + phi_v1 = 1; + } // ada340: b 0xada468 + else { + if (sp38 <= 0.0f) { // ada358: bc1f 0xada460 + phi_a0 = phi_v0; + if (phi_v0 != 0) // ada360: beqz v0,0xada388 ~> + { + phi_a0 = 0; + //ada37C + if (delta_a3_a4_sp6C.y < actor_ac_98_12) { + phi_a0 = 1; + } + } + phi_a1 = phi_a0; + //ada38C + phi_a0 = phi_v1; + if (phi_v1 != 0) { + phi_a0 = 0; + if (delta_a3_a5_sp60.y < actor_ac_98_12) { + phi_a0 = 1; + } + } + if (phi_a1) { // ada3b4 + if (phi_a0) { // ada3bc + *arg6 = delta_a3_a4_sp6C; + *arg7 = delta_a3_a5_sp60; + return 2; + } + } + // ada408 + if (phi_a1) { + *arg6 = delta_a3_a4_sp6C; + return 1; + } + // ada434 + if (phi_a0) { + *arg6 = delta_a3_a5_sp60; + return 1; + } + } + //ada460 + return 0; + } + } + // ada468 800632C8 + if (phi_v0 == 0) { // ada468: bnezl v0,0xada4a4 ~> + if (sp50 < 0.0f || 1.0f < sp50) { + return 0; + } + } else { // ada4a4 + phi_a1 = 0; + if (sp50 < 0.0f) { //ada4ac + phi_a1 = 1; + } + //ada4b8 + phi_a0 = phi_a1; + if (phi_a1 == 0) { + phi_a1 = 0; + if (1.0f < sp50) { + phi_a1 = 1; + } + } + //ada4dc + phi_a2 = 0; + if (sp4C < 0.0f) { + phi_a2 = 1; + } + if (phi_a2 == 0) { + phi_a2 = 0; + if (1.0f < sp4C) { + phi_a2 = 1; + } + } + if (phi_a1 != 0) { + if (phi_a2 != 0) { + return 0; + } + } + if (phi_a1 != 0) { + phi_v1 = 0; + } + if (phi_a2 != 0) { + phi_v0 = 0; + } + } + if (phi_v1 == 1) { + temp_f0_3 = sp50 * delta_a4_a5_sp54.y + delta_a3_a4_sp6C.y; + if (temp_f0_3 < 0.0f || actor_ac_98_12 < temp_f0_3) { + phi_v1 = 0; + } + } + if (phi_v0 == 1) { + temp_f0_3 = sp4C * delta_a4_a5_sp54.y + delta_a3_a4_sp6C.y; + if (temp_f0_3 < 0.0f || actor_ac_98_12 < temp_f0_3) { + phi_v0 = 0; + } + } + if (phi_v1 == 0 && phi_v0 == 0) { + return 0; + } + if (phi_v1 == 1) { + if (phi_v0 == 1) { + arg6->x = sp50 * delta_a4_a5_sp54.x + delta_a3_a4_sp6C.x + ac_actor_pos->x; + arg6->y = sp50 * delta_a4_a5_sp54.y + delta_a3_a4_sp6C.y + ac_actor_pos->y; + arg6->z = sp50 * delta_a4_a5_sp54.z + delta_a3_a4_sp6C.z + ac_actor_pos->z; + arg7->x = sp4C * delta_a4_a5_sp54.x + delta_a3_a4_sp6C.x + ac_actor_pos->x; + arg7->y = sp4C * delta_a4_a5_sp54.y + delta_a3_a4_sp6C.y + ac_actor_pos->y; + arg7->z = sp4C * delta_a4_a5_sp54.z + delta_a3_a4_sp6C.z + ac_actor_pos->z; + return 2; + } + } + if (phi_v1 == 1) { + arg6->x = sp50 * delta_a4_a5_sp54.x + delta_a3_a4_sp6C.x + ac_actor_pos->x; + arg6->y = sp50 * delta_a4_a5_sp54.y + delta_a3_a4_sp6C.y + ac_actor_pos->y; + arg6->z = sp50 * delta_a4_a5_sp54.z + delta_a3_a4_sp6C.z + ac_actor_pos->z; + return 1; + } + if (phi_v0 == 1) { // ada700 + arg6->x = sp4C * delta_a4_a5_sp54.x + delta_a3_a4_sp6C.x + ac_actor_pos->x; + arg6->y = sp4C * delta_a4_a5_sp54.y + delta_a3_a4_sp6C.y + ac_actor_pos->y; + arg6->z = sp4C * delta_a4_a5_sp54.z + delta_a3_a4_sp6C.z + ac_actor_pos->z; + return 1; + } + return 1; +} +#else +#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062ECC.s") +#endif // NON_MATCHING + +s32 func_800635D0(s32 arg0) { + s32 result; + + result = 0; + if (arg0 & 0x00400100) { + result = 1; + } else if (arg0 & 0x03000242) { + result = 2; + } else if (arg0 & 0x48800400) { + result = 4; + } else if (arg0 & 0x04000000) { + result = 8; + } + + KREG(7) = result; + return result; +} diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 84107e8a4..2e6aca502 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -32,7 +32,7 @@ typedef struct { /* 0x172 */ s16 unk_172; /* 0x174 */ s16 unk_174; /* 0x178 */ f32 unk_178; - /* 0x17C */ ColliderCylinderMain cylinderCollider; + /* 0x17C */ ColliderCylinder cylinderCollider; } ActorEnAObj; // size = 0x1C8 void func_8001D204(ActorEnAObj* this, GlobalContext* globalCtx); @@ -140,9 +140,9 @@ void En_A_Obj_Init(ActorEnAObj* this, GlobalContext* globalCtx) { this->actor.unk_4C = 500.0f; this->unk_178 = 45.0f; func_8001D234(this, this->actor.params); - ActorCollider_AllocCylinder(globalCtx, &this->cylinderCollider); - ActorCollider_InitCylinder(globalCtx, &this->cylinderCollider, &this->actor, &D_80115440); - this->actor.sub_98.mass = 0xFF; + Collider_InitCylinder(globalCtx, &this->cylinderCollider); + Collider_SetCylinder(globalCtx, &this->cylinderCollider, &this->actor, &D_80115440); + this->actor.colChkInfo.mass = 0xFF; this->actor.unk_1F = 0; break; case A_OBJ_KNOB: @@ -156,7 +156,7 @@ void En_A_Obj_Init(ActorEnAObj* this, GlobalContext* globalCtx) { } if (this->actor.params < 5) { - this->actor.sub_98.mass = 0xFF; + this->actor.colChkInfo.mass = 0xFF; } if (this->dynaPolyId != -1) { @@ -169,14 +169,14 @@ void En_A_Obj_Init(ActorEnAObj* this, GlobalContext* globalCtx) { #endif void En_A_Obj_Destroy(ActorEnAObj* this, GlobalContext* globalCtx) { - ColliderCylinderMain* cylinderCollider = &this->cylinderCollider; + ColliderCylinder* cylinderCollider = &this->cylinderCollider; DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId); switch (this->actor.params) { case A_OBJ_SIGNPOST_OBLONG: case A_OBJ_SIGNPOST_ARROW: - ActorCollider_FreeCylinder(globalCtx, cylinderCollider); + Collider_DestroyCylinder(globalCtx, cylinderCollider); } } @@ -303,7 +303,7 @@ void func_8001D608(ActorEnAObj* this, GlobalContext* globalCtx) { } void En_A_Obj_Update(ActorEnAObj* this, GlobalContext* globalCtx) { - ColliderCylinderMain* cylinderCollider; + Collider* collider; this->updateFunc(this, globalCtx); Actor_MoveForward(&this->actor); @@ -322,9 +322,9 @@ void En_A_Obj_Update(ActorEnAObj* this, GlobalContext* globalCtx) { switch (this->actor.params) { case A_OBJ_SIGNPOST_OBLONG: case A_OBJ_SIGNPOST_ARROW: - cylinderCollider = &this->cylinderCollider; - ActorCollider_Cylinder_Update(&this->actor, cylinderCollider); - Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, cylinderCollider); + collider = (Collider*)&this->cylinderCollider; + Collider_CylinderUpdate(&this->actor, &this->cylinderCollider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, collider); } } diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index dde4f6535..917e5fece 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -40,7 +40,7 @@ typedef struct { /* 0x158 */ s16 unk_158; /* 0x15A */ s16 unk_15A; /* 0x15C */ f32 unk_15C; - /* 0x160 */ ColliderCylinderMain cylinderCollider; + /* 0x160 */ ColliderCylinder cylinderCollider; } ActorEnItem00; void func_8001DFC8(ActorEnItem00* this, GlobalContext* globalCtx); @@ -93,8 +93,8 @@ void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) { } Actor_ProcessInitChain(&this->actor, D_8011550C); - ActorCollider_AllocCylinder(globalCtx, &this->cylinderCollider); - ActorCollider_InitCylinder(globalCtx, &this->cylinderCollider, &this->actor, &D_801154E0); + Collider_InitCylinder(globalCtx, &this->cylinderCollider); + Collider_SetCylinder(globalCtx, &this->cylinderCollider, &this->actor, &D_801154E0); this->unk_158 = 1; @@ -301,8 +301,8 @@ void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) { #endif void En_Item00_Destroy(ActorEnItem00* this, GlobalContext* globalCtx) { - ColliderCylinderMain* cylinderCollider = &this->cylinderCollider; - ActorCollider_FreeCylinder(globalCtx, cylinderCollider); + ColliderCylinder* cylinderCollider = &this->cylinderCollider; + Collider_DestroyCylinder(globalCtx, cylinderCollider); } void func_8001DFC8(ActorEnItem00* this, GlobalContext* globalCtx) { @@ -529,8 +529,8 @@ void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) { } } - ActorCollider_Cylinder_Update(&this->actor, &this->cylinderCollider); - Actor_CollisionCheck_SetAC(globalCtx, &globalCtx->sub_11E60, &this->cylinderCollider); + Collider_CylinderUpdate(&this->actor, &this->cylinderCollider); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinderCollider); if ((this->actor.params == DROP_SHIELD_DEKU) || (this->actor.params == DROP_SHIELD_HYLIAN) || (this->actor.params == DROP_TUNIC_ZORA) || (this->actor.params == DROP_TUNIC_GORON)) { diff --git a/src/code/z_play.c b/src/code/z_play.c index 55a5c4029..d01d86ce7 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -159,7 +159,7 @@ void Gameplay_Destroy(GlobalContext* globalCtx) { func_800C0F08(&globalCtx->preRenderCtx); func_800271A8(globalCtx); Effect_SS_Clear(globalCtx); - func_8005D400(globalCtx, &globalCtx->sub_11E60); + CollisionCheck_DestroyContext(globalCtx, &globalCtx->colChkCtx); if (D_80161490 == 3) { func_800B1DBC(&D_801613B0); @@ -242,7 +242,7 @@ void Gameplay_Init(GlobalContext* globalCtx) { func_8006BA00(globalCtx); func_80026C2C(globalCtx); func_800272B0(globalCtx, 0x55); - func_8005D3BC(globalCtx, &globalCtx->sub_11E60); + func_8005D3BC(globalCtx, &globalCtx->colChkCtx); SkelAnime_AnimationCtxReset(&globalCtx->animationCtx); func_8006450C(globalCtx, &globalCtx->csCtx); @@ -834,25 +834,25 @@ void Gameplay_Update(GlobalContext* globalCtx) { LOG_NUM("1", 1, "../z_play.c", 3612); } - func_8006139C(globalCtx, &globalCtx->sub_11E60); + func_8006139C(globalCtx, &globalCtx->colChkCtx); if (1 && HREG(63)) { LOG_NUM("1", 1, "../z_play.c", 3618); } - func_80061C98(globalCtx, &globalCtx->sub_11E60); + CollisionCheck_OC(globalCtx, &globalCtx->colChkCtx); if (1 && HREG(63)) { LOG_NUM("1", 1, "../z_play.c", 3624); } - func_800622E4(globalCtx, &globalCtx->sub_11E60); + func_800622E4(globalCtx, &globalCtx->colChkCtx); if (1 && HREG(63)) { LOG_NUM("1", 1, "../z_play.c", 3631); } - func_8005D40C(globalCtx, &globalCtx->sub_11E60); + CollisionCheck_InitContext(globalCtx, &globalCtx->colChkCtx); if (1 && HREG(63)) { LOG_NUM("1", 1, "../z_play.c", 3637); diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c index c859ec47f..13045fbc4 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c @@ -43,9 +43,9 @@ const ActorInit Bg_Bdan_Objects_InitVars = { }; static ColliderCylinderInit D_8086CD70 = { - 0x0A, 0x11, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xFFCFFFFF, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00000000, - 0x09, 0x00, 0x00, 0x00, 0x00BB, 0x0050, 0x0000, 0x0000, 0x0000, 0x0000, + { COLTYPE_UNK10, 0x11, 0x00, 0x00, 0x20, COLSHAPE_CYLINDER }, + { 0x00, { 0xFFCFFFFF, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, 0x09, 0x00, 0x00 }, + { 0x00BB, 0x0050, 0x0000, { 0 } }, }; static InitChainEntry initChain[] = { @@ -111,8 +111,8 @@ void BgBdanObjects_Init(BgBdanObjects* this, GlobalContext* globalCtx) { } if (thisx->params == 0) { DynaPolyInfo_Alloc(&D_06008CE0, &localC); - ActorCollider_AllocCylinder(globalCtx, &this->collider); - ActorCollider_InitCylinder(globalCtx, &this->collider, this, &D_8086CD70); + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, this, &D_8086CD70); thisx->posRot.pos.y = (f32)(thisx->posRot.pos.y + -79.0f); if (Flags_GetClear(globalCtx, thisx->room)) { Flags_SetSwitch(globalCtx, this->unk_168); @@ -157,7 +157,7 @@ void BgBdanObjects_Destroy(BgBdanObjects* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); if (thisx->params == 0) { - ActorCollider_FreeCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(globalCtx, &this->collider); } } @@ -296,8 +296,8 @@ void func_8086C5BC(BgBdanObjects* this, GlobalContext* globalCtx) { } void func_8086C618(BgBdanObjects* this, GlobalContext* globalCtx) { - ActorCollider_Cylinder_Update(&this->dyna.actor, &this->collider); - Actor_CollisionCheck_SetAT(globalCtx, &globalCtx->sub_11E60, &this->collider); + Collider_CylinderUpdate(&this->dyna.actor, &this->collider); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider); if (Flags_GetClear(globalCtx, this->dyna.actor.room)) { Flags_SetSwitch(globalCtx, this->unk_168); this->dyna.actor.initPosRot.rot.y = (s16)(this->dyna.actor.shape.rot.y + 0x2000) & 0xC000; diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h index 67993180d..db1092bc1 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h @@ -9,7 +9,7 @@ typedef struct { /* 0x0164 */ ActorFunc actionFunc; /* 0x0168 */ u8 unk_168; /* 0x016A */ s16 unk_16A; - /* 0x016C */ ColliderCylinderMain collider; + /* 0x016C */ ColliderCylinder collider; /* 0x01B8 */ s32 unk_1B8; } BgBdanObjects; // size = 0x01BC diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c index f15f9a2e5..785b705d5 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c @@ -57,10 +57,18 @@ extern UNK_PTR D_06005CF8; extern UNK_PTR D_060061A0; extern UNK_PTR D_06005A20; -static u32 D_8086E0A0[] = { 0x00000000, 0x00000000, 0x00000000, 0xEFC1FFFE, 0x00000000, - 0x00010100, 0x00000000, 0x00780000, 0x01720064 }; +static ColliderJntSphItemInit colliderItemsInit[] = { + { + { 0x00, { 0x00000000, 0x00, 0x00 }, { 0xEFC1FFFE, 0x00, 0x00 }, 0x00, 0x01, 0x01 }, + { 0x00, { { 0x0000, 0x0078, 0x0000 }, 370 }, 100 }, + }, +}; -static u32 D_8086E0C4[] = { 0x0A000939, 0x20000000, 0x00000001, &D_8086E0A0 }; +static ColliderJntSphInit colliderInit = { + { COLTYPE_UNK10, 0x00, 0x09, 0x39, 0x20, COLSHAPE_JNTSPH }, + 1, + &colliderItemsInit, +}; static InitChainEntry initChain[] = { ICHAIN_F32(unk_F4, 1400, ICHAIN_CONTINUE), @@ -68,7 +76,7 @@ static InitChainEntry initChain[] = { ICHAIN_F32(unk_FC, 1200, ICHAIN_STOP), }; -static u32 D_8086E0E0[] = { 0x00000000, 0x430C0000, 0x00000000, 0x00000000 }; +static Vec3f D_8086E0E0 = { 0, 140.0f, 0 }; void func_8086D010(BgBdanSwitch* this, GlobalContext* globalCtx, u32 collision, DynaPolyMoveFlag flag) { s16 pad1; @@ -86,8 +94,8 @@ void func_8086D010(BgBdanSwitch* this, GlobalContext* globalCtx, u32 collision, void func_8086D098(BgBdanSwitch* this, GlobalContext* globalCtx) { Actor* actor = &this->actor; - func_8005BBF8(globalCtx, &this->collider, actor); - func_8005C050(globalCtx, &this->collider, actor, &D_8086E0C4, &this->collider.unk_20); + Collider_InitJntSph(globalCtx, &this->collider); + Collider_SetJntSph(globalCtx, &this->collider, actor, &colliderInit, &this->colliderItems); } void func_8086D0EC(BgBdanSwitch* this) { @@ -187,7 +195,7 @@ void BgBdanSwitch_Destroy(BgBdanSwitch* this, GlobalContext* globalCtx) { break; case YELLOW_TALL_1: case YELLOW_TALL_2: - func_8005BCC8(globalCtx, &this->collider); + Collider_DestroyJntSph(globalCtx, &this->collider); } } @@ -383,14 +391,14 @@ void func_8086DB68(BgBdanSwitch* this, GlobalContext* globalCtx) { default: return; case YELLOW_TALL_1: - if (((this->collider.base.collideFlags & 2) != 0) && this->unk_1D8 <= 0) { + if (((this->collider.base.acFlags & 2) != 0) && this->unk_1D8 <= 0) { this->unk_1D8 = 0xA; func_8086DC30(this); func_8086D4B4(this, globalCtx); } break; case YELLOW_TALL_2: - if (((this->collider.base.collideFlags & 2) != 0) && ((this->unk_1DC & 2) == 0) && this->unk_1D8 <= 0) { + if (((this->collider.base.acFlags & 2) != 0) && ((this->unk_1DC & 2) == 0) && this->unk_1D8 <= 0) { this->unk_1D8 = 0xA; func_8086DC30(this); func_8086D4B4(this, globalCtx); @@ -426,7 +434,7 @@ void func_8086DCE8(BgBdanSwitch* this, GlobalContext* globalCtx) { } break; case YELLOW_TALL_2: - if (((this->collider.base.collideFlags & 2) != 0) && ((this->unk_1DC & 2) == 0) && (this->unk_1D8 <= 0)) { + if (((this->collider.base.acFlags & 2) != 0) && ((this->unk_1DC & 2) == 0) && (this->unk_1D8 <= 0)) { this->unk_1D8 = 0xA; func_8086DDA8(this); func_8086D548(this, globalCtx); @@ -468,12 +476,12 @@ void BgBdanSwitch_Update(BgBdanSwitch* this, GlobalContext* globalCtx) { if (!func_8008E988(globalCtx) && this->unk_1D8 > 0) { this->unk_1D8 -= 1; } - pad = this->collider.base.collideFlags; - this->collider.base.collideFlags &= 0xFFFD; + pad = this->collider.base.acFlags; + this->collider.base.acFlags &= 0xFFFD; this->unk_1DC = pad; - this->collider.unk_1C->unk_2E = this->unk_1D4 * 370.0f; - Actor_CollisionCheck_SetAC(globalCtx, &globalCtx->sub_11E60, &this->collider); - Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider); + this->collider.list[0].dim.modelSphere.radius = this->unk_1D4 * 370.0f; + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider); } void func_8086DF58(BgBdanSwitch* this, GlobalContext* globalCtx, UNK_TYPE arg2) { diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h index a0c34ac88..84c9d336d 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h @@ -14,24 +14,6 @@ typedef enum { } BgBdanSwitchType; typedef struct { - /* 0x00 */ char unk_00[0x2E]; - /* 0x2E */ s16 unk_2E; -} ColliderCustomHelper; - -typedef struct { - /* 0x00 */ Collider base; - /* 0x18 */ char unk_18[0x4]; - /* 0x1C */ ColliderCustomHelper* unk_1C; - /* 0x20 */ s32 unk_20; - /* 0x24 */ char unk_24[0x1C]; - // after this is a guess based on ColliderCylinderMain - /* 0x40 */ s16 radius; - /* 0x42 */ s16 height; - /* 0x44 */ s16 yShift; - /* 0x46 */ Vec3s position; -} ColliderCustomMain; // size = 0x4C - -typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ u32 dynaPolyId; /* 0x0150 */ f32 unk_150; @@ -40,8 +22,8 @@ typedef struct { /* 0x015C */ u32 unk_15C; /* 0x0160 */ u8 unk_160; /* 0x0164 */ ActorFunc updateFunc; - /* 0x0168 */ ColliderCustomMain collider; - /* 0x01B4 */ char unk_1B4[0x14]; + /* 0x0168 */ ColliderJntSph collider; + /* 0x0188 */ ColliderJntSphItem colliderItems[1]; /* 0x01C8 */ f32 unk_1C8; /* 0x01CC */ s16 unk_1CC; /* 0x01CE */ char unk_1CE[0x2]; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c index 734810bda..66e44f757 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c @@ -34,11 +34,12 @@ const ActorInit Bg_Hidan_Firewall_InitVars = { }; static ColliderCylinderInit cylinderInitData = { - 0x0A, 0x11, 0x00, 0x09, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20000000, 0x01, 0x04, - 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x01, 0x00, 0x001E, 0x0053, 0x0000, + { COLTYPE_UNK10, 0x11, 0x00, 0x09, 0x20, COLSHAPE_CYLINDER }, + { 0x00, { 0x20000000, 0x01, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x19, 0x00, 0x01 }, + { 30, 83, 0, { 0 } }, }; -static Sub98Init4 actor98InitData = { +static CollisionCheckInfoInit colChkInfoInit = { 0x01, 0x0050, 0x0064, @@ -62,19 +63,19 @@ void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx) { this->unk_150 = 0; - ActorCollider_AllocCylinder(globalCtx, &this->collider); - ActorCollider_InitCylinder(globalCtx, &this->collider, &this->actor, &cylinderInitData); + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &cylinderInitData); - this->collider.dim.position.y = this->actor.posRot.pos.y; + this->collider.dim.pos.y = this->actor.posRot.pos.y; - func_80061ED4(&this->actor.sub_98, NULL, &actor98InitData); + func_80061ED4(&this->actor.colChkInfo, NULL, &colChkInfoInit); this->actionFunc = (ActorFunc)BgHidanFirewall_Wait; } void BgHidanFirewall_Destroy(BgHidanFirewall* this, GlobalContext* globalCtx) { BgHidanFirewall* thing = this; - ActorCollider_FreeCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(globalCtx, &this->collider); } s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, GlobalContext* globalCtx) { @@ -165,8 +166,8 @@ void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* } sp28 = Math_Sins(this->actor.shape.rot.y); temp_ret = Math_Coss(this->actor.shape.rot.y); - this->collider.dim.position.x = this->actor.posRot.pos.x + sp30.x * temp_ret + sp30.z * sp28; - this->collider.dim.position.z = this->actor.posRot.pos.z - sp30.x * sp28 + sp30.z * temp_ret; + this->collider.dim.pos.x = this->actor.posRot.pos.x + sp30.x * temp_ret + sp30.z * sp28; + this->collider.dim.pos.z = this->actor.posRot.pos.z - sp30.x * sp28 + sp30.z * temp_ret; } void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx) { @@ -175,16 +176,16 @@ void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx) { this->unk_150 = (this->unk_150 + 1) % 8; - if (this->collider.base.colliderFlags & 2) { - this->collider.base.colliderFlags &= ~2; + if (this->collider.base.atFlags & 2) { + this->collider.base.atFlags &= ~2; BgHidanFirewall_Collide(this, globalCtx); } this->actionFunc(this, globalCtx); if (this->actionFunc == (ActorFunc)BgHidanFirewall_Erupt) { BgHidanFirewall_ColliderFollowPlayer(this, globalCtx); - Actor_CollisionCheck_SetAT(globalCtx, &globalCtx->sub_11E60, &this->collider); - Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider); func_8002F974(&this->actor, 0x2034); } } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h index 32cc66c10..c7f75a498 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.h @@ -8,7 +8,7 @@ typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ ActorFunc actionFunc; /* 0x0150 */ s16 unk_150; - /* 0x0154 */ ColliderCylinderMain collider; + /* 0x0154 */ ColliderCylinder collider; } BgHidanFirewall; // size = 0x01A0 #endif diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c index f1dccb770..00730a83a 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c @@ -162,11 +162,12 @@ const ActorInit Bg_Toki_Swd_InitVars = { }; static ColliderCylinderInit colliderInit = { - 0x0A, 0x00, 0x00, 0x39, 0x12, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, - 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000, 0x0001, 0x0000, 0x000A, 0x0046, 0x0000, + { COLTYPE_UNK10, 0x00, 0x00, 0x39, 0x12, COLSHAPE_CYLINDER }, + { 0x00, { 0xFFCFFFFF, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x00, 0x00, 0x01 }, + { 10, 70, 0, { 0 } } }; -static Sub98Init4 sub98Init = { +static CollisionCheckInfoInit colChkInfoInit = { 0x0A, 0x0023, 0x0064, @@ -182,7 +183,7 @@ void BgTokiSwd_SetupAction(BgTokiSwd* this, ActorFunc actionFunc) { } void BgTokiSwd_Init(BgTokiSwd* this, GlobalContext* globalCtx) { - ColliderCylinderMain* collision; + ColliderCylinder* collision; Actor* thisx = &this->actor; Actor_ProcessInitChain(thisx, initChain); @@ -197,15 +198,15 @@ void BgTokiSwd_Init(BgTokiSwd* this, GlobalContext* globalCtx) { globalCtx->unk_11D30[0] = 0xFF; } - ActorCollider_AllocCylinder(globalCtx, collision); - ActorCollider_InitCylinder(globalCtx, collision, thisx, &colliderInit); - ActorCollider_Cylinder_Update(thisx, collision); - func_80061ED4(&thisx->sub_98, 0, &sub98Init); + Collider_InitCylinder(globalCtx, collision); + Collider_SetCylinder(globalCtx, collision, thisx, &colliderInit); + Collider_CylinderUpdate(thisx, collision); + func_80061ED4(&thisx->colChkInfo, 0, &colChkInfoInit); } void BgTokiSwd_Destroy(BgTokiSwd* this, GlobalContext* globalCtx) { - ColliderCylinderMain* collider = &this->collider; - ActorCollider_FreeCylinder(globalCtx, collider); + ColliderCylinder* collider = &this->collider; + Collider_DestroyCylinder(globalCtx, collider); } void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx) { @@ -269,7 +270,7 @@ void func_808BB128(BgTokiSwd* this, GlobalContext* globalCtx) { void BgTokiSwd_Update(BgTokiSwd* this, GlobalContext* globalCtx) { this->actionFunc(&this->actor, globalCtx); - Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider); } void BgTokiSwd_Draw(BgTokiSwd* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h index 4fd13fbb0..c5c942ff9 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h @@ -7,7 +7,7 @@ typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ ActorFunc actionFunc; - /* 0x0150 */ ColliderCylinderMain collider; + /* 0x0150 */ ColliderCylinder collider; } BgTokiSwd; // size = 0x019C extern const ActorInit Bg_Toki_Swd_InitVars; diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 97e776eaa..467cb0090 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -33,9 +33,9 @@ const ActorInit Door_Ana_InitVars = { // initial collision data static ColliderCylinderInit colliderInit = { - 0x0A, 0x00, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, - 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, 0x00000048, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x0032, 0x000A, 0x0000, 0x0000, 0x0000, 0x0000, + { COLTYPE_UNK10, 0x00, 0x09, 0x00, 0x00, COLSHAPE_CYLINDER }, + { 0x02, { 0x00000000, 0x00, 0x00 }, { 0x00000048, 0x00, 0x00 }, 0x00, 0x01, 0x00 }, + { 50, 10, 0, { 0 } }, }; // array of entrance table entries to grotto destinations @@ -53,7 +53,7 @@ void DoorAna_SetupAction(DoorAna* this, ActorFunc func) { } void DoorAna_Init(DoorAna* this, GlobalContext* globalCtx) { - ColliderCylinderMain* collider; + ColliderCylinder* collider; this->actor.shape.rot.z = 0; this->actor.shape.rot.y = this->actor.shape.rot.z; @@ -62,8 +62,8 @@ void DoorAna_Init(DoorAna* this, GlobalContext* globalCtx) { // only allocate collider for grottos that need bombing/hammering open if ((this->actor.params & 0x200) != 0) { collider = &this->collider; - ActorCollider_AllocCylinder(globalCtx, collider); - ActorCollider_InitCylinder(globalCtx, collider, &this->actor, &colliderInit); + Collider_InitCylinder(globalCtx, collider); + Collider_SetCylinder(globalCtx, collider, &this->actor, &colliderInit); } else { this->actor.flags |= 0x10; } @@ -78,7 +78,7 @@ void DoorAna_Init(DoorAna* this, GlobalContext* globalCtx) { void DoorAna_Destroy(DoorAna* this, GlobalContext* globalCtx) { // free collider if it has one if ((this->actor.params & 0x200) != 0) { - ActorCollider_FreeCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(globalCtx, &this->collider); } } @@ -93,12 +93,12 @@ void DoorAna_Update_Hidden(DoorAna* this, GlobalContext* globalCtx) { } } else { // bombing/hammering open a grotto - if ((this->collider.base.collideFlags & 2) != 0) { + if ((this->collider.base.acFlags & 2) != 0) { openGrotto = true; - ActorCollider_FreeCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(globalCtx, &this->collider); } else { - ActorCollider_Cylinder_Update(&this->actor, &this->collider); - Actor_CollisionCheck_SetAC(globalCtx, &globalCtx->sub_11E60, &this->collider); + Collider_CylinderUpdate(&this->actor, &this->collider); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider); } } // open the grotto diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.h b/src/overlays/actors/ovl_Door_Ana/z_door_ana.h index 98718e330..3eecfc64c 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.h +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.h @@ -6,7 +6,7 @@ typedef struct { /* 0x0000 */ Actor actor; - /* 0x014C */ ColliderCylinderMain collider; + /* 0x014C */ ColliderCylinder collider; /* 0x0198 */ ActorFunc actionFunc; } DoorAna; // size = 0x019C diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index 378e66b93..943c153cd 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -45,8 +45,9 @@ const ActorInit En_Ani_InitVars = { }; static ColliderCylinderInit cylinderInitData = { - 0x0A, 0x00, 0x11, 0x39, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00, 0x00, - 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x001E, 0x0028, 0x0000, + { COLTYPE_UNK10, 0x00, 0x11, 0x39, 0x10, COLSHAPE_CYLINDER }, + { 0x00, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x00, 0x01, 0x01 }, + { 30, 40, 0, { 0 } }, }; static InitChainEntry initChain[] = { @@ -76,9 +77,9 @@ void EnAni_Init(EnAni* this, GlobalContext* globalCtx) { SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_060000F0, anim, this->limbDrawTable, this->transitionDrawTable, 0x10); SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, anim); - ActorCollider_AllocCylinder(globalCtx, &this->collider); - ActorCollider_InitCylinder(globalCtx, &this->collider, &this->actor, &cylinderInitData); - this->actor.sub_98.mass = 0xFF; + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &cylinderInitData); + this->actor.colChkInfo.mass = 0xFF; if (LINK_IS_CHILD) { EnAni_SetupAction(this, func_809B064C); } else { @@ -91,9 +92,9 @@ void EnAni_Init(EnAni* this, GlobalContext* globalCtx) { } void EnAni_Destroy(EnAni* this, GlobalContext* globalCtx) { - ColliderCylinderMain* collider; + ColliderCylinder* collider; collider = &this->collider; - ActorCollider_FreeCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(globalCtx, &this->collider); } s32 EnAni_SetText(EnAni* this, GlobalContext* globalCtx, u16 textId) { @@ -238,13 +239,13 @@ void func_809B0A6C(EnAni* this, GlobalContext* globalCtx) { } void EnAni_Update(EnAni* this, GlobalContext* globalCtx) { - ColliderCylinderMain* collider; + ColliderCylinder* collider; u32 pad; u32 pad2; collider = &this->collider; - ActorCollider_Cylinder_Update(&this->actor, collider); - Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, collider); + Collider_CylinderUpdate(&this->actor, collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, collider); Actor_MoveForward(&this->actor); func_8002E4B4(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); if ((globalCtx->csCtx.state != 0) && (globalCtx->csCtx.actorActions[0] != NULL)) { diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.h b/src/overlays/actors/ovl_En_Ani/z_en_ani.h index c690d8957..07f481154 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.h +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.h @@ -6,7 +6,7 @@ typedef struct { /* 0x0000 */ Actor actor; - /* 0x014C */ ColliderCylinderMain collider; + /* 0x014C */ ColliderCylinder collider; /* 0x0198 */ SkelAnime skelAnime; /* 0x01DC */ Vec3s limbDrawTable[16]; /* 0x023C */ Vec3s transitionDrawTable[16]; diff --git a/src/overlays/actors/ovl_En_Bird/z_en_bird.c b/src/overlays/actors/ovl_En_Bird/z_en_bird.c index dd7b67efd..9ec30777e 100644 --- a/src/overlays/actors/ovl_En_Bird/z_en_bird.c +++ b/src/overlays/actors/ovl_En_Bird/z_en_bird.c @@ -1,7 +1,7 @@ /* * File: z_en_bird.c * Overlay: ovl_En_Bird - * Description: The projectile fired by deku scrubs and octaroks. + * Description: A brown bird. Tweet tweet. */ #include <ultra64.h> @@ -70,7 +70,7 @@ void EnBird_Init(EnBird* this, GlobalContext* globalCtx) { this->unk_194 = 0; this->unk_198 = 0; this->unk_1C0 = 0x9C4; - this->actor.sub_98.mass = 0; + this->actor.colChkInfo.mass = 0; this->unk_1A8 = 1.5f; this->unk_1AC = 0.5f; this->unk_1A0 = 0.0f; diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index ee14811bd..7a045c0a2 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -27,52 +27,10 @@ const ActorInit En_Boom_InitVars = { (ActorFunc)EnBoom_Draw, }; -// Related to collision, should be moved somewhere else when collision_check is decompiled. -// Seems to be made up of a bunch of substructs, but I didnt do too much digging. -// This is probably not accurate. -typedef struct { - u8 unk_00; - u8 unk_01; - u8 unk_02; - u8 unk_03; - u8 unk_04; - u8 unk_05; - u16 pad_06; - u8 unk_08; - u8 pad_09; - u8 pad_0A; - u8 pad_0B; - u32 unk_0C; - u8 unk_10; - u8 unk_11; - u16 pad_12; - u32 unk_14; - u8 unk_18; - u8 unk_19; - u16 pad_1A; - u8 unk_1C; - u8 unk_1D; - u8 unk_1E; - u8 pad_1F; - u32 unk_20; - u32 unk_24; - u32 unk_28; - u32 unk_2C; - u32 unk_30; - u32 unk_34; - u32 unk_38; - u32 unk_3C; - u32 unk_40; - u32 unk_44; - u32 unk_48; - u32 unk_4C; -} unkCollision; // size = 0x50 - -static unkCollision col = { - 0x0A, 0x09, 0x00, 0x00, 0x08, 0x03, 0x0000, 0x02, 0x00, - 0x00, 0x00, 0x00000010, 0x00, 0x01, 0x0000, 0xFFCFFFFF, 0x00, 0x00, - 0x0000, 0x05, 0x00, 0x00, 0x00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +static ColliderQuadInit col = { + { COLTYPE_UNK10, 0x09, 0x00, 0x00, 0x08, COLSHAPE_QUAD }, + { 0x02, { 0x00000010, 0x00, 0x01 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x05, 0x00, 0x00 }, + { 0 }, }; static InitChainEntry initChain[] = { @@ -123,15 +81,15 @@ void EnBoom_Init(EnBoom* this, GlobalContext* globalCtx) { Effect_Add(globalCtx, &this->effect, 1, 0, 0, &trail); - func_8005D018(globalCtx, &this->collider); - func_8005D104(globalCtx, &this->collider, this, &col); + Collider_InitQuad(globalCtx, &this->collider); + Collider_SetQuad(globalCtx, &this->collider, this, &col); EnBoom_SetupAction(this, &EnBoom_Fly); } void EnBoom_Destroy(EnBoom* this, GlobalContext* globalCtx) { func_8002709C(globalCtx, this->effect); - func_8005D060(globalCtx, &this->collider); + Collider_DestroyQuad(globalCtx, &this->collider); } void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { @@ -183,13 +141,13 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { func_8002F974(this, 0x1010); // If the boomerang collides with EnItem00 or a Skulltula token, set grabbed pointer to pick it up - collided = (this->collider.colliderFlags & 0x2); + collided = (this->collider.base.atFlags & 0x2); collided = (!!(collided)); if (collided) { - if (((this->collider.at->id == ACTOR_EN_ITEM00) || (this->collider.at->id == ACTOR_EN_SI))) { - this->grabbed = this->collider.at; - if (this->collider.at->id == ACTOR_EN_SI) { - this->collider.at->flags |= 0x2000; + if (((this->collider.base.at->id == ACTOR_EN_ITEM00) || (this->collider.base.at->id == ACTOR_EN_SI))) { + this->grabbed = this->collider.base.at; + if (this->collider.base.at->id == ACTOR_EN_SI) { + this->collider.base.at->flags |= 0x2000; } } } @@ -220,7 +178,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { Actor_Kill(&this->actor); } } else { - collided = (this->collider.colliderFlags & 0x2); + collided = (this->collider.base.atFlags & 0x2); collided = (!!(collided)); if (collided) { // Copy the position from the prevous frame to the boomerang to start the bounce back. diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.h b/src/overlays/actors/ovl_En_Boom/z_en_boom.h index 473fe4060..88a3d117c 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.h +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.h @@ -5,16 +5,15 @@ #include <global.h> typedef struct { - /* 0x0000 */ Actor actor; - /* 0x014C */ Collider collider; - /* 0x0164 */ char unk_164[0x68]; - /* 0x01CC */ Actor* moveTo; // actor boomerang moves toward - /* 0x01D0 */ Actor* grabbed; // actor grabbed by the boomerang - /* 0x01D4 */ u8 returnTimer; // returns to Link when 0 - /* 0x01D5 */ u8 activeTimer; // increments once every update - /* 0x01D8 */ u32 effect; // set by Effect_Add - /* 0x01DC */ u32 unk_1DC[0x7]; - /* 0x01F8 */ ActorFunc actionFunc; + /* 0x0000 */ Actor actor; + /* 0x014C */ ColliderQuad collider; + /* 0x01CC */ Actor* moveTo; // actor boomerang moves toward + /* 0x01D0 */ Actor* grabbed; // actor grabbed by the boomerang + /* 0x01D4 */ u8 returnTimer; // returns to Link when 0 + /* 0x01D5 */ u8 activeTimer; // increments once every update + /* 0x01D8 */ u32 effect; // set by Effect_Add + /* 0x01DC */ u32 unk_1DC[0x7]; + /* 0x01F8 */ ActorFunc actionFunc; } EnBoom; // size = 0x01FC extern const ActorInit En_Boom_InitVars; diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/src/overlays/actors/ovl_En_Dog/z_en_dog.c index eea273209..fa42989f2 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -33,12 +33,12 @@ const ActorInit En_Dog_InitVars = { }; static ColliderCylinderInit cylinderInit = { - 0x06, 0x00, 0x09, 0x39, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x01, 0x00, 0x0010, 0x0014, 0x0000, 0x0000, 0x0000, 0x0000, + { COLTYPE_UNK6, 0x00, 0x09, 0x39, 0x10, COLSHAPE_CYLINDER }, + { 0x00, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x00, 0x01, 0x01 }, + { 16, 20, 0, { 0 } }, }; -static Sub98Init5 sub98Data = { +static CollisionCheckInfoInit2 colChkInfoInit = { 0x00, // health 0x0000, // unk_10 0x0000, // unk_12 @@ -155,8 +155,8 @@ s32 EnDog_PlayAnimAndSFX(EnDog* this) { } s8 EnDog_CanFollow(EnDog* this, GlobalContext* globalCtx) { - if ((this->collider.base.collideFlags & 2)) { - this->collider.base.collideFlags &= ~2; + if (this->collider.base.acFlags & 2) { + this->collider.base.acFlags &= ~2; return 2; } @@ -164,7 +164,7 @@ s8 EnDog_CanFollow(EnDog* this, GlobalContext* globalCtx) { return 0; } - if ((this->collider.base.maskB & 1)) { + if (this->collider.base.maskB & 1) { this->collider.base.maskB &= ~1; if (gSaveContext.dogParams != 0) { return 0; @@ -221,7 +221,7 @@ s32 EnDog_Orient(EnDog* this, GlobalContext* globalCtx) { void EnDog_Init(EnDog* this, GlobalContext* globalCtx) { SkelAnime* skelAnime; s16 followingDog; - ColliderCylinderMain* collider; + ColliderCylinder* collider; collider = &this->collider; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 24.0f); @@ -239,9 +239,9 @@ void EnDog_Init(EnDog* this, GlobalContext* globalCtx) { return; } - ActorCollider_AllocCylinder(globalCtx, collider); - ActorCollider_InitCylinder(globalCtx, collider, &this->actor, &cylinderInit); - func_80061EFC(&this->actor.sub_98, 0, &sub98Data); + Collider_InitCylinder(globalCtx, collider); + Collider_SetCylinder(globalCtx, collider, &this->actor, &cylinderInit); + func_80061EFC(&this->actor.colChkInfo, 0, &colChkInfoInit); Actor_SetScale(&this->actor, 0.0075f); this->waypoint = 0; this->actor.gravity = -1.0f; @@ -278,8 +278,8 @@ void EnDog_Init(EnDog* this, GlobalContext* globalCtx) { } void EnDog_Destroy(EnDog* this, GlobalContext* globalCtx) { - ColliderCylinderMain* collider = &this->collider; - ActorCollider_FreeCylinder(globalCtx, collider); + ColliderCylinder* collider = &this->collider; + Collider_DestroyCylinder(globalCtx, collider); } void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx) { @@ -437,8 +437,8 @@ void EnDog_Update(EnDog* this, GlobalContext* globalCtx) { func_8002E4B4(globalCtx, &this->actor, this->collider.dim.radius, this->collider.dim.height * 0.5f, 0.0f, 5); Actor_MoveForward(&this->actor); this->actionFunc(this, globalCtx); - ActorCollider_Cylinder_Update(&this->actor, &this->collider); - Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider); + Collider_CylinderUpdate(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider); } s32 EnDog_Callback1(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* actor) { diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.h b/src/overlays/actors/ovl_En_Dog/z_en_dog.h index 30dda5534..16be64f5c 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.h +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.h @@ -8,7 +8,7 @@ typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ ActorFunc actionFunc; - /* 0x0194 */ ColliderCylinderMain collider; + /* 0x0194 */ ColliderCylinder collider; /* 0x01E0 */ Path* path; /* 0x01E4 */ u8 reverse; /* 0x01E6 */ s16 waypoint; diff --git a/src/overlays/actors/ovl_En_Ds/z_en_ds.c b/src/overlays/actors/ovl_En_Ds/z_en_ds.c index fb3a53364..a5e842611 100644 --- a/src/overlays/actors/ovl_En_Ds/z_en_ds.c +++ b/src/overlays/actors/ovl_En_Ds/z_en_ds.c @@ -55,7 +55,7 @@ void EnDs_Init(EnDs* this, GlobalContext* globalCtx) { SkelAnime_InitSV(globalCtx, skelAnime, &D_06004768, &D_0600039C, &this->limbDrawTable, &this->unk_1B4, 6); SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_0600039C); - this->actor.sub_98.mass = 0xFF; + this->actor.colChkInfo.mass = 0xFF; Actor_SetScale(this, 0.013f); diff --git a/src/overlays/actors/ovl_En_It/z_en_it.c b/src/overlays/actors/ovl_En_It/z_en_it.c index f96c66296..29b9e3f2d 100644 --- a/src/overlays/actors/ovl_En_It/z_en_it.c +++ b/src/overlays/actors/ovl_En_It/z_en_it.c @@ -13,12 +13,13 @@ void EnIt_Destroy(EnIt* this, GlobalContext* globalCtx); void EnIt_Update(EnIt* this, GlobalContext* globalCtx); static ColliderCylinderInit cylinderInitData = { - 0x0A, 0x00, 0x00, 0x05, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00, 0x00, - 0x00, 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000, 0x0001, 0x0000, 0x0028, 0x000A, 0x0000, + { COLTYPE_UNK10, 0x00, 0x00, 0x05, 0x10, COLSHAPE_CYLINDER }, + { 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 }, + { 40, 10, 0, { 0 } }, }; -static u8 damageTblInitData[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, +static CollisionCheckInfoInit2 colChkInfoInit = { + 0x00, 0x0000, 0x0000, 0x0000, 0xFF, }; const ActorInit En_It_InitVars = { @@ -37,21 +38,21 @@ void EnIt_Init(EnIt* this, GlobalContext* globalCtx) { EnIt* it = this; it->actor.params = 0x0D05; - ActorCollider_AllocCylinder(globalCtx, &it->cylinderCollider); - ActorCollider_InitCylinder(globalCtx, &it->cylinderCollider, &it->actor, &cylinderInitData); - func_80061EFC(&it->actor.sub_98.damageChart, 0, &damageTblInitData); // Init Damage Chart + Collider_InitCylinder(globalCtx, &it->cylinderCollider); + Collider_SetCylinder(globalCtx, &it->cylinderCollider, &it->actor, &cylinderInitData); + func_80061EFC(&it->actor.colChkInfo, 0, &colChkInfoInit); // Init Damage Chart } void EnIt_Destroy(EnIt* this, GlobalContext* globalCtx) { EnIt* it = this; - ActorCollider_FreeCylinder(globalCtx, &it->cylinderCollider); + Collider_DestroyCylinder(globalCtx, &it->cylinderCollider); } void EnIt_Update(EnIt* this, GlobalContext* globalCtx) { s32 pad; EnIt* it = this; - ActorCollider_Cylinder_Update(&it->actor, &it->cylinderCollider); - Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &it->cylinderCollider); + Collider_CylinderUpdate(&it->actor, &it->cylinderCollider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &it->cylinderCollider); } diff --git a/src/overlays/actors/ovl_En_It/z_en_it.h b/src/overlays/actors/ovl_En_It/z_en_it.h index c9c63ee3c..e859b31cd 100644 --- a/src/overlays/actors/ovl_En_It/z_en_it.h +++ b/src/overlays/actors/ovl_En_It/z_en_it.h @@ -7,7 +7,7 @@ typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ u32 unk_14C; - /* 0x0150 */ ColliderCylinderMain cylinderCollider; + /* 0x0150 */ ColliderCylinder cylinderCollider; } EnIt; // size = 0x019C extern const ActorInit En_It_InitVars; diff --git a/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c b/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c index d4e9422ad..ef3ff832d 100644 --- a/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c +++ b/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c @@ -50,8 +50,8 @@ void EnLightbox_Init(EnLightbox* this, GlobalContext* globalCtx) { } thisx->posRot2.pos = thisx->posRot.pos; - thisx->sub_98.unk_10 = 0x1E; - thisx->sub_98.unk_12 = 0x32; + thisx->colChkInfo.unk_10 = 0x1E; + thisx->colChkInfo.unk_12 = 0x32; ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawFunc_Circle, 6.0f); this->dyna.unk_160 = 0; this->dyna.unk_15C = 0; @@ -102,7 +102,7 @@ void EnLightbox_Update(EnLightbox* this, GlobalContext* globalCtx) { } } Actor_MoveForward(thisx); - func_8002E4B4(globalCtx, thisx, thisx->sub_98.unk_12, thisx->sub_98.unk_10, thisx->sub_98.unk_10, 0x1D); + func_8002E4B4(globalCtx, thisx, thisx->colChkInfo.unk_12, thisx->colChkInfo.unk_10, thisx->colChkInfo.unk_10, 0x1D); thisx->posRot2.pos = thisx->posRot.pos; } diff --git a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c index e5a1ee914..4b9fbc472 100644 --- a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c +++ b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c @@ -25,8 +25,9 @@ const ActorInit En_M_Fire1_InitVars = { }; static ColliderCylinderInit cylinderInitData = { - 0x0A, 0x09, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00000001, 0x00, 0x00, - 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, 0x19, 0x0000, 0x0000, 0x0000, 0x00C8, 0x00C8, 0x0000, + { COLTYPE_UNK10, 0x09, 0x00, 0x00, 0x08, COLSHAPE_CYLINDER }, + { 0x02, { 0x00000001, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x19, 0x00, 0x00 }, + { 200, 200, 0, { 0 } } }; void EnMFire1_Init(EnMFire1* this, GlobalContext* globalCtx) { @@ -39,13 +40,13 @@ void EnMFire1_Init(EnMFire1* this, GlobalContext* globalCtx) { Actor_ChangeType(globalCtx, &globalCtx->actorCtx, &thisLocal->actor, ACTORTYPE_ITEMACTION); } - ActorCollider_AllocCylinder(globalCtx, &thisLocal->capsule); - ActorCollider_InitCylinder(globalCtx, &thisLocal->capsule, &thisLocal->actor, &cylinderInitData); + Collider_InitCylinder(globalCtx, &thisLocal->capsule); + Collider_SetCylinder(globalCtx, &thisLocal->capsule, &thisLocal->actor, &cylinderInitData); } void EnMFire1_Destroy(EnMFire1* this, GlobalContext* globalCtx) { - ColliderCylinderMain* capsule = &this->capsule; - ActorCollider_FreeCylinder(globalCtx, capsule); + ColliderCylinder* capsule = &this->capsule; + Collider_DestroyCylinder(globalCtx, capsule); } void EnMFire1_Update(EnMFire1* this, GlobalContext* globalCtx) { @@ -55,7 +56,7 @@ void EnMFire1_Update(EnMFire1* this, GlobalContext* globalCtx) { if (Math_ApproxF(&thisLocal->unk_0198, 1.0, 0.2)) { Actor_Kill(&this->actor); } else { - ActorCollider_Cylinder_Update(&thisLocal->actor, &thisLocal->capsule); - Actor_CollisionCheck_SetAT(globalCtx, &globalCtx->sub_11E60, &thisLocal->capsule); + Collider_CylinderUpdate(&thisLocal->actor, &thisLocal->capsule); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &thisLocal->capsule); } } diff --git a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.h b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.h index cbba916e6..fd5ebb128 100644 --- a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.h +++ b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.h @@ -6,7 +6,7 @@ typedef struct { /* 0x0000 */ Actor actor; - /* 0x014C */ ColliderCylinderMain capsule; + /* 0x014C */ ColliderCylinder capsule; /* 0x0198 */ f32 unk_0198; } EnMFire1; // size = 0x019C diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index 1e2e5d404..f59ec2a66 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -30,9 +30,10 @@ const ActorInit En_Ms_InitVars = { (ActorFunc)EnMs_Draw, }; -static s32 unk_col_80AB0320[] = { - 0x0A000939, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0xFFCFFFFF, - 0x00000000, 0x00010100, 0x00160025, 0x00000000, 0x00000000, +static ColliderCylinderInit_Set3 colliderInit = { + { COLTYPE_UNK10, 0x00, 0x09, 0x39, COLSHAPE_CYLINDER }, + { 0x00, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x00, 0x01, 0x01 }, + { 22, 37, 0, { 0 } }, }; static s16 prices[] = { @@ -73,12 +74,12 @@ void EnMs_Init(EnMs* this, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, initChain); SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06003DC0, &D_060005EC, &this->unkSkelAnimeStruct, &this->unk_1C6, 9); - ActorCollider_AllocCylinder(globalCtx, &this->collider); - func_8005C450(globalCtx, &this->collider, this, &unk_col_80AB0320); + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder_Set3(globalCtx, &this->collider, this, &colliderInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 35.0f); Actor_SetScale(&this->actor, 0.015f); - this->actor.sub_98.mass = 0xFF; + this->actor.colChkInfo.mass = 0xFF; this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; this->actor.gravity = -1.0f; @@ -89,8 +90,8 @@ void EnMs_Init(EnMs* this, GlobalContext* globalCtx) { } void EnMs_Destroy(EnMs* this, GlobalContext* globalCtx) { - ColliderCylinderMain* collider = &this->collider; - ActorCollider_FreeCylinder(globalCtx, collider); + ColliderCylinder* collider = &this->collider; + Collider_DestroyCylinder(globalCtx, collider); } void EnMs_Wait(EnMs* this, GlobalContext* globalCtx) { @@ -170,8 +171,8 @@ void EnMs_Update(EnMs* this, GlobalContext* globalCtx) { osSyncPrintf("OOOHHHHHH %f\n", this->actor.velocity.y); func_8002E4B4(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); } - ActorCollider_Cylinder_Update(&this->actor, &this->collider); - Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider); + Collider_CylinderUpdate(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider); } void EnMs_Draw(EnMs* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.h b/src/overlays/actors/ovl_En_Ms/z_en_ms.h index 45a06987d..c13657fe1 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.h +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.h @@ -12,7 +12,7 @@ typedef struct { /* 0x01C6 */ s16 unk_1C6; /* 0x01C8 */ char unk_1C8[0x34]; /* 0x01FC */ ActorFunc actionFunc; - /* 0x0200 */ ColliderCylinderMain collider; + /* 0x0200 */ ColliderCylinder collider; /* 0x024C */ s16 activeTimer; } EnMs; // size = 0x0250 diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 739d1f94f..af2f29510 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -28,9 +28,9 @@ const ActorInit En_Nutsball_InitVars = { }; static ColliderCylinderInit cylinderInitData = { - 0x0A, 0x11, 0x09, 0x39, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xFFCFFFFF, 0x00, 0x08, 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, - 0x11, 0x01, 0x01, 0x00, 0x000D, 0x000D, 0x0000, 0x0000, 0x0000, 0x0000, + { COLTYPE_UNK10, 0x11, 0x09, 0x39, 0x20, COLSHAPE_CYLINDER }, + { 0x00, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x11, 0x01, 0x01 }, + { 13, 13, 0, { 0 } }, }; static s16 objectTbl[] = { OBJECT_DEKUNUTS, OBJECT_HINTNUTS, OBJECT_SHOPNUTS, OBJECT_DNS, OBJECT_DNK }; @@ -40,8 +40,8 @@ void EnNutsball_Init(EnNutsball* this, GlobalContext* globalCtx) { s32 pad[2]; ActorShape_Init(&this->actor.shape, 400.0f, ActorShadow_DrawFunc_Circle, 13.0f); - ActorCollider_AllocCylinder(globalCtx, &this->collider); - ActorCollider_InitCylinder(globalCtx, &this->collider, &this->actor, &cylinderInitData); + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &cylinderInitData); this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectTbl[this->actor.params]); if (this->objBankIndex < 0) { @@ -52,8 +52,8 @@ void EnNutsball_Init(EnNutsball* this, GlobalContext* globalCtx) { } void EnNutsball_Destroy(EnNutsball* this, GlobalContext* globalCtx) { - ColliderCylinderMain* collider = &this->collider; - ActorCollider_FreeCylinder(globalCtx, collider); + ColliderCylinder* collider = &this->collider; + Collider_DestroyCylinder(globalCtx, collider); } void func_80ABBB34(EnNutsball* this, GlobalContext* globalCtx) { @@ -80,15 +80,15 @@ void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx) { this->actor.initPosRot.rot.z += 0x2AA8; - if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1) || (this->collider.base.colliderFlags & 2) || - (this->collider.base.collideFlags & 2) || (this->collider.base.maskA & 2)) { + if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1) || (this->collider.base.atFlags & 2) || + (this->collider.base.acFlags & 2) || (this->collider.base.maskA & 2)) { // Checking if the player is using a shield that reflects projectiles // And if so, reflects the projectile on impact if ((player->currentShield == 1) || ((player->currentShield == 2) && LINK_IS_ADULT)) { - if ((this->collider.base.colliderFlags & 2) && (this->collider.base.colliderFlags & 0x10) && - (this->collider.base.colliderFlags & 4)) { - this->collider.base.colliderFlags &= ~0x16; - this->collider.base.colliderFlags |= 0x08; + if ((this->collider.base.atFlags & 2) && (this->collider.base.atFlags & 0x10) && + (this->collider.base.atFlags & 4)) { + this->collider.base.atFlags &= ~0x16; + this->collider.base.atFlags |= 0x08; this->collider.body.toucher.flags = 2; func_800D20CC(&player->mf_A20, &sp4C, 0); @@ -122,13 +122,13 @@ void EnNutsball_Update(EnNutsball* this, GlobalContext* globalCtx) { Actor_MoveForward(&nutsball->actor); func_8002E4B4(globalCtx, &nutsball->actor, 10, cylinderInitData.dim.radius, cylinderInitData.dim.height, 5); - ActorCollider_Cylinder_Update(&nutsball->actor, &nutsball->collider); + Collider_CylinderUpdate(&nutsball->actor, &nutsball->collider); nutsball->actor.flags |= 0x1000000; - Actor_CollisionCheck_SetAT(globalCtx, &globalCtx->sub_11E60, &nutsball->collider); - Actor_CollisionCheck_SetAC(globalCtx, &globalCtx->sub_11E60, &nutsball->collider); - Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &nutsball->collider); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &nutsball->collider); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &nutsball->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &nutsball->collider); } } diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h index 50d12e96a..8d79403b6 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h @@ -9,7 +9,7 @@ typedef struct { /* 0x014C */ ActorFunc actionFunc; /* 0x0150 */ s8 objBankIndex; /* 0x0152 */ s16 timer; - /* 0x0154 */ ColliderCylinderMain collider; + /* 0x0154 */ ColliderCylinder collider; } EnNutsball; // size = 0x01A0 extern const ActorInit En_Nutsball_InitVars; diff --git a/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c b/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c index 8c8bb92df..69aad3387 100644 --- a/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c +++ b/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c @@ -48,8 +48,8 @@ void EnPubox_Init(EnPubox* this, GlobalContext* globalCtx) { break; } this->unk_164 = 1; - thisx->sub_98.unk_10 = 0x14; - thisx->sub_98.unk_12 = 0x32; + thisx->colChkInfo.unk_10 = 0x14; + thisx->colChkInfo.unk_12 = 0x32; thisx->unk_FC = 1200.0f; thisx->unk_F8 = 720.0f; ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawFunc_Circle, 6.0f); @@ -78,7 +78,7 @@ void EnPubox_Update(EnPubox* this, GlobalContext* globalCtx) { this->dyna.unk_154 = 0.0f; this->dyna.unk_150 = 0.0f; Actor_MoveForward(thisx); - func_8002E4B4(globalCtx, thisx, thisx->sub_98.unk_12, thisx->sub_98.unk_10, thisx->sub_98.unk_10, 0x1D); + func_8002E4B4(globalCtx, thisx, thisx->colChkInfo.unk_12, thisx->colChkInfo.unk_10, thisx->colChkInfo.unk_10, 0x1D); thisx->posRot2.pos = thisx->posRot.pos; } diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index ecda80c5a..d11e8480b 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -68,16 +68,16 @@ void func_80AF03F4(EnRu1* this, GlobalContext* globalCtx); void func_80AF0400(EnRu1* this, GlobalContext* globalCtx); void func_80AF05D4(EnRu1* this, GlobalContext* globalCtx); -ColliderCylinderInit D_80AF0800 = { - 0x00, 0x00, 0x00, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x00, 0x0019, 0x0050, 0x0000, 0x0000, 0x0000, 0x0000, +ColliderCylinderInit_Set3 D_80AF0800 = { + { COLTYPE_UNK0, 0x00, 0x00, 0x09, COLSHAPE_CYLINDER }, + { 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 }, + { 25, 80, 0, { 0 } }, }; -ColliderCylinderInit D_80AF082C = { - 0x00, 0x09, 0x00, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00000101, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x01, 0x00, 0x0014, 0x001E, 0x0000, 0x0000, 0x0000, 0x0000, +ColliderCylinderInit_Set3 D_80AF082C = { + { COLTYPE_UNK0, 0x09, 0x00, 0x09, COLSHAPE_CYLINDER }, + { 0x00, { 0x00000101, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x01, 0x00, 0x01 }, + { 20, 30, 0, { 0 } }, }; u32 D_80AF0858[] = { @@ -161,20 +161,20 @@ extern AnimationHeader D_06013A64; void func_80AEAC10(EnRu1* this, GlobalContext* globalCtx) { s32 pad[4]; - ColliderCylinderMain* collider = &this->collider; + ColliderCylinder* collider = &this->collider; - ActorCollider_Cylinder_Update(&this->actor, collider); - Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, collider); + Collider_CylinderUpdate(&this->actor, collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, collider); } void func_80AEAC54(EnRu1* this, GlobalContext* globalCtx) { Actor* thisx = &this->actor; - ColliderCylinderMain* collider2 = &this->collider2; + ColliderCylinder* collider2 = &this->collider2; s32 pad[3]; - ActorCollider_Cylinder_Update(thisx, collider2); + Collider_CylinderUpdate(thisx, collider2); if (this->unk_34C != 0) { - Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, collider2); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, collider2); } else if (thisx->xzDistanceFromLink > 32.0f) { this->unk_34C = 1; } @@ -182,26 +182,26 @@ void func_80AEAC54(EnRu1* this, GlobalContext* globalCtx) { void func_80AEACDC(EnRu1* this, GlobalContext* globalCtx) { s32 pad[4]; - ColliderCylinderMain* collider2 = &this->collider2; + ColliderCylinder* collider2 = &this->collider2; - ActorCollider_Cylinder_Update(&this->actor, collider2); - Actor_CollisionCheck_SetAT(globalCtx, &globalCtx->sub_11E60, collider2); + Collider_CylinderUpdate(&this->actor, collider2); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, collider2); } void func_80AEAD20(EnRu1* this, GlobalContext* globalCtx) { Actor* thisx = &this->actor; - ActorCollider_AllocCylinder(globalCtx, &this->collider); + Collider_InitCylinder(globalCtx, &this->collider); if (!thisx) {} // necessary to match - func_8005C450(globalCtx, &this->collider, thisx, &D_80AF0800); + Collider_SetCylinder_Set3(globalCtx, &this->collider, thisx, &D_80AF0800); - ActorCollider_AllocCylinder(globalCtx, &this->collider2); - func_8005C450(globalCtx, &this->collider2, thisx, &D_80AF082C); + Collider_InitCylinder(globalCtx, &this->collider2); + Collider_SetCylinder_Set3(globalCtx, &this->collider2, thisx, &D_80AF082C); } void func_80AEAD98(EnRu1* this, GlobalContext* globalCtx) { - ActorCollider_FreeCylinder(globalCtx, &this->collider); - ActorCollider_FreeCylinder(globalCtx, &this->collider2); + Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(globalCtx, &this->collider2); } void func_80AEADD8(EnRu1* this) { diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h index 581cdedec..dbabf46a1 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h @@ -41,8 +41,8 @@ typedef struct { /* 0x02AC */ s16 unk_2AC; /* 0x02AE */ char unk_2AE[0x2]; /* 0x02B0 */ s32 unk_2B0; - /* 0x02B4 */ ColliderCylinderMain collider; - /* 0x0300 */ ColliderCylinderMain collider2; + /* 0x02B4 */ ColliderCylinder collider; + /* 0x0300 */ ColliderCylinder collider2; /* 0x034C */ s32 unk_34C; /* 0x0350 */ s32 unk_350; /* 0x0354 */ f32 unk_354; diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index 002dcca43..f4317d83e 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -42,10 +42,10 @@ void func_80AF321C(EnRu2* this, GlobalContext* globalCtx); void func_80AF2AB4(EnRu2* this, GlobalContext* globalCtx); -static ColliderCylinderInit D_80AF40E0 = { - 0x0A, 0x00, 0x09, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, 0x00000080, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x001E, 0x0064, 0x0000, 0x0000, 0x0000, 0x0000, +static ColliderCylinderInit_Set3 colliderInit = { + { COLTYPE_UNK10, 0x00, 0x09, 0x00, COLSHAPE_CYLINDER }, + { 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000080, 0x00, 0x00 }, 0x00, 0x01, 0x00 }, + { 30, 100, 0, { 0 } }, }; static u32 D_80AF410C[] = { @@ -95,23 +95,23 @@ extern AnimationHeader D_0600F8B8; void func_80AF2550(EnRu2* this, GlobalContext* globalCtx) { EnRu2* thisLocal = this; - ActorCollider_AllocCylinder(globalCtx, &thisLocal->collider); - func_8005C450(globalCtx, &thisLocal->collider, &this->actor, &D_80AF40E0); + Collider_InitCylinder(globalCtx, &thisLocal->collider); + Collider_SetCylinder_Set3(globalCtx, &thisLocal->collider, &this->actor, &colliderInit); } void func_80AF259C(EnRu2* this, GlobalContext* globalCtx) { s32 pad; - ColliderCylinderMain* collider = &this->collider; + ColliderCylinder* collider = &this->collider; Actor* thisx = &this->actor; s32 pad2[2]; - ActorCollider_Cylinder_Update(thisx, collider); - Actor_CollisionCheck_SetAC(globalCtx, &globalCtx->sub_11E60, collider); + Collider_CylinderUpdate(thisx, collider); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, collider); } void EnRu2_Destroy(EnRu2* this, GlobalContext* globalCtx) { - ColliderCylinderMain* collider = &this->collider; - ActorCollider_FreeCylinder(globalCtx, collider); + ColliderCylinder* collider = &this->collider; + Collider_DestroyCylinder(globalCtx, collider); } void func_80AF2608(EnRu2* this) { diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h index 01e67ae10..79e8d7f61 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h @@ -21,7 +21,7 @@ typedef struct { /* 0x02C2 */ u8 unk_2C2; /* 0x02C3 */ u8 unk_2C3; /* 0x02C4 */ f32 unk_2C4; - /* 0x02C8 */ ColliderCylinderMain collider; + /* 0x02C8 */ ColliderCylinder collider; } EnRu2; // size = 0x0314 extern const ActorInit En_Ru2_InitVars; diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 0ea3c3220..ed9002b6f 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -169,12 +169,12 @@ s32 EnTkEff_CreateDflt(EnTk* this, Vec3f* pos, u8 duration, f32 size, f32 growth /** z_en_tk_eff.c ends here probably **/ static ColliderCylinderInit D_80B1D508 = { - 0x0A, 0x00, 0x00, 0x39, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x00, 0x001E, 0x0034, 0x0000, 0x0000, 0x0000, 0x0000, + { 0x0A, 0x00, 0x00, 0x39, 0x20, 0x01 }, + { 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 }, + { 0x001E, 0x0034, 0x0000, { 0 } }, }; -static Sub98Init5 D_80B1D534 = { +static CollisionCheckInfoInit2 colChkInfoInit = { 0x00, 0x0000, 0x0000, 0x0000, 0xFF, }; @@ -502,10 +502,10 @@ void EnTk_Init(EnTk* this, GlobalContext* globalCtx) { SkelAnime_ChangeAnim(&thisAgain->skelAnim, anim, 1.f, 0.f, SkelAnime_GetFrameCount(&D_06002F84.genericHeader), 0, 0.f); - ActorCollider_AllocCylinder(globalCtx, &thisAgain->collider); - ActorCollider_InitCylinder(globalCtx, &thisAgain->collider, &thisAgain->actor, &D_80B1D508); + Collider_InitCylinder(globalCtx, &thisAgain->collider); + Collider_SetCylinder(globalCtx, &thisAgain->collider, &thisAgain->actor, &D_80B1D508); - func_80061EFC(&thisAgain->actor.sub_98, NULL, &D_80B1D534); + func_80061EFC(&thisAgain->actor.colChkInfo, NULL, &colChkInfoInit); if (gSaveContext.dayTime <= 0xC000 || gSaveContext.dayTime >= 0xE000 || !LINK_IS_CHILD || globalCtx->sceneNum != SCENE_SPOT02) { @@ -524,7 +524,7 @@ void EnTk_Init(EnTk* this, GlobalContext* globalCtx) { void EnTk_Destroy(EnTk* this, GlobalContext* globalCtx) { EnTk* thisAgain = this; - ActorCollider_FreeCylinder(globalCtx, &thisAgain->collider); + Collider_DestroyCylinder(globalCtx, &thisAgain->collider); } void EnTk_Rest(EnTk* this, GlobalContext* globalCtx) { @@ -672,10 +672,10 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) { void EnTk_Update(EnTk* this, GlobalContext* globalCtx) { EnTk* thisAgain = this; - ColliderCylinderMain* collider = &thisAgain->collider; + ColliderCylinder* collider = &thisAgain->collider; - ActorCollider_Cylinder_Update(&thisAgain->actor, collider); - Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, collider); + Collider_CylinderUpdate(&thisAgain->actor, collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, collider); SkelAnime_FrameUpdateMatrix(&thisAgain->skelAnim); diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.h b/src/overlays/actors/ovl_En_Tk/z_en_tk.h index 5d3f67fe8..df0947b96 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.h +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.h @@ -25,7 +25,7 @@ struct EnTk { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnim; /* 0x0190 */ EnTkFunc* actionFunc; - /* 0x0194 */ ColliderCylinderMain collider; + /* 0x0194 */ ColliderCylinder collider; /* 0x01E0 */ s16 h_1E0; /* 0x01E2 */ char unk_1E2[0x26]; /* 0x0208 */ u8 validDigHere; diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index c254dbf45..9bdd6bdd3 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -19,9 +19,9 @@ void EnTuboTrap_Fly(EnTuboTrap* this, GlobalContext* globalCtx); #define FLAGS 0x00000010 static ColliderCylinderInit cylinderInitData = { - 0x0A, 0x11, 0x09, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xFFCFFFFF, 0x00, 0x04, 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x01, 0x00, 0x00, 0x0009, 0x0017, 0x0000, 0x0000, 0x0000, 0x0000, + { COLTYPE_UNK10, 0x11, 0x09, 0x00, 0x20, COLSHAPE_CYLINDER }, + { 0x00, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x01, 0x01, 0x00 }, + { 9, 23, 0, { 0 } }, }; const ActorInit En_Tubo_Trap_InitVars = { @@ -44,15 +44,15 @@ void EnTuboTrap_Init(EnTuboTrap* this, GlobalContext* globalCtx) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 2.0f); osSyncPrintf("\n\n"); osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 壷トラップ ☆☆☆☆☆ %x\n" VT_RST, this->actor.params); // "Urn Trap" - ActorCollider_AllocCylinder(globalCtx, &this->collider); - ActorCollider_InitCylinder(globalCtx, &this->collider, &this->actor, &cylinderInitData); + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &cylinderInitData); Actor_SetScale(&this->actor, 0.1f); this->actionFunc = (ActorFunc)EnTuboTrap_WaitForProximity; } void EnTuboTrap_Destroy(EnTuboTrap* this, GlobalContext* globalCtx) { - ColliderCylinderMain* collider = &this->collider; - ActorCollider_FreeCylinder(globalCtx, collider); + ColliderCylinder* collider = &this->collider; + Collider_DestroyCylinder(globalCtx, collider); } void EnTuboTrap_DropCollectible(EnTuboTrap* this, GlobalContext* globalCtx) { @@ -179,8 +179,8 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { return; } - if (this->collider.base.colliderFlags & 4) { - this->collider.base.colliderFlags &= ~4; + if (this->collider.base.atFlags & 4) { + this->collider.base.atFlags &= ~4; EnTuboTrap_SpawnFragments(this, globalCtx); Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_IT_SHIELD_REFLECT_SW); Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_POT_BROKEN); @@ -189,8 +189,8 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { return; } - if (this->collider.base.collideFlags & 2) { - this->collider.base.collideFlags &= ~2; + if (this->collider.base.acFlags & 2) { + this->collider.base.acFlags &= ~2; EnTuboTrap_SpawnFragments(this, globalCtx); Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_EXPLOSION); Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_POT_BROKEN); @@ -199,8 +199,8 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { return; } - if (this->collider.base.colliderFlags & 2) { - this->collider.base.colliderFlags &= ~2; + if (this->collider.base.atFlags & 2) { + this->collider.base.atFlags &= ~2; if (this->collider.base.at == &player->actor) { EnTuboTrap_SpawnFragments(this, globalCtx); Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_POT_BROKEN); @@ -277,15 +277,15 @@ void EnTuboTrap_Fly(EnTuboTrap* this, GlobalContext* globalCtx) { void EnTuboTrap_Update(EnTuboTrap* this, GlobalContext* globalCtx) { EnTuboTrap* tuboTrap = this; - SubGlobalContext11E60* sub_11E60 = &globalCtx->sub_11E60; + CollisionCheckContext* check = &globalCtx->colChkCtx; tuboTrap->actionFunc(tuboTrap, globalCtx); Actor_MoveForward(&tuboTrap->actor); func_8002E4B4(globalCtx, &tuboTrap->actor, 10.0f, 10.0f, 20.0f, 0x1D); Actor_SetHeight(&tuboTrap->actor, 0.0f); - ActorCollider_Cylinder_Update(&tuboTrap->actor, &tuboTrap->collider); - Actor_CollisionCheck_SetAC(globalCtx, sub_11E60, &tuboTrap->collider); - Actor_CollisionCheck_SetAT(globalCtx, sub_11E60, &tuboTrap->collider); + Collider_CylinderUpdate(&tuboTrap->actor, &tuboTrap->collider); + CollisionCheck_SetAC(globalCtx, check, &tuboTrap->collider); + CollisionCheck_SetAT(globalCtx, check, &tuboTrap->collider); } void EnTuboTrap_Draw(EnTuboTrap* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h index c734b043c..fc043acaa 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h @@ -9,7 +9,7 @@ typedef struct { /* 0x014C */ ActorFunc actionFunc; /* 0x0150 */ f32 targetY; /* 0x0154 */ Vec3f originPos; - /* 0x0160 */ ColliderCylinderMain collider; + /* 0x0160 */ ColliderCylinder collider; } EnTuboTrap; // size = 0x01AC extern const ActorInit En_Tubo_Trap_InitVars; diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 700123ee5..8cd22678f 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -50,24 +50,22 @@ const ActorInit En_Wallmas_InitVars = { }; static ColliderCylinderInit colCylinderInit = { - 0x00, 0x00, 0x09, 0x39, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x01, 0x00, 0x001E, 0x0028, 0x0000, 0x0000, 0x0000, 0x0000, + { COLTYPE_UNK0, 0x00, 0x09, 0x39, 0x10, COLSHAPE_CYLINDER }, + { 0x00, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x00, 0x01, 0x01 }, + { 30, 40, 0, { 0 } }, }; -static Sub98Init4 sub98Init = { +static CollisionCheckInfoInit colChkInfoInit = { 0x04, 0x001E, 0x0028, 0x96, }; -static ActorDamageChart damageChart = { { - { 0x1, 0x0 }, { 0x0, 0x2 }, { 0x0, 0x1 }, { 0x0, 0x2 }, { 0x1, 0x0 }, { 0x0, 0x2 }, { 0x0, 0x2 }, { 0x1, 0x0 }, - { 0x0, 0x1 }, { 0x0, 0x2 }, { 0x0, 0x4 }, { 0x2, 0x4 }, { 0x0, 0x2 }, { 0x4, 0x4 }, { 0x0, 0x4 }, { 0x0, 0x2 }, - { 0x0, 0x2 }, { 0x2, 0x4 }, { 0x0, 0x0 }, { 0x4, 0x4 }, { 0x0, 0x0 }, { 0x0, 0x0 }, { 0x0, 0x1 }, { 0x0, 0x4 }, - { 0x0, 0x2 }, { 0x0, 0x2 }, { 0x0, 0x8 }, { 0x0, 0x4 }, { 0x0, 0x0 }, { 0x0, 0x0 }, { 0x0, 0x4 }, { 0x0, 0x0 }, -} }; +static DamageTable damageTable = { + 0x10, 0x02, 0x01, 0x02, 0x10, 0x02, 0x02, 0x10, 0x01, 0x02, 0x04, 0x24, 0x02, 0x44, 0x04, 0x02, + 0x02, 0x24, 0x00, 0x44, 0x00, 0x00, 0x01, 0x04, 0x02, 0x02, 0x08, 0x04, 0x00, 0x00, 0x04, 0x00, +}; static InitChainEntry initChain[] = { ICHAIN_S8(naviEnemyId, 0x30, 1), @@ -97,9 +95,9 @@ void EnWallmas_Init(EnWallmas* this, GlobalContext* globalCtx) { SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06008FB0, &D_06009DB0, &this->unkSkelAnimeStruct, &this->unk_22e, 0x19); - ActorCollider_AllocCylinder(globalCtx, &this->colCylinder); - ActorCollider_InitCylinder(globalCtx, &this->colCylinder, &this->actor, &colCylinderInit); - func_80061ED4(&this->actor.sub_98, &damageChart, &sub98Init); + Collider_InitCylinder(globalCtx, &this->colCylinder); + Collider_SetCylinder(globalCtx, &this->colCylinder, &this->actor, &colCylinderInit); + func_80061ED4(&this->actor.colChkInfo, &damageTable, &colChkInfoInit); this2->switchFlag = (u8)(this2->actor.params >> 0x8); this->actor.params = this->actor.params & 0xFF; @@ -118,8 +116,8 @@ void EnWallmas_Init(EnWallmas* this, GlobalContext* globalCtx) { } void EnWallmas_Destroy(EnWallmas* this, GlobalContext* globalCtx) { - ColliderCylinderMain* col = &this->colCylinder; - ActorCollider_FreeCylinder(globalCtx, col); + ColliderCylinder* col = &this->colCylinder; + Collider_DestroyCylinder(globalCtx, col); } void EnWallmas_TimerInit(EnWallmas* this, GlobalContext* globalCtx) { @@ -194,7 +192,7 @@ void EnWallmas_ReturnToCeilingStart(EnWallmas* this) { void EnWallmas_TakeDamageStart(EnWallmas* this) { SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06000590, -3.0f); - if ((this->colCylinder.body.colliding->toucher.flags & 0x1F824) != 0) { + if ((this->colCylinder.body.acHitItem->toucher.flags & 0x1F824) != 0) { this->actor.posRot.rot.y = this->colCylinder.base.ac->posRot.rot.y; } else { this->actor.posRot.rot.y = func_8002DA78(&this->actor, this->colCylinder.base.ac) + 0x8000; @@ -252,7 +250,7 @@ void EnWallmas_StunBegin(EnWallmas* this) { SkelAnime_ChangeAnim(&this->skelAnime, &D_060019CC, 1.5f, 0, 20.0f, 2, -3.0f); this->actor.speedXZ = 0.0f; - if (this->actor.sub_98.damageEffect == 4) { + if (this->actor.colChkInfo.damageEffect == 4) { func_8003426C(&this->actor, -0x8000, 0xFF, 0, 0x50); } else { func_8003426C(&this->actor, 0, 0xFF, 0, 0x50); @@ -365,7 +363,7 @@ void EnWallmas_ReturnToCeiling(EnWallmas* this, GlobalContext* globalCtx) { void EnWallmas_TakeDamage(EnWallmas* this, GlobalContext* globalCtx) { if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) { - if (this->actor.sub_98.health == 0) { + if (this->actor.colChkInfo.health == 0) { EnWallMas_DieBegin(this, globalCtx); } else { EnWallmas_DamageCoolDownStart(this); @@ -469,7 +467,7 @@ void EnWallmas_Stun(EnWallmas* this, GlobalContext* globalCtx) { } if (this->timer == 0) { - if (this->actor.sub_98.health == 0) { + if (this->actor.colChkInfo.health == 0) { EnWallMas_DieBegin(this, globalCtx); } else { EnWallmas_ReturnToCeilingStart(this); @@ -478,27 +476,27 @@ void EnWallmas_Stun(EnWallmas* this, GlobalContext* globalCtx) { } void EnWallmas_ColUpdate(EnWallmas* this, GlobalContext* globalCtx) { - if ((this->colCylinder.base.collideFlags & 2) != 0) { - this->colCylinder.base.collideFlags &= ~2; + if ((this->colCylinder.base.acFlags & 2) != 0) { + this->colCylinder.base.acFlags &= ~2; func_80035650(&this->actor, &this->colCylinder.body, 1); - if ((this->actor.sub_98.damageEffect != 0) || (this->actor.sub_98.damage != 0)) { + if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) { if (Actor_ApplyDamage(&this->actor) == 0) { func_80032C7C(globalCtx, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_DEAD); this->actor.flags &= ~1; } else { - if (this->actor.sub_98.damage != 0) { + if (this->actor.colChkInfo.damage != 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_DAMAGE); } } - if ((this->actor.sub_98.damageEffect == DAMAGE_EFFECT_STUN_WHITE) || - (this->actor.sub_98.damageEffect == DAMAGE_EFFECT_STUN_BLUE)) { + if ((this->actor.colChkInfo.damageEffect == DAMAGE_EFFECT_STUN_WHITE) || + (this->actor.colChkInfo.damageEffect == DAMAGE_EFFECT_STUN_BLUE)) { if (this->actionFunc != (ActorFunc)&EnWallmas_Stun) { EnWallmas_StunBegin(this); } } else { - if (this->actor.sub_98.damageEffect == DAMAGE_EFFECT_BURN) { + if (this->actor.colChkInfo.damageEffect == DAMAGE_EFFECT_BURN) { func_8002A65C(globalCtx, &this->actor, &this->actor.posRot.pos, 0x28, 0x28); } @@ -536,12 +534,12 @@ void EnWallmas_Update(EnWallmas* this, GlobalContext* globalCtx) { } if ((this2->actionFunc != (ActorFunc)&EnWallmas_Die) && (this2->actionFunc != (ActorFunc)&EnWallmas_Drop)) { - ActorCollider_Cylinder_Update(&this2->actor, &this2->colCylinder); - Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this2->colCylinder); + Collider_CylinderUpdate(&this2->actor, &this2->colCylinder); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this2->colCylinder); if ((this2->actionFunc != (ActorFunc)&EnWallmas_TakeDamage) && (this2->actor.bgCheckFlags & 1) != 0 && (this2->actor.freeze == 0)) { - Actor_CollisionCheck_SetAC(globalCtx, &globalCtx->sub_11E60, &this2->colCylinder); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this2->colCylinder); } } diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h index 1855cdd33..7e8162ccb 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h @@ -21,7 +21,7 @@ typedef struct { /* 0x022E */ u16 unk_22e; /* 0x0230 */ char unk_230[0x94]; /* 0x02C4 */ f32 unk_2c4; - /* 0x02C8 */ ColliderCylinderMain colCylinder; + /* 0x02C8 */ ColliderCylinder colCylinder; } EnWallmas; // size = 0x0314 extern const ActorInit En_Wallmas_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c index 3ab37b6d7..5e892c388 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c @@ -29,14 +29,16 @@ const ActorInit Obj_Bombiwa_InitVars = { }; static ColliderCylinderInit colliderInit = { - 0x0C, 0x00, 0x0D, 0x39, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, 0x4FC1FFFE, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x01, 0x00, 0x0037, 0x0046, 0x0000, 0x0000, 0x0000, 0x0000, + { COLTYPE_UNK12, 0x00, 0x0D, 0x39, 0x20, COLSHAPE_CYLINDER }, + { 0x00, { 0x00000000, 0x00, 0x00 }, { 0x4FC1FFFE, 0x00, 0x00 }, 0x00, 0x01, 0x01 }, + { 55, 70, 0, { 0 } }, }; -static u32 damageChart[] = { - 0x0000000C, - 0x003CFF00, +static CollisionCheckInfoInit colChkInfoInit = { + 0x00, + 0x000C, + 0x003C, + 0xFF, }; static InitChainEntry initChain[] = { @@ -54,9 +56,9 @@ extern Gfx* D_060009E0; // dlist void ObjBombiwa_InitCollision(ObjBombiwa* this, GlobalContext* globalCtx) { ObjBombiwa* thisLocal = this; - ActorCollider_AllocCylinder(globalCtx, &thisLocal->collider); - ActorCollider_InitCylinder(globalCtx, &thisLocal->collider, &thisLocal->actor, &colliderInit); - ActorCollider_Cylinder_Update(&thisLocal->actor, &thisLocal->collider); + Collider_InitCylinder(globalCtx, &thisLocal->collider); + Collider_SetCylinder(globalCtx, &thisLocal->collider, &thisLocal->actor, &colliderInit); + Collider_CylinderUpdate(&thisLocal->actor, &thisLocal->collider); } void ObjBombiwa_Init(ObjBombiwa* this, GlobalContext* globalCtx) { @@ -65,7 +67,7 @@ void ObjBombiwa_Init(ObjBombiwa* this, GlobalContext* globalCtx) { if ((Flags_GetSwitch(globalCtx, this->actor.params & 0x3F) != 0)) { Actor_Kill(&this->actor); } else { - func_80061ED4(&this->actor.sub_98.damageChart, NULL, damageChart); + func_80061ED4(&this->actor.colChkInfo, NULL, &colChkInfoInit); if (this->actor.shape.rot.y == 0) { s16 rand = (s16)Math_Rand_ZeroFloat(65536.0f); this->actor.posRot.rot.y = rand; @@ -77,7 +79,7 @@ void ObjBombiwa_Init(ObjBombiwa* this, GlobalContext* globalCtx) { } void ObjBombiwa_Destroy(ObjBombiwa* this, GlobalContext* globalCtx) { - ActorCollider_FreeCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(globalCtx, &this->collider); } void ObjBombiwa_Break(ObjBombiwa* this, GlobalContext* globalCtx) { @@ -105,12 +107,11 @@ void ObjBombiwa_Break(ObjBombiwa* this, GlobalContext* globalCtx) { } void ObjBombiwa_Update(ObjBombiwa* this, GlobalContext* globalCtx) { - SubGlobalContext11E60* sub_11E60; - ColliderCylinderMain* collider; + CollisionCheckContext* colChkCtx; + ColliderCylinder* collider; if (func_80033684(globalCtx, &this->actor) != NULL || - ((this->collider.base.collideFlags & 2) != 0 && - (this->collider.body.colliding->toucher.flags & 0x40000040) != 0)) { + ((this->collider.base.acFlags & 2) != 0 && (this->collider.body.acHitItem->toucher.flags & 0x40000040) != 0)) { ObjBombiwa_Break(this, globalCtx); Flags_SetSwitch(globalCtx, this->actor.params & 0x3F); Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 80, NA_SE_EV_WALL_BROKEN); @@ -119,12 +120,12 @@ void ObjBombiwa_Update(ObjBombiwa* this, GlobalContext* globalCtx) { } Actor_Kill(&this->actor); } else { - this->collider.base.collideFlags &= ~0x2; + this->collider.base.acFlags &= ~0x2; if (this->actor.xzDistanceFromLink < 800.0f) { - sub_11E60 = &globalCtx->sub_11E60; + colChkCtx = &globalCtx->colChkCtx; collider = &this->collider; - Actor_CollisionCheck_SetAC(globalCtx, sub_11E60, collider); - Actor_CollisionCheck_SetOT(globalCtx, sub_11E60, collider); + CollisionCheck_SetAC(globalCtx, colChkCtx, collider); + CollisionCheck_SetOC(globalCtx, colChkCtx, collider); } } } diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h index 9f1c2797b..24a1a3489 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h @@ -6,7 +6,7 @@ typedef struct { /* 0x0000 */ Actor actor; - /* 0x014C */ ColliderCylinderMain collider; + /* 0x014C */ ColliderCylinder collider; } ObjBombiwa; // size = 0x0198 extern const ActorInit Obj_Bombiwa_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index b8ceea03d..f8f52cec9 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -30,15 +30,17 @@ const ActorInit Obj_Comb_InitVars = { (ActorFunc)ObjComb_Draw, }; -UNK_TYPE D_80B922E0[] = { - 0x00000000, 0x00000000, 0x00000000, 0x4001FFFE, 0x00000000, 0x00010100, 0x00000000, 0x00000000, 0x000F0064, +ColliderJntSphItemInit colliderItemsInit[1] = { + { + { 0x00, { 0x00000000, 0x00, 0x00 }, { 0x4001FFFE, 0x00, 0x00 }, 0x00, 0x01, 0x01 }, + { 0x00, { { 0, 0, 0 }, 15 }, 100 }, + }, }; -UNK_TYPE D_80B92304[] = { - 0x0A000909, - 0x20000000, - 0x00000001, - &D_80B922E0, +ColliderJntSphInit colliderInit = { + { COLTYPE_UNK10, 0x00, 0x09, 0x09, 0x20, COLSHAPE_JNTSPH }, + 1, + &colliderItemsInit, }; static InitChainEntry initChain[] = { @@ -132,13 +134,13 @@ void ObjComb_Init(ObjComb* this, GlobalContext* globalCtx) { s32 pad; Actor_ProcessInitChain(&this->actor, &initChain); - func_8005BBF8(globalCtx, &this->collider); - func_8005C050(globalCtx, &this->collider, this, &D_80B92304, &this->colliderBody); + Collider_InitJntSph(globalCtx, &this->collider); + Collider_SetJntSph(globalCtx, &this->collider, this, &colliderInit, &this->colliderItems); ObjComb_SetWait(this); } void ObjComb_Destroy(ObjComb* this, GlobalContext* globalCtx) { - func_8005BCC8(globalCtx, &this->collider); + Collider_DestroyJntSph(globalCtx, &this->collider); } void ObjComb_SetWait(ObjComb* this) { @@ -153,9 +155,9 @@ void ObjComb_Wait(ObjComb* this, GlobalContext* globalCtx) { this->unk_1B0 = 0; } - if ((this->collider.collideFlags & 0x2) != 0) { - this->collider.collideFlags &= ~0x2; - toucherFlags = this->colliderBodyPtr->colliding->toucher.flags; + if ((this->collider.base.acFlags & 0x2) != 0) { + this->collider.base.acFlags &= ~0x2; + toucherFlags = this->collider.list->body.acHitItem->toucher.flags; if (toucherFlags & 0x4001F866) { this->unk_1B0 = 1500; } else { @@ -164,11 +166,11 @@ void ObjComb_Wait(ObjComb* this, GlobalContext* globalCtx) { Actor_Kill(this); } } else { - Actor_CollisionCheck_SetAC(globalCtx, &globalCtx->sub_11E60, &this->collider); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider); } if (this->actor.update != NULL) { - Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider); } } diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h index fcd17464c..cde5477b5 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h @@ -7,11 +7,8 @@ typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ ActorFunc actionFunc; - /* 0x0150 */ Collider collider; - /* 0x0168 */ char unk_168[0x4]; - /* 0x016C */ ColliderBody* colliderBodyPtr; - /* 0x0170 */ ColliderBody colliderBody; - /* 0x0198 */ char unk_198[0x18]; + /* 0x0150 */ ColliderJntSph collider; + /* 0x0170 */ ColliderJntSphItem colliderItems[1]; /* 0x01B0 */ s16 unk_1B0; /* 0x01B2 */ s16 unk_1B2; } ObjComb; // size = 0x01B4 |
