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 all 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
1 change: 1 addition & 0 deletions include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ extern volatile OSTime gRSPGfxTimeAcc;
extern volatile OSTime gRSPOtherTimeAcc;
extern volatile OSTime D_8016A578;
extern volatile OSTime gRDPTimeAcc;
extern struct SpeedMeterTimeEntry* sSpeedMeterTimeEntryPtr; // declared here solely for the purpose of BSS ordering

extern SfxBankEntry D_8016BAD0[9];
extern SfxBankEntry D_8016BC80[12];
Expand Down
96 changes: 52 additions & 44 deletions include/z64collision_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,6 @@ struct PlayState;
* Bases for all shapes of colliders
*/

typedef enum ColliderType {
/* 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 ColliderShape {
/* 0 */ COLSHAPE_JNTSPH,
/* 1 */ COLSHAPE_CYLINDER,
Expand All @@ -42,6 +25,23 @@ typedef enum ColliderShape {
/* 4 */ COLSHAPE_MAX
} ColliderShape;

typedef enum ColliderMaterial {
/* 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 Collider {
/* 0x00 */ struct Actor* actor; // Attached actor
/* 0x04 */ struct Actor* at; // Actor attached to what it collided with as an AT collider.
Expand All @@ -51,12 +51,12 @@ typedef struct Collider {
/* 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 ColliderInit {
/* 0x00 */ u8 colType;
/* 0x00 */ u8 colMaterial;
/* 0x01 */ u8 atFlags;
/* 0x02 */ u8 acFlags;
/* 0x03 */ u8 ocFlags1;
Expand All @@ -65,7 +65,7 @@ typedef struct ColliderInit {
} ColliderInit; // size = 0x06

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

typedef struct ColliderElementDamageInfoAT {
/* 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 ColliderElementDamageInfoAC {
/* 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 ColliderElementDamageInfoACInit {
/* 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 ElementType {
/* 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;
typedef enum ElementMaterial {
/* 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 @@ -130,7 +124,7 @@ typedef struct ColliderElement {
} ColliderElement; // size = 0x28

typedef struct ColliderElementInit {
/* 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 Expand Up @@ -461,6 +455,20 @@ typedef struct CollisionCheckInfoInit2 {
/* 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 CollisionCheckInfo {
/* 0x00 */ DamageTable* damageTable;
/* 0x04 */ Vec3f displacement; // Amount to correct actor velocity by when colliding into a body
Expand All @@ -470,9 +478,9 @@ typedef struct CollisionCheckInfo {
/* 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

DamageTable* DamageTable_Get(s32 index);
Expand Down
2 changes: 1 addition & 1 deletion src/code/fault_gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*/
#if PLATFORM_GC

#pragma increment_block_number "gc-eu:208 gc-eu-mq:208 gc-eu-mq-dbg:208 gc-jp:208 gc-jp-ce:208 gc-jp-mq:208 gc-us:208" \
#pragma increment_block_number "gc-eu:208 gc-eu-mq:208 gc-eu-mq-dbg:192 gc-jp:208 gc-jp-ce:208 gc-jp-mq:208 gc-us:208" \
"gc-us-mq:208"

#include "global.h"
Expand Down
Loading