Enum cleanup (#247)

* various cleanup

* item cleanup

* enums

* enum flags

* NO

* treat didAreaChange as bool in ifs
This commit is contained in:
alex 2021-04-02 06:50:38 +01:00 committed by GitHub
parent ce6b660d64
commit 498694158a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 203 additions and 414 deletions

View File

@ -90,14 +90,15 @@ typedef struct HeapNode {
/* 0x0C */ s32 capacity;
} HeapNode; // size = 0x10
typedef struct NpcBlurData {
/// Ring buffer of an NPC's position over the past 20 frames.
typedef struct BlurBuffer {
/* 0x00 */ s8 unk_00;
/* 0x01 */ s8 unk_01;
/* 0x02 */ char unk_02[2];
/* 0x04 */ f32 xpos[20];
/* 0x54 */ f32 ypos[20];
/* 0xA4 */ f32 zpos[20];
} NpcBlurData; // size = 0xF4
/* 0x01 */ s8 index; ///< Current blur ring buffer index
/* 0x02 */ char unk_02[2]; // padding?
/* 0x04 */ f32 x[20];
/* 0x54 */ f32 y[20];
/* 0xA4 */ f32 z[20];
} BlurBuffer; // size = 0xF4
typedef struct Npc {
/* 0x000 */ s32 flags;
@ -108,7 +109,7 @@ typedef struct Npc {
/* 0x014 */ f32 jumpScale; /* also used for speech, temp1? */
/* 0x018 */ f32 moveSpeed;
/* 0x01C */ f32 jumpVelocity;
/* 0x020 */ struct NpcBlurData* blurData; /* related to movement somehow... */
/* 0x020 */ struct BlurBuffer* blurBuf; ///< Null unless flag 0x100000 is set.
/* 0x024 */ s32 unk_24;
/* 0x028 */ u32 currentAnim;
/* 0x02C */ char unk_2C[4];
@ -127,7 +128,7 @@ typedef struct Npc {
/* 0x088 */ s16 isFacingAway;
/* 0x08A */ s16 yawCamOffset;
/* 0x08C */ s16 unk_8C;
/* 0x08E */ s16 duration; /* formerly interp_counter */
/* 0x08E */ s16 duration; // TODO: name less vaguely
/* 0x090 */ Vec3s homePos;
/* 0x096 */ char unk_96[12];
/* 0x0A2 */ u16 unk_A2;
@ -983,7 +984,7 @@ typedef struct GameStatus {
/* 0x085 */ char unk_85;
/* 0x086 */ s16 areaID;
/* 0x088 */ s16 prevArea;
/* 0x08A */ s16 changedArea; /* (1 = yes) */
/* 0x08A */ s16 didAreaChange;
/* 0x08C */ s16 mapID;
/* 0x08E */ s16 entryID;
/* 0x090 */ u16 unk_90;

View File

@ -409,19 +409,19 @@ enum SongIDs {
typedef UNK_TYPE Ability;
enum Abilities {
ABILITY_DODGE_MASTER = 0,
ABILITY_DODGE_MASTER,
ABILITY_UNUSED,
ABILITY_SPIKE_SHIELD,
ABILITY_FIRST_ATTACK,
ABILITY_H_P_PLUS,
ABILITY_HP_PLUS,
ABILITY_DOUBLE_DIP,
ABILITY_MYSTERY_SCROLL,
ABILITY_FIRE_SHIELD,
ABILITY_PRETTY_LUCKY,
ABILITY_H_P_DRAIN,
ABILITY_HP_DRAIN,
ABILITY_ALL_OR_NOTHING,
ABILITY_SLOW_GO,
ABILITY_F_P_PLUS,
ABILITY_FP_PLUS,
ABILITY_ICE_POWER,
ABILITY_FEELING_FINE,
ABILITY_ATTACK_F_X,
@ -445,7 +445,7 @@ enum Abilities {
ABILITY_CLOSE_CALL,
ABILITY_P_UP_D_DOWN,
ABILITY_LUCKY_DAY,
ABILITY_MEGA_H_P_DRAIN,
ABILITY_MEGA_HP_DRAIN,
ABILITY_P_DOWN_D_UP,
ABILITY_FLOWER_FANATIC,
ABILITY_SPEEDY_SPIN,
@ -469,7 +469,7 @@ enum Abilities {
typedef UNK_TYPE Emote;
enum Emotes {
EMOTE_EXCLAMATION = 0,
EMOTE_EXCLAMATION,
EMOTE_SHOCK,
EMOTE_QUESTION,
EMOTE_FRUSTRATION,
@ -479,7 +479,7 @@ enum Emotes {
typedef UNK_TYPE Easing;
enum Easings {
EASING_LINEAR = 0,
EASING_LINEAR,
EASING_QUADRATIC_IN,
EASING_CUBIC_IN,
EASING_QUARTIC_IN,
@ -593,7 +593,7 @@ enum SoundIDs {
typedef UNK_TYPE Cam;
enum Cams {
CAM_DEFAULT = 0,
CAM_DEFAULT,
CAM_BATTLE,
CAM_TATTLE,
CAM_CAM3,
@ -603,7 +603,8 @@ enum Cams {
typedef s16 ItemID;
enum ItemIDs {
ITEM_JUMP = 1,
ITEM_NONE,
ITEM_JUMP,
ITEM_SPIN_JUMP,
ITEM_TORNADO_JUMP,
ITEM_HAMMER,
@ -826,7 +827,7 @@ enum ItemIDs {
ITEM_POWER_BOUNCE,
ITEM_SPIKE_SHIELD,
ITEM_FIRST_ATTACK,
ITEM_H_P_PLUS_A,
ITEM_HP_PLUS_A,
ITEM_QUAKE_HAMMER,
ITEM_DOUBLE_DIP,
ITEM_MYSTERY_SCROLL,
@ -840,10 +841,10 @@ enum ItemIDs {
ITEM_FEELING_FINE,
ITEM_ATTACK_F_X_A,
ITEM_ALLOR_NOTHING,
ITEM_H_P_DRAIN,
ITEM_HP_DRAIN,
ITEM_JUMP_CHARGE0,
ITEM_SLOW_GO,
ITEM_F_P_PLUS_A,
ITEM_FP_PLUS_A,
ITEM_MEGA_RUSH,
ITEM_ICE_POWER,
ITEM_DEFEND_PLUS_A,
@ -872,7 +873,7 @@ enum ItemIDs {
ITEM_CLOSE_CALL,
ITEM_P_UP_D_DOWN,
ITEM_LUCKY_DAY,
ITEM_MEGA_H_P_DRAIN,
ITEM_MEGA_HP_DRAIN,
ITEM_P_DOWN_D_UP,
ITEM_POWER_QUAKE,
ITEM_AUTO_MULTIBOUNCE,
@ -903,8 +904,8 @@ enum ItemIDs {
ITEM_EARTHQUAKE_JUMP,
ITEM_DEEP_FOCUS2,
ITEM_DEEP_FOCUS3,
ITEM_H_P_PLUS_B,
ITEM_F_P_PLUS_B,
ITEM_HP_PLUS_B,
ITEM_FP_PLUS_B,
ITEM_HAPPY_HEART_B,
ITEM_HAPPY_HEART_X,
ITEM_FLOWER_SAVER_B,
@ -925,12 +926,12 @@ enum ItemIDs {
ITEM_ATTACK_F_X_E,
ITEM_ATTACK_F_X_C,
ITEM_ATTACK_F_X_F,
ITEM_H_P_PLUS_C,
ITEM_H_P_PLUS_X,
ITEM_H_P_PLUS_Y,
ITEM_F_P_PLUS_C,
ITEM_F_P_PLUS_X,
ITEM_F_P_PLUS_Y,
ITEM_HP_PLUS_C,
ITEM_HP_PLUS_X,
ITEM_HP_PLUS_Y,
ITEM_FP_PLUS_C,
ITEM_FP_PLUS_X,
ITEM_FP_PLUS_Y,
ITEM_HEALTHY_HEALTHY,
ITEM_ATTACK_F_X_F2,
ITEM_ATTACK_F_X_F3,
@ -1014,7 +1015,7 @@ enum PlayerAnims {
typedef UNK_TYPE AmbientSound;
enum AmbientSounds {
AMBIENT_SPOOKY = 0,
AMBIENT_SPOOKY,
AMBIENT_WIND,
AMBIENT_BEACH,
AMBIENT_JUNGLE,
@ -1033,7 +1034,7 @@ enum AmbientSounds {
typedef UNK_TYPE EncounterOutcome;
enum EncounterOutcomes {
OUTCOME_PLAYER_WON = 0,
OUTCOME_PLAYER_WON,
OUTCOME_PLAYER_LOST,
OUTCOME_PLAYER_FLED,
OUTCOME_ENEMY_FLED,
@ -1073,7 +1074,7 @@ enum Iters {
typedef UNK_TYPE ActorSoundID;
enum ActorSoundIDs {
ACTOR_SOUND_WALK = 0,
ACTOR_SOUND_WALK,
ACTOR_SOUND_FLY,
ACTOR_SOUND_JUMP,
ACTOR_SOUND_HURT,
@ -1083,7 +1084,7 @@ enum ActorSoundIDs {
typedef UNK_TYPE Phase;
enum Phases {
PHASE_EXECUTE_ACTION = 0,
PHASE_EXECUTE_ACTION,
PHASE_FIRST_STRIKE,
PHASE_RUN_AWAY_START = 3,
PHASE_RUN_AWAY_RESET,
@ -1133,7 +1134,7 @@ enum ActorIDs {
typedef UNK_TYPE Element;
enum Elements {
ELEMENT_END = 0,
ELEMENT_END,
ELEMENT_NORMAL,
ELEMENT_FIRE,
ELEMENT_WATER,
@ -1190,7 +1191,7 @@ enum Events {
typedef UNK_TYPE HitSound;
enum HitSounds {
HIT_SOUND_MISS = 0,
HIT_SOUND_MISS,
HIT_SOUND_BONES,
HIT_SOUND_NORMAL,
HIT_SOUND_FIRE,
@ -1200,7 +1201,7 @@ enum HitSounds {
typedef s8 Status;
enum Statuses {
STATUS_END = 0,
STATUS_END,
STATUS_NORMAL,
STATUS_DEFAULT,
STATUS_FEAR,
@ -1241,7 +1242,7 @@ enum DoorSwings {
typedef UNK_TYPE ItemSpawnMode;
enum ItemSpawnModes {
ITEM_SPAWN_MODE_UNKNOWN_0 = 0,
ITEM_SPAWN_MODE_UNKNOWN_0,
ITEM_SPAWN_MODE_DECORATION,
ITEM_SPAWN_MODE_UNKNOWN_2,
ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS,
@ -1313,7 +1314,7 @@ enum Locations {
typedef UNK_TYPE DoorSound;
enum DoorSounds {
DOOR_SOUND_BASIC = 0,
DOOR_SOUND_BASIC,
DOOR_SOUND_METAL,
DOOR_SOUND_LARGE,
DOOR_SOUND_CREAKY,
@ -1324,7 +1325,7 @@ enum DoorSounds {
typedef s8 ActionState;
enum ActionStates {
ACTION_STATE_IDLE = 0,
ACTION_STATE_IDLE,
ACTION_STATE_WALK,
ACTION_STATE_RUN,
ACTION_STATE_JUMP,
@ -1336,7 +1337,9 @@ enum ActionStates {
ACTION_STATE_STEP_DOWN,
ACTION_STATE_LAND,
ACTION_STATE_STEP_DOWN_LAND,
ACTION_STATE_CONVERSATION, // This and following states prohibit normal movement.
// Following action states prohibit movement:
ACTION_STATE_CONVERSATION,
ACTION_STATE_SPIN_JUMP,
ACTION_STATE_GROUND_POUND,
ACTION_STATE_ULTRA_JUMP,
@ -1365,69 +1368,69 @@ enum NpcIDs {
typedef UNK_TYPE TriggerFlag;
enum TriggerFlags {
TRIGGER_WALL_PUSH = 0x40,
TRIGGER_FLOOR_TOUCH = 0x80,
TRIGGER_WALL_PRESS_A = 0x100,
TRIGGER_FLOOR_JUMP = 0x200,
TRIGGER_WALL_TOUCH = 0x400,
TRIGGER_FLOOR_PRESS_A = 0x800,
TRIGGER_WALL_HAMMER = 0x1000,
TRIGGER_GAME_FLAG_SET = 0x10000,
TRIGGER_AREA_FLAG_SET = 0x20000,
TRIGGER_CEILING_TOUCH = 0x40000,
TRIGGER_FLOOR_ABOVE = 0x80000,
TRIGGER_POINT_BOMB = 0x100000,
TRIGGER_WALL_PUSH = 0x00000040,
TRIGGER_FLOOR_TOUCH = 0x00000080,
TRIGGER_WALL_PRESS_A = 0x00000100,
TRIGGER_FLOOR_JUMP = 0x00000200,
TRIGGER_WALL_TOUCH = 0x00000400,
TRIGGER_FLOOR_PRESS_A = 0x00000800,
TRIGGER_WALL_HAMMER = 0x00001000,
TRIGGER_GAME_FLAG_SET = 0x00010000,
TRIGGER_AREA_FLAG_SET = 0x00020000,
TRIGGER_CEILING_TOUCH = 0x00040000,
TRIGGER_FLOOR_ABOVE = 0x00080000,
TRIGGER_POINT_BOMB = 0x00100000,
};
typedef UNK_TYPE Button;
enum Buttons {
BUTTON_C_RIGHT = 0x1,
BUTTON_C_LEFT = 0x2,
BUTTON_C_DOWN = 0x4,
BUTTON_C_UP = 0x8,
BUTTON_R = 0x10,
BUTTON_L = 0x20,
BUTTON_D_RIGHT = 0x100,
BUTTON_D_LEFT = 0x200,
BUTTON_D_DOWN = 0x400,
BUTTON_D_UP = 0x800,
BUTTON_START = 0x1000,
BUTTON_Z = 0x2000,
BUTTON_B = 0x4000,
BUTTON_A = 0x8000,
BUTTON_C_RIGHT = 0x00000001,
BUTTON_C_LEFT = 0x00000002,
BUTTON_C_DOWN = 0x00000004,
BUTTON_C_UP = 0x00000008,
BUTTON_R = 0x00000010,
BUTTON_L = 0x00000020,
BUTTON_D_RIGHT = 0x00000100,
BUTTON_D_LEFT = 0x00000200,
BUTTON_D_DOWN = 0x00000400,
BUTTON_D_UP = 0x00000800,
BUTTON_START = 0x00001000,
BUTTON_Z = 0x00002000,
BUTTON_B = 0x00004000,
BUTTON_A = 0x00008000,
};
typedef UNK_TYPE PlayerBuff;
enum PlayerBuffs {
PLAYER_BUFF_JUMP_CHARGE = 0x1,
PLAYER_BUFF_HAMMER_CHARGE = 0x2,
PLAYER_BUFF_STONE = 0x8,
PLAYER_BUFF_HUSTLE = 0x10,
PLAYER_BUFF_STATIC = 0x20,
PLAYER_BUFF_TRANSPARENT = 0x40,
PLAYER_BUFF_CLOUD_NINE = 0x80,
PLAYER_BUFF_TURBO_CHARGE = 0x100,
PLAYER_BUFF_WATER_BLOCK = 0x200,
PLAYER_BUFF_PARTNER_GLOWING = 0x10000,
PLAYER_BUFF_ALL = 0xFFFFFFF,
PLAYER_BUFF_JUMP_CHARGE = 0x00000001,
PLAYER_BUFF_HAMMER_CHARGE = 0x00000002,
PLAYER_BUFF_STONE = 0x00000008,
PLAYER_BUFF_HUSTLE = 0x00000010,
PLAYER_BUFF_STATIC = 0x00000020,
PLAYER_BUFF_TRANSPARENT = 0x00000040,
PLAYER_BUFF_CLOUD_NINE = 0x00000080,
PLAYER_BUFF_TURBO_CHARGE = 0x00000100,
PLAYER_BUFF_WATER_BLOCK = 0x00000200,
PLAYER_BUFF_PARTNER_GLOWING = 0x00010000,
PLAYER_BUFF_ALL = 0xFFFFFFFF,
};
typedef UNK_TYPE StatusFlag;
enum StatusFlags {
STATUS_FLAG_SLEEP = 0x1000,
STATUS_FLAG_STATIC = 0x2000,
STATUS_FLAG_FROZEN = 0x4000,
STATUS_FLAG_UNKNOWN_STATUS3 = 0x8000,
STATUS_FLAG_PARALYZE = 0x10000,
STATUS_FLAG_POISON = 0x20000,
STATUS_FLAG_DIZZY = 0x40000,
STATUS_FLAG_SHRINK = 0x80000,
STATUS_FLAG_STONE = 0x100000,
STATUS_FLAG_STOP = 0x200000,
STATUS_FLAG_K_O = 0x1000000,
STATUS_FLAG_GLOWING = 0x2000000,
STATUS_FLAG_TRANSPARENT = 0x4000000,
STATUS_FLAG_ATTACK_BOOST = 0x8000000,
STATUS_FLAG_SLEEP = 0x00001000,
STATUS_FLAG_STATIC = 0x00002000,
STATUS_FLAG_FROZEN = 0x00004000,
STATUS_FLAG_UNKNOWN_STATUS3 = 0x00008000,
STATUS_FLAG_PARALYZE = 0x00010000,
STATUS_FLAG_POISON = 0x00020000,
STATUS_FLAG_DIZZY = 0x00040000,
STATUS_FLAG_SHRINK = 0x00080000,
STATUS_FLAG_STONE = 0x00100000,
STATUS_FLAG_STOP = 0x00200000,
STATUS_FLAG_KO = 0x01000000,
STATUS_FLAG_GLOWING = 0x02000000,
STATUS_FLAG_TRANSPARENT = 0x04000000,
STATUS_FLAG_ATTACK_BOOST = 0x08000000,
STATUS_FLAG_DEFENSE_BOOST = 0x10000000,
STATUS_FLAG_CHILL_OUT = 0x20000000,
STATUS_FLAG_RIGHT_ON = 0x40000000,
@ -1435,19 +1438,19 @@ enum StatusFlags {
typedef UNK_TYPE DamageType;
enum DamageTypes {
DAMAGE_TYPE_FIRE = 0x2,
DAMAGE_TYPE_WATER = 0x4,
DAMAGE_TYPE_ICE = 0x8,
DAMAGE_TYPE_MAGIC = 0x10,
DAMAGE_TYPE_ELECTRIC = 0x20,
DAMAGE_TYPE_SMASH = 0x40,
DAMAGE_TYPE_JUMP = 0x80,
DAMAGE_TYPE_COSMIC = 0x100,
DAMAGE_TYPE_BLAST = 0x200,
DAMAGE_TYPE_P_O_W = 0x400,
DAMAGE_TYPE_QUAKE = 0x800,
DAMAGE_TYPE_THROW = 0x40000,
DAMAGE_TYPE_IGNORE_DEFENSE = 0x8000000,
DAMAGE_TYPE_FIRE = 0x00000002,
DAMAGE_TYPE_WATER = 0x00000004,
DAMAGE_TYPE_ICE = 0x00000008,
DAMAGE_TYPE_MAGIC = 0x00000010,
DAMAGE_TYPE_ELECTRIC = 0x00000020,
DAMAGE_TYPE_SMASH = 0x00000040,
DAMAGE_TYPE_JUMP = 0x00000080,
DAMAGE_TYPE_COSMIC = 0x00000100,
DAMAGE_TYPE_BLAST = 0x00000200,
DAMAGE_TYPE_POW = 0x00000400,
DAMAGE_TYPE_QUAKE = 0x00000800,
DAMAGE_TYPE_THROW = 0x00040000,
DAMAGE_TYPE_IGNORE_DEFENSE = 0x08000000,
DAMAGE_TYPE_NO_CONTACT = 0x10000000,
DAMAGE_TYPE_UNBLOCKABLE = 0x20000000,
DAMAGE_TYPE_TRIGGER_LUCKY = 0x80000000,
@ -1455,7 +1458,7 @@ enum DamageTypes {
typedef s8 PartnerID;
enum PartnerIDs {
PARTNER_NONE = 0,
PARTNER_NONE,
PARTNER_GOOMBARIO,
PARTNER_KOOPER,
PARTNER_BOMBETTE,
@ -1471,7 +1474,7 @@ enum PartnerIDs {
/// @see gAreas
enum Areas {
AREA_KMR = 0,
AREA_KMR,
AREA_MAC,
AREA_TIK,
AREA_KGR,
@ -1501,240 +1504,4 @@ enum Areas {
AREA_TST,
};
enum Sprites {
SPRITE_WORLD_GOOMBARIO = 1,
SPRITE_WORLD_KOOPER,
SPRITE_WORLD_BOMBETTE,
SPRITE_WORLD_PARAKARRY,
SPRITE_WORLD_BOW,
SPRITE_WORLD_WATT,
SPRITE_WORLD_SUSHIE,
SPRITE_WORLD_LAKILESTER,
SPRITE_BATTLE_GOOMBARIO,
SPRITE_BATTLE_KOOPER,
SPRITE_BATTLE_BOMBETTE,
SPRITE_BATTLE_PARAKARRY,
SPRITE_BATTLE_BOW,
SPRITE_BATTLE_WATT,
SPRITE_BATTLE_SUSHIE,
SPRITE_BATTLE_LAKILESTER,
SPRITE_KOOPER_WITHOUT_SHELL,
SPRITE_WORLD_ELDSTAR,
SPRITE_WORLD_MAMAR,
SPRITE_WORLD_SKOLAR,
SPRITE_WORLD_MUSKULAR,
SPRITE_WORLD_MISSTAR,
SPRITE_WORLD_KLEVAR,
SPRITE_WORLD_KALMAR,
SPRITE_BATTLE_ELDSTAR,
SPRITE_BATTLE_MAMAR,
SPRITE_BATTLE_SKOLAR,
SPRITE_BATTLE_MUSKULAR,
SPRITE_BATTLE_MISSTAR,
SPRITE_BATTLE_KLEVAR,
SPRITE_BATTLE_KALMAR,
SPRITE_TWINK,
SPRITE_JR_TROOPA,
SPRITE_SPIKED_JR_TROOPA,
SPRITE_SPIKED_PARA_JR_TROOPA,
SPRITE_MAGE_JR_TROOPA,
SPRITE_PARA_JR_TROOPA,
SPRITE_GOOMBA,
SPRITE_SPIKED_GOOMBA,
SPRITE_PARAGOOMBA,
SPRITE_KOOPA_TROOPA,
SPRITE_PARA_TROOPA,
SPRITE_FUZZY,
SPRITE_BOMBOMB,
SPRITE_BULLET_BILL,
SPRITE_BILL_BLASTER,
SPRITE_MONTY_MOLE,
SPRITE_CLEFT,
SPRITE_POKEY,
SPRITE_BANDIT,
SPRITE_BUZZY_BEETLE,
SPRITE_SWOOPER,
SPRITE_STONE_CHOMP,
SPRITE_PUTRID_PIRANHA,
SPRITE_PIRANHA_PLANT,
SPRITE_SENTINEL,
SPRITE_WORLD_CLUBBA,
SPRITE_BATTLE_CLUBBA,
SPRITE_SHY_GUY,
SPRITE_GROOVE_GUY,
SPRITE_SKY_GUY,
SPRITE_PYRO_GUY,
SPRITE_SPY_GUY,
SPRITE_MEDI_GUY,
SPRITE_FUZZIPEDE,
SPRITE_JUNGLE_GUY,
SPRITE_HEART_PLANT,
SPRITE_HURT_PLANT,
SPRITE_M_BUSH,
SPRITE_BUBBLE,
SPRITE_KENT_C_KOOPA,
SPRITE_DAYZEE,
SPRITE_LAKITU,
SPRITE_SPINY,
SPRITE_BZZAP,
SPRITE_RUFF_PUFF,
SPRITE_SPIKE_TOP,
SPRITE_DUPLIGHOST,
SPRITE_ALBINO_DINO,
SPRITE_BLOOPER,
SPRITE_BABY_BLOOPER,
SPRITE_GULPIT,
SPRITE_DRY_BONES,
SPRITE_THROWN_BONE,
SPRITE_BONY_BEETLE,
SPRITE_MAGIKOOPA,
SPRITE_FLYING_MAGIKOOPA,
SPRITE_WORLD_KOOPATROL,
SPRITE_KOOPATROL,
SPRITE_HAMMER_BROS,
SPRITE_BUSH_BASIC,
SPRITE_BUSH_BLOCKY,
SPRITE_BUSH_DRY,
SPRITE_BUSH_LEAFY,
SPRITE_BUSH_MATTED,
SPRITE_WORLD_KAMMY,
SPRITE_BATTLE_KAMMY,
SPRITE_GOOMBA_BROS,
SPRITE_GOOMBA_KING,
SPRITE_SPIKY_GOOMNUT,
SPRITE_DARK_TOAD,
SPRITE_KOOPA_BROS,
SPRITE_BUZZAR,
SPRITE_TUTANKOOPA,
SPRITE_CHAIN_CHOMP,
SPRITE_WORLD_TUBBA,
SPRITE_BATTLE_TUBBA,
SPRITE_TUBBAS_HEART,
SPRITE_BIG_LANTERN_GHOST,
SPRITE_SHY_SQUAD_GUY,
SPRITE_MARSHAL_GUY,
SPRITE_STILT_GUY,
SPRITE_STILT_GUY_UNFOLD,
SPRITE_SHY_STACK_GUY,
SPRITE_SHY_STACK_UNFOLD,
SPRITE_SHY_STACK_DAMAGE,
SPRITE_SHY_STACK_ROCK,
SPRITE_GENERAL_GUY,
SPRITE_GENERAL_GUY_BOMB,
SPRITE_TANK_GUY,
SPRITE_LAVA_PIRANHA_HEAD,
SPRITE_PETIT_PIRANHA,
SPRITE_LAVA_BUD,
SPRITE_HUFF_N_PUFF,
SPRITE_TUFF_PUFF,
SPRITE_MONSTAR,
SPRITE_CRYSTAL_KING,
SPRITE_WORLD_BOWSER,
SPRITE_BATTLE_BOWSER,
SPRITE_LUIGI,
SPRITE_TOAD,
SPRITE_THREE_SISTERS,
SPRITE_VANNA_T,
SPRITE_TOAD_KID,
SPRITE_TOAD_GUARD,
SPRITE_HARRY_T,
SPRITE_TOAD_MINISTER,
SPRITE_POSTMASTER,
SPRITE_CONDUCTOR_TOAD,
SPRITE_TRAIN_STATION_TOAD,
SPRITE_FISHMAEL,
SPRITE_ARTIST_TOAD,
SPRITE_KOOPA,
SPRITE_KOOPA_WITHOUT_SHELL,
SPRITE_WORLD_BOMBOMB,
SPRITE_WHACKA,
SPRITE_DRYITE,
SPRITE_MOUSER,
SPRITE_BOO,
SPRITE_YOSHI,
SPRITE_YOSHI_KID,
SPRITE_RAVEN,
SPRITE_BUBULB,
SPRITE_PENGUIN,
SPRITE_SHIVER_TOAD,
SPRITE_ALT_BANDIT,
SPRITE_GOOMPA,
SPRITE_GOOMBARIA,
SPRITE_GOOMA,
SPRITE_GOOMPAPA,
SPRITE_GOOMAMA,
SPRITE_THE_MASTER,
SPRITE_CHAN,
SPRITE_LEE,
SPRITE_MERLON,
SPRITE_CHET_RIPPO,
SPRITE_ROWF,
SPRITE_MINH_T,
SPRITE_RUSS_T,
SPRITE_TAYCE_T,
SPRITE_FICE_T,
SPRITE_BARTENDER,
SPRITE_CHANTERELLE,
SPRITE_RIP_CHEATO,
SPRITE_CHUCK_QUIZMO,
SPRITE_MERLUVLEE,
SPRITE_MERLAR,
SPRITE_MERLOW,
SPRITE_STAR_KID,
SPRITE_KOLORADO_WIFE,
SPRITE_KOOPA_KOOT,
SPRITE_KOLORADO,
SPRITE_BATTLE_KOLORADO,
SPRITE_ARCHEOLOGIST,
SPRITE_NOMADIMOUSE,
SPRITE_WORLD_MERLEE,
SPRITE_BATTLE_MERLEE,
SPRITE_DISGUISED_MOUSTAFA,
SPRITE_MOUSTAFA,
SPRITE_OAKLIE,
SPRITE_BOOTLER,
SPRITE_YAKKEY,
SPRITE_GOURMET_GUY,
SPRITE_VILLAGE_LEADER,
SPRITE_LEADERS_FRIEND,
SPRITE_RAFAEL_RAVEN,
SPRITE_TOLIELUP,
SPRITE_GATE_FLOWER,
SPRITE_PETUNIA,
SPRITE_POSIE,
SPRITE_LILY,
SPRITE_ROSIE,
SPRITE_SUN,
SPRITE_LAKILULU,
SPRITE_NINJI,
SPRITE_MAYOR_PENGUIN,
SPRITE_MAYOR_PENGUIN_WIFE,
SPRITE_PENGUIN_PATROL,
SPRITE_HERRINGWAY,
SPRITE_MERLE,
SPRITE_STAR_ROD,
SPRITE_FIRE,
SPRITE_COIN,
SPRITE_PARADE_PEACH,
SPRITE_PARADE_KOOPAS,
SPRITE_PARADE_BURNT_BOWSER,
SPRITE_PARADE_LUIGI,
SPRITE_PARADE_PARTNERS,
SPRITE_PARADE_YOSHIS,
SPRITE_PARADE_KOLORADOS,
SPRITE_PARADE_CHICKS,
SPRITE_PARADE_ICE_SHOW,
SPRITE_PARADE_TOADS,
SPRITE_PARADE_BATONS,
SPRITE_PARADE_DRUMS,
SPRITE_PARADE_FLAGS,
SPRITE_PARADE_HORNS,
SPRITE_PARADE_TUBBA_BALLOON,
SPRITE_PARADE_WIZARDS,
SPRITE_PARADE_MARIO,
SPRITE_PARADE_SHY_GUYS,
SPRITE_PARADE_TWINK,
SPRITE_LEAF,
};
#endif

View File

@ -51,10 +51,10 @@ void func_80036130(void) {
D_800A0944 = 0x00;
if (gGameStatusPtr->prevArea != gGameStatusPtr->areaID) {
gGameStatusPtr->changedArea = 1;
gGameStatusPtr->didAreaChange = TRUE;
gGameStatusPtr->prevArea = gGameStatusPtr->areaID;
} else {
gGameStatusPtr->changedArea = 0;
gGameStatusPtr->didAreaChange = FALSE;
}
}

View File

@ -113,40 +113,45 @@ void disable_npc_shadow(Npc* npc) {
func_802DE2AC(s32 arg0, s32 arg1, f32 arg2);
void set_npc_sprite(Npc* npc, s32 arg1, s32 arg2) {
void set_npc_sprite(Npc* npc, s32 anim, s32 arg2) {
s32 flagsTemp;
ASSERT(((npc->flags & 0x1000000)) || (func_802DE5E8(npc->unk_24) == 0));
ASSERT((npc->flags & 0x1000000) || func_802DE5E8(npc->unk_24) == 0);
npc->unk_B0 = arg2;
if (!(npc->flags & 0x1000000)) {
npc->unk_24 = func_802DE0EC(arg1, arg2);
ASSERT(!(npc->unk_24 < 0));
npc->unk_24 = func_802DE0EC(anim, arg2);
ASSERT(npc->unk_24 >= 0);
}
flagsTemp = npc->flags;
npc->currentAnim = arg1;
npc->currentAnim = anim;
if (!(flagsTemp & 0x40000000)) {
if (!(flagsTemp & 0x1000000)) {
func_802DE2AC(npc->unk_24, arg1, npc->animationSpeed);
func_802DE2AC(npc->unk_24, anim, npc->animationSpeed);
}
}
}
void enable_npc_blur(Npc* npc) {
NpcBlurData* blurData;
BlurBuffer* blurBuf;
s32 i;
if (!(npc->flags & 0x100000)) {
npc->flags |= 0x100000;
blurData = heap_malloc(sizeof(NpcBlurData));
npc->blurData = blurData;
ASSERT(blurData != NULL);
blurData->unk_00 = 0;
blurData->unk_01 = 0;
for (i = 0; i < ARRAY_COUNT(blurData->xpos); i++) {
blurData->xpos[i] = npc->pos.x;
blurData->ypos[i] = npc->pos.y;
blurData->zpos[i] = npc->pos.z;
blurBuf = heap_malloc(sizeof(BlurBuffer));
npc->blurBuf = blurBuf;
ASSERT(blurBuf != NULL);
blurBuf->unk_00 = 0;
blurBuf->index = 0;
for (i = 0; i < ARRAY_COUNT(blurBuf->x); i++) {
blurBuf->x[i] = npc->pos.x;
blurBuf->y[i] = npc->pos.y;
blurBuf->z[i] = npc->pos.z;
}
}
}
@ -154,28 +159,29 @@ void enable_npc_blur(Npc* npc) {
void disable_npc_blur(Npc* npc) {
if (npc->flags & 0x100000) {
npc->flags &= ~0x100000;
heap_free(npc->blurData);
npc->blurData = NULL;
heap_free(npc->blurBuf);
npc->blurBuf = NULL;
}
}
void update_npc_blur(Npc* npc) {
NpcBlurData* blurData = npc->blurData;
s32 index = blurData->unk_01;
BlurBuffer* blurBuf = npc->blurBuf;
s32 index = blurBuf->index;
blurData->xpos[index] = npc->pos.x;
blurData->ypos[index] = npc->pos.y;
blurData->zpos[index] = npc->pos.z;
blurBuf->x[index] = npc->pos.x;
blurBuf->y[index] = npc->pos.y;
blurBuf->z[index] = npc->pos.z;
index++;
if (index >= 20) {
index = 0;
}
blurData->unk_01 = index;
blurBuf->index = index;
}
INCLUDE_ASM(s32, "code_13870_len_6980", appedGfx_npc_blur);
INCLUDE_ASM(s32, "code_13870_len_6980", appendGfx_npc_blur);
INCLUDE_ASM(s32, "code_13870_len_6980", func_8003B184);
@ -290,6 +296,7 @@ INCLUDE_ASM(s32, "code_13870_len_6980", func_8003E0D4);
INCLUDE_ASM(s32, "code_13870_len_6980", func_8003E1D0);
/// @see set_defeated
void COPY_set_defeated(s32 mapID, s32 encounterID) {
EncounterStatus* currentEncounter = &gCurrentEncounter;
s32 encounterIdx = encounterID / 32;
@ -300,6 +307,13 @@ void COPY_set_defeated(s32 mapID, s32 encounterID) {
encounterShift = flag;
flag = currentEncounter->defeatFlags[mapID][encounterIdx];
currentEncounter->defeatFlags[mapID][encounterIdx] = flag | (1 << encounterShift);
// TODO: The below should work but has regalloc issues:
/*EncounterStatus *currentEncounter = &gCurrentEncounter;
s32 encounterIdx = encounterID / 32;
s32 encounterShift = encounterID % 32;
currentEncounter->defeatFlags[mapID][encounterIdx] |= (1 << encounterShift);*/
}
void func_8003E338(void) {
@ -319,6 +333,7 @@ void func_8003E338(void) {
currentEncounter->npcGroupList = 0;
currentEncounter->unk_08 = 0;
currentEncounter->dropWhackaBump = 0;
for (i = 0; i < ARRAY_COUNT(currentEncounter->defeatFlags); i++) {
for (j = 0; j < ARRAY_COUNT(currentEncounter->defeatFlags[i]); j++) {
currentEncounter->defeatFlags[i][j] = 0;
@ -344,14 +359,14 @@ void clear_encounter_status(void) {
currentEncounter->encounterList[i] = 0;
}
if (gGameStatusPtr->changedArea != 0) {
if (gGameStatusPtr->didAreaChange) {
for (i = 0; i < ARRAY_COUNT(currentEncounter->defeatFlags); i++) {
for (j = 0; j < ARRAY_COUNT(currentEncounter->defeatFlags[i]); j++) {
currentEncounter->defeatFlags[i][j] = 0;
}
}
if (gGameStatusPtr->changedArea != 0) {
if (gGameStatusPtr->didAreaChange) {
for (i = 0; i < ARRAY_COUNT(currentEncounter->recentMaps); i++) {
currentEncounter->recentMaps[i] = -1;
}
@ -369,9 +384,10 @@ void clear_encounter_status(void) {
currentEncounter->npcGroupList = 0;
currentEncounter->unk_08 = 0;
currentEncounter->unk_12 = 0;
func_80045AC0();
gGameState = 0;
bind_dynamic_entity_3(0, func_8003E670);
bind_dynamic_entity_3(NULL, func_8003E670);
}
void func_8003E50C(void) {
@ -402,6 +418,7 @@ void update_counters(void) {
update_encounters_post_battle();
break;
}
update_merlee_messages();
}
@ -425,6 +442,7 @@ void draw_encounter_ui(void) {
draw_encounters_post_battle();
break;
}
draw_merlee_messages();
}
@ -439,29 +457,30 @@ void draw_first_strike_ui(void) {
void func_8003E670(void) {
}
void make_npcs(s8 flags, s8 mapID, s32* NpcGroupList) {
void make_npcs(s8 flags, s8 mapID, s32* npcGroupList) {
EncounterStatus* currentEncounter = &gCurrentEncounter;
s32 i;
s32 j;
currentEncounter->resetMapEncounterFlags = flags;
currentEncounter->mapID = mapID;
currentEncounter->npcGroupList = NpcGroupList;
if (gGameStatusPtr->changedArea != 0) {
currentEncounter->npcGroupList = npcGroupList;
if (gGameStatusPtr->didAreaChange) {
for (i = 0; i < ARRAY_COUNT(currentEncounter->defeatFlags); i++) {
for (j = 0; j < ARRAY_COUNT(currentEncounter->defeatFlags[i]); j++) {
currentEncounter->defeatFlags[i][j] = 0;
}
}
if (gGameStatusPtr->changedArea != 0) {
if (gGameStatusPtr->didAreaChange) {
for (i = 0; i < ARRAY_COUNT(currentEncounter->recentMaps); i++) {
currentEncounter->recentMaps[i] = -1;
}
}
}
if (NpcGroupList != NULL) {
if (npcGroupList != NULL) {
gGameState = 1;
D_8009A678 = 1;
D_8009A5D0 = 0;

View File

@ -33,31 +33,31 @@ void clear_player_data(void) {
playerData->currentPartner = 0;
for (i = 0; i < ARRAY_COUNT(playerData->partners); i++) {
playerData->partners[i].enabled = 0;
playerData->partners[i].enabled = FALSE;
playerData->partners[i].level = 0;
playerData->partners[i].unk_02[0] = 0;
playerData->partners[i].unk_02[1] = 0;
playerData->partners[i].unk_02[2] = 0;
}
for (i = ARRAY_COUNT(playerData->keyItems) - 1; i >= 0; i--) {
playerData->keyItems[i] = 0;
for (i = 0; i < ARRAY_COUNT(playerData->keyItems); i++) {
playerData->keyItems[i] = ITEM_NONE;
}
for (i = ARRAY_COUNT(playerData->badges) - 1; i >= 0; i--) {
playerData->badges[i] = 0;
for (i = 0; i < ARRAY_COUNT(playerData->badges); i++) {
playerData->badges[i] = ITEM_NONE;
}
for (i = ARRAY_COUNT(playerData->invItems) - 1; i >= 0; i--) {
playerData->invItems[i] = 0;
for (i = 0; i < ARRAY_COUNT(playerData->invItems); i++) {
playerData->invItems[i] = ITEM_NONE;
}
for (i = ARRAY_COUNT(playerData->equippedBadges) - 1; i >= 0; i--) {
playerData->equippedBadges[i] = 0;
for (i = 0; i < ARRAY_COUNT(playerData->equippedBadges); i++) {
playerData->equippedBadges[i] = ITEM_NONE;
}
for (i = ARRAY_COUNT(playerData->storedItems) - 1; i >= 0; i--) {
playerData->storedItems[i] = 0;
for (i = 0; i < ARRAY_COUNT(playerData->storedItems); i++) {
playerData->storedItems[i] = ITEM_NONE;
}
playerData->otherHitsTaken = 0;
@ -106,7 +106,7 @@ s32 add_item(s32 itemID) {
sort_items();
for (i = 0; i < ARRAY_COUNT(gPlayerData.invItems); i++) {
if (playerData->invItems[i] == 0) {
if (playerData->invItems[i] == ITEM_NONE) {
break;
}
}
@ -125,7 +125,7 @@ s32 get_item_count(void) {
s32 sum = 0;
for (i; i < ARRAY_COUNT(gPlayerData.invItems); i++) {
if (playerData->invItems[i] != 0) {
if (playerData->invItems[i] != ITEM_NONE) {
sum++;
}
}
@ -137,6 +137,7 @@ s32 get_item_empty_count(void) {
return ARRAY_COUNT(gPlayerData.invItems) - get_item_count();
}
/// @returns the index of the given item in the player's inventory, or -1 if not found
s32 find_item(s32 itemID) {
PlayerData* playerData = &gPlayerData;
StaticItem* item = &gItemTable[itemID];
@ -169,17 +170,18 @@ s32 find_item(s32 itemID) {
return i;
}
/// Bubbles up player inventory items such that all ITEM_NONE values are at the bottom.
void sort_items(void) {
PlayerData* playerData = &gPlayerData;
int j;
int i;
s32 j;
s32 i;
for (i = ARRAY_COUNT(playerData->invItems) - 2; i >= 0; i--) {
if (playerData->invItems[i] != 0) {
if (playerData->invItems[i] != ITEM_NONE) {
for (j = ARRAY_COUNT(playerData->invItems) - 1; i < j; j--) {
if (playerData->invItems[j] == 0) {
if (playerData->invItems[j] == ITEM_NONE) {
playerData->invItems[j] = playerData->invItems[i];
playerData->invItems[i] = 0;
playerData->invItems[i] = ITEM_NONE;
break;
}
}
@ -197,7 +199,7 @@ s32 add_badge(s32 itemID) {
}
for (i = 0; i < ARRAY_COUNT(playerData->badges); i++) {
if (playerData->badges[i] == 0) {
if (playerData->badges[i] == ITEM_NONE) {
break;
}
}
@ -215,7 +217,7 @@ s32 store_item(s32 itemID) {
s32 i;
for (i = 0; i < ARRAY_COUNT(gPlayerData.storedItems); i++) {
if (playerData->storedItems[i] == 0) {
if (playerData->storedItems[i] == ITEM_NONE) {
break;
}
}
@ -235,7 +237,7 @@ s32 get_stored_count(void) {
s32 sum = 0;
for (i; i < ARRAY_COUNT(gPlayerData.storedItems); i++) {
if (playerData->storedItems[i] != 0) {
if (playerData->storedItems[i] != ITEM_NONE) {
sum++;
}
}

View File

@ -25,7 +25,7 @@ void clear_area_flags(void) {
SaveData* saveFile = &gCurrentSaveFile;
s32 i;
if (gGameStatusPtr->changedArea) {
if (gGameStatusPtr->didAreaChange) {
for (i = 0; i < ARRAY_COUNT(saveFile->areaFlags); i++) {
saveFile->areaFlags[i] = 0;
}

View File

@ -173,18 +173,18 @@ INCLUDE_ASM(s32, "code_fa4c0_len_3bf0", func_802D663C);
ApiStatus RemoveKeyItemAt(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = get_variable(script, *args++);
s16* ptrKeyItems = (s16*) &gPlayerData.keyItems;
s16* ptrKeyItems = &gPlayerData.keyItems;
ptrKeyItems[index] = 0;
ptrKeyItems[index] = ITEM_NONE;
return ApiStatus_DONE2;
}
ApiStatus RemoveItemAt(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 index = get_variable(script, *args++);
s16* ptrInvItems = (s16*) &gPlayerData.invItems;
s16* ptrInvItems = &gPlayerData.invItems;
ptrInvItems[index] = 0;
ptrInvItems[index] = ITEM_NONE;
sort_items();
return ApiStatus_DONE2;
}
@ -202,7 +202,7 @@ ApiStatus AddKeyItem(ScriptInstance* script, s32 isInitialCall) {
}
for (i = 0; i < ARRAY_COUNT(playerData->keyItems); i++) {
if (playerData->keyItems[i] == 0) {
if (playerData->keyItems[i] == ITEM_NONE) {
break;
}
}
@ -319,7 +319,7 @@ ApiStatus RemoveItem(ScriptInstance* script, s32 isInitialCall) {
if (itemIndex >= 0) {
// This is `playerData->invItems[i]`, but we have to do weird
// pointer math to get the output asm to exactly match :/
*(playerData->invItems + i) = 0;
*(playerData->invItems + i) = ITEM_NONE;
}
sort_items();
@ -406,13 +406,13 @@ ApiStatus RemoveBadge(ScriptInstance* script, s32 isInitialCall) {
for (i = 0; i < ARRAY_COUNT(playerData->badges); i++) {
if (playerData->badges[i] == badge) {
playerData->badges[i] = 0;
playerData->badges[i] = ITEM_NONE;
}
}
for (i = 0; i < ARRAY_COUNT(playerData->equippedBadges); i++) {
if (playerData->equippedBadges[i] == badge) {
playerData->equippedBadges[i] = 0;
playerData->equippedBadges[i] = ITEM_NONE;
}
}
return ApiStatus_DONE2;

View File

@ -8,7 +8,7 @@ glabel D_800984C0
.section .text
glabel appedGfx_npc_blur
glabel appendGfx_npc_blur
/* 16238 8003AE38 27BDFF08 */ addiu $sp, $sp, -0xf8
/* 1623C 8003AE3C F7BC00E8 */ sdc1 $f28, 0xe8($sp)
/* 16240 8003AE40 4480E000 */ mtc1 $zero, $f28

View File

@ -149,8 +149,8 @@ glabel render_npcs
/* 15DEC 8003A9EC 4600018D */ trunc.w.s $f6, $f0
/* 15DF0 8003A9F0 E6260004 */ swc1 $f6, 4($s1)
/* 15DF4 8003A9F4 0220202D */ daddu $a0, $s1, $zero
/* 15DF8 8003A9F8 3C028004 */ lui $v0, %hi(appedGfx_npc_blur)
/* 15DFC 8003A9FC 2442AE38 */ addiu $v0, $v0, %lo(appedGfx_npc_blur)
/* 15DF8 8003A9F8 3C028004 */ lui $v0, %hi(appendGfx_npc_blur)
/* 15DFC 8003A9FC 2442AE38 */ addiu $v0, $v0, %lo(appendGfx_npc_blur)
/* 15E00 8003AA00 AE22000C */ sw $v0, 0xc($s1)
/* 15E04 8003AA04 24020011 */ addiu $v0, $zero, 0x11
/* 15E08 8003AA08 AE300008 */ sw $s0, 8($s1)

View File

@ -260,7 +260,7 @@ set_npc_sprite = 0x8003AC5C; // type:func rom:0x1605C
enable_npc_blur = 0x8003AD24; // type:func rom:0x16124
disable_npc_blur = 0x8003ADAC; // type:func rom:0x161AC
update_npc_blur = 0x8003ADF8; // type:func rom:0x161F8
appedGfx_npc_blur = 0x8003AE38; // type:func rom:0x16238
appendGfx_npc_blur = 0x8003AE38; // type:func rom:0x16238
func_8003B184 = 0x8003B184; // type:func rom:0x16584
func_8003B198 = 0x8003B198; // type:func rom:0x16598
func_8003B1A8 = 0x8003B1A8; // type:func rom:0x165A8