1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-05 05:40:19 +00:00

Document Collision_Check (#468)

* Darkmeiro decompilation

Bg_Gnd_Darkmeiro decompiled, matched, and documented.

* give this a shot

* fix conflict

* one more try

* could be useful

* whoops

* some decomp

* still playing around with this

* rename functions

* ZAP again

* ZAP again

* the renaming begins

* more renaming. hopefully didn't break anything

* change all the things

* this and then merge

* and done

* one little thing

* small docs, small rename

* changed mind on cylinder and quad elements

* something

* more stuff

* more docs

* more adjustments

* Fixed some types

* more fixes

* all sorts of cleanup

* now with flags

* match!

* names and such

* update tools

* damage tables

* ColChkInfo

* one more thing

* formatting

* more formatting

* anime merge

* some stuff

* damage table

* again

* changes

* .s

* changes

* oc2 type

* a couple things

* format

* un-name magic arrows, not enough proof yet

* fix damage table script and remove old one

* EnAObj

* changes

Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Fig02 <fig02srl@gmail.com>
This commit is contained in:
petrie911 2021-01-17 20:13:36 -06:00 committed by GitHub
parent f786f958bb
commit 02994f5339
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
487 changed files with 14371 additions and 4713 deletions

View file

@ -68,31 +68,73 @@ static AnimationHeader* sAnimations[] = {
};
static ColliderCylinderInit sCylinderInit1 = {
{ COLTYPE_UNK10, 0x00, 0x00, 0x39, 0x10, COLSHAPE_CYLINDER },
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 },
{
COLTYPE_NONE,
AT_NONE,
AC_NONE,
OC1_ON | OC1_TYPE_ALL,
OC2_TYPE_1,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK0,
{ 0x00000000, 0x00, 0x00 },
{ 0x00000000, 0x00, 0x00 },
TOUCH_NONE,
BUMP_NONE,
OCELEM_ON,
},
{ 40, 100, 0, { 0, 0, 0 } },
};
static ColliderCylinderInit sCylinderInit2 = {
{ COLTYPE_UNK10, 0x00, 0x00, 0x39, 0x10, COLSHAPE_CYLINDER },
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 },
{
COLTYPE_NONE,
AT_NONE,
AC_NONE,
OC1_ON | OC1_TYPE_ALL,
OC2_TYPE_1,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK0,
{ 0x00000000, 0x00, 0x00 },
{ 0x00000000, 0x00, 0x00 },
TOUCH_NONE,
BUMP_NONE,
OCELEM_ON,
},
{ 60, 100, 0, { 0, 0, 0 } },
};
static ColliderJntSphItemInit sJntSphItemsInit[] = {
static ColliderJntSphElementInit sJntSphElementsInit[] = {
{
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 },
{
ELEMTYPE_UNK0,
{ 0x00000000, 0x00, 0x00 },
{ 0x00000000, 0x00, 0x00 },
TOUCH_NONE,
BUMP_NONE,
OCELEM_ON,
},
{ 11, { { 0, 0, 0 }, 20 }, 100 },
},
};
static ColliderJntSphInit sJntSphInit = {
{ COLTYPE_UNK10, 0x00, 0x00, 0x39, 0x10, COLSHAPE_JNTSPH },
ARRAY_COUNT(sJntSphItemsInit),
sJntSphItemsInit,
{
COLTYPE_NONE,
AT_NONE,
AC_NONE,
OC1_ON | OC1_TYPE_ALL,
OC2_TYPE_1,
COLSHAPE_JNTSPH,
},
ARRAY_COUNT(sJntSphElementsInit),
sJntSphElementsInit,
};
static CollisionCheckInfoInit sColChkInfoInit = { 10, 35, 100, 0xFE };
static CollisionCheckInfoInit sColChkInfoInit = { 10, 35, 100, MASS_HEAVY };
// Unused
static EnHorseNormalUnkStruct1 D_80A6D428[] = {
@ -165,10 +207,10 @@ void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx) {
Collider_InitCylinder(globalCtx, &this->bodyCollider);
Collider_SetCylinder(globalCtx, &this->bodyCollider, &this->actor, &sCylinderInit1);
Collider_InitJntSph(globalCtx, &this->headCollider);
Collider_SetJntSph(globalCtx, &this->headCollider, &this->actor, &sJntSphInit, this->headColliderItems);
Collider_SetJntSph(globalCtx, &this->headCollider, &this->actor, &sJntSphInit, this->headElements);
Collider_InitCylinder(globalCtx, &this->cloneCollider);
Collider_SetCylinder(globalCtx, &this->cloneCollider, &this->actor, &sCylinderInit2);
func_80061ED4(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
if (globalCtx->sceneNum == SCENE_SPOT20) {
if (this->actor.posRot.rot.z == 0 || gSaveContext.nightFlag) {
Actor_Kill(&this->actor);
@ -363,9 +405,9 @@ void EnHorseNormal_Wander(EnHorseNormal* this, GlobalContext* globalCtx) {
this->actor.speedXZ = 8.0f;
phi_t0 = 6;
}
if (Rand_ZeroOne() < 0.1f ||
(this->unk_21E == 0 && (this->actor.bgCheckFlags & 8 || this->bodyCollider.base.maskA & 2 ||
this->headCollider.base.maskA & 2))) {
if (Rand_ZeroOne() < 0.1f || (this->unk_21E == 0 && ((this->actor.bgCheckFlags & 8) ||
(this->bodyCollider.base.ocFlags1 & OC1_HIT) ||
(this->headCollider.base.ocFlags1 & OC1_HIT)))) {
this->unk_21E += (Rand_ZeroOne() * 30.0f) - 15.0f;
if (this->unk_21E > 50) {
this->unk_21E = 50;
@ -546,12 +588,12 @@ void EnHorseNormal_Update(Actor* thisx, GlobalContext* globalCtx) {
this->actor.posRot2.pos.y += 70.0f;
this->unk_204 = this->actor.projectedPos;
this->unk_204.y += 120.0f;
Collider_CylinderUpdate(&this->actor, &this->bodyCollider);
Collider_UpdateCylinder(&this->actor, &this->bodyCollider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base);
if (this->actor.speedXZ == 0.0f) {
this->actor.colChkInfo.mass = 0xFF;
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
} else {
this->actor.colChkInfo.mass = 0xFE;
this->actor.colChkInfo.mass = MASS_HEAVY;
}
}
@ -562,15 +604,15 @@ void func_80A6CAFC(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin) {
s32 i;
for (i = 0; i < this->headCollider.count; i++) {
sp4C.x = this->headCollider.list[i].dim.modelSphere.center.x;
sp4C.y = this->headCollider.list[i].dim.modelSphere.center.y;
sp4C.z = this->headCollider.list[i].dim.modelSphere.center.z;
func_800A6408(skin, this->headCollider.list[i].dim.joint, &sp4C, &sp40);
this->headCollider.list[i].dim.worldSphere.center.x = sp40.x;
this->headCollider.list[i].dim.worldSphere.center.y = sp40.y;
this->headCollider.list[i].dim.worldSphere.center.z = sp40.z;
this->headCollider.list[i].dim.worldSphere.radius =
this->headCollider.list[i].dim.modelSphere.radius * this->headCollider.list[i].dim.scale;
sp4C.x = this->headCollider.elements[i].dim.modelSphere.center.x;
sp4C.y = this->headCollider.elements[i].dim.modelSphere.center.y;
sp4C.z = this->headCollider.elements[i].dim.modelSphere.center.z;
func_800A6408(skin, this->headCollider.elements[i].dim.limb, &sp4C, &sp40);
this->headCollider.elements[i].dim.worldSphere.center.x = sp40.x;
this->headCollider.elements[i].dim.worldSphere.center.y = sp40.y;
this->headCollider.elements[i].dim.worldSphere.center.z = sp40.z;
this->headCollider.elements[i].dim.worldSphere.radius =
this->headCollider.elements[i].dim.modelSphere.radius * this->headCollider.elements[i].dim.scale;
}
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base);

View file

@ -26,7 +26,7 @@ typedef struct EnHorseNormal {
/* 0x0224 */ char unk_224[0x04];
/* 0x0228 */ ColliderCylinder bodyCollider;
/* 0x0274 */ ColliderJntSph headCollider;
/* 0x0294 */ ColliderJntSphItem headColliderItems[1];
/* 0x0294 */ ColliderJntSphElement headElements[1];
/* 0x02D4 */ ColliderCylinder cloneCollider;
/* 0x0320 */ char unk_320[0x04];
/* 0x0324 */ s32 waypoint;