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/code/z_actor.c | |
| 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/code/z_actor.c')
| -rw-r--r-- | src/code/z_actor.c | 89 |
1 files changed, 44 insertions, 45 deletions
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 { |
