z_collision_check.c (#73)

* func_8005B280 ok

* func_8005B65C OK

* split out func_8005BD50

* func_8005B7C0 OK

* func_8005B7F4 OK

* func_8005B824 OK

* func_8005B860 ok

* improve sanity

* func_8005B6B0 ok, ColliderInit_Actor structs added

* func_8005B884 ok

* func_8005BBF8 ok, split out func_8005BF50

* split more stuff out of func_8005C050.s

* func_8005C050 OK

* func_8005BA30 fakish OK, func_8005BAD8 real OK

* func_8005BB48 OK, func_8005BA84 almost decomp'd, but type issues

* func_8005BB10 Ok

* func_8005BF50 OK

* func_8005BE50 OK

* func_8005BD50 OK

* func_8005BCC8 Ok

* func_8005BC28

* func_8005BB8C func_8005BBB0 func_8005BBD4 Ok

* save my work commit

* func_8005C2BC fake OK

* func_8005C5B0 ok

* func_8005C608 ok

* func_8005C6C0 ok

* func_8005C6F8 ok

* func_8005C730 ok

* func_8005C774 func_8005C798 func_8005C7BC OK

* func_8005C7E0 ok, func_8005C810 split

* func_8005C810 OK

* func_8005C8C8 ok

* func_8005C964 OK

* func_8005CA88 ok

* func_8005CBAC ok

* func_8005C124 func_8005C1AC func_8005C234 func_8005CC98 OK

* func_8005CD34 func_8005CDD0 Ok

* func_8005CE6C ok

* func_8005CEC4 ok

* func_8005CEDC ok

* func_8005CF90 Ok

* standardize type names/vars more

* func_8005D3BC ok

* func_8005D40C OK, z64.h CollisionCheckContext

* func_8005D4B4 func_8005D4C8 ok

* partial data section migration

* improve function documentation, OT->OC

* Actor_CollisionCheck_SetOC ok

* Actor_CollisionCheck_SetAT Actor_CollisionCheck_SetAC Ok

* func_8005BA84 ok

* func_800611A0 ok

* func_80061274 ok

* clean up func_80061274

* func_8006139C ok

* func_8005E9C0 and dependencies OK

* minor cleanup to func_8005E9C0

* func_8005EC6C OK!

* func_8005E81C ok

* func_8005E604 ok

* func_8005E2EC func_8005E4F8 OK

* func_8005DE9C OK func_8005D8AC disassembled

* func_8006146C func_8006268C ok

* func_8005EEE0 ok

* func_8005F17C

* func_8005F39C ok

* func_8005F5B0 decompiled, not matching

* func_8005F7D0 decomp, func_8005D218 and func_8005D324 OK

* func_8005FA30 ok, split more functions

* func_8005FC04 ok

* func_8005FDCC k

* func_8005FF90 OK OK OK

* func_80060204 dead

* func_800604B0 ok

* func_80060704 func_80060994 ok, func_80060C2C somewhat disassembled. AT to AC matrix doneish

* func_800635D0 ok, func_80062ECC not so much

* OcLine oks

* D_8011DF28 functions disassembled

* D_8011DF5C functions OK

* setAT_SAC. setAC_SAC, setOC_SAC OK

* func_80061C98 decompiled, func_80061BF4, func_80061C18 OK

* func_800617D4 ok, func_800614A4 disassembled

* CollisionCheck_OC D_8011DFAC functions OK

* func_80062530 ok

* CollisionCheck_generalLineOcCheck subfunctions OK

* func_800622E4 ok

* after a long fought battle, func_80061F64 has fallen.

* func_800628A4 disassembled

* func_800627A0 func_8006285C OK

* ActorCollider_Cylinder_Update, func_80062718, func_80062734 ok

* func_80062CD4 decompiled, import EffShield/EffSpark types from MM

* various SubActor98 struct functions OK

* func_8005D4DC func_8005D62C ok

* .data section migrated, more OKs, fix NON_MATCHINGs to use effect structs

* func_80060C2C ok

* minor code tweaks

* func_80061C98 ok somehow

* Attempt to fix some unknowns, move types out of z64actor, add set3 ColliderInit types

* Apply changes

* formatting

* tweak a couple function names

* krim changes, func naming

* missed some things

* function renames

* Implement GenColliderInit.py utility

* Implement pr changes, GenColliderInit.py, DamageTable.py, z_collision_btltbls.c fully matching

* func_800614A4 ok

* Implement Roman's fixes, name Collider unknowns, rename COLTYPE -> COLSHAPE and define new COLTYPE

* collisionCheckCtx -> colChkCtx, fix small things
This commit is contained in:
mzxrules
2020-04-25 22:43:35 -04:00
committed by GitHub
parent f9bdb1d58a
commit aa91a7ee32
873 changed files with 6121 additions and 10660 deletions
+22 -122
View File
@@ -60,14 +60,26 @@ typedef struct {
} ActorOverlay; // size = 0x20
typedef struct {
struct {
char damage : 4;
char effect : 4;
} attack[32];
} ActorDamageChart;
u8 table[32];
} DamageTable;
typedef struct {
/* 0x00 */ ActorDamageChart* damageChart; // For actors which contain a damage chart (example: Stalfos)...
/* 0x00 */ u8 health;
/* 0x02 */ s16 unk_02;
/* 0x04 */ s16 unk_04;
/* 0x06 */ u8 mass;
} CollisionCheckInfoInit;
typedef struct {
/* 0x00 */ u8 health;
/* 0x02 */ s16 unk_02;
/* 0x04 */ s16 unk_04;
/* 0x06 */ s16 unk_06;
/* 0x08 */ u8 mass;
} CollisionCheckInfoInit2;
typedef struct {
/* 0x00 */ DamageTable* damageTable; // For actors which contain one (example: Stalfos)...
/* 0x04 */ Vec3f displacement; // Amount to correct velocity (0x5C) by when colliding into a body
/* 0x10 */ s16 unk_10;
/* 0x12 */ s16 unk_12;
@@ -76,9 +88,9 @@ typedef struct {
/* 0x17 */ u8 health;
/* 0x18 */ u8 damage; // Amount to decrement health by
/* 0x19 */ u8 damageEffect; // Stores what effect should occur when hit by a weapon
/* 0x1A */ u8 impactEffect; // Maybe? set on deku nut when deku nut collides with gossip stone
/* 0x1B */ u8 unk_1B;
} SubActorStruct98; // size = 0x1C
/* 0x1A */ u8 atHitEffect; // Stores what effect should occur when AT connects with an AC
/* 0x1B */ u8 acHitEffect; // Stores what effect should occur when AC is touched by an AT
} CollisionCheckInfo; // size = 0x1C
typedef struct {
/* 0x00 */ Vec3s rot; // Current actor shape rotation
@@ -121,7 +133,7 @@ typedef struct Actor {
/* 0x08C */ f32 waterSurfaceDist;
/* 0x090 */ f32 xzDistanceFromLink;
/* 0x094 */ f32 yDistanceFromLink;
/* 0x098 */ SubActorStruct98 sub_98;
/* 0x098 */ CollisionCheckInfo colChkInfo;
/* 0x0B4 */ ActorShape shape;
/* 0x0CC */ Vec3f unk_CC[2];
/* 0x0E4 */ Vec3f unk_E4; // Stores result of some vector transformation involving actor xyz vector, and a matrix at Global Context + 11D60
@@ -161,118 +173,6 @@ typedef struct Actor {
/* From here on, the structure and size varies for each actor */
} Actor; // size = 0x14C
typedef struct {
/* 0x00 */ u8 health;
/* 0x02 */ s16 unk_02;
/* 0x04 */ s16 unk_04;
/* 0x06 */ u8 mass;
} Sub98Init4;
typedef struct {
/* 0x00 */ u8 health;
/* 0x02 */ s16 unk_10;
/* 0x04 */ s16 unk_12;
/* 0x06 */ u16 unk_14;
/* 0x08 */ u8 mass;
} Sub98Init5;
typedef enum {
COLTYPE_CYLINDER = 1,
COLTYPE_CYLINDER_GROUP = 0,
COLTYPE_QUAD = 3,
COLTYPE_TRIANGLE_GROUP = 2
} ColliderType;
typedef struct {
/* 0x00 */ Actor* actor;
/* 0x04 */ Actor* at;
/* 0x08 */ Actor* ac;
/* 0x0C */ Actor* ot;
/* 0x10 */ u8 colliderFlags; /* Compared to 0x11 */
/* 0x11 */ u8 collideFlags; /* Compared to 0x10 */
/* 0x12 */ u8 maskA; /* Bitwise-and compared to 0x13 */
/* 0x13 */ u8 maskB; /* Bitwise-and compared to 0x12 */
/* 0x14 */ u8 unk_14;
/* 0x15 */ u8 type; /* Cylinder Collection, Cylinder, Triangle Collection, Quad */
} Collider; // size = 0x18
typedef struct {
/* 0x00 */ s32 flags; /* Toucher Attack Identifier Flags */
/* 0x04 */ u8 unk_04;
/* 0x05 */ u8 damage; /* Damage or Stun Timer */
} ColliderTouch; // size = 0x08
typedef struct {
/* 0x00 */ s32 flags; /* Collision Exclusion Mask */
/* 0x04 */ u8 effect; /* Damage Effect (Knockback, Fire, etc.) */
/* 0x05 */ u8 unk_05;
/* 0x06 */ s16 unk_06;
/* 0x08 */ s16 unk_08;
/* 0x0A */ s16 unk_0A;
} ColliderBump; // size = 0x0C
typedef struct ColliderBody {
/* 0x00 */ ColliderTouch toucher;
/* 0x08 */ ColliderBump bumper;
/* 0x14 */ u8 flags;
/* 0x15 */ u8 toucherFlags;
/* 0x16 */ u8 bumperFlags;
/* 0x17 */ u8 flags2;
/* 0x18 */ s32 unk_18;
/* 0x1C */ struct ColliderBodyEntry* colBuf;
/* 0x20 */ s32 unk_20;
/* 0x24 */ struct ColliderBody* colliding;
} ColliderBody; // size = 0x28
typedef struct ColliderBodyEntry {
/* 0x00 */ ColliderBody c;
/* 0x28 */ char unk_28[0x18];
} ColliderBodyEntry; // size = 0x40
typedef struct {
/* 0x00 */ u8 bodyFlags;
/* 0x01 */ u8 unk_09[0x3]; /* 000000 */
/* 0x04 */ s32 toucherMask; /* Attack Toucher Exclusion Mask */
/* 0x08 */ u8 bumperEffect; /* Damage Effect (Knockback, Fire, etc.) */
/* 0x09 */ u8 toucherDamage; /* Damage Amount or Stun Timer */
/* 0x0A */ u8 unk_12[0x2]; /* 0000 */
/* 0x0C */ s32 bumperMask; /* Bumper Exclusion Mask */
/* 0x10 */ u8 unk_18[0x4]; /* 00000000 */
/* 0x14 */ u8 toucherFlags; /* Attack Toucher Flags */
/* 0x15 */ u8 bumperFlags; /* Bumper Flags */
/* 0x16 */ u8 bodyFlags2;
/* 0x17 */ u8 unk_1F; /* 00 */
} ColliderBodyInfoInner; // size = 0x1A
typedef struct {
/* 0x00 */ u8 unk_00;
/* 0x01 */ u8 colliderFlags; /* Collider Flags */
/* 0x02 */ u8 collideFlags; /* Collide Flags */
/* 0x03 */ u8 maskA; /* Bitwise-And with Mask B */
/* 0x04 */ u8 maskB; /* Bitwise-And with Mask A */
/* 0x05 */ u8 type; /* Collider Type */
/* 0x06 */ u8 unk_06[0x2]; /* 0000 */
} ColliderBodyInfo; // size = 0x08
typedef struct {
/* 0x00 */ s16 radius; /* Cylinder Radius */
/* 0x02 */ s16 height; /* Cylinder Height */
/* 0x04 */ s16 yShift; /* Shift Cylinder on Y Axis */
/* 0x06 */ Vec3s position; /* {X, Y, Z} position of Cylinder */
} ColliderDimensions; // size = 0xC
typedef struct {
/* 0x00 */ Collider base;
/* 0x18 */ ColliderBody body;
/* 0x40 */ ColliderDimensions dim;
} ColliderCylinderMain; // size = 0x4C
typedef struct {
/* 0x00 */ ColliderBodyInfo body;
/* 0x08 */ ColliderBodyInfoInner inner;
/* 0x22 */ ColliderDimensions dim;
} ColliderCylinderInit; // size = 0x2E
typedef struct {
/* 0x00 */ Actor* actor;
/* 0x04 */ char unk_04[0x10];