Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name collider fields for "effects" / misc. #1925

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/tutorial/beginning_decomp.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ ovl_En_Jj: Rom 00E3E3D0:00E3F9E0 VRam 80A87800:80A88E10 Offset 0014B4

static ColliderCylinderInit sCylinderInit =
{
{ COLTYPE_UNK10, 0x00, 0x09, 0x39, 0x10, COLSHAPE_CYLINDER },
{ COL_MATERIAL_UNK10, 0x00, 0x09, 0x39, 0x10, COLSHAPE_CYLINDER },
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000004, 0x00, 0x00 }, 0x00, 0x01, 0x01 },
{ 170, 150, 0, { 0, 0, 0 } },
};
Expand All @@ -375,7 +375,7 @@ As with the InitChain, replace the commented-out data we copied into the C file
extern ColliderCylinderInit D_80A88CB4;
// static ColliderCylinderInit sCylinderInit =
// {
// { COLTYPE_UNK10, 0x00, 0x09, 0x39, 0x10, COLSHAPE_CYLINDER },
// { COL_MATERIAL_UNK10, 0x00, 0x09, 0x39, 0x10, COLSHAPE_CYLINDER },
// { 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000004, 0x00, 0x00 }, 0x00, 0x01, 0x01 },
// { 170, 150, 0, { 0, 0, 0 } },
// };
Expand Down Expand Up @@ -655,15 +655,15 @@ ActorInit En_Jj_InitVars = {
extern ColliderCylinderInit D_80A88CB4;
// static ColliderCylinderInit sCylinderInit = {
// {
// COLTYPE_NONE,
// COL_MATERIAL_NONE,
// AT_NONE,
// AC_ON | AC_TYPE_PLAYER,
// OC1_ON | OC1_TYPE_ALL,
// OC2_TYPE_1,
// COLSHAPE_CYLINDER,
// },
// {
// ELEMTYPE_UNK0,
// ELEM_MATERIAL_UNK0,
// { 0x00000000, 0x00, 0x00 },
// { 0x00000004, 0x00, 0x00 },
// ATELEM_NONE,
Expand Down
12 changes: 6 additions & 6 deletions docs/tutorial/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ ovl_En_Tg: Rom 00ECE1F0:00ECE910 VRam 80B18360:80B18A80 Offset 0005B0

static ColliderCylinderInit sCylinderInit =
{
{ COLTYPE_UNK10, 0x00, 0x00, 0x39, 0x20, COLSHAPE_CYLINDER },
{ COL_MATERIAL_UNK10, 0x00, 0x00, 0x39, 0x20, COLSHAPE_CYLINDER },
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 },
{ 20, 64, 0, { 0, 0, 0 } },
};
Expand All @@ -168,7 +168,7 @@ Copy this in below `D_80B18910`, delete the original words of data, change the n
// sCylinderInit
static ColliderCylinderInit D_80B18910 =
{
{ COLTYPE_UNK10, 0x00, 0x00, 0x39, 0x20, COLSHAPE_CYLINDER },
{ COL_MATERIAL_UNK10, 0x00, 0x00, 0x39, 0x20, COLSHAPE_CYLINDER },
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 },
{ 20, 64, 0, { 0, 0, 0 } },
};
Expand Down Expand Up @@ -235,7 +235,7 @@ extern UNK_TYPE D_80A88164;
extern ColliderCylinderInit D_80A88CB4;
// static ColliderCylinderInit sCylinderInit =
// {
// { COLTYPE_UNK10, 0x00, 0x09, 0x39, 0x10, COLSHAPE_CYLINDER },
// { COL_MATERIAL_UNK10, 0x00, 0x09, 0x39, 0x10, COLSHAPE_CYLINDER },
// { 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000004, 0x00, 0x00 }, 0x00, 0x01, 0x01 },
// { 170, 150, 0, { 0, 0, 0 } },
// };
Expand Down Expand Up @@ -283,7 +283,7 @@ extern UNK_TYPE D_80A88164;

static ColliderCylinderInit sCylinderInit =
{
{ COLTYPE_UNK10, 0x00, 0x09, 0x39, 0x10, COLSHAPE_CYLINDER },
{ COL_MATERIAL_UNK10, 0x00, 0x09, 0x39, 0x10, COLSHAPE_CYLINDER },
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000004, 0x00, 0x00 }, 0x00, 0x01, 0x01 },
{ 170, 150, 0, { 0, 0, 0 } },
};
Expand Down Expand Up @@ -505,7 +505,7 @@ ActorInit En_Jj_InitVars = {

static ColliderCylinderInit sCylinderInit =
{
{ COLTYPE_UNK10, 0x00, 0x09, 0x39, 0x10, COLSHAPE_CYLINDER },
{ COL_MATERIAL_UNK10, 0x00, 0x09, 0x39, 0x10, COLSHAPE_CYLINDER },
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000004, 0x00, 0x00 }, 0x00, 0x01, 0x01 },
{ 170, 150, 0, { 0, 0, 0 } },
};
Expand Down Expand Up @@ -615,7 +615,7 @@ s32 usused2[] = { 0, 0 };

