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

@ -102,22 +102,66 @@ const ActorInit En_Tite_InitVars = {
(ActorFunc)EnTite_Draw,
};
static ColliderJntSphItemInit sJntSphItemsInit[1] = {
static ColliderJntSphElementInit sJntSphElementsInit[1] = {
{
{ 0x00, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x01, 0x05, 0x01 },
{
ELEMTYPE_UNK0,
{ 0xFFCFFFFF, 0x00, 0x08 },
{ 0xFFCFFFFF, 0x00, 0x00 },
TOUCH_ON | TOUCH_SFX_NORMAL,
BUMP_ON | BUMP_HOOKABLE,
OCELEM_ON,
},
{ 0, { { 0, 1500, 0 }, 20 }, 100 },
},
};
static ColliderJntSphInit sJntSphInit = {
{ COLTYPE_UNK6, 0x11, 0x09, 0x39, 0x10, COLSHAPE_JNTSPH },
{
COLTYPE_HIT6,
AT_ON | AT_TYPE_ENEMY,
AC_ON | AC_TYPE_PLAYER,
OC1_ON | OC1_TYPE_ALL,
OC2_TYPE_1,
COLSHAPE_JNTSPH,
},
1,
sJntSphItemsInit,
sJntSphElementsInit,
};
static DamageTable sDamageTable[] = {
0x10, 0x02, 0x01, 0x02, 0x10, 0x02, 0x02, 0x10, 0x01, 0x02, 0x04, 0x02, 0xF4, 0x02, 0x02, 0x02,
0x02, 0xE0, 0xF3, 0xE0, 0x00, 0x00, 0x01, 0x04, 0x02, 0x02, 0x08, 0x04, 0x00, 0x00, 0x04, 0x00,
/* Deku nut */ DMG_ENTRY(0, 0x1),
/* Deku stick */ DMG_ENTRY(2, 0x0),
/* Slingshot */ DMG_ENTRY(1, 0x0),
/* Explosive */ DMG_ENTRY(2, 0x0),
/* Boomerang */ DMG_ENTRY(0, 0x1),
/* Normal arrow */ DMG_ENTRY(2, 0x0),
/* Hammer swing */ DMG_ENTRY(2, 0x0),
/* Hookshot */ DMG_ENTRY(0, 0x1),
/* Kokiri sword */ DMG_ENTRY(1, 0x0),
/* Master sword */ DMG_ENTRY(2, 0x0),
/* Giant's Knife */ DMG_ENTRY(4, 0x0),
/* Fire arrow */ DMG_ENTRY(2, 0x0),
/* Ice arrow */ DMG_ENTRY(4, 0xF),
/* Light arrow */ DMG_ENTRY(2, 0x0),
/* Unk arrow 1 */ DMG_ENTRY(2, 0x0),
/* Unk arrow 2 */ DMG_ENTRY(2, 0x0),
/* Unk arrow 3 */ DMG_ENTRY(2, 0x0),
/* Fire magic */ DMG_ENTRY(0, 0xE),
/* Ice magic */ DMG_ENTRY(3, 0xF),
/* Light magic */ DMG_ENTRY(0, 0xE),
/* Shield */ DMG_ENTRY(0, 0x0),
/* Mirror Ray */ DMG_ENTRY(0, 0x0),
/* Kokiri spin */ DMG_ENTRY(1, 0x0),
/* Giant spin */ DMG_ENTRY(4, 0x0),
/* Master spin */ DMG_ENTRY(2, 0x0),
/* Kokiri jump */ DMG_ENTRY(2, 0x0),
/* Giant jump */ DMG_ENTRY(8, 0x0),
/* Master jump */ DMG_ENTRY(4, 0x0),
/* Unknown 1 */ DMG_ENTRY(0, 0x0),
/* Unblockable */ DMG_ENTRY(0, 0x0),
/* Hammer jump */ DMG_ENTRY(4, 0x0),
/* Unknown 2 */ DMG_ENTRY(0, 0x0),
};
static InitChainEntry sInitChain[] = {
@ -160,7 +204,7 @@ void EnTite_Init(Actor* thisx, GlobalContext* globalCtx) {
thisx->posRot2.pos = thisx->posRot.pos;
thisx->posRot2.pos.y += 20.0f;
thisx->colChkInfo.health = 2;
thisx->colChkInfo.mass = 0xFE;
thisx->colChkInfo.mass = MASS_HEAVY;
Collider_InitJntSph(globalCtx, &this->collider);
Collider_SetJntSph(globalCtx, &this->collider, thisx, &sJntSphInit, &this->colliderItem);
this->unk_2DC = 0x1D;
@ -294,7 +338,7 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) {
if (this->vQueuedJumps != 0) {
this->vQueuedJumps--;
this->vAttackState = TEKTITE_BEGIN_LUNGE;
this->collider.base.atFlags &= ~2;
this->collider.base.atFlags &= ~AT_HIT;
} else {
EnTite_SetupTurnTowardPlayer(this);
}
@ -335,16 +379,16 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) {
func_800355B8(globalCtx, &this->backLeftFootPos);
}
}
if (!(this->collider.base.atFlags & 2) && (this->actor.flags & 0x40)) {
if (!(this->collider.base.atFlags & AT_HIT) && (this->actor.flags & 0x40)) {
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
} else {
Player* player = PLAYER;
this->collider.base.atFlags &= ~2;
this->collider.base.atFlags &= ~AT_HIT;
Animation_MorphToLoop(&this->skelAnime, &D_060012E4, 4.0f);
this->actor.speedXZ = -6.0f;
this->actor.posRot.rot.y = this->actor.yawTowardsLink;
if (&player->actor == this->collider.base.at) {
if (!(this->collider.base.atFlags & 4)) {
if (!(this->collider.base.atFlags & AT_BOUNCED)) {
Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT);
}
}
@ -622,7 +666,7 @@ void EnTite_Recoil(EnTite* this, GlobalContext* globalCtx) {
if ((this->actor.speedXZ == 0.0f) && ((this->actor.bgCheckFlags & 1) || ((this->actor.params == TEKTITE_BLUE) &&
(this->actor.bgCheckFlags & 0x20)))) {
this->actor.posRot.rot.y = this->actor.shape.rot.y;
this->collider.base.atFlags &= ~0x2;
this->collider.base.atFlags &= ~AT_HIT;
if ((this->actor.xzDistToLink > 300.0f) && (this->actor.yDistToLink > 80.0f) &&
(ABS(this->actor.shape.rot.x) < 4000) && (ABS(this->actor.shape.rot.z) < 4000) &&
((this->actor.bgCheckFlags & 1) ||
@ -813,11 +857,11 @@ void EnTite_FlipUpright(EnTite* this, GlobalContext* globalCtx) {
void EnTite_CheckDamage(Actor* thisx, GlobalContext* globalCtx) {
EnTite* this = THIS;
if ((this->collider.base.acFlags & 2) && (this->action >= TEKTITE_IDLE)) {
this->collider.base.acFlags &= ~2;
if ((this->collider.base.acFlags & AC_HIT) && (this->action >= TEKTITE_IDLE)) {
this->collider.base.acFlags &= ~AC_HIT;
if (thisx->colChkInfo.damageEffect != 0xE) { // Immune to fire magic
this->damageEffect = thisx->colChkInfo.damageEffect;
func_80035650(thisx, &this->collider.list->body, 0);
func_80035650(thisx, &this->collider.elements[0].info, 0);
// Stun if Tektite hit by nut, boomerang, hookshot, ice arrow or ice magic
if ((thisx->colChkInfo.damageEffect == 1) || (thisx->colChkInfo.damageEffect == 0xF)) {
if (this->action != TEKTITE_STUNNED) {
@ -954,7 +998,7 @@ void EnTite_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_tite.c", 1704);
func_80093D18(globalCtx->state.gfxCtx);
func_800628A4(0, &this->collider);
Collider_UpdateSpheres(0, &this->collider);
if (this->actor.params == TEKTITE_BLUE) {
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(&D_06001300));
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(&D_06001700));

View file

@ -28,7 +28,7 @@ typedef struct EnTite {
/* 0x02E3 */ u8 spawnIceTimer;
/* 0x02E4 */ u8 damageEffect;
/* 0x02E8 */ ColliderJntSph collider;
/* 0x0308 */ ColliderJntSphItem colliderItem;
/* 0x0308 */ ColliderJntSphElement colliderItem;
/* 0x0348 */ Vec3f frontLeftFootPos;
/* 0x0354 */ Vec3f frontRightFootPos;
/* 0x0360 */ Vec3f backRightFootPos;