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 10 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
20 changes: 17 additions & 3 deletions include/z64actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,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 @@ -124,9 +138,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