static ColliderCylinderInit sCylinderInit =
{
{ COLTYPE_UNK10, 0x00, 0x09, 0x39, 0x10, COLSHAPE_CYLINDER },
{ COL_MATERIAL_UNK10, 0x00, 0x09, 0x39, 0x10, COLSHAPE_CYLINDER },
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000004, 0x00, 0x00 }, 0x00, 0x01, 0x01 },
{ 170, 150, 0, { 0, 0, 0 } },
};
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void func_80A13098(EnFirefly* this) {
} else {
this->actor.params -= 2;
}
this->collider.list->body.atDmgInfo.effect = 1;
this->collider.list->body.atDmgInfo.playerACHitReaction = PLAYER_AC_HIT_REACTION_1;
this->auraType = 1;
this->onFire = 1;
this->actor.naviEnemyId = 0x11;
Expand Down
20 changes: 17 additions & 3 deletions include/z64actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,20 @@ typedef struct {
/* 0x08 */ u8 mass;
} CollisionCheckInfoInit2;

enum PlayerATHitReaction {
PLAYER_AT_HIT_REACTION_0,
PLAYER_AT_HIT_REACTION_1
};

enum PlayerACHitReaction {
PLAYER_AC_HIT_REACTION_0,
PLAYER_AC_HIT_REACTION_1,
PLAYER_AC_HIT_REACTION_2,
PLAYER_AC_HIT_REACTION_3,
PLAYER_AC_HIT_REACTION_4,
PLAYER_AC_HIT_REACTION_7 = 7
};

