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

@ -38,15 +38,51 @@ const ActorInit En_Sb_InitVars = {
(ActorFunc)EnSb_Draw,
};
static ColliderCylinderInit_Set3 sCylinderInit = {
{ COLTYPE_UNK10, 0x11, 0x09, 0x39, COLSHAPE_CYLINDER },
static ColliderCylinderInitType1 sCylinderInit = {
{
COLTYPE_NONE,
AT_ON | AT_TYPE_ENEMY,
AC_ON | AC_TYPE_PLAYER,
OC1_ON | OC1_TYPE_ALL,
COLSHAPE_CYLINDER,
},
{ 0x00, { 0xFFCFFFFF, 0x04, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
{ 30, 40, 0, { 0, 0, 0 } },
};
static DamageTable sDamageTable[] = {
0x00, 0x00, 0x00, 0xF2, 0x00, 0xF2, 0xF2, 0x12, 0xD1, 0xD2, 0xD4, 0x24, 0xF2, 0xF2, 0xE4, 0xF2,
0xF2, 0x24, 0x00, 0x00, 0x00, 0x00, 0xD1, 0xD4, 0xD2, 0xD2, 0xD8, 0xD4, 0x00, 0x00, 0x00, 0x00,
/* Deku nut */ DMG_ENTRY(0, 0x0),
/* Deku stick */ DMG_ENTRY(0, 0x0),
/* Slingshot */ DMG_ENTRY(0, 0x0),
/* Explosive */ DMG_ENTRY(2, 0xF),
/* Boomerang */ DMG_ENTRY(0, 0x0),
/* Normal arrow */ DMG_ENTRY(2, 0xF),
/* Hammer swing */ DMG_ENTRY(2, 0xF),
/* Hookshot */ DMG_ENTRY(2, 0x1),
/* Kokiri sword */ DMG_ENTRY(1, 0xD),
/* Master sword */ DMG_ENTRY(2, 0xD),
/* Giant's Knife */ DMG_ENTRY(4, 0xD),
/* Fire arrow */ DMG_ENTRY(4, 0x2),
/* Ice arrow */ DMG_ENTRY(2, 0xF),
/* Light arrow */ DMG_ENTRY(2, 0xF),
/* Unk arrow 1 */ DMG_ENTRY(4, 0xE),
/* Unk arrow 2 */ DMG_ENTRY(2, 0xF),
/* Unk arrow 3 */ DMG_ENTRY(2, 0xF),
/* Fire magic */ DMG_ENTRY(4, 0x2),
/* Ice magic */ DMG_ENTRY(0, 0x0),
/* Light magic */ DMG_ENTRY(0, 0x0),
/* Shield */ DMG_ENTRY(0, 0x0),
/* Mirror Ray */ DMG_ENTRY(0, 0x0),
/* Kokiri spin */ DMG_ENTRY(1, 0xD),
/* Giant spin */ DMG_ENTRY(4, 0xD),
/* Master spin */ DMG_ENTRY(2, 0xD),
/* Kokiri jump */ DMG_ENTRY(2, 0xD),
/* Giant jump */ DMG_ENTRY(8, 0xD),
/* Master jump */ DMG_ENTRY(4, 0xD),
/* Unknown 1 */ DMG_ENTRY(0, 0x0),
/* Unblockable */ DMG_ENTRY(0, 0x0),
/* Hammer jump */ DMG_ENTRY(0, 0x0),
/* Unknown 2 */ DMG_ENTRY(0, 0x0),
};
static InitChainEntry sInitChain[] = {
@ -85,7 +121,7 @@ void EnSb_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.colChkInfo.health = 2;
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06002BF0, &D_06000194, NULL, NULL, 0);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder_Set3(globalCtx, &this->collider, &this->actor, &sCylinderInit);
Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit);
this->isDead = false;
this->actor.colChkInfo.mass = 0;
Actor_SetScale(&this->actor, 0.006f);
@ -340,23 +376,23 @@ s32 EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) {
u8 hitByWindArrow;
// hit box collided, switch to cool down
if ((this->collider.base.atFlags & 2)) {
if ((this->collider.base.atFlags & AT_HIT)) {
EnSb_SetupCooldown(this, 1);
return 1;
}
// hurt box collided, take damage if appropriate
if ((this->collider.base.acFlags & 2)) {
if ((this->collider.base.acFlags & AC_HIT)) {
hitByWindArrow = false;
tookDamage = false;
this->collider.base.acFlags &= ~2;
this->collider.base.acFlags &= ~AC_HIT;
switch (this->actor.colChkInfo.damageEffect) {
case 14: // wind arrow
hitByWindArrow = true;
case 15: // explosions, arrow, hammer, ice arrow, light arrow, spirit arrow, shadow arrow
if (EnSb_IsVulnerable(this)) {
hitY = this->collider.body.bumper.unk_06.y - this->actor.posRot.pos.y;
hitY = this->collider.info.bumper.hitPos.y - this->actor.posRot.pos.y;
yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y;
if ((hitY < 30.0f) && (hitY > 10.0f) && (yawDiff >= -0x1FFF) && (yawDiff < 0x2000)) {
Actor_ApplyDamage(&this->actor);
@ -374,7 +410,7 @@ s32 EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) {
case 1: // hookshot/longshot
case 13: // all sword damage
if (EnSb_IsVulnerable(this)) {
hitY = this->collider.body.bumper.unk_06.y - this->actor.posRot.pos.y;
hitY = this->collider.info.bumper.hitPos.y - this->actor.posRot.pos.y;
yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y;
if ((hitY < 30.0f) && (hitY > 10.0f) && (yawDiff >= -0x1FFF) && (yawDiff < 0x2000)) {
Actor_ApplyDamage(&this->actor);
@ -398,10 +434,10 @@ s32 EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) {
// if player attack didn't do damage, play recoil sound and spawn sparks
if (!tookDamage) {
hitPoint.x = this->collider.body.bumper.unk_06.x;
hitPoint.y = this->collider.body.bumper.unk_06.y;
hitPoint.z = this->collider.body.bumper.unk_06.z;
func_80062DF4(globalCtx, &hitPoint);
hitPoint.x = this->collider.info.bumper.hitPos.x;
hitPoint.y = this->collider.info.bumper.hitPos.y;
hitPoint.z = this->collider.info.bumper.hitPos.z;
CollisionCheck_SpawnShieldParticlesMetal2(globalCtx, &hitPoint);
}
}
@ -433,7 +469,7 @@ void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc(this, globalCtx);
func_8002E4B4(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, 5);
EnSb_UpdateDamage(this, globalCtx);
Collider_CylinderUpdate(&this->actor, &this->collider);
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);