1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 22:30: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

@ -39,12 +39,26 @@ const ActorInit Obj_Kibako_InitVars = {
};
static ColliderCylinderInit sCylinderInit = {
{ COLTYPE_UNK10, 0x09, 0x09, 0x39, 0x20, COLSHAPE_CYLINDER },
{ 0x00, { 0x00000002, 0x00, 0x01 }, { 0x4FC00748, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
{
COLTYPE_NONE,
AT_ON | AT_TYPE_PLAYER,
AC_ON | AC_TYPE_PLAYER,
OC1_ON | OC1_TYPE_ALL,
OC2_TYPE_2,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK0,
{ 0x00000002, 0x00, 0x01 },
{ 0x4FC00748, 0x00, 0x00 },
TOUCH_ON | TOUCH_SFX_NORMAL,
BUMP_ON,
OCELEM_ON,
},
{ 12, 27, 0, { 0, 0, 0 } },
};
static CollisionCheckInfoInit sCCInfoInit = { 0, 0xC, 0x3C, 0xFE };
static CollisionCheckInfoInit sCCInfoInit = { 0, 12, 60, MASS_HEAVY };
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE),
@ -75,7 +89,7 @@ void ObjKibako_InitCollider(Actor* thisx, GlobalContext* globalCtx) {
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
Collider_CylinderUpdate(&this->actor, &this->collider);
Collider_UpdateCylinder(&this->actor, &this->collider);
}
void ObjKibako_Init(Actor* thisx, GlobalContext* globalCtx) {
@ -86,7 +100,7 @@ void ObjKibako_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.gravity = -1.2f;
this->actor.minVelocityY = -13.0f;
ObjKibako_InitCollider(&this->actor, globalCtx);
func_80061ED4(&this->actor.colChkInfo, NULL, &sCCInfoInit);
CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sCCInfoInit);
ObjKibako_SetupIdle(this);
// wooden box
osSyncPrintf("(dungeon keep 木箱)(arg_data 0x%04x)\n", this->actor.params);
@ -172,10 +186,12 @@ void ObjKibako_WaterBreak(ObjKibako* this, GlobalContext* globalCtx) {
void ObjKibako_SetupIdle(ObjKibako* this) {
this->actionFunc = ObjKibako_Idle;
this->actor.colChkInfo.mass = 0xFE;
this->actor.colChkInfo.mass = MASS_HEAVY;
}
void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) {
s32 pad;
if (Actor_HasParent(&this->actor, globalCtx)) {
ObjKibako_SetupHeld(this);
} else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 19.0f)) {
@ -183,7 +199,7 @@ void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) {
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 20, NA_SE_EV_WOODBOX_BREAK);
ObjKibako_SpawnCollectible(this, globalCtx);
Actor_Kill(&this->actor);
} else if (this->collider.base.acFlags & 2) {
} else if (this->collider.base.acFlags & AC_HIT) {
ObjKibako_AirBreak(this, globalCtx);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 20, NA_SE_EV_WOODBOX_BREAK);
ObjKibako_SpawnCollectible(this, globalCtx);
@ -191,16 +207,14 @@ void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) {
} else {
Actor_MoveForward(&this->actor);
func_8002E4B4(globalCtx, &this->actor, 19.0f, 20.0f, 0.0f, 5);
if (!(this->collider.base.maskA & 8) && (this->actor.xzDistToLink > 28.0f)) {
this->collider.base.maskA |= 8;
if (!(this->collider.base.ocFlags1 & OC1_TYPE_PLAYER) && (this->actor.xzDistToLink > 28.0f)) {
this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER;
}
if (this->actor.xzDistToLink < 600.0f) {
ColliderCylinder* collider = &this->collider;
Collider_CylinderUpdate(&this->actor, collider);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &collider->base);
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
if (this->actor.xzDistToLink < 180.0f) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &collider->base);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
}
if (this->actor.xzDistToLink < 100.0f) {
@ -221,7 +235,7 @@ void ObjKibako_Held(ObjKibako* this, GlobalContext* globalCtx) {
if (fabsf(this->actor.speedXZ) < 0.1f) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_PUT_DOWN_WOODBOX);
ObjKibako_SetupIdle(this);
this->collider.base.maskA &= ~8;
this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER;
} else {
ObjKibako_SetupThrown(this);
ObjKibako_ApplyGravity(this);
@ -239,27 +253,26 @@ void ObjKibako_SetupThrown(ObjKibako* this) {
}
void ObjKibako_Thrown(ObjKibako* this, GlobalContext* globalCtx) {
Actor* thisx = &this->actor;
s32 pad;
s32 pad2;
if ((thisx->bgCheckFlags & 0xB) || (this->collider.base.atFlags & 2)) {
if ((this->actor.bgCheckFlags & 0xB) || (this->collider.base.atFlags & AT_HIT)) {
ObjKibako_AirBreak(this, globalCtx);
Audio_PlaySoundAtPosition(globalCtx, &thisx->posRot.pos, 20, NA_SE_EV_WOODBOX_BREAK);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 20, NA_SE_EV_WOODBOX_BREAK);
ObjKibako_SpawnCollectible(this, globalCtx);
Actor_Kill(thisx);
Actor_Kill(&this->actor);
} else if (this->actor.bgCheckFlags & 0x40) {
ObjKibako_WaterBreak(this, globalCtx);
Audio_PlaySoundAtPosition(globalCtx, &thisx->posRot.pos, 20, NA_SE_EV_WOODBOX_BREAK);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 20, NA_SE_EV_WOODBOX_BREAK);
ObjKibako_SpawnCollectible(this, globalCtx);
Actor_Kill(thisx);
Actor_Kill(&this->actor);
} else {
ColliderCylinder* collider = &this->collider;
ObjKibako_ApplyGravity(this);
func_8002D7EC(thisx);
func_8002E4B4(globalCtx, thisx, 19.0f, 20.0f, 0.0f, 5);
Collider_CylinderUpdate(thisx, collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &collider->base);
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &collider->base);
func_8002D7EC(&this->actor);
func_8002E4B4(globalCtx, &this->actor, 19.0f, 20.0f, 0.0f, 5);
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
}