typedef struct {
/* 0x00 */ DamageTable* damageTable;
/* 0x04 */ Vec3f displacement; // Amount to correct actor velocity by when colliding into a body
Expand All @@ -127,9 +141,9 @@ typedef struct {
/* 0x16 */ u8 mass; // Used to compute displacement for OC collisions
/* 0x17 */ u8 health; // Note: some actors may use their own health variable instead of this one
/* 0x18 */ u8 damage; // Amount to decrement health by
/* 0x19 */ u8 damageEffect; // Stores what effect should occur when hit by a weapon
/* 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
/* 0x19 */ u8 damageEffect; // If a damageTable is set, the effect corresponding to the damage type, as specified in the damage table
/* 0x1A */ u8 playerATHitReaction; // (for Player) Reaction from an AT collider hit
/* 0x1B */ u8 playerACHitReaction; // (for Player) Reaction from an AC collider hit
} CollisionCheckInfo; // size = 0x1C

typedef struct {
Expand Down
74 changes: 34 additions & 40 deletions include/z64collision_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,6 @@ struct Actor;
* Bases for all shapes of colliders
*/

typedef enum {
/* 0 */ COLTYPE_HIT0, // Blue blood, white hitmark
/* 1 */ COLTYPE_HIT1, // No blood, dust hitmark
/* 2 */ COLTYPE_HIT2, // Green blood, dust hitmark
/* 3 */ COLTYPE_HIT3, // No blood, white hitmark
/* 4 */ COLTYPE_HIT4, // Water burst, no hitmark
/* 5 */ COLTYPE_HIT5, // No blood, red hitmark
/* 6 */ COLTYPE_HIT6, // Green blood, white hitmark
/* 7 */ COLTYPE_HIT7, // Red blood, white hitmark
/* 8 */ COLTYPE_HIT8, // Blue blood, red hitmark
/* 9 */ COLTYPE_METAL,
/* 10 */ COLTYPE_NONE,
/* 11 */ COLTYPE_WOOD,
/* 12 */ COLTYPE_HARD,
/* 13 */ COLTYPE_TREE
} ColliderType;

typedef enum {
/* 0 */ COLSHAPE_JNTSPH,
/* 1 */ COLSHAPE_CYLINDER,
Expand All @@ -37,6 +20,23 @@ typedef enum {
/* 4 */ COLSHAPE_MAX
} ColliderShape;

typedef enum {
/* 0 */ COL_MATERIAL_HIT0, // Blue blood, white hitmark
/* 1 */ COL_MATERIAL_HIT1, // No blood, dust hitmark
/* 2 */ COL_MATERIAL_HIT2, // Green blood, dust hitmark
/* 3 */ COL_MATERIAL_HIT3, // No blood, white hitmark
/* 4 */ COL_MATERIAL_HIT4, // Water burst, no hitmark
/* 5 */ COL_MATERIAL_HIT5, // No blood, red hitmark
/* 6 */ COL_MATERIAL_HIT6, // Green blood, white hitmark
/* 7 */ COL_MATERIAL_HIT7, // Red blood, white hitmark
/* 8 */ COL_MATERIAL_HIT8, // Blue blood, red hitmark
/* 9 */ COL_MATERIAL_METAL,
/* 10 */ COL_MATERIAL_NONE,
/* 11 */ COL_MATERIAL_WOOD,
/* 12 */ COL_MATERIAL_HARD,
/* 13 */ COL_MATERIAL_TREE
} ColliderMaterial;

typedef struct {
/* 0x00 */ struct Actor* actor; // Attached actor
/* 0x04 */ struct Actor* at; // Actor attached to what it collided with as an AT collider.
Expand All @@ -46,12 +46,12 @@ typedef struct {
/* 0x11 */ u8 acFlags;
/* 0x12 */ u8 ocFlags1;
/* 0x13 */ u8 ocFlags2; // Flags related to which colliders it can OC collide with.
/* 0x14 */ u8 colType; // Determines hitmarks and sound effects during AC collisions. See `ColliderType` enum
/* 0x14 */ u8 colMaterial; // Determines hitmarks and sound effects during AC collisions. See `ColliderMaterial` enum
/* 0x15 */ u8 shape; // See `ColliderShape` enum
} Collider; // size = 0x18

typedef struct {
/* 0x00 */ u8 colType;
/* 0x00 */ u8 colMaterial;
/* 0x01 */ u8 atFlags;
/* 0x02 */ u8 acFlags;
/* 0x03 */ u8 ocFlags1;
Expand All @@ -60,7 +60,7 @@ typedef struct {
} ColliderInit; // size = 0x06

typedef struct {
/* 0x00 */ u8 colType;
/* 0x00 */ u8 colMaterial;
/* 0x01 */ u8 atFlags;
/* 0x02 */ u8 acFlags;
/* 0x03 */ u8 ocFlags1;
Expand All @@ -77,44 +77,38 @@ typedef struct {

typedef struct {
/* 0x00 */ u32 dmgFlags; // Damage types dealt by this collider element as AT.
/* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.)
/* 0x04 */ u8 playerACHitReaction; // Player reaction to a Player AC collider hitting this AT collider
/* 0x05 */ u8 damage; // Damage
} ColliderElementDamageInfoAT; // size = 0x08

typedef struct {
/* 0x00 */ u32 dmgFlags; // Damage types that may affect this collider element as AC.
/* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.)
/* 0x04 */ u8 playerATHitReaction; // Player reaction to a Player AT collider hitting this AC collider
/* 0x05 */ u8 defense; // Damage Resistance
/* 0x06 */ Vec3s hitPos; // Point of contact
} ColliderElementDamageInfoAC; // size = 0x0C

typedef struct {
/* 0x00 */ u32 dmgFlags; // Damage types that may affect this collider element as AC.
/* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.)
/* 0x04 */ u8 playerATHitReaction; // Player reaction to a Player AT collider hitting this AC collider
/* 0x05 */ u8 defense; // Damage Resistance
} ColliderElementDamageInfoACInit; // size = 0x08

/**
* Affects the sound Link's sword makes when hitting it, hookability,
* and possibly other things. It's definitely not flags, as all checks
* are == or !=. Will probably need more actors decomped to truly
* understand what this is.
*/
typedef enum {
/* 0 */ ELEMTYPE_UNK0,
/* 1 */ ELEMTYPE_UNK1,
/* 2 */ ELEMTYPE_UNK2,
/* 3 */ ELEMTYPE_UNK3,
/* 4 */ ELEMTYPE_UNK4,
/* 5 */ ELEMTYPE_UNK5,
/* 6 */ ELEMTYPE_UNK6,
/* 7 */ ELEMTYPE_UNK7
} ElementType;
/* 0 */ ELEM_MATERIAL_UNK0,
/* 1 */ ELEM_MATERIAL_UNK1,
/* 2 */ ELEM_MATERIAL_UNK2,
/* 3 */ ELEM_MATERIAL_UNK3,
/* 4 */ ELEM_MATERIAL_UNK4,
/* 5 */ ELEM_MATERIAL_UNK5,
/* 6 */ ELEM_MATERIAL_UNK6,
/* 7 */ ELEM_MATERIAL_UNK7
} ElementMaterial;

typedef struct ColliderElement {
/* 0x00 */ ColliderElementDamageInfoAT atDmgInfo; // Damage properties when acting as an AT collider
/* 0x08 */ ColliderElementDamageInfoAC acDmgInfo; // Damage properties when acting as an AC collider
/* 0x14 */ u8 elemType; // Affects sfx reaction when attacked by Link and hookability. Full purpose unknown.
/* 0x14 */ u8 elemMaterial; // Affects sfx when attacked by Player, and interaction with hookshot and arrows.
/* 0x15 */ u8 atElemFlags; // Information flags for AT collisions
/* 0x16 */ u8 acElemFlags; // Information flags for AC collisions
/* 0x17 */ u8 ocElemFlags; // Information flags for OC collisions
Expand All @@ -125,7 +119,7 @@ typedef struct ColliderElement {
} ColliderElement; // size = 0x28

typedef struct {
/* 0x00 */ u8 elemType; // Affects sfx reaction when attacked by Link and hookability. Full purpose unknown.
/* 0x00 */ u8 elemMaterial; // Affects sfx when attacked by Player, and interaction with hookshot and arrows.
/* 0x04 */ ColliderElementDamageInfoAT atDmgInfo; // Damage properties when acting as an AT collider
/* 0x0C */ ColliderElementDamageInfoACInit acDmgInfo; // Damage properties when acting as an AC collider
/* 0x14 */ u8 atElemFlags; // Information flags for AT collisions
Expand Down
Loading