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

merge from upstream #104

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
  •  
  •  
  •  
87 changes: 44 additions & 43 deletions include/common_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ typedef s8 b8;

typedef s32 HitID;
typedef u32 AnimID;
typedef s32 HudElemID;

typedef struct {
u8 r, g, b, a;
Expand Down Expand Up @@ -651,59 +652,59 @@ typedef struct MusicProximityTrigger {
} MusicProximityTrigger; // size = 0x18

typedef struct StatusBar {
/* 0x00 */ s32 hpIconHIDs[2];
/* 0x08 */ s32 fpIconHIDs[2];
/* 0x10 */ s32 coinIconHID;
/* 0x14 */ s32 coinSparkleHID;
/* 0x18 */ s32 spIconHID;
/* 0x1C */ s32 spShineHID;
/* 0x20 */ s32 hpTimesHID;
/* 0x24 */ s32 fpTimesHID;
/* 0x28 */ s32 spTimesHID;
/* 0x2C */ s32 coinTimesHID;
/* 0x30 */ s32 starIconHID;
/* 0x00 */ HudElemID hpIconHIDs[2];
/* 0x08 */ HudElemID fpIconHIDs[2];
/* 0x10 */ HudElemID coinIconHID;
/* 0x14 */ HudElemID coinSparkleHID;
/* 0x18 */ HudElemID spIconHID;
/* 0x1C */ HudElemID spShineHID;
/* 0x20 */ HudElemID hpTimesHID;
/* 0x24 */ HudElemID fpTimesHID;
/* 0x28 */ HudElemID spTimesHID;
/* 0x2C */ HudElemID coinTimesHID;
/* 0x30 */ HudElemID starIconHID;
/* 0x34 */ s16 drawPosX; // base position of the whole bar
/* 0x36 */ s16 drawPosY; // base position of the whole bar, animated when it appears
/* 0x38 */ s16 showTimer;
/* 0x3A */ b8 hidden;
/* 0x3A */ b8 hidden; // current state of the status bar's visiblity
/* 0x3B */ b8 unk_3B;
/* 0x3C */ b8 unk_3C;
/* 0x3D */ s8 displayHP;
/* 0x3E */ s8 displayFP;
/* 0x3F */ char unk_3F;
/* 0x3F */ char pad_3F;
/* 0x40 */ s16 displayCoins;
/* 0x42 */ s16 displayStarpoints;
/* 0x44 */ s8 ignoreChanges; /* set != 0 to prevent automatic opening from HP/FP changes */
/* 0x45 */ b8 openInputDisabled;
/* 0x45 */ s8 alwaysShown; // when set, the status bar will always be shown. used while browsing a shop.
/* 0x47 */ s8 disabled; /* set != 0 for menu to be disabled completely */
/* 0x48 */ s16 displayStarPower;
/* 0x4A */ s8 hpBlinking; /* bool */
/* 0x4B */ s8 hpBlinkCounter;
/* 0x4C */ s8 hpBlinkTimer; /* until stop */
/* 0x4D */ s8 fpBlinking; /* bool */
/* 0x4E */ s8 fpBlinkCounter;
/* 0x4F */ s8 fpBlinkTimer; /* until stop */
/* 0x50 */ s8 spBlinking;
/* 0x51 */ s8 spBlinkCounter;
/* 0x52 */ s8 starpointsBlinking; /* bool */
/* 0x53 */ s8 starpointsBlinkCounter;
/* 0x54 */ s8 coinsBlinking; /* bool */
/* 0x55 */ s8 coinsBlinkCounter;
/* 0x56 */ s8 coinsBlinkTimer; /* until stop */
/* 0x57 */ s8 unk_57;
/* 0x58 */ s8 unk_58;
/* 0x59 */ s8 unk_59;
/* 0x5A */ s8 spBarsToBlink; /* how many sp bars to blink */
/* 0x5B */ char unk_5B;
/* 0x5C */ s32 coinCountTimesHID;
/* 0x60 */ s32 coinCountIconHID;
/* 0x64 */ s32 iconIndex12;
/* 0x68 */ s32 iconIndex13;
/* 0x6C */ s8 coinCounterHideTime;
/* 0x6D */ s8 unk_6D;
/* 0x6E */ s8 unk_6E;
/* 0x6F */ char unk_6F;
/* 0x4A */ b8 hpBlinking;
/* 0x4B */ s8 hpBlinkAnimTime;
/* 0x4C */ s8 hpBlinkTimeLeft;
/* 0x4D */ b8 fpBlinking;
/* 0x4E */ s8 fpBlinkAnimTime;
/* 0x4F */ s8 fpBlinkTimeLeft;
/* 0x50 */ b8 starPowerBlinking;
/* 0x51 */ s8 starPowerBlinkCounter;
/* 0x52 */ b8 starpointsBlinking;
/* 0x53 */ s8 starpointsBlinkAnimTime;
/* 0x54 */ b8 coinsBlinking;
/* 0x55 */ s8 coinsBlinkAnimTime;
/* 0x56 */ s8 coinsBlinkTimeLeft;
/* 0x57 */ s8 shimmerState;
/* 0x58 */ s8 shimmerTime;
/* 0x59 */ s8 shimmerLimit;
/* 0x5A */ s8 powBarsToBlink; // how many star power bars to blink
/* 0x5B */ char pad_5B;
/* 0x5C */ HudElemID coinCountTimesHID;
/* 0x60 */ HudElemID coinCountIconHID;
/* 0x64 */ HudElemID iconIndex12;
/* 0x68 */ HudElemID iconIndex13;
/* 0x6C */ s8 coinCounterHideDelay;
/* 0x6D */ s8 coinCountDisposeTime;
/* 0x6E */ s8 prevIgnoreChanges; // while the coin counter is open, ignoreChanges count is pushed here
/* 0x6F */ char pad_6F;
} StatusBar; // size = 0x70

typedef struct CameraInitData {
Expand Down Expand Up @@ -878,11 +879,11 @@ typedef struct BattleStatus {
/* 0x07B */ u8 damageTaken;
/* 0x07C */ s8 changePartnerAllowed;
/* 0x07D */ s8 menuStatus[4]; ///< -1 = automatically pick the first move, 0 = disabled, 1 = enabled
/* 0x081 */ s8 actionSuccess;
/* 0x082 */ char unk_82;
/* 0x081 */ s8 actionQuality; // degree of success for action command, -1 indicates failure, 0 is in progress, >0 is some degree of success
/* 0x082 */ s8 maxActionQuality; // seems to indicate the maximum positive value for actionQuality; never read and inconsistently used between various action commands
/* 0x083 */ s8 actionCommandMode;
/* 0x084 */ s8 actionQuality; // actionCommandVar1 ?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rename is likely to cause very subtle problems (actionQuality changing meaning). We should be sure to let users know of it if they've touched action command code

/* 0x085 */ s8 unk_85; // actionCommandVar2 ?
/* 0x084 */ s8 actionProgress;
/* 0x085 */ s8 resultTier;
/* 0x086 */ s8 actionResult; // see enum ActionResult
/* 0x087 */ s8 blockResult; // see enum BlockResult
/* 0x088 */ s8 itemUsesLeft; /* set to 2 for double dip, 3 for triple dip */
Expand Down
2 changes: 1 addition & 1 deletion include/effect_shims.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ b32 shim_npc_raycast_down_sides(s32, f32*, f32*, f32*, f32*);
s32 shim_load_effect(s32 effectIndex);
float shim_sqrtf(float value);
void shim_mdl_draw_hidden_panel_surface(Gfx**, u16 treeIndex);
s32 shim_is_point_visible(f32, f32, f32, s32, f32*, f32*);
b32 shim_is_point_visible(f32, f32, f32, s32, f32*, f32*);
void shim_guPerspectiveF(f32 mf[4][4], u16* perspNorm, f32 fovy, f32 aspect, f32 near, f32 far, f32 scale);
void shim_transform_point(Matrix4f mtx, f32 inX, f32 inY, f32 inZ, f32 inS, f32* outX, f32* outY, f32* outZ, f32* outW);
void shim_guPositionF(float mf[4][4], float r, float p, float h, float s, float x, float y, float z);
Expand Down
18 changes: 9 additions & 9 deletions include/effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -2596,14 +2596,14 @@ typedef union {
struct PinkSparklesFXData* pinkSparkles;
struct StarOutlineFXData* starOutline;
struct Effect86FXData* unk_86;
} EffectData;
} EffectInstanceDataPtr;

typedef struct EffectInstance {
/* 0x00 */ s32 flags;
/* 0x04 */ s32 effectIndex;
/* 0x04 */ s32 effectID;
/* 0x08 */ s32 numParts;
/* 0x0C */ EffectData data;
/* 0x10 */ struct EffectGraphics* graphics;
/* 0x0C */ EffectInstanceDataPtr data;
/* 0x10 */ struct EffectSharedData* shared;
} EffectInstance; // size = 0x14

// composite struct for watt effects -- NOT the same as StaticStatusFXData
Expand Down Expand Up @@ -2651,20 +2651,20 @@ typedef struct EffectBlueprint {
/* 0x04 */ s32 effectID;
/* 0x08 */ void (*init)(EffectInstance* effectInst);
/* 0x0C */ void (*update)(EffectInstance* effectInst);
/* 0x10 */ void (*renderWorld)(EffectInstance* effectInst);
/* 0x10 */ void (*renderScene)(EffectInstance* effectInst);
/* 0x14 */ void (*renderUI)(EffectInstance* effectInst);
} EffectBlueprint; // size = 0x18

typedef struct EffectGraphics {
typedef struct EffectSharedData {
/* 0x00 */ s32 flags;
/* 0x04 */ s32 effectIndex;
/* 0x08 */ s32 instanceCounter;
/* 0x0C */ s32 freeDelay;
/* 0x10 */ void (*update)(EffectInstance* effectInst);
/* 0x14 */ void (*renderWorld)(EffectInstance* effectInst);
/* 0x14 */ void (*renderScene)(EffectInstance* effectInst);
/* 0x18 */ void (*renderUI)(EffectInstance* effectInst);
/* 0x1C */ s32* data;
} EffectGraphics; // size = 0x20
/* 0x1C */ s32* graphics;
} EffectSharedData; // size = 0x20

typedef struct EffectTableEntry {
/* 0x00 */ void (*entryPoint);
Expand Down
35 changes: 17 additions & 18 deletions include/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ enum SoundIDs {
SOUND_FIRE_BAR_8_A = 0x0000033E,
SOUND_FIRE_BAR_9_A = 0x0000033F,
SOUND_FIRE_BAR_DEAD = 0x00000340,
SOUND_LRAW_CHARGE_BAR = 0x00000341,
SOUND_LRAW_CHARGE_METER = 0x00000341,
SOUND_POKEY_SWAY = 0x00000342, // same as SOUND_POKEY_LEAN_BACK?
SOUND_POKEY_WALK = 0x00000343,
SOUND_POKEY_LEAN_FORWARD = 0x00000344,
Expand Down Expand Up @@ -1643,7 +1643,7 @@ enum SoundIDs {
SOUND_LOOP_TIK_UNUSED3_FLOW3 = 0x8000003E, // #unused
SOUND_LOOP_TIK_UNUSED3_FLOW2 = 0x8000003F, // #unused
SOUND_LOOP_SAM_STAIRS_RISE = 0x80000040,
SOUND_LOOP_CHARGE_BAR = 0x80000041,
SOUND_LOOP_CHARGE_METER = 0x80000041,
SOUND_LOOP_CRYSTAL_BALL_GLOW = 0x80000042,
SOUND_LOOP_TIK18_WATER = 0x80000043,
SOUND_LOOP_TIK19_WATER = 0x80000044,
Expand Down Expand Up @@ -1960,12 +1960,12 @@ typedef enum HitResult {
} HitResult;

typedef enum ActionResult {
ACTION_RESULT_NONE = 127,
ACTION_RESULT_MINUS_4 = -4,
ACTION_RESULT_MINUS_2 = -2,
ACTION_RESULT_EARLY = -1,
ACTION_RESULT_FAIL = 0,
ACTION_RESULT_SUCCESS = 1,
ACTION_RESULT_NONE = 127,
ACTION_RESULT_METER_BELOW_HALF = -4, // certain mashing comamnds fail with this value
ACTION_RESULT_METER_NOT_ENOUGH = -2, // certain mashing comamnds fail with this value
ACTION_RESULT_EARLY = -1, // timing commands too early fail with this value
ACTION_RESULT_FAIL = 0, // simple failure to complete action command
ACTION_RESULT_SUCCESS = 1,
} ActionResult;

typedef enum BlockResult {
Expand Down Expand Up @@ -3476,10 +3476,10 @@ enum ActionCommand {
ACTION_COMMAND_BREAK_FREE = 0x00000004,
ACTION_COMMAND_WHIRLWIND = 0x00000005,
ACTION_COMMAND_STOP_LEECH = 0x00000006,
ACTION_COMMAND_07 = 0x00000007,
ACTION_COMMAND_UNUSED_FLEE = 0x00000007,
ACTION_COMMAND_DIZZY_SHELL = 0x00000008,
ACTION_COMMAND_FIRE_SHELL = 0x00000009,
ACTION_COMMAND_0A = 0x0000000A,
ACTION_COMMAND_UNUSED_MASH_A = 0x0000000A,
ACTION_COMMAND_BOMB = 0x0000000B,
ACTION_COMMAND_BODY_SLAM = 0x0000000C,
ACTION_COMMAND_AIR_LIFT = 0x0000000D,
Expand All @@ -3491,7 +3491,7 @@ enum ActionCommand {
ACTION_COMMAND_SPINY_SURGE = 0x00000013,
ACTION_COMMAND_HURRICANE = 0x00000014,
ACTION_COMMAND_SPOOK = 0x00000015,
ACTION_COMMAND_WATER_BLOCK = 0x00000016,
ACTION_COMMAND_THREE_CHANCES = 0x00000016,
ACTION_COMMAND_TIDAL_WAVE = 0x00000017,
};

Expand All @@ -3517,10 +3517,9 @@ enum EffectInstanceFlags {
FX_INSTANCE_FLAG_DISMISS = 0x00000010, // effect should perform cleanup and self-delete
};

enum EffectGfxDataFlags {
FX_GRAPHICS_DISABLED = 0x00000000,
FX_GRAPHICS_LOADED = 0x00000001,
FX_GRAPHICS_CAN_FREE = 0x00000002,
enum EffectSharedDataFlags {
FX_SHARED_DATA_LOADED = 0x00000001,
FX_SHARED_DATA_CAN_FREE = 0x00000002,
};

#include "move_enum.h"
Expand Down Expand Up @@ -5369,14 +5368,14 @@ enum FileMenuMessages {
/* 31 */ FILE_MESSAGE_HAS_BEEN_CREATED, // has been created.[End]
#if VERSION_PAL
// TODO: determine where these new entries should be placed
UNK1,
UNK2,
FILE_MESSAGE_PAL_UNK1,
FILE_MESSAGE_PAL_UNK2,
#endif
/* 32 */ FILE_MESSAGE_ENTER_A_FILE_NAME, // Enter a file name![End]
/* 33 */ FILE_MESSAGE_QUESTION, // ?[End]
/* 34 */ FILE_MESSAGE_PERIOD_34, // .[End]
#if VERSION_PAL
FILE_MESSAGE_BASE_UNK,
FILE_MESSAGE_PAL_UNK3,
#endif
};

Expand Down
13 changes: 7 additions & 6 deletions include/filemenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _FILEMENU_H_

#include "common.h"
#include "filemenu.h"

#define CENTER_WINDOW_X(id) (((gWindows[id].parent != WIN_NONE) \
? (gWindows[gWindows[id].parent].width / 2) \
Expand Down Expand Up @@ -53,20 +54,20 @@ extern MenuPanel* filemenu_menus[];

extern s32 filemenu_CopyToFileIdx;
extern s32 filemenu_pressedButtons;
extern s32 filemenu_cursorHudElem;
extern HudElemID filemenu_cursorHID;
extern s32 filemenu_heldButtons;
extern s8 filemenu_filename_pos;
extern s32 filemenu_CopyFromFileIdx;
extern s8 filemenu_currentMenu;
extern s32 filemenu_8024C09C;
extern s32 filemenu_cursorHudElemID[1];
extern HudElemID filemenu_cursorHIDs[1];
extern s32 filemenu_8024C0A4[3];
extern s32 filemenu_hudElemIDs[20];
extern s32 filemenu_createfile_hudElems[4];
extern HudElemID filemenu_mainHIDs[20];
extern HudElemID filemenu_createfile_HIDs[4];
extern u8 filemenu_filename[8];

#if VERSION_PAL
extern s32 D_802517D0[1];
extern HudElemID PauseLanguageHIDs[1];
extern s32 D_802517D4[1];
extern u16 D_802517E0[2][0x400];
extern u8 D_filemenu_8025095C[4];
Expand All @@ -79,7 +80,7 @@ extern u8 D_filemenu_8025095C[4];
f32* scaleX, f32* scaleY,\
f32* rotX, f32* rotY, f32* rotZ,\
s32* darkening,\
s32* opacity);\
s32* opacity)

WINDOW_UPDATE_FUNC(filemenu_update_show_name_input);
WINDOW_UPDATE_FUNC(filemenu_update_show_options_left);
Expand Down
31 changes: 11 additions & 20 deletions include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ void pause_handle_input(s32 buttonsPressed, s32 buttonsHeld);
void pause_cleanup(void);

// file menu stuff
void filemenu_init(s32);
void filemenu_init(s32 mode);
void filemenu_cleanup(void);
void filemenu_update(void);
s32 func_80244BC4(void);
s32 filemenu_get_exit_mode(void);
void filemenu_set_selected(MenuPanel* menu, s32 col, s32 row);
void filemenu_set_cursor_alpha(s32 arg0);
void filemenu_set_cursor_goal_pos(s32 windowIndex, s32 posX, s32 posY);
Expand Down Expand Up @@ -784,14 +784,7 @@ void basic_ai_chase(Evt* script, MobileAISettings* npcAISettings, EnemyDetectVol
void basic_ai_lose_player(Evt* script, MobileAISettings* npcAISettings, EnemyDetectVolume* territory);
void basic_ai_suspend(Evt* script);

// This legally allows all functions to be pointers without warnings.
// Perhaps the void arg functions can be changed later to remove this need.
typedef union {
void (*func1)(Evt*, s32);
void (*func2)(void);
} WorldArgs TRANSPARENT_UNION;

s32 create_worker_world(WorldArgs, WorldArgs);
s32 create_worker_scene(void (*updateFunc)(void), void (*renderFunc)(void));

void init_entity_models(void);
f32 phys_get_spin_history(s32 lag, s32* x, s32* y, s32* z);
Expand All @@ -801,7 +794,7 @@ void imgfx_update_cache(void);
s32 imgfx_get_free_instances(s32);
void free_worker(s32);

s32 ai_check_fwd_collisions(Npc* npc, f32 arg1, f32* arg2, f32* arg3, f32* arg4, f32* arg5);
b32 ai_check_fwd_collisions(Npc* npc, f32 time, f32* outYaw, f32* outDistFwd, f32* outDistCW, f32* outDistCCW);
void basic_ai_loiter_init(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory);
void PatrolAI_LoiterInit(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory);

Expand All @@ -826,7 +819,7 @@ void* load_asset_by_name(const char* assetName, u32* decompressedSize);
Gfx* mdl_get_copied_gfx(s32 copyIndex);
void mdl_get_copied_vertices(s32 copyIndex, Vtx** firstVertex, Vtx** copiedVertices, s32* numCopied);
void mdl_draw_hidden_panel_surface(Gfx** arg0, u16 treeIndex);
s32 is_point_visible(f32 x, f32 y, f32 z, s32 depthQueryID, f32* screenX, f32* screenY);
b32 is_point_visible(f32 x, f32 y, f32 z, s32 depthQueryID, f32* screenX, f32* screenY);
void set_screen_overlay_center_worldpos(s32 idx, s32 posIdx, s32 x, s32 y, s32 z);
void* mdl_get_next_texture_address(s32);
s32 cancel_current_message(void);
Expand Down Expand Up @@ -945,12 +938,10 @@ b32 can_control_status_bar(void);
void status_bar_respond_to_changes(void);
void status_bar_always_show_on(void);
void status_bar_always_show_off(void);
void func_800F0CB0(s32, f32, f32, f32);
void func_800F0D5C(void);
void func_800F0D80(void);
void func_800F102C(void);


void star_power_shimmer_start(s32, f32, f32, f32);
void star_power_shimmer_init(void);
void star_power_shimmer_update(void);
void star_power_shimmer_draw(void);
void shop_open_item_select_popup(s32 mode);
void hide_coin_counter(void);
void set_message_text_var(s32 msgID, s32 index);
Expand Down Expand Up @@ -1001,8 +992,8 @@ void init_encounters_ui(void);
void initialize_collision(void);
void render_entities(void);
void render_player(void);
void render_workers_world(void);
void render_effects_world(void);
void render_workers_scene(void);
void render_effects_scene(void);
s32 get_asset_offset(char*, s32*);
void initialize_status_bar(void);
void status_bar_start_blinking_fp(void);
Expand Down
4 changes: 4 additions & 0 deletions include/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
#define SP_PER_BAR 256
#define SP_PER_SEG 32

#define AC_DIFFICULTY_LEN 8
typedef s32 Difficulty1D[AC_DIFFICULTY_LEN];
typedef s32 Difficulty2D[AC_DIFFICULTY_LEN][2];

#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240

Expand Down
Loading
Loading