1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-07 14:50:15 +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,30 +68,72 @@ const ActorInit En_Ssh_InitVars = {
};
static ColliderCylinderInit sCylinderInit1 = {
{ COLTYPE_UNK6, 0x00, 0x09, 0x00, 0x10, COLSHAPE_CYLINDER },
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x01, 0x01, 0x00 },
{
COLTYPE_HIT6,
AT_NONE,
AC_ON | AC_TYPE_PLAYER,
OC1_NONE,
OC2_TYPE_1,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK0,
{ 0x00000000, 0x00, 0x00 },
{ 0x00000000, 0x00, 0x00 },
TOUCH_ON | TOUCH_SFX_NORMAL,
BUMP_ON,
OCELEM_NONE,
},
{ 32, 50, -24, { 0, 0, 0 } },
};
static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 0, 0, 0, 0xFF };
static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 0, 0, 0, MASS_IMMOVABLE };
static ColliderCylinderInit sCylinderInit2 = {
{ COLTYPE_UNK6, 0x00, 0x00, 0x39, 0x10, COLSHAPE_CYLINDER },
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 },
{
COLTYPE_HIT6,
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,
},
{ 20, 60, -30, { 0, 0, 0 } },
};
static ColliderJntSphItemInit sJntSphElementInit[1] = {
static ColliderJntSphElementInit sJntSphElementsInit[1] = {
{
{ 0x00, { 0xFFCFFFFF, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, 0x01, 0x00, 0x01 },
{
ELEMTYPE_UNK0,
{ 0xFFCFFFFF, 0x00, 0x04 },
{ 0x00000000, 0x00, 0x00 },
TOUCH_ON | TOUCH_SFX_NORMAL,
BUMP_NONE,
OCELEM_ON,
},
{ 1, { { 0, -240, 0 }, 28 }, 100 },
},
};
static ColliderJntSphInit sJntSphInit = {
{ COLTYPE_UNK6, 0x11, 0x00, 0x39, 0x10, COLSHAPE_JNTSPH },
{
COLTYPE_HIT6,
AT_ON | AT_TYPE_ENEMY,
AC_NONE,
OC1_ON | OC1_TYPE_ALL,
OC2_TYPE_1,
COLSHAPE_JNTSPH,
},
1,
sJntSphElementInit,
sJntSphElementsInit,
};
void EnSsh_SetupAction(EnSsh* this, EnSshActionFunc actionFunc) {
@ -183,14 +225,14 @@ void EnSsh_InitColliders(EnSsh* this, GlobalContext* globalCtx) {
Collider_SetCylinder(globalCtx, &this->colCylinder[i], &this->actor, cylinders[i]);
}
this->colCylinder[0].body.bumper.flags = 0x0003F8E9;
this->colCylinder[1].body.bumper.flags = 0xFFC00716;
this->colCylinder[2].base.type = 9;
this->colCylinder[2].body.bumperFlags = 0xD;
this->colCylinder[2].body.flags = 2;
this->colCylinder[2].body.bumper.flags = 0xFFCC0716;
this->colCylinder[0].info.bumper.dmgFlags = 0x0003F8E9;
this->colCylinder[1].info.bumper.dmgFlags = 0xFFC00716;
this->colCylinder[2].base.colType = COLTYPE_METAL;
this->colCylinder[2].info.bumperFlags = BUMP_ON | BUMP_HOOKABLE | BUMP_NO_AT_INFO;
this->colCylinder[2].info.elemType = ELEMTYPE_UNK2;
this->colCylinder[2].info.bumper.dmgFlags = 0xFFCC0716;
func_80061EFC(&this->actor.colChkInfo, DamageTable_Get(2), &sColChkInfoInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(2), &sColChkInfoInit);
Collider_InitJntSph(globalCtx, &this->colSph);
Collider_SetJntSph(globalCtx, &this->colSph, &this->actor, &sJntSphInit, this->colSphElements);
@ -246,9 +288,9 @@ void EnSsh_SetColliderScale(EnSsh* this, f32 scale, f32 radiusMod) {
f32 yShift;
s32 i;
radius = this->colSph.list[0].dim.modelSphere.radius;
radius = this->colSph.elements[0].dim.modelSphere.radius;
radius *= scale;
this->colSph.list[0].dim.modelSphere.radius = radius;
this->colSph.elements[0].dim.modelSphere.radius = radius;
for (i = 0; i < 6; i++) {
yShift = this->colCylinder[i].dim.yShift;
@ -412,17 +454,17 @@ void EnSsh_Sway(EnSsh* this) {
}
void EnSsh_CheckBodyStickHit(EnSsh* this, GlobalContext* globalCtx) {
ColliderBody* body = &this->colCylinder[0].body;
ColliderInfo* info0 = &this->colCylinder[0].info;
Player* player = PLAYER;
if (player->unk_860 != 0) {
body->bumper.flags |= 2;
this->colCylinder[1].body.bumper.flags &= ~2;
this->colCylinder[2].body.bumper.flags &= ~2;
info0->bumper.dmgFlags |= 2;
this->colCylinder[1].info.bumper.dmgFlags &= ~2;
this->colCylinder[2].info.bumper.dmgFlags &= ~2;
} else {
body->bumper.flags &= ~2;
this->colCylinder[1].body.bumper.flags |= 2;
this->colCylinder[2].body.bumper.flags |= 2;
info0->bumper.dmgFlags &= ~2;
this->colCylinder[1].info.bumper.dmgFlags |= 2;
this->colCylinder[2].info.bumper.dmgFlags |= 2;
}
}
@ -434,8 +476,8 @@ s32 EnSsh_CheckHitLink(EnSsh* this, GlobalContext* globalCtx) {
return false;
}
for (i = 0; i < 3; i++) {
if (this->colCylinder[i + 3].base.maskB & 1) {
this->colCylinder[i + 3].base.maskB &= ~1;
if (this->colCylinder[i + 3].base.ocFlags2 & OC2_HIT_PLAYER) {
this->colCylinder[i + 3].base.ocFlags2 &= ~OC2_HIT_PLAYER;
hit = true;
}
}
@ -460,10 +502,10 @@ s32 EnSsh_CheckHitFront(EnSsh* this) {
if (this->colCylinder[2].base.acFlags) {} // Needed for matching
acFlags = this->colCylinder[2].base.acFlags;
if (!!(acFlags & 2) == 0) {
if (!!(acFlags & AC_HIT) == 0) {
return 0;
} else {
this->colCylinder[2].base.acFlags &= ~2;
this->colCylinder[2].base.acFlags &= ~AC_HIT;
this->invincibilityTimer = 8;
if ((this->swayTimer == 0) && (this->hitTimer == 0) && (this->stunTimer == 0)) {
this->swayTimer = 60;
@ -476,13 +518,13 @@ s32 EnSsh_CheckHitBack(EnSsh* this, GlobalContext* globalCtx) {
ColliderCylinder* cyl = &this->colCylinder[0];
s32 hit = false;
if (cyl->base.acFlags & 2) {
cyl->base.acFlags &= ~2;
if (cyl->base.acFlags & AC_HIT) {
cyl->base.acFlags &= ~AC_HIT;
hit = true;
}
cyl = &this->colCylinder[1];
if (cyl->base.acFlags & 2) {
cyl->base.acFlags &= ~2;
if (cyl->base.acFlags & AC_HIT) {
cyl->base.acFlags &= ~AC_HIT;
hit = true;
}
if (!hit) {
@ -523,7 +565,7 @@ s32 EnSsh_CollisionCheck(EnSsh* this, GlobalContext* globalCtx) {
}
void EnSsh_SetBodyCylinderAC(EnSsh* this, GlobalContext* globalCtx) {
Collider_CylinderUpdate(&this->actor, &this->colCylinder[0]);
Collider_UpdateCylinder(&this->actor, &this->colCylinder[0]);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[0].base);
}
@ -531,10 +573,10 @@ void EnSsh_SetLegsCylinderAC(EnSsh* this, GlobalContext* globalCtx) {
s16 angleTowardsLink = ABS((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y));
if (angleTowardsLink < 90 * (0x10000 / 360)) {
Collider_CylinderUpdate(&this->actor, &this->colCylinder[2]);
Collider_UpdateCylinder(&this->actor, &this->colCylinder[2]);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[2].base);
} else {
Collider_CylinderUpdate(&this->actor, &this->colCylinder[1]);
Collider_UpdateCylinder(&this->actor, &this->colCylinder[1]);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colCylinder[1].base);
}
}
@ -845,7 +887,7 @@ s32 EnSsh_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
void EnSsh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
EnSsh* this = THIS;
func_800628A4(limbIndex, &this->colSph);
Collider_UpdateSpheres(limbIndex, &this->colSph);
}
void EnSsh_Draw(Actor* thisx, GlobalContext* globalCtx) {

View file

@ -16,7 +16,7 @@ typedef struct EnSsh {
/* 0x02F8 */ EnSshActionFunc actionFunc;
/* 0x02FC */ ColliderCylinder colCylinder[6];
/* 0x04C4 */ ColliderJntSph colSph;
/* 0x04E4 */ ColliderJntSphItem colSphElements[1];
/* 0x04E4 */ ColliderJntSphElement colSphElements[1];
/* 0x0524 */ s16 initialYaw;
/* 0x0526 */ s16 maxTurnRate;
/* 0x0528 */ s16 unkTimer;