diff --git a/include/common_structs.h b/include/common_structs.h index 7c75638e63b..55e428e6abd 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -29,6 +29,7 @@ typedef s8 b8; typedef s32 HitID; typedef u32 AnimID; +typedef s32 HudElemID; typedef struct { u8 r, g, b, a; @@ -651,26 +652,26 @@ 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 */ @@ -678,32 +679,32 @@ typedef struct StatusBar { /* 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 { @@ -912,11 +913,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 ? - /* 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 */ diff --git a/include/dead.h b/include/dead.h index 49a4dee21f8..0ceaa7f3951 100644 --- a/include/dead.h +++ b/include/dead.h @@ -122,7 +122,7 @@ #define GetNextPathPos dead_GetNextPathPos #define queue_render_task dead_queue_render_task #define dma_copy dead_dma_copy -#define create_worker_world dead_create_worker_world +#define create_worker_scene dead_create_worker_scene #define GetEntryID dead_GetEntryID #define SetMusicTrack dead_SetMusicTrack #define FadeInMusic dead_FadeInMusic diff --git a/include/effects.h b/include/effects.h index 9fe46e3cca0..3cf8cb886da 100644 --- a/include/effects.h +++ b/include/effects.h @@ -2606,14 +2606,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 @@ -2661,20 +2661,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); diff --git a/include/enums.h b/include/enums.h index 7447d741a72..46de96c4726 100644 --- a/include/enums.h +++ b/include/enums.h @@ -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, @@ -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, @@ -1961,12 +1961,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 { @@ -3477,10 +3477,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, @@ -3492,7 +3492,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, }; @@ -3518,10 +3518,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" diff --git a/include/filemenu.h b/include/filemenu.h index fcb085e030a..caead1bb787 100644 --- a/include/filemenu.h +++ b/include/filemenu.h @@ -2,6 +2,7 @@ #define _FILEMENU_H_ #include "common.h" +#include "filemenu.h" enum { PAGE_0, @@ -17,20 +18,20 @@ extern MenuPanel* filemenu_menus[]; extern s32 filemenu_iterFileIdx; extern s32 filemenu_pressedButtons; -extern s32 filemenu_cursorHudElem; +extern HudElemID filemenu_cursorHID; extern s32 filemenu_heldButtons; extern s8 filemenu_filename_pos; extern s32 filemenu_loadedFileIdx; 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]; diff --git a/include/functions.h b/include/functions.h index cc783fc12b7..047fd7b732a 100644 --- a/include/functions.h +++ b/include/functions.h @@ -796,14 +796,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); @@ -961,10 +954,10 @@ void status_bar_respond_to_changes(void); void status_bar_always_show_on(void); void status_bar_always_show_off(void); void func_800F0C9C(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); s32 get_item_count(void); s32 get_stored_empty_count(void); s32 get_stored_count(void); @@ -1020,8 +1013,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); diff --git a/include/macros.h b/include/macros.h index a46cf02bd5c..9f2ea1b9208 100644 --- a/include/macros.h +++ b/include/macros.h @@ -109,6 +109,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 diff --git a/include/map.h b/include/map.h index 262679e47ed..0e1f054be6f 100644 --- a/include/map.h +++ b/include/map.h @@ -7,14 +7,6 @@ #include "script_api/map.h" #include "npc.h" -// temporary: some standard script names -#define EVS_MakeEntities EVS_MakeEntities -#define EVS_SetupMusic EVS_SetupMusic -#define EVS_SetupRooms EVS_SetupRooms -#define EVS_SetupFoliage EVS_SetupFoliage -#define EVS_BindExitTriggers EVS_BindExitTriggers -#define EVS_EnterMap EVS_EnterMap - #define CLONED_MODEL(idx) (10000+(idx)) // TODO: consider moving Npc here diff --git a/include/npc.h b/include/npc.h index 8b3c52aae44..b1d822e1e19 100644 --- a/include/npc.h +++ b/include/npc.h @@ -385,7 +385,7 @@ typedef struct EncounterStatus { /* 0x008 */ s8 unk_08; /* 0x009 */ s8 battleOutcome; // see enum: EncounterOutcomes /* 0x00A */ s8 battleTriggerCooldown; ///< set to 15 after victory, 45 after fleeing - /* 0x00B */ b8 hasMerleeCoinBonus; /* triple coins when TRUE */ + /* 0x00B */ s8 hasMerleeCoinBonus; /* triple coins when TRUE */ /* 0x00C */ u8 damageTaken; /* valid after battle */ /* 0x00D */ char unk_0D; /* 0x00E */ s16 coinsEarned; /* valid after battle */ @@ -424,7 +424,7 @@ extern EncounterStatus gCurrentEncounter; #endif -b32 basic_ai_check_player_dist(EnemyDetectVolume* arg0, Enemy* arg1, f32 arg2, f32 arg3, b8 arg4); +b32 basic_ai_check_player_dist(EnemyDetectVolume* arg0, Enemy* arg1, f32 arg2, f32 arg3, s8 arg4); /// The default Npc::onUpdate and Npc::onRender callback. void STUB_npc_callback(Npc*); diff --git a/include/script_api/battle.h b/include/script_api/battle.h index 3b82ac42e08..f55bf1025df 100644 --- a/include/script_api/battle.h +++ b/include/script_api/battle.h @@ -206,7 +206,7 @@ API_CALLABLE(EnablePlayerBlur); API_CALLABLE(PlayerBasicJumpToGoal); API_CALLABLE(PlayerSuperJumpToGoal); API_CALLABLE(PlayerUltraJumpToGoal); -API_CALLABLE(GetPlayerActionSuccess); +API_CALLABLE(GetPlayerActionQuality); API_CALLABLE(BindTakeTurn); API_CALLABLE(PauseTakeTurn); API_CALLABLE(ResumeTakeTurn); @@ -283,7 +283,7 @@ API_CALLABLE(SetBattleCamTargetingModes); API_CALLABLE(UseBattleCamPresetImmediately); API_CALLABLE(UseBattleCamPresetWait); API_CALLABLE(HideHealthBar); -API_CALLABLE(GetPartnerActionSuccess); +API_CALLABLE(GetPartnerActionQuality); API_CALLABLE(CreateNpc); API_CALLABLE(EnableBattleStatusBar); API_CALLABLE(PlayerYieldTurn); diff --git a/include/variables.h b/include/variables.h index 5cd6b316f56..a135015a3ec 100644 --- a/include/variables.h +++ b/include/variables.h @@ -70,7 +70,7 @@ extern WindowStyle gWindowStyles[]; extern u16 gCurrentDoorSounds; extern u16 gCurrentRoomDoorSounds; -extern b8 D_8014C248; +extern s8 D_8014C248; extern UNK_FUN_PTR(TalkNotificationCallback); extern UNK_FUN_PTR(InteractNotificationCallback); diff --git a/src/23680.c b/src/23680.c index 8ae15119e2e..6a3af937776 100644 --- a/src/23680.c +++ b/src/23680.c @@ -409,7 +409,7 @@ b32 is_point_outside_territory(s32 shape, f32 centerX, f32 centerZ, f32 pointX, } } -b32 basic_ai_check_player_dist(EnemyDetectVolume* territory, Enemy* enemy, f32 radius, f32 fwdPosOffset, b8 useWorldYaw) { +b32 basic_ai_check_player_dist(EnemyDetectVolume* territory, Enemy* enemy, f32 radius, f32 fwdPosOffset, s8 useWorldYaw) { Npc* npc = get_npc_unsafe(enemy->npcID); PlayerStatus* playerStatus = &gPlayerStatus; PartnerStatus* partnerStatus; diff --git a/src/43F0.c b/src/43F0.c index 0119af72786..3af9f3c70e8 100644 --- a/src/43F0.c +++ b/src/43F0.c @@ -109,7 +109,6 @@ void* _heap_malloc(HeapNode* head, u32 size) { } } - // find out the required block size with header newBlockSize = size + sizeof(HeapNode); diff --git a/src/77480.c b/src/77480.c index 5fb2de7cd56..d7a56f87bdf 100644 --- a/src/77480.c +++ b/src/77480.c @@ -1524,7 +1524,6 @@ void render_player_model(void) { rtPtr->dist = -z; rtPtr->renderMode = playerStatus->renderMode; - if (!(playerStatus->flags & PS_FLAG_SPINNING)) { appendGfx = appendGfx_player; } else { diff --git a/src/8a160_len_700.c b/src/8a160_len_700.c deleted file mode 100644 index ed10463d0a7..00000000000 --- a/src/8a160_len_700.c +++ /dev/null @@ -1,183 +0,0 @@ -#include "common.h" -#include "include_asset.h" - -INCLUDE_IMG("A2960.png", D_801094B0); - -Vp D_801096B0 = { - .vp = { - .vscale = { 640, 480, 511, 0 }, - .vtrans = { 640, 480, 511, 0 } - } -}; - -#include "A2B70.vtx.inc.c" - -#include "A2BC0.gfx.inc.c" -#include "A2C88.gfx.inc.c" - -u8 D_80109800[32] = { - 40, 90, 81, 72, 65, 59, 53, 47, 43, 38, 34, 31, 28, 25, 22, 20, 18, 16, 15, 13, 12, 10, 9, 8, 7, 7, 6, 5, 5, 4, 0, 0 -}; - -Vec2b D_80109820[56] = { - { 247, 105 }, { 239, 87 }, { 17, 87 }, { 9, 105 }, { 0, 122 }, { 230, 69 }, { 26, 69 }, { 221, 52 }, { 35, 52 }, - { 202, 49 }, { 186, 255 }, { 200, 241 }, { 0, 200 }, { 56, 241 }, { 70, 255 }, { 54, 49 }, { 196, 222 }, - { 239, 191 }, { 17, 191 }, { 60, 222 }, { 85, 13 }, { 74, 46 }, { 99, 27 }, { 93, 43 }, { 12, 33 }, { 12, 22 }, - { 24, 22 }, { 24, 33 }, { 12, 10 }, { 24, 10 }, { 24, 45 }, { 232, 33 }, { 232, 22 }, { 232, 45 }, { 113, 40 }, - { 193, 203 }, { 190, 183 }, { 182, 46 }, { 163, 43 }, { 35, 182 }, { 52, 173 }, { 12, 45 }, { 244, 22 }, - { 244, 33 }, { 232, 10 }, { 244, 10 }, { 244, 45 }, { 204, 173 }, { 221, 182 }, { 186, 164 }, { 171, 13 }, - { 157, 27 }, { 143, 40 }, { 63, 203 }, { 66, 183 }, { 70, 164 } -}; - -typedef struct Unk8a160 { - /* 0x00 */ u8 alive; - /* 0x01 */ s8 timeLeft; - /* 0x02 */ u8 lifetime; - /* 0x03 */ Color_RGBA8 rgba; - /* 0x07 */ s8 lodVal; - /* 0x08 */ f32 x; - /* 0x0C */ f32 y; - /* 0x10 */ Vec2f vel; - /* 0x18 */ f32 scale; -} Unk8a160; // size = 0x1C - -typedef struct Unk8a160Outer { - /* 0x00 */ Unk8a160 subs[57]; // one base + 56 others? -} Unk8a160Outer; - -BSS Unk8a160Outer D_8010D000[1]; - -void func_800F0CB0(s32 arg0, f32 x, f32 y, f32 scale) { - Unk8a160Outer* outer = &D_8010D000[arg0]; - Unk8a160* sub = &outer->subs[0]; - s32 numSubstructs = ARRAY_COUNT(outer->subs); - s32 i; - - if (arg0 <= 0) { - sub->alive = TRUE; - sub->x = x; - sub->y = y; - sub->scale = scale; - sub->timeLeft = 40; - sub->lifetime = 0; - sub = &outer->subs[1]; - - for (i = 1; i < numSubstructs; i++, sub++) { - sub->lodVal = (s32) (-((f32) i) * 0.0f) - 1; - } - } -} - -void func_800F0D5C(void) { - Unk8a160Outer* outer = &D_8010D000[0]; - s32 i; - - for (i = 0; i < ARRAY_COUNT(D_8010D000); i++) { - outer[i].subs[0].alive = FALSE; - } -} - -void func_800F0D80(void) { - Unk8a160Outer* outer; - s32 i; - s32 j; - - for (i = 0; i < ARRAY_COUNT(D_8010D000); i++, outer++) { - outer = &D_8010D000[i]; - - if (outer->subs[0].alive) { - outer->subs[0].timeLeft--; - outer->subs[0].lifetime++; - - if (outer->subs[0].timeLeft < 0) { - outer->subs[0].alive = FALSE; - } else { - Unk8a160* sub = &outer->subs[0]; - s32 baseTimeLeft = sub->timeLeft; - f32 baseX = sub->x; - f32 baseY = sub->y; - - sub++; - for (j = 1; j < ARRAY_COUNT(outer->subs); j++, sub++) { - sub->lodVal++; - if (sub->lodVal >= 30) { - if (baseTimeLeft < 30) { - sub->lodVal = -31; - } else { - sub->lodVal = 0; - } - } - - if (sub->lodVal >= 0) { - if (sub->lodVal == 0) { - f32 tx = D_80109820[j - 1].x; - f32 ty = D_80109820[j - 1].y; - u8 t = 127; - - sub->vel.x = tx * 0.1; - sub->vel.y = -ty * 0.1; - sub->x = baseX; - sub->y = baseY; - sub->scale = 1.0f; - sub->rgba.r = rand_int(t); - sub->rgba.g = rand_int(t - sub->rgba.r); - sub->rgba.b = rand_int(t - sub->rgba.g - sub->rgba.r); - sub->rgba.a = 255; - sub->rgba.r += 128; - sub->rgba.g += 128; - sub->rgba.b += 128; - } - sub->x += sub->vel.x; - sub->y += sub->vel.y; - sub->vel.x *= 0.92; - sub->vel.y *= 0.92; - sub->scale = (f32) D_80109800[sub->lodVal] * 0.04; - } - } - } - } - } -} - -void func_800F102C(void) { - Matrix4f sp20, sp60; - Unk8a160Outer* outer; - s32 i; - s32 j; - - gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x00, 0x00000000); - gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - gSPViewport(gMainGfxPos++, &D_801096B0); - - guOrthoF(sp20, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, -100.0f, 100.0f, 1.0f); - guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); - - gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); - gSPDisplayList(gMainGfxPos++, D_80109710); - gDPSetEnvColor(gMainGfxPos++, 127, 127, 127, 127); - - for (i = 0; i < ARRAY_COUNT(D_8010D000); i++, outer++) { - outer = &D_8010D000[i]; - - if (outer->subs[0].alive) { - Unk8a160* it = &outer->subs[0]; - f32 baseScale = it->scale; - - it++; - for (j = 1; j < ARRAY_COUNT(outer->subs); j++, it++) { - if (it->lodVal >= 0) { - guPositionF(sp60, 0.0f, 0.0f, gGameStatusPtr->frameCounter * 10, it->scale * baseScale, - it->x, it->y, 0.0f); - guMtxF2L(sp60, &gDisplayContext->matrixStack[gMatrixListPos]); - - gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], - G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW); - gDPSetPrimColor(gMainGfxPos++, 0, 80 - it->lodVal, it->rgba.r, it->rgba.g, it->rgba.b, it->rgba.a); - gSPDisplayList(gMainGfxPos++, D_801097D8); - gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW); - } - } - } - } -} diff --git a/src/8a860_len_3f30.c b/src/8a860_len_3f30.c index c7823010859..3a8d6d85c77 100644 --- a/src/8a860_len_3f30.c +++ b/src/8a860_len_3f30.c @@ -89,14 +89,14 @@ BSS s8 PopupMenu_LastDisplayIndex; BSS s8 PopupMenu_DisplayedEntryCount; BSS s16 D_8010D658; BSS s16 D_8010D65A; -BSS s32 PopupMenu_EmptybarHEID; -BSS s32 PopupMenu_TitleIconHEID; -BSS s32 PopupMenu_TimesHEID; -BSS s32 PopupMenu_PartnerLevelHEID; -BSS s32 PopupMenu_CursorHEID; -BSS s32 PopupMenu_UpArrowHEID; -BSS s32 PopupMenu_DownArrowHEID; -BSS s32 PopupMenu_EntryIconHEID; +BSS HudElemID PopupMenu_EmptybarHID; +BSS HudElemID PopupMenu_TitleIconHID; +BSS HudElemID PopupMenu_TimesHID; +BSS HudElemID PopupMenu_PartnerLevelHID; +BSS HudElemID PopupMenu_CursorHID; +BSS HudElemID PopupMenu_UpArrowHID; +BSS HudElemID PopupMenu_DownArrowHID; +BSS HudElemID PopupMenu_EntryIconHID; BSS s16 D_8010D67C; BSS s16 D_8010D67E; BSS s16 D_8010D680; @@ -211,28 +211,28 @@ void hide_popup_menu(void) { } void destroy_popup_menu(void) { - hud_element_free(PopupMenu_EmptybarHEID); - hud_element_free(PopupMenu_EntryIconHEID); - hud_element_free(PopupMenu_CursorHEID); - hud_element_free(PopupMenu_UpArrowHEID); - hud_element_free(PopupMenu_DownArrowHEID); + hud_element_free(PopupMenu_EmptybarHID); + hud_element_free(PopupMenu_EntryIconHID); + hud_element_free(PopupMenu_CursorHID); + hud_element_free(PopupMenu_UpArrowHID); + hud_element_free(PopupMenu_DownArrowHID); if (gPopupMenu->popupType == POPUP_TYPE_TRADE_FOR_BADGE) { - hud_element_free(PopupMenu_TitleIconHEID); - hud_element_free(PopupMenu_TimesHEID); + hud_element_free(PopupMenu_TitleIconHID); + hud_element_free(PopupMenu_TimesHID); } if (gPopupMenu->popupType == POPUP_TYPE_UPGRADE_PARTNER) { - hud_element_free(PopupMenu_TitleIconHEID); - hud_element_free(PopupMenu_TimesHEID); + hud_element_free(PopupMenu_TitleIconHID); + hud_element_free(PopupMenu_TimesHID); } if (gPopupMenu->popupType == POPUP_TYPE_SWITCH_PARTNER || gPopupMenu->popupType == POPUP_TYPE_UPGRADE_PARTNER) { - hud_element_free(PopupMenu_PartnerLevelHEID); + hud_element_free(PopupMenu_PartnerLevelHID); } if (gPopupMenu->popupType == POPUP_TYPE_SELL_ITEM) { - hud_element_free(PopupMenu_TitleIconHEID); + hud_element_free(PopupMenu_TitleIconHID); } if ((gPopupMenu->popupType <= POPUP_TYPE_USE_ITEM || @@ -318,27 +318,27 @@ void func_800F16CC(void) { if (gPopupMenu->popupType == POPUP_MENU_SELL_ITEM) { set_window_update(WINDOW_ID_16, (s32) basic_window_update); } - hud_element_set_tint(PopupMenu_EmptybarHEID, 255, 255, 255); - hud_element_set_tint(PopupMenu_EntryIconHEID, 255, 255, 255); - hud_element_set_tint(PopupMenu_CursorHEID, 255, 255, 255); - hud_element_set_tint(PopupMenu_UpArrowHEID, 255, 255, 255); - hud_element_set_tint(PopupMenu_DownArrowHEID, 255, 255, 255); + hud_element_set_tint(PopupMenu_EmptybarHID, 255, 255, 255); + hud_element_set_tint(PopupMenu_EntryIconHID, 255, 255, 255); + hud_element_set_tint(PopupMenu_CursorHID, 255, 255, 255); + hud_element_set_tint(PopupMenu_UpArrowHID, 255, 255, 255); + hud_element_set_tint(PopupMenu_DownArrowHID, 255, 255, 255); if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) { - hud_element_set_tint(PopupMenu_TitleIconHEID, 255, 255, 255); - hud_element_set_tint(PopupMenu_TimesHEID, 255, 255, 255); + hud_element_set_tint(PopupMenu_TitleIconHID, 255, 255, 255); + hud_element_set_tint(PopupMenu_TimesHID, 255, 255, 255); } if (gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) { - hud_element_set_tint(PopupMenu_TitleIconHEID, 255, 255, 255); - hud_element_set_tint(PopupMenu_TimesHEID, 255, 255, 255); + hud_element_set_tint(PopupMenu_TitleIconHID, 255, 255, 255); + hud_element_set_tint(PopupMenu_TimesHID, 255, 255, 255); } if (gPopupMenu->popupType == POPUP_MENU_SWITCH_PARTNER || gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) { - hud_element_set_tint(PopupMenu_PartnerLevelHEID, 255, 255, 255); + hud_element_set_tint(PopupMenu_PartnerLevelHID, 255, 255, 255); } if (gPopupMenu->popupType == POPUP_MENU_SELL_ITEM) { - hud_element_set_tint(PopupMenu_TitleIconHEID, 255, 255, 255); + hud_element_set_tint(PopupMenu_TitleIconHID, 255, 255, 255); } - hud_element_set_script(PopupMenu_CursorHEID, &HES_AnimatedHandPointer); + hud_element_set_script(PopupMenu_CursorHID, &HES_AnimatedHandPointer); D_8010D690 = MSG_PAL_STANDARD; gPopupState = POPUP_STATE_20; } @@ -352,7 +352,7 @@ s32 popup_menu_update(void) { s32 posY; s32 width; s32 height; - s32 elementID; + HudElemID hid; s32 cond; s32 buttons; s32 msgID; @@ -425,61 +425,61 @@ s32 popup_menu_update(void) { #endif } D_8010D68C = 0; - elementID = hud_element_create(&HES_EmptyBar); - PopupMenu_EmptybarHEID = elementID; - hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80); - hud_element_set_tint(elementID, 255, 255, 255); + hid = hud_element_create(&HES_EmptyBar); + PopupMenu_EmptybarHID = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_set_tint(hid, 255, 255, 255); if (gPopupMenu->popupType != POPUP_MENU_THROW_AWAY_ITEM) { - hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } one = POPUP_MENU_SWITCH_PARTNER; // required to match (why is 1 loaded so early?) - elementID = hud_element_create(gPopupMenu->ptrIcon[0]); - PopupMenu_EntryIconHEID = elementID; - hud_element_set_scale(elementID, 0.45f); - hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_FILTER_TEX | HUD_ELEMENT_FLAG_80); + hid = hud_element_create(gPopupMenu->ptrIcon[0]); + PopupMenu_EntryIconHID = hid; + hud_element_set_scale(hid, 0.45f); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX | HUD_ELEMENT_FLAG_80); - elementID = hud_element_create(&HES_AnimatedHandPointer); - PopupMenu_CursorHEID = elementID; - hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); + hid = hud_element_create(&HES_AnimatedHandPointer); + PopupMenu_CursorHID = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); - elementID = hud_element_create(&HES_GreenArrowUp); - PopupMenu_UpArrowHEID = elementID; - hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); + hid = hud_element_create(&HES_GreenArrowUp); + PopupMenu_UpArrowHID = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); - elementID = hud_element_create(&HES_GreenArrowDown); - PopupMenu_DownArrowHEID = elementID; - hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); + hid = hud_element_create(&HES_GreenArrowDown); + PopupMenu_DownArrowHID = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) { - PopupMenu_TitleIconHEID = hud_element_create(&HES_StatusStarPiece); - elementID = PopupMenu_TitleIconHEID; - hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80); - hud_element_set_tint(elementID, 255, 255, 255); + PopupMenu_TitleIconHID = hud_element_create(&HES_StatusStarPiece); + hid = PopupMenu_TitleIconHID; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_set_tint(hid, 255, 255, 255); } if (gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) { - PopupMenu_TitleIconHEID = hud_element_create(&HES_StatusStarPiece); - elementID = PopupMenu_TitleIconHEID; - hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_FILTER_TEX | HUD_ELEMENT_FLAG_80); - hud_element_set_tint(elementID, 255, 255, 255); + PopupMenu_TitleIconHID = hud_element_create(&HES_StatusStarPiece); + hid = PopupMenu_TitleIconHID; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX | HUD_ELEMENT_FLAG_80); + hud_element_set_tint(hid, 255, 255, 255); } if (gPopupMenu->popupType == POPUP_MENU_SELL_ITEM) { - PopupMenu_TitleIconHEID = hud_element_create(&HES_StatusCoin); - elementID = PopupMenu_TitleIconHEID; - hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80); - hud_element_set_tint(elementID, 255, 255, 255); + PopupMenu_TitleIconHID = hud_element_create(&HES_StatusCoin); + hid = PopupMenu_TitleIconHID; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_set_tint(hid, 255, 255, 255); } if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE || gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) { - PopupMenu_TimesHEID = hud_element_create(&HES_MenuTimes); - elementID = PopupMenu_TimesHEID; - hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80); - hud_element_set_tint(elementID, 255, 255, 255); + PopupMenu_TimesHID = hud_element_create(&HES_MenuTimes); + hid = PopupMenu_TimesHID; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_set_tint(hid, 255, 255, 255); } if (gPopupMenu->popupType == one || gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) { - PopupMenu_PartnerLevelHEID = hud_element_create(D_80109890[0]); - elementID = PopupMenu_PartnerLevelHEID; - hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80); - hud_element_set_tint(elementID, 255, 255, 255); + PopupMenu_PartnerLevelHID = hud_element_create(D_80109890[0]); + hid = PopupMenu_PartnerLevelHID; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_set_tint(hid, 255, 255, 255); } D_8010D65A = -200; @@ -1118,25 +1118,25 @@ s32 popup_menu_update(void) { } break; case POPUP_STATE_CHOSE_WORLD: - hud_element_set_tint(PopupMenu_EmptybarHEID, 160, 160, 160); - hud_element_set_tint(PopupMenu_EntryIconHEID, 160, 160, 160); - hud_element_set_tint(PopupMenu_CursorHEID, 160, 160, 160); - hud_element_set_tint(PopupMenu_UpArrowHEID, 160, 160, 160); - hud_element_set_tint(PopupMenu_DownArrowHEID, 160, 160, 160); - hud_element_set_script(PopupMenu_CursorHEID, &HES_HandPointer); + hud_element_set_tint(PopupMenu_EmptybarHID, 160, 160, 160); + hud_element_set_tint(PopupMenu_EntryIconHID, 160, 160, 160); + hud_element_set_tint(PopupMenu_CursorHID, 160, 160, 160); + hud_element_set_tint(PopupMenu_UpArrowHID, 160, 160, 160); + hud_element_set_tint(PopupMenu_DownArrowHID, 160, 160, 160); + hud_element_set_script(PopupMenu_CursorHID, &HES_HandPointer); if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) { - hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160); - hud_element_set_tint(PopupMenu_TimesHEID, 160, 160, 160); + hud_element_set_tint(PopupMenu_TitleIconHID, 160, 160, 160); + hud_element_set_tint(PopupMenu_TimesHID, 160, 160, 160); } if (gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) { - hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160); - hud_element_set_tint(PopupMenu_TimesHEID, 160, 160, 160); + hud_element_set_tint(PopupMenu_TitleIconHID, 160, 160, 160); + hud_element_set_tint(PopupMenu_TimesHID, 160, 160, 160); } if (gPopupMenu->popupType == POPUP_MENU_SWITCH_PARTNER || gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) { - hud_element_set_tint(PopupMenu_PartnerLevelHEID, 160, 160, 160); + hud_element_set_tint(PopupMenu_PartnerLevelHID, 160, 160, 160); } if (gPopupMenu->popupType == POPUP_MENU_SELL_ITEM) { - hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160); + hud_element_set_tint(PopupMenu_TitleIconHID, 160, 160, 160); } D_8010D690 = MSG_PAL_0D; @@ -1247,26 +1247,26 @@ s32 popup_menu_update(void) { gPopupMenu->result = POPUP_RESULT_CHOOSING; break; case POPUP_STATE_CANCEL_DIP: - hud_element_set_tint(PopupMenu_EmptybarHEID, 160, 160, 160); - hud_element_set_tint(PopupMenu_EntryIconHEID, 160, 160, 160); - hud_element_set_tint(PopupMenu_CursorHEID, 160, 160, 160); - hud_element_set_tint(PopupMenu_UpArrowHEID, 160, 160, 160); - hud_element_set_tint(PopupMenu_DownArrowHEID, 160, 160, 160); - hud_element_set_script(PopupMenu_CursorHEID, &HES_HandPointer); + hud_element_set_tint(PopupMenu_EmptybarHID, 160, 160, 160); + hud_element_set_tint(PopupMenu_EntryIconHID, 160, 160, 160); + hud_element_set_tint(PopupMenu_CursorHID, 160, 160, 160); + hud_element_set_tint(PopupMenu_UpArrowHID, 160, 160, 160); + hud_element_set_tint(PopupMenu_DownArrowHID, 160, 160, 160); + hud_element_set_script(PopupMenu_CursorHID, &HES_HandPointer); if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) { - hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160); - hud_element_set_tint(PopupMenu_TimesHEID, 160, 160, 160); + hud_element_set_tint(PopupMenu_TitleIconHID, 160, 160, 160); + hud_element_set_tint(PopupMenu_TimesHID, 160, 160, 160); } if (gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) { - hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160); - hud_element_set_tint(PopupMenu_TimesHEID, 160, 160, 160); + hud_element_set_tint(PopupMenu_TitleIconHID, 160, 160, 160); + hud_element_set_tint(PopupMenu_TimesHID, 160, 160, 160); } if (gPopupMenu->popupType == POPUP_MENU_SWITCH_PARTNER || gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) { - hud_element_set_tint(PopupMenu_PartnerLevelHEID, 160, 160, 160); + hud_element_set_tint(PopupMenu_PartnerLevelHID, 160, 160, 160); } if (gPopupMenu->popupType == POPUP_MENU_SELL_ITEM) { - hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160); + hud_element_set_tint(PopupMenu_TitleIconHID, 160, 160, 160); } switch (gPopupMenu->popupType) { @@ -1336,26 +1336,26 @@ s32 popup_menu_update(void) { gPopupState = POPUP_STATE_MINUS_3; break; case POPUP_STATE_CANCEL_DIP_DECLINE: - hud_element_set_tint(PopupMenu_EmptybarHEID, 255, 255, 255); - hud_element_set_tint(PopupMenu_EntryIconHEID, 255, 255, 255); - hud_element_set_tint(PopupMenu_CursorHEID, 255, 255, 255); - hud_element_set_tint(PopupMenu_UpArrowHEID, 255, 255, 255); - hud_element_set_tint(PopupMenu_DownArrowHEID, 255, 255, 255); + hud_element_set_tint(PopupMenu_EmptybarHID, 255, 255, 255); + hud_element_set_tint(PopupMenu_EntryIconHID, 255, 255, 255); + hud_element_set_tint(PopupMenu_CursorHID, 255, 255, 255); + hud_element_set_tint(PopupMenu_UpArrowHID, 255, 255, 255); + hud_element_set_tint(PopupMenu_DownArrowHID, 255, 255, 255); if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) { - hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160); - hud_element_set_tint(PopupMenu_TimesHEID, 160, 160, 160); + hud_element_set_tint(PopupMenu_TitleIconHID, 160, 160, 160); + hud_element_set_tint(PopupMenu_TimesHID, 160, 160, 160); } if (gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) { - hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160); - hud_element_set_tint(PopupMenu_TimesHEID, 160, 160, 160); + hud_element_set_tint(PopupMenu_TitleIconHID, 160, 160, 160); + hud_element_set_tint(PopupMenu_TimesHID, 160, 160, 160); } if (gPopupMenu->popupType == POPUP_MENU_SWITCH_PARTNER || gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) { - hud_element_set_tint(PopupMenu_PartnerLevelHEID, 160, 160, 160); + hud_element_set_tint(PopupMenu_PartnerLevelHID, 160, 160, 160); } if (gPopupMenu->popupType == POPUP_MENU_SELL_ITEM) { - hud_element_set_tint(PopupMenu_TitleIconHEID, 160, 160, 160); + hud_element_set_tint(PopupMenu_TitleIconHID, 160, 160, 160); } - hud_element_set_script(PopupMenu_CursorHEID, &HES_HandPointer); + hud_element_set_script(PopupMenu_CursorHID, &HES_HandPointer); switch (gPopupMenu->popupType) { case POPUP_MENU_USE_ITEM: @@ -1479,7 +1479,7 @@ void popup_menu_draw_menu_contents(s32* userData, s32 baseX, s32 baseY, s32 widt if (gPopupMenu->popupType == POPUP_MENU_THROW_AWAY_ITEM) { y = baseY + D_8010D658 + 21; } - id = PopupMenu_EmptybarHEID; + id = PopupMenu_EmptybarHID; hud_element_set_render_pos(id, baseX + EMPTY_BAR_X, y - 3); hud_element_set_alpha(id, PopupMenu_Alpha); if (PopupMenu_MaxDisplayableEntryCount < gPopupMenu->numEntries) { @@ -1592,7 +1592,7 @@ void popup_menu_draw_menu_contents(s32* userData, s32 baseX, s32 baseY, s32 widt case POPUP_MENU_SWITCH_PARTNER: case POPUP_MENU_UPGRADE_PARTNER: for (j = 0; j < ARRAY_COUNT(D_80109890); j++) { - id = PopupMenu_PartnerLevelHEID; + id = PopupMenu_PartnerLevelHID; if (gPopupMenu->enabled[i]) { hud_element_set_script(id, D_80109890[j]); @@ -1651,7 +1651,7 @@ void popup_menu_draw_menu_contents(s32* userData, s32 baseX, s32 baseY, s32 widt y += offset; } } else { - id = PopupMenu_EntryIconHEID; + id = PopupMenu_EntryIconHID; hud_element_set_script(id, gPopupMenu->ptrIcon[i]); hud_element_set_render_pos(id, x, y); hud_element_set_alpha(id, PopupMenu_Alpha); @@ -1672,7 +1672,7 @@ void popup_menu_draw_menu_contents(s32* userData, s32 baseX, s32 baseY, s32 widt y += offset; } } else { - id = PopupMenu_EntryIconHEID; + id = PopupMenu_EntryIconHID; hud_element_set_script(id, gPopupMenu->ptrIcon[i]); hud_element_set_render_pos(id, x, y); hud_element_set_alpha(id, PopupMenu_Alpha); @@ -1693,7 +1693,7 @@ void popup_menu_draw_menu_contents(s32* userData, s32 baseX, s32 baseY, s32 widt y += offset; } } else { - id = PopupMenu_EntryIconHEID; + id = PopupMenu_EntryIconHID; hud_element_set_script(id, gPopupMenu->ptrIcon[i]); hud_element_set_render_pos(id, x, y); hud_element_set_alpha(id, PopupMenu_Alpha); @@ -1711,7 +1711,7 @@ void popup_menu_draw_menu_contents(s32* userData, s32 baseX, s32 baseY, s32 widt v0 = (PopupMenu_SelectedIndex - PopupMenu_FirstDisplayIndex) * LINE_HEIGHT; x = baseX + 8; y = baseY + 9 + v0; - id = PopupMenu_CursorHEID; + id = PopupMenu_CursorHID; if (gPopupMenu->popupType == POPUP_TYPE_THROW_AWAY_ITEM && PopupMenu_SelectedIndex == 0) { y -= 2; @@ -1812,7 +1812,7 @@ void popup_menu_draw_menu_contents(s32* userData, s32 baseX, s32 baseY, s32 widt } if (PopupMenu_FirstDisplayIndex > 0) { - id = PopupMenu_UpArrowHEID; + id = PopupMenu_UpArrowHID; x = baseX + offset; y = baseY; hud_element_set_render_pos(id, x + 35, y - 1); @@ -1821,7 +1821,7 @@ void popup_menu_draw_menu_contents(s32* userData, s32 baseX, s32 baseY, s32 widt } if (PopupMenu_LastDisplayIndex < gPopupMenu->numEntries) { - id = PopupMenu_DownArrowHEID; + id = PopupMenu_DownArrowHID; x = baseX + offset; y = baseY; y += PopupMenu_MaxDisplayableEntryCount * LINE_HEIGHT; @@ -2160,14 +2160,14 @@ void func_800F4C1C(s32* userData, s32 x, s32 y) { } void popup_draw_cost_icon(s32* userData, s32 x, s32 y) { - s32 hudElement; + HudElemID hid; s32 xPos; s32 yPos; switch (gPopupMenu->popupType) { case POPUP_TYPE_TRADE_FOR_BADGE: xPos = x + 16; - hudElement = PopupMenu_TitleIconHEID; + hid = PopupMenu_TitleIconHID; yPos = y + 16; break; #if VERSION_JP @@ -2177,16 +2177,16 @@ void popup_draw_cost_icon(s32* userData, s32 x, s32 y) { #endif case POPUP_TYPE_SELL_ITEM: xPos = x + 17; - hudElement = PopupMenu_TitleIconHEID; + hid = PopupMenu_TitleIconHID; yPos = y + 17; break; default: return; } - hud_element_set_render_pos(hudElement, xPos, yPos); - hud_element_set_alpha(hudElement, PopupMenu_Alpha); - hud_element_draw_clipped(hudElement); + hud_element_set_render_pos(hid, xPos, yPos); + hud_element_set_alpha(hid, PopupMenu_Alpha); + hud_element_draw_clipped(hid); } void popup_draw_already_have_partner(s32* userData, s32 x, s32 y) { @@ -2198,26 +2198,26 @@ void popup_draw_already_have_partner(s32* userData, s32 x, s32 y) { } void func_800F4D28(s32* userData, s32 x, s32 y) { - s32 hudElement = PopupMenu_TitleIconHEID; + HudElemID hid = PopupMenu_TitleIconHID; PlayerData* playerData = &gPlayerData; s32 xPos = x + 14; s32 yPos = y + 9; s32 type; - hud_element_set_alpha(hudElement, PopupMenu_Alpha); + hud_element_set_alpha(hid, PopupMenu_Alpha); if (gPopupMenu->popupType == POPUP_TYPE_TRADE_FOR_BADGE) { - hud_element_set_render_pos(hudElement, xPos, yPos); + hud_element_set_render_pos(hid, xPos, yPos); } else { - hud_element_set_render_pos(hudElement, xPos, y + 10); + hud_element_set_render_pos(hid, xPos, y + 10); } - hud_element_draw_clipped(hudElement); + hud_element_draw_clipped(hid); - hudElement = PopupMenu_TimesHEID; - hud_element_set_render_pos(hudElement, x + 26, y + 11); - hud_element_set_alpha(hudElement, PopupMenu_Alpha); - hud_element_draw_clipped(hudElement); + hid = PopupMenu_TimesHID; + hud_element_set_render_pos(hid, x + 26, y + 11); + hud_element_set_alpha(hid, PopupMenu_Alpha); + hud_element_draw_clipped(hid); type = gPopupMenu->popupType; if (type == POPUP_TYPE_TRADE_FOR_BADGE) { diff --git a/src/animator.c b/src/animator.c index 3b22ce6f0ab..8c9487c5e43 100644 --- a/src/animator.c +++ b/src/animator.c @@ -286,7 +286,7 @@ s32 create_model_animator(s16* animPos) { ASSERT(i < ARRAY_COUNT(*gCurrentAnimMeshListPtr)); (*gCurrentAnimMeshListPtr)[i] = animator = heap_malloc(sizeof(*animator)); - gAnimCount += 1; + gAnimCount++; ASSERT(animator != NULL); @@ -330,7 +330,7 @@ s32 create_mesh_animator(s16* animPos, s16* animBuffer) { ASSERT(i < ARRAY_COUNT(*gCurrentAnimMeshListPtr)); (*gCurrentAnimMeshListPtr)[i] = animator = heap_malloc(sizeof(*animator)); - gAnimCount += 1; + gAnimCount++; ASSERT(animator != NULL); diff --git a/src/audio/25f00_len_940.c b/src/audio/25f00_len_940.c index 08934734b38..29e172413a9 100644 --- a/src/audio/25f00_len_940.c +++ b/src/audio/25f00_len_940.c @@ -305,7 +305,7 @@ void nuAuCleanDMABuffers(void) { nuAuDmaNext = 0; frameCounter = &nuAuFrameCounter; - *frameCounter += 1; + (*frameCounter)++; } while (0); } diff --git a/src/audio/2d9a0_len_890.c b/src/audio/2d9a0_len_890.c index ddfbda7d0dd..ec2745aad71 100644 --- a/src/audio/2d9a0_len_890.c +++ b/src/audio/2d9a0_len_890.c @@ -249,7 +249,6 @@ u8 au_voice_step(AuVoice* voice) { return op; } - void au_voice_set_vol_changed(AuVoice* voice) { voice->envelopeFlags |= AU_VOICE_ENV_FLAG_VOL_CHANGED; } diff --git a/src/audio/2e230_len_2190.c b/src/audio/2e230_len_2190.c index 122b531ea52..c97e9f2afa0 100644 --- a/src/audio/2e230_len_2190.c +++ b/src/audio/2e230_len_2190.c @@ -1059,7 +1059,6 @@ s32* func_80054AA0(s32* bkFileOffset, void* vaddr, s32 bankIndex, s32 bankGroup) readState = BK_READ_FETCH_HEADER; keepReading = TRUE; - while (keepReading) { switch (readState) { case BK_READ_DONE: diff --git a/src/audio/reverb.c b/src/audio/reverb.c index 0876a176212..58e1c8cf28f 100644 --- a/src/audio/reverb.c +++ b/src/audio/reverb.c @@ -370,7 +370,6 @@ Acmd* au_pull_fx(AuFX* fx, Acmd* ptr, s16 outputBuf, s16 arg3) { return cmdBufPos; } - #define INPUT_PARAM 0 #define OUTPUT_PARAM 1 #define FBCOEF_PARAM 2 diff --git a/src/audio/sfx.c b/src/audio/sfx.c index 29c50e36581..e3d899891ee 100644 --- a/src/audio/sfx.c +++ b/src/audio/sfx.c @@ -75,7 +75,7 @@ s32 LoopingSounds[] = { [SOUND_LOOP_IDX(SOUND_LOOP_TIK_UNUSED3_FLOW3)] SOUND_LRAW_WATER_FLOWING_3, [SOUND_LOOP_IDX(SOUND_LOOP_TIK_UNUSED3_FLOW2)] SOUND_LRAW_WATER_FLOWING_2, [SOUND_LOOP_IDX(SOUND_LOOP_SAM_STAIRS_RISE)] SOUND_LRAW_SAM_STAIRS_RISE, - [SOUND_LOOP_IDX(SOUND_LOOP_CHARGE_BAR)] SOUND_LRAW_CHARGE_BAR, + [SOUND_LOOP_IDX(SOUND_LOOP_CHARGE_METER)] SOUND_LRAW_CHARGE_METER, [SOUND_LOOP_IDX(SOUND_LOOP_CRYSTAL_BALL_GLOW)] SOUND_LRAW_CRYSTAL_BALL_GLOW, [SOUND_LOOP_IDX(SOUND_LOOP_TIK18_WATER)] SOUND_LRAW_TIK_WATER, [SOUND_LOOP_IDX(SOUND_LOOP_TIK19_WATER)] SOUND_LRAW_TIK_WATER, diff --git a/src/battle/16C8E0.c b/src/battle/16C8E0.c index af604984ace..854349ee525 100644 --- a/src/battle/16C8E0.c +++ b/src/battle/16C8E0.c @@ -25,10 +25,10 @@ BSS Camera SavedWorldCameras[ARRAY_COUNT(gCameras)]; BSS f32 SavedWorldPlayerPosX; BSS f32 SavedWorldPlayerPosY; BSS f32 SavedWorldPlayerPosZ; -BSS s32 D_8029EFBC; -BSS s32 BtlStarPointTensHIDs[10]; -BSS s32 BtlStarPointShinesHIDs[10]; -BSS s32 BtlStarPointOnesHIDs[10]; +BSS HudElemID HPBarHID; +BSS HudElemID BtlStarPointTensHIDs[10]; +BSS HudElemID BtlStarPointShinesHIDs[10]; +BSS HudElemID BtlStarPointOnesHIDs[10]; BSS PAL_BIN gTattleBgPalette[0x100]; extern HudScript HES_HPDigit0; @@ -163,7 +163,7 @@ void initialize_battle(void) { PlayerData* playerData = &gPlayerData; BattleStatus* battleStatus = &gBattleStatus; Camera* tattleCam = &gCameras[CAM_TATTLE]; - s32 hudElemID; + HudElemID hid; s32 i; gBattleStatus.flags1 = 0; @@ -206,29 +206,29 @@ void initialize_battle(void) { gBattleStatus.flags2 &= ~BS_FLAGS2_PEACH_BATTLE; } - create_worker_world(NULL, btl_render_actors); + create_worker_scene(NULL, btl_render_actors); btl_popup_messages_init(); - func_80268E88(); + create_action_command_ui_worker(); set_windows_visible(WINDOW_GROUP_1); - D_8029EFBC = hud_element_create(&HES_HPBar); - hud_element_set_flags(D_8029EFBC, HUD_ELEMENT_FLAG_80); + HPBarHID = hud_element_create(&HES_HPBar); + hud_element_set_flags(HPBarHID, HUD_ELEMENT_FLAG_80); for (i = 0; i < ARRAY_COUNT(BtlStarPointTensHIDs); i++) { - hudElemID = BtlStarPointTensHIDs[i] = hud_element_create(&HES_Item_StarPoint); - hud_element_set_flags(hudElemID, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_depth(hudElemID, 20); + hid = BtlStarPointTensHIDs[i] = hud_element_create(&HES_Item_StarPoint); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_depth(hid, 20); } for (i = 0; i < ARRAY_COUNT(BtlStarPointShinesHIDs); i++) { - hudElemID = BtlStarPointShinesHIDs[i] = hud_element_create(&HES_StatusSPShine); - hud_element_set_flags(hudElemID, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_depth(hudElemID, 20); + hid = BtlStarPointShinesHIDs[i] = hud_element_create(&HES_StatusSPShine); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_depth(hid, 20); } for (i = 0; i < ARRAY_COUNT(BtlStarPointOnesHIDs); i++) { - hudElemID = BtlStarPointOnesHIDs[i] = hud_element_create(&HES_SmallStarPoint); - hud_element_set_flags(hudElemID, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_depth(hudElemID, 20); + hid = BtlStarPointOnesHIDs[i] = hud_element_create(&HES_SmallStarPoint); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_depth(hid, 20); } tattleCam->fpDoPreRender = tattle_cam_pre_render; @@ -907,36 +907,36 @@ void btl_draw_enemy_health_bars(void) { if (enemy->healthBarPos.y >= -500) { s32 screenX, screenY, screenZ; - s32 id; + HudElemID hid; get_screen_coords(CAM_BATTLE, x, y, z, &screenX, &screenY, &screenZ); screenY += 16; - id = D_8029EFBC; - hud_element_set_render_depth(id, 10); - hud_element_set_script(id, &HES_HPBar); - hud_element_set_render_pos(id, screenX, screenY); - hud_element_draw_clipped(id); + hid = HPBarHID; + hud_element_set_render_depth(hid, 10); + hud_element_set_script(hid, &HES_HPBar); + hud_element_set_render_pos(hid, screenX, screenY); + hud_element_draw_clipped(hid); temp = currentHP / 10; ones = currentHP % 10; // tens digit if (temp > 0) { - id = D_8029EFBC; - hud_element_set_render_depth(id, 10); - hud_element_set_script(id, bHPDigitHudScripts[temp]); + hid = HPBarHID; + hud_element_set_render_depth(hid, 10); + hud_element_set_script(hid, bHPDigitHudScripts[temp]); btl_draw_prim_quad(0, 0, 0, 0, screenX, screenY + 2, 8, 8); - hud_element_set_render_pos(id, screenX + 4, screenY + 6); - hud_element_draw_next(id); + hud_element_set_render_pos(hid, screenX + 4, screenY + 6); + hud_element_draw_next(hid); } // ones digit - id = D_8029EFBC; - hud_element_set_render_depth(id, 10); - hud_element_set_script(id, bHPDigitHudScripts[ones]); + hid = HPBarHID; + hud_element_set_render_depth(hid, 10); + hud_element_set_script(hid, bHPDigitHudScripts[ones]); btl_draw_prim_quad(0, 0, 0, 0, screenX + 6, screenY + 2, 8, 8); - hud_element_set_render_pos(id, screenX + 10, screenY + 6); - hud_element_draw_next(id); + hud_element_set_render_pos(hid, screenX + 10, screenY + 6); + hud_element_draw_next(hid); temp = enemy->healthFraction; temp = 25 - temp; @@ -983,7 +983,6 @@ void btl_update_starpoints_display(void) { D_802809F5++; } - if (cond) { s32 posX, posY; s32 tens, ones; @@ -1027,7 +1026,7 @@ void btl_update_starpoints_display(void) { if (hud_element_get_script(id) != &HES_Item_StarPoint) { hud_element_set_script(id, &HES_Item_StarPoint); } - hud_element_clear_flags(id, 2); + hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); hud_element_set_render_pos(id, posX, posY); hud_element_draw_clipped(id); @@ -1035,7 +1034,7 @@ void btl_update_starpoints_display(void) { if (hud_element_get_script(id) != &HES_StatusSPShine) { hud_element_set_script(id, &HES_StatusSPShine); } - hud_element_clear_flags(id, 2); + hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); hud_element_set_render_pos(id, posX, posY - 5); hud_element_draw_clipped(id); posX -= (one * 20.0f); @@ -1060,7 +1059,7 @@ void btl_update_starpoints_display(void) { if (hud_element_get_script(id) != &HES_SmallStarPoint) { hud_element_set_script(id, &HES_SmallStarPoint); } - hud_element_clear_flags(id, 2); + hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); hud_element_set_render_pos(id, posX, posY); hud_element_draw_clipped(id); posX -= one * 10.0f; diff --git a/src/battle/1A5830.c b/src/battle/1A5830.c index 64010e62434..f93defe17b3 100644 --- a/src/battle/1A5830.c +++ b/src/battle/1A5830.c @@ -1578,7 +1578,7 @@ API_CALLABLE(RunToGoal) { if (actor->actorTypeData1b[0] >= 0) { actorState->dist = actor->actorTypeData1b[0] + 1; } else { - actorState->dist = ~actor->actorTypeData1b[0]; //TODO optimization? + actorState->dist = -(actor->actorTypeData1b[0] + 1); } if ((actor->actorTypeData1[0] != 0) && (actor->actorTypeData1[1] == 0)) { sfx_play_sound_at_position(actor->actorTypeData1[0], SOUND_SPACE_DEFAULT, actor->curPos.x, actor->curPos.y, actor->curPos.z); @@ -1704,7 +1704,7 @@ API_CALLABLE(IdleRunToGoal) { if (actor->actorTypeData1b[0] >= 0) { movement->dist = actor->actorTypeData1b[0] + 1; } else { - movement->dist = ~actor->actorTypeData1b[0]; + movement->dist = -(actor->actorTypeData1b[0] + 1); } script->functionTemp[0] = TRUE; } @@ -2022,7 +2022,7 @@ API_CALLABLE(RunPartTo) { if (part->actorTypeData2b[0] >= 0) { movement->dist = part->actorTypeData2b[0] + 1; } else { - movement->dist = ~part->actorTypeData2b[0]; + movement->dist = -(part->actorTypeData2b[0] + 1); } if (part->partTypeData[0] != 0 && part->partTypeData[1] == 0) { sfx_play_sound_at_position(part->partTypeData[0], SOUND_SPACE_DEFAULT, part->absolutePos.x, part->absolutePos.y, part->absolutePos.z); @@ -2219,7 +2219,7 @@ API_CALLABLE(FlyToGoal) { if (actor->actorTypeData1b[1] >= 0) { actorState->vel = actor->actorTypeData1b[1] + 1; } else { - actorState->vel = ~actor->actorTypeData1b[1]; + actorState->vel = -(actor->actorTypeData1b[1] + 1); } if ((actor->actorTypeData1[2] != 0) && (actor->actorTypeData1[3] == 0)) { sfx_play_sound_at_position(actor->actorTypeData1[2], SOUND_SPACE_DEFAULT, actor->curPos.x, actor->curPos.y, actor->curPos.z); @@ -2484,7 +2484,7 @@ API_CALLABLE(FlyPartTo) { if (part->actorTypeData2b[1] >= 0) { partMovement->unk_2C = actor->actorTypeData1b[1] + 1; } else { - partMovement->unk_2C = ~actor->actorTypeData1b[1]; + partMovement->unk_2C = -(actor->actorTypeData1b[1] + 1); } } diff --git a/src/battle/action_cmd.c b/src/battle/action_cmd.c index 068232511ca..369e1d8661b 100644 --- a/src/battle/action_cmd.c +++ b/src/battle/action_cmd.c @@ -25,29 +25,29 @@ u8 mashMeter_cutOffColors[15] = { 255, 255, 255, }; -s32 actionCmdTableJump[] = { 7, 6, 5, 4, 3, 2, 1, 0 }; -s32 actionCmdTableHammer[] = { 11, 10, 9, 8, 7, 6, 5, 4 }; -s32 actionCmdTableFlee[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTableBreakFree[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTableWhirlwind[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTableStopLeech[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTable07[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTableDizzyShell[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTableFireShell[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTable0A[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTableBomb[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTableBodySlam[] = { 9, 8, 7, 6, 5, 4, 3, 2 }; -s32 actionCmdTableAirLift[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTableAirRaid[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTableSquirt[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTablePowerShock[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTableMegaShock[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTableSmack[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTableSpinySurge[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTableHurricane[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTableSpook[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; -s32 actionCmdTableWaterBlock[] = { 6, 3, 5, 3, 4, 3, 2, 3, 1, 3, 0, 3, 0, 2, 0, 1 }; -s32 actionCmdTableTidalWave[] = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTableJump = { 7, 6, 5, 4, 3, 2, 1, 0 }; +Difficulty1D actionCmdTableHammer = { 11, 10, 9, 8, 7, 6, 5, 4 }; +Difficulty1D actionCmdTableFlee = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTableBreakFree = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTableWhirlwind = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTableStopLeech = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTable07 = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTableDizzyShell = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTableFireShell = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTable0A = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTableBomb = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTableBodySlam = { 9, 8, 7, 6, 5, 4, 3, 2 }; +Difficulty1D actionCmdTableAirLift = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTableAirRaid = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTableSquirt = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTablePowerShock = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTableMegaShock = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTableSmack = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTableSpinySurge = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTableHurricane = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty1D actionCmdTableSpook = { 130, 120, 110, 100, 90, 80, 70, 60 }; +Difficulty2D actionCmdTableWaterBlock = { {6, 3}, {5, 3}, {4, 3}, {2, 3}, {1, 3}, {0, 3}, {0, 2}, {0, 1} }; +Difficulty1D actionCmdTableTidalWave = { 130, 120, 110, 100, 90, 80, 70, 60 }; #define AC_TBL_ENTRY(name) \ action_cmd_ ## name ## _ROM_START, action_cmd_ ## name ## _ROM_END, action_cmd_ ## name ## _VRAM @@ -60,10 +60,10 @@ void* actionCommandDmaTable[] = { AC_TBL_ENTRY(break_free), AC_TBL_ENTRY(whirlwind), AC_TBL_ENTRY(stop_leech), - AC_TBL_ENTRY(07), + AC_TBL_ENTRY(unused_flee), AC_TBL_ENTRY(dizzy_shell), AC_TBL_ENTRY(fire_shell), - AC_TBL_ENTRY(0A), + AC_TBL_ENTRY(unused_mash_a), AC_TBL_ENTRY(bomb), AC_TBL_ENTRY(body_slam), AC_TBL_ENTRY(air_lift), @@ -75,11 +75,11 @@ void* actionCommandDmaTable[] = { AC_TBL_ENTRY(spiny_surge), AC_TBL_ENTRY(hurricane), AC_TBL_ENTRY(spook), - AC_TBL_ENTRY(water_block), + AC_TBL_ENTRY(three_chances), AC_TBL_ENTRY(tidal_wave), }; -BSS s32 sMashMeterSmoothDivisor; +BSS s32 MashMeterSmoothDivisor; BSS s32 D_8029FBC4_pad[3]; // TODO move to actor_api BSS s32 IsGroupHeal; @@ -98,23 +98,23 @@ API_CALLABLE(LoadActionCommand) { return ApiStatus_DONE2; } -s32 adjust_action_command_difficulty(s32 arg0) { +s32 adjust_action_command_difficulty(s32 difficultyLevel) { if (!(gBattleStatus.flags1 & BS_FLAGS1_PARTNER_ACTING)) { - arg0 -= is_ability_active(ABILITY_DODGE_MASTER) * 3; + difficultyLevel -= is_ability_active(ABILITY_DODGE_MASTER) * 3; } - if (arg0 < 0) { - arg0 = 0; + if (difficultyLevel < 0) { + difficultyLevel = 0; } - if (arg0 > 7) { - arg0 = 7; + if (difficultyLevel > 7) { + difficultyLevel = 7; } - return arg0; + return difficultyLevel; } void draw_mash_meter(s32 posX, s32 posY, s32 fillValue, s32 colorMode) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; s32 maxCutOff; s32 i; s32 cutOff; @@ -123,22 +123,22 @@ void draw_mash_meter(s32 posX, s32 posY, s32 fillValue, s32 colorMode) { s32 filledWidth; s32 r, g, b; - if (!actionCommandStatus->showHud) { + if (!acs->showHud) { return; } posX -= 28; posY -= 4; - maxCutOff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals]; + maxCutOff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals]; if (fillValue < 0) { fillValue = 0; } width = 0; - for (i = 0; i < actionCommandStatus->mashMeterIntervals; i++) { - cutOff = actionCommandStatus->mashMeterCutoffs[i + 1]; + for (i = 0; i < acs->mashMeterNumIntervals; i++) { + cutOff = acs->mashMeterCutoffs[i + 1]; if (cutOff > fillValue) { cutOff = fillValue; } @@ -150,22 +150,22 @@ void draw_mash_meter(s32 posX, s32 posY, s32 fillValue, s32 colorMode) { } //difference between current and previous filled value - offsetX = width - actionCommandStatus->barFillWidth; - if (abs(offsetX) >= sMashMeterSmoothDivisor * 100) { - actionCommandStatus->barFillWidth += offsetX / sMashMeterSmoothDivisor; + offsetX = width - acs->meterFillWidth; + if (abs(offsetX) >= MashMeterSmoothDivisor * 100) { + acs->meterFillWidth += offsetX / MashMeterSmoothDivisor; } else { - actionCommandStatus->barFillWidth = width; + acs->meterFillWidth = width; } offsetX = 0; - for (i = 0; i < actionCommandStatus->mashMeterIntervals; i++) { - cutOff = actionCommandStatus->mashMeterCutoffs[i + 1]; + for (i = 0; i < acs->mashMeterNumIntervals; i++) { + cutOff = acs->mashMeterCutoffs[i + 1]; width = (cutOff * 60 / maxCutOff) - offsetX; r = mashMeter_bgColors[3 * i + 0]; g = mashMeter_bgColors[3 * i + 1]; b = mashMeter_bgColors[3 * i + 2]; startup_draw_prim_rect_COPY(posX + offsetX, posY, posX + offsetX + width, posY + 5, r, g, b, 255); - if (i < actionCommandStatus->mashMeterIntervals - 1) { + if (i < acs->mashMeterNumIntervals - 1) { r = mashMeter_cutOffColors[3 * i + 0]; g = mashMeter_cutOffColors[3 * i + 1]; b = mashMeter_cutOffColors[3 * i + 2]; @@ -177,7 +177,7 @@ void draw_mash_meter(s32 posX, s32 posY, s32 fillValue, s32 colorMode) { } offsetX = 0; - for (i = 0; i < actionCommandStatus->mashMeterIntervals; i++) { + for (i = 0; i < acs->mashMeterNumIntervals; i++) { if (colorMode == 0) { r = mashMeter_fillColors[3 * i + 0]; g = mashMeter_fillColors[3 * i + 1]; @@ -196,13 +196,13 @@ void draw_mash_meter(s32 posX, s32 posY, s32 fillValue, s32 colorMode) { b = 0; } - cutOff = actionCommandStatus->mashMeterCutoffs[i + 1]; + cutOff = acs->mashMeterCutoffs[i + 1]; if (cutOff > fillValue) { cutOff = fillValue; } filledWidth = cutOff * 60 / maxCutOff - offsetX; - width = actionCommandStatus->barFillWidth / 100 - offsetX; + width = acs->meterFillWidth / 100 - offsetX; if (width < 0) { break; @@ -217,81 +217,81 @@ void draw_mash_meter(s32 posX, s32 posY, s32 fillValue, s32 colorMode) { startup_draw_prim_rect_COPY(posX + offsetX, posY, posX + offsetX + width, posY + 5, r, g, b, 255); offsetX += filledWidth; - if (i >= actionCommandStatus->mashMeterIntervals - 1) { + if (i >= acs->mashMeterNumIntervals - 1) { break; } } } void draw_mash_meter_multicolor(s32 posX, s32 posY, s32 fillValue) { - sMashMeterSmoothDivisor = 2; + MashMeterSmoothDivisor = 2; draw_mash_meter(posX, posY, fillValue, MASH_METER_MODE_MULTI_COLOR); } void draw_mash_meter_multicolor_with_divisor(s32 posX, s32 posY, s32 fillValue, s32 divisor) { - sMashMeterSmoothDivisor = divisor; + MashMeterSmoothDivisor = divisor; draw_mash_meter(posX, posY, fillValue, MASH_METER_MODE_MULTI_COLOR); } void draw_mash_meter_mode(s32 posX, s32 posY, s32 fillValue, s32 colorMode) { - sMashMeterSmoothDivisor = 2; + MashMeterSmoothDivisor = 2; draw_mash_meter(posX, posY, fillValue, colorMode); } void draw_mash_meter_mode_with_divisor(s32 posX, s32 posY, s32 fillValue, s32 divisor, s32 colorMode) { - sMashMeterSmoothDivisor = divisor; + MashMeterSmoothDivisor = divisor; draw_mash_meter(posX, posY, fillValue, colorMode); } void draw_mash_meter_blink(s32 posX, s32 posY, s32 fillValue) { - sMashMeterSmoothDivisor = 2; + MashMeterSmoothDivisor = 2; draw_mash_meter(posX, posY, fillValue, MASH_METER_MODE_BLINK); } void draw_mash_meter_blink_with_divisor(s32 posX, s32 posY, s32 fillValue, s32 divisor) { - sMashMeterSmoothDivisor = divisor; + MashMeterSmoothDivisor = divisor; draw_mash_meter(posX, posY, fillValue, MASH_METER_MODE_BLINK); } void action_command_init_status(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; - actionCommandStatus->autoSucceed = FALSE; - actionCommandStatus->berserkerEnabled = FALSE; + acs->autoSucceed = FALSE; + acs->berserkerEnabled = FALSE; if (!(gBattleStatus.flags1 & BS_FLAGS1_PARTNER_ACTING)) { if (is_ability_active(ABILITY_RIGHT_ON)) { - actionCommandStatus->autoSucceed = TRUE; + acs->autoSucceed = TRUE; } if (!(gBattleStatus.flags1 & BS_FLAGS1_PARTNER_ACTING) && is_ability_active(ABILITY_BERSERKER)) { - actionCommandStatus->showHud = FALSE; - actionCommandStatus->berserkerEnabled = TRUE; + acs->showHud = FALSE; + acs->berserkerEnabled = TRUE; if (rand_int(100) < 25) { - actionCommandStatus->autoSucceed = TRUE; + acs->autoSucceed = TRUE; } } } if (gGameStatusPtr->demoBattleFlags & DEMO_BTL_FLAG_ENABLED) { - actionCommandStatus->autoSucceed = TRUE; + acs->autoSucceed = TRUE; } if (gBattleStatus.flags1 & BS_FLAGS1_AUTO_SUCCEED_ACTION) { - actionCommandStatus->autoSucceed = TRUE; - actionCommandStatus->showHud = FALSE; + acs->autoSucceed = TRUE; + acs->showHud = FALSE; } } void action_command_update(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; if (gBattleStatus.flags1 & BS_FLAGS1_FREE_ACTION_COMMAND) { action_command_free(); } - switch (actionCommandStatus->actionCommandID) { + switch (acs->actionCommandID) { case ACTION_COMMAND_NONE: break; case ACTION_COMMAND_JUMP: @@ -312,8 +312,8 @@ void action_command_update(void) { case ACTION_COMMAND_STOP_LEECH: action_command_stop_leech_update(); break; - case ACTION_COMMAND_07: - action_command_07_update(); + case ACTION_COMMAND_UNUSED_FLEE: + action_command_unused_flee_update(); break; case ACTION_COMMAND_DIZZY_SHELL: action_command_dizzy_shell_update(); @@ -321,8 +321,8 @@ void action_command_update(void) { case ACTION_COMMAND_FIRE_SHELL: action_command_fire_shell_update(); break; - case ACTION_COMMAND_0A: - action_command_0A_update(); + case ACTION_COMMAND_UNUSED_MASH_A: + action_command_unused_mash_a_update(); break; case ACTION_COMMAND_BOMB: action_command_bomb_update(); @@ -357,8 +357,8 @@ void action_command_update(void) { case ACTION_COMMAND_SPOOK: action_command_spook_update(); break; - case ACTION_COMMAND_WATER_BLOCK: - action_command_water_block_update(); + case ACTION_COMMAND_THREE_CHANCES: + action_command_three_chances_update(); break; case ACTION_COMMAND_TIDAL_WAVE: action_command_tidal_wave_update(); @@ -390,8 +390,8 @@ void action_command_draw(void) { case ACTION_COMMAND_STOP_LEECH: action_command_stop_leech_draw(); break; - case ACTION_COMMAND_07: - action_command_07_draw(); + case ACTION_COMMAND_UNUSED_FLEE: + action_command_unused_flee_draw(); break; case ACTION_COMMAND_DIZZY_SHELL: action_command_dizzy_shell_draw(); @@ -399,8 +399,8 @@ void action_command_draw(void) { case ACTION_COMMAND_FIRE_SHELL: action_command_fire_shell_draw(); break; - case ACTION_COMMAND_0A: - action_command_0A_draw(); + case ACTION_COMMAND_UNUSED_MASH_A: + action_command_unused_mash_a_draw(); break; case ACTION_COMMAND_BOMB: action_command_bomb_draw(); @@ -435,8 +435,8 @@ void action_command_draw(void) { case ACTION_COMMAND_SPOOK: action_command_spook_draw(); break; - case ACTION_COMMAND_WATER_BLOCK: - action_command_water_block_draw(); + case ACTION_COMMAND_THREE_CHANCES: + action_command_three_chances_draw(); break; case ACTION_COMMAND_TIDAL_WAVE: action_command_tidal_wave_draw(); @@ -444,9 +444,9 @@ void action_command_draw(void) { } void action_command_free(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; - switch (actionCommandStatus->actionCommandID) { + switch (acs->actionCommandID) { case ACTION_COMMAND_NONE: break; case ACTION_COMMAND_JUMP: @@ -467,8 +467,8 @@ void action_command_free(void) { case ACTION_COMMAND_STOP_LEECH: action_command_jump_draw(); break; - case ACTION_COMMAND_07: - action_command_07_free(); + case ACTION_COMMAND_UNUSED_FLEE: + action_command_unused_flee_free(); break; case ACTION_COMMAND_DIZZY_SHELL: action_command_dizzy_shell_free(); @@ -476,8 +476,8 @@ void action_command_free(void) { case ACTION_COMMAND_FIRE_SHELL: action_command_fire_shell_free(); break; - case ACTION_COMMAND_0A: - action_command_0A_free(); + case ACTION_COMMAND_UNUSED_MASH_A: + action_command_unused_mash_a_free(); break; case ACTION_COMMAND_BOMB: action_command_bomb_free(); @@ -512,32 +512,32 @@ void action_command_free(void) { case ACTION_COMMAND_SPOOK: action_command_spook_free(); break; - case ACTION_COMMAND_WATER_BLOCK: - action_command_water_block_free(); + case ACTION_COMMAND_THREE_CHANCES: + action_command_three_chances_free(); break; case ACTION_COMMAND_TIDAL_WAVE: action_command_tidal_wave_free(); break; } - actionCommandStatus->actionCommandID = ACTION_COMMAND_NONE; + acs->actionCommandID = ACTION_COMMAND_NONE; gBattleStatus.flags1 &= ~BS_FLAGS1_2000; gBattleStatus.flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; gBattleStatus.flags1 &= ~BS_FLAGS1_4000; close_action_command_instruction_popup(); - btl_set_popup_duration(0); + btl_set_popup_duration(POPUP_MSG_OFF); } -void func_80268E88(void) { +void create_action_command_ui_worker(void) { ActionCommandStatus* actionCmdStatus = &gActionCommandStatus; actionCmdStatus->workerID = create_worker_frontUI(action_command_update, action_command_draw); - actionCmdStatus->actionCommandID = 0; + actionCmdStatus->actionCommandID = ACTION_COMMAND_NONE; } s32 check_block_input(s32 buttonMask) { BattleStatus* battleStatus = &gBattleStatus; PlayerData* playerData = &gPlayerData; - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; s32 mashWindow; s32 blockWindow; s32 block; @@ -548,20 +548,20 @@ s32 check_block_input(s32 buttonMask) { battleStatus->blockResult = BLOCK_RESULT_FAIL; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_TUTORIAL_BLOCK && (battleStatus->flags1 & BS_FLAGS1_TUTORIAL_BATTLE)) { + if (battleStatus->actionCommandMode == AC_MODE_TUTORIAL_BLOCK && (battleStatus->flags1 & BS_FLAGS1_TUTORIAL_BATTLE)) { battleStatus->blockResult = BLOCK_RESULT_SUCCESS; return TRUE; } - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED || (gGameStatusPtr->demoBattleFlags & DEMO_BTL_FLAG_ENABLED)) { + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED || (gGameStatusPtr->demoBattleFlags & DEMO_BTL_FLAG_ENABLED)) { return FALSE; } if (playerData->hitsTaken < 9999) { playerData->hitsTaken++; - actionCommandStatus->hitsTakenIsMax = FALSE; + acs->hitsTakenIsMax = FALSE; } else { - actionCommandStatus->hitsTakenIsMax = TRUE; + acs->hitsTakenIsMax = TRUE; } block = FALSE; @@ -631,28 +631,28 @@ s32 check_block_input(s32 buttonMask) { bufferPos++; } } - if (block && !actionCommandStatus->hitsTakenIsMax) { + if (block && !acs->hitsTakenIsMax) { playerData->hitsBlocked++; } return block; } -void func_80269118(void) { +void increment_action_command_attempt_count(void) { PlayerData* playerData = &gPlayerData; - ActionCommandStatus *actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus *acs = &gActionCommandStatus; - if (!actionCommandStatus->autoSucceed) { + if (!acs->autoSucceed) { if (playerData->actionCommandAttempts < 9999) { playerData->actionCommandAttempts++; - actionCommandStatus->hitsTakenIsMax = FALSE; + acs->hitsTakenIsMax = FALSE; } else { - actionCommandStatus->hitsTakenIsMax = TRUE; + acs->hitsTakenIsMax = TRUE; } } } -void func_80269160(void) { +void increment_action_command_success_count(void) { PlayerData* playerData = &gPlayerData; if (!gActionCommandStatus.autoSucceed && gActionCommandStatus.hitsTakenIsMax) { @@ -667,7 +667,7 @@ API_CALLABLE(SetActionDifficultyTable) { API_CALLABLE(SetupMashMeter) { Bytecode* args = script->ptrReadPos; - gActionCommandStatus.mashMeterIntervals = evt_get_variable(script, *args++); + gActionCommandStatus.mashMeterNumIntervals = evt_get_variable(script, *args++); gActionCommandStatus.mashMeterCutoffs[1] = evt_get_variable(script, *args++); gActionCommandStatus.mashMeterCutoffs[2] = evt_get_variable(script, *args++); gActionCommandStatus.mashMeterCutoffs[3] = evt_get_variable(script, *args++); @@ -677,13 +677,13 @@ API_CALLABLE(SetupMashMeter) { return ApiStatus_DONE2; } -API_CALLABLE(GetActionSuccess) { - evt_set_variable(script, *script->ptrReadPos, gBattleStatus.actionSuccess); +API_CALLABLE(GetSmashActionQuality) { + evt_set_variable(script, *script->ptrReadPos, gBattleStatus.actionQuality); return ApiStatus_DONE2; } API_CALLABLE(SetActionSuccess) { - gBattleStatus.actionSuccess = evt_get_variable(script, *script->ptrReadPos); + gBattleStatus.actionQuality = evt_get_variable(script, *script->ptrReadPos); return ApiStatus_DONE2; } @@ -708,12 +708,12 @@ API_CALLABLE(GetCommandAutoSuccess) { } API_CALLABLE(SetCommandAutoSuccess) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; if (evt_get_variable(script, *script->ptrReadPos) != 0) { - actionCommandStatus->autoSucceed = TRUE; + acs->autoSucceed = TRUE; } else { - actionCommandStatus->autoSucceed = FALSE; + acs->autoSucceed = FALSE; } return ApiStatus_DONE2; } @@ -723,11 +723,11 @@ API_CALLABLE(func_802693F0) { return ApiStatus_DONE2; } -API_CALLABLE(CloseActionCommandInfo) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; +API_CALLABLE(InterruptActionCommand) { + ActionCommandStatus* acs = &gActionCommandStatus; if (isInitialCall) { - switch (actionCommandStatus->actionCommandID) { + switch (acs->actionCommandID) { case ACTION_COMMAND_WHIRLWIND: case ACTION_COMMAND_STOP_LEECH: return ApiStatus_DONE2; @@ -737,13 +737,13 @@ API_CALLABLE(CloseActionCommandInfo) { } } - sfx_stop_sound(SOUND_LOOP_CHARGE_BAR); + sfx_stop_sound(SOUND_LOOP_CHARGE_METER); close_action_command_instruction_popup(); return ApiStatus_DONE2; } -API_CALLABLE(func_80269470) { +API_CALLABLE(InterruptLeechActionCommand) { if (isInitialCall) { action_command_free(); return ApiStatus_BLOCK; @@ -754,22 +754,22 @@ API_CALLABLE(func_80269470) { } API_CALLABLE(ShowActionHud) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; if (evt_get_variable(script, *script->ptrReadPos) == 0) { - actionCommandStatus->showHud = FALSE; + acs->showHud = FALSE; } else { - actionCommandStatus->showHud = TRUE; + acs->showHud = TRUE; } return ApiStatus_DONE2; } -API_CALLABLE(GetActionSuccessCopy) { - evt_set_variable(script, *script->ptrReadPos, gBattleStatus.actionSuccess); +API_CALLABLE(GetMashActionQuality) { + evt_set_variable(script, *script->ptrReadPos, gBattleStatus.actionQuality); return ApiStatus_DONE2; } -API_CALLABLE(GetActionResult) { +API_CALLABLE(GetJumpActionQuality) { evt_set_variable(script, *script->ptrReadPos, gBattleStatus.actionResult); return ApiStatus_DONE2; } @@ -784,22 +784,22 @@ API_CALLABLE(GetBlockResult) { return ApiStatus_DONE2; } -API_CALLABLE(GetActionQuality) { - evt_set_variable(script, *script->ptrReadPos, gBattleStatus.actionQuality); +API_CALLABLE(GetActionProgress) { + evt_set_variable(script, *script->ptrReadPos, gBattleStatus.actionProgress); return ApiStatus_DONE2; } -API_CALLABLE(SetActionQuality) { - gBattleStatus.actionQuality = evt_get_variable(script, *script->ptrReadPos); +API_CALLABLE(SetActionProgress) { + gBattleStatus.actionProgress = evt_get_variable(script, *script->ptrReadPos); return ApiStatus_DONE2; } -API_CALLABLE(func_80269600) { - evt_set_variable(script, *script->ptrReadPos, gBattleStatus.unk_85); +API_CALLABLE(GetActionResultTier) { + evt_set_variable(script, *script->ptrReadPos, gBattleStatus.resultTier); return ApiStatus_DONE2; } -API_CALLABLE(func_8026962C) { - gBattleStatus.unk_85 = evt_get_variable(script, *script->ptrReadPos); +API_CALLABLE(SetActionResultTier) { + gBattleStatus.resultTier = evt_get_variable(script, *script->ptrReadPos); return ApiStatus_DONE2; } diff --git a/src/battle/action_cmd.h b/src/battle/action_cmd.h index 77bda51587a..a504f4542dd 100644 --- a/src/battle/action_cmd.h +++ b/src/battle/action_cmd.h @@ -3,16 +3,17 @@ #include "common.h" #include "hud_element.h" +#include "battle.h" #include "battle/action_cmd/jump.h" #include "battle/action_cmd/hammer.h" #include "battle/action_cmd/flee.h" #include "battle/action_cmd/break_free.h" #include "battle/action_cmd/whirlwind.h" #include "battle/action_cmd/stop_leech.h" -#include "battle/action_cmd/07.h" +#include "battle/action_cmd/unused_flee.h" #include "battle/action_cmd/dizzy_shell.h" #include "battle/action_cmd/fire_shell.h" -#include "battle/action_cmd/0A.h" +#include "battle/action_cmd/unused_mash_a.h" #include "battle/action_cmd/bomb.h" #include "battle/action_cmd/body_slam.h" #include "battle/action_cmd/air_lift.h" @@ -24,56 +25,132 @@ #include "battle/action_cmd/spiny_surge.h" #include "battle/action_cmd/hurricane.h" #include "battle/action_cmd/spook.h" -#include "battle/action_cmd/water_block.h" +#include "battle/action_cmd/three_chances.h" #include "battle/action_cmd/tidal_wave.h" +// standard states for action commands +// used by every command except three_chances and tidal_wave +enum { + AC_STATE_INIT = 0, // create hud elements + AC_STATE_APPEAR = 1, // hud elements move into position + AC_STATE_START = 10, // begin listening for input + AC_STATE_ACTIVE = 11, // responding to player input + AC_STATE_DISPOSE = 12, // delay and disappear +}; + +enum ActionCommandDifficulty { + AC_DIFFICULTY_0 = 0, // easiest + AC_DIFFICULTY_1 = 1, // very easy + AC_DIFFICULTY_2 = 2, // easy + AC_DIFFICULTY_3 = 3, // standard + AC_DIFFICULTY_4 = 4, // harder + AC_DIFFICULTY_5 = 5, // hard + AC_DIFFICULTY_6 = 6, // very hard + AC_DIFFICULTY_7 = 7, // hardest +}; + enum MashMeterColorModes { - MASH_METER_MODE_BLINK = -1, - MASH_METER_MODE_MULTI_COLOR = 0, - MASH_METER_MODE_ONE_COLOR = 1, + MASH_METER_MODE_BLINK = -1, + MASH_METER_MODE_MULTI_COLOR = 0, + MASH_METER_MODE_ONE_COLOR = 1, }; enum ActionCommandModes { - ACTION_COMMAND_MODE_TUTORIAL_BLOCK = -1, - ACTION_COMMAND_MODE_NOT_LEARNED = 0, - ACTION_COMMAND_MODE_LEARNED = 1, - ACTION_COMMAND_MODE_TUTORIAL = 2, - ACTION_COMMAND_MODE_TUTORIAL_WAIT_INPUT = 3, + AC_MODE_TUTORIAL_BLOCK = -1, + AC_MODE_NOT_LEARNED = 0, + AC_MODE_LEARNED = 1, + AC_MODE_TUTORIAL = 2, + AC_MODE_TUTORIAL_WAIT_INPUT = 3, }; +#define AC_QUALITY_FAILED -1 + +// mash meter has 100 units for each 1% +#define ONE_PCT_MASH 100 + +// mash meter goes up to 100% +#define MAX_MASH_PCT 100 + +// total number of units in the mash meter +#define MAX_MASH_UNITS (MAX_MASH_PCT * ONE_PCT_MASH) + +#define SCALE_BY_PCT(x, pct) ((x) * (pct) / 100) +#define PCT_TO_TABLE_IDX(table, pct) ((pct) / (ONE_PCT_MASH / ARRAY_COUNT(table))) +#define PCT_TO_TABLE_RATE(table, pct) (table[PCT_TO_TABLE_IDX(table, pct)]) + typedef struct ActionCommandStatus { /* 0x00 */ s32 workerID; - /* 0x04 */ s32 hudElements[16]; - /* 0x44 */ s16 barFillLevel; // full = 10000 - /* 0x46 */ s16 thresholdLevel; - /* 0x48 */ s16 barFillWidth; // X100 + /* 0x04 */ HudElemID hudElemIDs[16]; + /* 0x44 */ s16 meterFillLevel; // 0 to MAX_MASH_UNITS + /* 0x46 */ s16 escapeThreshold; + /* 0x48 */ s16 meterFillWidth; // X100 /* 0x4A */ s16 actionCommandID; /* 0x4C */ s16 state; /* 0x4E */ s16 prepareTime; - /* 0x50 */ s16 difficulty; // values from 0 to 7 + /* 0x50 */ s16 difficulty; // see enum: ActionCommandDifficulty /* 0x52 */ s16 duration; - /* 0x54 */ s16 frameCounter; + /* 0x54 */ s16 stateTimer; /* 0x56 */ s16 hudPosX; /* 0x58 */ s16 hudPosY; - /* 0x5A */ s16 unk_5A; - /* 0x5C */ s8 unk_5C; - /* 0x5D */ s8 unk_5D; + /* 0x5A */ s16 escapeChance; // used by air_lift (via AirLiftChance), break_free (30), and flee (random 0-1). + /* 0x5C */ union { + struct { + s8 unk_5C; + s8 unk_5D; + } any; + struct { + b8 holdingLeft; + } airRaid; + struct { + s8 dir; + } breakFree; + struct { + b8 holdingLeft; + } fireShell; + struct { + s8 dir; + s8 drainDelay; // only found in unused variant + } flee; + struct { + b8 holdingLeft; + } smack; + struct { + s8 tossState; + } spinySurge; + struct { + b8 holdingLeft; + } spook; + struct { + b8 draining; + } squirt; + struct { + b8 hadCorrectTiming; + s8 time; + } threeChances; + struct { + s8 prevButton; + s8 inputCount; + } tidalWave; + }; /* 0x5E */ s8 autoSucceed; - /* 0x5F */ s8 hammerMissedStart; - /* 0x60 */ s8 wrongButtonPressed; - /* 0x61 */ s8 showHud; - /* 0x62 */ s8 playHammerSounds; - /* 0x63 */ s8 unk_63; - /* 0x64 */ s16 targetWeakness; // chance of applying special status, the more the easier it is to fill the bar + /* 0x5F */ b8 hammerMissedStart; + /* 0x60 */ b8 wrongButtonPressed; + /* 0x61 */ b8 showHud; + /* 0x62 */ b8 playHammerSounds; + /* 0x63 */ char pad_63[1]; + /* 0x64 */ union { + s16 variation; // used to select different variants of an action command + s16 statusChance; // chance of applying special status; higher values make mashing easier + }; /* 0x66 */ s16 thresholdMoveDir; - /* 0x68 */ s16 isBarFilled; - /* 0x6A */ s16 berserkerEnabled; + /* 0x68 */ b16 isMeterFilled; + /* 0x6A */ b16 berserkerEnabled; /* 0x6C */ s16 hudPrepareTime; - /* 0x6E */ s16 hitsTakenIsMax; + /* 0x6E */ b16 hitsTakenIsMax; /* 0x70 */ s16 lookBackCounter; /* 0x72 */ s16 wrongInputFrameCounter; /* 0x74 */ s16 mashMeterCutoffs[6]; // upper bounds for each interval - /* 0x80 */ s8 mashMeterIntervals; + /* 0x80 */ s8 mashMeterNumIntervals; } ActionCommandStatus; extern ActionCommandStatus gActionCommandStatus; @@ -113,9 +190,9 @@ extern HudScript HES_TimingWait; void action_command_init_status(void); void action_command_free(void); -void func_80268E88(void); -void func_80269118(void); -void func_80269160(void); +void create_action_command_ui_worker(void); +void increment_action_command_attempt_count(void); +void increment_action_command_success_count(void); void draw_mash_meter_multicolor_with_divisor(s32 posX, s32 posY, s32 fillValue, s32 divisor); void draw_mash_meter_blink(s32 posX, s32 posY, s32 fillValue); @@ -128,7 +205,7 @@ s32 check_block_input(s32 buttonMask); API_CALLABLE(LoadActionCommand); API_CALLABLE(SetActionDifficultyTable); API_CALLABLE(SetupMashMeter); -API_CALLABLE(GetActionSuccess); +API_CALLABLE(GetSmashActionQuality); API_CALLABLE(SetActionSuccess); API_CALLABLE(SetActionCommandMode); API_CALLABLE(GetActionCommandMode); @@ -136,16 +213,16 @@ API_CALLABLE(SetActionHudPrepareTime); API_CALLABLE(GetCommandAutoSuccess); API_CALLABLE(SetCommandAutoSuccess); API_CALLABLE(func_802693F0); -API_CALLABLE(CloseActionCommandInfo); -API_CALLABLE(func_80269470); +API_CALLABLE(InterruptActionCommand); +API_CALLABLE(InterruptLeechActionCommand); API_CALLABLE(ShowActionHud); -API_CALLABLE(GetActionSuccessCopy); -API_CALLABLE(GetActionResult); +API_CALLABLE(GetMashActionQuality); +API_CALLABLE(GetJumpActionQuality); API_CALLABLE(SetActionResult); API_CALLABLE(GetBlockResult); -API_CALLABLE(GetActionQuality); -API_CALLABLE(SetActionQuality); -API_CALLABLE(func_80269600); -API_CALLABLE(func_8026962C); +API_CALLABLE(GetActionProgress); +API_CALLABLE(SetActionProgress); +API_CALLABLE(GetActionResultTier); +API_CALLABLE(SetActionResultTier); #endif diff --git a/src/battle/action_cmd/07.c b/src/battle/action_cmd/07.c deleted file mode 100644 index 2af443b707b..00000000000 --- a/src/battle/action_cmd/07.c +++ /dev/null @@ -1,200 +0,0 @@ -#include "common.h" -#include "battle/action_cmd.h" - -#define NAMESPACE action_command_07 - -void btl_message_unlock_box_pos(void); - -BSS s32 D_802A9620; - -extern s32 actionCmdTable07[]; - -API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - BattleStatus* battleStatus = &gBattleStatus; - Bytecode* args = script->ptrReadPos; - s32 hudElement; - s32 hudElementTemp; - - battleStatus->unk_82 = 5; - battleStatus->actionCmdDifficultyTable = actionCmdTable07; - - actionCommandStatus->autoSucceed = 0; - actionCommandStatus->actionCommandID = ACTION_COMMAND_07; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = evt_get_variable(script, *args); - actionCommandStatus->hudPosX = -48; - actionCommandStatus->barFillWidth = 0; - D_802A9620 = 0; - actionCommandStatus->hudPosY = 80; - - hudElement = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = hudElement; - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(hudElement, 0); - - // Weird use of an extra temp settles regalloc here. - hudElementTemp = hud_element_create(&HES_BlueMeter); - hudElement = hudElementTemp; - actionCommandStatus->hudElements[1] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElement = hud_element_create(&HES_RunAwayOK); - actionCommandStatus->hudElements[2] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; - - return ApiStatus_DONE2; -} - -API_CALLABLE(N(start)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - BattleStatus* battleStatus = &gBattleStatus; - s32* args = script->ptrReadPos; - s32 mask; - - actionCommandStatus->autoSucceed = 0; - actionCommandStatus->prepareTime = evt_get_variable(script, *args++); - actionCommandStatus->duration = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = adjust_action_command_difficulty(actionCommandStatus->difficulty); - - actionCommandStatus->wrongButtonPressed = FALSE; - battleStatus->actionSuccess = 0; - battleStatus->actionResult = ACTION_RESULT_FAIL; - - battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; - btl_message_unlock_box_pos(); - actionCommandStatus->state = 10; - - return ApiStatus_DONE2; -} - -void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - BattleStatus* battleStatus = &gBattleStatus; - s32 id; - - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); - - id = actionCommandStatus->hudElements[0]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); - } - hud_element_set_alpha(id, 255); - - id = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); - } - - id = actionCommandStatus->hudElements[2]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); - } - - actionCommandStatus->state = 1; - break; - case 1: - btl_set_popup_duration(99); - - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; - } - - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_pos(actionCommandStatus->hudElements[2], actionCommandStatus->hudPosX + 31, actionCommandStatus->hudPosY + 14); - break; - case 10: - btl_set_popup_duration(99); - - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; - return; - } - - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton); - battleStatus->actionSuccess = 0; - D_802A9620 = 1; - actionCommandStatus->unk_5D = 0; - actionCommandStatus->state = 11; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - // fallthrough - case 11: - btl_set_popup_duration(99); - - if (battleStatus->curButtonsPressed & BUTTON_A) { - s32 fillAmt = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 6; - - if (actionCommandStatus->unk_5D == 0) { - actionCommandStatus->barFillLevel += fillAmt; - } - } - - if (actionCommandStatus->barFillLevel > 10000) { - actionCommandStatus->barFillLevel = 10000; - actionCommandStatus->unk_5D = 3; - } - - if (actionCommandStatus->unk_5D != 0) { - actionCommandStatus->unk_5D--; - if (actionCommandStatus->unk_5D == 0) { - actionCommandStatus->barFillLevel = 0; - battleStatus->actionSuccess++; - } - } - - battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100; - - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; - } - btl_set_popup_duration(0); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; - break; - case 12: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; - } - action_command_free(); - break; - } -} - -void N(draw)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - s32 hudX; - s32 hudY; - s32 hudElement1; - - hud_element_draw_clipped(actionCommandStatus->hudElements[0]); - hudElement1 = actionCommandStatus->hudElements[1]; - hud_element_draw_clipped(hudElement1); - hud_element_get_render_pos(hudElement1, &hudX, &hudY); - - if (D_802A9620 == 0) { - draw_mash_meter_multicolor_with_divisor(hudX, hudY, actionCommandStatus->barFillLevel / 100, 1); - } else { - draw_mash_meter_multicolor_with_divisor(hudX, hudY, actionCommandStatus->barFillLevel / 100, 2); - } - - hud_element_draw_clipped(actionCommandStatus->hudElements[2]); -} - -#include "common/free_hud_elements.inc.c" diff --git a/src/battle/action_cmd/07.h b/src/battle/action_cmd/07.h deleted file mode 100644 index 94c399dce20..00000000000 --- a/src/battle/action_cmd/07.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _07_H_ -#define _07_H_ - -#include "common_structs.h" - -API_CALLABLE(action_command_07_init); -API_CALLABLE(action_command_07_start); -void action_command_07_update(void); -void action_command_07_draw(void); -void action_command_07_free(void); - -#endif diff --git a/src/battle/action_cmd/0A.c b/src/battle/action_cmd/0A.c deleted file mode 100644 index c78999e117c..00000000000 --- a/src/battle/action_cmd/0A.c +++ /dev/null @@ -1,161 +0,0 @@ -#include "common.h" -#include "battle/action_cmd.h" - -#define NAMESPACE action_command_0A - -extern s32 actionCmdTable0A[]; - -API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - BattleStatus* battleStatus = &gBattleStatus; - s32 hudElement; - - battleStatus->unk_82 = 100; - battleStatus->actionCmdDifficultyTable = actionCmdTable0A; - battleStatus->actionResult = ACTION_RESULT_NONE; - - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; - return ApiStatus_DONE2; - } - - action_command_init_status(); - - actionCommandStatus->actionCommandID = ACTION_COMMAND_0A; - actionCommandStatus->showHud = TRUE; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->isBarFilled = FALSE; - battleStatus->actionSuccess = 0; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->hudPosY = 80; - - hudElement = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElement = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElement = hud_element_create(&HES_100pct); - actionCommandStatus->hudElements[2] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - return ApiStatus_DONE2; -} - -#include "common/MashActionCommandStart.inc.c" - -void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - BattleStatus* battleStatus = &gBattleStatus; - s32 id; - s32 cutoff; - - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); - - id = actionCommandStatus->hudElements[0]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); - } - - id = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); - } - - actionCommandStatus->state = 1; - break; - case 1: - btl_set_popup_duration(99); - - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; - } - - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - break; - case 10: - btl_set_popup_duration(99); - - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; - return; - } - - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton); - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->state = 11; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - // fallthrough - case 11: - btl_set_popup_duration(99); - - if (battleStatus->curButtonsPressed & BUTTON_A) { - actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 15; - } - - if (actionCommandStatus->barFillLevel >= 10000) { - id = actionCommandStatus->hudElements[2]; - actionCommandStatus->barFillLevel = 10000; - actionCommandStatus->isBarFilled = TRUE; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 50, actionCommandStatus->hudPosY + 28); - hud_element_clear_flags(id, 2); - } - - battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100; - - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; - } - - if (actionCommandStatus->barFillLevel == 0) { - battleStatus->actionSuccess = -1; - } else { - battleStatus->actionSuccess = actionCommandStatus->barFillLevel / 100; - } - - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1]; - if (battleStatus->actionSuccess >= cutoff) { - battleStatus->actionResult = ACTION_RESULT_SUCCESS; - } else { - battleStatus->actionResult = ACTION_RESULT_MINUS_2; - } - - if (battleStatus->actionSuccess == 100) { - func_80269160(); - } - - btl_set_popup_duration(0); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; - break; - case 12: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; - } - action_command_free(); - break; - } -} - -#include "common/draw_hud_elements.inc.c" - -#include "common/free_hud_elements.inc.c" diff --git a/src/battle/action_cmd/0A.h b/src/battle/action_cmd/0A.h deleted file mode 100644 index a899a4042a7..00000000000 --- a/src/battle/action_cmd/0A.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _0A_H_ -#define _0A_H_ - -#include "common_structs.h" - -API_CALLABLE(action_command_0A_init); -API_CALLABLE(action_command_0A_start); -void action_command_0A_update(void); -void action_command_0A_draw(void); -void action_command_0A_free(void); - -#endif diff --git a/src/battle/action_cmd/air_lift.c b/src/battle/action_cmd/air_lift.c index 4155f7bfd4c..fc4f2a9968b 100644 --- a/src/battle/action_cmd/air_lift.c +++ b/src/battle/action_cmd/air_lift.c @@ -4,224 +4,248 @@ #define NAMESPACE action_command_air_lift -s32 D_802A9852_4292C0[] = { 0, 25, 50, 75, 75, 0, 0, 0 }; +extern s32 actionCmdTableAirLift[]; -BSS s32 air_lift_bss_0; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_BUTTON = 0, + HIDX_METER = 1, + HIDX_100_PCT = 2, +}; -extern s32 actionCmdTableAirLift[]; +// how much to add to the meter per input if all modifiers are neutral +#define METER_FILL_RATE 820 + +s32 N(DrainRateTable)[] = { 0, 25, 50, 75, 75 }; + +#define GET_DRAIN_RATE(pct) PCT_TO_TABLE_RATE(N(DrainRateTable), pct) + +BSS b32 N(HasStarted); API_CALLABLE(N(init)) { s32 *args = script->ptrReadPos; BattleStatus* battleStatus = &gBattleStatus; - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - s32 hudElement; + ActionCommandStatus* acs = &gActionCommandStatus; + HudElemID hid; battleStatus->actionCmdDifficultyTable = actionCmdTableAirLift; - battleStatus->unk_82 = 0; + battleStatus->maxActionQuality = 0; battleStatus->actionResult = ACTION_RESULT_NONE; + action_command_init_status(); - actionCommandStatus->unk_5A = evt_get_variable(script, *args++); - actionCommandStatus->actionCommandID = ACTION_COMMAND_AIR_LIFT; - actionCommandStatus->showHud = TRUE; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->isBarFilled = FALSE; - battleStatus->actionSuccess = 0; + + // effectiveness for this move comes from AirLiftChance, which ultimately depends on + // the target actor's HP and status. this value will ONLY be zero if the target actor + // is transparent, in which case a dummy version of the action command is played out + // which is guaranteed to fail. + acs->escapeChance = evt_get_variable(script, *args++); + + acs->actionCommandID = ACTION_COMMAND_AIR_LIFT; + acs->showHud = TRUE; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + acs->isMeterFilled = FALSE; battleStatus->actionQuality = 0; - actionCommandStatus->hudPrepareTime = 30; - actionCommandStatus->hudPosX = -48; - air_lift_bss_0 = 0; - actionCommandStatus->hudPosY = 80; - - hudElement = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElement = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElement = hud_element_create(&HES_100pct); - actionCommandStatus->hudElements[2] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + battleStatus->actionProgress = 0; + + N(HasStarted) = FALSE; + acs->hudPrepareTime = 30; + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_BUTTON] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_100pct); + acs->hudElemIDs[HIDX_100_PCT] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); return ApiStatus_DONE2; } API_CALLABLE(N(start)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Bytecode* args = script->ptrReadPos; - u8 mashMeterCutoff; action_command_init_status(); - actionCommandStatus->prepareTime = evt_get_variable(script, *args++); - actionCommandStatus->duration = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = adjust_action_command_difficulty(actionCommandStatus->difficulty); - actionCommandStatus->targetWeakness = evt_get_variable(script, *args++); + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + acs->variation = evt_get_variable(script, *args++); - actionCommandStatus->wrongButtonPressed = FALSE; - battleStatus->actionSuccess = 0; + acs->wrongButtonPressed = FALSE; + battleStatus->actionQuality = 0; battleStatus->actionResult = ACTION_RESULT_NONE; + battleStatus->maxActionQuality = acs->mashMeterCutoffs[acs->mashMeterNumIntervals - 1]; - mashMeterCutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1]; - actionCommandStatus->unk_5C = 0; + acs->any.unk_5C = 0; battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; - actionCommandStatus->state = 10; - battleStatus->unk_82 = mashMeterCutoff; + acs->state = AC_STATE_START; - func_80269118(); + increment_action_command_attempt_count(); return ApiStatus_DONE2; } void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); - id = actionCommandStatus->hudElements[0]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_BUTTON]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - id = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); - if (actionCommandStatus->hudPrepareTime != 0) { - actionCommandStatus->hudPrepareTime--; + if (acs->hudPrepareTime != 0) { + acs->hudPrepareTime--; return; } - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUTTON], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); break; - case 10: - btl_set_popup_duration(99); + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + if (acs->prepareTime != 0) { + acs->prepareTime--; return; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton); - air_lift_bss_0 = 1; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - sfx_play_sound_with_params(SOUND_LOOP_CHARGE_BAR, 0, 0, 0); - actionCommandStatus->state = 11; + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_MashAButton); + N(HasStarted) = TRUE; + acs->stateTimer = acs->duration; + sfx_play_sound_with_params(SOUND_LOOP_CHARGE_METER, 0, 0, 0); + acs->state = AC_STATE_ACTIVE; + // fallthrough - case 11: - btl_set_popup_duration(99); - if (!actionCommandStatus->isBarFilled) { - if (actionCommandStatus->unk_5A != 0) { - s32 a = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals]; - - actionCommandStatus->barFillLevel -= D_802A9852_4292C0[actionCommandStatus->barFillLevel / a / 20]; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // meter can drain if it hasn't been fully filled + if (!acs->isMeterFilled) { + if (acs->escapeChance != 0) { + s32 maxFillLevel = acs->mashMeterCutoffs[acs->mashMeterNumIntervals]; + acs->meterFillLevel -= GET_DRAIN_RATE(acs->meterFillLevel / maxFillLevel); + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } else { - actionCommandStatus->barFillLevel -= 10; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + acs->meterFillLevel -= 10; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } } - if (battleStatus->actionCommandMode != ACTION_COMMAND_MODE_NOT_LEARNED && (battleStatus->curButtonsPressed & BUTTON_A)) { - if (actionCommandStatus->unk_5A != 0) { - s32 a = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; - s32 b = actionCommandStatus->unk_5A * 820; - - actionCommandStatus->barFillLevel += (a * b) / 10000; + // check for meter-filling input + if (battleStatus->actionCommandMode != AC_MODE_NOT_LEARNED && (battleStatus->curButtonsPressed & BUTTON_A)) { + if (acs->escapeChance != 0) { + // fill rate = 820 multiplied by two values expressed as percentages + s32 difficultyPct = battleStatus->actionCmdDifficultyTable[acs->difficulty]; + s32 effectivenessPct = METER_FILL_RATE * acs->escapeChance; + // divide by 100 for each percent-based multiplier + acs->meterFillLevel += (difficultyPct * effectivenessPct) / (100 * 100); } else { - actionCommandStatus->barFillLevel += 100; - if (actionCommandStatus->barFillLevel >= 500) { - actionCommandStatus->barFillLevel = 500; + acs->meterFillLevel += ONE_PCT_MASH; + if (acs->meterFillLevel >= 5 * ONE_PCT_MASH) { + acs->meterFillLevel = 5 * ONE_PCT_MASH; } } - } - if (actionCommandStatus->barFillLevel > 10000) { - actionCommandStatus->barFillLevel = 10000; - actionCommandStatus->isBarFilled = TRUE; - id = actionCommandStatus->hudElements[2]; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 50, actionCommandStatus->hudPosY + 28); - hud_element_clear_flags(id, 2); + // handle meter reaching 100% + if (acs->meterFillLevel > MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + acs->isMeterFilled = TRUE; + hid = acs->hudElemIDs[HIDX_100_PCT]; + hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY + 28); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - battleStatus->actionSuccess = actionCommandStatus->barFillLevel / 100; - if (battleStatus->actionQuality < battleStatus->actionSuccess) { - battleStatus->actionQuality = battleStatus->actionSuccess; + battleStatus->actionQuality = acs->meterFillLevel / ONE_PCT_MASH; + if (battleStatus->actionProgress < battleStatus->actionQuality) { + battleStatus->actionProgress = battleStatus->actionQuality; } - sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_BAR, 0, 0, battleStatus->actionSuccess * 12); + sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_METER, 0, 0, battleStatus->actionQuality * 12); - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } - if (actionCommandStatus->unk_5A == 0) { - battleStatus->actionQuality = 0; + if (acs->escapeChance == 0) { + battleStatus->actionProgress = 0; } - battleStatus->actionSuccess = battleStatus->actionQuality; - if (rand_int(99) < battleStatus->actionSuccess) { + // threshold for success is completely random, only guaranteed if the meter is 100% filled + battleStatus->actionQuality = battleStatus->actionProgress; + if (rand_int(99) < battleStatus->actionQuality) { battleStatus->actionResult = ACTION_RESULT_SUCCESS; - battleStatus->actionSuccess = 1; + battleStatus->actionQuality = 1; } else { - battleStatus->actionResult = ACTION_RESULT_MINUS_2; - battleStatus->actionSuccess = -1; + battleStatus->actionResult = ACTION_RESULT_METER_NOT_ENOUGH; + battleStatus->actionQuality = AC_QUALITY_FAILED; } - if (battleStatus->actionSuccess == 1) { - func_80269160(); + if (battleStatus->actionQuality == 1) { + increment_action_command_success_count(); } - btl_set_popup_duration(0); - sfx_stop_sound(SOUND_LOOP_CHARGE_BAR); - actionCommandStatus->frameCounter = 20; - actionCommandStatus->state = 12; + + btl_set_popup_duration(POPUP_MSG_OFF); + sfx_stop_sound(SOUND_LOOP_CHARGE_METER); + acs->stateTimer = 20; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->unk_5A == 0) { - actionCommandStatus->barFillLevel -= 100; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + case AC_STATE_DISPOSE: + if (acs->escapeChance == 0) { + acs->meterFillLevel -= ONE_PCT_MASH; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } action_command_free(); break; @@ -229,28 +253,31 @@ void N(update)(void) { } void N(draw)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - s32 hudX; - s32 hudY; - s32 hudElement1; + ActionCommandStatus* acs = &gActionCommandStatus; + s32 hudX, hudY; + HudElemID hid; - if (gBattleStatus.actionCommandMode != ACTION_COMMAND_MODE_NOT_LEARNED) { - hud_element_draw_clipped(actionCommandStatus->hudElements[0]); + if (gBattleStatus.actionCommandMode != AC_MODE_NOT_LEARNED) { + hud_element_draw_clipped(acs->hudElemIDs[HIDX_BUTTON]); } - hudElement1 = actionCommandStatus->hudElements[1]; - hud_element_draw_clipped(hudElement1); - hud_element_get_render_pos(hudElement1, &hudX, &hudY); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_draw_clipped(hid); + hud_element_get_render_pos(hid, &hudX, &hudY); - if (air_lift_bss_0 == 0) { - draw_mash_meter_multicolor_with_divisor(hudX, hudY, actionCommandStatus->barFillLevel / 100, 1); - } else if (!actionCommandStatus->isBarFilled) { - draw_mash_meter_multicolor_with_divisor(hudX, hudY, actionCommandStatus->barFillLevel / 100, 4); + if (!N(HasStarted)) { + draw_mash_meter_multicolor_with_divisor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH, 1); + } else if (!acs->isMeterFilled) { + draw_mash_meter_multicolor_with_divisor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH, 4); } else { - draw_mash_meter_blink_with_divisor(hudX, hudY, actionCommandStatus->barFillLevel / 100, 4); + draw_mash_meter_blink_with_divisor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH, 4); } - hud_element_draw_clipped(actionCommandStatus->hudElements[2]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_100_PCT]); } -#include "common/free_hud_elements.inc.c" +void N(free)(void) { + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_BUTTON]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_METER]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_100_PCT]); +} diff --git a/src/battle/action_cmd/air_lift.h b/src/battle/action_cmd/air_lift.h index 264b6f16d36..1ce977b2c1c 100644 --- a/src/battle/action_cmd/air_lift.h +++ b/src/battle/action_cmd/air_lift.h @@ -3,8 +3,12 @@ #include "common_structs.h" +// args: chance of success API_CALLABLE(action_command_air_lift_init); + +// args: prep time, duration, difficulty, variation (unused) API_CALLABLE(action_command_air_lift_start); + void action_command_air_lift_update(void); void action_command_air_lift_draw(void); void action_command_air_lift_free(void); diff --git a/src/battle/action_cmd/air_raid.c b/src/battle/action_cmd/air_raid.c index c8721b1088b..75082f06cfc 100644 --- a/src/battle/action_cmd/air_raid.c +++ b/src/battle/action_cmd/air_raid.c @@ -3,229 +3,282 @@ #define NAMESPACE action_command_air_raid -s32 D_802A9970_429C90[] = { 0, 25, 50, 75, 75 }; -s32 D_802A9984_429CA4[] = { 40, 70, 99, 200 }; -s32 D_802A9994_429CB4[] = { 35, 60, 80, 99, 200 }; -s32 D_802A99A8_429CC8[] = { 35, 35, 60, 80, 99, 200 }; - extern s32 actionCmdTableAirRaid[]; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_STICK = 0, + HIDX_METER = 1, + HIDX_100_PCT = 2, +}; + +// how much to add to the meter per input if all modifiers are neutral +#define METER_FILL_RATE 850 + +s32 N(DrainRateTable)[] = { 0, 25, 50, 75, 75 }; + +#define GET_DRAIN_RATE(pct) PCT_TO_TABLE_RATE(N(DrainRateTable), pct) + +// threshold meter values; not used for anything +// these correspond to values provided via SetupMashMeter +s32 N(BasicThresholds)[] = { 40, 70, 99, 200 }; +s32 N(SuperThresholds)[] = { 35, 60, 80, 99, 200 }; +s32 N(UltraThresholds)[] = { 35, 35, 60, 80, 99, 200 }; + API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 hudElement; + HudElemID hid; - battleStatus->unk_82 = 100; + battleStatus->maxActionQuality = 100; battleStatus->actionCmdDifficultyTable = actionCmdTableAirRaid; battleStatus->actionResult = ACTION_RESULT_NONE; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_AIR_RAID; - actionCommandStatus->showHud = TRUE; - actionCommandStatus->hudPrepareTime = 30; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->isBarFilled = FALSE; - battleStatus->actionSuccess = 0; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->hudPosY = 80; - - hudElement = hud_element_create(&HES_StickNeutral); - actionCommandStatus->hudElements[0] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElement = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElement = hud_element_create(&HES_100pct); - actionCommandStatus->hudElements[2] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + acs->actionCommandID = ACTION_COMMAND_AIR_RAID; + acs->showHud = TRUE; + acs->hudPrepareTime = 30; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + acs->isMeterFilled = FALSE; + battleStatus->actionQuality = 0; + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_StickNeutral); + acs->hudElemIDs[HIDX_STICK] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_100pct); + acs->hudElemIDs[HIDX_100_PCT] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); return ApiStatus_DONE2; } -#include "common/MashActionCommandStart.inc.c" +API_CALLABLE(N(start)) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + Bytecode* args = script->ptrReadPos; + + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; + return ApiStatus_DONE2; + } + + action_command_init_status(); + + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + acs->statusChance = evt_get_variable(script, *args++); // unused + + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; + battleStatus->actionResult = ACTION_RESULT_NONE; + battleStatus->maxActionQuality = acs->mashMeterCutoffs[(acs->mashMeterNumIntervals - 1)]; + battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; + acs->state = AC_STATE_START; + + increment_action_command_attempt_count(); + + return ApiStatus_DONE2; +} void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Actor* partner = battleStatus->partnerActor; + HudElemID hid; s32 cutoff; - s32 id; - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); - id = actionCommandStatus->hudElements[0]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_STICK]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - id = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); - if (actionCommandStatus->hudPrepareTime != 0) { - actionCommandStatus->hudPrepareTime--; + if (acs->hudPrepareTime != 0) { + acs->hudPrepareTime--; return; } - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_STICK], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); break; - case 10: - btl_set_popup_duration(99); + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + if (acs->prepareTime != 0) { + acs->prepareTime--; return; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_StickMashLeft); - actionCommandStatus->barFillLevel = 0; - battleStatus->unk_85 = 0; - actionCommandStatus->unk_5C = 0; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - sfx_play_sound_with_params(SOUND_LOOP_CHARGE_BAR, 0, 0, 0); - actionCommandStatus->state = 11; + hud_element_set_script(acs->hudElemIDs[HIDX_STICK], &HES_StickMashLeft); + acs->meterFillLevel = 0; + battleStatus->resultTier = 0; + acs->airRaid.holdingLeft = FALSE; + acs->stateTimer = acs->duration; + sfx_play_sound_with_params(SOUND_LOOP_CHARGE_METER, 0, 0, 0); + acs->state = AC_STATE_ACTIVE; + // fallthrough - case 11: - btl_set_popup_duration(99); - if (!actionCommandStatus->isBarFilled) { - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals]; - - actionCommandStatus->barFillLevel -= D_802A9970_429C90[actionCommandStatus->barFillLevel / cutoff / 20]; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // meter can drain if it hasn't been fully filled + if (!acs->isMeterFilled) { + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals]; + acs->meterFillLevel -= GET_DRAIN_RATE(acs->meterFillLevel / cutoff); + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } + } - if (!actionCommandStatus->isBarFilled) { - if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { - actionCommandStatus->unk_5C = 1; - } + // check for meter-filling input + if (!acs->isMeterFilled) { + if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { + acs->airRaid.holdingLeft = TRUE; + } - if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT)) { - if (actionCommandStatus->unk_5C != 0) { - actionCommandStatus->barFillLevel += (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 850) / 100; - actionCommandStatus->unk_5C = 0; - } + if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT)) { + if (acs->airRaid.holdingLeft) { + acs->meterFillLevel += SCALE_BY_PCT(METER_FILL_RATE, battleStatus->actionCmdDifficultyTable[acs->difficulty]); + acs->airRaid.holdingLeft = FALSE; } + } - if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { - actionCommandStatus->barFillLevel -= (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 850) / 100; - } + // right stick inputs actively drain the meter + if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { + acs->meterFillLevel -= SCALE_BY_PCT(METER_FILL_RATE, battleStatus->actionCmdDifficultyTable[acs->difficulty]); } } - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } - if (actionCommandStatus->barFillLevel > 10000) { - id = actionCommandStatus->hudElements[2]; - actionCommandStatus->barFillLevel = 10000; - actionCommandStatus->isBarFilled = TRUE; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 50, actionCommandStatus->hudPosY + 28); - hud_element_clear_flags(id, 2); + // handle meter reaching 100% + if (acs->meterFillLevel > MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + acs->isMeterFilled = TRUE; + hid = acs->hudElemIDs[HIDX_100_PCT]; + hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY + 28); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100; - sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_BAR, 0, 0, battleStatus->actionQuality * 12); + battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH; + sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_METER, 0, 0, battleStatus->actionProgress * 12); + // resultTier is not used by this move; uses actionProgress instead via the move script switch (partner->actorBlueprint->level) { case PARTNER_RANK_NORMAL: - if (battleStatus->actionQuality >= D_802A9984_429CA4[battleStatus->unk_85]) { - battleStatus->unk_85++; + if (battleStatus->actionProgress >= N(BasicThresholds)[battleStatus->resultTier]) { + battleStatus->resultTier++; } - if (battleStatus->unk_85 > 0 && battleStatus->actionQuality < D_802A9984_429CA4[battleStatus->unk_85 - 1]) { - battleStatus->unk_85--; + if (battleStatus->resultTier > 0 && battleStatus->actionProgress < N(BasicThresholds)[battleStatus->resultTier - 1]) { + battleStatus->resultTier--; } break; case PARTNER_RANK_SUPER: - if (battleStatus->actionQuality >= D_802A9994_429CB4[battleStatus->unk_85]) { - battleStatus->unk_85++; + if (battleStatus->actionProgress >= N(SuperThresholds)[battleStatus->resultTier]) { + battleStatus->resultTier++; } - if (battleStatus->unk_85 > 0 && battleStatus->actionQuality < D_802A9994_429CB4[battleStatus->unk_85 - 1]) { - battleStatus->unk_85--; + if (battleStatus->resultTier > 0 && battleStatus->actionProgress < N(SuperThresholds)[battleStatus->resultTier - 1]) { + battleStatus->resultTier--; } break; case PARTNER_RANK_ULTRA: - if (battleStatus->actionQuality >= D_802A99A8_429CC8[battleStatus->unk_85]) { - battleStatus->unk_85++; + if (battleStatus->actionProgress >= N(UltraThresholds)[battleStatus->resultTier]) { + battleStatus->resultTier++; } - if (battleStatus->unk_85 > 0 && battleStatus->actionQuality < D_802A99A8_429CC8[battleStatus->unk_85 - 1]) { - battleStatus->unk_85--; + if (battleStatus->resultTier > 0 && battleStatus->actionProgress < N(UltraThresholds)[battleStatus->resultTier - 1]) { + battleStatus->resultTier--; } break; } - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } - if (actionCommandStatus->barFillLevel == 0) { - battleStatus->actionSuccess = -1; + if (acs->meterFillLevel == 0) { + battleStatus->actionQuality = AC_QUALITY_FAILED; } else { - battleStatus->actionSuccess = actionCommandStatus->barFillLevel / 100; + battleStatus->actionQuality = acs->meterFillLevel / ONE_PCT_MASH; } - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1]; - if (battleStatus->actionSuccess <= cutoff) { - battleStatus->actionResult = ACTION_RESULT_MINUS_2; - } else { + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals - 1]; + if (battleStatus->actionQuality > cutoff) { battleStatus->actionResult = ACTION_RESULT_SUCCESS; + } else { + battleStatus->actionResult = ACTION_RESULT_METER_NOT_ENOUGH; } - if (battleStatus->actionSuccess == 100) { - func_80269160(); + if (battleStatus->actionQuality == 100) { + // only count 100% fill as success for this action command + increment_action_command_success_count(); } - btl_set_popup_duration(0); - sfx_stop_sound(SOUND_LOOP_CHARGE_BAR); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; + btl_set_popup_duration(POPUP_MSG_OFF); + sfx_stop_sound(SOUND_LOOP_CHARGE_METER); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; + case AC_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } action_command_free(); break; } } -#include "common/draw_hud_elements.inc.c" +#include "common/MashCommandDraw.inc.c" -#include "common/free_hud_elements.inc.c" +#include "common/MashCommandFree.inc.c" diff --git a/src/battle/action_cmd/air_raid.h b/src/battle/action_cmd/air_raid.h index 8d84daf63b1..74dfcc8a78e 100644 --- a/src/battle/action_cmd/air_raid.h +++ b/src/battle/action_cmd/air_raid.h @@ -3,8 +3,12 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_air_raid_init); + +// args: prep time, duration, difficulty API_CALLABLE(action_command_air_raid_start); + void action_command_air_raid_update(void); void action_command_air_raid_draw(void); void action_command_air_raid_free(void); diff --git a/src/battle/action_cmd/body_slam.c b/src/battle/action_cmd/body_slam.c index 15eb77500fe..a5aecc3e8ba 100644 --- a/src/battle/action_cmd/body_slam.c +++ b/src/battle/action_cmd/body_slam.c @@ -5,167 +5,216 @@ extern s32 actionCmdTableBodySlam[]; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_BUTTON = 0, + HIDX_METER = 1, + HIDX_LIGHT = 2, + HIDX_FRAME = 3, +}; + +// how much to add to the meter per frame +#define METER_FILL_RATE 154 + API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; - battleStatus->unk_82 = 100; + battleStatus->maxActionQuality = 100; battleStatus->actionCmdDifficultyTable = actionCmdTableBodySlam; battleStatus->actionResult = ACTION_RESULT_NONE; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_BODY_SLAM; - actionCommandStatus->showHud = TRUE; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->isBarFilled = FALSE; - battleStatus->actionSuccess = 0; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->hudPosY = 80; - - id = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_FillGaugeResult); - actionCommandStatus->hudElements[3] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_TimingWait); - actionCommandStatus->hudElements[2] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 41, actionCommandStatus->hudPosY + 22); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); + acs->actionCommandID = ACTION_COMMAND_BODY_SLAM; + acs->showHud = TRUE; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + acs->isMeterFilled = FALSE; + battleStatus->actionQuality = 0; + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_BUTTON] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_FillGaugeResult); + acs->hudElemIDs[HIDX_FRAME] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_TimingWait); + acs->hudElemIDs[HIDX_LIGHT] = hid; + hud_element_set_render_pos(hid, acs->hudPosX + 41, acs->hudPosY + 22); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); return ApiStatus_DONE2; } -#include "common/MashActionCommandStart.inc.c" +API_CALLABLE(N(start)) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + Bytecode* args = script->ptrReadPos; + + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; + return ApiStatus_DONE2; + } + + action_command_init_status(); + + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + acs->statusChance = evt_get_variable(script, *args++); // unused + + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; + battleStatus->actionResult = ACTION_RESULT_NONE; + battleStatus->maxActionQuality = acs->mashMeterCutoffs[(acs->mashMeterNumIntervals - 1)]; + battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; + acs->state = AC_STATE_START; + + increment_action_command_attempt_count(); + + return ApiStatus_DONE2; +} void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; - s32 phi_v0; + HudElemID hid; - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); - id = actionCommandStatus->hudElements[0]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_BUTTON]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - id = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - id = actionCommandStatus->hudElements[2]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_LIGHT]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - id = actionCommandStatus->hudElements[3]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_FRAME]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_pos(actionCommandStatus->hudElements[2], actionCommandStatus->hudPosX + 41, actionCommandStatus->hudPosY + 22); - hud_element_set_render_pos(actionCommandStatus->hudElements[3], actionCommandStatus->hudPosX + 42, actionCommandStatus->hudPosY + 24); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUTTON], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_LIGHT], acs->hudPosX + 41, acs->hudPosY + 22); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_FRAME], acs->hudPosX + 42, acs->hudPosY + 24); break; - case 10: - btl_set_popup_duration(99); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->prepareTime != 0) { + acs->prepareTime--; return; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_AButtonDown); - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->thresholdLevel = 0; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - sfx_play_sound_with_params(SOUND_LOOP_CHARGE_BAR, 0, 0, 0); - actionCommandStatus->state = 11; - case 11: - btl_set_popup_duration(99); - + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_AButtonDown); + acs->meterFillLevel = 0; + acs->escapeThreshold = 0; + acs->stateTimer = acs->duration; + sfx_play_sound_with_params(SOUND_LOOP_CHARGE_METER, 0, 0, 0); + acs->state = AC_STATE_ACTIVE; + + // fallthrough + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // check for meter-filling input if (battleStatus->curButtonsDown & BUTTON_A) { - actionCommandStatus->barFillLevel += 154; - actionCommandStatus->thresholdLevel += 154; + acs->meterFillLevel += METER_FILL_RATE; + acs->escapeThreshold += METER_FILL_RATE; } else { - actionCommandStatus->frameCounter = 0; + acs->stateTimer = 0; } - if (actionCommandStatus->barFillLevel >= 10000) { - actionCommandStatus->barFillLevel = 10000; - hud_element_set_script(actionCommandStatus->hudElements[2], &HES_TimingReady); - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_AButton); - if (!actionCommandStatus->isBarFilled) { + // handle meter reaching 100% + if (acs->meterFillLevel >= MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + hud_element_set_script(acs->hudElemIDs[HIDX_LIGHT], &HES_TimingReady); + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_AButton); + if (!acs->isMeterFilled) { sfx_play_sound(SOUND_TIMING_BAR_GO); - actionCommandStatus->isBarFilled = TRUE; + acs->isMeterFilled = TRUE; } } - battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100; - sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_BAR, 0, 0, battleStatus->actionQuality * 12); - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; + battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH; + sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_METER, 0, 0, battleStatus->actionProgress * 12); + if (acs->stateTimer != 0) { + acs->stateTimer--; return; } do { - if (actionCommandStatus->thresholdLevel < 10000) { - battleStatus->actionSuccess = -1; - } else if (actionCommandStatus->thresholdLevel - (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 154) >= 10309) { - battleStatus->actionSuccess = -1; + if (acs->escapeThreshold < MAX_MASH_UNITS) { + battleStatus->actionQuality = AC_QUALITY_FAILED; } else { - battleStatus->actionSuccess = 1; + s32 window = battleStatus->actionCmdDifficultyTable[acs->difficulty] * METER_FILL_RATE; + // release needs to be within 2 frames + modifier from difficulty table + if (acs->escapeThreshold - window >= MAX_MASH_UNITS + 2 * METER_FILL_RATE + 1) { + battleStatus->actionQuality = AC_QUALITY_FAILED; + } else { + battleStatus->actionQuality = 1; + } } } while (0); // required to match battleStatus->actionResult = ACTION_RESULT_FAIL; - if (battleStatus->actionSuccess == 1) { - func_80269160(); + if (battleStatus->actionQuality == 1) { + increment_action_command_success_count(); } - btl_set_popup_duration(0); - sfx_stop_sound(SOUND_LOOP_CHARGE_BAR); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; + + btl_set_popup_duration(POPUP_MSG_OFF); + sfx_stop_sound(SOUND_LOOP_CHARGE_METER); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; + case AC_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; return; } action_command_free(); @@ -174,21 +223,21 @@ void N(update)(void) { } void N(draw)(void) { - s32 x, y; - s32 hudElement; - - hud_element_draw_clipped(gActionCommandStatus.hudElements[0]); - hudElement = gActionCommandStatus.hudElements[1]; - hud_element_draw_clipped(hudElement); - hud_element_get_render_pos(hudElement, &x, &y); - hud_element_draw_clipped(gActionCommandStatus.hudElements[3]); - draw_mash_meter_multicolor(x, y, gActionCommandStatus.barFillLevel / 100); - hud_element_draw_clipped(gActionCommandStatus.hudElements[2]); + s32 hudX, hudY; + HudElemID hid; + + hud_element_draw_clipped(gActionCommandStatus.hudElemIDs[HIDX_BUTTON]); + hid = gActionCommandStatus.hudElemIDs[HIDX_METER]; + hud_element_draw_clipped(hid); + hud_element_get_render_pos(hid, &hudX, &hudY); + hud_element_draw_clipped(gActionCommandStatus.hudElemIDs[HIDX_FRAME]); + draw_mash_meter_multicolor(hudX, hudY, gActionCommandStatus.meterFillLevel / ONE_PCT_MASH); + hud_element_draw_clipped(gActionCommandStatus.hudElemIDs[HIDX_LIGHT]); } void N(free)(void) { - hud_element_free(gActionCommandStatus.hudElements[0]); - hud_element_free(gActionCommandStatus.hudElements[1]); - hud_element_free(gActionCommandStatus.hudElements[2]); - hud_element_free(gActionCommandStatus.hudElements[3]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_BUTTON]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_METER]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_LIGHT]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_FRAME]); } diff --git a/src/battle/action_cmd/body_slam.h b/src/battle/action_cmd/body_slam.h index 23360a0bfe5..71a73545806 100644 --- a/src/battle/action_cmd/body_slam.h +++ b/src/battle/action_cmd/body_slam.h @@ -3,10 +3,19 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_body_slam_init); + +// args: prep time, duration, difficulty, variation API_CALLABLE(action_command_body_slam_start); + void action_command_body_slam_update(void); void action_command_body_slam_draw(void); void action_command_body_slam_free(void); +enum { + ACV_SLAM_BOMBETTE = 0, + ACV_SLAM_WATT = 1, +}; + #endif diff --git a/src/battle/action_cmd/bomb.c b/src/battle/action_cmd/bomb.c index f56a9d9718b..920c8083ddb 100644 --- a/src/battle/action_cmd/bomb.c +++ b/src/battle/action_cmd/bomb.c @@ -3,189 +3,230 @@ #define NAMESPACE action_command_bomb -s32 D_802A9810_428280[] = { 0, 25, 50, 75, 75, 0, 0, 0 }; - extern s32 actionCmdTableBomb[]; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_BUTTON = 0, + HIDX_METER = 1, + HIDX_100_PCT = 2, +}; + +// how much to add to the meter per input if all modifiers are neutral +#define BASIC_FILL_TICK 940 +#define SUPER_FILL_TICK 800 +#define ULTRA_FILL_TICK 740 + +s32 N(DrainRateTable)[] = { 0, 25, 50, 75, 75 }; + +#define GET_DRAIN_RATE(pct) PCT_TO_TABLE_RATE(N(DrainRateTable), pct) + API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 hudElement; + HudElemID hid; - battleStatus->unk_82 = 100; + battleStatus->maxActionQuality = 100; battleStatus->actionCmdDifficultyTable = actionCmdTableBomb; battleStatus->actionResult = ACTION_RESULT_NONE; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_BOMB; - actionCommandStatus->showHud = TRUE; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->isBarFilled = FALSE; - battleStatus->actionSuccess = 0; - - actionCommandStatus->hudPosX = -48; - actionCommandStatus->hudPosY = 80; - - hudElement = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElement = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElement = hud_element_create(&HES_100pct); - actionCommandStatus->hudElements[2] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + acs->actionCommandID = ACTION_COMMAND_BOMB; + acs->showHud = TRUE; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + acs->isMeterFilled = FALSE; + battleStatus->actionQuality = 0; + + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_BUTTON] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_100pct); + acs->hudElemIDs[HIDX_100_PCT] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); return ApiStatus_DONE2; } -#include "common/MashActionCommandStart.inc.c" +API_CALLABLE(N(start)) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + Bytecode* args = script->ptrReadPos; + + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; + return ApiStatus_DONE2; + } + + action_command_init_status(); + + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + acs->variation = evt_get_variable(script, *args++); + + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; + battleStatus->actionResult = ACTION_RESULT_NONE; + battleStatus->maxActionQuality = acs->mashMeterCutoffs[(acs->mashMeterNumIntervals - 1)]; + battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; + acs->state = AC_STATE_START; + + increment_action_command_attempt_count(); + + return ApiStatus_DONE2; +} void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 hudElement; - s32 mashMeterCutoff; - - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); - hudElement = actionCommandStatus->hudElements[0]; - hud_element_set_alpha(hudElement, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + HudElemID hid; + s32 cutoff; + + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); + hid = acs->hudElemIDs[HIDX_BUTTON]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hudElement = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(hudElement, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, - actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, - actionCommandStatus->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUTTON], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); break; - case 10: - btl_set_popup_duration(99); + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + if (acs->prepareTime != 0) { + acs->prepareTime--; break; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton); - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - sfx_play_sound_with_params(SOUND_LOOP_CHARGE_BAR, 0, 0, 0); - actionCommandStatus->state = 11; + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_MashAButton); + acs->meterFillLevel = 0; + acs->stateTimer = acs->duration; + sfx_play_sound_with_params(SOUND_LOOP_CHARGE_METER, 0, 0, 0); + acs->state = AC_STATE_ACTIVE; // fallthrough - case 11: - btl_set_popup_duration(99); - if (!actionCommandStatus->isBarFilled) { - mashMeterCutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals]; - actionCommandStatus->barFillLevel -= - D_802A9810_428280[actionCommandStatus->barFillLevel / mashMeterCutoff / 20]; - - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // meter can drain if it hasn't been fully filled + if (!acs->isMeterFilled) { + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals]; + acs->meterFillLevel -= GET_DRAIN_RATE(acs->meterFillLevel / cutoff); + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } + // check for meter-filling input if (battleStatus->curButtonsPressed & BUTTON_A) { - switch (actionCommandStatus->targetWeakness) { - case 0: { - s32 fillOffset = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 235 * 4; - actionCommandStatus->barFillLevel += fillOffset / 100; + switch (acs->variation) { + case ACV_BOMB_BASIC: + acs->meterFillLevel += SCALE_BY_PCT(BASIC_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]); break; - } - case 1: - actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 8; + case ACV_BOMB_SUPER: + acs->meterFillLevel += SCALE_BY_PCT(SUPER_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]); break; - case 2: { - s32 fillOffset = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 185 * 4; - actionCommandStatus->barFillLevel += fillOffset / 100; + case ACV_BOMB_ULTRA: + acs->meterFillLevel += SCALE_BY_PCT(ULTRA_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]); break; - } } } - if (actionCommandStatus->barFillLevel > 10000) { - hudElement = actionCommandStatus->hudElements[2]; - actionCommandStatus->barFillLevel = 10000; - actionCommandStatus->isBarFilled = TRUE; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX + 50, - actionCommandStatus->hudPosY + 28); - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + // handle meter reaching 100% + if (acs->meterFillLevel > MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + acs->isMeterFilled = TRUE; + hid = acs->hudElemIDs[HIDX_100_PCT]; + hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY + 28); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100; - sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_BAR, 0, 0, battleStatus->actionQuality * 12); - - if (actionCommandStatus->frameCounter == 0) { - if (actionCommandStatus->barFillLevel == 0) { - battleStatus->actionSuccess = -1; - } else { - battleStatus->actionSuccess = actionCommandStatus->barFillLevel / 100; - } + battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH; + sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_METER, 0, 0, battleStatus->actionProgress * 12); - mashMeterCutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1]; - if (mashMeterCutoff >= battleStatus->actionSuccess) { - battleStatus->actionResult = ACTION_RESULT_MINUS_2; - } else { - battleStatus->actionResult = ACTION_RESULT_SUCCESS; - } + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; + } - if (battleStatus->actionSuccess == 100) { - func_80269160(); - } + if (acs->meterFillLevel == 0) { + battleStatus->actionQuality = AC_QUALITY_FAILED; + } else { + battleStatus->actionQuality = acs->meterFillLevel / ONE_PCT_MASH; + } - sfx_stop_sound(SOUND_LOOP_CHARGE_BAR); - btl_set_popup_duration(0); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals - 1]; + if (battleStatus->actionQuality > cutoff) { + battleStatus->actionResult = ACTION_RESULT_SUCCESS; } else { - actionCommandStatus->frameCounter--; + battleStatus->actionResult = ACTION_RESULT_METER_NOT_ENOUGH; + } + + if (battleStatus->actionQuality == 100) { + // only count 100% fill as success for this action command + increment_action_command_success_count(); } + + sfx_stop_sound(SOUND_LOOP_CHARGE_METER); + btl_set_popup_duration(POPUP_MSG_OFF); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - } else { - action_command_free(); + case AC_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } + action_command_free(); break; } } -#include "common/draw_hud_elements.inc.c" +#include "common/MashCommandDraw.inc.c" -#include "common/free_hud_elements.inc.c" +#include "common/MashCommandFree.inc.c" diff --git a/src/battle/action_cmd/bomb.h b/src/battle/action_cmd/bomb.h index 0f36c8f740e..70fcb8024a4 100644 --- a/src/battle/action_cmd/bomb.h +++ b/src/battle/action_cmd/bomb.h @@ -3,10 +3,21 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_bomb_init); + +// args: prep time, duration, difficulty, variation API_CALLABLE(action_command_bomb_start); + void action_command_bomb_update(void); void action_command_bomb_draw(void); void action_command_bomb_free(void); +// variants for this action command +enum { + ACV_BOMB_BASIC = 0, + ACV_BOMB_SUPER = 1, + ACV_BOMB_ULTRA = 2, +}; + #endif diff --git a/src/battle/action_cmd/break_free.c b/src/battle/action_cmd/break_free.c index 72472f1c342..05e12e1fc1a 100644 --- a/src/battle/action_cmd/break_free.c +++ b/src/battle/action_cmd/break_free.c @@ -5,212 +5,230 @@ extern s32 actionCmdTableBreakFree[]; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_BUTTON = 0, + HIDX_METER = 1, + HIDX_RUN_AWAY = 2, + HIDX_OK = 3, +}; + +// how much to add to the meter per input if all modifiers are neutral +#define METER_FILL_RATE 100 + API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; - battleStatus->unk_82 = 0; + battleStatus->maxActionQuality = 0; battleStatus->actionCmdDifficultyTable = actionCmdTableBreakFree; battleStatus->actionResult = ACTION_RESULT_NONE; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_BREAK_FREE; - actionCommandStatus->showHud = TRUE; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->thresholdLevel = 0; - actionCommandStatus->barFillWidth = 0; - battleStatus->actionSuccess = 0; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->hudPosY = 80; - - id = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_RunningAway); - actionCommandStatus->hudElements[2] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_RunAwayOK); - actionCommandStatus->hudElements[3] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + acs->actionCommandID = ACTION_COMMAND_BREAK_FREE; + acs->showHud = TRUE; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->escapeThreshold = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_BUTTON] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_RunningAway); + acs->hudElemIDs[HIDX_RUN_AWAY] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_RunAwayOK); + acs->hudElemIDs[HIDX_OK] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); return ApiStatus_DONE2; } API_CALLABLE(N(start)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Bytecode* args = script->ptrReadPos; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->prepareTime = evt_get_variable(script, *args++); - actionCommandStatus->duration = evt_get_variable(script, *args++); - actionCommandStatus->unk_5A = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = adjust_action_command_difficulty(actionCommandStatus->difficulty); + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->escapeChance = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->thresholdLevel = 0; - actionCommandStatus->barFillWidth = 0; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->escapeThreshold = 0; + acs->meterFillWidth = 0; - battleStatus->actionSuccess = 0; + battleStatus->actionQuality = 0; battleStatus->actionResult = ACTION_RESULT_NONE; - battleStatus->unk_82 = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1]; + battleStatus->maxActionQuality = acs->mashMeterCutoffs[acs->mashMeterNumIntervals - 1]; - actionCommandStatus->thresholdLevel = rand_int(actionCommandStatus->unk_5A); - actionCommandStatus->unk_5C = 0; - actionCommandStatus->state = 10; + acs->escapeThreshold = rand_int(acs->escapeChance); + acs->breakFree.dir = 0; + acs->state = AC_STATE_START; battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; return ApiStatus_DONE2; } void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); - id = actionCommandStatus->hudElements[0]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_BUTTON]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - id = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - id = actionCommandStatus->hudElements[2]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_RUN_AWAY]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - id = actionCommandStatus->hudElements[3]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_OK]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_pos(actionCommandStatus->hudElements[2], actionCommandStatus->hudPosX + 31, actionCommandStatus->hudPosY - 1); - hud_element_set_render_pos(actionCommandStatus->hudElements[3], actionCommandStatus->hudPosX + 31, actionCommandStatus->hudPosY + 17); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUTTON], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_RUN_AWAY], acs->hudPosX + 31, acs->hudPosY - 1); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_OK], acs->hudPosX + 31, acs->hudPosY + 17); break; - case 10: - btl_set_popup_duration(99); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->prepareTime != 0) { + acs->prepareTime--; return; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton); - actionCommandStatus->state = 11; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - case 11: - btl_set_popup_duration(99); - if (actionCommandStatus->unk_5C == 0) { - actionCommandStatus->thresholdLevel++; - if (actionCommandStatus->thresholdLevel >= actionCommandStatus->unk_5A) { - actionCommandStatus->thresholdLevel = actionCommandStatus->unk_5A; - actionCommandStatus->unk_5C = 1; + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_MashAButton); + acs->state = AC_STATE_ACTIVE; + acs->stateTimer = acs->duration; + + // fallthrough + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // update the position of the 'OK' tick + if (acs->breakFree.dir == 0) { + acs->escapeThreshold++; + if (acs->escapeThreshold >= acs->escapeChance) { + acs->escapeThreshold = acs->escapeChance; + acs->breakFree.dir = 1; } } else { - actionCommandStatus->thresholdLevel--; - if (actionCommandStatus->thresholdLevel <= 0) { - actionCommandStatus->thresholdLevel = 0; - actionCommandStatus->unk_5C = 0; + acs->escapeThreshold--; + if (acs->escapeThreshold <= 0) { + acs->escapeThreshold = 0; + acs->breakFree.dir = 0; } } - if (!actionCommandStatus->berserkerEnabled) { + // unlike most other mash inputs, this command doesn't just increment meterFillLevel with inputs + // instead we sum the total number of inputs during the last N frames of the input buffer + if (!acs->berserkerEnabled) { s32 inputBufPos = battleStatus->inputBufferPos; - s32 temp_a2 = actionCommandStatus->duration - actionCommandStatus->frameCounter; + s32 windowLen = acs->duration - acs->stateTimer; s32 i; - actionCommandStatus->barFillLevel = 0; + acs->meterFillLevel = 0; - inputBufPos -= temp_a2; + inputBufPos -= windowLen; if (inputBufPos < 0) { inputBufPos += ARRAY_COUNT(battleStatus->pushInputBuffer); } - for (i = 0; i < temp_a2; i++, inputBufPos++) { + for (i = 0; i < windowLen; i++, inputBufPos++) { if (inputBufPos >= ARRAY_COUNT(battleStatus->pushInputBuffer)) { inputBufPos -= ARRAY_COUNT(battleStatus->pushInputBuffer); } if (battleStatus->pushInputBuffer[inputBufPos] & BUTTON_A) { - actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; + acs->meterFillLevel += SCALE_BY_PCT(METER_FILL_RATE, battleStatus->actionCmdDifficultyTable[acs->difficulty]); } } } else { - actionCommandStatus->barFillLevel += (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]) / 4; - actionCommandStatus->barFillLevel += rand_int(battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] / 4); + acs->meterFillLevel += SCALE_BY_PCT(25, battleStatus->actionCmdDifficultyTable[acs->difficulty]); + acs->meterFillLevel += rand_int(SCALE_BY_PCT(25, battleStatus->actionCmdDifficultyTable[acs->difficulty])); } - battleStatus->actionSuccess = actionCommandStatus->barFillLevel / 100; - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; + battleStatus->actionQuality = acs->meterFillLevel / ONE_PCT_MASH; + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } - if (battleStatus->actionSuccess >= actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals] - actionCommandStatus->thresholdLevel) { + if (battleStatus->actionQuality >= acs->mashMeterCutoffs[acs->mashMeterNumIntervals] - acs->escapeThreshold) { battleStatus->actionResult = ACTION_RESULT_SUCCESS; - battleStatus->actionSuccess = 1; + battleStatus->actionQuality = 1; } else { - battleStatus->actionResult = ACTION_RESULT_MINUS_2; - battleStatus->actionSuccess = -1; + battleStatus->actionResult = ACTION_RESULT_METER_NOT_ENOUGH; + battleStatus->actionQuality = AC_QUALITY_FAILED; } - btl_set_popup_duration(0); - actionCommandStatus->frameCounter = 20; - actionCommandStatus->state = 12; + btl_set_popup_duration(POPUP_MSG_OFF); + acs->stateTimer = 20; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; + case AC_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } action_command_free(); break; @@ -218,40 +236,35 @@ void N(update)(void) { } void N(draw)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - s32* hudElements = actionCommandStatus->hudElements; - s32 hudX; - s32 hudY; - s32 id; - s16 mashMeterCutoff; - s32 thirtyOne; - - mashMeterCutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals]; - hudX = 60 - ((mashMeterCutoff - actionCommandStatus->thresholdLevel) * 60 / mashMeterCutoff); - - // Putting 31 into a variable manually fixes regalloc, so perhaps this was a constant defined somewhere? - thirtyOne = 31; - hud_element_set_render_pos(hudElements[3], actionCommandStatus->hudPosX - (hudX - thirtyOne), - actionCommandStatus->hudPosY + 17); - hud_element_set_render_pos(hudElements[2], actionCommandStatus->hudPosX - (hudX - thirtyOne), - actionCommandStatus->hudPosY - 1); - - if (!actionCommandStatus->berserkerEnabled) { - hud_element_draw_clipped(hudElements[0]); + ActionCommandStatus* acs = &gActionCommandStatus; + s32* hudElements = acs->hudElemIDs; + s32 hudX, hudY; + HudElemID hid; + s16 maxMeterValue; + + // equivalent to 60 * acs->escapeThreshold / maxMeterValue + maxMeterValue = acs->mashMeterCutoffs[acs->mashMeterNumIntervals]; + hudX = 60 - ((maxMeterValue - acs->escapeThreshold) * 60 / maxMeterValue); + + hud_element_set_render_pos(hudElements[HIDX_OK], acs->hudPosX + 31 - hudX, acs->hudPosY + 17); + hud_element_set_render_pos(hudElements[HIDX_RUN_AWAY], acs->hudPosX + 31 - hudX, acs->hudPosY - 1); + + if (!acs->berserkerEnabled) { + hud_element_draw_clipped(hudElements[HIDX_BUTTON]); } - id = hudElements[1]; - hud_element_draw_clipped(id); - hud_element_get_render_pos(id, &hudX, &hudY); + hid = hudElements[HIDX_METER]; + hud_element_draw_clipped(hid); + hud_element_get_render_pos(hid, &hudX, &hudY); - draw_mash_meter_multicolor(hudX, hudY, actionCommandStatus->barFillLevel / 100); - hud_element_draw_clipped(hudElements[2]); - hud_element_draw_clipped(hudElements[3]); + draw_mash_meter_multicolor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH); + hud_element_draw_clipped(hudElements[HIDX_RUN_AWAY]); + hud_element_draw_clipped(hudElements[HIDX_OK]); } void N(free)(void) { - hud_element_free(gActionCommandStatus.hudElements[0]); - hud_element_free(gActionCommandStatus.hudElements[1]); - hud_element_free(gActionCommandStatus.hudElements[2]); - hud_element_free(gActionCommandStatus.hudElements[3]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_BUTTON]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_METER]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_RUN_AWAY]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_OK]); } diff --git a/src/battle/action_cmd/break_free.h b/src/battle/action_cmd/break_free.h index e462bbfae21..aefde2cca3c 100644 --- a/src/battle/action_cmd/break_free.h +++ b/src/battle/action_cmd/break_free.h @@ -3,8 +3,12 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_break_free_init); + +// args: prep time, duration, effectiveness, difficulty API_CALLABLE(action_command_break_free_start); + void action_command_break_free_update(void); void action_command_break_free_draw(void); void action_command_break_free_free(void); diff --git a/src/battle/action_cmd/common/MashActionCommandStart.inc.c b/src/battle/action_cmd/common/MashActionCommandStart.inc.c deleted file mode 100644 index cae983082aa..00000000000 --- a/src/battle/action_cmd/common/MashActionCommandStart.inc.c +++ /dev/null @@ -1,30 +0,0 @@ -API_CALLABLE(N(start)) { - u8 mashMeterCutoff; - - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - BattleStatus* battleStatus = &gBattleStatus; - Bytecode* args = script->ptrReadPos; - - if (battleStatus->actionCommandMode == 0) { - battleStatus->actionSuccess = 0; - return ApiStatus_DONE2; - } - - action_command_init_status(); - actionCommandStatus->prepareTime = evt_get_variable(script, *args++); - actionCommandStatus->duration = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = adjust_action_command_difficulty(actionCommandStatus->difficulty); - actionCommandStatus->targetWeakness = evt_get_variable(script, *args++); - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - battleStatus->actionSuccess = 0; - battleStatus->actionResult = ACTION_RESULT_NONE; - mashMeterCutoff = actionCommandStatus->mashMeterCutoffs[(actionCommandStatus->mashMeterIntervals - 1)]; - battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; - actionCommandStatus->state = 10; - battleStatus->unk_82 = mashMeterCutoff; - func_80269118(); - return ApiStatus_DONE2; -} diff --git a/src/battle/action_cmd/common/MashCommandDraw.inc.c b/src/battle/action_cmd/common/MashCommandDraw.inc.c new file mode 100644 index 00000000000..90ed2cad585 --- /dev/null +++ b/src/battle/action_cmd/common/MashCommandDraw.inc.c @@ -0,0 +1,21 @@ +#include "common.h" + +void N(draw)(void) { + ActionCommandStatus* acs = &gActionCommandStatus; + s32 hudX, hudY; + HudElemID hid; + + hud_element_draw_clipped(acs->hudElemIDs[0]); + + hid = acs->hudElemIDs[1]; + hud_element_draw_clipped(hid); + hud_element_get_render_pos(hid, &hudX, &hudY); + + if (!acs->isMeterFilled) { + draw_mash_meter_multicolor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH); + } else { + draw_mash_meter_blink(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH); + } + + hud_element_draw_clipped(acs->hudElemIDs[2]); +} diff --git a/src/battle/action_cmd/common/MashCommandFree.inc.c b/src/battle/action_cmd/common/MashCommandFree.inc.c new file mode 100644 index 00000000000..882533930fb --- /dev/null +++ b/src/battle/action_cmd/common/MashCommandFree.inc.c @@ -0,0 +1,7 @@ +#include "common.h" + +void N(free)(void) { + hud_element_free(gActionCommandStatus.hudElemIDs[0]); + hud_element_free(gActionCommandStatus.hudElemIDs[1]); + hud_element_free(gActionCommandStatus.hudElemIDs[2]); +} diff --git a/src/battle/action_cmd/common/draw_hud_elements.inc.c b/src/battle/action_cmd/common/draw_hud_elements.inc.c deleted file mode 100644 index b11c5e6fecf..00000000000 --- a/src/battle/action_cmd/common/draw_hud_elements.inc.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "common.h" - -void N(draw)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - - s32 hudX; - s32 hudY; - s32 hudElement; - s32 barFillLevel; - - hud_element_draw_clipped(actionCommandStatus->hudElements[0]); - - hudElement = actionCommandStatus->hudElements[1]; - hud_element_draw_clipped(hudElement); - hud_element_get_render_pos(hudElement, &hudX, &hudY); - - if (!actionCommandStatus->isBarFilled) { - draw_mash_meter_multicolor(hudX, hudY, actionCommandStatus->barFillLevel / 100); - } else { - draw_mash_meter_blink(hudX, hudY, actionCommandStatus->barFillLevel / 100); - } - - hud_element_draw_clipped(actionCommandStatus->hudElements[2]); -} diff --git a/src/battle/action_cmd/common/free_hud_elements.inc.c b/src/battle/action_cmd/common/free_hud_elements.inc.c deleted file mode 100644 index 6aad1389569..00000000000 --- a/src/battle/action_cmd/common/free_hud_elements.inc.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "common.h" - -void N(free)(void) { - hud_element_free(gActionCommandStatus.hudElements[0]); - hud_element_free(gActionCommandStatus.hudElements[1]); - hud_element_free(gActionCommandStatus.hudElements[2]); -} - diff --git a/src/battle/action_cmd/dizzy_shell.c b/src/battle/action_cmd/dizzy_shell.c index 472be435e79..0949876682c 100644 --- a/src/battle/action_cmd/dizzy_shell.c +++ b/src/battle/action_cmd/dizzy_shell.c @@ -4,197 +4,247 @@ #define NAMESPACE action_command_dizzy_shell -s32 D_802A9800_426970[8] = { 0, 25, 50, 75, 75, 0, 0, 0 }; - extern s32 actionCmdTableDizzyShell[]; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_BUTTON = 0, + HIDX_METER = 1, + HIDX_100_PCT = 2, +}; + +// how much to add to the meter per input if all modifiers are neutral +#define METER_FILL_TICK 850 + +s32 N(DrainRateTable)[] = { 0, 25, 50, 75, 75 }; + +#define GET_DRAIN_RATE(pct) PCT_TO_TABLE_RATE(N(DrainRateTable), pct) + API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; - battleStatus->unk_82 = 100; + battleStatus->maxActionQuality = 100; battleStatus->actionCmdDifficultyTable = actionCmdTableDizzyShell; battleStatus->actionResult = ACTION_RESULT_NONE; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_DIZZY_SHELL; - actionCommandStatus->showHud = TRUE; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->isBarFilled = FALSE; - battleStatus->actionSuccess = 0; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->hudPosY = 80; - - id = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_100pct); - actionCommandStatus->hudElements[2] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + acs->actionCommandID = ACTION_COMMAND_DIZZY_SHELL; + acs->showHud = TRUE; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + acs->isMeterFilled = FALSE; + battleStatus->actionQuality = 0; + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_BUTTON] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_100pct); + acs->hudElemIDs[HIDX_100_PCT] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); return ApiStatus_DONE2; } -#include "common/MashActionCommandStart.inc.c" +API_CALLABLE(N(start)) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + Bytecode* args = script->ptrReadPos; + + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; + return ApiStatus_DONE2; + } + + action_command_init_status(); + + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + acs->statusChance = evt_get_variable(script, *args++); // average chance for enemies to be affected + + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; + battleStatus->actionResult = ACTION_RESULT_NONE; + battleStatus->maxActionQuality = acs->mashMeterCutoffs[(acs->mashMeterNumIntervals - 1)]; + battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; + acs->state = AC_STATE_START; + + increment_action_command_attempt_count(); + + return ApiStatus_DONE2; +} void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; s32 cutoff; s32 fillLevel; - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); - id = actionCommandStatus->hudElements[0]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_BUTTON]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - id = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUTTON], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); break; - case 10: - btl_set_popup_duration(99); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->prepareTime != 0) { + acs->prepareTime--; return; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton); - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - sfx_play_sound_with_params(SOUND_LOOP_CHARGE_BAR, 0, 0, 0); - actionCommandStatus->state = 11; - case 11: - btl_set_popup_duration(99); - if (!actionCommandStatus->isBarFilled) { - if (actionCommandStatus->targetWeakness != 0) { - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals]; - - actionCommandStatus->barFillLevel -= D_802A9800_426970[actionCommandStatus->barFillLevel / cutoff / 20]; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_MashAButton); + acs->meterFillLevel = 0; + acs->stateTimer = acs->duration; + sfx_play_sound_with_params(SOUND_LOOP_CHARGE_METER, 0, 0, 0); + acs->state = AC_STATE_ACTIVE; + + // fallthrough + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // meter can drain if it hasn't been fully filled + if (!acs->isMeterFilled) { + if (acs->statusChance != 0) { + s32 maxFillLevel = acs->mashMeterCutoffs[acs->mashMeterNumIntervals]; + acs->meterFillLevel -= GET_DRAIN_RATE (acs->meterFillLevel / maxFillLevel); + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } else { - actionCommandStatus->barFillLevel -= 10; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + acs->meterFillLevel -= 10; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } } + // check for meter-filling input if (battleStatus->curButtonsPressed & BUTTON_A) { - s32 a = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; - s32 b = actionCommandStatus->targetWeakness * 850; - s32 temp_v1_2 = (a * b) / 10000; + s32 difficultyPct = battleStatus->actionCmdDifficultyTable[acs->difficulty]; + s32 effectivenessPct = METER_FILL_TICK * acs->statusChance; + // divide by 100 for each percent-based multiplier + s32 fillAmt = (difficultyPct * effectivenessPct) / (100 * 100); - if (temp_v1_2 != 0) { - actionCommandStatus->barFillLevel += temp_v1_2; + if (fillAmt != 0) { + acs->meterFillLevel += fillAmt; } else { - actionCommandStatus->barFillLevel += 100; - if (actionCommandStatus->barFillLevel >= 500) { - actionCommandStatus->barFillLevel = 500; + acs->meterFillLevel += ONE_PCT_MASH; + if (acs->meterFillLevel >= 5 * ONE_PCT_MASH) { + acs->meterFillLevel = 5 * ONE_PCT_MASH; } } } - if (actionCommandStatus->barFillLevel >= 10000) { - id = actionCommandStatus->hudElements[2]; - actionCommandStatus->barFillLevel = 10000; - actionCommandStatus->isBarFilled = TRUE; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 50, actionCommandStatus->hudPosY + 28); - hud_element_clear_flags(id, 2); + // handle meter reaching 100% + if (acs->meterFillLevel >= MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + acs->isMeterFilled = TRUE; + hid = acs->hudElemIDs[HIDX_100_PCT]; + hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY + 28); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100; - sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_BAR, 0, 0, battleStatus->actionQuality * 12); + battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH; + sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_METER, 0, 0, battleStatus->actionProgress * 12); - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } - fillLevel = actionCommandStatus->barFillLevel; - if (actionCommandStatus->targetWeakness == 0) { + fillLevel = acs->meterFillLevel; + if (acs->statusChance == 0) { fillLevel = 0; } if (fillLevel == 0) { - battleStatus->actionSuccess = -1; + battleStatus->actionQuality = AC_QUALITY_FAILED; } else { - battleStatus->actionSuccess = fillLevel / 100; + battleStatus->actionQuality = fillLevel / ONE_PCT_MASH; } - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1]; - if (battleStatus->actionSuccess >= cutoff) { + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals - 1]; + if (battleStatus->actionQuality >= cutoff) { battleStatus->actionResult = ACTION_RESULT_SUCCESS; } else { - battleStatus->actionResult = ACTION_RESULT_MINUS_2; + battleStatus->actionResult = ACTION_RESULT_METER_NOT_ENOUGH; } - if (battleStatus->actionSuccess == 100) { - func_80269160(); + if (battleStatus->actionQuality == 100) { + // only could 100% fill as success for this action command + increment_action_command_success_count(); } - sfx_stop_sound(SOUND_LOOP_CHARGE_BAR); - btl_set_popup_duration(0); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; + sfx_stop_sound(SOUND_LOOP_CHARGE_METER); + btl_set_popup_duration(POPUP_MSG_OFF); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->targetWeakness == 0) { - actionCommandStatus->barFillLevel -= 100; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + case AC_STATE_DISPOSE: + if (acs->statusChance == 0) { + acs->meterFillLevel -= 100; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } action_command_free(); break; } } -#include "common/draw_hud_elements.inc.c" +#include "common/MashCommandDraw.inc.c" -#include "common/free_hud_elements.inc.c" +#include "common/MashCommandFree.inc.c" diff --git a/src/battle/action_cmd/dizzy_shell.h b/src/battle/action_cmd/dizzy_shell.h index d00e734a587..cbb974c8fcd 100644 --- a/src/battle/action_cmd/dizzy_shell.h +++ b/src/battle/action_cmd/dizzy_shell.h @@ -3,8 +3,12 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_dizzy_shell_init); + +// args: prep time, duration, difficulty, chance API_CALLABLE(action_command_dizzy_shell_start); + void action_command_dizzy_shell_update(void); void action_command_dizzy_shell_draw(void); void action_command_dizzy_shell_free(void); diff --git a/src/battle/action_cmd/fire_shell.c b/src/battle/action_cmd/fire_shell.c index 076a5ca0f8e..85f3ac4974a 100644 --- a/src/battle/action_cmd/fire_shell.c +++ b/src/battle/action_cmd/fire_shell.c @@ -3,213 +3,273 @@ #define NAMESPACE action_command_fire_shell -s32 D_802A9950_427320[5] = { 0, 25, 50, 75, 75 }; -s32 D_802A9964_427334[4] = { 40, 70, 99, 200 }; -s32 D_802A9974_427344[5] = { 35, 60, 80, 99, 200 }; -s32 D_802A9988_427358[6] = { 35, 35, 60, 80, 99, 200 }; - extern s32 actionCmdTableFireShell[]; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_STICK = 0, + HIDX_METER = 1, + HIDX_100_PCT = 2, +}; + +// how much to add to the meter per input +#define METER_FILL_TICK 950 + +s32 N(DrainRateTable)[] = { 0, 25, 50, 75, 75 }; + +#define GET_DRAIN_RATE(pct) PCT_TO_TABLE_RATE(N(DrainRateTable), pct) + +// threshold meter values; not used for anything +// these correspond to values provided via SetupMashMeter +s32 N(BasicThresholds)[] = { 40, 70, 99, 200 }; +s32 N(SuperThresholds)[] = { 35, 60, 80, 99, 200 }; +s32 N(UltraThresholds)[] = { 35, 35, 60, 80, 99, 200 }; + API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; - battleStatus->unk_82 = 100; + battleStatus->maxActionQuality = 100; battleStatus->actionCmdDifficultyTable = actionCmdTableFireShell; battleStatus->actionResult = ACTION_RESULT_NONE; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_FIRE_SHELL; - actionCommandStatus->showHud = TRUE; - actionCommandStatus->hudPrepareTime = 30; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->isBarFilled = FALSE; - battleStatus->actionSuccess = 0; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->hudPosY = 80; - - id = hud_element_create(&HES_StickNeutral); - actionCommandStatus->hudElements[0] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_100pct); - actionCommandStatus->hudElements[2] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + acs->actionCommandID = ACTION_COMMAND_FIRE_SHELL; + acs->showHud = TRUE; + acs->hudPrepareTime = 30; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + acs->isMeterFilled = FALSE; + battleStatus->actionQuality = 0; + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_StickNeutral); + acs->hudElemIDs[HIDX_STICK] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_100pct); + acs->hudElemIDs[HIDX_100_PCT] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + return ApiStatus_DONE2; +} + +API_CALLABLE(N(start)) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + Bytecode* args = script->ptrReadPos; + + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; + return ApiStatus_DONE2; + } + + action_command_init_status(); + + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + acs->statusChance = evt_get_variable(script, *args++); // unused + + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; + battleStatus->actionResult = ACTION_RESULT_NONE; + battleStatus->maxActionQuality = acs->mashMeterCutoffs[(acs->mashMeterNumIntervals - 1)]; + battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; + acs->state = AC_STATE_START; + + increment_action_command_attempt_count(); return ApiStatus_DONE2; } -#include "common/MashActionCommandStart.inc.c" void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Actor* partner = battleStatus->partnerActor; - s32 id; + HudElemID hid; s32 cutoff; - s32 fillLevel; - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); - id = actionCommandStatus->hudElements[0]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_STICK]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - id = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_STICK], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); break; - case 10: - btl_set_popup_duration(99); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->prepareTime != 0) { + acs->prepareTime--; return; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_StickMashLeft); - actionCommandStatus->barFillLevel = 0; - battleStatus->unk_85 = 0; - actionCommandStatus->unk_5C = 0; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - sfx_play_sound_with_params(SOUND_LOOP_CHARGE_BAR, 0, 0, 0); - actionCommandStatus->state = 11; - case 11: - btl_set_popup_duration(99); - - if (!actionCommandStatus->isBarFilled) { - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals]; - actionCommandStatus->barFillLevel -= D_802A9950_427320[actionCommandStatus->barFillLevel / cutoff / 20]; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + hud_element_set_script(acs->hudElemIDs[HIDX_STICK], &HES_StickMashLeft); + acs->meterFillLevel = 0; + battleStatus->resultTier = 0; + acs->fireShell.holdingLeft = FALSE; + acs->stateTimer = acs->duration; + sfx_play_sound_with_params(SOUND_LOOP_CHARGE_METER, 0, 0, 0); + acs->state = AC_STATE_ACTIVE; + + // fallthrough + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // meter can drain if it hasn't been fully filled + if (!acs->isMeterFilled) { + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals]; + acs->meterFillLevel -= GET_DRAIN_RATE(acs->meterFillLevel / cutoff); + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } - if (!actionCommandStatus->isBarFilled) { - if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { - actionCommandStatus->unk_5C = 1; - } + } - if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && (actionCommandStatus->unk_5C != 0)) { - actionCommandStatus->barFillLevel += (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 950) / 100; - actionCommandStatus->unk_5C = 0; - } + // check for meter-filling input + if (!acs->isMeterFilled) { + if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { + acs->fireShell.holdingLeft = TRUE; + } - if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { - actionCommandStatus->barFillLevel -= (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 950) / 100; + if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT)) { + if (acs->fireShell.holdingLeft != 0) { + s32 difficultyPct = battleStatus->actionCmdDifficultyTable[acs->difficulty]; + acs->meterFillLevel += SCALE_BY_PCT(METER_FILL_TICK, difficultyPct); + acs->fireShell.holdingLeft = FALSE; } } + + // right stick inputs actively drain the meter + if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { + s32 difficultyPct = battleStatus->actionCmdDifficultyTable[acs->difficulty]; + acs->meterFillLevel -= SCALE_BY_PCT(METER_FILL_TICK, difficultyPct); + } } - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } - if (actionCommandStatus->barFillLevel > 10000) { - id = actionCommandStatus->hudElements[2]; - actionCommandStatus->barFillLevel = 10000; - actionCommandStatus->isBarFilled = TRUE; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 50, actionCommandStatus->hudPosY + 28); - hud_element_clear_flags(id, 2); + // handle meter reaching 100% + if (acs->meterFillLevel > MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + acs->isMeterFilled = TRUE; + hid = acs->hudElemIDs[HIDX_100_PCT]; + hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY + 28); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100; - sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_BAR, 0, 0, battleStatus->actionQuality * 12); + battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH; + sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_METER, 0, 0, battleStatus->actionProgress * 12); + + // resultTier is not used by this move; uses actionProgress instead via the move script switch (partner->actorBlueprint->level) { case PARTNER_RANK_NORMAL: - if (battleStatus->actionQuality >= D_802A9964_427334[battleStatus->unk_85]) { - battleStatus->unk_85++; + if (battleStatus->actionProgress >= N(BasicThresholds)[battleStatus->resultTier]) { + battleStatus->resultTier++; } - if (battleStatus->unk_85 > 0 && (battleStatus->actionQuality < D_802A9964_427334[battleStatus->unk_85 - 1])) { - battleStatus->unk_85--; + if (battleStatus->resultTier > 0 && (battleStatus->actionProgress < N(BasicThresholds)[battleStatus->resultTier - 1])) { + battleStatus->resultTier--; } break; case PARTNER_RANK_SUPER: - if (battleStatus->actionQuality >= D_802A9974_427344[battleStatus->unk_85]) { - battleStatus->unk_85++; + if (battleStatus->actionProgress >= N(SuperThresholds)[battleStatus->resultTier]) { + battleStatus->resultTier++; } - if (battleStatus->unk_85 > 0 && (battleStatus->actionQuality < D_802A9974_427344[battleStatus->unk_85 - 1])) { - battleStatus->unk_85--; + if (battleStatus->resultTier > 0 && (battleStatus->actionProgress < N(SuperThresholds)[battleStatus->resultTier - 1])) { + battleStatus->resultTier--; } break; case PARTNER_RANK_ULTRA: - if (battleStatus->actionQuality >= D_802A9988_427358[battleStatus->unk_85]) { - battleStatus->unk_85++; + if (battleStatus->actionProgress >= N(UltraThresholds)[battleStatus->resultTier]) { + battleStatus->resultTier++; } - if (battleStatus->unk_85 > 0 && (battleStatus->actionQuality < D_802A9988_427358[battleStatus->unk_85 - 1])) { - battleStatus->unk_85--; + if (battleStatus->resultTier > 0 && (battleStatus->actionProgress < N(UltraThresholds)[battleStatus->resultTier - 1])) { + battleStatus->resultTier--; } break; } - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } - if (actionCommandStatus->barFillLevel == 0) { - battleStatus->actionSuccess = -1; + if (acs->meterFillLevel == 0) { + battleStatus->actionQuality = AC_QUALITY_FAILED; } else { - battleStatus->actionSuccess = actionCommandStatus->barFillLevel / 100; + battleStatus->actionQuality = acs->meterFillLevel / ONE_PCT_MASH; } - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1]; - if (cutoff >= battleStatus->actionSuccess) { - battleStatus->actionResult = ACTION_RESULT_MINUS_2; - } else { + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals - 1]; + if (battleStatus->actionQuality > cutoff) { battleStatus->actionResult = ACTION_RESULT_SUCCESS; + } else { + battleStatus->actionResult = ACTION_RESULT_METER_NOT_ENOUGH; } - if (battleStatus->actionSuccess == 100) { - func_80269160(); + if (battleStatus->actionQuality == 100) { + // only count 100% fill as success for this action command + increment_action_command_success_count(); } - sfx_stop_sound(SOUND_LOOP_CHARGE_BAR); - btl_set_popup_duration(0); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; + + sfx_stop_sound(SOUND_LOOP_CHARGE_METER); + btl_set_popup_duration(POPUP_MSG_OFF); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; + case AC_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } action_command_free(); break; } } -#include "common/draw_hud_elements.inc.c" +#include "common/MashCommandDraw.inc.c" -#include "common/free_hud_elements.inc.c" +#include "common/MashCommandFree.inc.c" diff --git a/src/battle/action_cmd/fire_shell.h b/src/battle/action_cmd/fire_shell.h index 3ea25791351..1bd3c76b404 100644 --- a/src/battle/action_cmd/fire_shell.h +++ b/src/battle/action_cmd/fire_shell.h @@ -3,8 +3,12 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_fire_shell_init); + +// args: prep time, duration, difficulty API_CALLABLE(action_command_fire_shell_start); + void action_command_fire_shell_update(void); void action_command_fire_shell_draw(void); void action_command_fire_shell_free(void); diff --git a/src/battle/action_cmd/flee.c b/src/battle/action_cmd/flee.c index 8f2874f14ed..01159ac3408 100644 --- a/src/battle/action_cmd/flee.c +++ b/src/battle/action_cmd/flee.c @@ -3,245 +3,266 @@ #define NAMESPACE action_command_flee -BSS s32 D_802A9920; - extern s32 actionCmdTableFlee[]; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_BUTTON = 0, + HIDX_METER = 1, + HIDX_RUN_AWAY = 2, + HIDX_OK = 3, + HIDX_100_PCT = 4, +}; + +// how much to add to the meter per input if all modifiers are neutral +#define METER_FILL_RATE 180 + +BSS b32 N(HasStarted); + API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Bytecode* args = script->ptrReadPos; - s32 xOffset; - s32 hudElement; + s32 offsetX; + HudElemID hid; - battleStatus->unk_82 = 0; + battleStatus->maxActionQuality = 0; battleStatus->actionCmdDifficultyTable = actionCmdTableFlee; battleStatus->actionResult = ACTION_RESULT_NONE; + action_command_init_status(); - actionCommandStatus->unk_5A = evt_get_variable(script, *args++); - actionCommandStatus->actionCommandID = ACTION_COMMAND_FLEE; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = actionCommandStatus->unk_5A * 100; - actionCommandStatus->thresholdLevel = rand_int(50); - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->unk_5C = 1; - actionCommandStatus->unk_5A = rand_int(1); - actionCommandStatus->isBarFilled = FALSE; - battleStatus->actionSuccess = 0; - actionCommandStatus->hudPosX = -48; - D_802A9920 = 0; - actionCommandStatus->hudPosY = 80; - - hudElement = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElement = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElement = hud_element_create(&HES_RunningAway); - actionCommandStatus->hudElements[2] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElement = hud_element_create(&HES_RunAwayOK); - actionCommandStatus->hudElements[3] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - xOffset = 29 - ((100 - actionCommandStatus->thresholdLevel) * 60) / 100; - hud_element_set_render_pos(actionCommandStatus->hudElements[3], actionCommandStatus->hudPosX - xOffset, actionCommandStatus->hudPosY + 17); - hud_element_set_render_pos(actionCommandStatus->hudElements[2], actionCommandStatus->hudPosX - xOffset, actionCommandStatus->hudPosY - 1); - - hudElement = hud_element_create(&HES_100pct); - actionCommandStatus->hudElements[4] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + acs->escapeChance = evt_get_variable(script, *args++); + + acs->actionCommandID = ACTION_COMMAND_FLEE; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = acs->escapeChance * 100; + acs->escapeThreshold = rand_int(50); + acs->meterFillWidth = 0; + acs->flee.dir = 1; + acs->escapeChance = rand_int(1); + acs->isMeterFilled = FALSE; + battleStatus->actionQuality = 0; + N(HasStarted) = FALSE; + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_BUTTON] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_RunningAway); + acs->hudElemIDs[HIDX_RUN_AWAY] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_RunAwayOK); + acs->hudElemIDs[HIDX_OK] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + offsetX = 29 - ((100 - acs->escapeThreshold) * 60) / 100; + hud_element_set_render_pos(acs->hudElemIDs[HIDX_OK], acs->hudPosX - offsetX, acs->hudPosY + 17); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_RUN_AWAY], acs->hudPosX - offsetX, acs->hudPosY - 1); + + hid = hud_element_create(&HES_100pct); + acs->hudElemIDs[HIDX_100_PCT] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); return ApiStatus_DONE2; } API_CALLABLE(N(start)) { - Bytecode* args = script->ptrReadPos; - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; + Bytecode* args = script->ptrReadPos; action_command_init_status(); - actionCommandStatus->prepareTime = evt_get_variable(script, *args++); - actionCommandStatus->duration = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = adjust_action_command_difficulty(actionCommandStatus->difficulty); - actionCommandStatus->wrongButtonPressed = FALSE; - battleStatus->actionSuccess = 0; + + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + + acs->wrongButtonPressed = FALSE; + battleStatus->actionQuality = 0; battleStatus->actionResult = ACTION_RESULT_NONE; - battleStatus->unk_82 = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1]; + battleStatus->maxActionQuality = acs->mashMeterCutoffs[acs->mashMeterNumIntervals - 1]; battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; - actionCommandStatus->state = 10; + acs->state = AC_STATE_START; + return ApiStatus_DONE2; } void N(update)(void) { - s32 temp; - s32 hudElement; BattleStatus* battleStatus = &gBattleStatus; - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - - switch (actionCommandStatus->state) { - case 0: - hudElement = actionCommandStatus->hudElements[0]; - hud_element_set_alpha(hudElement, 0xFF); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + ActionCommandStatus* acs = &gActionCommandStatus; + HudElemID hid; + s32 escapeDelta; + + switch (acs->state) { + case AC_STATE_INIT: + hid = acs->hudElemIDs[HIDX_BUTTON]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hudElement = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(hudElement, 0xFF); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hudElement = actionCommandStatus->hudElements[2]; - hud_element_set_alpha(hudElement, 0xFF); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[HIDX_RUN_AWAY]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hudElement = actionCommandStatus->hudElements[3]; - hud_element_set_alpha(hudElement, 0xFF); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[HIDX_OK]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + case AC_STATE_APPEAR: + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUTTON], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); break; - case 10: - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + case AC_STATE_START: + if (acs->prepareTime != 0) { + acs->prepareTime--; break; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton); - D_802A9920 = 1; - actionCommandStatus->state = 11; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - case 11: - if (battleStatus->actionCommandMode != ACTION_COMMAND_MODE_NOT_LEARNED && (battleStatus->curButtonsPressed & BUTTON_A)) { - actionCommandStatus->barFillLevel += (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 180 / 100); + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_MashAButton); + N(HasStarted) = TRUE; + acs->state = AC_STATE_ACTIVE; + acs->stateTimer = acs->duration; + + // fallthrough + case AC_STATE_ACTIVE: + // check for meter-filling input + if (battleStatus->actionCommandMode != AC_MODE_NOT_LEARNED && (battleStatus->curButtonsPressed & BUTTON_A)) { + acs->meterFillLevel += SCALE_BY_PCT(METER_FILL_RATE, battleStatus->actionCmdDifficultyTable[acs->difficulty]); } - if (actionCommandStatus->barFillLevel >= 10000) { - hudElement = actionCommandStatus->hudElements[4]; - actionCommandStatus->barFillLevel = 10000; - actionCommandStatus->isBarFilled = TRUE; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX + 50, actionCommandStatus->hudPosY + 28); - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + + // handle meter reaching 100% + if (acs->meterFillLevel >= MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + acs->isMeterFilled = TRUE; + hid = acs->hudElemIDs[HIDX_100_PCT]; + hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY + 28); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - battleStatus->actionSuccess = actionCommandStatus->barFillLevel / 100; - if (actionCommandStatus->frameCounter == 0) { - if (battleStatus->actionSuccess >= (100 - actionCommandStatus->thresholdLevel)) { - battleStatus->actionResult = ACTION_RESULT_SUCCESS; - battleStatus->actionSuccess = 1; - } else { - battleStatus->actionResult = ACTION_RESULT_MINUS_2; - battleStatus->actionSuccess = -1; - } - actionCommandStatus->frameCounter = 20; - actionCommandStatus->state = 12; + battleStatus->actionQuality = acs->meterFillLevel / ONE_PCT_MASH; + + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; + } + + if (battleStatus->actionQuality >= (100 - acs->escapeThreshold)) { + battleStatus->actionResult = ACTION_RESULT_SUCCESS; + battleStatus->actionQuality = 1; } else { - actionCommandStatus->frameCounter--; + battleStatus->actionResult = ACTION_RESULT_METER_NOT_ENOUGH; + battleStatus->actionQuality = AC_QUALITY_FAILED; } + + acs->stateTimer = 20; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; + case AC_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; break; } action_command_free(); break; } - switch (actionCommandStatus->state) { - case 1: - case 10: - case 11: - temp = actionCommandStatus->unk_5A == 0 ? 7 : 8; - if (actionCommandStatus->unk_5C == 0) { - actionCommandStatus->thresholdLevel += temp; - if (actionCommandStatus->thresholdLevel >= 100) { - actionCommandStatus->thresholdLevel = 100; - actionCommandStatus->unk_5C = 1; + // update the position of the 'OK' tick + switch (acs->state) { + case AC_STATE_APPEAR: + case AC_STATE_START: + case AC_STATE_ACTIVE: + escapeDelta = acs->escapeChance == 0 ? 7 : 8; + if (acs->flee.dir == 0) { + acs->escapeThreshold += escapeDelta; + if (acs->escapeThreshold >= 100) { + acs->escapeThreshold = 100; + acs->flee.dir = 1; + } + } else { + acs->escapeThreshold -= escapeDelta; + if (acs->escapeThreshold <= 0) { + acs->escapeThreshold = 0; + acs->flee.dir = 0; } - break; - } - actionCommandStatus->thresholdLevel -= temp; - if (actionCommandStatus->thresholdLevel <= 0) { - actionCommandStatus->thresholdLevel = 0; - actionCommandStatus->unk_5C = 0; } + break; } } void N(draw)(void) { - s32 y; - s32 x; - s32 temp_a1; - s32 hudElement; - s32 temp_v1; - BattleStatus* battleStatus = &gBattleStatus; - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; + s32 hudX, hudY; + HudElemID hid; - temp_v1 = (100 - actionCommandStatus->thresholdLevel) * 60; - x = 60 - temp_v1 / 100; - temp_a1 = x - 31; + // equivalent to 60 * acs->escapeThreshold / 100 + hudX = 60 - ((100 - acs->escapeThreshold) * 60 / 100); - hud_element_set_render_pos(actionCommandStatus->hudElements[3], actionCommandStatus->hudPosX - temp_a1, actionCommandStatus->hudPosY + 17); - hud_element_set_render_pos(actionCommandStatus->hudElements[2], actionCommandStatus->hudPosX + 31 - x, actionCommandStatus->hudPosY - 1); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_OK], acs->hudPosX + 31 - hudX, acs->hudPosY + 17); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_RUN_AWAY], acs->hudPosX + 31 - hudX, acs->hudPosY - 1); - if (battleStatus->actionCommandMode != ACTION_COMMAND_MODE_NOT_LEARNED) { - hud_element_draw_clipped(actionCommandStatus->hudElements[0]); + if (battleStatus->actionCommandMode != AC_MODE_NOT_LEARNED) { + hud_element_draw_clipped(acs->hudElemIDs[HIDX_BUTTON]); } - hudElement = actionCommandStatus->hudElements[1]; - hud_element_draw_clipped(hudElement); - hud_element_get_render_pos(hudElement, &x, &y); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_draw_clipped(hid); + hud_element_get_render_pos(hid, &hudX, &hudY); - if (D_802A9920 == 0) { - draw_mash_meter_multicolor_with_divisor(x, y, actionCommandStatus->barFillLevel / 100, 1); + if (!N(HasStarted)) { + draw_mash_meter_multicolor_with_divisor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH, 1); + } else if (!acs->isMeterFilled) { + draw_mash_meter_multicolor_with_divisor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH, 4); } else { - if (!actionCommandStatus->isBarFilled) { - draw_mash_meter_multicolor_with_divisor(x, y, actionCommandStatus->barFillLevel / 100, 4); - } else { - draw_mash_meter_blink(x, y, actionCommandStatus->barFillLevel / 100); - } + draw_mash_meter_blink(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH); } - hud_element_draw_clipped(actionCommandStatus->hudElements[2]); - hud_element_draw_clipped(actionCommandStatus->hudElements[3]); - hud_element_draw_clipped(actionCommandStatus->hudElements[4]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_RUN_AWAY]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_OK]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_100_PCT]); } void N(free)(void) { - hud_element_free(gActionCommandStatus.hudElements[0]); - hud_element_free(gActionCommandStatus.hudElements[1]); - hud_element_free(gActionCommandStatus.hudElements[2]); - hud_element_free(gActionCommandStatus.hudElements[3]); - hud_element_free(gActionCommandStatus.hudElements[4]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_BUTTON]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_METER]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_RUN_AWAY]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_OK]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_100_PCT]); } diff --git a/src/battle/action_cmd/flee.h b/src/battle/action_cmd/flee.h index c2910bca54f..65b863cff49 100644 --- a/src/battle/action_cmd/flee.h +++ b/src/battle/action_cmd/flee.h @@ -3,8 +3,12 @@ #include "common_structs.h" +// args: unknown value from actor var API_CALLABLE(action_command_flee_init); + +// args: prep time, duration, difficulty API_CALLABLE(action_command_flee_start); + void action_command_flee_update(void); void action_command_flee_draw(void); void action_command_flee_free(void); diff --git a/src/battle/action_cmd/hammer.c b/src/battle/action_cmd/hammer.c index 5d42267aec3..3501f4d2b3c 100644 --- a/src/battle/action_cmd/hammer.c +++ b/src/battle/action_cmd/hammer.c @@ -5,310 +5,326 @@ extern s32 actionCmdTableHammer[]; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_FRAME = 0, + HIDX_WAIT = 1, + HIDX_CHARGE_A = 2, + HIDX_CHARGE_B = 3, + HIDX_CHARGE_C = 4, + HIDX_STICK = 5, + HIDX_RIGHT_ON = 6, +}; + API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; - battleStatus->unk_82 = 1; + battleStatus->maxActionQuality = 1; battleStatus->actionCmdDifficultyTable = actionCmdTableHammer; battleStatus->actionResult = ACTION_RESULT_FAIL; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { battleStatus->actionQuality = 0; + battleStatus->actionProgress = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_SMASH; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->hudPosY = 96; - - id = hud_element_create(&HES_TimingBar1Chance); - actionCommandStatus->hudElements[0] = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 10); - - id = hud_element_create(&HES_TimingWait); - actionCommandStatus->hudElements[1] = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - - id = hud_element_create(&HES_TimingCharge4a); - actionCommandStatus->hudElements[2] = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - - id = hud_element_create(&HES_TimingCharge4b); - actionCommandStatus->hudElements[3] = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - - id = hud_element_create(&HES_TimingCharge4c); - actionCommandStatus->hudElements[4] = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - - id = hud_element_create(&HES_StickHoldLeft); - actionCommandStatus->hudElements[5] = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - - id = hud_element_create(&HES_RightOn); - actionCommandStatus->hudElements[6] = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - hud_element_set_alpha(id, 255); + acs->actionCommandID = ACTION_COMMAND_SMASH; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->hudPosX = -48; + acs->hudPosY = 96; + + hid = hud_element_create(&HES_TimingBar1Chance); + acs->hudElemIDs[HIDX_FRAME] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 10); + + hid = hud_element_create(&HES_TimingWait); + acs->hudElemIDs[HIDX_WAIT] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + + hid = hud_element_create(&HES_TimingCharge4a); + acs->hudElemIDs[HIDX_CHARGE_A] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + + hid = hud_element_create(&HES_TimingCharge4b); + acs->hudElemIDs[HIDX_CHARGE_B] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + + hid = hud_element_create(&HES_TimingCharge4c); + acs->hudElemIDs[HIDX_CHARGE_C] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + + hid = hud_element_create(&HES_StickHoldLeft); + acs->hudElemIDs[HIDX_STICK] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + + hid = hud_element_create(&HES_RightOn); + acs->hudElemIDs[HIDX_RIGHT_ON] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_alpha(hid, 255); return ApiStatus_DONE2; } API_CALLABLE(N(start)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Bytecode* args = script->ptrReadPos; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { battleStatus->actionQuality = 0; + battleStatus->actionProgress = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->prepareTime = evt_get_variable(script, *args++); - actionCommandStatus->duration = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = evt_get_variable(script, *args); - actionCommandStatus->difficulty = adjust_action_command_difficulty(actionCommandStatus->difficulty); - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->playHammerSounds = TRUE; - if (actionCommandStatus->prepareTime < 0) { - actionCommandStatus->prepareTime = 0; - actionCommandStatus->playHammerSounds = FALSE; + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + acs->wrongButtonPressed = FALSE; + acs->playHammerSounds = TRUE; + if (acs->prepareTime < 0) { + acs->prepareTime = 0; + acs->playHammerSounds = FALSE; } - actionCommandStatus->hammerMissedStart = FALSE; - battleStatus->actionSuccess = 0; + acs->hammerMissedStart = FALSE; battleStatus->actionQuality = 0; + battleStatus->actionProgress = 0; battleStatus->actionResult = ACTION_RESULT_FAIL; - actionCommandStatus->state = 10; + acs->state = AC_STATE_START; battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; - func_80269118(); + + increment_action_command_attempt_count(); + return ApiStatus_DONE2; } void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Actor* partner = battleStatus->partnerActor; - s32 id; - f32 temp_f20; - s32 phi_s0; + HudElemID hid; + f32 oneThird; + s32 inputWindow; + s32 bufferPos; + s32 i; s32 new_var; - s32 a; - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); - id = actionCommandStatus->hudElements[0]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_FRAME]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_set_alpha(id, 255); + hud_element_set_alpha(hid, 255); - id = actionCommandStatus->hudElements[1]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_WAIT]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_set_alpha(id, 255); + hud_element_set_alpha(hid, 255); - id = actionCommandStatus->hudElements[2]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_CHARGE_A]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_set_alpha(id, 255); + hud_element_set_alpha(hid, 255); - id = actionCommandStatus->hudElements[3]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_CHARGE_B]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_set_alpha(id, 255); + hud_element_set_alpha(hid, 255); - id = actionCommandStatus->hudElements[4]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_CHARGE_C]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_set_alpha(id, 255); + hud_element_set_alpha(hid, 255); - id = actionCommandStatus->hudElements[5]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_STICK]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_set_alpha(id, 255); + hud_element_set_alpha(hid, 255); - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX + 21, actionCommandStatus->hudPosY - 3); - hud_element_set_render_pos(actionCommandStatus->hudElements[2], actionCommandStatus->hudPosX + 5, actionCommandStatus->hudPosY + 1); - hud_element_set_render_pos(actionCommandStatus->hudElements[3], actionCommandStatus->hudPosX - 7, actionCommandStatus->hudPosY + 1); - hud_element_set_render_pos(actionCommandStatus->hudElements[4], actionCommandStatus->hudPosX - 19, actionCommandStatus->hudPosY + 1); - hud_element_set_render_pos(actionCommandStatus->hudElements[5], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY - 23); - if (actionCommandStatus->autoSucceed != 0) { - id = actionCommandStatus->hudElements[6]; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 50, actionCommandStatus->hudPosY); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_FRAME], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_WAIT], acs->hudPosX + 21, acs->hudPosY - 3); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_CHARGE_A], acs->hudPosX + 5, acs->hudPosY + 1); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_CHARGE_B], acs->hudPosX - 7, acs->hudPosY + 1); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_CHARGE_C], acs->hudPosX - 19, acs->hudPosY + 1); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_STICK], acs->hudPosX, acs->hudPosY - 23); + if (acs->autoSucceed != 0) { + hid = acs->hudElemIDs[HIDX_RIGHT_ON]; + hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); break; } } break; - case 10: - btl_set_popup_duration(99); - if (actionCommandStatus->prepareTime < 15) { - hud_element_set_alpha(actionCommandStatus->hudElements[0], 255); - hud_element_set_alpha(actionCommandStatus->hudElements[1], 255); - hud_element_set_alpha(actionCommandStatus->hudElements[2], 255); - hud_element_set_alpha(actionCommandStatus->hudElements[3], 255); - hud_element_set_alpha(actionCommandStatus->hudElements[4], 255); - hud_element_set_alpha(actionCommandStatus->hudElements[5], 255); + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->prepareTime < 15) { + hud_element_set_alpha(acs->hudElemIDs[HIDX_FRAME], 255); + hud_element_set_alpha(acs->hudElemIDs[HIDX_WAIT], 255); + hud_element_set_alpha(acs->hudElemIDs[HIDX_CHARGE_A], 255); + hud_element_set_alpha(acs->hudElemIDs[HIDX_CHARGE_B], 255); + hud_element_set_alpha(acs->hudElemIDs[HIDX_CHARGE_C], 255); + hud_element_set_alpha(acs->hudElemIDs[HIDX_STICK], 255); } - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + if (acs->prepareTime != 0) { + acs->prepareTime--; return; } - actionCommandStatus->frameCounter = 0; - if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && battleStatus->actionCommandMode < ACTION_COMMAND_MODE_TUTORIAL) { - actionCommandStatus->hammerMissedStart = TRUE; + acs->stateTimer = 0; + if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && battleStatus->actionCommandMode < AC_MODE_TUTORIAL) { + acs->hammerMissedStart = TRUE; } - actionCommandStatus->state = 11; - case 11: - btl_set_popup_duration(99); + acs->state = AC_STATE_ACTIVE; - if (battleStatus->actionCommandMode <= ACTION_COMMAND_MODE_TUTORIAL_BLOCK) { + // fallthrough + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + if (battleStatus->actionCommandMode <= AC_MODE_TUTORIAL_BLOCK) { return; } - phi_s0 = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; - new_var = phi_s0 + 2; - temp_f20 = (actionCommandStatus->duration - new_var) / 3; + inputWindow = battleStatus->actionCmdDifficultyTable[acs->difficulty]; + new_var = inputWindow + 2; + oneThird = (acs->duration - new_var) / 3; - if (actionCommandStatus->frameCounter < temp_f20) { - hud_element_set_script(actionCommandStatus->hudElements[4], &HES_TimingCharge3); - battleStatus->actionQuality = 0; - if (actionCommandStatus->frameCounter == 0 && actionCommandStatus->playHammerSounds) { - sfx_play_sound(SOUND_TIMING_BAR_TICK); + if (acs->stateTimer < oneThird) { + hud_element_set_script(acs->hudElemIDs[HIDX_CHARGE_C], &HES_TimingCharge3); + battleStatus->actionProgress = 0; + if (acs->stateTimer == 0) { + if (acs->playHammerSounds) { + sfx_play_sound(SOUND_TIMING_BAR_TICK); + } } - } else if (actionCommandStatus->frameCounter < temp_f20 * 2) { - hud_element_set_script(actionCommandStatus->hudElements[3], &HES_TimingCharge2); - battleStatus->actionQuality = 1; - if (actionCommandStatus->frameCounter == temp_f20) { - if (actionCommandStatus->playHammerSounds) { + } else if (acs->stateTimer < oneThird * 2) { + hud_element_set_script(acs->hudElemIDs[HIDX_CHARGE_B], &HES_TimingCharge2); + battleStatus->actionProgress = 1; + if (acs->stateTimer == oneThird) { + if (acs->playHammerSounds) { sfx_play_sound(SOUND_TIMING_BAR_TICK); } } - } else if (actionCommandStatus->frameCounter < temp_f20 * 3.0f) { - hud_element_set_script(actionCommandStatus->hudElements[2], &HES_TimingCharge1); - battleStatus->actionQuality = 2; - if (actionCommandStatus->frameCounter == temp_f20 * 2) { - if (actionCommandStatus->playHammerSounds) { + } else if (acs->stateTimer < oneThird * 3) { + hud_element_set_script(acs->hudElemIDs[HIDX_CHARGE_A], &HES_TimingCharge1); + battleStatus->actionProgress = 2; + if (acs->stateTimer == oneThird * 2) { + if (acs->playHammerSounds) { sfx_play_sound(SOUND_TIMING_BAR_TICK); } } } - if (actionCommandStatus->frameCounter == (~phi_s0 + actionCommandStatus->duration)) { - battleStatus->actionQuality = 3; - hud_element_set_script(actionCommandStatus->hudElements[1], &HES_TimingReady); - hud_element_set_script(actionCommandStatus->hudElements[5], &HES_StickTapNeutral); - if (actionCommandStatus->playHammerSounds) { + if (acs->stateTimer == (-(inputWindow + 1) + acs->duration)) { + battleStatus->actionProgress = 3; + hud_element_set_script(acs->hudElemIDs[HIDX_WAIT], &HES_TimingReady); + hud_element_set_script(acs->hudElemIDs[HIDX_STICK], &HES_StickTapNeutral); + if (acs->playHammerSounds) { sfx_play_sound(SOUND_TIMING_BAR_GO); } - if (actionCommandStatus->autoSucceed != 0 && actionCommandStatus->autoSucceed != 2) { - actionCommandStatus->autoSucceed = 2; - actionCommandStatus->frameCounter = actionCommandStatus->duration - 4; + if (acs->autoSucceed != 0 && acs->autoSucceed != 2) { + acs->autoSucceed = 2; + acs->stateTimer = acs->duration - 4; } } - - a = actionCommandStatus->duration - actionCommandStatus->frameCounter; - phi_s0 = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] - a + 3; - if (phi_s0 < 0) { - phi_s0 = 0; + inputWindow = battleStatus->actionCmdDifficultyTable[acs->difficulty] - (acs->duration - acs->stateTimer) + 3; + if (inputWindow < 0) { + inputWindow = 0; } - if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && - phi_s0 == 0 && - actionCommandStatus->autoSucceed == 0 && - battleStatus->actionCommandMode < ACTION_COMMAND_MODE_TUTORIAL) - { - battleStatus->actionSuccess = -1; + // has the stick been release too early? + if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) + && inputWindow == 0 + && acs->autoSucceed == 0 + && battleStatus->actionCommandMode < AC_MODE_TUTORIAL + ) { + battleStatus->actionQuality = AC_QUALITY_FAILED; battleStatus->actionResult = ACTION_RESULT_EARLY; action_command_free(); - } else { - s32 i; - s32 bufferPos; - - bufferPos = battleStatus->inputBufferPos; - bufferPos -= phi_s0; - if (bufferPos < 0) { - bufferPos += ARRAY_COUNT(battleStatus->holdInputBuffer); - } + return; + } + + // step back several frames in the input buffer + bufferPos = battleStatus->inputBufferPos; + bufferPos -= inputWindow; + if (bufferPos < 0) { + bufferPos += ARRAY_COUNT(battleStatus->holdInputBuffer); + } - if (battleStatus->actionSuccess == 0) { - for (i = 0; i < phi_s0; i++, bufferPos++) { - if (bufferPos >= ARRAY_COUNT(battleStatus->holdInputBuffer)) { - bufferPos -= ARRAY_COUNT(battleStatus->holdInputBuffer); - } - - if (!(battleStatus->holdInputBuffer[bufferPos] & BUTTON_STICK_LEFT) || - actionCommandStatus->autoSucceed != 0) - { - battleStatus->actionSuccess = 1; - battleStatus->actionResult = ACTION_RESULT_SUCCESS; - gBattleStatus.flags1 |= BS_FLAGS1_2000; - } + // has the stick been released within the window? + if (battleStatus->actionQuality == 0) { + for (i = 0; i < inputWindow; i++) { + if (bufferPos >= ARRAY_COUNT(battleStatus->holdInputBuffer)) { + bufferPos -= ARRAY_COUNT(battleStatus->holdInputBuffer); } - } - if (battleStatus->actionCommandMode < ACTION_COMMAND_MODE_TUTORIAL || actionCommandStatus->frameCounter != actionCommandStatus->duration) { - actionCommandStatus->frameCounter++; - if (actionCommandStatus->duration < actionCommandStatus->frameCounter) { - if (battleStatus->actionSuccess == 0) { - battleStatus->actionSuccess = -1; - } + if (!(battleStatus->holdInputBuffer[bufferPos] & BUTTON_STICK_LEFT) || acs->autoSucceed != 0) { + battleStatus->actionQuality = 1; + battleStatus->actionResult = ACTION_RESULT_SUCCESS; + gBattleStatus.flags1 |= BS_FLAGS1_2000; + } + bufferPos++; + } + } - if (battleStatus->actionSuccess == 1) { - func_80269160(); - } + if (battleStatus->actionCommandMode < AC_MODE_TUTORIAL || acs->stateTimer != acs->duration) { + acs->stateTimer++; + if (acs->duration < acs->stateTimer) { + if (battleStatus->actionQuality == 0) { + battleStatus->actionQuality = AC_QUALITY_FAILED; + } - btl_set_popup_duration(0); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; + if (battleStatus->actionQuality == 1) { + increment_action_command_success_count(); } + + btl_set_popup_duration(POPUP_MSG_OFF); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; } } break; - case 12: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; + case AC_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; return; } action_command_free(); @@ -317,21 +333,21 @@ void N(update)(void) { } void N(draw)(void) { - hud_element_draw_clipped(gActionCommandStatus.hudElements[0]); - hud_element_draw_clipped(gActionCommandStatus.hudElements[1]); - hud_element_draw_clipped(gActionCommandStatus.hudElements[2]); - hud_element_draw_clipped(gActionCommandStatus.hudElements[3]); - hud_element_draw_clipped(gActionCommandStatus.hudElements[4]); - hud_element_draw_clipped(gActionCommandStatus.hudElements[5]); - hud_element_draw_clipped(gActionCommandStatus.hudElements[6]); + hud_element_draw_clipped(gActionCommandStatus.hudElemIDs[HIDX_FRAME]); + hud_element_draw_clipped(gActionCommandStatus.hudElemIDs[HIDX_WAIT]); + hud_element_draw_clipped(gActionCommandStatus.hudElemIDs[HIDX_CHARGE_A]); + hud_element_draw_clipped(gActionCommandStatus.hudElemIDs[HIDX_CHARGE_B]); + hud_element_draw_clipped(gActionCommandStatus.hudElemIDs[HIDX_CHARGE_C]); + hud_element_draw_clipped(gActionCommandStatus.hudElemIDs[HIDX_STICK]); + hud_element_draw_clipped(gActionCommandStatus.hudElemIDs[HIDX_RIGHT_ON]); } void N(free)(void) { - hud_element_free(gActionCommandStatus.hudElements[0]); - hud_element_free(gActionCommandStatus.hudElements[1]); - hud_element_free(gActionCommandStatus.hudElements[2]); - hud_element_free(gActionCommandStatus.hudElements[3]); - hud_element_free(gActionCommandStatus.hudElements[4]); - hud_element_free(gActionCommandStatus.hudElements[5]); - hud_element_free(gActionCommandStatus.hudElements[6]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_FRAME]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_WAIT]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_CHARGE_A]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_CHARGE_B]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_CHARGE_C]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_STICK]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_RIGHT_ON]); } diff --git a/src/battle/action_cmd/hammer.h b/src/battle/action_cmd/hammer.h index 64112f322df..dcde91a1c81 100644 --- a/src/battle/action_cmd/hammer.h +++ b/src/battle/action_cmd/hammer.h @@ -3,8 +3,12 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_hammer_init); + +// args: prep time, duration, difficulty API_CALLABLE(action_command_hammer_start); + void action_command_hammer_update(void); void action_command_hammer_draw(void); void action_command_hammer_free(void); diff --git a/src/battle/action_cmd/hurricane.c b/src/battle/action_cmd/hurricane.c index 006b070f58c..3dac388456d 100644 --- a/src/battle/action_cmd/hurricane.c +++ b/src/battle/action_cmd/hurricane.c @@ -3,185 +3,189 @@ #define NAMESPACE action_command_hurricane -s32 D_802A98E0_42FFC0[8] = { 0, 25, 50, 75, 75, 0, 0, 0 }; - extern s32 actionCmdTableHurricane[]; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_A_BUTTON = 0, + HIDX_METER = 1, + HIDX_B_BUTTON = 2, + HIDX_100_PCT = 4, +}; + +// how much to add to the meter per input +#define METER_FILL_TICK 650 + +s32 N(DrainRateTable)[] = { 0, 25, 50, 75, 75 }; + +#define GET_DRAIN_RATE(pct) PCT_TO_TABLE_RATE(N(DrainRateTable), pct) + API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; - battleStatus->unk_82 = 5; + battleStatus->maxActionQuality = 5; battleStatus->actionCmdDifficultyTable = actionCmdTableHurricane; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_HURRICANE; - actionCommandStatus->hudPrepareTime = 30; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->isBarFilled = FALSE; - actionCommandStatus->hudPosY = 80; - - id = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - - id = hud_element_create(&HES_BButton); - actionCommandStatus->hudElements[2] = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - - id = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_100pct); - actionCommandStatus->hudElements[4] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + acs->actionCommandID = ACTION_COMMAND_HURRICANE; + acs->hudPrepareTime = 30; + acs->hudPosX = -48; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + acs->isMeterFilled = FALSE; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_A_BUTTON] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + + hid = hud_element_create(&HES_BButton); + acs->hudElemIDs[HIDX_B_BUTTON] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_100pct); + acs->hudElemIDs[HIDX_100_PCT] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); return ApiStatus_DONE2; } API_CALLABLE(N(start)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Bytecode* args = script->ptrReadPos; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->prepareTime = evt_get_variable(script, *args++); - actionCommandStatus->duration = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = adjust_action_command_difficulty(actionCommandStatus->difficulty); - actionCommandStatus->targetWeakness = evt_get_variable(script, *args++); + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + acs->statusChance = evt_get_variable(script, *args++); // average chance for enemies to be affected - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - battleStatus->actionSuccess = 0; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; battleStatus->actionResult = ACTION_RESULT_FAIL; - actionCommandStatus->state = 10; + acs->state = AC_STATE_START; battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; - func_80269118(); + increment_action_command_attempt_count(); return ApiStatus_DONE2; } -// Almost identical to action_command_mega_shock_update (mega_shock) void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - + HudElemID hid; + s32 cutoff; s32 buttonsPushed; - s32 frameCount; s32 buttonsAB; s32 bufferPos; - s32 hudElement; - s32 mashMeterIndex; - s32 mashMeterCutoff; - s8 adjustedFillLevel; - - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); - - hudElement = actionCommandStatus->hudElements[0]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + s32 i; + + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); + + hid = acs->hudElemIDs[HIDX_A_BUTTON]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_set_alpha(hudElement, 255); + hud_element_set_alpha(hid, 255); - hudElement = actionCommandStatus->hudElements[2]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[HIDX_B_BUTTON]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_set_alpha(hudElement, 255); + hud_element_set_alpha(hid, 255); - hudElement = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(hudElement, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); - if (actionCommandStatus->hudPrepareTime != 0) { - actionCommandStatus->hudPrepareTime--; + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->hudPrepareTime != 0) { + acs->hudPrepareTime--; break; } - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX - 17, - actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[2], actionCommandStatus->hudPosX + 23, - actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, - actionCommandStatus->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_A_BUTTON], acs->hudPosX - 17, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_B_BUTTON], acs->hudPosX + 23, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); break; - case 10: - btl_set_popup_duration(99); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->prepareTime != 0) { + acs->prepareTime--; break; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton); - hud_element_set_script(actionCommandStatus->hudElements[2], &HES_MashBButton1); - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->unk_5C = 0; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - actionCommandStatus->state = 11; + hud_element_set_script(acs->hudElemIDs[HIDX_A_BUTTON], &HES_MashAButton); + hud_element_set_script(acs->hudElemIDs[HIDX_B_BUTTON], &HES_MashBButton1); + acs->meterFillLevel = 0; + acs->any.unk_5C = 0; + acs->stateTimer = acs->duration; + acs->state = AC_STATE_ACTIVE; + // fallthrough - case 11: - btl_set_popup_duration(99); - if (!actionCommandStatus->isBarFilled) { - s16 newFillLevel; - - if (actionCommandStatus->targetWeakness != 0) { - s8 mashMeterIntervals = actionCommandStatus->mashMeterIntervals; - s16* mashMeterCutoffs = actionCommandStatus->mashMeterCutoffs; - s32 index; - - mashMeterCutoff = mashMeterCutoffs[mashMeterIntervals]; - index = actionCommandStatus->barFillLevel / mashMeterCutoff / 20; - newFillLevel = actionCommandStatus->barFillLevel - D_802A98E0_42FFC0[index]; + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // meter can drain if it hasn't been fully filled + if (!acs->isMeterFilled) { + if (acs->statusChance != 0) { + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals]; + acs->meterFillLevel -= GET_DRAIN_RATE(acs->meterFillLevel / cutoff); + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; + } } else { - newFillLevel = actionCommandStatus->barFillLevel - 10; - } - - actionCommandStatus->barFillLevel = newFillLevel; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + acs->meterFillLevel -= 10; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; + } } } + // step back two frames in the input buffer bufferPos = battleStatus->inputBufferPos; bufferPos -= 2; if (bufferPos < 0) { @@ -189,150 +193,144 @@ void N(update)(void) { } buttonsPushed = 0; - frameCount = 1; - while (frameCount >= 0) { + // get combined input during the last two frames + for (i = 1; i >= 0; i--) { if (bufferPos >= ARRAY_COUNT(battleStatus->pushInputBuffer)) { bufferPos -= ARRAY_COUNT(battleStatus->pushInputBuffer); } - - buttonsPushed |= battleStatus->pushInputBuffer[bufferPos++]; - frameCount--; + buttonsPushed |= battleStatus->pushInputBuffer[bufferPos]; + bufferPos++; } buttonsAB = BUTTON_A | BUTTON_B; if ((buttonsPushed & buttonsAB) == buttonsAB) { - if (actionCommandStatus->targetWeakness != 0) { - s32 fillLevel; + if (acs->statusChance != 0) { + s32 amt; - fillLevel = actionCommandStatus->targetWeakness * 650; - fillLevel = fillLevel / 100 * battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; + amt = SCALE_BY_PCT(METER_FILL_TICK, acs->statusChance); + amt = SCALE_BY_PCT(amt, battleStatus->actionCmdDifficultyTable[acs->difficulty]); // Perplexing reuse of buttonsPushed here, but it fixes register allocation. Likely another // subexpression from above can be put into a variable and reused instead. // // TODO: Find a way to avoid reusing buttonsPushed. - buttonsPushed = fillLevel / 100; + buttonsPushed = amt; - actionCommandStatus->barFillLevel += buttonsPushed; + acs->meterFillLevel += buttonsPushed; } else { - actionCommandStatus->barFillLevel += 100; + acs->meterFillLevel += ONE_PCT_MASH; - if (actionCommandStatus->barFillLevel >= 500) { - actionCommandStatus->barFillLevel = 500; + if (acs->meterFillLevel >= 5 * ONE_PCT_MASH) { + acs->meterFillLevel = 5 * ONE_PCT_MASH; } } + // step back two frames in the input buffer bufferPos = battleStatus->inputBufferPos; bufferPos -= 2; if (bufferPos < 0) { bufferPos += ARRAY_COUNT(battleStatus->pushInputBuffer); } - frameCount = 1; - while (frameCount >= 0) { + // clear buffer to be ready for the next input + for (i = 1; i >= 0; i--) { if (bufferPos >= ARRAY_COUNT(battleStatus->pushInputBuffer)) { bufferPos -= ARRAY_COUNT(battleStatus->pushInputBuffer); } - - battleStatus->pushInputBuffer[bufferPos++] = 0; - frameCount--; + battleStatus->pushInputBuffer[bufferPos] = 0; + bufferPos++; } } - if (actionCommandStatus->barFillLevel > 10000) { - hudElement = actionCommandStatus->hudElements[4]; - actionCommandStatus->barFillLevel = 10000; - actionCommandStatus->isBarFilled = TRUE; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX + 50, - actionCommandStatus->hudPosY + 28); - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + // handle meter reaching 100% + if (acs->meterFillLevel > MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + acs->isMeterFilled = TRUE; + hid = acs->hudElemIDs[HIDX_100_PCT]; + hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY + 28); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - adjustedFillLevel = actionCommandStatus->barFillLevel / 100; - - battleStatus->actionQuality = adjustedFillLevel; + battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH; - if (actionCommandStatus->frameCounter == 0) { - s16 threshold; - - // Again, reusing buttonsPushed specifically for reg-alloc. See above. - // - // TODO: Find a way to avoid reusing buttonsPushed. - buttonsPushed = actionCommandStatus->barFillLevel; - if (actionCommandStatus->targetWeakness == 0) { - buttonsPushed = 0; - } - - if (buttonsPushed == 0) { - battleStatus->actionSuccess = -1; - } else { - battleStatus->actionSuccess = buttonsPushed / 100; - } - - mashMeterIndex = actionCommandStatus->mashMeterIntervals - 1; - mashMeterCutoff = actionCommandStatus->mashMeterCutoffs[mashMeterIndex]; - threshold = mashMeterCutoff / 2; + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; + } - if (battleStatus->actionQuality <= threshold) { - battleStatus->actionResult = ACTION_RESULT_MINUS_4; - } else { - battleStatus->actionResult = ACTION_RESULT_SUCCESS; - } + // Again, reusing buttonsPushed specifically for reg-alloc. See above. + // + // TODO: Find a way to avoid reusing buttonsPushed. + buttonsPushed = acs->meterFillLevel; + if (acs->statusChance == 0) { + buttonsPushed = 0; + } - if (battleStatus->actionSuccess == 100) { - func_80269160(); - } + if (buttonsPushed == 0) { + battleStatus->actionQuality = AC_QUALITY_FAILED; + } else { + battleStatus->actionQuality = buttonsPushed / ONE_PCT_MASH; + } - btl_set_popup_duration(0); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; + // a good result is filling the meter over halfway to the second-highest interval + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals - 1]; + if (battleStatus->actionProgress <= cutoff / 2) { + battleStatus->actionResult = ACTION_RESULT_METER_BELOW_HALF; } else { - actionCommandStatus->frameCounter -= 1; + battleStatus->actionResult = ACTION_RESULT_SUCCESS; + } + + if (battleStatus->actionQuality == 100) { + // only count 100% fill as success for this action command + increment_action_command_success_count(); } + + btl_set_popup_duration(POPUP_MSG_OFF); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->targetWeakness == 0) { - actionCommandStatus->barFillLevel -= 100; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + case AC_STATE_DISPOSE: + if (acs->statusChance == 0) { + acs->meterFillLevel -= ONE_PCT_MASH; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter -= 1; - } else { - action_command_free(); + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } + action_command_free(); break; } } void N(draw)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - s32 hudY; - s32 hudX; - s32 id; + ActionCommandStatus* acs = &gActionCommandStatus; + s32 hudX, hudY; + HudElemID hid; - hud_element_draw_clipped(actionCommandStatus->hudElements[0]); - hud_element_draw_clipped(actionCommandStatus->hudElements[2]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_A_BUTTON]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_B_BUTTON]); - id = actionCommandStatus->hudElements[1]; - hud_element_draw_clipped(id); - hud_element_get_render_pos(id, &hudX, &hudY); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_draw_clipped(hid); + hud_element_get_render_pos(hid, &hudX, &hudY); - if (!actionCommandStatus->isBarFilled) { - draw_mash_meter_multicolor(hudX, hudY, actionCommandStatus->barFillLevel / 100); + if (!acs->isMeterFilled) { + draw_mash_meter_multicolor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH); } else { - draw_mash_meter_blink(hudX, hudY, actionCommandStatus->barFillLevel / 100); + draw_mash_meter_blink(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH); } - hud_element_draw_clipped(actionCommandStatus->hudElements[4]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_100_PCT]); } void N(free)(void) { - hud_element_free(gActionCommandStatus.hudElements[0]); - hud_element_free(gActionCommandStatus.hudElements[1]); - hud_element_free(gActionCommandStatus.hudElements[2]); - hud_element_free(gActionCommandStatus.hudElements[4]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_A_BUTTON]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_METER]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_B_BUTTON]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_100_PCT]); } diff --git a/src/battle/action_cmd/hurricane.h b/src/battle/action_cmd/hurricane.h index 9ad06312015..948177e755a 100644 --- a/src/battle/action_cmd/hurricane.h +++ b/src/battle/action_cmd/hurricane.h @@ -3,8 +3,12 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_hurricane_init); + +// args: prep time, duration, difficulty, chance API_CALLABLE(action_command_hurricane_start); + void action_command_hurricane_update(void); void action_command_hurricane_draw(void); void action_command_hurricane_free(void); diff --git a/src/battle/action_cmd/jump.c b/src/battle/action_cmd/jump.c index f61fe13778f..40e4b094bb8 100644 --- a/src/battle/action_cmd/jump.c +++ b/src/battle/action_cmd/jump.c @@ -5,188 +5,190 @@ extern s32 actionCmdTableJump[]; +// indices into ActionCommandStatus::hudElements for this action command enum { - AC_JUMP_STATE_0 = 0, - AC_JUMP_STATE_1 = 1, - AC_JUMP_STATE_10 = 10, - AC_JUMP_STATE_11 = 11, - AC_JUMP_STATE_CLEANUP = 12, + HIDX_BUTTON = 0, + HIDX_RIGHT_ON = 1, }; API_CALLABLE(N(init)) { - s32 hudElement; - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; + HudElemID hid; - gBattleStatus.unk_82 = 1; + gBattleStatus.maxActionQuality = 1; gBattleStatus.actionCmdDifficultyTable = actionCmdTableJump; gBattleStatus.actionResult = ACTION_RESULT_FAIL; - if (gBattleStatus.actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - gBattleStatus.actionSuccess = 0; + if (gBattleStatus.actionCommandMode == AC_MODE_NOT_LEARNED) { + gBattleStatus.actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_JUMP; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->hudPosY = 80; - - hudElement = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = hudElement; - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_alpha(hudElement, 255); - - hudElement = hud_element_create(&HES_RightOn); - actionCommandStatus->hudElements[1] = hudElement; - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_alpha(hudElement, 255); + acs->actionCommandID = ACTION_COMMAND_JUMP; + acs->hudPosX = -48; + acs->state = 0; + acs->wrongButtonPressed = FALSE; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_BUTTON] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_alpha(hid, 255); + + hid = hud_element_create(&HES_RightOn); + acs->hudElemIDs[HIDX_RIGHT_ON] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_alpha(hid, 255); return ApiStatus_DONE2; } API_CALLABLE(N(start)) { - s32 hudElement; - - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Bytecode* args = script->ptrReadPos; + HudElemID hid; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; - return ApiStatus_DONE2; - } else { - action_command_init_status(); - actionCommandStatus->prepareTime = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = adjust_action_command_difficulty(actionCommandStatus->difficulty); - actionCommandStatus->wrongButtonPressed = FALSE; - battleStatus->actionSuccess = 0; - - hudElement = actionCommandStatus->hudElements[0]; - actionCommandStatus->hudPosX = 50; - battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; - battleStatus->flags1 &= ~BS_FLAGS1_2000; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); - } - - actionCommandStatus->state = AC_JUMP_STATE_10; - func_80269118(); - btl_set_popup_duration(10); + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } + + action_command_init_status(); + acs->prepareTime = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + acs->wrongButtonPressed = FALSE; + battleStatus->actionQuality = 0; + + hid = acs->hudElemIDs[HIDX_BUTTON]; + acs->hudPosX = 50; + battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; + battleStatus->flags1 &= ~BS_FLAGS1_2000; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + + acs->state = AC_STATE_START; + increment_action_command_attempt_count(); + btl_set_popup_duration(10); + + return ApiStatus_DONE2; } void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 hudElement; + HudElemID hid; s32 successWindow; - switch (actionCommandStatus->state) { - case AC_JUMP_STATE_0: - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_TUTORIAL) { - btl_set_popup_duration(99); + switch (acs->state) { + case AC_STATE_INIT: + if (battleStatus->actionCommandMode == AC_MODE_TUTORIAL) { + btl_set_popup_duration(POPUP_MSG_ON); } - actionCommandStatus->state = AC_JUMP_STATE_1; + acs->state = AC_STATE_APPEAR; break; - case AC_JUMP_STATE_1: - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_TUTORIAL) { - btl_set_popup_duration(99); + case AC_STATE_APPEAR: + if (battleStatus->actionCommandMode == AC_MODE_TUTORIAL) { + btl_set_popup_duration(POPUP_MSG_ON); } - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hudElement = actionCommandStatus->hudElements[0]; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[HIDX_BUTTON]; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - if (actionCommandStatus->autoSucceed) { - hudElement = actionCommandStatus->hudElements[1]; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX + 50, actionCommandStatus->hudPosY); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); - break; + if (acs->autoSucceed) { + hid = acs->hudElemIDs[HIDX_RIGHT_ON]; + hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } } break; - case AC_JUMP_STATE_10: - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_TUTORIAL) { - btl_set_popup_duration(99); + case AC_STATE_START: + // this state is the time before valid input is allowed + + if (battleStatus->actionCommandMode == AC_MODE_TUTORIAL) { + btl_set_popup_duration(POPUP_MSG_ON); } - successWindow = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; - if (((actionCommandStatus->prepareTime - successWindow) - 2) <= 0) { - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_AButtonDown); + // show the A button being pressed two frames before input is allowed + successWindow = battleStatus->actionCmdDifficultyTable[acs->difficulty]; + if (((acs->prepareTime - successWindow) - 2) <= 0) { + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_AButtonDown); } - if ((battleStatus->curButtonsPressed & BUTTON_A) && !actionCommandStatus->autoSucceed) { - actionCommandStatus->wrongButtonPressed = TRUE; + // inputs during this state will cause the action to fail + if ((battleStatus->curButtonsPressed & BUTTON_A) && !acs->autoSucceed) { + acs->wrongButtonPressed = TRUE; battleStatus->actionResult = ACTION_RESULT_EARLY; } - if ((actionCommandStatus->prepareTime - successWindow) > 0) { - actionCommandStatus->prepareTime -= 1; + // continue until we begin the window for valid input + if ((acs->prepareTime - successWindow) > 0) { + acs->prepareTime--; break; } - actionCommandStatus->frameCounter = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; - battleStatus->actionSuccess = -1; - actionCommandStatus->state = AC_JUMP_STATE_11; - // fall through - case AC_JUMP_STATE_11: - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_TUTORIAL) { - btl_set_popup_duration(99); + acs->stateTimer = battleStatus->actionCmdDifficultyTable[acs->difficulty]; + battleStatus->actionQuality = AC_QUALITY_FAILED; + acs->state = AC_STATE_ACTIVE; + + // fallthrough + case AC_STATE_ACTIVE: + if (battleStatus->actionCommandMode == AC_MODE_TUTORIAL) { + btl_set_popup_duration(POPUP_MSG_ON); } - if (battleStatus->actionCommandMode >= ACTION_COMMAND_MODE_TUTORIAL) { - if (actionCommandStatus->frameCounter == 0) { + if (battleStatus->actionCommandMode >= AC_MODE_TUTORIAL) { + if (acs->stateTimer == 0) { break; } } else { - if (battleStatus->actionSuccess >= 0) { - hudElement = actionCommandStatus->hudElements[0]; - if (actionCommandStatus->showHud) { - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + if (battleStatus->actionQuality >= 0) { + hid = acs->hudElemIDs[HIDX_BUTTON]; + if (acs->showHud) { + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } } } - if (battleStatus->actionSuccess < 0) { - if (((battleStatus->curButtonsPressed & BUTTON_A) && - !actionCommandStatus->wrongButtonPressed) || - actionCommandStatus->autoSucceed) { - battleStatus->actionSuccess = 1; + // valid input is allowed during this state + if (battleStatus->actionQuality < 0) { + if (((battleStatus->curButtonsPressed & BUTTON_A) && !acs->wrongButtonPressed) || acs->autoSucceed) { + battleStatus->actionQuality = 1; battleStatus->actionResult = ACTION_RESULT_SUCCESS; gBattleStatus.flags1 |= BS_FLAGS1_2000; } } - if (actionCommandStatus->frameCounter == 0) { - if (battleStatus->actionSuccess == 1) { - func_80269160(); + if (acs->stateTimer == 0) { + if (battleStatus->actionQuality == 1) { + increment_action_command_success_count(); } - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_TUTORIAL) { - btl_set_popup_duration(0); + if (battleStatus->actionCommandMode == AC_MODE_TUTORIAL) { + btl_set_popup_duration(POPUP_MSG_OFF); } - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = AC_JUMP_STATE_CLEANUP; + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; break; } - actionCommandStatus->frameCounter--; + acs->stateTimer--; break; - case AC_JUMP_STATE_CLEANUP: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; + case AC_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; break; } action_command_free(); @@ -195,13 +197,13 @@ void N(update)(void) { } void N(draw)(void) { - hud_element_draw_clipped(gActionCommandStatus.hudElements[0]); + hud_element_draw_clipped(gActionCommandStatus.hudElemIDs[HIDX_BUTTON]); if (!(gGameStatusPtr->demoBattleFlags & DEMO_BTL_FLAG_ENABLED)) { - hud_element_draw_clipped(gActionCommandStatus.hudElements[1]); + hud_element_draw_clipped(gActionCommandStatus.hudElemIDs[HIDX_RIGHT_ON]); } } void N(free)(void) { - hud_element_free(gActionCommandStatus.hudElements[0]); - hud_element_free(gActionCommandStatus.hudElements[1]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_BUTTON]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_RIGHT_ON]); } diff --git a/src/battle/action_cmd/jump.h b/src/battle/action_cmd/jump.h index b88e8a426e0..03984817ebc 100644 --- a/src/battle/action_cmd/jump.h +++ b/src/battle/action_cmd/jump.h @@ -3,8 +3,13 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_jump_init); + +// args: duration, difficulty +// duration should be two frames fewer than actual motion toward the target API_CALLABLE(action_command_jump_start); + void action_command_jump_update(void); void action_command_jump_draw(void); void action_command_jump_free(void); diff --git a/src/battle/action_cmd/mega_shock.c b/src/battle/action_cmd/mega_shock.c index f7992b62573..f778af15089 100644 --- a/src/battle/action_cmd/mega_shock.c +++ b/src/battle/action_cmd/mega_shock.c @@ -1,192 +1,195 @@ #include "common.h" + + #include "audio/public.h" #include "battle/action_cmd.h" #define NAMESPACE action_command_mega_shock -s32 D_802A9930_42E340[] = { 0, 25, 50, 75, 75, 0, 0, 0 }; - extern s32 actionCmdTableMegaShock[]; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_A_BUTTON = 0, + HIDX_METER = 1, + HIDX_B_BUTTON = 2, + HIDX_100_PCT = 4, +}; + +// how much to add to the meter per input +#define METER_FILL_TICK 780 + +s32 N(DrainRateTable)[] = { 0, 25, 50, 75, 75 }; + +#define GET_DRAIN_RATE(pct) PCT_TO_TABLE_RATE(N(DrainRateTable), pct) + API_CALLABLE(N(init)) { BattleStatus* battleStatus = &gBattleStatus; - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - s32 elementID; + ActionCommandStatus* acs = &gActionCommandStatus; + HudElemID hid; - battleStatus->unk_82 = 5; + battleStatus->maxActionQuality = 5; battleStatus->actionCmdDifficultyTable = actionCmdTableMegaShock; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } + action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_MEGA_SHOCK; - actionCommandStatus->state = 0; - actionCommandStatus->hudPrepareTime = 30; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->isBarFilled = FALSE; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->hudPosY = 80; - - elementID = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = elementID; - hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(elementID, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(elementID, 0); - - elementID = hud_element_create(&HES_BButton); - actionCommandStatus->hudElements[2] = elementID; - hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(elementID, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(elementID, 0); - - elementID = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = elementID; - hud_element_set_render_pos(elementID, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 0x1C); - hud_element_set_render_depth(elementID, 0); - hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - elementID = hud_element_create(&HES_100pct); - actionCommandStatus->hudElements[4] = elementID; - hud_element_set_render_pos(elementID, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 0x1C); - hud_element_set_render_depth(elementID, 0); - hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + acs->actionCommandID = ACTION_COMMAND_MEGA_SHOCK; + acs->state = AC_STATE_INIT; + acs->hudPrepareTime = 30; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + acs->isMeterFilled = FALSE; + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_A_BUTTON] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + + hid = hud_element_create(&HES_BButton); + acs->hudElemIDs[HIDX_B_BUTTON] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_100pct); + acs->hudElemIDs[HIDX_100_PCT] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); return ApiStatus_DONE2; } API_CALLABLE(N(start)) { - Bytecode* readPos = script->ptrReadPos; - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; + Bytecode* args = script->ptrReadPos; - s16 arg; - ApiStatus result; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; + return ApiStatus_DONE2; + } - if (battleStatus->actionCommandMode != ACTION_COMMAND_MODE_NOT_LEARNED) { - action_command_init_status(); + action_command_init_status(); - actionCommandStatus->prepareTime = evt_get_variable(script, *readPos++); - actionCommandStatus->duration = evt_get_variable(script, *readPos++); - arg = evt_get_variable(script, *readPos++); + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + acs->statusChance = evt_get_variable(script, *args++); // average chance for enemies to be affected - actionCommandStatus->difficulty = arg; - actionCommandStatus->difficulty = adjust_action_command_difficulty(arg); - actionCommandStatus->targetWeakness = evt_get_variable(script, *readPos++); - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; + battleStatus->actionResult = ACTION_RESULT_FAIL; + acs->state = AC_STATE_START; + battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; - battleStatus->actionSuccess = 0; - battleStatus->actionResult = ACTION_RESULT_FAIL; - actionCommandStatus->state = 10; - battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; + increment_action_command_attempt_count(); - func_80269118(); - result = ApiStatus_DONE2; - } else { - battleStatus->actionSuccess = 0; - result = ApiStatus_DONE2; - } - - return result; + return ApiStatus_DONE2; } void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - + HudElemID hid; + s32 cutoff; s32 buttonsPushed; - s32 frameCount; s32 buttonsAB; s32 bufferPos; - s32 hudElement; - s32 mashMeterIndex; - s32 mashMeterCutoff; - s8 adjustedFillLevel; - - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); - - hudElement = actionCommandStatus->hudElements[0]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + s32 i; + + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); + + hid = acs->hudElemIDs[HIDX_A_BUTTON]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_set_alpha(hudElement, 255); + hud_element_set_alpha(hid, 255); - hudElement = actionCommandStatus->hudElements[2]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[HIDX_B_BUTTON]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_set_alpha(hudElement, 255); + hud_element_set_alpha(hid, 255); - hudElement = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(hudElement, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); - if (actionCommandStatus->hudPrepareTime != 0) { - actionCommandStatus->hudPrepareTime--; + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->hudPrepareTime != 0) { + acs->hudPrepareTime--; break; } - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX - 17, - actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[2], actionCommandStatus->hudPosX + 23, - actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, - actionCommandStatus->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_A_BUTTON], acs->hudPosX - 17, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_B_BUTTON], acs->hudPosX + 23, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); break; - case 10: - btl_set_popup_duration(99); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->prepareTime != 0) { + acs->prepareTime--; break; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton); - hud_element_set_script(actionCommandStatus->hudElements[2], &HES_MashBButton1); - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->unk_5C = 0; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - sfx_play_sound_with_params(SOUND_LOOP_CHARGE_BAR, 0, 0, 0); - actionCommandStatus->state = 11; - case 11: - btl_set_popup_duration(99); - if (!actionCommandStatus->isBarFilled) { - s16 newFillLevel; - - if (actionCommandStatus->targetWeakness != 0) { - s8 mashMeterIntervals = actionCommandStatus->mashMeterIntervals; - s16* mashMeterCutoffs = actionCommandStatus->mashMeterCutoffs; - s32 index; - - mashMeterCutoff = mashMeterCutoffs[mashMeterIntervals]; - index = actionCommandStatus->barFillLevel / mashMeterCutoff / 20; - newFillLevel = actionCommandStatus->barFillLevel - D_802A9930_42E340[index]; + hud_element_set_script(acs->hudElemIDs[HIDX_A_BUTTON], &HES_MashAButton); + hud_element_set_script(acs->hudElemIDs[HIDX_B_BUTTON], &HES_MashBButton1); + acs->meterFillLevel = 0; + acs->any.unk_5C = 0; + acs->stateTimer = acs->duration; + sfx_play_sound_with_params(SOUND_LOOP_CHARGE_METER, 0, 0, 0); + acs->state = AC_STATE_ACTIVE; + + // fallthrough + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // meter can drain if it hasn't been fully filled + if (!acs->isMeterFilled) { + if (acs->statusChance != 0) { + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals]; + acs->meterFillLevel -= GET_DRAIN_RATE(acs->meterFillLevel / cutoff); + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; + } } else { - newFillLevel = actionCommandStatus->barFillLevel - 10; - } - - actionCommandStatus->barFillLevel = newFillLevel; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + acs->meterFillLevel -= 10; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; + } } } + // step back two frames in the input buffer bufferPos = battleStatus->inputBufferPos; bufferPos -= 2; if (bufferPos < 0) { @@ -194,153 +197,145 @@ void N(update)(void) { } buttonsPushed = 0; - frameCount = 1; - while (frameCount >= 0) { + // get combined input during the last two frames + for (i = 1; i >= 0; i--) { if (bufferPos >= ARRAY_COUNT(battleStatus->pushInputBuffer)) { bufferPos -= ARRAY_COUNT(battleStatus->pushInputBuffer); } - - buttonsPushed |= battleStatus->pushInputBuffer[bufferPos++]; - frameCount--; + buttonsPushed |= battleStatus->pushInputBuffer[bufferPos]; + bufferPos++; } buttonsAB = BUTTON_A | BUTTON_B; if ((buttonsPushed & buttonsAB) == buttonsAB) { - if (actionCommandStatus->targetWeakness != 0) { - s32 fillLevel; + if (acs->statusChance != 0) { + s32 amt; - fillLevel = actionCommandStatus->targetWeakness * 780; - fillLevel = fillLevel / 100 * battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; + amt = SCALE_BY_PCT(METER_FILL_TICK, acs->statusChance); + amt = SCALE_BY_PCT(amt, battleStatus->actionCmdDifficultyTable[acs->difficulty]); // Perplexing reuse of buttonsPushed here, but it fixes register allocation. Likely another // subexpression from above can be put into a variable and reused instead. // // TODO: Find a way to avoid reusing buttonsPushed. - buttonsPushed = fillLevel / 100; + buttonsPushed = amt; - actionCommandStatus->barFillLevel += buttonsPushed; + acs->meterFillLevel += buttonsPushed; } else { - actionCommandStatus->barFillLevel += 100; + acs->meterFillLevel += ONE_PCT_MASH; - if (actionCommandStatus->barFillLevel >= 500) { - actionCommandStatus->barFillLevel = 500; + if (acs->meterFillLevel >= 5 * ONE_PCT_MASH) { + acs->meterFillLevel = 5 * ONE_PCT_MASH; } } + // step back two frames in the input buffer bufferPos = battleStatus->inputBufferPos; bufferPos -= 2; if (bufferPos < 0) { bufferPos += ARRAY_COUNT(battleStatus->pushInputBuffer); } - frameCount = 1; - while (frameCount >= 0) { + // clear buffer to be ready for the next input + for (i = 1; i >= 0; i--) { if (bufferPos >= ARRAY_COUNT(battleStatus->pushInputBuffer)) { bufferPos -= ARRAY_COUNT(battleStatus->pushInputBuffer); } - - battleStatus->pushInputBuffer[bufferPos++] = 0; - frameCount--; + battleStatus->pushInputBuffer[bufferPos] = 0; + bufferPos++; } } - if (actionCommandStatus->barFillLevel > 10000) { - hudElement = actionCommandStatus->hudElements[4]; - actionCommandStatus->barFillLevel = 10000; - actionCommandStatus->isBarFilled = TRUE; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX + 50, - actionCommandStatus->hudPosY + 28); - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + if (acs->meterFillLevel > MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + acs->isMeterFilled = TRUE; + hid = acs->hudElemIDs[HIDX_100_PCT]; + hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY + 28); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - adjustedFillLevel = actionCommandStatus->barFillLevel / 100; - - battleStatus->actionQuality = adjustedFillLevel; - sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_BAR, 0, 0, adjustedFillLevel * 12); - - if (actionCommandStatus->frameCounter == 0) { - s16 threshold; + battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH; + sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_METER, 0, 0, battleStatus->actionProgress * 12); - // Again, reusing buttonsPushed specifically for reg-alloc. See above. - // - // TODO: Find a way to avoid reusing buttonsPushed. - buttonsPushed = actionCommandStatus->barFillLevel; - if (actionCommandStatus->targetWeakness == 0) { - buttonsPushed = 0; - } - - if (buttonsPushed == 0) { - battleStatus->actionSuccess = -1; - } else { - battleStatus->actionSuccess = buttonsPushed / 100; - } - - mashMeterIndex = actionCommandStatus->mashMeterIntervals - 1; - mashMeterCutoff = actionCommandStatus->mashMeterCutoffs[mashMeterIndex]; - threshold = mashMeterCutoff / 2; + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; + } - if (battleStatus->actionQuality <= threshold) { - battleStatus->actionResult = ACTION_RESULT_MINUS_4; - } else { - battleStatus->actionResult = ACTION_RESULT_SUCCESS; - } + // Again, reusing buttonsPushed specifically for reg-alloc. See above. + // + // TODO: Find a way to avoid reusing buttonsPushed. + buttonsPushed = acs->meterFillLevel; + if (acs->statusChance == 0) { + buttonsPushed = 0; + } - if (battleStatus->actionSuccess == 100) { - func_80269160(); - } + if (buttonsPushed == 0) { + battleStatus->actionQuality = AC_QUALITY_FAILED; + } else { + battleStatus->actionQuality = buttonsPushed / ONE_PCT_MASH; + } - sfx_stop_sound(SOUND_LOOP_CHARGE_BAR); - btl_set_popup_duration(0); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; + // a good result is filling the meter over halfway to the second-highest interval + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals - 1]; + if (battleStatus->actionProgress <= cutoff / 2) { + battleStatus->actionResult = ACTION_RESULT_METER_BELOW_HALF; } else { - actionCommandStatus->frameCounter -= 1; + battleStatus->actionResult = ACTION_RESULT_SUCCESS; } + + if (battleStatus->actionQuality == 100) { + // only count 100% fill as success for this action command + increment_action_command_success_count(); + } + + sfx_stop_sound(SOUND_LOOP_CHARGE_METER); + btl_set_popup_duration(POPUP_MSG_OFF); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->targetWeakness == 0) { - actionCommandStatus->barFillLevel -= 100; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + case AC_STATE_DISPOSE: + if (acs->statusChance == 0) { + acs->meterFillLevel -= ONE_PCT_MASH; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter -= 1; - } else { - action_command_free(); + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } + action_command_free(); break; } } void N(draw)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - - s32 hudElement; - s32 hudElementX; - s32 hudElementY; + ActionCommandStatus* acs = &gActionCommandStatus; + s32 hudX, hudY; + HudElemID hid; - hud_element_draw_clipped(actionCommandStatus->hudElements[0]); - hud_element_draw_clipped(actionCommandStatus->hudElements[2]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_A_BUTTON]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_B_BUTTON]); - hudElement = actionCommandStatus->hudElements[1]; - hud_element_draw_clipped(hudElement); - hud_element_get_render_pos(hudElement, &hudElementX, &hudElementY); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_draw_clipped(hid); + hud_element_get_render_pos(hid, &hudX, &hudY); - if (!actionCommandStatus->isBarFilled) { - draw_mash_meter_multicolor(hudElementX, hudElementY, actionCommandStatus->barFillLevel / 100); + if (!acs->isMeterFilled) { + draw_mash_meter_multicolor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH); } else { - draw_mash_meter_blink(hudElementX, hudElementY, actionCommandStatus->barFillLevel / 100); + draw_mash_meter_blink(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH); } - hud_element_draw_clipped(actionCommandStatus->hudElements[4]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_100_PCT]); } void N(free)(void) { - hud_element_free(gActionCommandStatus.hudElements[0]); - hud_element_free(gActionCommandStatus.hudElements[1]); - hud_element_free(gActionCommandStatus.hudElements[2]); - hud_element_free(gActionCommandStatus.hudElements[4]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_A_BUTTON]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_METER]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_B_BUTTON]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_100_PCT]); } diff --git a/src/battle/action_cmd/mega_shock.h b/src/battle/action_cmd/mega_shock.h index 77ebb16578e..29e9422f027 100644 --- a/src/battle/action_cmd/mega_shock.h +++ b/src/battle/action_cmd/mega_shock.h @@ -3,8 +3,12 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_mega_shock_init); + +// args: prep time, duration, difficulty, chance API_CALLABLE(action_command_mega_shock_start); + void action_command_mega_shock_update(void); void action_command_mega_shock_draw(void); void action_command_mega_shock_free(void); diff --git a/src/battle/action_cmd/power_shock.c b/src/battle/action_cmd/power_shock.c index 92239692540..346513eb09a 100644 --- a/src/battle/action_cmd/power_shock.c +++ b/src/battle/action_cmd/power_shock.c @@ -1,258 +1,279 @@ #include "common.h" #include "battle/action_cmd.h" +/** + * The player must mash A to fill up a meter. + * + * After a fixed period of time, the fill amount is compared to a "random" threshold + * value to determine success. This "random" value is selected using a mechanic similar + * to the flee command -- a random initial value is chosen which begins increasing and + * decreasing, bounded by the limits of the meter, at a fixed rate until the command + * is done. However, since the "speed" of the moving value and the duration are both + * fixed, this is effectively just choosing a random threhsold value. + */ + #define NAMESPACE action_command_power_shock -s32 D_802A9AA0_42D9B0[] = { 0, 25, 50, 75, 75, 0, 0, 0}; +extern s32 actionCmdTablePowerShock[]; + +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_BUTTON = 0, + HIDX_METER = 1, + HIDX_RUN_AWAY = 2, // unused + HIDX_100_PCT = 3, + HIDX_OK = 4, +}; -BSS s32 D_802A9B00; +// how much to add to the meter per input +#define METER_FILL_TICK 850 -extern s32 actionCmdTablePowerShock[]; +s32 N(DrainRateTable)[] = { 0, 25, 50, 75, 75 }; + +#define GET_DRAIN_RATE(pct) (N(DrainRateTable)[((pct) / (ONE_PCT_MASH / 5))]) + +BSS s32 N(HasStarted); API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; - s32 temp_v1; + HudElemID hid; + s32 offsetX; - battleStatus->unk_82 = 100; + battleStatus->maxActionQuality = 100; battleStatus->actionCmdDifficultyTable = actionCmdTablePowerShock; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_POWER_SHOCK; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->thresholdLevel = rand_int(100); - actionCommandStatus->hudPrepareTime = 30; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->isBarFilled = FALSE; - actionCommandStatus->thresholdMoveDir = 0; - D_802A9B00 = FALSE; - actionCommandStatus->hudPosY = 80; - - id = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - - id = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_100pct); - actionCommandStatus->hudElements[3] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_RunAwayOK); - actionCommandStatus->hudElements[4] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - temp_v1 = (100 - actionCommandStatus->thresholdLevel) * 60; - temp_v1 /= 100; - temp_v1 = 29 - temp_v1; - hud_element_set_render_pos(actionCommandStatus->hudElements[3], actionCommandStatus->hudPosX - temp_v1, actionCommandStatus->hudPosY + 17); + acs->actionCommandID = ACTION_COMMAND_POWER_SHOCK; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + acs->escapeThreshold = rand_int(100); + acs->hudPrepareTime = 30; + acs->isMeterFilled = FALSE; + acs->thresholdMoveDir = 0; + N(HasStarted) = FALSE; + + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_BUTTON] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_100pct); + acs->hudElemIDs[HIDX_100_PCT] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_RunAwayOK); + acs->hudElemIDs[HIDX_OK] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + offsetX = 29 - ((100 - acs->escapeThreshold) * 60) / 100; + hud_element_set_render_pos(acs->hudElemIDs[HIDX_100_PCT], acs->hudPosX - offsetX, acs->hudPosY + 17); return ApiStatus_DONE2; } API_CALLABLE(N(start)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Bytecode* args = script->ptrReadPos; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->prepareTime = evt_get_variable(script, *args++); - actionCommandStatus->duration = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = adjust_action_command_difficulty(actionCommandStatus->difficulty); - actionCommandStatus->targetWeakness = evt_get_variable(script, *args++); - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - battleStatus->actionSuccess = 0; + + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + acs->statusChance = evt_get_variable(script, *args++); // chance for enemy to be affected + + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; battleStatus->actionResult = ACTION_RESULT_FAIL; - actionCommandStatus->state = 10; + acs->state = AC_STATE_START; battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; - func_80269118(); + + increment_action_command_attempt_count(); + return ApiStatus_DONE2; } void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; - s32 phi_a1; + HudElemID hid; + s32 amt; s32 cutoff; - s32 new_var; - - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); - id = actionCommandStatus->hudElements[0]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + s32 offsetX; + + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); + hid = acs->hudElemIDs[HIDX_BUTTON]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_set_alpha(id, 255); - id = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_alpha(hid, 255); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - id = actionCommandStatus->hudElements[4]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[HIDX_OK]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); - if (actionCommandStatus->hudPrepareTime != 0) { - actionCommandStatus->hudPrepareTime--; + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->hudPrepareTime != 0) { + acs->hudPrepareTime--; } else { - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos( - actionCommandStatus->hudElements[0], - actionCommandStatus->hudPosX, - actionCommandStatus->hudPosY); - hud_element_set_render_pos( - actionCommandStatus->hudElements[1], - actionCommandStatus->hudPosX, - actionCommandStatus->hudPosY + 28); - - phi_a1 = 100 - actionCommandStatus->thresholdLevel; - new_var = 29 - (phi_a1 * 60) / 100; - hud_element_set_render_pos( - actionCommandStatus->hudElements[4], - actionCommandStatus->hudPosX - new_var, - actionCommandStatus->hudPosY + 17); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUTTON], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); + + amt = 100 - acs->escapeThreshold; + offsetX = 29 - (amt * 60) / 100; + hud_element_set_render_pos(acs->hudElemIDs[HIDX_OK], acs->hudPosX - offsetX, acs->hudPosY + 17); } break; - case 10: - btl_set_popup_duration(99); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->prepareTime != 0) { + acs->prepareTime--; break; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton); - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->unk_5C = 0; - D_802A9B00 = TRUE; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - sfx_play_sound_with_params(SOUND_LOOP_CHARGE_BAR, 0, 0, 0); - actionCommandStatus->state = 11; + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_MashAButton); + acs->meterFillLevel = 0; + acs->any.unk_5C = 0; + N(HasStarted) = TRUE; + acs->stateTimer = acs->duration; + sfx_play_sound_with_params(SOUND_LOOP_CHARGE_METER, 0, 0, 0); + acs->state = AC_STATE_ACTIVE; + // fallthrough - case 11: - btl_set_popup_duration(99); - - if (!actionCommandStatus->isBarFilled) { - if (actionCommandStatus->targetWeakness != 0) { - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals]; - actionCommandStatus->barFillLevel -= D_802A9AA0_42D9B0[actionCommandStatus->barFillLevel / cutoff / 20]; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // meter can drain if it hasn't been fully filled + if (!acs->isMeterFilled) { + if (acs->statusChance != 0) { + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals]; + acs->meterFillLevel -= GET_DRAIN_RATE(acs->meterFillLevel / cutoff); + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } else { - actionCommandStatus->barFillLevel -= 10; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + acs->meterFillLevel -= 10; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } } + // check for meter-filling input if (battleStatus->curButtonsPressed & BUTTON_A) { - phi_a1 = actionCommandStatus->targetWeakness; - if (phi_a1 != 0) { - s32 a = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; + if (acs->statusChance != 0) { + s32 difficultyPct = battleStatus->actionCmdDifficultyTable[acs->difficulty]; + amt = SCALE_BY_PCT(SCALE_BY_PCT(METER_FILL_TICK, difficultyPct), acs->statusChance); - phi_a1 = (((a * 850) / 100) * phi_a1) / 100; - actionCommandStatus->barFillLevel += phi_a1; + acs->meterFillLevel += amt; } else { - actionCommandStatus->barFillLevel += 100; - if (actionCommandStatus->barFillLevel >= 500) { - actionCommandStatus->barFillLevel = 500; + acs->meterFillLevel += ONE_PCT_MASH; + if (acs->meterFillLevel >= 5 * ONE_PCT_MASH) { + acs->meterFillLevel = 5 * ONE_PCT_MASH; } } } - if (actionCommandStatus->barFillLevel > 10000) { - actionCommandStatus->barFillLevel = 10000; - actionCommandStatus->isBarFilled = TRUE; - id = actionCommandStatus->hudElements[3]; - hud_element_set_render_pos( - id, - actionCommandStatus->hudPosX + 50, - actionCommandStatus->hudPosY + 28); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + // handle meter reaching 100% + if (acs->meterFillLevel > MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + acs->isMeterFilled = TRUE; + hid = acs->hudElemIDs[HIDX_100_PCT]; + hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY + 28); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100; - sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_BAR, 0, 0, battleStatus->actionQuality * 12); + battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH; + sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_METER, 0, 0, battleStatus->actionProgress * 12); - if (actionCommandStatus->frameCounter == 0) { - phi_a1 = actionCommandStatus->barFillLevel; - if (actionCommandStatus->targetWeakness == 0) { - phi_a1 = 0; - } - - battleStatus->actionQuality = phi_a1 / 100; - if (phi_a1 == 0) { - battleStatus->actionSuccess = -1; - } else if (battleStatus->actionQuality >= actionCommandStatus->thresholdLevel) { - battleStatus->actionSuccess = 1; - } else { - battleStatus->actionSuccess = 0; - } + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; + } - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1]; - if (cutoff / 2 < battleStatus->actionQuality) { - battleStatus->actionResult = ACTION_RESULT_SUCCESS; - } else { - battleStatus->actionResult = ACTION_RESULT_MINUS_4; - } + amt = acs->meterFillLevel; + if (acs->statusChance == 0) { + amt = 0; + } - if (battleStatus->actionSuccess == 1) { - func_80269160(); - } + battleStatus->actionProgress = amt / ONE_PCT_MASH; + if (amt == 0) { + battleStatus->actionQuality = AC_QUALITY_FAILED; + } else if (battleStatus->actionProgress >= acs->escapeThreshold) { + battleStatus->actionQuality = 1; + } else { + battleStatus->actionQuality = 0; + } - sfx_stop_sound(SOUND_LOOP_CHARGE_BAR); - btl_set_popup_duration(0); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; + // a good result is filling the meter over halfway to the second-highest interval + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals - 1]; + if (battleStatus->actionProgress <= cutoff / 2) { + battleStatus->actionResult = ACTION_RESULT_METER_BELOW_HALF; } else { - actionCommandStatus->frameCounter--; + battleStatus->actionResult = ACTION_RESULT_SUCCESS; + } + + if (battleStatus->actionQuality == 1) { + increment_action_command_success_count(); } + + sfx_stop_sound(SOUND_LOOP_CHARGE_METER); + btl_set_popup_duration(POPUP_MSG_OFF); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->targetWeakness == 0) { - actionCommandStatus->barFillLevel -= 100; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + case AC_STATE_DISPOSE: + if (acs->statusChance == 0) { + acs->meterFillLevel -= ONE_PCT_MASH; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; + if (acs->stateTimer != 0) { + acs->stateTimer--; break; } action_command_free(); @@ -261,60 +282,55 @@ void N(update)(void) { // Invisible "run away"-like meter that determines success threshold. // https://www.youtube.com/watch?v=FagUpV0c67s - switch (actionCommandStatus->state) { - case 1: - case 10: - case 11: - if (actionCommandStatus->thresholdMoveDir == 0) { - actionCommandStatus->thresholdLevel += 7; - if (actionCommandStatus->thresholdLevel >= 100) { - actionCommandStatus->thresholdLevel = 100; - actionCommandStatus->thresholdMoveDir = 1; + switch (acs->state) { + case AC_STATE_APPEAR: + case AC_STATE_START: + case AC_STATE_ACTIVE: + if (acs->thresholdMoveDir == 0) { + acs->escapeThreshold += 7; + if (acs->escapeThreshold >= 100) { + acs->escapeThreshold = 100; + acs->thresholdMoveDir = 1; } } else { - actionCommandStatus->thresholdLevel -= 7; - if (actionCommandStatus->thresholdLevel <= 0) { - actionCommandStatus->thresholdLevel = 0; - actionCommandStatus->thresholdMoveDir = 0; + acs->escapeThreshold -= 7; + if (acs->escapeThreshold <= 0) { + acs->escapeThreshold = 0; + acs->thresholdMoveDir = 0; } } } } void N(draw)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - s32 y; - s32 x; - s32 id; - s32 temp_a1; - s32 temp_v0; - - temp_v0 = actionCommandStatus->thresholdLevel * 60; - x = 60 - temp_v0 / 100; - temp_a1 = x - 31; - hud_element_set_render_pos(actionCommandStatus->hudElements[4], actionCommandStatus->hudPosX - temp_a1, actionCommandStatus->hudPosY + 17); - hud_element_draw_clipped(actionCommandStatus->hudElements[0]); - - id = actionCommandStatus->hudElements[1]; - hud_element_draw_clipped(id); - hud_element_get_render_pos(id, &x, &y); + ActionCommandStatus* acs = &gActionCommandStatus; + s32 hudX, hudY; + HudElemID hid; + + hudX = 60 - (acs->escapeThreshold * 60 / 100); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_OK], acs->hudPosX + 31 - hudX, acs->hudPosY + 17); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_BUTTON]); + + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_draw_clipped(hid); + hud_element_get_render_pos(hid, &hudX, &hudY); // Redundant call, but needed to match. - hud_element_get_render_pos(id, &x, &y); + hud_element_get_render_pos(hid, &hudX, &hudY); - if (!D_802A9B00) { - draw_mash_meter_multicolor_with_divisor(x, y, actionCommandStatus->barFillLevel / 100, 1); - } else if (!actionCommandStatus->isBarFilled) { - draw_mash_meter_multicolor_with_divisor(x, y, actionCommandStatus->barFillLevel / 100, 4); + if (!N(HasStarted)) { + draw_mash_meter_multicolor_with_divisor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH, 1); + } else if (!acs->isMeterFilled) { + draw_mash_meter_multicolor_with_divisor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH, 4); } else { - draw_mash_meter_blink_with_divisor(x, y, actionCommandStatus->barFillLevel / 100, 4); + draw_mash_meter_blink_with_divisor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH, 4); } - id = actionCommandStatus->hudElements[3]; - hud_element_draw_clipped(id); + hid = acs->hudElemIDs[HIDX_100_PCT]; + hud_element_draw_clipped(hid); } void N(free)(void) { - hud_element_free(gActionCommandStatus.hudElements[0]); - hud_element_free(gActionCommandStatus.hudElements[1]); - hud_element_free(gActionCommandStatus.hudElements[3]); - hud_element_free(gActionCommandStatus.hudElements[4]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_BUTTON]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_METER]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_100_PCT]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_OK]); } diff --git a/src/battle/action_cmd/power_shock.h b/src/battle/action_cmd/power_shock.h index d9dba62e6c6..a6cf63be62e 100644 --- a/src/battle/action_cmd/power_shock.h +++ b/src/battle/action_cmd/power_shock.h @@ -3,8 +3,12 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_power_shock_init); + +// args: prep time, duration, difficulty, chance API_CALLABLE(action_command_power_shock_start); + void action_command_power_shock_update(void); void action_command_power_shock_draw(void); void action_command_power_shock_free(void); diff --git a/src/battle/action_cmd/smack.c b/src/battle/action_cmd/smack.c index 2030fc7125e..b9af4e26db9 100644 --- a/src/battle/action_cmd/smack.c +++ b/src/battle/action_cmd/smack.c @@ -3,275 +3,293 @@ #define NAMESPACE action_command_smack -typedef struct UnkVec2s { - /* 0x00 */ s16 unk_0; - /* 0x02 */ s16 unk_2; -} UnkVec2s; - -UnkVec2s D_802A99D2_42ED72[] = { - { 0x00, 0x00 }, - { 0x00, 0x19 }, - { 0x00, 0x32 }, - { 0x00, 0x4B }, - { 0x00, 0x4B }, -}; +extern s32 actionCmdTableSmack[]; -s32 D_802A99E4_42ED84[] = { - 0x28, 0x46, 0x63, 0xC8, +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_STICK = 0, + HIDX_METER = 1, + HIDX_100_PCT = 2, }; -s32 D_802A99F4_42ED94[] = { - 0x23, 0x3C, 0x50, 0x63, 0xC8, -}; +// how much to add to the meter per input +#define HAND_METER_FILL_TICK 1300 +#define FAN_METER_FILL_TICK 850 +#define FAIL_METER_FILL_TICK 1100 -s32 D_802A9A08_42EDA8[] = { - 0x23, 0x23, 0x3C, 0x50, 0x63, 0xC8, -}; +s32 N(DrainRateTable)[] = { 0, 25, 50, 75, 75 }; -s32 D_802A9A20_42EDC0[] = { - 0x23, 0x3C, 0x50, 0x63, 0xC8, 0x00, -}; +#define GET_DRAIN_RATE(pct) PCT_TO_TABLE_RATE(N(DrainRateTable), pct) -extern s32 actionCmdTableSmack[]; +// threshold meter values for additional hits +// these correspond to values provided via SetupMashMeter +s32 N(BasicHitThresholds)[] = { 40, 70, 99, 200 }; +s32 N(SuperHitThresholds)[] = { 35, 60, 80, 99, 200 }; +s32 N(UltraHitThresholds)[] = { 35, 35, 60, 80, 99, 200 }; +s32 N(FanHitThresholds)[] = { 35, 60, 80, 99, 200 }; API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 hudElement; + HudElemID hid; - battleStatus->unk_82 = 100; + battleStatus->maxActionQuality = 100; battleStatus->actionCmdDifficultyTable = actionCmdTableSmack; battleStatus->actionResult = ACTION_RESULT_NONE; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_SMACK; - actionCommandStatus->showHud = TRUE; - actionCommandStatus->hudPrepareTime = 30; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->isBarFilled = FALSE; - battleStatus->actionSuccess = 0; + acs->actionCommandID = ACTION_COMMAND_SMACK; + acs->showHud = TRUE; + acs->hudPrepareTime = 30; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + acs->isMeterFilled = FALSE; battleStatus->actionQuality = 0; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->hudPosY = 80; - - hudElement = hud_element_create(&HES_StickNeutral); - actionCommandStatus->hudElements[0] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElement = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElement = hud_element_create(&HES_100pct); - actionCommandStatus->hudElements[2] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + battleStatus->actionProgress = 0; + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_StickNeutral); + acs->hudElemIDs[HIDX_STICK] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_100pct); + acs->hudElemIDs[HIDX_100_PCT] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); return ApiStatus_DONE2; } -#include "common/MashActionCommandStart.inc.c" +API_CALLABLE(N(start)) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + Bytecode* args = script->ptrReadPos; + + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; + return ApiStatus_DONE2; + } + + action_command_init_status(); + + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + acs->variation = evt_get_variable(script, *args++); + + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; + battleStatus->actionResult = ACTION_RESULT_NONE; + battleStatus->maxActionQuality = acs->mashMeterCutoffs[(acs->mashMeterNumIntervals - 1)]; + battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; + acs->state = AC_STATE_START; + + increment_action_command_attempt_count(); + + return ApiStatus_DONE2; +} void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Actor* partnerActor = battleStatus->partnerActor; - - s32 mashMeterCutoff; - s32 hudElement; - - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); - hudElement = actionCommandStatus->hudElements[0]; - hud_element_set_alpha(hudElement, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + HudElemID hid; + s32 cutoff; + s32 idx; + + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); + hid = acs->hudElemIDs[HIDX_STICK]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hudElement = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(hudElement, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); - if (actionCommandStatus->hudPrepareTime != 0) { - actionCommandStatus->hudPrepareTime--; + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->hudPrepareTime != 0) { + acs->hudPrepareTime--; break; } - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, - actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, - actionCommandStatus->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_STICK], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); break; - case 10: - btl_set_popup_duration(99); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->prepareTime != 0) { + acs->prepareTime--; break; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_StickMashLeft); - actionCommandStatus->barFillLevel = 0; - battleStatus->unk_85 = 0; - actionCommandStatus->unk_5C = 0; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - sfx_play_sound_with_params(SOUND_LOOP_CHARGE_BAR, 0, 0, 0); - actionCommandStatus->state = 11; + hud_element_set_script(acs->hudElemIDs[HIDX_STICK], &HES_StickMashLeft); + acs->meterFillLevel = 0; + battleStatus->resultTier = 0; + acs->smack.holdingLeft = FALSE; + acs->stateTimer = acs->duration; + sfx_play_sound_with_params(SOUND_LOOP_CHARGE_METER, 0, 0, 0); + acs->state = AC_STATE_ACTIVE; // fallthrough - case 11: - btl_set_popup_duration(99); - if (!actionCommandStatus->isBarFilled) { - s32 index; - mashMeterCutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals]; - actionCommandStatus->barFillLevel -= - D_802A99D2_42ED72[actionCommandStatus->barFillLevel / mashMeterCutoff / 20].unk_2; - - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // meter can drain if it hasn't been fully filled + if (!acs->isMeterFilled) { + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals]; + acs->meterFillLevel -= GET_DRAIN_RATE(acs->meterFillLevel / cutoff); + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } + } - if (!actionCommandStatus->isBarFilled) { - if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { - actionCommandStatus->unk_5C = TRUE; - } + // check for meter-filling input + if (!acs->isMeterFilled) { + if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { + acs->smack.holdingLeft = TRUE; + } - if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && actionCommandStatus->unk_5C) { - if (actionCommandStatus->targetWeakness == 0) { - actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 13; + if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT)) { + if (acs->smack.holdingLeft) { + if (acs->variation == ACV_SMACK_HAND) { + // regular smack + acs->meterFillLevel += SCALE_BY_PCT(HAND_METER_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]); } else { - actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 850 / 100; + // fan smack + acs->meterFillLevel += SCALE_BY_PCT(FAN_METER_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]); } - - actionCommandStatus->unk_5C = 0; - } - - if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { - actionCommandStatus->barFillLevel -= battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 11; + acs->smack.holdingLeft = FALSE; } } + // right stick inputs actively drain the meter + if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { + acs->meterFillLevel -= SCALE_BY_PCT(FAIL_METER_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]); + } } - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } - if (actionCommandStatus->barFillLevel > 10000) { - hudElement = actionCommandStatus->hudElements[2]; - actionCommandStatus->barFillLevel = 10000; - actionCommandStatus->isBarFilled = TRUE; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX + 50, - actionCommandStatus->hudPosY + 28); - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + // handle meter reaching 100% + if (acs->meterFillLevel > MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + acs->isMeterFilled = TRUE; + hid = acs->hudElemIDs[HIDX_100_PCT]; + hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY + 28); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100; - sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_BAR, 0, 0, battleStatus->actionQuality * 12); + battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH; + sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_METER, 0, 0, battleStatus->actionProgress * 12); switch (partnerActor->actorBlueprint->level) { - case 0: - if (battleStatus->actionQuality >= D_802A99E4_42ED84[battleStatus->unk_85]) { - battleStatus->unk_85++; + case PARTNER_RANK_NORMAL: + if (battleStatus->actionProgress >= N(BasicHitThresholds)[battleStatus->resultTier]) { + battleStatus->resultTier++; } - if (battleStatus->unk_85 > 0) { - s32 index = battleStatus->unk_85 - 1; - if (battleStatus->actionQuality < D_802A99E4_42ED84[index]) { - battleStatus->unk_85--; + if (battleStatus->resultTier > 0) { + if (battleStatus->actionProgress < N(BasicHitThresholds)[battleStatus->resultTier - 1]) { + battleStatus->resultTier--; } } break; - case 1: - if (battleStatus->actionQuality >= D_802A99F4_42ED94[battleStatus->unk_85]) { - battleStatus->unk_85++; + case PARTNER_RANK_SUPER: + if (battleStatus->actionProgress >= N(SuperHitThresholds)[battleStatus->resultTier]) { + battleStatus->resultTier++; } - if (battleStatus->unk_85 > 0) { - s32 index = battleStatus->unk_85 - 1; - if (battleStatus->actionQuality < D_802A99F4_42ED94[index]) { - battleStatus->unk_85--; + if (battleStatus->resultTier > 0) { + if (battleStatus->actionProgress < N(SuperHitThresholds)[battleStatus->resultTier - 1]) { + battleStatus->resultTier--; } } break; - case 2: - if (actionCommandStatus->targetWeakness == 0) { - if (battleStatus->actionQuality >= D_802A9A08_42EDA8[battleStatus->unk_85]) { - battleStatus->unk_85++; + case PARTNER_RANK_ULTRA: + if (acs->variation == ACV_SMACK_HAND) { + if (battleStatus->actionProgress >= N(UltraHitThresholds)[battleStatus->resultTier]) { + battleStatus->resultTier++; } - if (battleStatus->unk_85 > 0) { - s32 index = battleStatus->unk_85 - 1; - if (battleStatus->actionQuality < D_802A9A08_42EDA8[index]) { - battleStatus->unk_85--; + if (battleStatus->resultTier > 0) { + if (battleStatus->actionProgress < N(UltraHitThresholds)[battleStatus->resultTier - 1]) { + battleStatus->resultTier--; } } } else { - if (battleStatus->actionQuality >= D_802A9A20_42EDC0[battleStatus->unk_85]) { - battleStatus->unk_85++; + if (battleStatus->actionProgress >= N(FanHitThresholds)[battleStatus->resultTier]) { + battleStatus->resultTier++; } - if (battleStatus->unk_85 > 0) { - s32 index = battleStatus->unk_85 - 1; - if (battleStatus->actionQuality < D_802A9A20_42EDC0[index]) { - battleStatus->unk_85--; + if (battleStatus->resultTier > 0) { + if (battleStatus->actionProgress < N(FanHitThresholds)[battleStatus->resultTier - 1]) { + battleStatus->resultTier--; } } } break; } - if (actionCommandStatus->frameCounter == 0) { - s32 mashMeterCutoff; - - if (actionCommandStatus->barFillLevel == 0) { - battleStatus->actionSuccess = -1; - } else { - mashMeterCutoff = actionCommandStatus->barFillLevel; - battleStatus->actionSuccess = mashMeterCutoff / 100; - } + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; + } - mashMeterCutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1]; - if (mashMeterCutoff < battleStatus->actionSuccess) { - battleStatus->actionResult = ACTION_RESULT_SUCCESS; - } else { - battleStatus->actionResult = ACTION_RESULT_MINUS_2; - } + if (acs->meterFillLevel == 0) { + battleStatus->actionQuality = AC_QUALITY_FAILED; + } else { + battleStatus->actionQuality = acs->meterFillLevel / ONE_PCT_MASH; + } - if (battleStatus->actionSuccess == 100) { - func_80269160(); - } + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals - 1]; + if (battleStatus->actionQuality > cutoff) { + battleStatus->actionResult = ACTION_RESULT_SUCCESS; + } else { + battleStatus->actionResult = ACTION_RESULT_METER_NOT_ENOUGH; + } - btl_set_popup_duration(0); - sfx_stop_sound(SOUND_LOOP_CHARGE_BAR); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; - break; + if (battleStatus->actionQuality == 100) { + increment_action_command_success_count(); } - actionCommandStatus->frameCounter--; + btl_set_popup_duration(POPUP_MSG_OFF); + sfx_stop_sound(SOUND_LOOP_CHARGE_METER); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; + case AC_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; break; } action_command_free(); @@ -279,6 +297,6 @@ void N(update)(void) { } } -#include "common/draw_hud_elements.inc.c" +#include "common/MashCommandDraw.inc.c" -#include "common/free_hud_elements.inc.c" +#include "common/MashCommandFree.inc.c" diff --git a/src/battle/action_cmd/smack.h b/src/battle/action_cmd/smack.h index bfa11f5eeea..745c5f48494 100644 --- a/src/battle/action_cmd/smack.h +++ b/src/battle/action_cmd/smack.h @@ -3,10 +3,20 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_smack_init); + +// args: prep time, duration, difficulty, variation API_CALLABLE(action_command_smack_start); + void action_command_smack_update(void); void action_command_smack_draw(void); void action_command_smack_free(void); +// variants for this action command +enum { + ACV_SMACK_HAND = 0, + ACV_SMACK_FAN = 1, +}; + #endif diff --git a/src/battle/action_cmd/spiny_surge.c b/src/battle/action_cmd/spiny_surge.c index e6a7d523cb8..528b3c4c7c3 100644 --- a/src/battle/action_cmd/spiny_surge.c +++ b/src/battle/action_cmd/spiny_surge.c @@ -3,236 +3,250 @@ #define NAMESPACE action_command_spiny_surge -s32 D_802A9860_42F680[8] = { 0, 25, 50, 75, 75, 0, 0, 0 }; +extern s32 actionCmdTableSpinySurge[]; -BSS s32 D_802A98C0; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_STICK = 0, + HIDX_METER = 1, + HIDX_100_PCT = 2, +}; -extern s32 actionCmdTableSpinySurge[]; +// how much to add to the meter per input +#define METER_FILL_TICK 1250 + +s32 N(DrainRateTable)[] = { 0, 25, 50, 75, 75 }; + +#define GET_DRAIN_RATE(pct) PCT_TO_TABLE_RATE(N(DrainRateTable), pct) + +BSS s32 PrevButtons; API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; - battleStatus->unk_82 = 16; + battleStatus->maxActionQuality = 16; battleStatus->actionCmdDifficultyTable = actionCmdTableSpinySurge; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_SPINY_SURGE; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->isBarFilled = FALSE; - battleStatus->actionSuccess = 0; + acs->actionCommandID = ACTION_COMMAND_SPINY_SURGE; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + acs->isMeterFilled = FALSE; + battleStatus->actionQuality = 0; battleStatus->actionResult = ACTION_RESULT_FAIL; - actionCommandStatus->hudPrepareTime = 30; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->hudPosY = 80; - - id = hud_element_create(&HES_StickNeutral); - actionCommandStatus->hudElements[0] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_100pct); - actionCommandStatus->hudElements[2] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + acs->hudPrepareTime = 30; + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_StickNeutral); + acs->hudElemIDs[HIDX_STICK] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_100pct); + acs->hudElemIDs[HIDX_100_PCT] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); return ApiStatus_DONE2; } API_CALLABLE(N(start)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Bytecode* args = script->ptrReadPos; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->prepareTime = evt_get_variable(script, *args++); - actionCommandStatus->duration = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = adjust_action_command_difficulty(actionCommandStatus->difficulty); + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - battleStatus->actionSuccess = 0; - actionCommandStatus->state = 10; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; + acs->state = AC_STATE_START; battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; - func_80269118(); + increment_action_command_attempt_count(); return ApiStatus_DONE2; } void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; s32 cutoff; - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); - id = actionCommandStatus->hudElements[0]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[HIDX_STICK]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - id = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); - if (actionCommandStatus->hudPrepareTime != 0) { - actionCommandStatus->hudPrepareTime--; + if (acs->hudPrepareTime != 0) { + acs->hudPrepareTime--; break; } - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, - actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, - actionCommandStatus->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_STICK], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); break; - case 10: - btl_set_popup_duration(99); + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + if (acs->prepareTime != 0) { + acs->prepareTime--; break; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_StickMashLeft); - actionCommandStatus->unk_5C = 0; - D_802A98C0 = 0; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - sfx_play_sound_with_params(SOUND_LOOP_CHARGE_BAR, 0, 0, 0); - actionCommandStatus->state = 11; + hud_element_set_script(acs->hudElemIDs[HIDX_STICK], &HES_StickMashLeft); + acs->spinySurge.tossState = SPINY_SURGE_NONE; + PrevButtons = 0; + acs->stateTimer = acs->duration; + sfx_play_sound_with_params(SOUND_LOOP_CHARGE_METER, 0, 0, 0); + acs->state = AC_STATE_ACTIVE; // fallthrough - case 11: - btl_set_popup_duration(99); - if (!actionCommandStatus->isBarFilled) { - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals]; - actionCommandStatus->barFillLevel -= - D_802A9860_42F680[actionCommandStatus->barFillLevel / cutoff / 20]; - - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // meter can drain if it hasn't been fully filled + if (!acs->isMeterFilled) { + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals]; + acs->meterFillLevel -= GET_DRAIN_RATE(acs->meterFillLevel / cutoff); + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } + } - if (!actionCommandStatus->isBarFilled) { - if (battleStatus->curButtonsPressed & BUTTON_STICK_LEFT) { - actionCommandStatus->barFillLevel += (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 1250) / 100; - } - if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { - actionCommandStatus->barFillLevel -= (battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 1250) / 100; - } + // check for meter-filling input + if (!acs->isMeterFilled) { + if (battleStatus->curButtonsPressed & BUTTON_STICK_LEFT) { + acs->meterFillLevel += SCALE_BY_PCT(METER_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]); + } + // right stick inputs actively drain the meter + if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { + acs->meterFillLevel -= SCALE_BY_PCT(METER_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]); } } - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } - if (actionCommandStatus->barFillLevel > 10000) { - id = actionCommandStatus->hudElements[2]; - actionCommandStatus->barFillLevel = 10000; - actionCommandStatus->isBarFilled = TRUE; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 50, actionCommandStatus->hudPosY + 28); - hud_element_clear_flags(id, 2); + // handle meter reaching 100% + if (acs->meterFillLevel > MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + acs->isMeterFilled = TRUE; + hid = acs->hudElemIDs[HIDX_100_PCT]; + hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY + 28); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - if (D_802A98C0 & BUTTON_STICK_LEFT) { - actionCommandStatus->unk_5C = 1; + // set signal value for the move script to play throwing animations + if (PrevButtons & BUTTON_STICK_LEFT) { + acs->spinySurge.tossState = SPINY_SURGE_HOLD; } - if (D_802A98C0 & BUTTON_STICK_RIGHT) { - actionCommandStatus->unk_5C = -1; + if (PrevButtons & BUTTON_STICK_RIGHT) { + acs->spinySurge.tossState = SPINY_SURGE_RESET; } - - if (!(D_802A98C0 & BUTTON_STICK_LEFT) && - !(battleStatus->curButtonsDown & BUTTON_STICK_RIGHT) && - actionCommandStatus->unk_5C == 1) - { - actionCommandStatus->unk_5C = 2; + if (!(PrevButtons & BUTTON_STICK_LEFT) + && !(battleStatus->curButtonsDown & BUTTON_STICK_RIGHT) + && acs->spinySurge.tossState == SPINY_SURGE_HOLD + ) { + acs->spinySurge.tossState = SPINY_SURGE_THROW; } - battleStatus->actionSuccess = actionCommandStatus->barFillLevel / 100; - D_802A98C0 = battleStatus->curButtonsDown; - battleStatus->actionQuality = actionCommandStatus->unk_5C; + battleStatus->actionQuality = acs->meterFillLevel / ONE_PCT_MASH; + PrevButtons = battleStatus->curButtonsDown; + battleStatus->actionProgress = acs->spinySurge.tossState; - sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_BAR, 0, 0, battleStatus->actionSuccess * 12); + sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_METER, 0, 0, battleStatus->actionQuality * 12); - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } - if (actionCommandStatus->barFillLevel == 0) { - battleStatus->actionSuccess = -1; + if (acs->meterFillLevel == 0) { + battleStatus->actionQuality = AC_QUALITY_FAILED; } else { - battleStatus->actionSuccess = actionCommandStatus->barFillLevel / 100; + battleStatus->actionQuality = acs->meterFillLevel / ONE_PCT_MASH; } - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1]; - if (cutoff >= battleStatus->actionSuccess) { - battleStatus->actionResult = ACTION_RESULT_MINUS_2; - } else { + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals - 1]; + if (battleStatus->actionQuality > cutoff) { battleStatus->actionResult = ACTION_RESULT_SUCCESS; + } else { + battleStatus->actionResult = ACTION_RESULT_METER_NOT_ENOUGH; } - if (battleStatus->actionSuccess == 100) { - func_80269160(); + if (battleStatus->actionQuality == 100) { + // only count 100% fill as success for this action command + increment_action_command_success_count(); } - btl_set_popup_duration(0); - sfx_stop_sound(SOUND_LOOP_CHARGE_BAR); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; + btl_set_popup_duration(POPUP_MSG_OFF); + sfx_stop_sound(SOUND_LOOP_CHARGE_METER); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - } else { - action_command_free(); + case AC_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } + action_command_free(); break; } } -#include "common/draw_hud_elements.inc.c" +#include "common/MashCommandDraw.inc.c" -#include "common/free_hud_elements.inc.c" +#include "common/MashCommandFree.inc.c" diff --git a/src/battle/action_cmd/spiny_surge.h b/src/battle/action_cmd/spiny_surge.h index 1ffa63ef608..c7d2b921a4d 100644 --- a/src/battle/action_cmd/spiny_surge.h +++ b/src/battle/action_cmd/spiny_surge.h @@ -3,10 +3,22 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_spiny_surge_init); + +// args: prep time, duration, difficulty API_CALLABLE(action_command_spiny_surge_start); + void action_command_spiny_surge_update(void); void action_command_spiny_surge_draw(void); void action_command_spiny_surge_free(void); +enum { + SPINY_SURGE_RESET = -1, + SPINY_SURGE_NONE = 0, + SPINY_SURGE_HOLD = 1, + SPINY_SURGE_THROW = 2, + SPINY_SURGE_IGNORE = 3, +}; + #endif diff --git a/src/battle/action_cmd/spook.c b/src/battle/action_cmd/spook.c index 3979b41971d..725c8490fd8 100644 --- a/src/battle/action_cmd/spook.c +++ b/src/battle/action_cmd/spook.c @@ -4,227 +4,278 @@ #define NAMESPACE action_command_spook -s32 D_802A9920_430940[8] = { 0, 25, 50, 75, 75, 0, 0, 0 }; - extern s32 actionCmdTableSpook[]; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_STICK = 0, + HIDX_METER = 1, + HIDX_100_PCT = 2, +}; + +// how much to add to the meter per input +#define METER_FILL_TICK 850 + +s32 N(DrainRateTable)[] = { 0, 25, 50, 75, 75 }; + +#define GET_DRAIN_RATE(pct) PCT_TO_TABLE_RATE(N(DrainRateTable), pct) + API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; - battleStatus->unk_82 = 100; + battleStatus->maxActionQuality = 100; battleStatus->actionCmdDifficultyTable = actionCmdTableSpook; battleStatus->actionResult = ACTION_RESULT_NONE; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_SPOOK; - actionCommandStatus->showHud = TRUE; - actionCommandStatus->hudPrepareTime = 30; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->isBarFilled = FALSE; - battleStatus->actionSuccess = 0; + acs->actionCommandID = ACTION_COMMAND_SPOOK; + acs->showHud = TRUE; + acs->hudPrepareTime = 30; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + acs->isMeterFilled = FALSE; battleStatus->actionQuality = 0; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->hudPosY = 80; - - id = hud_element_create(&HES_StickNeutral); - actionCommandStatus->hudElements[0] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_100pct); - actionCommandStatus->hudElements[2] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + battleStatus->actionProgress = 0; + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_StickNeutral); + acs->hudElemIDs[HIDX_STICK] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_100pct); + acs->hudElemIDs[HIDX_100_PCT] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + return ApiStatus_DONE2; +} + +API_CALLABLE(N(start)) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + Bytecode* args = script->ptrReadPos; + + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; + return ApiStatus_DONE2; + } + + action_command_init_status(); + + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + acs->statusChance = evt_get_variable(script, *args++); // average chance for enemies to be affected + + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; + battleStatus->actionResult = ACTION_RESULT_NONE; + battleStatus->maxActionQuality = acs->mashMeterCutoffs[(acs->mashMeterNumIntervals - 1)]; + battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; + acs->state = AC_STATE_START; + + increment_action_command_attempt_count(); return ApiStatus_DONE2; } -#include "common/MashActionCommandStart.inc.c" void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; s32 cutoff; s32 fillLevel; - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); - id = actionCommandStatus->hudElements[0]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_STICK]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - id = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_STICK], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); break; - case 10: - btl_set_popup_duration(99); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->prepareTime != 0) { + acs->prepareTime--; return; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_StickMashLeft); - actionCommandStatus->barFillLevel = 0; - battleStatus->actionQuality = 0; - actionCommandStatus->unk_5C = 0; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - sfx_play_sound_with_params(SOUND_LOOP_CHARGE_BAR, 0, 0, 0); - actionCommandStatus->state = 11; - case 11: - btl_set_popup_duration(99); - if (!actionCommandStatus->isBarFilled) { - if (actionCommandStatus->targetWeakness != 0) { - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals]; - - actionCommandStatus->barFillLevel -= D_802A9920_430940[actionCommandStatus->barFillLevel / cutoff / 20]; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + hud_element_set_script(acs->hudElemIDs[HIDX_STICK], &HES_StickMashLeft); + acs->meterFillLevel = 0; + battleStatus->actionProgress = 0; + acs->spook.holdingLeft = FALSE; + acs->stateTimer = acs->duration; + sfx_play_sound_with_params(SOUND_LOOP_CHARGE_METER, 0, 0, 0); + acs->state = AC_STATE_ACTIVE; + + // fallthrough + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // meter can drain if it hasn't been fully filled + if (!acs->isMeterFilled) { + if (acs->statusChance != 0) { + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals]; + acs->meterFillLevel -= GET_DRAIN_RATE(acs->meterFillLevel / cutoff); + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } else { - actionCommandStatus->barFillLevel -= 10; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + acs->meterFillLevel -= 10; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } + } - if (!actionCommandStatus->isBarFilled) { - if (actionCommandStatus->targetWeakness != 0) { - - if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { - actionCommandStatus->unk_5C = TRUE; - } - - if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && actionCommandStatus->unk_5C) { - s32 a = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; - s32 b = actionCommandStatus->targetWeakness * 850; + // check for meter-filling input + if (!acs->isMeterFilled) { + if (acs->statusChance != 0) { - actionCommandStatus->barFillLevel += (a * b) / 10000; - actionCommandStatus->unk_5C = 0; - } + if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { + acs->spook.holdingLeft = TRUE; + } - if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { - s32 a = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; - s32 b = actionCommandStatus->targetWeakness * 850; + if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && acs->spook.holdingLeft) { + s32 a = battleStatus->actionCmdDifficultyTable[acs->difficulty]; + s32 b = METER_FILL_TICK * acs->statusChance; + // divide by 100 for each percent-based multiplier + acs->meterFillLevel += (a * b) / (100 * 100); + acs->spook.holdingLeft = FALSE; + } - actionCommandStatus->barFillLevel -= (a * b) / 10000; - } - } else { - if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { - actionCommandStatus->unk_5C = TRUE; - } + if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { + s32 a = battleStatus->actionCmdDifficultyTable[acs->difficulty]; + s32 b = METER_FILL_TICK * acs->statusChance; + // divide by 100 for each percent-based multiplier + acs->meterFillLevel -= (a * b) / (100 * 100); + } + } else { + if (battleStatus->curButtonsDown & BUTTON_STICK_LEFT) { + acs->spook.holdingLeft = TRUE; + } - if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && actionCommandStatus->unk_5C) { - actionCommandStatus->barFillLevel += 100; - if (actionCommandStatus->barFillLevel >= 500) { - actionCommandStatus->barFillLevel = 500; - } - actionCommandStatus->unk_5C = 0; + if (!(battleStatus->curButtonsDown & BUTTON_STICK_LEFT) && acs->spook.holdingLeft) { + acs->meterFillLevel += ONE_PCT_MASH; + if (acs->meterFillLevel >= 5 * ONE_PCT_MASH) { + acs->meterFillLevel = 5 * ONE_PCT_MASH; } + acs->spook.holdingLeft = FALSE; + } - if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { - actionCommandStatus->barFillLevel -= 100; - } + if (battleStatus->curButtonsPressed & BUTTON_STICK_RIGHT) { + acs->meterFillLevel -= ONE_PCT_MASH; } } } - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } - if (actionCommandStatus->barFillLevel > 10000) { - id = actionCommandStatus->hudElements[2]; - actionCommandStatus->barFillLevel = 10000; - actionCommandStatus->isBarFilled = TRUE; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 50, actionCommandStatus->hudPosY + 28); - hud_element_clear_flags(id, 2); + + // handle meter reaching 100% + if (acs->meterFillLevel > MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + acs->isMeterFilled = TRUE; + hid = acs->hudElemIDs[HIDX_100_PCT]; + hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY + 28); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100; - sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_BAR, 0, 0, battleStatus->actionQuality * 12); + battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH; + sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_METER, 0, 0, battleStatus->actionProgress * 12); - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } - fillLevel = actionCommandStatus->barFillLevel; - if (actionCommandStatus->targetWeakness == 0) { + fillLevel = acs->meterFillLevel; + if (acs->statusChance == 0) { fillLevel = 0; } if (fillLevel == 0) { - battleStatus->actionSuccess = -1; + battleStatus->actionQuality = AC_QUALITY_FAILED; } else { - battleStatus->actionSuccess = fillLevel / 100; + battleStatus->actionQuality = fillLevel / ONE_PCT_MASH; } - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1]; - if (battleStatus->actionSuccess > cutoff) { + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals - 1]; + if (battleStatus->actionQuality > cutoff) { battleStatus->actionResult = ACTION_RESULT_SUCCESS; } else { - battleStatus->actionResult = ACTION_RESULT_MINUS_2; + battleStatus->actionResult = ACTION_RESULT_METER_NOT_ENOUGH; } - if (battleStatus->actionSuccess == 100) { - func_80269160(); + if (battleStatus->actionQuality == 100) { + // only count 100% fill as success for this action command + increment_action_command_success_count(); } - btl_set_popup_duration(0); - sfx_stop_sound(SOUND_LOOP_CHARGE_BAR); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; + + btl_set_popup_duration(POPUP_MSG_OFF); + sfx_stop_sound(SOUND_LOOP_CHARGE_METER); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->targetWeakness == 0) { - actionCommandStatus->barFillLevel -= 100; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + case AC_STATE_DISPOSE: + if (acs->statusChance == 0) { + acs->meterFillLevel -= ONE_PCT_MASH; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } action_command_free(); break; } } -#include "common/draw_hud_elements.inc.c" +#include "common/MashCommandDraw.inc.c" -#include "common/free_hud_elements.inc.c" +#include "common/MashCommandFree.inc.c" diff --git a/src/battle/action_cmd/spook.h b/src/battle/action_cmd/spook.h index 838f4cbc435..53c68cea2f0 100644 --- a/src/battle/action_cmd/spook.h +++ b/src/battle/action_cmd/spook.h @@ -3,8 +3,12 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_spook_init); + +// args: prep time, duration, difficulty, chance API_CALLABLE(action_command_spook_start); + void action_command_spook_update(void); void action_command_spook_draw(void); void action_command_spook_free(void); diff --git a/src/battle/action_cmd/squirt.c b/src/battle/action_cmd/squirt.c index 57f68f940e0..59af59bfbd2 100644 --- a/src/battle/action_cmd/squirt.c +++ b/src/battle/action_cmd/squirt.c @@ -3,221 +3,245 @@ #define NAMESPACE action_command_squirt -s32 D_802A9760_42A480[] = { 300, 300, 265, 220, 175, 175 }; -s32 D_802A9778_42A498[] = { 300, 300, 265, 220, 175, 175 }; - extern s32 actionCmdTableSquirt[]; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_BUTTON = 0, + HIDX_METER = 1, +}; + +// how much to subtract from the meter per frame after overfilling it +#define METER_DRAIN_RATE 250 + +s32 N(DrainRateTable)[] = { 300, 300, 265, 220, 175, 175 }; +s32 N(FillRateTable)[] = { 300, 300, 265, 220, 175, 175 }; + +// bug: the sixth entry is not accessible due to the way idx is calculated in these macros +#define GET_DRAIN_RATE(pct) (N(DrainRateTable)[((pct) / (ONE_PCT_MASH / 5))]) +#define GET_FILL_RATE(pct) (N(FillRateTable)[((pct) / (ONE_PCT_MASH / 5))]) + API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; - battleStatus->unk_82 = 5; + battleStatus->maxActionQuality = 5; battleStatus->actionCmdDifficultyTable = actionCmdTableSquirt; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_SQUIRT; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - battleStatus->actionQuality = 0; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->unk_5C = 0; - actionCommandStatus->hudPosY = 80; - - id = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - - id = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + acs->actionCommandID = ACTION_COMMAND_SQUIRT; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionProgress = 0; + acs->hudPosX = -48; + acs->squirt.draining = FALSE; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_BUTTON] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); return ApiStatus_DONE2; } API_CALLABLE(N(start)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Bytecode* args = script->ptrReadPos; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->prepareTime = evt_get_variable(script, *args++); - actionCommandStatus->duration = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = adjust_action_command_difficulty(actionCommandStatus->difficulty); - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - battleStatus->actionSuccess = 0; + + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; battleStatus->actionResult = ACTION_RESULT_FAIL; - actionCommandStatus->state = 10; + acs->state = AC_STATE_START; battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; - func_80269118(); + + increment_action_command_attempt_count(); + return ApiStatus_DONE2; } void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; - s32 mashMeterCutoff; + HudElemID hid; + s32 fillPct; s32 cutoff; - s32 temp; + s32 idx; - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); - id = actionCommandStatus->hudElements[0]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[HIDX_BUTTON]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_set_alpha(id, 255); + hud_element_set_alpha(hid, 255); - id = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, - actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, - actionCommandStatus->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUTTON], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); break; - case 10: - btl_set_popup_duration(99); + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + if (acs->prepareTime != 0) { + acs->prepareTime--; break; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_AButtonDown); - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->unk_5C = 0; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - sfx_play_sound_with_params(SOUND_LOOP_CHARGE_BAR, 0, 0, 0); - actionCommandStatus->state = 11; + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_AButtonDown); + acs->meterFillLevel = 0; + acs->squirt.draining = FALSE; + acs->stateTimer = acs->duration; + sfx_play_sound_with_params(SOUND_LOOP_CHARGE_METER, 0, 0, 0); + acs->state = AC_STATE_ACTIVE; + // fallthrough - case 11: - btl_set_popup_duration(99); - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals]; - temp = actionCommandStatus->barFillLevel / cutoff; - if (actionCommandStatus->unk_5C == 0) { + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // meter filling and draining + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals]; + fillPct = acs->meterFillLevel / cutoff; + if (!acs->squirt.draining) { if (!(battleStatus->curButtonsDown & BUTTON_A)) { - actionCommandStatus->barFillLevel -= D_802A9760_42A480[temp / 20]; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + acs->meterFillLevel -= GET_DRAIN_RATE(fillPct); + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } } else { - actionCommandStatus->barFillLevel += D_802A9778_42A498[temp / 20] * battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] / 100; - if (actionCommandStatus->barFillLevel > 10000) { - actionCommandStatus->barFillLevel = 10000; - actionCommandStatus->unk_5C = 1; + s32 amt = GET_FILL_RATE(fillPct); + acs->meterFillLevel += SCALE_BY_PCT(amt, battleStatus->actionCmdDifficultyTable[acs->difficulty]); + if (acs->meterFillLevel > MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + acs->squirt.draining = TRUE; } } } else { - actionCommandStatus->barFillLevel -= 250; - if (actionCommandStatus->barFillLevel <= 0) { - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->unk_5C = 0; + acs->meterFillLevel -= METER_DRAIN_RATE; + if (acs->meterFillLevel <= 0) { + acs->meterFillLevel = 0; + acs->squirt.draining = FALSE; } } - battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100; - sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_BAR, 0, 0, battleStatus->actionQuality * 12); - id = actionCommandStatus->hudElements[0]; - if (temp < 80) { - if (hud_element_get_script(id) != &HES_AButtonDown) { - hud_element_set_script(id, &HES_AButtonDown); + battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH; + sfx_adjust_env_sound_params(SOUND_LOOP_CHARGE_METER, 0, 0, battleStatus->actionProgress * 12); + + hid = acs->hudElemIDs[HIDX_BUTTON]; + if (fillPct < 80) { + if (hud_element_get_script(hid) != &HES_AButtonDown) { + hud_element_set_script(hid, &HES_AButtonDown); } } else { - if (hud_element_get_script(id) != &HES_PressAButton) { - hud_element_set_script(id, &HES_PressAButton); + if (hud_element_get_script(hid) != &HES_PressAButton) { + hud_element_set_script(hid, &HES_PressAButton); } } - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } - if (actionCommandStatus->barFillLevel == 0) { - battleStatus->actionSuccess = -1; + if (acs->meterFillLevel == 0) { + battleStatus->actionQuality = AC_QUALITY_FAILED; } else { - battleStatus->actionSuccess = battleStatus->actionQuality; + battleStatus->actionQuality = battleStatus->actionProgress; } - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals - 1]; - if (cutoff / 2 < battleStatus->actionQuality) { - battleStatus->actionResult = ACTION_RESULT_SUCCESS; + // a good result is filling the meter over halfway to the second-highest interval + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals - 1]; + if (battleStatus->actionProgress <= cutoff / 2) { + battleStatus->actionResult = ACTION_RESULT_METER_BELOW_HALF; } else { - battleStatus->actionResult = ACTION_RESULT_MINUS_4; + battleStatus->actionResult = ACTION_RESULT_SUCCESS; } - if (battleStatus->actionSuccess == 100) { - func_80269160(); + if (battleStatus->actionQuality == 100) { + // only count 100% fill as success for this action command + increment_action_command_success_count(); } - btl_set_popup_duration(0); - sfx_stop_sound(SOUND_LOOP_CHARGE_BAR); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; + + btl_set_popup_duration(POPUP_MSG_OFF); + sfx_stop_sound(SOUND_LOOP_CHARGE_METER); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - } else { - action_command_free(); + case AC_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; } + action_command_free(); break; } } void N(draw)(void) { - s32 x, y; - s32 id; - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - - hud_element_draw_clipped(actionCommandStatus->hudElements[0]); - id = actionCommandStatus->hudElements[1]; - hud_element_draw_clipped(id); - hud_element_get_render_pos(id, &x, &y); - if (actionCommandStatus->unk_5C == 0) { - draw_mash_meter_multicolor_with_divisor(x, y, actionCommandStatus->barFillLevel / 100, 1); + ActionCommandStatus* acs = &gActionCommandStatus; + s32 hudX, hudY; + HudElemID hid; + + hud_element_draw_clipped(acs->hudElemIDs[HIDX_BUTTON]); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_draw_clipped(hid); + hud_element_get_render_pos(hid, &hudX, &hudY); + if (!acs->squirt.draining) { + draw_mash_meter_multicolor_with_divisor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH, 1); } else { - draw_mash_meter_mode_with_divisor(x, y, actionCommandStatus->barFillLevel / 100, 1, MASH_METER_MODE_ONE_COLOR); + draw_mash_meter_mode_with_divisor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH, 1, MASH_METER_MODE_ONE_COLOR); } } void N(free)(void) { - sfx_stop_sound(SOUND_LOOP_CHARGE_BAR); - hud_element_free(gActionCommandStatus.hudElements[0]); - hud_element_free(gActionCommandStatus.hudElements[1]); + sfx_stop_sound(SOUND_LOOP_CHARGE_METER); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_BUTTON]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_METER]); } diff --git a/src/battle/action_cmd/squirt.h b/src/battle/action_cmd/squirt.h index 6b32649a656..5018425a87c 100644 --- a/src/battle/action_cmd/squirt.h +++ b/src/battle/action_cmd/squirt.h @@ -3,8 +3,12 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_squirt_init); + +// args: prep time, duration, difficulty API_CALLABLE(action_command_squirt_start); + void action_command_squirt_update(void); void action_command_squirt_draw(void); void action_command_squirt_free(void); diff --git a/src/battle/action_cmd/stop_leech.c b/src/battle/action_cmd/stop_leech.c index be19002bb41..45ad219851b 100644 --- a/src/battle/action_cmd/stop_leech.c +++ b/src/battle/action_cmd/stop_leech.c @@ -1,66 +1,83 @@ #include "common.h" #include "battle/action_cmd.h" +/** + * Differs from most mash commands by not having a fixed time limit and not having + * a rising sound effect as it fills. + */ + #define NAMESPACE action_command_stop_leech extern s32 actionCmdTableStopLeech[]; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_BUTTON = 0, + HIDX_METER = 1, +}; + +// how much to add to the meter per input if all modifiers are neutral +#define METER_FILL_TICK 100 + API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 hudElement; + HudElemID hid; - battleStatus->unk_82 = 5; + battleStatus->maxActionQuality = 5; battleStatus->actionCmdDifficultyTable = actionCmdTableStopLeech; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_STOP_LEECH; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->hudPosY = 80; - - hudElement = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = hudElement; - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(hudElement, 0); - - hudElement = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = hudElement; - hud_element_set_render_pos(hudElement, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(hudElement, 0); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + acs->actionCommandID = ACTION_COMMAND_STOP_LEECH; + acs->hudPosX = -48; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_BUTTON] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); return ApiStatus_DONE2; } API_CALLABLE(N(start)) { Bytecode* args = script->ptrReadPos; - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->prepareTime = evt_get_variable(script, *args++); - actionCommandStatus->duration = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = adjust_action_command_difficulty(actionCommandStatus->difficulty); - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - battleStatus->actionSuccess = 0; + + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; battleStatus->actionResult = ACTION_RESULT_FAIL; - actionCommandStatus->state = 10; + acs->state = AC_STATE_START; battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; return ApiStatus_DONE2; @@ -68,74 +85,78 @@ API_CALLABLE(N(start)) { void N(update)(void) { BattleStatus* battleStatus = &gBattleStatus; - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - s32 hudElement; - s16 hudElementX; - - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); - hudElement = actionCommandStatus->hudElements[0]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + ActionCommandStatus* acs = &gActionCommandStatus; + HudElemID hid; + + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); + hid = acs->hudElemIDs[HIDX_BUTTON]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_set_alpha(hudElement, 0xFF); - hudElement = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(hudElement, 0xFF); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_alpha(hid, 255); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); - hudElementX = actionCommandStatus->hudPosX + 20; - actionCommandStatus->hudPosX = hudElementX; - if (hudElementX > 50) { - actionCommandStatus->hudPosX = 50; + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + acs->hudPosX = acs->hudPosX + 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUTTON], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); break; - case 10: - btl_set_popup_duration(99); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime -= 1; + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->prepareTime != 0) { + acs->prepareTime--; break; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton); - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->state = 11; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - case 11: - btl_set_popup_duration(99); - if (!actionCommandStatus->berserkerEnabled) { + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_MashAButton); + acs->meterFillLevel = 0; + acs->state = AC_STATE_ACTIVE; + acs->stateTimer = acs->duration; + + // fallthrough + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // check for meter-filling input + if (!acs->berserkerEnabled) { if (battleStatus->curButtonsPressed & BUTTON_A) { - actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]; + acs->meterFillLevel += SCALE_BY_PCT(METER_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]); } } else { - actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] / 6; - actionCommandStatus->barFillLevel += rand_int((battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty]) / 6); + acs->meterFillLevel += SCALE_BY_PCT(METER_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]) / 6; + acs->meterFillLevel += rand_int(SCALE_BY_PCT(METER_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]) / 6); } - battleStatus->actionQuality = actionCommandStatus->barFillLevel / 100; - if (actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals] <= battleStatus->actionQuality) { - actionCommandStatus->frameCounter = 0; + battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH; + + // handle filling the meter + if (acs->mashMeterCutoffs[acs->mashMeterNumIntervals] <= battleStatus->actionProgress) { + acs->stateTimer = 0; } - if (actionCommandStatus->frameCounter == 0) { - btl_set_popup_duration(0); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; + if (acs->stateTimer == 0) { + btl_set_popup_duration(POPUP_MSG_OFF); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; break; } - actionCommandStatus->frameCounter -= 1; + acs->stateTimer--; break; - case 12: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter -= 1; + case AC_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; break; } - battleStatus->actionSuccess = 1; + battleStatus->actionQuality = 1; battleStatus->actionResult = ACTION_RESULT_NONE; action_command_free(); default: @@ -144,21 +165,21 @@ void N(update)(void) { } void N(draw)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - s32 x, y; - s32 hudElement; + ActionCommandStatus* acs = &gActionCommandStatus; + s32 hudX, hudY; + HudElemID hid; - if (!actionCommandStatus->berserkerEnabled) { - hud_element_draw_clipped(actionCommandStatus->hudElements[0]); + if (!acs->berserkerEnabled) { + hud_element_draw_clipped(acs->hudElemIDs[HIDX_BUTTON]); } - hudElement = actionCommandStatus->hudElements[1]; - hud_element_draw_clipped(hudElement); - hud_element_get_render_pos(hudElement, &x, &y); - draw_mash_meter_multicolor_with_divisor(x, y, actionCommandStatus->barFillLevel / 100, 2); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_draw_clipped(hid); + hud_element_get_render_pos(hid, &hudX, &hudY); + draw_mash_meter_multicolor_with_divisor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH, 2); } void N(free)(void) { - hud_element_free(gActionCommandStatus.hudElements[0]); - hud_element_free(gActionCommandStatus.hudElements[1]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_BUTTON]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_METER]); } diff --git a/src/battle/action_cmd/stop_leech.h b/src/battle/action_cmd/stop_leech.h index 606d4669deb..92bc3e1fae2 100644 --- a/src/battle/action_cmd/stop_leech.h +++ b/src/battle/action_cmd/stop_leech.h @@ -3,10 +3,17 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_stop_leech_init); + +// args: prep time, duration, difficulty API_CALLABLE(action_command_stop_leech_start); + void action_command_stop_leech_update(void); void action_command_stop_leech_draw(void); void action_command_stop_leech_free(void); +// timeout duration for leech -- if the player can survive for this many frames (> 18.2 mintues) the command will end +#define AC_LEECH_MAX_TIME 32767 + #endif diff --git a/src/battle/action_cmd/three_chances.c b/src/battle/action_cmd/three_chances.c new file mode 100644 index 00000000000..7bea124a460 --- /dev/null +++ b/src/battle/action_cmd/three_chances.c @@ -0,0 +1,669 @@ +#include "common.h" +#include "battle/action_cmd.h" +#include "include_asset.h" + +#define NAMESPACE action_command_three_chances + +extern s32 actionCmdTableWaterBlock[][2]; + +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_BUTTON = 0, + HIDX_FRAME = 1, + HIDX_LIGHT_1 = 2, + HIDX_LIGHT_2 = 3, + HIDX_LIGHT_3 = 4, + HIDX_05 = 5, // unused 4th light + HIDX_RATING_1 = 6, + HIDX_RATING_2 = 7, + HIDX_RATING_3 = 8, + HIDX_09 = 9, // unused rating for 4th light + HIDX_DIGIT = 10, + HIDX_TICK_1 = 11, + HIDX_TICK_2 = 12, + HIDX_BUFF_ICON = 13, +}; + +// states for this action command +enum { + THREE_CHANCES_STATE_INIT = 0, // create hud elements + THREE_CHANCES_STATE_APPEAR = 1, // hud elements move into position + THREE_CHANCES_STATE_START = 10, // begin the input-checking phase + THREE_CHANCES_STATE_PREFACE = 11, // first two ticks light up + THREE_CHANCES_STATE_FIRST_CHANCE = 12, // first window to match timing + THREE_CHANCES_STATE_SECOND_CHANCE = 13, // second window to match timing + THREE_CHANCES_STATE_THIRD_CHANCE = 14, // third window to match timing + THREE_CHANCES_STATE_UNUSED_CHANCE = 15, // unimplemented fourth chance to match timing + THREE_CHANCES_STATE_WRAPUP = 16, // tally overall success + THREE_CHANCES_STATE_DISPOSE = 17, // delay and disappear +}; + +// input window before the light appears where A inputs cause timing test to fail +#define ANTI_MASH_TIME 5 + +INCLUDE_IMG("battle/action_cmd/three_chances_1.png", battle_action_cmd_three_chances_1_png); +INCLUDE_PAL("battle/action_cmd/three_chances_1.pal", battle_action_cmd_three_chances_1_pal); + +INCLUDE_IMG("battle/action_cmd/three_chances_2.png", battle_action_cmd_three_chances_2_png); +INCLUDE_PAL("battle/action_cmd/three_chances_2.pal", battle_action_cmd_three_chances_2_pal); + +INCLUDE_IMG("battle/action_cmd/three_chances_3.png", battle_action_cmd_three_chances_3_png); +INCLUDE_PAL("battle/action_cmd/three_chances_3.pal", battle_action_cmd_three_chances_3_pal); + +INCLUDE_IMG("battle/action_cmd/three_chances_0.png", battle_action_cmd_three_chances_0_png); +INCLUDE_PAL("battle/action_cmd/three_chances_0.pal", battle_action_cmd_three_chances_0_pal); + +INCLUDE_IMG("battle/action_cmd/three_chances_block.png", battle_action_cmd_three_chances_block_png); +INCLUDE_PAL("battle/action_cmd/three_chances_block.pal", battle_action_cmd_three_chances_block_pal); + +INCLUDE_IMG("battle/action_cmd/three_chances_circle.png", battle_action_cmd_three_chances_circle_png); +INCLUDE_PAL("battle/action_cmd/three_chances_circle.pal", battle_action_cmd_three_chances_circle_pal); + +INCLUDE_IMG("battle/action_cmd/three_chances_cloud.png", battle_action_cmd_three_chances_cloud_png); +INCLUDE_PAL("battle/action_cmd/three_chances_cloud.pal", battle_action_cmd_three_chances_cloud_pal); + +INCLUDE_IMG("battle/action_cmd/three_chances_4.png", battle_action_cmd_three_chances_4_png); +INCLUDE_PAL("battle/action_cmd/three_chances_4.pal", battle_action_cmd_three_chances_4_pal); + +HudScript HES_Digit1 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_three_chances_1, 24, 24); +HudScript HES_Digit2 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_three_chances_2, 24, 24); +HudScript HES_Digit3 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_three_chances_3, 24, 24); +HudScript HES_Digit0 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_three_chances_0, 24, 24); +HudScript HES_Digit4 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_three_chances_4, 24, 24); + +HudScript HES_WaterBlock = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_three_chances_block, 32, 32); +HudScript HES_TurboCharge = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_three_chances_circle, 40, 40); +HudScript HES_CloudNine = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_three_chances_cloud, 40, 40); + +HudScript* DigitScripts[] = { + &HES_Digit0, + &HES_Digit1, + &HES_Digit2, + &HES_Digit3, + &HES_Digit4, + &HES_Digit4, + &HES_Digit4, + &HES_Digit4, + &HES_Digit4, + &HES_Digit4, +}; + +API_CALLABLE(N(init)) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + Bytecode* args = script->ptrReadPos; + HudElemID hid; + + battleStatus->maxActionQuality = 5; + battleStatus->actionCmdDifficultyTable = (s32*)actionCmdTableWaterBlock; + + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; + return ApiStatus_DONE2; + } + + action_command_init_status(); + + acs->actionCommandID = ACTION_COMMAND_THREE_CHANCES; + acs->state = THREE_CHANCES_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + acs->variation = evt_get_variable(script, *args++); + battleStatus->actionProgress = 1; + acs->hudPrepareTime = 30; + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_BUTTON] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + + hid = hud_element_create(&HES_TimingBar3Chances); + acs->hudElemIDs[HIDX_FRAME] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_TimingWait); + acs->hudElemIDs[HIDX_LIGHT_1] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_TimingWait); + acs->hudElemIDs[HIDX_LIGHT_2] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_TimingWait); + acs->hudElemIDs[HIDX_LIGHT_3] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_TimingOK); + acs->hudElemIDs[HIDX_RATING_1] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_TimingOK); + acs->hudElemIDs[HIDX_RATING_2] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_TimingOK); + acs->hudElemIDs[HIDX_RATING_3] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + acs->hudElemIDs[HIDX_DIGIT] = hud_element_create(DigitScripts[1]); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_DIGIT], acs->hudPosX, acs->hudPosY); + + acs->hudElemIDs[HIDX_TICK_1] = hud_element_create(&HES_TimingCharge4c); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_TICK_1], acs->hudPosX, acs->hudPosY); + + hid = hud_element_create(&HES_TimingCharge4b); + acs->hudElemIDs[HIDX_TICK_2] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + + switch (acs->variation) { + case ACV_THREE_CHANCES_WATER_BLOCK: + acs->hudElemIDs[HIDX_BUFF_ICON] = hud_element_create(&HES_WaterBlock); + hid = acs->hudElemIDs[HIDX_BUFF_ICON]; + break; + case ACV_THREE_CHANCES_TURBO_CHARGE: + acs->hudElemIDs[HIDX_BUFF_ICON] = hud_element_create(&HES_TurboCharge); + hid = acs->hudElemIDs[HIDX_BUFF_ICON]; + break; + case ACV_THREE_CHANCES_CLOUD_NINE: + acs->hudElemIDs[HIDX_BUFF_ICON] = hud_element_create(&HES_CloudNine); + hid = acs->hudElemIDs[HIDX_BUFF_ICON]; + break; + } + + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + return ApiStatus_DONE2; +} + +API_CALLABLE(N(start)) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + Bytecode* args = script->ptrReadPos; + + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; + return ApiStatus_DONE2; + } + + action_command_init_status(); + + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionProgress = 1; + battleStatus->actionQuality = 0; + battleStatus->actionResult = ACTION_RESULT_FAIL; + acs->state = 10; + battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; + + increment_action_command_attempt_count(); + + return ApiStatus_DONE2; +} + +void N(update)(void) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + s32 pos; + s32 i; + s32 window; + HudElemID hid; + + switch (acs->state) { + case THREE_CHANCES_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); + hid = acs->hudElemIDs[HIDX_BUTTON]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + hud_element_set_alpha(hid, 255); + hid = acs->hudElemIDs[HIDX_FRAME]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + hid = acs->hudElemIDs[HIDX_LIGHT_1]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + hid = acs->hudElemIDs[HIDX_LIGHT_2]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + hid = acs->hudElemIDs[HIDX_LIGHT_3]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + hid = acs->hudElemIDs[HIDX_DIGIT]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + hid = acs->hudElemIDs[HIDX_TICK_1]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + hid = acs->hudElemIDs[HIDX_TICK_2]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + hid = acs->hudElemIDs[HIDX_BUFF_ICON]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + acs->state = THREE_CHANCES_STATE_APPEAR; + break; + case THREE_CHANCES_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->hudPrepareTime != 0) { + acs->hudPrepareTime--; + return; + } + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; + } + hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUTTON], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_FRAME], acs->hudPosX + 28, acs->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_LIGHT_1], acs->hudPosX + 21, acs->hudPosY + 24); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_LIGHT_2], acs->hudPosX + 41, acs->hudPosY + 24); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_LIGHT_3], acs->hudPosX + 61, acs->hudPosY + 24); + + hid = acs->hudElemIDs[HIDX_DIGIT]; + switch (acs->variation) { + case ACV_THREE_CHANCES_WATER_BLOCK: + hud_element_set_render_pos(hid, acs->hudPosX + 91, acs->hudPosY + 7); + break; + case ACV_THREE_CHANCES_TURBO_CHARGE: + hud_element_set_render_pos(hid, acs->hudPosX + 91, acs->hudPosY + 13); + break; + case ACV_THREE_CHANCES_CLOUD_NINE: + hud_element_set_render_pos(hid, acs->hudPosX + 91, acs->hudPosY + 13); + break; + } + + hud_element_set_render_pos(acs->hudElemIDs[HIDX_TICK_1], acs->hudPosX - 5, acs->hudPosY + 29); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_TICK_2], acs->hudPosX + 7, acs->hudPosY + 29); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUFF_ICON], acs->hudPosX + 92, acs->hudPosY + 23); + break; + case THREE_CHANCES_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->prepareTime != 0) { + acs->prepareTime--; + return; + } + + acs->stateTimer = acs->duration - 60; + if (acs->stateTimer < 42) { + acs->stateTimer = 42; + } + acs->state = THREE_CHANCES_STATE_PREFACE; + + // fallthrough + case THREE_CHANCES_STATE_PREFACE: + btl_set_popup_duration(POPUP_MSG_ON); + + // first two minor ticks + if (acs->stateTimer == 42) { + hud_element_set_script(acs->hudElemIDs[HIDX_TICK_1], &HES_TimingCharge3); + sfx_play_sound(SOUND_TIMING_BAR_TICK); + } + if (acs->stateTimer == 22) { + hud_element_set_script(acs->hudElemIDs[HIDX_TICK_2], &HES_TimingCharge2); + sfx_play_sound(SOUND_TIMING_BAR_TICK); + } + + // activate the first light + if (acs->stateTimer == 2) { + hud_element_set_script(acs->hudElemIDs[HIDX_LIGHT_1], &HES_TimingReady); + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_AButtonDown); + sfx_play_sound(SOUND_TIMING_BAR_GO); + } + + acs->stateTimer--; + + // prepare to listen for input + if (acs->stateTimer == 0) { + acs->stateTimer = 20; + acs->threeChances.time = 0; + acs->state = THREE_CHANCES_STATE_FIRST_CHANCE; + acs->threeChances.hadCorrectTiming = FALSE; + acs->wrongButtonPressed = FALSE; + } + break; + case THREE_CHANCES_STATE_FIRST_CHANCE: + btl_set_popup_duration(POPUP_MSG_ON); + // in this state, test for input during the first six frames (threeChances.time >= -5), then display + // a verdict and wait until the full 20 frame state lifetime is complete before beginning the next one. + + // first six frames, if no input has been received + if (!(acs->wrongButtonPressed || acs->threeChances.hadCorrectTiming) + && acs->threeChances.time >= -5 + ) { + s32 (*difficultyVec)[2] = (s32 (*)[2])battleStatus->actionCmdDifficultyTable; + window = difficultyVec[acs->difficulty][0] + difficultyVec[acs->difficulty][1] + ANTI_MASH_TIME; + pos = battleStatus->inputBufferPos; + pos -= window; + if (pos < 0) { + pos += ARRAY_COUNT(battleStatus->pushInputBuffer); + } + if (window == 0) { + window = 1; + } + // iterate through last N inputs looking for button presses + for (i = 0; i < window; pos++, i++) { + if (pos >= ARRAY_COUNT(battleStatus->pushInputBuffer)) { + pos -= ARRAY_COUNT(battleStatus->pushInputBuffer); + } + + if (i < ANTI_MASH_TIME && (battleStatus->pushInputBuffer[pos] & BUTTON_A)) { + acs->wrongButtonPressed = TRUE; + } + + if (((battleStatus->pushInputBuffer[pos] & BUTTON_A) && !acs->wrongButtonPressed) || acs->autoSucceed) { + acs->threeChances.hadCorrectTiming = TRUE; + battleStatus->actionProgress++; + break; + } + } + } + + // if an input is received, show an early verdict + if ((acs->threeChances.time > -5) + && (acs->wrongButtonPressed || acs->threeChances.hadCorrectTiming) + ) { + hid = acs->hudElemIDs[HIDX_RATING_1]; + if (acs->threeChances.hadCorrectTiming) { + hud_element_set_script(hid, &HES_TimingOK); + } else { + hud_element_set_script(hid, &HES_TimingMiss); + } + hud_element_set_render_pos(hid, acs->hudPosX + 28, acs->hudPosY + 38); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + + // after six frames, show the verdict + if (acs->threeChances.time == -5) { + hid = acs->hudElemIDs[HIDX_RATING_1]; + if (acs->threeChances.hadCorrectTiming) { + hud_element_set_script(hid, &HES_TimingOK); + } else { + hud_element_set_script(hid, &HES_TimingMiss); + } + hud_element_set_render_pos(hid, acs->hudPosX + 28, acs->hudPosY + 38); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_AButton); + } + + acs->threeChances.time--; + + // activate the second light just before the next state begins + if (acs->stateTimer == 2) { + hud_element_set_script(acs->hudElemIDs[HIDX_LIGHT_2], &HES_TimingReady); + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_AButtonDown); + sfx_play_sound(SOUND_TIMING_BAR_GO); + } + + acs->stateTimer--; + + if (acs->stateTimer == 0) { + acs->stateTimer = 20; + acs->threeChances.time = 0; + acs->state = THREE_CHANCES_STATE_SECOND_CHANCE; + acs->threeChances.hadCorrectTiming = FALSE; + acs->wrongButtonPressed = FALSE; + } + break; + case THREE_CHANCES_STATE_SECOND_CHANCE: + btl_set_popup_duration(POPUP_MSG_ON); + // in this state, test for input during the first six frames (threeChances.time >= -5), then display + // a verdict and wait until the full 20 frame state lifetime is complete before beginning the next one. + + // first six frames, if no input has been received + if (!(acs->wrongButtonPressed || acs->threeChances.hadCorrectTiming) + && acs->threeChances.time >= -5 + ) { + s32 (*difficultyVec)[2] = (s32 (*)[2])battleStatus->actionCmdDifficultyTable; + window = difficultyVec[acs->difficulty][0] + difficultyVec[acs->difficulty][1] + ANTI_MASH_TIME - 1; + if (window < 6) { + window = 6; + } + pos = battleStatus->inputBufferPos; + pos -= window; + if (pos < 0) { + pos += ARRAY_COUNT(battleStatus->pushInputBuffer); + } + if (window == 0) { + window = 1; + } + // iterate through last N inputs looking for button presses + for (i = 0; i < window; pos++, i++) { + if (pos >= ARRAY_COUNT(battleStatus->pushInputBuffer)) { + pos -= ARRAY_COUNT(battleStatus->pushInputBuffer); + } + + if (i < ANTI_MASH_TIME) { + if (battleStatus->pushInputBuffer[pos] & BUTTON_A) { + acs->wrongButtonPressed = TRUE; + } + } + + if (((battleStatus->pushInputBuffer[pos] & BUTTON_A) && !acs->wrongButtonPressed) || acs->autoSucceed) { + acs->threeChances.hadCorrectTiming = TRUE; + battleStatus->actionProgress++; + break; + } + } + } + + // if an input is received, show an early verdict + if ((acs->threeChances.time > -5) + && (acs->wrongButtonPressed || acs->threeChances.hadCorrectTiming) + ) { + hid = acs->hudElemIDs[HIDX_RATING_2]; + if (acs->threeChances.hadCorrectTiming) { + hud_element_set_script(hid, &HES_TimingOK); + } else { + hud_element_set_script(hid, &HES_TimingMiss); + } + hud_element_set_render_pos(hid, acs->hudPosX + 48, acs->hudPosY + 38); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + + // after six frames, show the verdict + if (acs->threeChances.time == -5) { + hid = acs->hudElemIDs[HIDX_RATING_2]; + if (acs->threeChances.hadCorrectTiming) { + hud_element_set_script(hid, &HES_TimingOK); + } else { + hud_element_set_script(hid, &HES_TimingMiss); + } + hud_element_set_render_pos(hid, acs->hudPosX + 48, acs->hudPosY + 38); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_AButton); + } + + acs->threeChances.time--; + + // activate the third light just before the next state begins + if (acs->stateTimer == 2) { + hud_element_set_script(acs->hudElemIDs[HIDX_LIGHT_3], &HES_TimingReady); + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_AButtonDown); + sfx_play_sound(SOUND_TIMING_BAR_GO); + } + + acs->stateTimer--; + + if (acs->stateTimer == 0) { + acs->stateTimer = 20; + acs->threeChances.time = 0; + acs->state = THREE_CHANCES_STATE_THIRD_CHANCE; + acs->threeChances.hadCorrectTiming = FALSE; + acs->wrongButtonPressed = FALSE; + } + break; + case THREE_CHANCES_STATE_THIRD_CHANCE: + btl_set_popup_duration(POPUP_MSG_ON); + // in this state, test for input during the first six frames (threeChances.time >= -5), then display + // a verdict and begin wrapping up the action command. + + // first six frames, if no input has been received + if (!(acs->wrongButtonPressed || acs->threeChances.hadCorrectTiming) + && acs->threeChances.time >= -5 + ) { + s32 (*difficultyVec)[2] = (s32 (*)[2])battleStatus->actionCmdDifficultyTable; + window = difficultyVec[acs->difficulty][0] + difficultyVec[acs->difficulty][1] + ANTI_MASH_TIME - 2; + if (window < 6) { + window = 6; + } + pos = battleStatus->inputBufferPos; + pos -= window; + if (pos < 0) { + pos += ARRAY_COUNT(battleStatus->pushInputBuffer); + } + if (window == 0) { + window = 1; + } + // iterate through last N inputs looking for button presses + for (i = 0; i < window; pos++, i++) { + if (pos >= ARRAY_COUNT(battleStatus->pushInputBuffer)) { + pos -= ARRAY_COUNT(battleStatus->pushInputBuffer); + } + + if (i < ANTI_MASH_TIME) { + if (battleStatus->pushInputBuffer[pos] & BUTTON_A) { + acs->wrongButtonPressed = TRUE; + } + } + + if (((battleStatus->pushInputBuffer[pos] & BUTTON_A) && !acs->wrongButtonPressed) || + acs->autoSucceed) { + acs->threeChances.hadCorrectTiming = TRUE; + battleStatus->actionProgress++; + break; + } + } + } + + // if an input is received, show an early verdict + if ((acs->threeChances.time > -5) + && (acs->wrongButtonPressed || acs->threeChances.hadCorrectTiming) + ) { + hid = acs->hudElemIDs[HIDX_RATING_3]; + if (acs->threeChances.hadCorrectTiming) { + hud_element_set_script(hid, &HES_TimingOK); + } else { + hud_element_set_script(hid, &HES_TimingMiss); + } + hud_element_set_render_pos(hid, acs->hudPosX + 68, acs->hudPosY + 38); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + + // after six frames, show the verdict + if (acs->threeChances.time == -5) { + hid = acs->hudElemIDs[HIDX_RATING_3]; + if (acs->threeChances.hadCorrectTiming) { + hud_element_set_script(hid, &HES_TimingOK); + } else { + hud_element_set_script(hid, &HES_TimingMiss); + } + hud_element_set_render_pos(hid, acs->hudPosX + 68, acs->hudPosY + 38); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_AButton); + acs->state = THREE_CHANCES_STATE_WRAPUP; + return; + } + + acs->threeChances.time--; + break; + case THREE_CHANCES_STATE_WRAPUP: + if (battleStatus->actionProgress == 0) { + battleStatus->actionQuality = AC_QUALITY_FAILED; + } else { + battleStatus->actionQuality = battleStatus->actionProgress; + } + battleStatus->actionResult = ACTION_RESULT_SUCCESS; + if (battleStatus->actionQuality == 3) { + increment_action_command_success_count(); + } + btl_set_popup_duration(POPUP_MSG_OFF); + acs->stateTimer = 5; + acs->state = THREE_CHANCES_STATE_DISPOSE; + break; + case THREE_CHANCES_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; + return; + } + action_command_free(); + break; + } +} + +void N(draw)(void) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + HudElemID hid; + + hud_element_draw_clipped(acs->hudElemIDs[HIDX_BUTTON]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_FRAME]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_LIGHT_1]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_LIGHT_2]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_LIGHT_3]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_RATING_1]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_RATING_2]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_RATING_3]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_BUFF_ICON]); + + hid = acs->hudElemIDs[HIDX_DIGIT]; + if (hud_element_get_script(hid) != DigitScripts[battleStatus->actionProgress]) { + hud_element_set_script(hid, DigitScripts[battleStatus->actionProgress]); + } + + hud_element_draw_clipped(hid); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_TICK_1]); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_TICK_2]); +} + +void N(free)(void) { + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_BUTTON]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_FRAME]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_LIGHT_1]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_LIGHT_2]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_LIGHT_3]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_RATING_1]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_RATING_2]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_RATING_3]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_DIGIT]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_TICK_1]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_TICK_2]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_BUFF_ICON]); +} diff --git a/src/battle/action_cmd/three_chances.h b/src/battle/action_cmd/three_chances.h new file mode 100644 index 00000000000..105a8909580 --- /dev/null +++ b/src/battle/action_cmd/three_chances.h @@ -0,0 +1,23 @@ +#ifndef _THREE_CHANCES_H_ +#define _THREE_CHANCES_H_ + +#include "common_structs.h" + +// args: variation +API_CALLABLE(action_command_three_chances_init); + +// args: prep time, duration, difficulty +API_CALLABLE(action_command_three_chances_start); + +void action_command_three_chances_update(void); +void action_command_three_chances_draw(void); +void action_command_three_chances_free(void); + +// variants for this action command +enum { + ACV_THREE_CHANCES_WATER_BLOCK = 0, + ACV_THREE_CHANCES_TURBO_CHARGE = 1, + ACV_THREE_CHANCES_CLOUD_NINE = 2, +}; + +#endif diff --git a/src/battle/action_cmd/tidal_wave.c b/src/battle/action_cmd/tidal_wave.c index 4455922d828..5ad3133c86a 100644 --- a/src/battle/action_cmd/tidal_wave.c +++ b/src/battle/action_cmd/tidal_wave.c @@ -3,83 +3,113 @@ #define NAMESPACE action_command_tidal_wave -HudScript* D_802A97C0_42CEB0[3] = { &HES_PressAButton, &HES_PressBButton, &HES_PressCDownButton }; -HudScript* D_802A97CC_42CEBC[3] = { &HES_AButtonDown, &HES_BButtonHeld, &HES_CDownButtonHeld }; - extern s32 actionCmdTableTidalWave[]; +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_METER = 0, + HIDX_FIRST_BUTTON = 1, + // remaining HIDX are for the sequence of buttons +}; + +// states for this action command +enum { + TIDAL_WAVE_STATE_INIT = 0, // create hud elements + TIDAL_WAVE_STATE_APPEAR = 1, // hud elements move into position + TIDAL_WAVE_STATE_START = 10, + TIDAL_WAVE_STATE_NEXT_BUTTON = 11, // choose the next required input + TIDAL_WAVE_STATE_AWAIT_INPUT = 12, // wait for the player's response + TIDAL_WAVE_STATE_WRAPUP = 13, // tally overall success + TIDAL_WAVE_STATE_DISPOSE = 14, // delay and disappear +}; + +enum { + TIDAL_WAVE_INPUT_A = 0, + TIDAL_WAVE_INPUT_B = 1, + TIDAL_WAVE_INPUT_C_DOWN = 2, + TIDAL_WAVE_INPUT_COUNT, +}; + +HudScript* HudButtonsUp[TIDAL_WAVE_INPUT_COUNT] = { &HES_PressAButton, &HES_PressBButton, &HES_PressCDownButton }; +HudScript* HudButtonsDown[TIDAL_WAVE_INPUT_COUNT] = { &HES_AButtonDown, &HES_BButtonHeld, &HES_CDownButtonHeld }; + API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; s32 i; - battleStatus->unk_82 = 5; + battleStatus->maxActionQuality = 5; battleStatus->actionCmdDifficultyTable = actionCmdTableTidalWave; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; - return ApiStatus_DONE2; - } else { - action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_TIDAL_WAVE; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { battleStatus->actionQuality = 0; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->hudPosY = 80; - - id = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[0] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - for (i = 1; i < ARRAY_COUNT(actionCommandStatus->hudElements) - 1; i++) { - id = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[i] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - } - return ApiStatus_DONE2; } + + action_command_init_status(); + + acs->actionCommandID = ACTION_COMMAND_TIDAL_WAVE; + acs->state = TIDAL_WAVE_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionProgress = 0; + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + for (i = HIDX_FIRST_BUTTON; i < ARRAY_COUNT(acs->hudElemIDs) - 1; i++) { + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[i] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + } + + return ApiStatus_DONE2; } API_CALLABLE(N(start)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Bytecode* args = script->ptrReadPos; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->prepareTime = evt_get_variable(script, *args++); - actionCommandStatus->duration = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = adjust_action_command_difficulty(actionCommandStatus->difficulty); - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - battleStatus->actionSuccess = 0; + + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; battleStatus->actionQuality = 0; + battleStatus->actionProgress = 0; battleStatus->actionResult = ACTION_RESULT_FAIL; - actionCommandStatus->state = 10; + acs->state = TIDAL_WAVE_STATE_START; battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; - func_80269118(); + + increment_action_command_attempt_count(); + return ApiStatus_DONE2; } void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; s8 oldButton; s8 newButton; s32 numLookbackFrames; @@ -88,82 +118,79 @@ void N(update)(void) { s32 success; s32 i; - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); - id = actionCommandStatus->hudElements[0]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + switch (acs->state) { + case TIDAL_WAVE_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); + hid = acs->hudElemIDs[HIDX_METER]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_set_alpha(id, 255); - actionCommandStatus->state = 1; + hud_element_set_alpha(hid, 255); + acs->state = TIDAL_WAVE_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + case TIDAL_WAVE_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos( - actionCommandStatus->hudElements[0], - actionCommandStatus->hudPosX + 21, - actionCommandStatus->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX + 21, acs->hudPosY + 28); break; - case 10: - btl_set_popup_duration(99); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + case TIDAL_WAVE_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->prepareTime != 0) { + acs->prepareTime--; break; } - actionCommandStatus->unk_5D = 1; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - actionCommandStatus->unk_5C = rand_int(2); - actionCommandStatus->state = 11; - actionCommandStatus->wrongInputFrameCounter = 0; + acs->tidalWave.inputCount = 1; + acs->stateTimer = acs->duration; + acs->tidalWave.prevButton = rand_int(TIDAL_WAVE_INPUT_COUNT - 1); + acs->state = TIDAL_WAVE_STATE_NEXT_BUTTON; + acs->wrongInputFrameCounter = 0; + // fallthrough - case 11: - btl_set_popup_duration(99); + case TIDAL_WAVE_STATE_NEXT_BUTTON: + btl_set_popup_duration(POPUP_MSG_ON); // Pick a new button that doesn't match the old one. - oldButton = actionCommandStatus->unk_5C; + oldButton = acs->tidalWave.prevButton; do { - newButton = rand_int(2); - actionCommandStatus->unk_5C = newButton; + newButton = rand_int(TIDAL_WAVE_INPUT_COUNT - 1); + acs->tidalWave.prevButton = newButton; } while (oldButton == newButton); - id = actionCommandStatus->hudElements[actionCommandStatus->unk_5D]; - hud_element_set_script( - id, D_802A97C0_42CEB0[newButton]); - hud_element_set_render_pos( - id, - actionCommandStatus->hudPosX + ((actionCommandStatus->unk_5D - 1) * 20) + 16, - actionCommandStatus->hudPosY); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hid = acs->hudElemIDs[acs->tidalWave.inputCount]; + hud_element_set_script(hid, HudButtonsUp[newButton]); + hud_element_set_render_pos(hid, acs->hudPosX + ((acs->tidalWave.inputCount - 1) * 20) + 16, acs->hudPosY); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); sfx_play_sound(SOUND_TIMING_BAR_TICK); - actionCommandStatus->lookBackCounter = 1; - actionCommandStatus->state = 12; + acs->lookBackCounter = 1; + acs->state = TIDAL_WAVE_STATE_AWAIT_INPUT; + // fallthrough - case 12: - btl_set_popup_duration(99); - if (--actionCommandStatus->frameCounter == 0) { - actionCommandStatus->state = 13; + case TIDAL_WAVE_STATE_AWAIT_INPUT: + btl_set_popup_duration(POPUP_MSG_ON); + + acs->stateTimer--; + if (acs->stateTimer == 0) { + acs->state = TIDAL_WAVE_STATE_WRAPUP; break; } // Stops checking for input if on the 15th button. - if (actionCommandStatus->unk_5D == 15) { + if (acs->tidalWave.inputCount == 15) { break; } // Number of frames until input possible (if negative, used to look backward; // allows correct presses to be buffered after an incorrect press). - actionCommandStatus->lookBackCounter--; + acs->lookBackCounter--; // Wrong-input lockout frame counter - actionCommandStatus->wrongInputFrameCounter--; + acs->wrongInputFrameCounter--; - if (actionCommandStatus->lookBackCounter <= 0) { + if (acs->lookBackCounter <= 0) { // Determine number of frames to look back in input buffer (up to 20). - numLookbackFrames = abs(actionCommandStatus->lookBackCounter); + numLookbackFrames = abs(acs->lookBackCounter); if (numLookbackFrames > 20) { numLookbackFrames = 20; } @@ -186,51 +213,51 @@ void N(update)(void) { } // If not locked out from previous wrong press... - if (actionCommandStatus->wrongInputFrameCounter > 0) { + if (acs->wrongInputFrameCounter > 0) { break; }; success = FALSE; - actionCommandStatus->wrongButtonPressed = FALSE; + acs->wrongButtonPressed = FALSE; // Check for presses of the current button. - switch (actionCommandStatus->unk_5C) { - case 0: - if (actionCommandStatus->autoSucceed) { + switch (acs->tidalWave.prevButton) { + case TIDAL_WAVE_INPUT_A: + if (acs->autoSucceed) { success = TRUE; } else { buttonsPressed = battleStatus->pushInputBuffer[bufferPos]; if (buttonsPressed != 0) { if (buttonsPressed & ~BUTTON_A) { - actionCommandStatus->wrongButtonPressed = TRUE; + acs->wrongButtonPressed = TRUE; } else { success = TRUE; } } } break; - case 1: - if (actionCommandStatus->autoSucceed) { + case TIDAL_WAVE_INPUT_B: + if (acs->autoSucceed) { success = TRUE; } else { buttonsPressed = battleStatus->pushInputBuffer[bufferPos]; if (buttonsPressed != 0) { if (buttonsPressed & ~BUTTON_B) { - actionCommandStatus->wrongButtonPressed = TRUE; + acs->wrongButtonPressed = TRUE; } else { success = TRUE; } } } break; - case 2: - if (actionCommandStatus->autoSucceed) { + case TIDAL_WAVE_INPUT_C_DOWN: + if (acs->autoSucceed) { success = TRUE; } else { buttonsPressed = battleStatus->pushInputBuffer[bufferPos]; if (buttonsPressed != 0) { if (buttonsPressed & ~BUTTON_C_DOWN) { - actionCommandStatus->wrongButtonPressed = TRUE; + acs->wrongButtonPressed = TRUE; } else { success = TRUE; } @@ -239,30 +266,26 @@ void N(update)(void) { break; } - if (actionCommandStatus->wrongButtonPressed) { + if (acs->wrongButtonPressed) { // Wrong; prevent successful inputs for 10 frames. - actionCommandStatus->wrongInputFrameCounter = 10; + acs->wrongInputFrameCounter = 10; sfx_play_sound(SOUND_MENU_ERROR); - actionCommandStatus->lookBackCounter = 0; + acs->lookBackCounter = 0; } if (success) { // Correct; shrink button, set up next button press, etc. - id = actionCommandStatus->hudElements[actionCommandStatus->unk_5D]; - hud_element_set_script(id, D_802A97CC_42CEBC[actionCommandStatus->unk_5C]); - hud_element_set_scale(id, 0.5f); - hud_element_set_render_pos( - id, - actionCommandStatus->hudPosX + ((actionCommandStatus->unk_5D - 1) * 20), - actionCommandStatus->hudPosY + 7); - actionCommandStatus->unk_5D++; - actionCommandStatus->barFillLevel += - battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 0x12; - if (actionCommandStatus->barFillLevel > 10000) { - actionCommandStatus->barFillLevel = 10000; + hid = acs->hudElemIDs[acs->tidalWave.inputCount]; + hud_element_set_script(hid, HudButtonsDown[acs->tidalWave.prevButton]); + hud_element_set_scale(hid, 0.5f); + hud_element_set_render_pos(hid, acs->hudPosX + ((acs->tidalWave.inputCount - 1) * 20), acs->hudPosY + 7); + acs->tidalWave.inputCount++; + acs->meterFillLevel += battleStatus->actionCmdDifficultyTable[acs->difficulty] * 18; + if (acs->meterFillLevel > MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; } - actionCommandStatus->state = 11; - battleStatus->actionQuality++; + acs->state = TIDAL_WAVE_STATE_NEXT_BUTTON; + battleStatus->actionProgress++; sfx_play_sound(SOUND_APPROVE); return; } @@ -271,23 +294,23 @@ void N(update)(void) { } } break; - case 13: - if (battleStatus->actionQuality == 0) { - battleStatus->actionSuccess = -1; + case TIDAL_WAVE_STATE_WRAPUP: + if (battleStatus->actionProgress == 0) { + battleStatus->actionQuality = AC_QUALITY_FAILED; } else { - battleStatus->actionSuccess = battleStatus->actionQuality; + battleStatus->actionQuality = battleStatus->actionProgress; } battleStatus->actionResult = ACTION_RESULT_SUCCESS; - if (battleStatus->actionSuccess >= 10) { - func_80269160(); + if (battleStatus->actionQuality >= 10) { + increment_action_command_success_count(); } - btl_set_popup_duration(0); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 14; + btl_set_popup_duration(POPUP_MSG_OFF); + acs->stateTimer = 5; + acs->state = TIDAL_WAVE_STATE_DISPOSE; break; - case 14: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; + case TIDAL_WAVE_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; } else { action_command_free(); } @@ -298,17 +321,17 @@ void N(update)(void) { void N(draw)(void) { s32 i; - for (i = 1; i < ARRAY_COUNT(gActionCommandStatus.hudElements) - 1; i++) { - hud_element_draw_clipped(gActionCommandStatus.hudElements[i]); + for (i = HIDX_FIRST_BUTTON; i < ARRAY_COUNT(gActionCommandStatus.hudElemIDs) - 1; i++) { + hud_element_draw_clipped(gActionCommandStatus.hudElemIDs[i]); } } void N(free)(void) { s32 i; - hud_element_free(gActionCommandStatus.hudElements[0]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_METER]); - for (i = 1; i < ARRAY_COUNT(gActionCommandStatus.hudElements) - 1; i++) { - hud_element_free(gActionCommandStatus.hudElements[i]); + for (i = HIDX_FIRST_BUTTON; i < ARRAY_COUNT(gActionCommandStatus.hudElemIDs) - 1; i++) { + hud_element_free(gActionCommandStatus.hudElemIDs[i]); } } diff --git a/src/battle/action_cmd/tidal_wave.h b/src/battle/action_cmd/tidal_wave.h index b82506667bd..8f38fe99b03 100644 --- a/src/battle/action_cmd/tidal_wave.h +++ b/src/battle/action_cmd/tidal_wave.h @@ -3,8 +3,12 @@ #include "common_structs.h" +// args: none API_CALLABLE(action_command_tidal_wave_init); + +// args: prep time, duration, difficulty API_CALLABLE(action_command_tidal_wave_start); + void action_command_tidal_wave_update(void); void action_command_tidal_wave_draw(void); void action_command_tidal_wave_free(void); diff --git a/src/battle/action_cmd/unused_flee.c b/src/battle/action_cmd/unused_flee.c new file mode 100644 index 00000000000..725c28c22f3 --- /dev/null +++ b/src/battle/action_cmd/unused_flee.c @@ -0,0 +1,223 @@ +#include "common.h" +#include "battle/action_cmd.h" + +/** + * Seems to be an unused, partially broken version of the Flee action command. + * The player must mash A to fill a meter up to an OK mark. + * + * Unlike the normal flee command, the OK mark does not move and the command will only + * succeed of the meter is filled. Once filled, it rapidly drains and must be refilled. + */ + +#define NAMESPACE action_command_unused_flee + +void btl_message_unlock_box_pos(void); + +extern s32 actionCmdTable07[]; + +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_BUTTON = 0, + HIDX_METER = 1, + HIDX_OK = 2, +}; + +// how much to add to the meter per input if all modifiers are neutral +#define METER_FILL_TICK 600 + +BSS b32 N(HasStarted); + +API_CALLABLE(N(init)) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + Bytecode* args = script->ptrReadPos; + HudElemID hid; + s32 temp; + + battleStatus->maxActionQuality = 5; + battleStatus->actionCmdDifficultyTable = actionCmdTable07; + + acs->autoSucceed = FALSE; + acs->actionCommandID = ACTION_COMMAND_UNUSED_FLEE; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = evt_get_variable(script, *args); + acs->hudPosX = -48; + acs->meterFillWidth = 0; + N(HasStarted) = FALSE; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_BUTTON] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + + // Weird use of an extra temp settles regalloc here. + hid = temp = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_RunAwayOK); + acs->hudElemIDs[HIDX_OK] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; + + return ApiStatus_DONE2; +} + +API_CALLABLE(N(start)) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + Bytecode* args = script->ptrReadPos; + + acs->autoSucceed = FALSE; + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + + acs->wrongButtonPressed = FALSE; + battleStatus->actionQuality = 0; + battleStatus->actionResult = ACTION_RESULT_FAIL; + + battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; + btl_message_unlock_box_pos(); + acs->state = AC_STATE_START; + + return ApiStatus_DONE2; +} + +void N(update)(void) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + HudElemID hid; + + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); + + hid = acs->hudElemIDs[HIDX_BUTTON]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + hud_element_set_alpha(hid, 255); + + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + + hid = acs->hudElemIDs[HIDX_OK]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + + acs->state = AC_STATE_APPEAR; + break; + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; + } + + hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUTTON], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_OK], acs->hudPosX + 31, acs->hudPosY + 14); + break; + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + + if (acs->prepareTime != 0) { + acs->prepareTime--; + return; + } + + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_MashAButton); + battleStatus->actionQuality = 0; + N(HasStarted) = TRUE; + acs->flee.drainDelay = 0; + acs->state = AC_STATE_ACTIVE; + acs->stateTimer = acs->duration; + + // fallthrough + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // check for meter-filling input + if (battleStatus->curButtonsPressed & BUTTON_A) { + s32 fillAmt = SCALE_BY_PCT(METER_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]); + + if (acs->flee.drainDelay == 0) { + acs->meterFillLevel += fillAmt; + } + } + + // handle meter reaching 100% + if (acs->meterFillLevel > MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + acs->flee.drainDelay = 3; + } + + // meter can reset if mashing stops after it's been fully filled + if (acs->flee.drainDelay != 0) { + acs->flee.drainDelay--; + if (acs->flee.drainDelay == 0) { + acs->meterFillLevel = 0; + battleStatus->actionQuality++; + } + } + + battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH; + + if (acs->stateTimer != 0) { + acs->stateTimer--; + return; + } + btl_set_popup_duration(POPUP_MSG_OFF); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; + break; + case AC_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; + return; + } + action_command_free(); + break; + } +} + +void N(draw)(void) { + ActionCommandStatus* acs = &gActionCommandStatus; + s32 hudX, hudY; + HudElemID hid; + + hud_element_draw_clipped(acs->hudElemIDs[HIDX_BUTTON]); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_draw_clipped(hid); + hud_element_get_render_pos(hid, &hudX, &hudY); + + if (!N(HasStarted)) { + draw_mash_meter_multicolor_with_divisor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH, 1); + } else { + draw_mash_meter_multicolor_with_divisor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH, 2); + } + + hud_element_draw_clipped(acs->hudElemIDs[HIDX_OK]); +} + +void N(free)(void) { + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_BUTTON]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_METER]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_OK]); +} diff --git a/src/battle/action_cmd/unused_flee.h b/src/battle/action_cmd/unused_flee.h new file mode 100644 index 00000000000..56f343179a7 --- /dev/null +++ b/src/battle/action_cmd/unused_flee.h @@ -0,0 +1,16 @@ +#ifndef _UNUSED_FLEE_H_ +#define _UNUSED_FLEE_H_ + +#include "common_structs.h" + +// args: none +API_CALLABLE(action_command_unused_flee_init); + +// args: prep time, duration, difficulty +API_CALLABLE(action_command_unused_flee_start); + +void action_command_unused_flee_update(void); +void action_command_unused_flee_draw(void); +void action_command_unused_flee_free(void); + +#endif diff --git a/src/battle/action_cmd/unused_mash_a.c b/src/battle/action_cmd/unused_mash_a.c new file mode 100644 index 00000000000..1f8e5faf36e --- /dev/null +++ b/src/battle/action_cmd/unused_mash_a.c @@ -0,0 +1,211 @@ +#include "common.h" +#include "battle/action_cmd.h" + +/** + * A very simple "mash A to fill the meter" action command. + * The command is very easy, as each mash adds a large amount to the meter and the + * meter does not drain. + */ + +#define NAMESPACE action_command_unused_mash_a + +extern s32 actionCmdTable0A[]; + +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_BUTTON = 0, + HIDX_METER = 1, + HIDX_100_PCT = 2, +}; + +// how much to add to the meter per input +#define METER_FILL_TICK 1500 + +API_CALLABLE(N(init)) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + HudElemID hid; + + battleStatus->maxActionQuality = 100; + battleStatus->actionCmdDifficultyTable = actionCmdTable0A; + battleStatus->actionResult = ACTION_RESULT_NONE; + + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; + return ApiStatus_DONE2; + } + + action_command_init_status(); + + acs->actionCommandID = ACTION_COMMAND_UNUSED_MASH_A; + acs->showHud = TRUE; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + acs->isMeterFilled = FALSE; + battleStatus->actionQuality = 0; + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_BUTTON] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_100pct); + acs->hudElemIDs[HIDX_100_PCT] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + return ApiStatus_DONE2; +} + +API_CALLABLE(N(start)) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + Bytecode* args = script->ptrReadPos; + + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; + return ApiStatus_DONE2; + } + + action_command_init_status(); + + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + acs->statusChance = evt_get_variable(script, *args++); // unused + + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; + battleStatus->actionResult = ACTION_RESULT_NONE; + battleStatus->maxActionQuality = acs->mashMeterCutoffs[(acs->mashMeterNumIntervals - 1)]; + battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; + acs->state = AC_STATE_START; + + increment_action_command_attempt_count(); + + return ApiStatus_DONE2; +} + +void N(update)(void) { + ActionCommandStatus* acs = &gActionCommandStatus; + BattleStatus* battleStatus = &gBattleStatus; + HudElemID hid; + s32 cutoff; + + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); + + hid = acs->hudElemIDs[HIDX_BUTTON]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + + acs->state = AC_STATE_APPEAR; + break; + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; + } + + hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUTTON], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); + break; + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + + if (acs->prepareTime != 0) { + acs->prepareTime--; + return; + } + + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_MashAButton); + acs->meterFillLevel = 0; + acs->state = AC_STATE_ACTIVE; + acs->stateTimer = acs->duration; + + // fallthrough + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // check for meter-filling input + if (battleStatus->curButtonsPressed & BUTTON_A) { + acs->meterFillLevel += SCALE_BY_PCT(METER_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]); + } + + // handle meter reaching 100% + if (acs->meterFillLevel >= MAX_MASH_UNITS) { + acs->meterFillLevel = MAX_MASH_UNITS; + acs->isMeterFilled = TRUE; + hid = acs->hudElemIDs[HIDX_100_PCT]; + hud_element_set_render_pos(hid, acs->hudPosX + 50, acs->hudPosY + 28); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + + battleStatus->actionProgress = acs->meterFillLevel / ONE_PCT_MASH; + + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; + } + + if (acs->meterFillLevel == 0) { + battleStatus->actionQuality = AC_QUALITY_FAILED; + } else { + battleStatus->actionQuality = acs->meterFillLevel / ONE_PCT_MASH; + } + + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals - 1]; + if (battleStatus->actionQuality >= cutoff) { + battleStatus->actionResult = ACTION_RESULT_SUCCESS; + } else { + battleStatus->actionResult = ACTION_RESULT_METER_NOT_ENOUGH; + } + + if (battleStatus->actionQuality == 100) { + // only count 100% fill as success for this action command + increment_action_command_success_count(); + } + + btl_set_popup_duration(POPUP_MSG_OFF); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; + break; + case AC_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; + break; + } + action_command_free(); + break; + } +} + +#include "common/MashCommandDraw.inc.c" + +#include "common/MashCommandFree.inc.c" diff --git a/src/battle/action_cmd/unused_mash_a.h b/src/battle/action_cmd/unused_mash_a.h new file mode 100644 index 00000000000..9361939e0b8 --- /dev/null +++ b/src/battle/action_cmd/unused_mash_a.h @@ -0,0 +1,16 @@ +#ifndef _UNUSED_MASH_A_H_ +#define _UNUSED_MASH_A_H_ + +#include "common_structs.h" + +// args: none +API_CALLABLE(action_command_unused_mash_a_init); + +// args: prep time, duration, difficulty +API_CALLABLE(action_command_unused_mash_a_start); + +void action_command_unused_mash_a_update(void); +void action_command_unused_mash_a_draw(void); +void action_command_unused_mash_a_free(void); + +#endif diff --git a/src/battle/action_cmd/water_block.c b/src/battle/action_cmd/water_block.c deleted file mode 100644 index 6e06e39be8e..00000000000 --- a/src/battle/action_cmd/water_block.c +++ /dev/null @@ -1,643 +0,0 @@ -#include "common.h" -#include "battle/action_cmd.h" -#include "include_asset.h" - -#define NAMESPACE action_command_water_block - -INCLUDE_IMG("battle/action_cmd/water_block_1.png", battle_action_cmd_water_block_1_png); -INCLUDE_PAL("battle/action_cmd/water_block_1.pal", battle_action_cmd_water_block_1_pal); - -INCLUDE_IMG("battle/action_cmd/water_block_2.png", battle_action_cmd_water_block_2_png); -INCLUDE_PAL("battle/action_cmd/water_block_2.pal", battle_action_cmd_water_block_2_pal); - -INCLUDE_IMG("battle/action_cmd/water_block_3.png", battle_action_cmd_water_block_3_png); -INCLUDE_PAL("battle/action_cmd/water_block_3.pal", battle_action_cmd_water_block_3_pal); - -INCLUDE_IMG("battle/action_cmd/water_block_0.png", battle_action_cmd_water_block_0_png); -INCLUDE_PAL("battle/action_cmd/water_block_0.pal", battle_action_cmd_water_block_0_pal); - -INCLUDE_IMG("battle/action_cmd/water_block_block.png", battle_action_cmd_water_block_block_png); -INCLUDE_PAL("battle/action_cmd/water_block_block.pal", battle_action_cmd_water_block_block_pal); - -INCLUDE_IMG("battle/action_cmd/water_block_circle.png", battle_action_cmd_water_block_circle_png); -INCLUDE_PAL("battle/action_cmd/water_block_circle.pal", battle_action_cmd_water_block_circle_pal); - -INCLUDE_IMG("battle/action_cmd/water_block_cloud.png", battle_action_cmd_water_block_cloud_png); -INCLUDE_PAL("battle/action_cmd/water_block_cloud.pal", battle_action_cmd_water_block_cloud_pal); - -INCLUDE_IMG("battle/action_cmd/water_block_4.png", battle_action_cmd_water_block_4_png); -INCLUDE_PAL("battle/action_cmd/water_block_4.pal", battle_action_cmd_water_block_4_pal); - -HudScript HES_WaterBlock1 = { - HUD_ELEMENT_OP_SetVisible, - HUD_ELEMENT_OP_SetTileSize, HUD_ELEMENT_SIZE_24x24, - HUD_ELEMENT_OP_Loop, - HUD_ELEMENT_OP_SetCI, 60, (s32)battle_action_cmd_water_block_1_png, (s32)battle_action_cmd_water_block_1_pal, - 0x00000003, - HUD_ELEMENT_OP_End -}; - -HudScript HES_WaterBlock2 = { - HUD_ELEMENT_OP_SetVisible, - HUD_ELEMENT_OP_SetTileSize, HUD_ELEMENT_SIZE_24x24, - HUD_ELEMENT_OP_Loop, - HUD_ELEMENT_OP_SetCI, 60, (s32)battle_action_cmd_water_block_2_png, (s32)battle_action_cmd_water_block_2_pal, - 0x00000003, - HUD_ELEMENT_OP_End -}; - -HudScript HES_WaterBlock3 = { - HUD_ELEMENT_OP_SetVisible, - HUD_ELEMENT_OP_SetTileSize, HUD_ELEMENT_SIZE_24x24, - HUD_ELEMENT_OP_Loop, - HUD_ELEMENT_OP_SetCI, 60, (s32)battle_action_cmd_water_block_3_png, (s32)battle_action_cmd_water_block_3_pal, - 0x00000003, - HUD_ELEMENT_OP_End -}; - -HudScript HES_WaterBlock0 = { - HUD_ELEMENT_OP_SetVisible, - HUD_ELEMENT_OP_SetTileSize, HUD_ELEMENT_SIZE_24x24, - HUD_ELEMENT_OP_Loop, - HUD_ELEMENT_OP_SetCI, 60, (s32)battle_action_cmd_water_block_0_png, (s32)battle_action_cmd_water_block_0_pal, - 0x00000003, - HUD_ELEMENT_OP_End -}; - -HudScript HES_WaterBlock4 = { - HUD_ELEMENT_OP_SetVisible, - HUD_ELEMENT_OP_SetTileSize, HUD_ELEMENT_SIZE_24x24, - HUD_ELEMENT_OP_Loop, - HUD_ELEMENT_OP_SetCI, 60, (s32)battle_action_cmd_water_block_4_png, (s32)battle_action_cmd_water_block_4_pal, - 0x00000003, - HUD_ELEMENT_OP_End -}; - -HudScript HES_WaterBlockBlock = { - HUD_ELEMENT_OP_SetVisible, - HUD_ELEMENT_OP_SetTileSize, HUD_ELEMENT_SIZE_32x32, - HUD_ELEMENT_OP_Loop, - HUD_ELEMENT_OP_SetCI, 60, (s32)battle_action_cmd_water_block_block_png, (s32)battle_action_cmd_water_block_block_pal, - 0x00000003, - HUD_ELEMENT_OP_End -}; - -HudScript HES_WaterBlockCircle = { - HUD_ELEMENT_OP_SetVisible, - HUD_ELEMENT_OP_SetTileSize, HUD_ELEMENT_SIZE_40x40, - HUD_ELEMENT_OP_Loop, - HUD_ELEMENT_OP_SetCI, 60, (s32)battle_action_cmd_water_block_circle_png, (s32)battle_action_cmd_water_block_circle_pal, - 0x00000003, - HUD_ELEMENT_OP_End -}; - -HudScript HES_WaterBlockCloud = { - HUD_ELEMENT_OP_SetVisible, - HUD_ELEMENT_OP_SetTileSize, HUD_ELEMENT_SIZE_40x40, - HUD_ELEMENT_OP_Loop, - HUD_ELEMENT_OP_SetCI, 60, (s32)battle_action_cmd_water_block_cloud_png, (s32)battle_action_cmd_water_block_cloud_pal, - 0x00000003, - HUD_ELEMENT_OP_End -}; - -HudScript* D_802AB180_42C670[] = { - &HES_WaterBlock0 -}; - -HudScript* D_802AB184_42C674[] = { - &HES_WaterBlock1, &HES_WaterBlock2, &HES_WaterBlock3, &HES_WaterBlock4, &HES_WaterBlock4, &HES_WaterBlock4, &HES_WaterBlock4, &HES_WaterBlock4, &HES_WaterBlock4, 0, 0 -}; - -extern s32 actionCmdTableWaterBlock[]; - -API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - BattleStatus* battleStatus = &gBattleStatus; - Bytecode* args = script->ptrReadPos; - s32 id; - - battleStatus->unk_82 = 5; - battleStatus->actionCmdDifficultyTable = actionCmdTableWaterBlock; - - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; - return ApiStatus_DONE2; - } - - action_command_init_status(); - actionCommandStatus->actionCommandID = ACTION_COMMAND_WATER_BLOCK; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - actionCommandStatus->targetWeakness = evt_get_variable(script, *args++); - battleStatus->actionQuality = 1; - actionCommandStatus->hudPrepareTime = 30; - actionCommandStatus->hudPosX = -48; - actionCommandStatus->hudPosY = 80; - - id = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - - id = hud_element_create(&HES_TimingBar3Chances); - actionCommandStatus->hudElements[1] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_TimingWait); - actionCommandStatus->hudElements[2] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_TimingWait); - actionCommandStatus->hudElements[3] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_TimingWait); - actionCommandStatus->hudElements[4] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_TimingOK); - actionCommandStatus->hudElements[6] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_TimingOK); - actionCommandStatus->hudElements[7] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_TimingOK); - actionCommandStatus->hudElements[8] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - actionCommandStatus->hudElements[10] = hud_element_create(D_802AB184_42C674[0]); - hud_element_set_render_pos(actionCommandStatus->hudElements[10], - actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - - actionCommandStatus->hudElements[11] = hud_element_create(&HES_TimingCharge4c); - hud_element_set_render_pos(actionCommandStatus->hudElements[11], - actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - - id = hud_element_create(&HES_TimingCharge4b); - actionCommandStatus->hudElements[12] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - - switch (actionCommandStatus->targetWeakness) { - case 0: - actionCommandStatus->hudElements[13] = hud_element_create(&HES_WaterBlockBlock); - id = actionCommandStatus->hudElements[13]; - break; - case 1: - actionCommandStatus->hudElements[13] = hud_element_create(&HES_WaterBlockCircle); - id = actionCommandStatus->hudElements[13]; - break; - case 2: - actionCommandStatus->hudElements[13] = hud_element_create(&HES_WaterBlockCloud); - id = actionCommandStatus->hudElements[13]; - break; - } - - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - return ApiStatus_DONE2; -} - -API_CALLABLE(N(start)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - BattleStatus* battleStatus = &gBattleStatus; - Bytecode* args = script->ptrReadPos; - - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; - return ApiStatus_DONE2; - } - - action_command_init_status(); - actionCommandStatus->prepareTime = evt_get_variable(script, *args++); - actionCommandStatus->duration = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = adjust_action_command_difficulty(actionCommandStatus->difficulty); - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - battleStatus->actionQuality = 1; - battleStatus->actionSuccess = 0; - battleStatus->actionResult = ACTION_RESULT_FAIL; - actionCommandStatus->state = 10; - battleStatus->flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; - func_80269118(); - return ApiStatus_DONE2; -} - -void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - BattleStatus* battleStatus = &gBattleStatus; - s32 pos; - s32 i; - s32 limit; - s32 id; - - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); - id = actionCommandStatus->hudElements[0]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); - } - hud_element_set_alpha(id, 255); - id = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); - } - id = actionCommandStatus->hudElements[2]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); - } - id = actionCommandStatus->hudElements[3]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); - } - id = actionCommandStatus->hudElements[4]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); - } - id = actionCommandStatus->hudElements[10]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); - } - id = actionCommandStatus->hudElements[11]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); - } - id = actionCommandStatus->hudElements[12]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); - } - id = actionCommandStatus->hudElements[13]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); - } - actionCommandStatus->state = 1; - break; - case 1: - btl_set_popup_duration(99); - if (actionCommandStatus->hudPrepareTime != 0) { - actionCommandStatus->hudPrepareTime--; - return; - } - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; - } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX + 28, actionCommandStatus->hudPosY + 28); - hud_element_set_render_pos(actionCommandStatus->hudElements[2], actionCommandStatus->hudPosX + 21, actionCommandStatus->hudPosY + 24); - hud_element_set_render_pos(actionCommandStatus->hudElements[3], actionCommandStatus->hudPosX + 41, actionCommandStatus->hudPosY + 24); - hud_element_set_render_pos(actionCommandStatus->hudElements[4], actionCommandStatus->hudPosX + 61, actionCommandStatus->hudPosY + 24); - - id = actionCommandStatus->hudElements[10]; - switch (actionCommandStatus->targetWeakness) { - case 0: - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 91, actionCommandStatus->hudPosY + 7); - break; - case 1: - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 91, actionCommandStatus->hudPosY + 13); - break; - case 2: - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 91, actionCommandStatus->hudPosY + 13); - break; - } - - hud_element_set_render_pos(actionCommandStatus->hudElements[11], actionCommandStatus->hudPosX - 5, actionCommandStatus->hudPosY + 29); - hud_element_set_render_pos(actionCommandStatus->hudElements[12], actionCommandStatus->hudPosX + 7, actionCommandStatus->hudPosY + 29); - hud_element_set_render_pos(actionCommandStatus->hudElements[13], actionCommandStatus->hudPosX + 92, actionCommandStatus->hudPosY + 23); - break; - case 10: - btl_set_popup_duration(99); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; - return; - } - - actionCommandStatus->frameCounter = actionCommandStatus->duration - 60; - if (actionCommandStatus->frameCounter < 42) { - actionCommandStatus->frameCounter = 42; - } - actionCommandStatus->state = 11; - // fallthrough - case 11: - btl_set_popup_duration(99); - if (actionCommandStatus->frameCounter == 42) { - hud_element_set_script(actionCommandStatus->hudElements[11], &HES_TimingCharge3); - sfx_play_sound(SOUND_TIMING_BAR_TICK); - } - if (actionCommandStatus->frameCounter == 22) { - hud_element_set_script(actionCommandStatus->hudElements[12], &HES_TimingCharge2); - sfx_play_sound(SOUND_TIMING_BAR_TICK); - } - if (actionCommandStatus->frameCounter == 2) { - hud_element_set_script(actionCommandStatus->hudElements[2], &HES_TimingReady); - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_AButtonDown); - sfx_play_sound(SOUND_TIMING_BAR_GO); - } - actionCommandStatus->frameCounter--; - if (actionCommandStatus->frameCounter == 0) { - actionCommandStatus->frameCounter = 20; - actionCommandStatus->unk_5D = 0; - actionCommandStatus->state = 12; - actionCommandStatus->unk_5C = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - } - break; - case 12: - btl_set_popup_duration(99); - if (!actionCommandStatus->wrongButtonPressed && (actionCommandStatus->unk_5C == 0) && (actionCommandStatus->unk_5D >= -5)) { - limit = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty * 2] + - battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty * 2 + 1] + - 5; - pos = battleStatus->inputBufferPos; - pos -= limit; - if (pos < 0) { - pos += ARRAY_COUNT(battleStatus->pushInputBuffer); - } - if (limit == 0) { - limit = 1; - } - - for (i = 0; i < limit; pos++, i++) { - if (pos >= ARRAY_COUNT(battleStatus->pushInputBuffer)) { - pos -= ARRAY_COUNT(battleStatus->pushInputBuffer); - } - - if (i < 5 && (battleStatus->pushInputBuffer[pos] & BUTTON_A)) { - actionCommandStatus->wrongButtonPressed = TRUE; - } - - if (((battleStatus->pushInputBuffer[pos] & BUTTON_A) && !actionCommandStatus->wrongButtonPressed) || - actionCommandStatus->autoSucceed) { - actionCommandStatus->unk_5C = 1; - battleStatus->actionQuality++; - break; - } - } - } - - if ((actionCommandStatus->unk_5D >= -4) && (actionCommandStatus->wrongButtonPressed || (actionCommandStatus->unk_5C != 0))) { - id = actionCommandStatus->hudElements[6]; - if (actionCommandStatus->unk_5C != 0) { - hud_element_set_script(id, &HES_TimingOK); - } else { - hud_element_set_script(id, &HES_TimingMiss); - } - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 28, actionCommandStatus->hudPosY + 38); - hud_element_clear_flags(id, 2); - } - - if (actionCommandStatus->unk_5D == -5) { - id = actionCommandStatus->hudElements[6]; - if (actionCommandStatus->unk_5C != 0) { - hud_element_set_script(id, &HES_TimingOK); - } else { - hud_element_set_script(id, &HES_TimingMiss); - } - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 28, actionCommandStatus->hudPosY + 38); - hud_element_clear_flags(id, 2); - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_AButton); - } - actionCommandStatus->unk_5D--; - if (actionCommandStatus->frameCounter == 2) { - hud_element_set_script(actionCommandStatus->hudElements[3], &HES_TimingReady); - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_AButtonDown); - sfx_play_sound(SOUND_TIMING_BAR_GO); - } - actionCommandStatus->frameCounter--; - if (actionCommandStatus->frameCounter == 0) { - actionCommandStatus->frameCounter = 20; - actionCommandStatus->unk_5D = 0; - actionCommandStatus->state = 13; - actionCommandStatus->unk_5C = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - } - break; - case 13: - btl_set_popup_duration(99); - if (!actionCommandStatus->wrongButtonPressed && (actionCommandStatus->unk_5C == 0) && (actionCommandStatus->unk_5D >= -5)) { - limit = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty * 2] + - battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty * 2 + 1] + - 4; - if (limit < 6) { - limit = 6; - } - pos = battleStatus->inputBufferPos; - pos -= limit; - if (pos < 0) { - pos += ARRAY_COUNT(battleStatus->pushInputBuffer); - } - if (limit == 0) { - limit = 1; - } - - for (i = 0; i < limit; pos++, i++) { - if (pos >= ARRAY_COUNT(battleStatus->pushInputBuffer)) { - pos -= ARRAY_COUNT(battleStatus->pushInputBuffer); - } - - if (i < 5) { - if (battleStatus->pushInputBuffer[pos] & BUTTON_A) { - actionCommandStatus->wrongButtonPressed = TRUE; - } - } - - if (((battleStatus->pushInputBuffer[pos] & BUTTON_A) && !actionCommandStatus->wrongButtonPressed) || - actionCommandStatus->autoSucceed) { - actionCommandStatus->unk_5C = 1; - battleStatus->actionQuality++; - break; - } - } - } - - if ((actionCommandStatus->unk_5D >= -4) && (actionCommandStatus->wrongButtonPressed || (actionCommandStatus->unk_5C != 0))) { - id = actionCommandStatus->hudElements[7]; - if (actionCommandStatus->unk_5C != 0) { - hud_element_set_script(id, &HES_TimingOK); - } else { - hud_element_set_script(id, &HES_TimingMiss); - } - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 48, actionCommandStatus->hudPosY + 38); - hud_element_clear_flags(id, 2); - } - if (actionCommandStatus->unk_5D == -5) { - id = actionCommandStatus->hudElements[7]; - if (actionCommandStatus->unk_5C != 0) { - hud_element_set_script(id, &HES_TimingOK); - } else { - hud_element_set_script(id, &HES_TimingMiss); - } - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 48, actionCommandStatus->hudPosY + 38); - hud_element_clear_flags(id, 2); - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_AButton); - } - actionCommandStatus->unk_5D--; - if (actionCommandStatus->frameCounter == 2) { - hud_element_set_script(actionCommandStatus->hudElements[4], &HES_TimingReady); - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_AButtonDown); - sfx_play_sound(SOUND_TIMING_BAR_GO); - } - actionCommandStatus->frameCounter--; - if (actionCommandStatus->frameCounter == 0) { - actionCommandStatus->frameCounter = 20; - actionCommandStatus->unk_5D = 0; - actionCommandStatus->state = 14; - actionCommandStatus->unk_5C = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - } - break; - case 14: - btl_set_popup_duration(99); - if (!actionCommandStatus->wrongButtonPressed && (actionCommandStatus->unk_5C == 0) && (actionCommandStatus->unk_5D >= -5)) { - limit = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty * 2] + - battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty * 2 + 1] + - 3; - if (limit < 6) { - limit = 6; - } - pos = battleStatus->inputBufferPos; - pos -= limit; - if (pos < 0) { - pos += ARRAY_COUNT(battleStatus->pushInputBuffer); - } - if (limit == 0) { - limit = 1; - } - - for (i = 0; i < limit; pos++, i++) { - if (pos >= ARRAY_COUNT(battleStatus->pushInputBuffer)) { - pos -= ARRAY_COUNT(battleStatus->pushInputBuffer); - } - - if (i < 5) { - if (battleStatus->pushInputBuffer[pos] & BUTTON_A) { - actionCommandStatus->wrongButtonPressed = TRUE; - } - } - - if (((battleStatus->pushInputBuffer[pos] & BUTTON_A) && !actionCommandStatus->wrongButtonPressed) || - actionCommandStatus->autoSucceed) { - actionCommandStatus->unk_5C = 1; - battleStatus->actionQuality++; - break; - } - } - } - if (actionCommandStatus->unk_5D >= -4) { - if (actionCommandStatus->wrongButtonPressed || (actionCommandStatus->unk_5C != 0)) { - id = actionCommandStatus->hudElements[8]; - if (actionCommandStatus->unk_5C != 0) { - hud_element_set_script(id, &HES_TimingOK); - } else { - hud_element_set_script(id, &HES_TimingMiss); - } - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 68, actionCommandStatus->hudPosY + 38); - hud_element_clear_flags(id, 2); - } - } - if (actionCommandStatus->unk_5D == -5) { - id = actionCommandStatus->hudElements[8]; - if (actionCommandStatus->unk_5C != 0) { - hud_element_set_script(id, &HES_TimingOK); - } else { - hud_element_set_script(id, &HES_TimingMiss); - } - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 68, actionCommandStatus->hudPosY + 38); - hud_element_clear_flags(id, 2); - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_AButton); - actionCommandStatus->state = 16; - return; - } - actionCommandStatus->unk_5D--; - break; - case 16: - if (battleStatus->actionQuality == 0) { - battleStatus->actionSuccess = -1; - } else { - battleStatus->actionSuccess = battleStatus->actionQuality; - } - battleStatus->actionResult = ACTION_RESULT_SUCCESS; - if (battleStatus->actionSuccess == 3) { - func_80269160(); - } - btl_set_popup_duration(0); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 17; - break; - case 17: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; - return; - } - action_command_free(); - break; - } -} - -void N(draw)(void) { - s32 hudElement; - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; - BattleStatus* battleStatus = &gBattleStatus; - - hud_element_draw_clipped(actionCommandStatus->hudElements[0]); - hud_element_draw_clipped(actionCommandStatus->hudElements[1]); - hud_element_draw_clipped(actionCommandStatus->hudElements[2]); - hud_element_draw_clipped(actionCommandStatus->hudElements[3]); - hud_element_draw_clipped(actionCommandStatus->hudElements[4]); - hud_element_draw_clipped(actionCommandStatus->hudElements[6]); - hud_element_draw_clipped(actionCommandStatus->hudElements[7]); - hud_element_draw_clipped(actionCommandStatus->hudElements[8]); - hud_element_draw_clipped(actionCommandStatus->hudElements[13]); - - hudElement = actionCommandStatus->hudElements[10]; - if (hud_element_get_script(hudElement) != D_802AB180_42C670[battleStatus->actionQuality]) { - hud_element_set_script(hudElement, D_802AB180_42C670[battleStatus->actionQuality]); - } - - hud_element_draw_clipped(hudElement); - hud_element_draw_clipped(actionCommandStatus->hudElements[11]); - hud_element_draw_clipped(actionCommandStatus->hudElements[12]); -} - -void N(free)(void) { - hud_element_free(gActionCommandStatus.hudElements[0]); - hud_element_free(gActionCommandStatus.hudElements[1]); - hud_element_free(gActionCommandStatus.hudElements[2]); - hud_element_free(gActionCommandStatus.hudElements[3]); - hud_element_free(gActionCommandStatus.hudElements[4]); - hud_element_free(gActionCommandStatus.hudElements[6]); - hud_element_free(gActionCommandStatus.hudElements[7]); - hud_element_free(gActionCommandStatus.hudElements[8]); - hud_element_free(gActionCommandStatus.hudElements[10]); - hud_element_free(gActionCommandStatus.hudElements[11]); - hud_element_free(gActionCommandStatus.hudElements[12]); - hud_element_free(gActionCommandStatus.hudElements[13]); -} diff --git a/src/battle/action_cmd/water_block.h b/src/battle/action_cmd/water_block.h deleted file mode 100644 index 68f3b348d20..00000000000 --- a/src/battle/action_cmd/water_block.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _WATER_BLOCK_H_ -#define _WATER_BLOCK_H_ - -#include "common_structs.h" - -API_CALLABLE(action_command_water_block_init); -API_CALLABLE(action_command_water_block_start); -void action_command_water_block_update(void); -void action_command_water_block_draw(void); -void action_command_water_block_free(void); - -#endif diff --git a/src/battle/action_cmd/whirlwind.c b/src/battle/action_cmd/whirlwind.c index f181957014b..d3c2fc0b981 100644 --- a/src/battle/action_cmd/whirlwind.c +++ b/src/battle/action_cmd/whirlwind.c @@ -5,6 +5,20 @@ #define NAMESPACE action_command_whirlwind +extern s32 actionCmdTableWhirlwind[]; + +// indices into ActionCommandStatus::hudElements for this action command +enum { + HIDX_BUTTON = 0, + HIDX_METER = 1, + HIDX_DIGIT = 2, + HIDX_BUBBLE = 3, +}; + +// how much to add to the meter per input +#define HUFF_FILL_TICK 500 +#define BUZZAR_FILL_TICK 600 + INCLUDE_IMG("battle/action_cmd/whirlwind_1.png", battle_action_cmd_whirlwind_1_png); INCLUDE_PAL("battle/action_cmd/whirlwind_1.pal", battle_action_cmd_whirlwind_1_pal); @@ -30,236 +44,238 @@ INCLUDE_IMG("battle/action_cmd/whirlwind_bubble.png", battle_action_cmd_whirlwin INCLUDE_PAL("battle/action_cmd/whirlwind_bubble.pal", battle_action_cmd_whirlwind_bubble_pal); HudScript HES_Whirlwind1 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_1, 24, 24); - HudScript HES_Whirlwind2 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_2, 24, 24); - HudScript HES_Whirlwind3 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_3, 24, 24); - HudScript HES_Whirlwind4 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_4, 24, 24); - HudScript HES_Whirlwind5 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_5, 24, 24); - HudScript HES_Whirlwind6 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_6, 24, 24); - HudScript HES_Whirlwind7 = HES_TEMPLATE_CI_ENUM_SIZE(battle_action_cmd_whirlwind_7, 24, 24); HudScript HES_WhirlwindBubble = HES_TEMPLATE_CI_CUSTOM_SIZE(battle_action_cmd_whirlwind_bubble, battle_action_cmd_whirlwind_bubble_png_width, battle_action_cmd_whirlwind_bubble_png_height); -s32 D_802AA844_4254B4[] = { 0, 25, 50, 75, 100, 100 }; +s32 N(DrainRateTable0)[] = { 0, 25, 50, 75, 100, 100 }; +s32 N(DrainRateTable1)[] = { 50, 50, 50, 50, 75, 75, 75, 100, 100, 100, 100 }; -s32 D_802AA85C_4254CC[] = { 50, 50, 50, 50, 75, 75, 75, 100, 100, 100, 100 }; +// bug: the final entry is not accessible due to the way idx is calculated in these macros +#define GET_DRAIN_RATE_HUFF(pct) (N(DrainRateTable0)[((pct) / (ONE_PCT_MASH / 5))]) +#define GET_DRAIN_RATE_BUZZAR(pct) (N(DrainRateTable1)[((pct) / (ONE_PCT_MASH / 10))]) -HudScript* D_802AA888_4254F8[] = { +HudScript* N(HuffDigits)[] = { &HES_Whirlwind7, &HES_Whirlwind6, &HES_Whirlwind5, &HES_Whirlwind4, &HES_Whirlwind3, &HES_Whirlwind2 }; -HudScript* D_802AA8A0_425510[] = { +HudScript* N(BuzzarDigits)[] = { &HES_Whirlwind1, &HES_Whirlwind1, &HES_Whirlwind2, &HES_Whirlwind3, &HES_Whirlwind3 }; -s32 D_802AA8B4_425524[] = { 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1 }; - -extern s32 actionCmdTableWhirlwind[]; +s32 N(BuzzarQuality)[] = { 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1 }; API_CALLABLE(N(init)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Bytecode* args = script->ptrReadPos; - s16 temp_v0; - s32 id; + HudElemID hid; - battleStatus->unk_82 = 5; + battleStatus->maxActionQuality = 5; battleStatus->actionCmdDifficultyTable = actionCmdTableWhirlwind; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->targetWeakness = evt_get_variable(script, *args++); - actionCommandStatus->actionCommandID = ACTION_COMMAND_WHIRLWIND; - actionCommandStatus->state = 0; - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - if (actionCommandStatus->targetWeakness == 0) { - battleStatus->actionQuality = 0; + acs->variation = evt_get_variable(script, *args++); + acs->actionCommandID = ACTION_COMMAND_WHIRLWIND; + acs->state = AC_STATE_INIT; + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + if (acs->variation == ACV_WHIRLWIND_HUFF) { + battleStatus->actionProgress = 0; } else { - battleStatus->actionQuality = 3; + battleStatus->actionProgress = 3; } - actionCommandStatus->hudPosX = -48; - actionCommandStatus->hudPosY = 80; - - id = hud_element_create(&HES_AButton); - actionCommandStatus->hudElements[0] = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_depth(id, 0); - - id = hud_element_create(&HES_BlueMeter); - actionCommandStatus->hudElements[1] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_Whirlwind7); - actionCommandStatus->hudElements[2] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 54, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - id = hud_element_create(&HES_WhirlwindBubble); - actionCommandStatus->hudElements[3] = id; - hud_element_set_render_pos(id, actionCommandStatus->hudPosX + 60, actionCommandStatus->hudPosY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + acs->hudPosX = -48; + acs->hudPosY = 80; + + hid = hud_element_create(&HES_AButton); + acs->hudElemIDs[HIDX_BUTTON] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY); + hud_element_set_render_depth(hid, 0); + + hid = hud_element_create(&HES_BlueMeter); + acs->hudElemIDs[HIDX_METER] = hid; + hud_element_set_render_pos(hid, acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_Whirlwind7); + acs->hudElemIDs[HIDX_DIGIT] = hid; + hud_element_set_render_pos(hid, acs->hudPosX + 54, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_WhirlwindBubble); + acs->hudElemIDs[HIDX_BUBBLE] = hid; + hud_element_set_render_pos(hid, acs->hudPosX + 60, acs->hudPosY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); return ApiStatus_DONE2; } API_CALLABLE(N(start)) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; Bytecode* args = script->ptrReadPos; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { - battleStatus->actionSuccess = 0; + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { + battleStatus->actionQuality = 0; return ApiStatus_DONE2; } action_command_init_status(); - actionCommandStatus->prepareTime = evt_get_variable(script, *args++); - actionCommandStatus->duration = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = evt_get_variable(script, *args++); - actionCommandStatus->difficulty = adjust_action_command_difficulty(actionCommandStatus->difficulty); - actionCommandStatus->wrongButtonPressed = FALSE; - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->barFillWidth = 0; - battleStatus->actionSuccess = 0; + + acs->prepareTime = evt_get_variable(script, *args++); + acs->duration = evt_get_variable(script, *args++); + acs->difficulty = evt_get_variable(script, *args++); + acs->difficulty = adjust_action_command_difficulty(acs->difficulty); + + acs->wrongButtonPressed = FALSE; + acs->meterFillLevel = 0; + acs->meterFillWidth = 0; + battleStatus->actionQuality = 0; battleStatus->actionResult = ACTION_RESULT_FAIL; - if (actionCommandStatus->targetWeakness == 0) { - battleStatus->actionQuality = 0; + if (acs->variation == ACV_WHIRLWIND_HUFF) { + battleStatus->actionProgress = 0; } else { - battleStatus->actionQuality = 3; + battleStatus->actionProgress = 3; } - actionCommandStatus->state = 10; + acs->state = AC_STATE_START; gBattleStatus.flags1 &= ~BS_FLAGS1_FREE_ACTION_COMMAND; + return ApiStatus_DONE2; } void N(update)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; s32 cutoff; - s32 temp; + s32 fillPct; s32 amt; - switch (actionCommandStatus->state) { - case 0: - btl_set_popup_duration(99); + switch (acs->state) { + case AC_STATE_INIT: + btl_set_popup_duration(POPUP_MSG_ON); - id = actionCommandStatus->hudElements[0]; - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_BUTTON]; + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_set_alpha(id, 255); + hud_element_set_alpha(hid, 255); - id = actionCommandStatus->hudElements[1]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - id = actionCommandStatus->hudElements[2]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_DIGIT]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - id = actionCommandStatus->hudElements[3]; - hud_element_set_alpha(id, 255); - if (actionCommandStatus->showHud) { - hud_element_clear_flags(id, 2); + hid = acs->hudElemIDs[HIDX_BUBBLE]; + hud_element_set_alpha(hid, 255); + if (acs->showHud) { + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - actionCommandStatus->state = 1; + acs->state = AC_STATE_APPEAR; break; - case 1: - btl_set_popup_duration(99); - actionCommandStatus->hudPosX += 20; - if (actionCommandStatus->hudPosX > 50) { - actionCommandStatus->hudPosX = 50; + case AC_STATE_APPEAR: + btl_set_popup_duration(POPUP_MSG_ON); + acs->hudPosX += 20; + if (acs->hudPosX > 50) { + acs->hudPosX = 50; } - hud_element_set_render_pos(actionCommandStatus->hudElements[0], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY); - hud_element_set_render_pos(actionCommandStatus->hudElements[1], actionCommandStatus->hudPosX, actionCommandStatus->hudPosY + 28); - hud_element_set_render_pos(actionCommandStatus->hudElements[2], actionCommandStatus->hudPosX + 54, actionCommandStatus->hudPosY + 23); - hud_element_set_render_pos(actionCommandStatus->hudElements[3], actionCommandStatus->hudPosX + 60, actionCommandStatus->hudPosY + 23); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUTTON], acs->hudPosX, acs->hudPosY); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_METER], acs->hudPosX, acs->hudPosY + 28); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_DIGIT], acs->hudPosX + 54, acs->hudPosY + 23); + hud_element_set_render_pos(acs->hudElemIDs[HIDX_BUBBLE], acs->hudPosX + 60, acs->hudPosY + 23); break; - case 10: - btl_set_popup_duration(99); - if (actionCommandStatus->prepareTime != 0) { - actionCommandStatus->prepareTime--; + case AC_STATE_START: + btl_set_popup_duration(POPUP_MSG_ON); + if (acs->prepareTime != 0) { + acs->prepareTime--; return; } - hud_element_set_script(actionCommandStatus->hudElements[0], &HES_MashAButton); - actionCommandStatus->barFillLevel = 0; - actionCommandStatus->state = 11; - actionCommandStatus->frameCounter = actionCommandStatus->duration; - case 11: - btl_set_popup_duration(99); - cutoff = actionCommandStatus->mashMeterCutoffs[actionCommandStatus->mashMeterIntervals]; - temp = actionCommandStatus->barFillLevel / cutoff; - if (actionCommandStatus->targetWeakness == 0) { - amt = D_802AA844_4254B4[temp / 20]; + hud_element_set_script(acs->hudElemIDs[HIDX_BUTTON], &HES_MashAButton); + acs->meterFillLevel = 0; + acs->state = AC_STATE_ACTIVE; + acs->stateTimer = acs->duration; + + // fallthrough + case AC_STATE_ACTIVE: + btl_set_popup_duration(POPUP_MSG_ON); + + // apply meter draining every frame + cutoff = acs->mashMeterCutoffs[acs->mashMeterNumIntervals]; + fillPct = acs->meterFillLevel / cutoff; + if (acs->variation == ACV_WHIRLWIND_HUFF) { + amt = GET_DRAIN_RATE_HUFF(fillPct); } else { - amt = D_802AA85C_4254CC[temp / 10]; + amt = GET_DRAIN_RATE_BUZZAR(fillPct); } - actionCommandStatus->barFillLevel -= amt; + acs->meterFillLevel -= amt; - if (actionCommandStatus->barFillLevel < 0) { - actionCommandStatus->barFillLevel = 0; + if (acs->meterFillLevel < 0) { + acs->meterFillLevel = 0; } - if (!actionCommandStatus->berserkerEnabled) { + // check for meter-filling input + if (!acs->berserkerEnabled) { if (battleStatus->curButtonsPressed & BUTTON_A) { - s32 amt; - - if (actionCommandStatus->targetWeakness == 0) { - amt = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 5; + if (acs->variation == ACV_WHIRLWIND_HUFF) { + amt = SCALE_BY_PCT(HUFF_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]); } else { - amt = battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] * 6; + amt = SCALE_BY_PCT(BUZZAR_FILL_TICK, battleStatus->actionCmdDifficultyTable[acs->difficulty]); } - actionCommandStatus->barFillLevel += amt; + acs->meterFillLevel += amt; } } else { - actionCommandStatus->barFillLevel += battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] / 4; - actionCommandStatus->barFillLevel += rand_int(battleStatus->actionCmdDifficultyTable[actionCommandStatus->difficulty] / 4); + acs->meterFillLevel += SCALE_BY_PCT(25, battleStatus->actionCmdDifficultyTable[acs->difficulty]); + acs->meterFillLevel += rand_int(SCALE_BY_PCT(25, battleStatus->actionCmdDifficultyTable[acs->difficulty])); } - if (actionCommandStatus->barFillLevel > cutoff * 100) { - actionCommandStatus->barFillLevel = cutoff * 100; + // cap meter to maximum fill level + if (acs->meterFillLevel > cutoff * 100) { + acs->meterFillLevel = cutoff * 100; } - if (!actionCommandStatus->targetWeakness) { - battleStatus->actionQuality = actionCommandStatus->barFillLevel / 2000; + + if (acs->variation == ACV_WHIRLWIND_HUFF) { + battleStatus->actionProgress = (acs->meterFillLevel / ONE_PCT_MASH) / 20; } else { - battleStatus->actionQuality = D_802AA8B4_425524[actionCommandStatus->barFillLevel / 1000]; + battleStatus->actionProgress = N(BuzzarQuality)[(acs->meterFillLevel / ONE_PCT_MASH) / 10]; } - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; + if (acs->stateTimer != 0) { + acs->stateTimer--; return; } battleStatus->actionResult = ACTION_RESULT_NONE; - battleStatus->actionSuccess = battleStatus->actionQuality; - btl_set_popup_duration(0); - actionCommandStatus->frameCounter = 5; - actionCommandStatus->state = 12; + battleStatus->actionQuality = battleStatus->actionProgress; + btl_set_popup_duration(POPUP_MSG_OFF); + acs->stateTimer = 5; + acs->state = AC_STATE_DISPOSE; break; - case 12: - if (actionCommandStatus->frameCounter != 0) { - actionCommandStatus->frameCounter--; + case AC_STATE_DISPOSE: + if (acs->stateTimer != 0) { + acs->stateTimer--; return; } action_command_free(); @@ -268,36 +284,37 @@ void N(update)(void) { } void N(draw)(void) { - ActionCommandStatus* actionCommandStatus = &gActionCommandStatus; + ActionCommandStatus* acs = &gActionCommandStatus; BattleStatus* battleStatus = &gBattleStatus; - s32 x, y; - s32 id; + s32 hudX, hudY; + HudElemID hid; - if (!actionCommandStatus->berserkerEnabled) { - hud_element_draw_clipped(actionCommandStatus->hudElements[0]); + if (!acs->berserkerEnabled) { + hud_element_draw_clipped(acs->hudElemIDs[HIDX_BUTTON]); } - id = actionCommandStatus->hudElements[1]; - hud_element_draw_clipped(id); - hud_element_get_render_pos(id, &x, &y); - - draw_mash_meter_multicolor_with_divisor(x, y, actionCommandStatus->barFillLevel / 100, 1); - hud_element_draw_clipped(actionCommandStatus->hudElements[3]); - id = actionCommandStatus->hudElements[2]; - if (!actionCommandStatus->targetWeakness) { - if (D_802AA888_4254F8[battleStatus->actionQuality] != hud_element_get_script(id)) { - hud_element_set_script(id, D_802AA888_4254F8[battleStatus->actionQuality]); + hid = acs->hudElemIDs[HIDX_METER]; + hud_element_draw_clipped(hid); + hud_element_get_render_pos(hid, &hudX, &hudY); + + draw_mash_meter_multicolor_with_divisor(hudX, hudY, acs->meterFillLevel / ONE_PCT_MASH, 1); + hud_element_draw_clipped(acs->hudElemIDs[HIDX_BUBBLE]); + + hid = acs->hudElemIDs[HIDX_DIGIT]; + if (acs->variation == ACV_WHIRLWIND_HUFF) { + if (N(HuffDigits)[battleStatus->actionProgress] != hud_element_get_script(hid)) { + hud_element_set_script(hid, N(HuffDigits)[battleStatus->actionProgress]); } } else { - if (D_802AA8A0_425510[battleStatus->actionQuality] != hud_element_get_script(id)) { - hud_element_set_script(id, D_802AA8A0_425510[battleStatus->actionQuality]); + if (N(BuzzarDigits)[battleStatus->actionProgress] != hud_element_get_script(hid)) { + hud_element_set_script(hid, N(BuzzarDigits)[battleStatus->actionProgress]); } } - hud_element_draw_clipped(id); + hud_element_draw_clipped(hid); } void N(free)(void) { - hud_element_free(gActionCommandStatus.hudElements[0]); - hud_element_free(gActionCommandStatus.hudElements[1]); - hud_element_free(gActionCommandStatus.hudElements[2]); - hud_element_free(gActionCommandStatus.hudElements[3]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_BUTTON]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_METER]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_DIGIT]); + hud_element_free(gActionCommandStatus.hudElemIDs[HIDX_BUBBLE]); } diff --git a/src/battle/action_cmd/whirlwind.h b/src/battle/action_cmd/whirlwind.h index 5f91dce34b9..532ab62b627 100644 --- a/src/battle/action_cmd/whirlwind.h +++ b/src/battle/action_cmd/whirlwind.h @@ -3,10 +3,19 @@ #include "common_structs.h" +// args: variation API_CALLABLE(action_command_whirlwind_init); + +// args: prep time, duration, difficulty API_CALLABLE(action_command_whirlwind_start); + void action_command_whirlwind_update(void); void action_command_whirlwind_draw(void); void action_command_whirlwind_free(void); +enum { + ACV_WHIRLWIND_HUFF = 0, + ACV_WHIRLWIND_BUZZAR = 1, +}; + #endif diff --git a/src/battle/actor_api.c b/src/battle/actor_api.c index dc54a46b48c..ad9f9dc5a56 100644 --- a/src/battle/actor_api.c +++ b/src/battle/actor_api.c @@ -179,7 +179,6 @@ API_CALLABLE(LoadBattleSection) { return ApiStatus_DONE1; } - API_CALLABLE(GetBattlePhase) { evt_set_variable(script, *script->ptrReadPos, gBattleStatus.battlePhase); return ApiStatus_DONE2; @@ -235,7 +234,7 @@ API_CALLABLE(SetIdleGoalToHome) { } API_CALLABLE(SetGoalToIndex) { - s32* args = script->ptrReadPos; + Bytecode* args = script->ptrReadPos; s32 actorID = evt_get_variable(script, *args++); s32 index = evt_get_variable(script, *args++); Actor* actor; @@ -2040,7 +2039,7 @@ API_CALLABLE(SetActorStatusOffsets) { API_CALLABLE(SummonEnemy) { BattleStatus* battleStatus = &gBattleStatus; - s32* args = script->ptrReadPos; + Bytecode* args = script->ptrReadPos; Actor* actor1; Actor* actor2; s16* enemyIDs; @@ -2767,7 +2766,7 @@ API_CALLABLE(ModifyActorDecoration) { API_CALLABLE(UseIdleAnimation) { Actor* actor; - s32* args = script->ptrReadPos; + Bytecode* args = script->ptrReadPos; s32 actorID = evt_get_variable(script, *args++); s32 useIdle = evt_get_variable(script, *args++); @@ -2940,7 +2939,7 @@ API_CALLABLE(RemovePlayerBuffs) { API_CALLABLE(SetPartAlpha) { Actor* actor; - s32* args = script->ptrReadPos; + Bytecode* args = script->ptrReadPos; s32 actorID = evt_get_variable(script, *args++); s32 partID = evt_get_variable(script, *args++); s32 opacity = evt_get_variable(script, *args++); diff --git a/src/battle/actor_rendering.c b/src/battle/actor_rendering.c index bec342bae0c..45f2e29a02b 100644 --- a/src/battle/actor_rendering.c +++ b/src/battle/actor_rendering.c @@ -3442,7 +3442,7 @@ void part_glow_on(b32 isNpcSprite, ActorPart* part, s32 yaw, b32 isReflection) { } if (!isReflection) { - decorations->glowUnk3 -= 1; + decorations->glowUnk3--; } } diff --git a/src/battle/area/flo2/actor/huff_n_puff.c b/src/battle/area/flo2/actor/huff_n_puff.c index 034dfcf2096..7d02186cfc9 100644 --- a/src/battle/area/flo2/actor/huff_n_puff.c +++ b/src/battle/area/flo2/actor/huff_n_puff.c @@ -1819,11 +1819,11 @@ EvtScript N(EVS_Move_HurricaneBreath) = { Call(ShowMessageBox, BTL_MSG_ACTION_TIP_MASH_BUTTON, 180) Call(ShowActionHud, TRUE) Call(LoadActionCommand, ACTION_COMMAND_WHIRLWIND) - Call(action_command_whirlwind_init, 0) + Call(action_command_whirlwind_init, ACV_WHIRLWIND_HUFF) Call(SetupMashMeter, 5, 20, 40, 60, 80, 100) Wait(10) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) - Call(action_command_whirlwind_start, 0, 200 * DT, 3) + Call(action_command_whirlwind_start, 0, 200 * DT, AC_DIFFICULTY_3) Thread Call(GetActorVar, ACTOR_SELF, AVAR_ScaleX, LVar2) Set(LVar3, LVar2) @@ -1891,7 +1891,7 @@ EvtScript N(EVS_Move_HurricaneBreath) = { IfEq(LVar1, 1) Goto(10) EndIf - Call(GetActionQuality, LVar1) + Call(GetActionProgress, LVar1) Else Thread Call(GetActorVar, ACTOR_SELF, AVAR_ScaleX, LVar2) @@ -2987,7 +2987,7 @@ EvtScript N(EVS_Attack_TuffPuffSwarm) = { Call(SetupMashMeter, 1, 25, 0, 0, 0, 0) Wait(10) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) - Call(action_command_stop_leech_start, 0, 32767, 3) + Call(action_command_stop_leech_start, 0, AC_LEECH_MAX_TIME, AC_DIFFICULTY_3) Set(LVarB, LVarA) Div(LVarB, 2) Wait(LVarB) @@ -3004,29 +3004,29 @@ EvtScript N(EVS_Attack_TuffPuffSwarm) = { Call(EnemyDamageTarget, ACTOR_SELF, LVarA, DAMAGE_TYPE_UNBLOCKABLE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT, 0, 0, 2, BS_FLAGS1_NICE_HIT) Add(LVarD, 1) EndIf - Call(GetActionSuccessCopy, LVar0) + Call(GetMashActionQuality, LVar0) IfEq(LVar0, 1) BreakLoop EndIf Call(GetLastDamage, ACTOR_PLAYER, LVar0) IfEq(LVar0, 0) IfGt(LVarD, 1) - Call(func_80269470) + Call(InterruptLeechActionCommand) BreakLoop EndIf EndIf Call(GetPlayerHP, LVar0) IfEq(LVar0, 0) - Call(func_80269470) + Call(InterruptLeechActionCommand) BreakLoop EndIf IfGe(LVarD, 20) - Call(func_80269470) + Call(InterruptLeechActionCommand) BreakLoop EndIf Wait(1) EndLoop - Call(func_80269470) + Call(InterruptLeechActionCommand) EndIf Switch(LVarA) CaseOrEq(HIT_RESULT_HIT) diff --git a/src/battle/area/hos/actor/goombario_tutor.c b/src/battle/area/hos/actor/goombario_tutor.c index aaa21cecc7c..5f8f0560a8d 100644 --- a/src/battle/area/hos/actor/goombario_tutor.c +++ b/src/battle/area/hos/actor/goombario_tutor.c @@ -210,7 +210,7 @@ EvtScript N(EVS_TakeTurn) = { Call(action_command_jump_init) Call(ShowActionHud, TRUE) Wait(10) - Call(action_command_jump_start, 12, 3) + Call(action_command_jump_start, 12, AC_DIFFICULTY_3) EndThread Call(PlaySound, SOUND_ACTOR_JUMP) Call(JumpToGoal, ACTOR_SELF, 22, FALSE, TRUE, FALSE) @@ -220,11 +220,11 @@ EvtScript N(EVS_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(1.3), Float(0.5), Float(1.0)) Wait(1) Call(GetActionCommandMode, LVar0) - IfEq(LVar0, ACTION_COMMAND_MODE_TUTORIAL) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_TUTORIAL_WAIT_INPUT) + IfEq(LVar0, AC_MODE_TUTORIAL) + Call(SetActionCommandMode, AC_MODE_TUTORIAL_WAIT_INPUT) Loop(0) Call(GetActionCommandMode, LVar0) - IfLt(LVar0, ACTION_COMMAND_MODE_TUTORIAL) + IfLt(LVar0, AC_MODE_TUTORIAL) BreakLoop EndIf Wait(1) @@ -236,7 +236,7 @@ EvtScript N(EVS_TakeTurn) = { EndIf Wait(2) Call(EnemyDamageTarget, ACTOR_SELF, LVar0, 0, 0, 0, 1, BS_FLAGS1_TRIGGER_EVENTS) - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Set(LVarF, LVar0) Switch(LVarF) CaseOrEq(HIT_RESULT_HIT) @@ -303,7 +303,7 @@ EvtScript N(EVS_ManageTutorial) = { Call(ActorSpeak, MSG_HOS_0019, ACTOR_PARTNER, 1, ANIM_Twink_Talk, ANIM_Twink_Fly) Call(UseIdleAnimation, ACTOR_PARTNER, TRUE) Call(SetBattleMenuEnabledFlags, BTL_MENU_ENABLED_JUMP) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_TUTORIAL) + Call(SetActionCommandMode, AC_MODE_TUTORIAL) Call(WaitForState, BATTLE_STATE_PLAYER_MOVE) Call(UseBattleCamPreset, BTL_CAM_DEFAULT) Wait(15) @@ -312,7 +312,7 @@ EvtScript N(EVS_ManageTutorial) = { Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) Call(ActorSpeak, MSG_HOS_001A, ACTOR_PARTNER, 1, ANIM_Twink_Talk, ANIM_Twink_Fly) Call(UseIdleAnimation, ACTOR_PARTNER, TRUE) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_LEARNED) + Call(SetActionCommandMode, AC_MODE_LEARNED) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) Call(SetMessageBoxDuration, -1) Thread @@ -324,12 +324,12 @@ EvtScript N(EVS_ManageTutorial) = { Wait(15) Call(SetGoalToHome, ACTOR_PARTNER) Call(FlyToGoal, ACTOR_PARTNER, 20, 20, EASING_COS_IN_OUT) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_TUTORIAL) + Call(SetActionCommandMode, AC_MODE_TUTORIAL) Call(WaitForState, BATTLE_STATE_0) Call(SetBattleFlagBits2, BS_FLAGS2_DOING_JUMP_TUTORIAL, TRUE) Loop(0) Call(GetActionCommandMode, LVar0) - IfNe(LVar0, ACTION_COMMAND_MODE_TUTORIAL) + IfNe(LVar0, AC_MODE_TUTORIAL) BreakLoop EndIf Wait(1) @@ -354,7 +354,7 @@ EvtScript N(EVS_ManageTutorial) = { Call(EndActorSpeech, ACTOR_PARTNER, 1, ANIM_Twink_Talk, ANIM_Twink_Fly) Call(UseIdleAnimation, ACTOR_PARTNER, TRUE) Call(SetActionSuccess, 1) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_LEARNED) + Call(SetActionCommandMode, AC_MODE_LEARNED) Call(WaitForState, BATTLE_STATE_BEGIN_PARTNER_TURN) Call(UseBattleCamPreset, BTL_CAM_DEFAULT) Wait(15) @@ -368,11 +368,11 @@ EvtScript N(EVS_ManageTutorial) = { Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) Call(ActorSpeak, MSG_HOS_001E, ACTOR_ENEMY0, 1, ANIM_BattleGoombario_Talk, ANIM_BattleGoombario_Idle) Call(UseIdleAnimation, ACTOR_PARTNER, TRUE) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_TUTORIAL) + Call(SetActionCommandMode, AC_MODE_TUTORIAL) Call(WaitForState, BATTLE_STATE_0) Loop(0) Call(GetActionCommandMode, LVar0) - IfNe(LVar0, ACTION_COMMAND_MODE_TUTORIAL) + IfNe(LVar0, AC_MODE_TUTORIAL) BreakLoop EndIf Wait(1) @@ -396,17 +396,17 @@ EvtScript N(EVS_ManageTutorial) = { Call(EndActorSpeech, ACTOR_PARTNER, 1, ANIM_Twink_Talk, ANIM_Twink_Fly) Call(UseIdleAnimation, ACTOR_PARTNER, TRUE) Call(SetActionSuccess, 1) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_TUTORIAL_BLOCK) + Call(SetActionCommandMode, AC_MODE_TUTORIAL_BLOCK) Call(WaitForState, BATTLE_STATE_END_TURN) Call(UseBattleCamPreset, BTL_CAM_DEFAULT) Wait(15) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_LEARNED) + Call(SetActionCommandMode, AC_MODE_LEARNED) Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) Call(ActorSpeak, MSG_HOS_0020, ACTOR_PARTNER, 1, ANIM_Twink_Talk, ANIM_Twink_Fly) Call(UseIdleAnimation, ACTOR_PARTNER, TRUE) Call(WaitForState, BATTLE_STATE_PLAYER_MENU) Call(SetBattleMenuEnabledFlags, BTL_MENU_ENABLED_SMASH) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_TUTORIAL) + Call(SetActionCommandMode, AC_MODE_TUTORIAL) Call(WaitForState, BATTLE_STATE_PLAYER_MOVE) Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) Call(ActorSpeak, MSG_HOS_0022, ACTOR_PARTNER, 1, ANIM_Twink_Talk, ANIM_Twink_Fly) @@ -426,18 +426,18 @@ EvtScript N(EVS_ManageTutorial) = { EndLoop Call(EndActorSpeech, ACTOR_PARTNER, 1, ANIM_Twink_Talk, ANIM_Twink_Fly) Call(UseIdleAnimation, ACTOR_PARTNER, TRUE) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_LEARNED) + Call(SetActionCommandMode, AC_MODE_LEARNED) Call(WaitForState, BATTLE_STATE_0) Wait(5) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_TUTORIAL) + Call(SetActionCommandMode, AC_MODE_TUTORIAL) Loop(0) Call(GetActionCommandMode, LVar0) - IfNe(LVar0, ACTION_COMMAND_MODE_TUTORIAL) + IfNe(LVar0, AC_MODE_TUTORIAL) BreakLoop EndIf Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0) IfEq(LVar0, 0) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_TUTORIAL_BLOCK) + Call(SetActionCommandMode, AC_MODE_TUTORIAL_BLOCK) Call(PauseTakeTurn, ACTOR_PLAYER) Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) Call(ActorSpeak, MSG_HOS_0023, ACTOR_PARTNER, 1, ANIM_Twink_Talk, ANIM_Twink_Fly) @@ -450,13 +450,13 @@ EvtScript N(EVS_ManageTutorial) = { EndLoop Call(EndActorSpeech, ACTOR_PARTNER, 1, ANIM_Twink_Talk, ANIM_Twink_Fly) Call(UseIdleAnimation, ACTOR_PARTNER, TRUE) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_TUTORIAL) + Call(SetActionCommandMode, AC_MODE_TUTORIAL) Call(ResumeTakeTurn, ACTOR_PLAYER) EndIf Wait(1) EndLoop Loop(0) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) IfEq(LVar0, 3) BreakLoop EndIf @@ -474,7 +474,7 @@ EvtScript N(EVS_ManageTutorial) = { Call(EndActorSpeech, ACTOR_PARTNER, 1, ANIM_Twink_Talk, ANIM_Twink_Fly) Call(UseIdleAnimation, ACTOR_PARTNER, TRUE) Call(SetActionSuccess, 1) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_LEARNED) + Call(SetActionCommandMode, AC_MODE_LEARNED) Call(WaitForState, BATTLE_STATE_BEGIN_PARTNER_TURN) Call(UseBattleCamPreset, BTL_CAM_DEFAULT) Wait(15) @@ -497,16 +497,16 @@ EvtScript N(EVS_ManageTutorial) = { Call(SetBattleFlagBits2, BS_FLAGS2_DOING_JUMP_TUTORIAL, FALSE) Label(10) Call(SetBattleMenuEnabledFlags, BTL_MENU_ENABLED_JUMP | BTL_MENU_ENABLED_SMASH | BTL_MENU_ENABLED_STRATEGIES) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_TUTORIAL) + Call(SetActionCommandMode, AC_MODE_TUTORIAL) Call(WaitForState, BATTLE_STATE_PLAYER_MOVE) Call(GetMenuSelection, LVar0, LVar1, LVar2) IfEq(LVar0, BTL_MENU_TYPE_STRATEGIES) Goto(99) EndIf - Call(SetActionCommandMode, ACTION_COMMAND_MODE_LEARNED) + Call(SetActionCommandMode, AC_MODE_LEARNED) Call(WaitForState, BATTLE_STATE_BEGIN_PARTNER_TURN) Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) - Call(GetActionResult, LVar0) + Call(GetJumpActionQuality, LVar0) Switch(LVar0) CaseEq(ACTION_RESULT_EARLY) Call(ActorSpeak, MSG_HOS_002A, ACTOR_PARTNER, 1, ANIM_Twink_Talk, ANIM_Twink_Fly) @@ -518,7 +518,7 @@ EvtScript N(EVS_ManageTutorial) = { Call(UseIdleAnimation, ACTOR_PARTNER, TRUE) Call(SetEnemyHP, ACTOR_ENEMY0, 99) Call(SetActorFlagBits, ACTOR_ENEMY0, ACTOR_FLAG_NO_ATTACK, FALSE) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_LEARNED) + Call(SetActionCommandMode, AC_MODE_LEARNED) Call(WaitForState, BATTLE_STATE_END_TURN) Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) Call(GetBlockResult, LVar0) diff --git a/src/battle/area/iwa/actor/buzzar.c b/src/battle/area/iwa/actor/buzzar.c index 5df6b854022..4b651b62ee9 100644 --- a/src/battle/area/iwa/actor/buzzar.c +++ b/src/battle/area/iwa/actor/buzzar.c @@ -386,7 +386,7 @@ EvtScript N(EVS_Attack_WindBlast) = { Call(ShowMessageBox, BTL_MSG_ACTION_TIP_REDUCE_DAMAGE, 90) Call(ShowActionHud, TRUE) Call(LoadActionCommand, ACTION_COMMAND_WHIRLWIND) - Call(action_command_whirlwind_init, 1) + Call(action_command_whirlwind_init, ACV_WHIRLWIND_BUZZAR) Call(SetupMashMeter, 3, 40, 70, 100, 0, 0) Wait(8) Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Buzzar_Anim11) @@ -395,7 +395,7 @@ EvtScript N(EVS_Attack_WindBlast) = { Wait(6) Call(PlaySoundAtActor, ACTOR_SELF, SOUND_BUZZAR_WHIRLWIND) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) - Call(action_command_whirlwind_start, 0, 88 * DT, 3) + Call(action_command_whirlwind_start, 0, 88 * DT, AC_DIFFICULTY_3) Call(UseBattleCamPreset, BTL_CAM_REPOSITION) Call(SetBattleCamTarget, -25, 60, 0) Call(SetBattleCamDist, 460) @@ -430,7 +430,7 @@ EvtScript N(EVS_Attack_WindBlast) = { EndThread EndIf Wait(90) - Call(GetActionQuality, LVar1) + Call(GetActionProgress, LVar1) Call(ActorExists, ACTOR_PARTNER, LVar0) IfEq(LVar0, TRUE) Wait(3) @@ -451,7 +451,7 @@ EvtScript N(EVS_Attack_WindBlast) = { Call(ShowMessageBox, BTL_MSG_ACTION_TIP_REDUCE_DAMAGE, 90) Call(ShowActionHud, TRUE) Call(LoadActionCommand, ACTION_COMMAND_WHIRLWIND) - Call(action_command_whirlwind_init, 1) + Call(action_command_whirlwind_init, ACV_WHIRLWIND_BUZZAR) Call(SetupMashMeter, 3, 40, 70, 100, 0, 0) Wait(8) Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Buzzar_Anim11) @@ -460,7 +460,7 @@ EvtScript N(EVS_Attack_WindBlast) = { Wait(6) Call(PlaySoundAtActor, ACTOR_SELF, SOUND_BUZZAR_WHIRLWIND) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) - Call(action_command_whirlwind_start, 0, 88 * DT, 3) + Call(action_command_whirlwind_start, 0, 88 * DT, AC_DIFFICULTY_3) Call(UseBattleCamPreset, BTL_CAM_REPOSITION) Call(SetBattleCamTarget, -25, 60, 0) Call(SetBattleCamDist, 460) @@ -512,7 +512,7 @@ EvtScript N(EVS_Attack_WindBlast) = { EndIf Call(FreezeBattleState, TRUE) Wait(90) - Call(GetActionQuality, LVar1) + Call(GetActionProgress, LVar1) Call(SetTargetActor, ACTOR_SELF, ACTOR_PLAYER) Call(SetGoalToTarget, ACTOR_SELF) Call(EnemyDamageTarget, ACTOR_SELF, LVar0, DAMAGE_TYPE_UNBLOCKABLE | DAMAGE_TYPE_MULTIPLE_POPUPS, SUPPRESS_EVENT_ALL, 0, LVar1, BS_FLAGS1_TRIGGER_EVENTS) @@ -952,10 +952,10 @@ EvtScript N(EVS_Attack_GrappleDrop) = { Call(MoveBattleCamOver, 60) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) Call(ShowActionHud, TRUE) - Call(action_command_break_free_start, 0, 60 * DT, 30, 3) + Call(action_command_break_free_start, 0, 60 * DT, 30, AC_DIFFICULTY_3) ExecGetTID(N(EVS_LiftMario), LVarA) Wait(62) - Call(GetActionSuccessCopy, LVar0) + Call(GetMashActionQuality, LVar0) IfGt(LVar0, 0) Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Buzzar_Anim01) Wait(2) diff --git a/src/battle/area/iwa/area.c b/src/battle/area/iwa/area.c index 9cd05690469..aade90c17a9 100644 --- a/src/battle/area/iwa/area.c +++ b/src/battle/area/iwa/area.c @@ -74,10 +74,10 @@ Formation A(Formation_0B) = { ACTOR_BY_IDX(A(monty_mole), BTL_POS_GROUND_C, 8), }; -Vec3i A(vector3D_8021853C) = { 90, 70, 0 }; +Vec3i A(BossPos) = { 90, 70, 0 }; Formation A(Formation_0C) = { - ACTOR_BY_POS(A(buzzar), A(vector3D_8021853C), 10), + ACTOR_BY_POS(A(buzzar), A(BossPos), 10), }; Formation A(Formation_0D) = { diff --git a/src/battle/area/kmr_part_3/actor/spiked_para_jr_troopa.c b/src/battle/area/kmr_part_3/actor/spiked_para_jr_troopa.c index 732d78f8b03..7a6ca767678 100644 --- a/src/battle/area/kmr_part_3/actor/spiked_para_jr_troopa.c +++ b/src/battle/area/kmr_part_3/actor/spiked_para_jr_troopa.c @@ -560,12 +560,12 @@ API_CALLABLE(N(ShowPointerHudElem)) { Bytecode* args = script->ptrReadPos; f32 posX = evt_get_float_variable(script, *args++); f32 posY = evt_get_float_variable(script, *args++); - s32 iconIdx = hud_element_create(&HES_AnimatedHandPointer); + HudElemID hid = hud_element_create(&HES_AnimatedHandPointer); - hud_element_set_render_pos(iconIdx, posX, posY); - hud_element_set_scale(iconIdx, 1.5f); - hud_element_clear_flags(iconIdx, HUD_ELEMENT_FLAG_200000 | HUD_ELEMENT_FLAG_DISABLED); - evt_set_variable(script, *args++, iconIdx); + hud_element_set_render_pos(hid, posX, posY); + hud_element_set_scale(hid, 1.5f); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_200000 | HUD_ELEMENT_FLAG_DISABLED); + evt_set_variable(script, *args++, hid); load_tattle_flags(ACTOR_TYPE_JR_TROOPA_4); return ApiStatus_DONE2; } diff --git a/src/battle/area/kpa2/actor/intro_bowser.c b/src/battle/area/kpa2/actor/intro_bowser.c index cc7ce15566e..2302df27d79 100644 --- a/src/battle/area/kpa2/actor/intro_bowser.c +++ b/src/battle/area/kpa2/actor/intro_bowser.c @@ -21,7 +21,6 @@ extern EvtScript N(EVS_Attack_FireBreath); extern EvtScript N(EVS_UseStarRod); extern EvtScript N(EVS_StarRodCast); - enum N(ActorPartIDs) { PRT_MAIN = 1, }; diff --git a/src/battle/area/kzn2/actor/lava_piranha.c b/src/battle/area/kzn2/actor/lava_piranha.c index 337fe96d83b..b5c87ae7ff1 100644 --- a/src/battle/area/kzn2/actor/lava_piranha.c +++ b/src/battle/area/kzn2/actor/lava_piranha.c @@ -543,7 +543,7 @@ API_CALLABLE(N(MarkVineInterpolationDirty)) { API_CALLABLE(N(CreateVineRenderer)) { N(VineRenderState) = VINE_RENDER_STATE_NONE; - create_worker_world(NULL, &N(worker_render_piranha_vines)); + create_worker_scene(NULL, &N(worker_render_piranha_vines)); return ApiStatus_DONE2; } diff --git a/src/battle/area/pra/area.c b/src/battle/area/pra/area.c index bbc3658d281..e5ca00444c4 100644 --- a/src/battle/area/pra/area.c +++ b/src/battle/area/pra/area.c @@ -18,7 +18,6 @@ extern Stage A(pra_03b); extern Stage A(pra_03c); extern Stage A(pra_04); - Vec3i A(pos_swoopula)[] = { { 15, 133, -25 }, { 55, 133, -25 }, diff --git a/src/battle/area/sam/area.c b/src/battle/area/sam/area.c index 975ba0d391e..76ef3529988 100644 --- a/src/battle/area/sam/area.c +++ b/src/battle/area/sam/area.c @@ -14,7 +14,6 @@ extern Stage A(sam_02c); extern Stage A(sam_02d); extern Stage A(sam_03); - Vec3i A(pos_rocks_1)[] = { { -35, 0, -52 }, { -20, 0, -50 }, diff --git a/src/battle/area/tik2/actor/blooper_baby.c b/src/battle/area/tik2/actor/blooper_baby.c index 3a7e9e8764d..6ffccd8365e 100644 --- a/src/battle/area/tik2/actor/blooper_baby.c +++ b/src/battle/area/tik2/actor/blooper_baby.c @@ -480,20 +480,20 @@ EvtScript N(EVS_TakeTurn) = { Call(JumpToGoal, ACTOR_SELF, 16, FALSE, TRUE, FALSE) Call(SetGoalToTarget, ACTOR_SELF) Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BabyBlooper_Anim08) - Call(ShowMessageBox, BTL_MSG_ACTION_TIP_MASH_BUTTON, 32767) + Call(ShowMessageBox, BTL_MSG_ACTION_TIP_MASH_BUTTON, AC_LEECH_MAX_TIME) Call(ShowActionHud, TRUE) Call(LoadActionCommand, ACTION_COMMAND_STOP_LEECH) Call(action_command_stop_leech_init) Call(SetupMashMeter, 1, 15, 0, 0, 0, 0) Wait(10) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) - Call(action_command_stop_leech_start, 0, 32767, 3) + Call(action_command_stop_leech_start, 0, AC_LEECH_MAX_TIME, AC_DIFFICULTY_3) Loop(5) Call(UseIdleAnimation, ACTOR_PLAYER, FALSE) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB1_Leeching) Set(LFlag0, FALSE) Loop(10) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -509,7 +509,7 @@ EvtScript N(EVS_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0)) Set(LFlag0, FALSE) Loop(2) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -524,7 +524,7 @@ EvtScript N(EVS_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.9), Float(1.1), Float(1.0)) Set(LFlag0, FALSE) Loop(2) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -539,7 +539,7 @@ EvtScript N(EVS_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.8), Float(1.2), Float(1.0)) Set(LFlag0, FALSE) Loop(3) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -554,7 +554,7 @@ EvtScript N(EVS_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.7), Float(1.4), Float(1.0)) Set(LFlag0, FALSE) Loop(2) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -595,13 +595,13 @@ EvtScript N(EVS_TakeTurn) = { Else Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0)) Call(DispatchEventPlayer, EVENT_66) - Call(func_80269470) + Call(InterruptLeechActionCommand) BreakLoop EndIf Call(SetActorScale, ACTOR_SELF, Float(0.7), Float(1.4), Float(1.0)) Set(LFlag0, FALSE) Loop(3) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -616,7 +616,7 @@ EvtScript N(EVS_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.8), Float(1.2), Float(1.0)) Set(LFlag0, FALSE) Loop(2) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -631,7 +631,7 @@ EvtScript N(EVS_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.9), Float(1.1), Float(1.0)) Set(LFlag0, FALSE) Loop(2) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -647,12 +647,12 @@ EvtScript N(EVS_TakeTurn) = { Call(GetPlayerHP, LVar1) IfEq(LVar1, 0) Call(DispatchEventPlayer, EVENT_66) - Call(func_80269470) + Call(InterruptLeechActionCommand) BreakLoop EndIf Set(LFlag0, FALSE) Loop(12) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -665,7 +665,7 @@ EvtScript N(EVS_TakeTurn) = { EndIf EndLoop Call(DispatchEventPlayer, EVENT_66) - Call(func_80269470) + Call(InterruptLeechActionCommand) Call(UseIdleAnimation, ACTOR_PLAYER, TRUE) Call(UseBattleCamPreset, BTL_CAM_DEFAULT) Call(MoveBattleCamOver, 20) diff --git a/src/battle/area/trd_part_2/actor/fake_bowser.c b/src/battle/area/trd_part_2/actor/fake_bowser.c index 245006e1b5a..6f8bad86ac3 100644 --- a/src/battle/area/trd_part_2/actor/fake_bowser.c +++ b/src/battle/area/trd_part_2/actor/fake_bowser.c @@ -333,7 +333,6 @@ s32 N(IdleHeadAngles)[] = { 255, 255, 255 }; - EvtScript N(EVS_AnimBowser_IdleHead) = { UseArray(FakeBowserAnimState) UseFBuf(Ref(N(IdleHeadAngles))) diff --git a/src/battle/battle.h b/src/battle/battle.h index 52e11279e86..16fa77d63a1 100644 --- a/src/battle/battle.h +++ b/src/battle/battle.h @@ -272,4 +272,7 @@ Actor* create_actor(Formation formation); #define DANGER_THRESHOLD 5 #define PERIL_THRESHOLD 1 +#define POPUP_MSG_ON 99 +#define POPUP_MSG_OFF 0 + #endif diff --git a/src/battle/btl_states_actions.c b/src/battle/btl_states_actions.c index 64d3b54f50d..f28f4b80656 100644 --- a/src/battle/btl_states_actions.c +++ b/src/battle/btl_states_actions.c @@ -263,15 +263,15 @@ void btl_state_update_normal_start(void) { battleStatus->incrementStarPointDelay = 0; battleStatus->damageTaken = 0; battleStatus->nextMerleeSpellType = MERLEE_SPELL_NONE; - battleStatus->actionCommandMode = ACTION_COMMAND_MODE_NOT_LEARNED; + battleStatus->actionCommandMode = AC_MODE_NOT_LEARNED; gCameras[CAM_DEFAULT].flags |= CAMERA_FLAG_DISABLED; gCameras[CAM_BATTLE].flags |= CAMERA_FLAG_DISABLED; gCameras[CAM_TATTLE].flags |= CAMERA_FLAG_DISABLED; if (is_ability_active(ABILITY_MYSTERY_SCROLL)) { - battleStatus->actionCommandMode = ACTION_COMMAND_MODE_LEARNED; + battleStatus->actionCommandMode = AC_MODE_LEARNED; } - battleStatus->actionSuccess = 0; - battleStatus->unk_82 = 0; + battleStatus->actionQuality = 0; + battleStatus->maxActionQuality = 0; battleStatus->enabledMenusFlags = -1; battleStatus->enabledStarPowersFlags = -1; battleStatus->itemUsesLeft = 0; @@ -2240,7 +2240,6 @@ void btl_state_update_run_away(void) { if (!(enemy->flags & ACTOR_FLAG_NO_DMG_APPLY)) { f32 escapeChance = enemy->actorBlueprint->escapeChance; - if (enemy->debuff == STATUS_KEY_FEAR || enemy->debuff == STATUS_KEY_DIZZY || enemy->debuff == STATUS_KEY_PARALYZE || @@ -2251,7 +2250,7 @@ void btl_state_update_run_away(void) { escapeChance = 100.0f; } totalEscapeChance += escapeChance; - enemyCount += 1; + enemyCount++; } } } @@ -3599,7 +3598,7 @@ void btl_state_update_enemy_move(void) { } battleStatus->stateFreezeCount = 0; battleStatus->lastAttackDamage = 0; - battleStatus->actionSuccess = 0; + battleStatus->actionQuality = 0; battleStatus->actionResult = ACTION_RESULT_NONE; battleStatus->blockResult = BLOCK_RESULT_NONE; battleStatus->curDamageSource = DMG_SRC_DEFAULT; diff --git a/src/battle/btl_states_menus.c b/src/battle/btl_states_menus.c index 14e8c9732eb..69a666dcde1 100644 --- a/src/battle/btl_states_menus.c +++ b/src/battle/btl_states_menus.c @@ -403,7 +403,7 @@ BSS s32 battle_menu_moveOptionActive; BSS s8 BattleSubmenuStratsState; BSS s8 StratsMenuPos; BSS s8 OldStratsMenuPos; -BSS b8 ShowingErrorMessage; +BSS s8 ShowingErrorMessage; BSS s8 D_802AD608; BSS s8 D_802AD609; BSS s8 StratsMenuLines; @@ -414,8 +414,8 @@ BSS s16 D_802AD610; BSS s16 D_802AD612; BSS s8 D_802AD614; BSS s32 D_802AD618; -BSS HudElemID GreenArrowUpID; -BSS HudElemID GreenArrowDownID; +BSS HudElemID HID_GreenArrowUp; +BSS HudElemID HID_GreenArrowDown; BSS s32 D_802AD624; #if VERSION_IQUE @@ -519,7 +519,7 @@ void btl_main_menu_destroy(void) { s32 btl_main_menu_update(void) { BattleStatus* battleStatus = &gBattleStatus; f32 theta; - s32 id; + HudElemID hid; s32 i; f32 x, y; s32 l, t; @@ -537,85 +537,85 @@ s32 btl_main_menu_update(void) { BattleMenu_MaxIdx -= D_802AD0B0; for (i = 0; i < BattleMenu_NumOptions; i++) { - D_802AD010[i] = id = hud_element_create(BattleMenu_HudScripts[i]); - hud_element_set_render_depth(id, 5); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_scale(id, 0.75f); - - D_802AD028[i] = id = hud_element_create(&HES_ProjectorSpot); - hud_element_create_transform_B(id); - hud_element_set_render_depth(id, 10); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_DISABLED); - } - - D_802AD040 = id = hud_element_create(&HES_ProjectorSpot); - hud_element_create_transform_B(id); - hud_element_set_render_depth(id, 7); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_DISABLED); - - D_802AD044 = id = hud_element_create(&HES_ProjectorReel); - hud_element_create_transform_B(id); - hud_element_set_render_depth(id, 0); - hud_element_set_render_pos(id, 40, 212); - hud_element_set_tint(id, 0, 91, 127); - hud_element_set_transform_rotation_pivot(id, 16, -16); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX); - hud_element_set_alpha(id, 240); - - D_802AD048 = id = hud_element_create(&HES_ProjectorReel); - hud_element_create_transform_B(id); - hud_element_set_render_depth(id, 2); - hud_element_set_render_pos(id, 39, 212); - hud_element_set_tint(id, 0, 91, 127); - hud_element_set_transform_rotation_pivot(id, 16, -16); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX); - hud_element_set_alpha(id, 240); - - D_802AD04C = id = hud_element_create(&HES_ProjectorBeam); - hud_element_create_transform_B(id); - hud_element_set_render_depth(id, 20); - hud_element_set_render_pos(id, 78, 178); - hud_element_set_tint(id, 255, 255, 255); - hud_element_set_transform_rotation_pivot(id, 0, 0); - hud_element_set_transform_rotation(id, 0.0f, 0.0f, -45.0f); - hud_element_set_alpha(id, 200); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_DISABLED); - - D_802AD05C = id = hud_element_create(&HES_SwapBackground); - hud_element_set_render_depth(id, 0); - hud_element_set_render_pos(id, 97, 208); - hud_element_set_tint(id, 255, 255, 255); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX); - hud_element_set_alpha(id, 230); - - D_802AD050 = id = hud_element_create(&HES_SwapZ); - hud_element_set_render_depth(id, 5); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - hud_element_set_render_pos(id, 94, 209); - - D_802AD054 = id = hud_element_create(&HES_SwapArrowLeft); - hud_element_set_render_depth(id, 5); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - hud_element_set_render_pos(id, 81, 210); - - D_802AD058 = id = hud_element_create(&HES_SwapArrowRight); - hud_element_set_render_depth(id, 5); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - hud_element_set_render_pos(id, 102, 210); + D_802AD010[i] = hid = hud_element_create(BattleMenu_HudScripts[i]); + hud_element_set_render_depth(hid, 5); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_scale(hid, 0.75f); + + D_802AD028[i] = hid = hud_element_create(&HES_ProjectorSpot); + hud_element_create_transform_B(hid); + hud_element_set_render_depth(hid, 10); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + } + + D_802AD040 = hid = hud_element_create(&HES_ProjectorSpot); + hud_element_create_transform_B(hid); + hud_element_set_render_depth(hid, 7); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + + D_802AD044 = hid = hud_element_create(&HES_ProjectorReel); + hud_element_create_transform_B(hid); + hud_element_set_render_depth(hid, 0); + hud_element_set_render_pos(hid, 40, 212); + hud_element_set_tint(hid, 0, 91, 127); + hud_element_set_transform_rotation_pivot(hid, 16, -16); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); + hud_element_set_alpha(hid, 240); + + D_802AD048 = hid = hud_element_create(&HES_ProjectorReel); + hud_element_create_transform_B(hid); + hud_element_set_render_depth(hid, 2); + hud_element_set_render_pos(hid, 39, 212); + hud_element_set_tint(hid, 0, 91, 127); + hud_element_set_transform_rotation_pivot(hid, 16, -16); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); + hud_element_set_alpha(hid, 240); + + D_802AD04C = hid = hud_element_create(&HES_ProjectorBeam); + hud_element_create_transform_B(hid); + hud_element_set_render_depth(hid, 20); + hud_element_set_render_pos(hid, 78, 178); + hud_element_set_tint(hid, 255, 255, 255); + hud_element_set_transform_rotation_pivot(hid, 0, 0); + hud_element_set_transform_rotation(hid, 0.0f, 0.0f, -45.0f); + hud_element_set_alpha(hid, 200); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + + D_802AD05C = hid = hud_element_create(&HES_SwapBackground); + hud_element_set_render_depth(hid, 0); + hud_element_set_render_pos(hid, 97, 208); + hud_element_set_tint(hid, 255, 255, 255); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); + hud_element_set_alpha(hid, 230); + + D_802AD050 = hid = hud_element_create(&HES_SwapZ); + hud_element_set_render_depth(hid, 5); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_set_render_pos(hid, 94, 209); + + D_802AD054 = hid = hud_element_create(&HES_SwapArrowLeft); + hud_element_set_render_depth(hid, 5); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_set_render_pos(hid, 81, 210); + + D_802AD058 = hid = hud_element_create(&HES_SwapArrowRight); + hud_element_set_render_depth(hid, 5); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_set_render_pos(hid, 102, 210); D_802AD00A = 100; D_802AD001 = 3; BattleMenuState = BTL_MENU_STATE_UNK_1; @@ -627,8 +627,8 @@ s32 btl_main_menu_update(void) { switch (D_802AD001) { case 1: if (D_802AD001 == 1) { - id = D_802AD04C; - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hid = D_802AD04C; + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } default: D_802AD001--; @@ -644,14 +644,14 @@ s32 btl_main_menu_update(void) { l = BattleMenu_BasePosX + x; t = BattleMenu_BasePosY + y; - id = D_802AD010[i]; - hud_element_set_render_pos(id, l, t); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - - id = D_802AD028[i]; - hud_element_set_render_pos(id, l, t); - hud_element_set_alpha(id, 100); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hid = D_802AD010[i]; + hud_element_set_render_pos(hid, l, t); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + + hid = D_802AD028[i]; + hud_element_set_render_pos(hid, l, t); + hud_element_set_alpha(hid, 100); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } x = 0.0f; @@ -661,11 +661,11 @@ s32 btl_main_menu_update(void) { l = BattleMenu_BasePosX + x; t = BattleMenu_BasePosY + y; - id = D_802AD040; - hud_element_set_render_pos(id, l, t); - hud_element_set_alpha(id, 180); - hud_element_set_scale(id, 0.85f); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hid = D_802AD040; + hud_element_set_render_pos(hid, l, t); + hud_element_set_alpha(hid, 180); + hud_element_set_scale(hid, 0.85f); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); BattleMenuState = BTL_MENU_STATE_ACCEPT_INPUT; break; } @@ -1074,7 +1074,7 @@ s32 btl_submenu_moves_update(void) { s32 msgX; s32 msgID; s32 cond; - s32 id; + HudElemID hid; s32 i; s32 j; @@ -1117,73 +1117,73 @@ s32 btl_submenu_moves_update(void) { } for (i = 0; i < BattleMenu_Moves_OptionCount; i++) { - id = hud_element_create(battle_menu_moveOptionIconScripts[BattleMenu_Moves_OptionIndexMap[i]]); - BattleMenu_Moves_OptionIDs[i] = id; - hud_element_set_scale(id, 0.45f); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX | HUD_ELEMENT_FLAG_80); + hid = hud_element_create(battle_menu_moveOptionIconScripts[BattleMenu_Moves_OptionIndexMap[i]]); + BattleMenu_Moves_OptionIDs[i] = hid; + hud_element_set_scale(hid, 0.45f); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX | HUD_ELEMENT_FLAG_80); } - id = hud_element_create(&HES_AnimatedHandPointer); - BattleMenu_Moves_CursorID = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); - hud_element_set_render_pos(id, BattleMenu_Moves_PosX, BattleMenu_Moves_PosY); + hid = hud_element_create(&HES_AnimatedHandPointer); + BattleMenu_Moves_CursorID = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); + hud_element_set_render_pos(hid, BattleMenu_Moves_PosX, BattleMenu_Moves_PosY); - id = hud_element_create(&HES_GreenArrowUp); - BattleMenu_Moves_UpArrowID = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); - hud_element_set_render_pos(id, BattleMenu_Moves_PosX + 39, BattleMenu_Moves_PosY - 7); + hid = hud_element_create(&HES_GreenArrowUp); + BattleMenu_Moves_UpArrowID = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); + hud_element_set_render_pos(hid, BattleMenu_Moves_PosX + 39, BattleMenu_Moves_PosY - 7); - id = hud_element_create(&HES_GreenArrowDown); - BattleMenu_Moves_DownArrowID = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); - hud_element_set_render_pos(id, BattleMenu_Moves_PosX + 39, BattleMenu_Moves_PosY + 78); + hid = hud_element_create(&HES_GreenArrowDown); + BattleMenu_Moves_DownArrowID = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); + hud_element_set_render_pos(hid, BattleMenu_Moves_PosX + 39, BattleMenu_Moves_PosY + 78); if (!BattleMenu_UsingSpiritsSubmenu) { - id = hud_element_create(&HES_StatusFlower); - BattleMenu_Moves_TitleID = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); + hid = hud_element_create(&HES_StatusFlower); + BattleMenu_Moves_TitleID = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); } else { - id = hud_element_create(&HES_MenuStarPower); - BattleMenu_Moves_TitleID = id; - hud_element_set_scale(id, 0.75f); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); + hid = hud_element_create(&HES_MenuStarPower); + BattleMenu_Moves_TitleID = hid; + hud_element_set_scale(hid, 0.75f); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); } - hud_element_set_render_pos(id, BattleMenu_Moves_PosX + 56, BattleMenu_Moves_PosY); + hud_element_set_render_pos(hid, BattleMenu_Moves_PosX + 56, BattleMenu_Moves_PosY); for (i = 0; i < BattleMenu_Moves_OptionCount; i++) { if (!BattleMenu_UsingSpiritsSubmenu) { switch (battle_menu_moveOptionDisplayCostReductionColors[i]) { case 0: - id = hud_element_create(&HES_FPCost); - BattleMenu_Moves_OptionCostUnitIDs[i] = id; + hid = hud_element_create(&HES_FPCost); + BattleMenu_Moves_OptionCostUnitIDs[i] = hid; break; case 1: - id = hud_element_create(&HES_FPCostReduced); - BattleMenu_Moves_OptionCostUnitIDs[i] = id; + hid = hud_element_create(&HES_FPCostReduced); + BattleMenu_Moves_OptionCostUnitIDs[i] = hid; break; default: - id = hud_element_create(&HES_FPCostReducedTwice); - BattleMenu_Moves_OptionCostUnitIDs[i] = id; + hid = hud_element_create(&HES_FPCostReducedTwice); + BattleMenu_Moves_OptionCostUnitIDs[i] = hid; break; } } else { switch (battle_menu_moveOptionDisplayCostReductionColors[i]) { case 0: - id = hud_element_create(&HES_POWCost); - BattleMenu_Moves_OptionCostUnitIDs[i] = id; + hid = hud_element_create(&HES_POWCost); + BattleMenu_Moves_OptionCostUnitIDs[i] = hid; break; case 1: - id = hud_element_create(&HES_POWCostReduced); - BattleMenu_Moves_OptionCostUnitIDs[i] = id; + hid = hud_element_create(&HES_POWCostReduced); + BattleMenu_Moves_OptionCostUnitIDs[i] = hid; break; default: - id = hud_element_create(&HES_POWCostReducedTwice); - BattleMenu_Moves_OptionCostUnitIDs[i] = id; + hid = hud_element_create(&HES_POWCostReducedTwice); + BattleMenu_Moves_OptionCostUnitIDs[i] = hid; break; } } - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - hud_element_set_render_pos(id, BattleMenu_Moves_PosX + 56, BattleMenu_Moves_PosY); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_set_render_pos(hid, BattleMenu_Moves_PosX + 56, BattleMenu_Moves_PosY); } BattleMenu_Moves_TextColor = MSG_PAL_STANDARD; @@ -1309,8 +1309,8 @@ s32 btl_submenu_moves_update(void) { break; case BTL_SUBMENU_MOVES_STATE_UNK_NEGATIVE_ONE: for (i = 0; i < BattleMenu_Moves_OptionCount; i++) { - id = BattleMenu_Moves_OptionIDs[i]; - hud_element_set_tint(id, 160, 160, 160); + hid = BattleMenu_Moves_OptionIDs[i]; + hud_element_set_tint(hid, 160, 160, 160); } hud_element_set_tint(BattleMenu_Moves_CursorID, 160, 160, 160); hud_element_set_tint(BattleMenu_Moves_UpArrowID, 160, 160, 160); @@ -1318,8 +1318,8 @@ s32 btl_submenu_moves_update(void) { hud_element_set_tint(BattleMenu_Moves_TitleID, 160, 160, 160); for (i = 0; i < BattleMenu_Moves_OptionCount; i++) { - id = BattleMenu_Moves_OptionCostUnitIDs[i]; - hud_element_set_tint(id, 160, 160, 160); + hid = BattleMenu_Moves_OptionCostUnitIDs[i]; + hud_element_set_tint(hid, 160, 160, 160); } hud_element_set_script(BattleMenu_Moves_CursorID, &HES_HandPointer); @@ -1784,8 +1784,8 @@ void func_802A472C(void) { } hud_element_free(D_802AD618); - hud_element_free(GreenArrowUpID); - hud_element_free(GreenArrowDownID); + hud_element_free(HID_GreenArrowUp); + hud_element_free(HID_GreenArrowDown); } void func_802A47E0(void) { @@ -1796,8 +1796,8 @@ void func_802A47E0(void) { } hud_element_set_tint(D_802AD618, 255, 255, 255); - hud_element_set_tint(GreenArrowUpID, 255, 255, 255); - hud_element_set_tint(GreenArrowDownID, 255, 255, 255); + hud_element_set_tint(HID_GreenArrowUp, 255, 255, 255); + hud_element_set_tint(HID_GreenArrowDown, 255, 255, 255); hud_element_set_script(D_802AD618, &HES_AnimatedHandPointer); set_window_update(WINDOW_ID_6, WINDOW_UPDATE_TRANSPARENT); set_window_update(WINDOW_ID_7, WINDOW_UPDATE_TRANSPARENT); @@ -1820,8 +1820,8 @@ void func_802A48FC(void) { } hud_element_set_tint(D_802AD618, 255, 255, 255); - hud_element_set_tint(GreenArrowUpID, 255, 255, 255); - hud_element_set_tint(GreenArrowDownID, 255, 255, 255); + hud_element_set_tint(HID_GreenArrowUp, 255, 255, 255); + hud_element_set_tint(HID_GreenArrowDown, 255, 255, 255); hud_element_set_script(D_802AD618, &HES_AnimatedHandPointer); D_802AD614 = MSG_PAL_STANDARD; D_802AD60B = 1; @@ -1837,7 +1837,7 @@ void func_802A4A10(void) { s32 btl_update_strats_menu(void) { BattleStatus* battleStatus = &gBattleStatus; - s32 id; + HudElemID hid; s32 x, y; s32 width; s32 msgID; @@ -1851,22 +1851,22 @@ s32 btl_update_strats_menu(void) { D_802AD60E = (StratsMenuPos - D_802AD608) * 13; for (i = 0; i < D_802AD66C; i++) { - D_802AD628[i] = id = hud_element_create(D_802AD640[i]); - hud_element_set_scale(id, 0.45f); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX | HUD_ELEMENT_FLAG_80); + D_802AD628[i] = hid = hud_element_create(D_802AD640[i]); + hud_element_set_scale(hid, 0.45f); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX | HUD_ELEMENT_FLAG_80); } - D_802AD618 = id = hud_element_create(&HES_AnimatedHandPointer); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); - hud_element_set_render_pos(id, D_802AD63C, D_802AD63E); + D_802AD618 = hid = hud_element_create(&HES_AnimatedHandPointer); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); + hud_element_set_render_pos(hid, D_802AD63C, D_802AD63E); - GreenArrowUpID = id = hud_element_create(&HES_GreenArrowUp); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); - hud_element_set_render_pos(id, D_802AD63C + 39, D_802AD63E - 7); + HID_GreenArrowUp = hid = hud_element_create(&HES_GreenArrowUp); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); + hud_element_set_render_pos(hid, D_802AD63C + 39, D_802AD63E - 7); - GreenArrowDownID = id = hud_element_create(&HES_GreenArrowDown); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); - hud_element_set_render_pos(id, D_802AD63C + 39, D_802AD63E + 78); + HID_GreenArrowDown = hid = hud_element_create(&HES_GreenArrowDown); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); + hud_element_set_render_pos(hid, D_802AD63C + 39, D_802AD63E + 78); D_802AD614 = MSG_PAL_STANDARD; x = D_802AD63C; @@ -1947,8 +1947,8 @@ s32 btl_update_strats_menu(void) { hud_element_set_tint(D_802AD628[i], 160, 160, 160); } hud_element_set_tint(D_802AD618, 160, 160, 160); - hud_element_set_tint(GreenArrowUpID, 160, 160, 160); - hud_element_set_tint(GreenArrowDownID, 160, 160, 160); + hud_element_set_tint(HID_GreenArrowUp, 160, 160, 160); + hud_element_set_tint(HID_GreenArrowDown, 160, 160, 160); hud_element_set_script(D_802AD618, &HES_HandPointer); D_802AD614 = MSG_PAL_0D; set_window_update(WINDOW_ID_6, WINDOW_UPDATE_DARKENED); @@ -2104,13 +2104,13 @@ void btl_menu_strats_draw_content(void* data, s32 x, s32 y) { hud_element_draw_clipped(id); if (D_802AD608 > 0) { - id = GreenArrowUpID; + id = HID_GreenArrowUp; hud_element_set_render_pos(id, x + 67, y + 16); hud_element_set_alpha(id, D_802AD624); hud_element_draw_clipped(id); } if (D_802AD609 < D_802AD66C) { - id = GreenArrowDownID; + id = HID_GreenArrowDown; hud_element_set_render_pos(id, x + 67, y + 100); hud_element_set_alpha(id, D_802AD624); hud_element_draw_clipped(id); @@ -2347,7 +2347,7 @@ void btl_state_update_player_menu(void) { BattleMenu_OptionEnabled[entryIdx] = TRUE; BattleMenu_HudScripts[entryIdx] = battle_menu_StrategiesHudScript.enabled; BattleMenu_TitleMessages[entryIdx] = BattleMenu_CenteredMessages[BTL_MENU_TYPE_STRATEGIES]; - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_TUTORIAL || gBattleStatus.flags1 & BS_FLAGS1_TUTORIAL_BATTLE) { + if (battleStatus->actionCommandMode == AC_MODE_TUTORIAL || gBattleStatus.flags1 & BS_FLAGS1_TUTORIAL_BATTLE) { BattleMenu_TitleMessages[entryIdx] = MSG_Menus_EndTraining_Centered; } battle_menu_isMessageDisabled[entryIdx] = 0; @@ -2560,7 +2560,7 @@ void btl_state_update_player_menu(void) { if (battleStatus->submenuMoveCount == 1) { battleStatus->submenuMoveCount = 0; } - if (battleStatus->actionCommandMode == 2) { + if (battleStatus->actionCommandMode == AC_MODE_TUTORIAL) { battleStatus->submenuMoveCount = 0; } break; @@ -2569,7 +2569,7 @@ void btl_state_update_player_menu(void) { if (battleStatus->submenuMoveCount == 1) { battleStatus->submenuMoveCount = 0; } - if (battleStatus->actionCommandMode == 2) { + if (battleStatus->actionCommandMode == AC_MODE_TUTORIAL) { battleStatus->submenuMoveCount = 0; } break; @@ -2658,7 +2658,7 @@ void btl_state_update_player_menu(void) { btl_state_update_player_menu(); break; } else if (currentSubmenu == BTL_MENU_TYPE_STRATEGIES) { - if (battleStatus->actionCommandMode != ACTION_COMMAND_MODE_TUTORIAL && !(gBattleStatus.flags1 & BS_FLAGS1_TUTORIAL_BATTLE)) { + if (battleStatus->actionCommandMode != AC_MODE_TUTORIAL && !(gBattleStatus.flags1 & BS_FLAGS1_TUTORIAL_BATTLE)) { gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_BUILD_STRATEGIES; btl_state_update_player_menu(); btl_state_update_player_menu(); @@ -4913,7 +4913,7 @@ void btl_state_update_select_target(void) { Actor* actor; s32 targetListLength; s32 selectedTargetIndex; - s32 id; + HudElemID hid; s8* targetIndexList; SelectableTarget* target; s32 i; @@ -5005,10 +5005,10 @@ void btl_state_update_select_target(void) { // create the HUD elements for the target pointers for (i = 0; i < targetListLength; i++) { - id = hud_element_create(&HES_HandPointDownLoop); - BattleMenu_TargetHudElems[i] = id; - hud_element_set_render_depth(id, 0); - hud_element_set_render_pos(id, 0, -100); + hid = hud_element_create(&HES_HandPointDownLoop); + BattleMenu_TargetHudElems[i] = hid; + hud_element_set_render_depth(hid, 0); + hud_element_set_render_pos(hid, 0, -100); } gBattleSubState = BTL_SUBSTATE_SELECT_TARGET_CHOOSE; break; @@ -5061,12 +5061,12 @@ void btl_state_update_select_target(void) { target = &actor->targetData[targetIndexList[selectedTargetIndex]]; actorFlags = get_actor(target->actorID)->flags; - id = BattleMenu_TargetHudElems[0]; + hid = BattleMenu_TargetHudElems[0]; if (actorFlags & ACTOR_FLAG_UPSIDE_DOWN) { - hud_element_set_script(id, &HES_HandPointLeftLoop); + hud_element_set_script(hid, &HES_HandPointLeftLoop); } else { - hud_element_set_script(id, &HES_HandPointDownLoop); + hud_element_set_script(hid, &HES_HandPointDownLoop); } sfx_play_sound(SOUND_MENU_CHANGE_SELECTION); } diff --git a/src/battle/common/actor/duplighost.inc.c b/src/battle/common/actor/duplighost.inc.c index 59fcc5ea404..a4ffe99cfe5 100644 --- a/src/battle/common/actor/duplighost.inc.c +++ b/src/battle/common/actor/duplighost.inc.c @@ -746,6 +746,3 @@ EvtScript N(EVS_TakeTurn) = { Return End }; - - - diff --git a/src/battle/common/actor/forest_fuzzy.inc.c b/src/battle/common/actor/forest_fuzzy.inc.c index 473c7896fe2..f920150d73e 100644 --- a/src/battle/common/actor/forest_fuzzy.inc.c +++ b/src/battle/common/actor/forest_fuzzy.inc.c @@ -165,7 +165,7 @@ EvtScript N(EVS_HandleEvent) = { ExecWait(EVS_Enemy_Death) Return CaseEq(EVENT_SHOCK_HIT) - Call(func_80269470) + Call(InterruptLeechActionCommand) SetConst(LVar0, PRT_MAIN) SetConst(LVar1, ANIM_Fuzzy_Forest_HurtShock) ExecWait(EVS_Enemy_ShockHit) @@ -179,7 +179,7 @@ EvtScript N(EVS_HandleEvent) = { Call(SetActorJumpGravity, ACTOR_SELF, Float(1.6)) Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE) CaseEq(EVENT_SHOCK_DEATH) - Call(func_80269470) + Call(InterruptLeechActionCommand) SetConst(LVar0, PRT_MAIN) SetConst(LVar1, ANIM_Fuzzy_Forest_HurtShock) ExecWait(EVS_Enemy_ShockHit) diff --git a/src/battle/common/actor/jungle_fuzzy.inc.c b/src/battle/common/actor/jungle_fuzzy.inc.c index f258ee14bcd..9a13352df0b 100644 --- a/src/battle/common/actor/jungle_fuzzy.inc.c +++ b/src/battle/common/actor/jungle_fuzzy.inc.c @@ -169,7 +169,7 @@ EvtScript N(EVS_HandleEvent) = { ExecWait(EVS_Enemy_Death) Return CaseEq(EVENT_SHOCK_HIT) - Call(func_80269470) + Call(InterruptLeechActionCommand) SetConst(LVar0, PRT_MAIN) SetConst(LVar1, ANIM_Fuzzy_Jungle_HurtShock) ExecWait(EVS_Enemy_ShockHit) @@ -183,7 +183,7 @@ EvtScript N(EVS_HandleEvent) = { Call(SetActorJumpGravity, ACTOR_SELF, Float(1.6)) Call(JumpToGoal, ACTOR_SELF, 5, FALSE, TRUE, FALSE) CaseEq(EVENT_SHOCK_DEATH) - Call(func_80269470) + Call(InterruptLeechActionCommand) SetConst(LVar0, PRT_MAIN) SetConst(LVar1, ANIM_Fuzzy_Jungle_HurtShock) ExecWait(EVS_Enemy_ShockHit) @@ -439,14 +439,14 @@ EvtScript N(EVS_Attack_Leech) = { Wait(30) EndLoop Else - Call(ShowMessageBox, BTL_MSG_ACTION_TIP_MASH_BUTTON, 32767) + Call(ShowMessageBox, BTL_MSG_ACTION_TIP_MASH_BUTTON, AC_LEECH_MAX_TIME) Call(ShowActionHud, TRUE) Call(LoadActionCommand, ACTION_COMMAND_STOP_LEECH) Call(action_command_stop_leech_init) Call(SetupMashMeter, 1, 23, 0, 0, 0, 0) Wait(10) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) - Call(action_command_stop_leech_start, 0, 32767, 3) + Call(action_command_stop_leech_start, 0, AC_LEECH_MAX_TIME, AC_DIFFICULTY_3) Set(LVarD, 0) Loop(5) Call(UseIdleAnimation, ACTOR_PLAYER, FALSE) @@ -455,7 +455,7 @@ EvtScript N(EVS_Attack_Leech) = { Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Jungle_Bite) Set(LFlag0, FALSE) Loop(21) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -473,7 +473,7 @@ EvtScript N(EVS_Attack_Leech) = { Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -487,7 +487,7 @@ EvtScript N(EVS_Attack_Leech) = { Call(SetActorScale, ACTOR_SELF, Float(0.9), Float(1.2), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -501,7 +501,7 @@ EvtScript N(EVS_Attack_Leech) = { Call(SetActorScale, ACTOR_SELF, Float(0.8), Float(1.3), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -515,7 +515,7 @@ EvtScript N(EVS_Attack_Leech) = { Call(SetActorScale, ACTOR_SELF, Float(0.7), Float(1.4), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -529,7 +529,7 @@ EvtScript N(EVS_Attack_Leech) = { Call(SetActorScale, ACTOR_SELF, Float(0.7), Float(1.5), Float(1.0)) Set(LFlag0, FALSE) Loop(2) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -543,7 +543,7 @@ EvtScript N(EVS_Attack_Leech) = { Call(SetActorScale, ACTOR_SELF, Float(0.6), Float(1.6), Float(1.0)) Set(LFlag0, FALSE) Loop(10) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -556,7 +556,7 @@ EvtScript N(EVS_Attack_Leech) = { EndIf Set(LFlag0, FALSE) Loop(2) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -590,7 +590,7 @@ EvtScript N(EVS_Attack_Leech) = { Else Add(LVarD, 1) IfGt(LVarD, 1) - Call(func_80269470) + Call(InterruptLeechActionCommand) BreakLoop EndIf EndIf @@ -600,12 +600,12 @@ EvtScript N(EVS_Attack_Leech) = { Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Fuzzy_Jungle_Jump) Call(GetPlayerHP, LVar1) IfEq(LVar1, 0) - Call(func_80269470) + Call(InterruptLeechActionCommand) BreakLoop EndIf Set(LFlag0, FALSE) Loop(35) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -616,7 +616,7 @@ EvtScript N(EVS_Attack_Leech) = { BreakLoop EndIf EndLoop - Call(func_80269470) + Call(InterruptLeechActionCommand) Call(SetActorRotation, ACTOR_SELF, 0, 0, 0) Call(SetActorDispOffset, ACTOR_SELF, 0, 8, 0) Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0)) diff --git a/src/battle/common/actor/spiked_goomba.inc.c b/src/battle/common/actor/spiked_goomba.inc.c index 17c7c99e4bb..a86acfd8f9c 100644 --- a/src/battle/common/actor/spiked_goomba.inc.c +++ b/src/battle/common/actor/spiked_goomba.inc.c @@ -4,7 +4,6 @@ #include "script_api/battle.h" #include "sprite/npc/SpikedGoomba.h" - #define NAMESPACE A(spiked_goomba) extern s32 N(DefaultAnims)[]; diff --git a/src/battle/common/actor/swooper.inc.c b/src/battle/common/actor/swooper.inc.c index 2559f9d6ad2..83958c1890c 100644 --- a/src/battle/common/actor/swooper.inc.c +++ b/src/battle/common/actor/swooper.inc.c @@ -183,14 +183,14 @@ EvtScript N(EVS_Flying_HandleEvent) = { ExecWait(EVS_Enemy_Death) Return CaseEq(EVENT_SHOCK_HIT) - Call(func_80269470) + Call(InterruptLeechActionCommand) SetConst(LVar0, PRT_MAIN) SetConst(LVar1, ANIM_Swooper_Anim15) ExecWait(EVS_Enemy_ShockHit) Call(UseBattleCamPreset, BTL_CAM_DEFAULT) ExecWait(N(EVS_ReturnHome)) CaseEq(EVENT_SHOCK_DEATH) - Call(func_80269470) + Call(InterruptLeechActionCommand) SetConst(LVar0, PRT_MAIN) SetConst(LVar1, ANIM_Swooper_Anim15) ExecWait(EVS_Enemy_ShockHit) @@ -359,14 +359,14 @@ EvtScript N(EVS_HandleEvent) = { EndIf Return CaseEq(EVENT_SHOCK_HIT) - Call(func_80269470) + Call(InterruptLeechActionCommand) SetConst(LVar0, PRT_MAIN) SetConst(LVar1, ANIM_Swooper_Anim15) ExecWait(EVS_Enemy_ShockHit_Impl) Call(UseBattleCamPreset, BTL_CAM_DEFAULT) ExecWait(N(EVS_ReturnHome)) CaseEq(EVENT_SHOCK_DEATH) - Call(func_80269470) + Call(InterruptLeechActionCommand) SetConst(LVar0, PRT_MAIN) SetConst(LVar1, ANIM_Swooper_Anim15) ExecWait(EVS_Enemy_ShockHit_Impl) diff --git a/src/battle/common/actor/swoopula.inc.c b/src/battle/common/actor/swoopula.inc.c index 511f8d5e2df..8f340f6bb68 100644 --- a/src/battle/common/actor/swoopula.inc.c +++ b/src/battle/common/actor/swoopula.inc.c @@ -187,14 +187,14 @@ EvtScript N(EVS_Flying_HandleEvent) = { ExecWait(EVS_Enemy_Death) Return CaseEq(EVENT_SHOCK_HIT) - Call(func_80269470) + Call(InterruptLeechActionCommand) SetConst(LVar0, PRT_MAIN) SetConst(LVar1, ANIM_Swooper_Gray_Anim15) ExecWait(EVS_Enemy_ShockHit) Call(UseBattleCamPreset, BTL_CAM_DEFAULT) ExecWait(N(EVS_ReturnHome)) CaseEq(EVENT_SHOCK_DEATH) - Call(func_80269470) + Call(InterruptLeechActionCommand) SetConst(LVar0, PRT_MAIN) SetConst(LVar1, ANIM_Swooper_Gray_Anim15) ExecWait(EVS_Enemy_ShockHit) @@ -363,14 +363,14 @@ EvtScript N(EVS_HandleEvent) = { EndIf Return CaseEq(EVENT_SHOCK_HIT) - Call(func_80269470) + Call(InterruptLeechActionCommand) SetConst(LVar0, PRT_MAIN) SetConst(LVar1, ANIM_Swooper_Gray_Anim15) ExecWait(EVS_Enemy_ShockHit_Impl) Call(UseBattleCamPreset, BTL_CAM_DEFAULT) ExecWait(N(EVS_ReturnHome)) CaseEq(EVENT_SHOCK_DEATH) - Call(func_80269470) + Call(InterruptLeechActionCommand) SetConst(LVar0, PRT_MAIN) SetConst(LVar1, ANIM_Swooper_Gray_Anim15) ExecWait(EVS_Enemy_ShockHit_Impl) @@ -564,20 +564,20 @@ EvtScript N(EVS_Flying_TakeTurn) = { Wait(30) EndLoop Else - Call(ShowMessageBox, BTL_MSG_ACTION_TIP_MASH_BUTTON, 32767) + Call(ShowMessageBox, BTL_MSG_ACTION_TIP_MASH_BUTTON, AC_LEECH_MAX_TIME) Call(ShowActionHud, TRUE) Call(LoadActionCommand, ACTION_COMMAND_STOP_LEECH) Call(action_command_stop_leech_init) Call(SetupMashMeter, 1, 30, 0, 0, 0, 0) Wait(10) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) - Call(action_command_stop_leech_start, 0, 32767, 3) + Call(action_command_stop_leech_start, 0, AC_LEECH_MAX_TIME, AC_DIFFICULTY_3) Set(LVarD, 0) Loop(MAX_LEECH_COUNT) Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Swooper_Gray_Anim02) Set(LFlag0, FALSE) Loop(21) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -595,7 +595,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -609,7 +609,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.9), Float(1.2), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -623,7 +623,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.8), Float(1.3), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -637,7 +637,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.7), Float(1.4), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -651,7 +651,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.7), Float(1.5), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -665,7 +665,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.7), Float(1.4), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -679,7 +679,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.8), Float(1.3), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -693,7 +693,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.9), Float(1.2), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -707,7 +707,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -724,7 +724,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { EndIf Set(LFlag0, FALSE) Loop(5) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -739,7 +739,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -753,7 +753,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.9), Float(1.2), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -767,7 +767,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.8), Float(1.3), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -781,7 +781,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.7), Float(1.4), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -795,7 +795,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.7), Float(1.5), Float(1.0)) Set(LFlag0, FALSE) Loop(2) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -809,7 +809,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.6), Float(1.6), Float(1.0)) Set(LFlag0, FALSE) Loop(10) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -823,7 +823,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0)) Set(LFlag0, FALSE) Loop(2) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -857,18 +857,18 @@ EvtScript N(EVS_Flying_TakeTurn) = { Else Add(LVarD, 1) IfGt(LVarD, 1) - Call(func_80269470) + Call(InterruptLeechActionCommand) BreakLoop EndIf EndIf Call(GetPlayerHP, LVar1) IfEq(LVar1, 0) - Call(func_80269470) + Call(InterruptLeechActionCommand) BreakLoop EndIf Set(LFlag0, FALSE) Loop(30) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -879,7 +879,7 @@ EvtScript N(EVS_Flying_TakeTurn) = { BreakLoop EndIf EndLoop - Call(func_80269470) + Call(InterruptLeechActionCommand) Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0)) EndIf Call(UseBattleCamPreset, BTL_CAM_DEFAULT) @@ -1014,20 +1014,20 @@ EvtScript N(EVS_TakeTurn) = { Wait(30) EndLoop Else - Call(ShowMessageBox, BTL_MSG_ACTION_TIP_MASH_BUTTON, 32767) + Call(ShowMessageBox, BTL_MSG_ACTION_TIP_MASH_BUTTON, AC_LEECH_MAX_TIME) Call(ShowActionHud, TRUE) Call(LoadActionCommand, ACTION_COMMAND_STOP_LEECH) Call(action_command_stop_leech_init) Call(SetupMashMeter, 1, 30, 0, 0, 0, 0) Wait(10) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) - Call(action_command_stop_leech_start, 0, 32767, 3) + Call(action_command_stop_leech_start, 0, AC_LEECH_MAX_TIME, AC_DIFFICULTY_3) Set(LVarD, 0) Loop(MAX_LEECH_COUNT) Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_Swooper_Gray_Anim02) Set(LFlag0, FALSE) Loop(21) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -1044,7 +1044,7 @@ EvtScript N(EVS_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -1058,7 +1058,7 @@ EvtScript N(EVS_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.9), Float(1.2), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -1072,7 +1072,7 @@ EvtScript N(EVS_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.8), Float(1.3), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -1086,7 +1086,7 @@ EvtScript N(EVS_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.7), Float(1.4), Float(1.0)) Set(LFlag0, FALSE) Loop(1) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -1100,7 +1100,7 @@ EvtScript N(EVS_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.7), Float(1.5), Float(1.0)) Set(LFlag0, FALSE) Loop(2) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -1114,7 +1114,7 @@ EvtScript N(EVS_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(0.6), Float(1.6), Float(1.0)) Set(LFlag0, FALSE) Loop(10) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -1128,7 +1128,7 @@ EvtScript N(EVS_TakeTurn) = { Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0)) Set(LFlag0, FALSE) Loop(2) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -1162,18 +1162,18 @@ EvtScript N(EVS_TakeTurn) = { Else Add(LVarD, 1) IfGt(LVarD, 1) - Call(func_80269470) + Call(InterruptLeechActionCommand) BreakLoop EndIf EndIf Call(GetPlayerHP, LVar1) IfEq(LVar1, 0) - Call(func_80269470) + Call(InterruptLeechActionCommand) BreakLoop EndIf Set(LFlag0, FALSE) Loop(35) - Call(GetActionSuccessCopy, LVar1) + Call(GetMashActionQuality, LVar1) IfEq(LVar1, 1) Set(LFlag0, TRUE) BreakLoop @@ -1184,7 +1184,7 @@ EvtScript N(EVS_TakeTurn) = { BreakLoop EndIf EndLoop - Call(func_80269470) + Call(InterruptLeechActionCommand) Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0)) EndIf Call(UseBattleCamPreset, BTL_CAM_DEFAULT) diff --git a/src/battle/common/move/HammerSupport.inc.c b/src/battle/common/move/HammerSupport.inc.c index f41cf38ed6b..46bb472ee5b 100644 --- a/src/battle/common/move/HammerSupport.inc.c +++ b/src/battle/common/move/HammerSupport.inc.c @@ -3,10 +3,29 @@ #include "battle/action_cmd/hammer.h" #include "sprite/player.h" -#include "world/common/todo/IsBerserkerEquipped.inc.c" +#define BASIC_HAMMER_DMG_BAD 1 +#define BASIC_HAMMER_DMG_GOOD 2 +#define SUPER_HAMMER_DMG_BAD 2 +#define SUPER_HAMMER_DMG_GOOD 4 +#define ULTRA_HAMMER_DMG_BAD 3 +#define ULTRA_HAMMER_DMG_GOOD 6 + +API_CALLABLE(N(IsBerserkerEquipped)) { + script->varTable[0] = gBattleStatus.actionCommandMode; + script->varTable[1] = 15; + + if (is_ability_active(ABILITY_BERSERKER)) { + script->varTable[0] = AC_MODE_NOT_LEARNED; + script->varTable[1] = 40; + } + + return ApiStatus_DONE2; +} + #include "world/common/todo/ShouldMovesAutoSucceed.inc.c" -EvtScript N(EVS_HammerSupport_A) = { +// Move the player into position 32 units to the left of the target enemy +EvtScript N(EVS_HammerSupport_SmashApproach) = { Call(InitTargetIterator) Call(SetGoalToTarget, ACTOR_PLAYER) Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0) @@ -21,7 +40,8 @@ EvtScript N(EVS_HammerSupport_A) = { End }; -EvtScript N(EVS_HammerSupport_B) = { +// Move the player into a fixed position ideal for quakin' +EvtScript N(EVS_HammerSupport_QuakeApproach) = { Call(SetGoalPos, ACTOR_PLAYER, -33, 0, 0) Call(UseBattleCamPreset, BTL_CAM_PLAYER_ATTACK_APPROACH) Call(SetActorSpeed, ACTOR_PLAYER, Float(5.0)) @@ -31,7 +51,9 @@ EvtScript N(EVS_HammerSupport_B) = { End }; -EvtScript N(EVS_HammerSupport_C) = { +// delay while player holds hammer on the ground before raising it +// can be sped up by pre-emptively holding left +EvtScript N(EVS_HammerSupport_BasicRaiseDelay) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0) Set(LVar1, 0) @@ -62,7 +84,9 @@ EvtScript N(EVS_HammerSupport_C) = { End }; -EvtScript N(EVS_HammerSupport_D) = { +// delay while player holds hammer on the ground before raising it +// can be sped up by pre-emptively holding left +EvtScript N(EVS_HammerSupport_SuperRaiseDelay) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0) Set(LVar1, 0) @@ -93,7 +117,9 @@ EvtScript N(EVS_HammerSupport_D) = { End }; -EvtScript N(EVS_HammerSupport_E) = { +// delay while player holds hammer on the ground before raising it +// can be sped up by pre-emptively holding left +EvtScript N(EVS_HammerSupport_UltraRaiseDelay) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0) Set(LVar1, 0) @@ -131,13 +157,13 @@ EvtScript N(EVS_HammerSupport_F) = { Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HAMMER_WINDUP) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB1_Smash1_PullBack) Wait(4) - Call(action_command_hammer_start, 0, 36, 3) - Call(SetActionQuality, 0) + Call(action_command_hammer_start, 0, 36, AC_DIFFICULTY_3) + Call(SetActionProgress, 0) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB1_Smash1_Hold1) Set(LVar1, 0) Loop(30) Wait(1) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) IfNe(LVar0, 0) IfNe(LVar1, 1) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB1_Smash1_Hold2) @@ -163,7 +189,7 @@ EvtScript N(EVS_HammerSupport_F) = { End }; -EvtScript N(EVS_Hammer_ReturnHome_A) = { +EvtScript N(EVS_HammerSupport_ReturnHome_SmashSuccess) = { Call(PlayerYieldTurn) Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME) Call(MoveBattleCamOver, 5) @@ -181,7 +207,7 @@ EvtScript N(EVS_Hammer_ReturnHome_A) = { End }; -EvtScript N(EVS_Hammer_ReturnHome_B) = { +EvtScript N(EVS_HammerSupport_ReturnHome_Quake) = { Call(PlayerYieldTurn) Call(func_802693F0) Wait(20) @@ -197,7 +223,7 @@ EvtScript N(EVS_Hammer_ReturnHome_B) = { End }; -EvtScript N(EVS_Hammer_ReturnHome_C) = { +EvtScript N(EVS_HammerSupport_ReturnHome_SmashMiss) = { Call(PlayerYieldTurn) Call(UseBattleCamPreset, BTL_CAM_PLAYER_MISTAKE) Call(func_802693F0) @@ -217,10 +243,10 @@ EvtScript N(EVS_Hammer_ReturnHome_C) = { EvtScript N(EVS_UseBasicHammer) = { Call(LoadActionCommand, ACTION_COMMAND_SMASH) Call(action_command_hammer_init) - ExecWait(N(EVS_HammerSupport_A)) + ExecWait(N(EVS_HammerSupport_SmashApproach)) Call(SetGoalToTarget, ACTOR_PLAYER) Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0) - ExecWait(N(EVS_HammerSupport_C)) + ExecWait(N(EVS_HammerSupport_BasicRaiseDelay)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 0, 0, 0, 16) Call(UseBattleCamPreset, BTL_CAM_PLAYER_AIM_HAMMER) Call(SetBattleCamOffsetY, 8) @@ -229,10 +255,10 @@ EvtScript N(EVS_UseBasicHammer) = { Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB1_Smash1_PullBack) Wait(4) Call(N(IsBerserkerEquipped)) - IfNe(LVar0, HIT_RESULT_HIT) + IfNe(LVar0, FALSE) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB1_Smash1_Hold1) Call(GetActionCommandMode, LVar0) - IfLt(LVar0, 2) + IfLt(LVar0, AC_MODE_TUTORIAL) Call(N(ShouldMovesAutoSucceed)) IfEq(LVar0, 0) Loop(45) @@ -245,12 +271,12 @@ EvtScript N(EVS_UseBasicHammer) = { EndIf EndIf Add(LVarD, 6) - Call(action_command_hammer_start, 0, LVarD, 3) - Call(SetActionQuality, 0) + Call(action_command_hammer_start, 0, LVarD, AC_DIFFICULTY_3) + Call(SetActionProgress, 0) Set(LVar1, 0) Loop(30) Wait(1) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) IfNe(LVar0, 0) IfNe(LVar1, 1) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB1_Smash1_Hold2) @@ -264,16 +290,16 @@ EvtScript N(EVS_UseBasicHammer) = { EndLoop Label(0) Call(GetActionCommandMode, LVar0) - IfLt(LVar0, 2) + IfLt(LVar0, AC_MODE_TUTORIAL) Wait(1) - Call(GetActionSuccess, LVar0) + Call(GetSmashActionQuality, LVar0) IfEq(LVar0, 0) Goto(0) EndIf EndIf Else - Call(action_command_hammer_start, 0, LVar1, 3) - Call(SetActionQuality, 0) + Call(action_command_hammer_start, 0, LVar1, AC_DIFFICULTY_3) + Call(SetActionProgress, 0) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB1_Smash1_Hold1) Sub(LVar1, 10) Wait(LVar1) @@ -281,11 +307,11 @@ EvtScript N(EVS_UseBasicHammer) = { Wait(5) EndIf Call(GetActionCommandMode, LVar0) - IfEq(LVar0, 2) - Call(SetActionCommandMode, 3) + IfEq(LVar0, AC_MODE_TUTORIAL) + Call(SetActionCommandMode, AC_MODE_TUTORIAL_WAIT_INPUT) Loop(0) Call(GetActionCommandMode, LVar0) - IfLt(LVar0, 2) + IfLt(LVar0, AC_MODE_TUTORIAL) BreakLoop EndIf Wait(1) @@ -303,10 +329,10 @@ EvtScript N(EVS_UseBasicHammer) = { EvtScript N(EVS_UseSuperHammer) = { Call(LoadActionCommand, ACTION_COMMAND_SMASH) Call(action_command_hammer_init) - ExecWait(N(EVS_HammerSupport_A)) + ExecWait(N(EVS_HammerSupport_SmashApproach)) Call(SetGoalToTarget, ACTOR_PLAYER) Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0) - ExecWait(N(EVS_HammerSupport_D)) + ExecWait(N(EVS_HammerSupport_SuperRaiseDelay)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 0, 0, 0, BS_FLAGS1_INCLUDE_POWER_UPS) Call(UseBattleCamPreset, BTL_CAM_PLAYER_AIM_HAMMER) Call(SetBattleCamOffsetY, 8) @@ -328,12 +354,12 @@ EvtScript N(EVS_UseSuperHammer) = { EndLoop EndIf Add(LVarD, 6) - Call(action_command_hammer_start, 0, LVarD, 3) - Call(SetActionQuality, 0) + Call(action_command_hammer_start, 0, LVarD, AC_DIFFICULTY_3) + Call(SetActionProgress, 0) Set(LVar1, 0) Loop(30) Wait(1) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) IfNe(LVar0, 0) IfNe(LVar1, 1) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB1_Smash2_Hold2) @@ -347,13 +373,13 @@ EvtScript N(EVS_UseSuperHammer) = { EndLoop Label(0) Wait(1) - Call(GetActionSuccess, LVar0) + Call(GetSmashActionQuality, LVar0) IfEq(LVar0, 0) Goto(0) EndIf Else - Call(action_command_hammer_start, 0, LVar1, 3) - Call(SetActionQuality, 0) + Call(action_command_hammer_start, 0, LVar1, AC_DIFFICULTY_3) + Call(SetActionProgress, 0) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB1_Smash2_Hold1) Sub(LVar1, 10) Wait(LVar1) @@ -372,10 +398,10 @@ EvtScript N(EVS_UseSuperHammer) = { EvtScript N(EVS_UseUltraHammer) = { Call(LoadActionCommand, ACTION_COMMAND_SMASH) Call(action_command_hammer_init) - ExecWait(N(EVS_HammerSupport_A)) + ExecWait(N(EVS_HammerSupport_SmashApproach)) Call(SetGoalToTarget, ACTOR_PLAYER) Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0) - ExecWait(N(EVS_HammerSupport_E)) + ExecWait(N(EVS_HammerSupport_UltraRaiseDelay)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 0, 0, 0, BS_FLAGS1_INCLUDE_POWER_UPS) Call(UseBattleCamPreset, BTL_CAM_PLAYER_AIM_HAMMER) Call(SetBattleCamOffsetY, 8) @@ -397,12 +423,12 @@ EvtScript N(EVS_UseUltraHammer) = { EndLoop EndIf Add(LVarD, 6) - Call(action_command_hammer_start, 0, LVarD, 3) - Call(SetActionQuality, 0) + Call(action_command_hammer_start, 0, LVarD, AC_DIFFICULTY_3) + Call(SetActionProgress, 0) Set(LVar1, 0) Loop(30) Wait(1) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) IfNe(LVar0, 0) IfNe(LVar1, 1) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB1_Smash3_Hold2) @@ -416,13 +442,13 @@ EvtScript N(EVS_UseUltraHammer) = { EndLoop Label(0) Wait(1) - Call(GetActionSuccess, LVar0) + Call(GetSmashActionQuality, LVar0) IfEq(LVar0, 0) Goto(0) EndIf Else - Call(action_command_hammer_start, 0, LVar1, 3) - Call(SetActionQuality, 0) + Call(action_command_hammer_start, 0, LVar1, AC_DIFFICULTY_3) + Call(SetActionProgress, 0) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB1_Smash3_Hold1) Sub(LVar1, 10) Wait(LVar1) @@ -442,10 +468,10 @@ EvtScript N(EVS_Hammer_UseBasicQuake) = { Call(ChooseNextTarget, ITER_LAST, LVar0) Call(LoadActionCommand, ACTION_COMMAND_SMASH) Call(action_command_hammer_init) - ExecWait(N(EVS_HammerSupport_B)) + ExecWait(N(EVS_HammerSupport_QuakeApproach)) Call(SetGoalToTarget, ACTOR_PLAYER) Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0) - ExecWait(N(EVS_HammerSupport_C)) + ExecWait(N(EVS_HammerSupport_BasicRaiseDelay)) Call(UseBattleCamPreset, BTL_CAM_PLAYER_AIM_HAMMER) Call(AddBattleCamDist, 80) Call(InitTargetIterator) @@ -464,12 +490,12 @@ EvtScript N(EVS_Hammer_UseBasicQuake) = { EndLoop EndIf Add(LVarD, 6) - Call(action_command_hammer_start, 0, LVarD, 3) - Call(SetActionQuality, 0) + Call(action_command_hammer_start, 0, LVarD, AC_DIFFICULTY_3) + Call(SetActionProgress, 0) Set(LVar1, 0) Loop(30) Wait(1) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) IfNe(LVar0, 0) IfNe(LVar1, 1) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB1_Smash1_Hold2) @@ -483,7 +509,7 @@ EvtScript N(EVS_Hammer_UseBasicQuake) = { EndLoop Label(0) Wait(1) - Call(GetActionSuccess, LVar0) + Call(GetSmashActionQuality, LVar0) IfEq(LVar0, 0) Goto(0) EndIf @@ -500,10 +526,10 @@ EvtScript N(EVS_Hammer_UseSuperQuake) = { Call(ChooseNextTarget, ITER_LAST, LVar0) Call(LoadActionCommand, ACTION_COMMAND_SMASH) Call(action_command_hammer_init) - ExecWait(N(EVS_HammerSupport_B)) + ExecWait(N(EVS_HammerSupport_QuakeApproach)) Call(SetGoalToTarget, ACTOR_PLAYER) Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0) - ExecWait(N(EVS_HammerSupport_D)) + ExecWait(N(EVS_HammerSupport_SuperRaiseDelay)) Call(UseBattleCamPreset, BTL_CAM_PLAYER_AIM_HAMMER) Call(AddBattleCamDist, 80) Call(InitTargetIterator) @@ -522,7 +548,7 @@ EvtScript N(EVS_Hammer_UseSuperQuake) = { EndLoop EndIf Add(LVarD, 6) - Call(action_command_hammer_start, 0, LVarD, 3) + Call(action_command_hammer_start, 0, LVarD, AC_DIFFICULTY_3) Loop(60) Wait(1) Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0) @@ -532,7 +558,7 @@ EvtScript N(EVS_Hammer_UseSuperQuake) = { EndLoop Label(0) Wait(1) - Call(GetActionSuccess, LVar0) + Call(GetSmashActionQuality, LVar0) IfEq(LVar0, 0) Goto(0) EndIf @@ -549,10 +575,10 @@ EvtScript N(EVS_Hammer_UseUltraQuake) = { Call(ChooseNextTarget, ITER_LAST, LVar0) Call(LoadActionCommand, ACTION_COMMAND_SMASH) Call(action_command_hammer_init) - ExecWait(N(EVS_HammerSupport_B)) + ExecWait(N(EVS_HammerSupport_QuakeApproach)) Call(SetGoalToTarget, ACTOR_PLAYER) Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0) - ExecWait(N(EVS_HammerSupport_E)) + ExecWait(N(EVS_HammerSupport_UltraRaiseDelay)) Call(UseBattleCamPreset, BTL_CAM_PLAYER_AIM_HAMMER) Call(AddBattleCamDist, 80) Call(InitTargetIterator) @@ -571,7 +597,7 @@ EvtScript N(EVS_Hammer_UseUltraQuake) = { EndLoop EndIf Add(LVarD, 6) - Call(action_command_hammer_start, 0, LVarD, 3) + Call(action_command_hammer_start, 0, LVarD, AC_DIFFICULTY_3) Loop(60) Wait(1) Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0) @@ -581,7 +607,7 @@ EvtScript N(EVS_Hammer_UseUltraQuake) = { EndLoop Label(0) Wait(1) - Call(GetActionSuccess, LVar0) + Call(GetSmashActionQuality, LVar0) IfEq(LVar0, 0) Goto(0) EndIf diff --git a/src/battle/common/move/ItemRefund.inc.c b/src/battle/common/move/ItemRefund.inc.c index c4a7e2ada3b..b5b53975192 100644 --- a/src/battle/common/move/ItemRefund.inc.c +++ b/src/battle/common/move/ItemRefund.inc.c @@ -13,7 +13,7 @@ API_CALLABLE(N(GiveRefund)) { f32 posZ; f32 angle = 0.0f; s32 delayTime = 0; - s32 tempIcon; + HudElemID hid; if (player_team_is_ability_active(player, ABILITY_REFUND) && sellValue > 0) { s32 iconX; @@ -45,19 +45,19 @@ API_CALLABLE(N(GiveRefund)) { #if VERSION_PAL switch (gCurrentLanguage) { case LANGUAGE_EN: - itemIcon = tempIcon = hud_element_create(&HES_Refund); + itemIcon = hid = hud_element_create(&HES_Refund); break; case LANGUAGE_DE: - itemIcon = tempIcon = hud_element_create(&HES_Refund_de); + itemIcon = hid = hud_element_create(&HES_Refund_de); break; case LANGUAGE_FR: - itemIcon = tempIcon = hud_element_create(&HES_Refund_fr); + itemIcon = hid = hud_element_create(&HES_Refund_fr); break; case LANGUAGE_ES: - itemIcon = tempIcon = hud_element_create(&HES_Refund_es); + itemIcon = hid = hud_element_create(&HES_Refund_es); break; } - hud_element_set_render_pos(tempIcon, iconX + 36, iconY - 63); + hud_element_set_render_pos(hid, iconX + 36, iconY - 63); #else itemIcon = hud_element_create(&HES_Refund); hud_element_set_render_pos(itemIcon, iconX + 36, iconY - 63); diff --git a/src/battle/common/move/JumpSupport.inc.c b/src/battle/common/move/JumpSupport.inc.c index 94a6f5a043a..2e5f13968d5 100644 --- a/src/battle/common/move/JumpSupport.inc.c +++ b/src/battle/common/move/JumpSupport.inc.c @@ -24,7 +24,7 @@ API_CALLABLE(N(CalcJumpReboundTime)) { script->varTable[0] = 20; } - if (battleStatus->actionCommandMode != ACTION_COMMAND_MODE_NOT_LEARNED) { + if (battleStatus->actionCommandMode != AC_MODE_NOT_LEARNED) { if (script->varTable[0] < 6) { script->varTable[0] = 6; } @@ -311,7 +311,7 @@ EvtScript N(EVS_JumpSupport_ApproachAndJump) = { Call(action_command_jump_init) ExecWait(N(EVS_JumpSupport_Approach)) ExecWait(N(EVS_JumpSupport_CalcJumpTime)) - Call(action_command_jump_start, LVarA, 3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_MarioB1_Stomp) @@ -329,13 +329,13 @@ EvtScript N(EVS_JumpSupport_UnusedSuper) = { Set(LVarB, LVarA) Add(LVarB, 14) Add(LVarB, -3) - Call(action_command_jump_start, LVarB, 3) + Call(action_command_jump_start, LVarB, AC_DIFFICULTY_3) Call(UseBattleCamPreset, BTL_CAM_PLAYER_SUPER_JUMP_MIDAIR) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Sit, ANIM_Mario1_SpinJump) Call(PlayerSuperJumpToGoal, LVarA, PLAYER_SUPER_JUMP_0) Wait(7) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(PlayerSuperJumpToGoal, 3, PLAYER_SUPER_JUMP_1) @@ -355,14 +355,14 @@ EvtScript N(EVS_JumpSupport_UnusedUltra) = { Set(LVarB, LVarA) Sub(LVarB, 4) Add(LVarB, -3) - Call(action_command_jump_start, LVarB, 3) + Call(action_command_jump_start, LVarB, AC_DIFFICULTY_3) Call(UseBattleCamPreset, BTL_CAM_PLAYER_ULTRA_JUMP_MIDAIR) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_MarioW2_Carried, ANIM_MarioB1_Stomp) Call(PlayerUltraJumpToGoal, LVarA, PLAYER_ULTRA_JUMP_0) - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Set(LVar9, 0) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) IfGt(LVar0, 0) Set(LVar9, 1) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB1_Stomp) @@ -372,14 +372,14 @@ EvtScript N(EVS_JumpSupport_UnusedUltra) = { Call(SetActorDispOffset, ACTOR_SELF, 0, 0, 0) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) - Call(action_command_jump_start, 13, 3) + Call(action_command_jump_start, 13, AC_DIFFICULTY_3) Call(UseBattleCamPreset, BTL_CAM_PLAYER_UNUSED_ULTRA_JUMP) Call(PlayerUltraJumpToGoal, 15, PLAYER_ULTRA_JUMP_2) Goto(10) Else Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) - Call(action_command_jump_start, 2, 3) + Call(action_command_jump_start, 2, AC_DIFFICULTY_3) Call(PlayerUltraJumpToGoal, 4, PLAYER_ULTRA_JUMP_1) Goto(10) EndIf diff --git a/src/battle/common/stage/area_tik/tik_04.inc.c b/src/battle/common/stage/area_tik/tik_04.inc.c index a59c9580e92..2896c8c94cc 100644 --- a/src/battle/common/stage/area_tik/tik_04.inc.c +++ b/src/battle/common/stage/area_tik/tik_04.inc.c @@ -49,5 +49,3 @@ Stage NAMESPACE = { .preBattle = &N(EVS_PreBattle), .postBattle = &N(EVS_PostBattle), }; - - diff --git a/src/battle/dmg_partner.c b/src/battle/dmg_partner.c index 903263cf3af..b2524ae697f 100644 --- a/src/battle/dmg_partner.c +++ b/src/battle/dmg_partner.c @@ -249,7 +249,7 @@ HitResult calc_partner_damage_enemy(void) { } sfx_play_sound_at_position(SOUND_HIT_FIRE, SOUND_SPACE_DEFAULT, state->goalPos.x, state->goalPos.y, state->goalPos.z); - + if (gBattleStatus.flags1 & (BS_FLAGS1_NICE_HIT | BS_FLAGS1_SUPER_HIT)) { return HIT_RESULT_NICE; } else { @@ -1053,7 +1053,7 @@ API_CALLABLE(PartnerDamageEnemy) { PlayerStatus* playerStatus = &gPlayerStatus; Bytecode* args = script->ptrReadPos; Actor* enemy = get_actor(script->owner1.enemyID); - s32 temp_s4 = *args++; + s32 retVar = *args++; s32 flags; s32 damageResult; u8 statusChance; @@ -1119,7 +1119,7 @@ API_CALLABLE(PartnerDamageEnemy) { return ApiStatus_FINISH; } - evt_set_variable(script, temp_s4, damageResult); + evt_set_variable(script, retVar, damageResult); if (!does_script_exist_by_ref(script)) { return ApiStatus_FINISH; @@ -1382,21 +1382,21 @@ API_CALLABLE(DeletePartner) { return ApiStatus_DONE2; } -API_CALLABLE(GetPartnerActionSuccess) { - BattleStatus* battleStatus = &gBattleStatus; - s32 var = *script->ptrReadPos; - s32 actionSuccess = battleStatus->actionSuccess; - s32 outVal = 0; +API_CALLABLE(GetPartnerActionQuality) { + Bytecode* args = script->ptrReadPos; + s32 outVar = *args++; + s32 actionQuality = gBattleStatus.actionQuality; + s32 quality = 0; - if (actionSuccess < outVal) { - actionSuccess = outVal; + if (actionQuality < 0) { + actionQuality = 0; } - if (actionSuccess > outVal) { - outVal = actionSuccess; + if (quality < actionQuality) { + quality = actionQuality; } - evt_set_variable(script, var, outVal); + evt_set_variable(script, outVar, quality); return ApiStatus_DONE2; } diff --git a/src/battle/dmg_player.c b/src/battle/dmg_player.c index 3939391832d..3d2d4532b80 100644 --- a/src/battle/dmg_player.c +++ b/src/battle/dmg_player.c @@ -1917,7 +1917,7 @@ API_CALLABLE(PlayerBasicJumpToGoal) { } break; case BASIC_STATE_02: - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { return ApiStatus_DONE2; } playerState->moveTime = 1; @@ -2507,21 +2507,21 @@ API_CALLABLE(PlayerUltraJumpToGoal) { return ApiStatus_BLOCK; } -API_CALLABLE(GetPlayerActionSuccess) { +API_CALLABLE(GetPlayerActionQuality) { Bytecode* args = script->ptrReadPos; s32 outVar = *args++; - s32 actionSuccess = gBattleStatus.actionSuccess; - s32 actionSucceeded = 0; + s32 actionQuality = gBattleStatus.actionQuality; + s32 quality = 0; - if (actionSuccess < 0) { - actionSuccess = 0; + if (actionQuality < 0) { + actionQuality = 0; } - if (actionSucceeded < actionSuccess) { - actionSucceeded = actionSuccess; + if (quality < actionQuality) { + quality = actionQuality; } - evt_set_variable(script, outVar, actionSucceeded); + evt_set_variable(script, outVar, quality); return ApiStatus_DONE2; } diff --git a/src/battle/level_up.c b/src/battle/level_up.c index d6fe1a4d2b2..3d3566765e3 100644 --- a/src/battle/level_up.c +++ b/src/battle/level_up.c @@ -495,7 +495,7 @@ void btl_state_update_celebration(void) { Actor* partner = battleStatus->partnerActor; s8 currentSubmenu; s32 newSubmenu; - s32 id; + HudElemID hid; s32 x, y, z; s32 width; s32 itemHudElemID; @@ -666,60 +666,60 @@ void btl_state_update_celebration(void) { mdl_set_shroud_tint_params(0, 0, 0, ((10 - CelebrateSubstateTime) * 16) & 0xF0); } } else { - id = hud_element_create(&HES_level_up_heart); - LevelUpStatEmblemIDs[0] = id; - hud_element_set_render_pos(id, 310, 140); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - - id = hud_element_create(&HES_level_up_flower); - LevelUpStatEmblemIDs[1] = id; - hud_element_set_render_pos(id, 158, 340); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - - id = hud_element_create(&HES_level_up_leaves); - LevelUpStatEmblemIDs[3] = id; - hud_element_set_render_pos(id, 158, 340); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - - id = hud_element_create(&HES_level_up_badge); - LevelUpStatEmblemIDs[2] = id; - hud_element_set_render_pos(id, 6, 140); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); - - id = hud_element_create(levelup_stat_scripts[0]); - LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_TITLE] = id; - hud_element_set_render_pos(id, 160, 317); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); + hid = hud_element_create(&HES_level_up_heart); + LevelUpStatEmblemIDs[0] = hid; + hud_element_set_render_pos(hid, 310, 140); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + + hid = hud_element_create(&HES_level_up_flower); + LevelUpStatEmblemIDs[1] = hid; + hud_element_set_render_pos(hid, 158, 340); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + + hid = hud_element_create(&HES_level_up_leaves); + LevelUpStatEmblemIDs[3] = hid; + hud_element_set_render_pos(hid, 158, 340); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + + hid = hud_element_create(&HES_level_up_badge); + LevelUpStatEmblemIDs[2] = hid; + hud_element_set_render_pos(hid, 6, 140); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + + hid = hud_element_create(levelup_stat_scripts[0]); + LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_TITLE] = hid; + hud_element_set_render_pos(hid, 160, 317); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); for (i = 1; i < ARRAY_COUNT(LevelUpStatTextIDs[LVL_UP_FP]); i++) { - id = hud_element_create(HES_LevelUpDigits[LVL_UP_FP][0]); - LevelUpStatTextIDs[LVL_UP_FP][i] = id; - hud_element_set_render_pos(id, 160, 317); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hid = hud_element_create(HES_LevelUpDigits[LVL_UP_FP][0]); + LevelUpStatTextIDs[LVL_UP_FP][i] = hid; + hud_element_set_render_pos(hid, 160, 317); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); } - id = hud_element_create(levelup_stat_scripts[1]); - LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_TITLE] = id; - hud_element_set_render_pos(id, 312, 117); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); + hid = hud_element_create(levelup_stat_scripts[1]); + LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_TITLE] = hid; + hud_element_set_render_pos(hid, 312, 117); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); for (i = 1; i < ARRAY_COUNT(LevelUpStatTextIDs[LVL_UP_HP]); i++) { - id = hud_element_create(HES_LevelUpDigits[LVL_UP_HP][0]); - LevelUpStatTextIDs[LVL_UP_HP][i] = id; - hud_element_set_render_pos(id, 312, 117); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hid = hud_element_create(HES_LevelUpDigits[LVL_UP_HP][0]); + LevelUpStatTextIDs[LVL_UP_HP][i] = hid; + hud_element_set_render_pos(hid, 312, 117); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); } - id = hud_element_create(levelup_stat_scripts[2]); - LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_TITLE] = id; - hud_element_set_render_pos(id, 8, 117); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); + hid = hud_element_create(levelup_stat_scripts[2]); + LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_TITLE] = hid; + hud_element_set_render_pos(hid, 8, 117); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); for (i = 1; i < ARRAY_COUNT(LevelUpStatTextIDs[LVL_UP_BP]); i++) { - id = hud_element_create(HES_LevelUpDigits[LVL_UP_BP][0]); - LevelUpStatTextIDs[LVL_UP_BP][i] = id; - hud_element_set_render_pos(id, 8, 117); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hid = hud_element_create(HES_LevelUpDigits[LVL_UP_BP][0]); + LevelUpStatTextIDs[LVL_UP_BP][i] = hid; + hud_element_set_render_pos(hid, 8, 117); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); } CantLevelUpStat[MENU_HP] = FALSE; @@ -730,70 +730,70 @@ void btl_state_update_celebration(void) { // current FP tensDigit = playerData->curMaxFP / 10; onesDigit = playerData->curMaxFP % 10; - id = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_CUR_TENS]; - hud_element_set_script(id, level_up_small_digit_scripts[LVL_UP_FP][tensDigit]); + hid = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_CUR_TENS]; + hud_element_set_script(hid, level_up_small_digit_scripts[LVL_UP_FP][tensDigit]); if (tensDigit != 0) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x - 14, y + 46); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x - 14, y + 46); - id = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_CUR_ONES]; - hud_element_set_script(id, level_up_small_digit_scripts[LVL_UP_FP][onesDigit]); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x - 8, y + 46); + hid = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_CUR_ONES]; + hud_element_set_script(hid, level_up_small_digit_scripts[LVL_UP_FP][onesDigit]); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x - 8, y + 46); - id = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_ARROW]; - hud_element_set_script(id, &HES_level_up_small_green_arrow); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x - 3, y + 46); + hid = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_ARROW]; + hud_element_set_script(hid, &HES_level_up_small_green_arrow); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x - 3, y + 46); // upgraded FP tensDigit = (playerData->curMaxFP + 5) / 10; onesDigit = (playerData->curMaxFP + 5) % 10; - id = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_NEXT_TENS]; - hud_element_set_script(id, HES_LevelUpDigits[LVL_UP_FP][tensDigit]); + hid = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_NEXT_TENS]; + hud_element_set_script(hid, HES_LevelUpDigits[LVL_UP_FP][tensDigit]); if (tensDigit != 0) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x + 3, y + 46); - - id = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_NEXT_ONES]; - hud_element_set_script(id, HES_LevelUpDigits[LVL_UP_FP][onesDigit]); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x + 10, y + 46); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x + 3, y + 46); + + hid = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_NEXT_ONES]; + hud_element_set_script(hid, HES_LevelUpDigits[LVL_UP_FP][onesDigit]); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x + 10, y + 46); } else { // upgraded FP only - id = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_NEXT_TENS]; + hid = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_NEXT_TENS]; tensDigit = playerData->curMaxFP / 10; onesDigit = playerData->curMaxFP % 10; - hud_element_set_script(id, HES_LevelUpDigits[LVL_UP_FP][tensDigit]); + hud_element_set_script(hid, HES_LevelUpDigits[LVL_UP_FP][tensDigit]); if (tensDigit != 0) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x - 6, y + 46); - - id = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_NEXT_ONES]; - hud_element_set_script(id, HES_LevelUpDigits[LVL_UP_FP][onesDigit]); - hud_element_clear_flags(id, 2); - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x + 2, y + 46); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x - 6, y + 46); + + hid = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_NEXT_ONES]; + hud_element_set_script(hid, HES_LevelUpDigits[LVL_UP_FP][onesDigit]); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x + 2, y + 46); CantLevelUpStat[MENU_FP] = TRUE; } if (is_ability_active(ABILITY_FP_PLUS)) { - id = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_BONUS]; + hid = LevelUpStatTextIDs[LVL_UP_FP][LVL_UP_BONUS]; itemHudElemID = gItemTable[ITEM_FP_PLUS_A].hudElemID; - hud_element_set_script(id, gItemHudScripts[itemHudElemID].enabled); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_scale(id, 0.5f); - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x + 17, y + 46); + hud_element_set_script(hid, gItemHudScripts[itemHudElemID].enabled); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_scale(hid, 0.5f); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x + 17, y + 46); } if (playerData->hardMaxHP != 50) { @@ -801,140 +801,140 @@ void btl_state_update_celebration(void) { tensDigit = playerData->curMaxHP / 10; onesDigit = playerData->curMaxHP % 10; - id = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_CUR_TENS]; - hud_element_set_script(id, level_up_small_digit_scripts[LVL_UP_HP][tensDigit]); + hid = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_CUR_TENS]; + hud_element_set_script(hid, level_up_small_digit_scripts[LVL_UP_HP][tensDigit]); if (tensDigit != 0) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x - 14, y + 46); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x - 14, y + 46); - id = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_CUR_ONES]; - hud_element_set_script(id, level_up_small_digit_scripts[LVL_UP_HP][onesDigit]); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x - 8, y + 46); + hid = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_CUR_ONES]; + hud_element_set_script(hid, level_up_small_digit_scripts[LVL_UP_HP][onesDigit]); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x - 8, y + 46); - id = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_ARROW]; - hud_element_set_script(id, &HES_level_up_small_red_arrow); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x - 3, y + 46); + hid = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_ARROW]; + hud_element_set_script(hid, &HES_level_up_small_red_arrow); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x - 3, y + 46); tensDigit = (playerData->curMaxHP + 5) / 10; onesDigit = (playerData->curMaxHP + 5) % 10; - id = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_NEXT_TENS]; - hud_element_set_script(id, HES_LevelUpDigits[LVL_UP_HP][tensDigit]); + hid = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_NEXT_TENS]; + hud_element_set_script(hid, HES_LevelUpDigits[LVL_UP_HP][tensDigit]); if (tensDigit != 0) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x + 3, y + 46); - - id = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_NEXT_ONES]; - hud_element_set_script(id, HES_LevelUpDigits[LVL_UP_HP][onesDigit]); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x + 10, y + 46); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x + 3, y + 46); + + hid = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_NEXT_ONES]; + hud_element_set_script(hid, HES_LevelUpDigits[LVL_UP_HP][onesDigit]); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x + 10, y + 46); } else { tensDigit = playerData->curMaxHP / 10; onesDigit = playerData->curMaxHP % 10; - id = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_NEXT_TENS]; - hud_element_set_script(id, HES_LevelUpDigits[LVL_UP_HP][tensDigit]); + hid = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_NEXT_TENS]; + hud_element_set_script(hid, HES_LevelUpDigits[LVL_UP_HP][tensDigit]); if (tensDigit != 0) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x - 6, y + 46); - - id = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_NEXT_ONES]; - hud_element_set_script(id, HES_LevelUpDigits[LVL_UP_HP][onesDigit]); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x + 2, y + 46); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x - 6, y + 46); + + hid = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_NEXT_ONES]; + hud_element_set_script(hid, HES_LevelUpDigits[LVL_UP_HP][onesDigit]); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x + 2, y + 46); CantLevelUpStat[MENU_HP] = TRUE; } if (is_ability_active(ABILITY_HP_PLUS)) { - id = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_BONUS]; + hid = LevelUpStatTextIDs[LVL_UP_HP][LVL_UP_BONUS]; itemHudElemID = gItemTable[ITEM_HP_PLUS_A].hudElemID; - hud_element_set_script(id, gItemHudScripts[itemHudElemID].enabled); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_scale(id, 0.5f); - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x + 17, y + 46); + hud_element_set_script(hid, gItemHudScripts[itemHudElemID].enabled); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_scale(hid, 0.5f); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x + 17, y + 46); } if (playerData->maxBP != 30) { tensDigit = playerData->maxBP / 10; onesDigit = playerData->maxBP % 10; - id = LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_CUR_TENS]; - hud_element_set_script(id, level_up_small_digit_scripts[LVL_UP_BP][tensDigit]); + hid = LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_CUR_TENS]; + hud_element_set_script(hid, level_up_small_digit_scripts[LVL_UP_BP][tensDigit]); if (tensDigit != 0) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x - 14, y + 46); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x - 14, y + 46); - id = LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_CUR_ONES]; - hud_element_set_script(id, level_up_small_digit_scripts[LVL_UP_BP][onesDigit]); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x - 8, y + 46); + hid = LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_CUR_ONES]; + hud_element_set_script(hid, level_up_small_digit_scripts[LVL_UP_BP][onesDigit]); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x - 8, y + 46); - id = LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_ARROW]; - hud_element_set_script(id, &HES_level_up_small_blue_arrow); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x - 3, y + 46); + hid = LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_ARROW]; + hud_element_set_script(hid, &HES_level_up_small_blue_arrow); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x - 3, y + 46); tensDigit = (playerData->maxBP + 3) / 10; onesDigit = (playerData->maxBP + 3) % 10; - id = LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_NEXT_TENS]; - hud_element_set_script(id, HES_LevelUpDigits[LVL_UP_BP][tensDigit]); + hid = LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_NEXT_TENS]; + hud_element_set_script(hid, HES_LevelUpDigits[LVL_UP_BP][tensDigit]); if (tensDigit != 0) { - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); } - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x + 3, y + 46); - - id = LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_NEXT_ONES]; - hud_element_set_script(id, HES_LevelUpDigits[LVL_UP_BP][onesDigit]); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x + 10, y + 46); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x + 3, y + 46); + + hid = LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_NEXT_ONES]; + hud_element_set_script(hid, HES_LevelUpDigits[LVL_UP_BP][onesDigit]); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x + 10, y + 46); } else { - id = LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_NEXT_TENS]; - hud_element_set_script(id, HES_LevelUpDigits[LVL_UP_BP][3]); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x - 6, y + 46); - - id = LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_NEXT_ONES]; - hud_element_set_script(id, HES_LevelUpDigits[LVL_UP_BP][0]); - hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - hud_element_get_render_pos(id, &x, &y); - hud_element_set_render_pos(id, x + 2, y + 46); + hid = LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_NEXT_TENS]; + hud_element_set_script(hid, HES_LevelUpDigits[LVL_UP_BP][3]); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x - 6, y + 46); + + hid = LevelUpStatTextIDs[LVL_UP_BP][LVL_UP_NEXT_ONES]; + hud_element_set_script(hid, HES_LevelUpDigits[LVL_UP_BP][0]); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_get_render_pos(hid, &x, &y); + hud_element_set_render_pos(hid, x + 2, y + 46); CantLevelUpStat[MENU_BP] = TRUE; } - id = LevelUpSpotlightID = hud_element_create(&HES_ProjectorBeam); - hud_element_create_transform_B(id); - hud_element_set_render_pos(id, 156, 13); - hud_element_set_tint(id, 255, 255, 255); - hud_element_set_transform_rotation_pivot(id, 0, -35); - hud_element_set_transform_rotation(id, 0.0f, 0.0f, 180.0f); - hud_element_set_transform_scale(id, 1.0f, 1.5f, 1.0f); - hud_element_set_alpha(id, 200); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX | HUD_ELEMENT_FLAG_80); - - id = LevelUpSelectTextID = hud_element_create(&HES_level_up_select_one_to_upgrade); - hud_element_set_render_pos(id, 0, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); + LevelUpSpotlightID = hid = hud_element_create(&HES_ProjectorBeam); + hud_element_create_transform_B(hid); + hud_element_set_render_pos(hid, 156, 13); + hud_element_set_tint(hid, 255, 255, 255); + hud_element_set_transform_rotation_pivot(hid, 0, -35); + hud_element_set_transform_rotation(hid, 0.0f, 0.0f, 180.0f); + hud_element_set_transform_scale(hid, 1.0f, 1.5f, 1.0f); + hud_element_set_alpha(hid, 200); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX | HUD_ELEMENT_FLAG_80); + + LevelUpSelectTextID = hid = hud_element_create(&HES_level_up_select_one_to_upgrade); + hud_element_set_render_pos(hid, 0, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); battleStatus->curSubmenu = 1; CelebrateSubstateTime = 10; @@ -942,50 +942,50 @@ void btl_state_update_celebration(void) { } break; case BTL_SUBSTATE_CELEBRATE_LEVEL_UP_SHOW_HUD: - id = LevelUpStatEmblemIDs[0]; - hud_element_get_render_pos(id, &x, &y); + hid = LevelUpStatEmblemIDs[0]; + hud_element_get_render_pos(hid, &x, &y); x -= 20; - hud_element_set_render_pos(id, x, y); + hud_element_set_render_pos(hid, x, y); for (i = 0; i < ARRAY_COUNT(LevelUpStatTextIDs[LVL_UP_HP]); i++) { - id = LevelUpStatTextIDs[LVL_UP_HP][i]; - hud_element_get_render_pos(id, &x, &y); + hid = LevelUpStatTextIDs[LVL_UP_HP][i]; + hud_element_get_render_pos(hid, &x, &y); x -= 20; - hud_element_set_render_pos(id, x, y); + hud_element_set_render_pos(hid, x, y); } - id = LevelUpStatEmblemIDs[1]; - hud_element_get_render_pos(id, &x, &y); + hid = LevelUpStatEmblemIDs[1]; + hud_element_get_render_pos(hid, &x, &y); y -= 20; - hud_element_set_render_pos(id, x, y); + hud_element_set_render_pos(hid, x, y); - id = LevelUpStatEmblemIDs[3]; - hud_element_get_render_pos(id, &x, &y); + hid = LevelUpStatEmblemIDs[3]; + hud_element_get_render_pos(hid, &x, &y); y -= 20; - hud_element_set_render_pos(id, x, y); + hud_element_set_render_pos(hid, x, y); for (i = 0; i < ARRAY_COUNT(LevelUpStatTextIDs[LVL_UP_FP]); i++) { - id = LevelUpStatTextIDs[LVL_UP_FP][i]; - hud_element_get_render_pos(id, &x, &y); + hid = LevelUpStatTextIDs[LVL_UP_FP][i]; + hud_element_get_render_pos(hid, &x, &y); y -= 20; - hud_element_set_render_pos(id, x, y); + hud_element_set_render_pos(hid, x, y); } - id = LevelUpStatEmblemIDs[2]; - hud_element_get_render_pos(id, &x, &y); + hid = LevelUpStatEmblemIDs[2]; + hud_element_get_render_pos(hid, &x, &y); x += 20; - hud_element_set_render_pos(id, x, y); + hud_element_set_render_pos(hid, x, y); for (i = 0; i < ARRAY_COUNT(LevelUpStatTextIDs[LVL_UP_BP]); i++) { - id = LevelUpStatTextIDs[LVL_UP_BP][i]; - hud_element_get_render_pos(id, &x, &y); + hid = LevelUpStatTextIDs[LVL_UP_BP][i]; + hud_element_get_render_pos(hid, &x, &y); x += 20; - hud_element_set_render_pos(id, x, y); + hud_element_set_render_pos(hid, x, y); } CelebrateSubstateTime--; if (CelebrateSubstateTime == 0) { - hud_element_set_tint(id, 128, 128, 128); + hud_element_set_tint(hid, 128, 128, 128); #if VERSION_JP x = 32; y = 186; diff --git a/src/battle/move/hammer/attack.c b/src/battle/move/hammer/attack.c index 86ccf5159f4..bc905e9de3d 100644 --- a/src/battle/move/hammer/attack.c +++ b/src/battle/move/hammer/attack.c @@ -15,19 +15,19 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 45) - Set(LVarE, 1) - Set(LVarF, 2) + Set(LVarD, 45)// action command duration + Set(LVarE, 1) // bad input dmg + Set(LVarF, 2) // good input dmg ExecWait(N(EVS_UseMove_Impl)) CaseEq(1) - Set(LVarD, 45) - Set(LVarE, 2) - Set(LVarF, 4) + Set(LVarD, 45)// action command duration + Set(LVarE, 2) // bad input dmg + Set(LVarF, 4) // good input dmg ExecWait(N(EVS_UseMove_Impl)) CaseEq(2) - Set(LVarD, 45) - Set(LVarE, 3) - Set(LVarF, 6) + Set(LVarD, 45)// action command duration + Set(LVarE, 3) // bad input dmg + Set(LVarF, 6) // good input dmg ExecWait(N(EVS_UseMove_Impl)) EndSwitch Return @@ -44,7 +44,7 @@ EvtScript N(EVS_UseMove_Impl) = { CaseEq(2) ExecWait(N(EVS_UseUltraHammer)) EndSwitch - Call(GetActionSuccessCopy, LVar0) + Call(GetMashActionQuality, LVar0) // incorrect use, should use GetSmashActionQuality Switch(LVar0) CaseGt(0) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -89,10 +89,10 @@ EvtScript N(EVS_UseMove_Impl) = { Wait(1) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16) IfEq(LVar0, HIT_RESULT_MISS) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -120,11 +120,11 @@ EvtScript N(EVS_UseMove_Impl) = { Switch(LVar0) CaseOrEq(HIT_RESULT_NICE) CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_A)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashSuccess)) EndCaseGroup CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) EndCaseGroup EndSwitch Return @@ -188,7 +188,7 @@ EvtScript N(EVS_FirstStrike) = { Wait(1) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16) IfEq(LVar0, HIT_RESULT_MISS) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -201,7 +201,7 @@ EvtScript N(EVS_FirstStrike) = { Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT) EndSwitch Call(PlayerDamageEnemy, LVar0, DAMAGE_TYPE_SMASH, SUPPRESS_EVENTS_HAMMER, 0, LVar9, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_TRIGGER_EVENTS) - ExecWait(N(EVS_Hammer_ReturnHome_A)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashSuccess)) Return End }; @@ -213,19 +213,19 @@ EvtScript N(EVS_UseBerserker) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 75) - Set(LVarE, 1) - Set(LVarF, 2) + Set(LVarD, 75) // action command duration + Set(LVarE, 1) // bad input dmg + Set(LVarF, 2) // good input dmg ExecWait(N(EVS_UseBerserker_Impl)) CaseEq(1) - Set(LVarD, 66) - Set(LVarE, 2) - Set(LVarF, 4) + Set(LVarD, 66) // action command duration + Set(LVarE, 2) // bad input dmg + Set(LVarF, 4) // good input dmg ExecWait(N(EVS_UseBerserker_Impl)) CaseEq(2) - Set(LVarD, 57) - Set(LVarE, 3) - Set(LVarF, 6) + Set(LVarD, 57) // action command duration + Set(LVarE, 3) // bad input dmg + Set(LVarF, 6) // good input dmg ExecWait(N(EVS_UseBerserker_Impl)) EndSwitch Return @@ -263,10 +263,10 @@ EvtScript N(EVS_UseBerserker_Impl) = { EndThread EndSwitch Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_STRIKE) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf - Call(GetActionSuccessCopy, LVar0) + Call(GetMashActionQuality, LVar0) // incorrect use, should use GetSmashActionQuality Switch(LVar0) CaseGt(0) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -311,10 +311,10 @@ EvtScript N(EVS_UseBerserker_Impl) = { Wait(1) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16) IfEq(LVar0, HIT_RESULT_MISS) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -342,11 +342,11 @@ EvtScript N(EVS_UseBerserker_Impl) = { Switch(LVar0) CaseOrEq(HIT_RESULT_NICE) CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_A)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashSuccess)) EndCaseGroup CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) EndCaseGroup EndSwitch Return diff --git a/src/battle/move/hammer/auto_smash.c b/src/battle/move/hammer/auto_smash.c index b3224086aa9..d74e6323568 100644 --- a/src/battle/move/hammer/auto_smash.c +++ b/src/battle/move/hammer/auto_smash.c @@ -13,19 +13,19 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 45) - Set(LVarE, 1) - Set(LVarF, 2) + Set(LVarD, 45) // duration + Set(LVarE, BASIC_HAMMER_DMG_BAD) + Set(LVarF, BASIC_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove_Impl)) CaseEq(1) - Set(LVarD, 45) - Set(LVarE, 2) - Set(LVarF, 4) + Set(LVarD, 45) // duration + Set(LVarE, SUPER_HAMMER_DMG_BAD) + Set(LVarF, SUPER_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove_Impl)) CaseEq(2) - Set(LVarD, 45) - Set(LVarE, 3) - Set(LVarF, 6) + Set(LVarD, 45) // duration + Set(LVarE, ULTRA_HAMMER_DMG_BAD) + Set(LVarF, ULTRA_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove_Impl)) EndSwitch Return @@ -43,7 +43,7 @@ EvtScript N(EVS_UseMove_Impl) = { ExecWait(N(EVS_UseUltraHammer)) EndSwitch Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, LVar9, BS_FLAGS1_INCLUDE_POWER_UPS) - Call(GetActionSuccessCopy, LVar0) + Call(GetMashActionQuality, LVar0) // incorrect use, should use GetSmashActionQuality Switch(LVar0) CaseGt(0) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -88,10 +88,10 @@ EvtScript N(EVS_UseMove_Impl) = { Wait(1) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16) IfEq(LVar0, HIT_RESULT_MISS) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -119,11 +119,11 @@ EvtScript N(EVS_UseMove_Impl) = { Switch(LVar0) CaseOrEq(HIT_RESULT_NICE) CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_A)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashSuccess)) EndCaseGroup CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) EndCaseGroup EndSwitch Return diff --git a/src/battle/move/hammer/d_down_pound.c b/src/battle/move/hammer/d_down_pound.c index 3cef97004a6..e9b17477ed9 100644 --- a/src/battle/move/hammer/d_down_pound.c +++ b/src/battle/move/hammer/d_down_pound.c @@ -6,22 +6,23 @@ #include "battle/common/move/HammerSupport.inc.c" -API_CALLABLE(func_802A10A4_74AE34) { +API_CALLABLE(N(MakeGreenImpactFX)) { Bytecode* args = script->ptrReadPos; - s32 var0 = evt_get_variable(script, *args++); - s32 var1 = evt_get_variable(script, *args++); - s32 var2 = evt_get_variable(script, *args++); + s32 x = evt_get_variable(script, *args++); + s32 y = evt_get_variable(script, *args++); + s32 z = evt_get_variable(script, *args++); + b32 success = script->varTable[10]; // value from GetPlayerActionQuality - if (script->varTable[10] == 0) { - fx_green_impact(TRUE, var0 + 30, var1 + 25, var2, 45.0f); + if (!success) { + fx_green_impact(TRUE, x + 30, y + 25, z, 45.0f); } else { - fx_green_impact(FALSE, var0 + 30, var1 + 25, var2, 45.0f); + fx_green_impact(FALSE, x + 30, y + 25, z, 45.0f); } return ApiStatus_DONE2; } -extern EvtScript N(UseMove_Impl); +extern EvtScript N(EVS_UseMove_Impl); EvtScript N(EVS_UseMove) = { Call(ShowActionHud, TRUE) @@ -29,26 +30,26 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 50) - Set(LVarE, 1) - Set(LVarF, 2) - ExecWait(N(UseMove_Impl)) + Set(LVarD, 50) // duration + Set(LVarE, BASIC_HAMMER_DMG_BAD) + Set(LVarF, BASIC_HAMMER_DMG_GOOD) + ExecWait(N(EVS_UseMove_Impl)) CaseEq(1) - Set(LVarD, 50) - Set(LVarE, 2) - Set(LVarF, 4) - ExecWait(N(UseMove_Impl)) + Set(LVarD, 50) // duration + Set(LVarE, SUPER_HAMMER_DMG_BAD) + Set(LVarF, SUPER_HAMMER_DMG_GOOD) + ExecWait(N(EVS_UseMove_Impl)) CaseEq(2) - Set(LVarD, 50) - Set(LVarE, 3) - Set(LVarF, 6) - ExecWait(N(UseMove_Impl)) + Set(LVarD, 50) // duration + Set(LVarE, ULTRA_HAMMER_DMG_BAD) + Set(LVarF, ULTRA_HAMMER_DMG_GOOD) + ExecWait(N(EVS_UseMove_Impl)) EndSwitch Return End }; -EvtScript N(UseMove_Impl) = { +EvtScript N(EVS_UseMove_Impl) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) @@ -59,7 +60,7 @@ EvtScript N(UseMove_Impl) = { ExecWait(N(EVS_UseUltraHammer)) EndSwitch Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH | DAMAGE_TYPE_IGNORE_DEFENSE, 25, 0, LVar9, 16) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -100,7 +101,7 @@ EvtScript N(UseMove_Impl) = { EndThread EndSwitch EndSwitch - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) IfGt(LVar0, FALSE) Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_STRIKE) Call(MoveBattleCamOver, 5) @@ -119,13 +120,13 @@ EvtScript N(UseMove_Impl) = { EndSwitch Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16) IfEq(LVar0, HIT_RESULT_MISS) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf - Call(GetPlayerActionSuccess, LVarA) + Call(GetPlayerActionQuality, LVarA) Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) - Call(func_802A10A4_74AE34, LVar0, LVar1, LVar2) - Call(GetPlayerActionSuccess, LVar0) + Call(N(MakeGreenImpactFX), LVar0, LVar1, LVar2) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(PlayerDamageEnemy, LVar0, DAMAGE_TYPE_SMASH | DAMAGE_TYPE_IGNORE_DEFENSE, SUPPRESS_EVENTS_HAMMER, 0, LVarF, BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_NICE_HIT) @@ -135,11 +136,11 @@ EvtScript N(UseMove_Impl) = { Switch(LVar0) CaseOrEq(HIT_RESULT_NICE) CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_A)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashSuccess)) EndCaseGroup CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) EndCaseGroup EndSwitch Return diff --git a/src/battle/move/hammer/hammer_charge_0.c b/src/battle/move/hammer/hammer_charge_0.c index 891cf02b054..001fcc0d996 100644 --- a/src/battle/move/hammer/hammer_charge_0.c +++ b/src/battle/move/hammer/hammer_charge_0.c @@ -41,32 +41,32 @@ API_CALLABLE(func_802A11CC_74F2FC) { return ApiStatus_DONE2; } -extern EvtScript N(EVS_802A3348); +extern EvtScript N(EVS_UseMove1_Impl); EvtScript N(EVS_UseMove1) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 65) - Set(LVarE, 1) - Set(LVarF, 2) - ExecWait(N(EVS_802A3348)) + Set(LVarD, 65) // duration + Set(LVarE, BASIC_HAMMER_DMG_BAD) + Set(LVarF, BASIC_HAMMER_DMG_GOOD) + ExecWait(N(EVS_UseMove1_Impl)) CaseEq(1) - Set(LVarD, 65) - Set(LVarE, 2) - Set(LVarF, 4) - ExecWait(N(EVS_802A3348)) + Set(LVarD, 65) // duration + Set(LVarE, SUPER_HAMMER_DMG_BAD) + Set(LVarF, SUPER_HAMMER_DMG_GOOD) + ExecWait(N(EVS_UseMove1_Impl)) CaseEq(2) - Set(LVarD, 65) - Set(LVarE, 4) - Set(LVarF, 6) - ExecWait(N(EVS_802A3348)) + Set(LVarD, 65) // duration + Set(LVarE, ULTRA_HAMMER_DMG_BAD + 1) + Set(LVarF, ULTRA_HAMMER_DMG_GOOD) + ExecWait(N(EVS_UseMove1_Impl)) EndSwitch Return End }; -EvtScript N(EVS_802A3348) = { +EvtScript N(EVS_UseMove1_Impl) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) @@ -77,7 +77,7 @@ EvtScript N(EVS_802A3348) = { ExecWait(N(EVS_UseBasicHammer)) EndSwitch Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, LVar9, 16) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -121,11 +121,11 @@ EvtScript N(EVS_802A3348) = { Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_STRIKE) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16) IfEq(LVar0, HIT_RESULT_MISS) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf Set(LFlag0, FALSE) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -155,11 +155,11 @@ EvtScript N(EVS_802A3348) = { Switch(LVar0) CaseOrEq(HIT_RESULT_NICE) CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_A)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashSuccess)) EndCaseGroup CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) EndCaseGroup EndSwitch Return @@ -336,5 +336,3 @@ EvtScript N(EVS_802A3FD8) = { Return End }; - - diff --git a/src/battle/move/hammer/hammer_charge_1.c b/src/battle/move/hammer/hammer_charge_1.c index 8506e059b82..65e9447cb36 100644 --- a/src/battle/move/hammer/hammer_charge_1.c +++ b/src/battle/move/hammer/hammer_charge_1.c @@ -56,19 +56,19 @@ EvtScript N(EVS_UseMove1) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 65) - Set(LVarE, 1) - Set(LVarF, 2) + Set(LVarD, 65) // duration + Set(LVarE, BASIC_HAMMER_DMG_BAD) + Set(LVarF, BASIC_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove1_Impl)) CaseEq(1) - Set(LVarD, 65) - Set(LVarE, 2) - Set(LVarF, 4) + Set(LVarD, 65) // duration + Set(LVarE, SUPER_HAMMER_DMG_BAD) + Set(LVarF, SUPER_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove1_Impl)) CaseEq(2) - Set(LVarD, 65) - Set(LVarE, 4) - Set(LVarF, 6) + Set(LVarD, 65) // duration + Set(LVarE, ULTRA_HAMMER_DMG_BAD + 1) + Set(LVarF, ULTRA_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove1_Impl)) EndSwitch Return @@ -86,7 +86,7 @@ EvtScript N(EVS_UseMove1_Impl) = { ExecWait(N(EVS_UseBasicHammer)) EndSwitch Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, LVar9, 16) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -130,11 +130,11 @@ EvtScript N(EVS_UseMove1_Impl) = { Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_STRIKE) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16) IfEq(LVar0, HIT_RESULT_MISS) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf Set(LFlag0, FALSE) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -164,11 +164,11 @@ EvtScript N(EVS_UseMove1_Impl) = { Switch(LVar0) CaseOrEq(HIT_RESULT_NICE) CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_A)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashSuccess)) EndCaseGroup CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) EndCaseGroup EndSwitch Return diff --git a/src/battle/move/hammer/hammer_charge_2.c b/src/battle/move/hammer/hammer_charge_2.c index 33f6570675d..ba4cb30e184 100644 --- a/src/battle/move/hammer/hammer_charge_2.c +++ b/src/battle/move/hammer/hammer_charge_2.c @@ -56,19 +56,19 @@ EvtScript N(EVS_UseMove1) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 65) - Set(LVarE, 1) - Set(LVarF, 2) + Set(LVarD, 65) // duration + Set(LVarE, BASIC_HAMMER_DMG_BAD) + Set(LVarF, BASIC_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove1_Impl)) CaseEq(1) - Set(LVarD, 65) - Set(LVarE, 2) - Set(LVarF, 4) + Set(LVarD, 65) // duration + Set(LVarE, SUPER_HAMMER_DMG_BAD) + Set(LVarF, SUPER_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove1_Impl)) CaseEq(2) - Set(LVarD, 65) - Set(LVarE, 4) - Set(LVarF, 6) + Set(LVarD, 65) // duration + Set(LVarE, ULTRA_HAMMER_DMG_BAD + 1) + Set(LVarF, ULTRA_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove1_Impl)) EndSwitch Return @@ -86,7 +86,7 @@ EvtScript N(EVS_UseMove1_Impl) = { ExecWait(N(EVS_UseBasicHammer)) EndSwitch Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, LVar9, 16) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -130,11 +130,11 @@ EvtScript N(EVS_UseMove1_Impl) = { Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_STRIKE) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16) IfEq(LVar0, HIT_RESULT_MISS) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf Set(LFlag0, FALSE) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -164,11 +164,11 @@ EvtScript N(EVS_UseMove1_Impl) = { Switch(LVar0) CaseOrEq(HIT_RESULT_NICE) CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_A)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashSuccess)) EndCaseGroup CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) EndCaseGroup EndSwitch Return diff --git a/src/battle/move/hammer/hammer_throw.c b/src/battle/move/hammer/hammer_throw.c index efd1d531a08..8721bc8fe79 100644 --- a/src/battle/move/hammer/hammer_throw.c +++ b/src/battle/move/hammer/hammer_throw.c @@ -41,19 +41,19 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 50) - Set(LVarE, 1) - Set(LVarF, 2) + Set(LVarD, 50) // duration + Set(LVarE, BASIC_HAMMER_DMG_BAD) + Set(LVarF, BASIC_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove_Impl)) CaseEq(1) - Set(LVarD, 50) - Set(LVarE, 2) - Set(LVarF, 4) + Set(LVarD, 50) // duration + Set(LVarE, SUPER_HAMMER_DMG_BAD) + Set(LVarF, SUPER_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove_Impl)) CaseEq(2) - Set(LVarD, 50) - Set(LVarE, 3) - Set(LVarF, 6) + Set(LVarD, 50) // duration + Set(LVarE, ULTRA_HAMMER_DMG_BAD) + Set(LVarF, ULTRA_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove_Impl)) EndSwitch Return @@ -194,7 +194,7 @@ EvtScript N(EVS_UseMove_Impl) = { Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow3_Hold1) EndSwitch Call(GetActionCommandMode, LVar0) - IfGt(LVar0, 0) + IfGt(LVar0, AC_MODE_NOT_LEARNED) Call(N(ShouldMovesAutoSucceed)) IfEq(LVar0, 0) Loop(45) @@ -206,12 +206,12 @@ EvtScript N(EVS_UseMove_Impl) = { EndLoop EndIf Add(LVarD, 6) - Call(action_command_hammer_start, 0, LVarD, 3) - Call(SetActionQuality, 0) + Call(action_command_hammer_start, 0, LVarD, AC_DIFFICULTY_3) + Call(SetActionProgress, 0) Set(LVar1, 0) Loop(30) Wait(1) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) IfNe(LVar0, 0) IfNe(LVar1, 1) Call(GetMenuSelection, LVar3, LVar4, LVar5) @@ -245,10 +245,10 @@ EvtScript N(EVS_UseMove_Impl) = { Wait(30) EndIf Call(GetActionCommandMode, LVar0) - IfGt(LVar0, 0) + IfGt(LVar0, AC_MODE_NOT_LEARNED) Loop(0) Wait(1) - Call(GetActionSuccess, LVar0) + Call(GetSmashActionQuality, LVar0) IfNe(LVar0, 0) BreakLoop EndIf @@ -285,7 +285,7 @@ EvtScript N(EVS_UseMove_Impl) = { Call(InitTargetIterator) Call(SetGoalToTarget, ACTOR_SELF) Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2) - Call(GetPlayerActionSuccess, LVar3) + Call(GetPlayerActionQuality, LVar3) Switch(LVar3) CaseGt(FALSE) Thread @@ -317,11 +317,11 @@ EvtScript N(EVS_UseMove_Impl) = { IfEq(LVar3, HIT_RESULT_MISS) Call(VirtualEntityLandJump, LVarA) Call(DeleteVirtualEntity, LVarA) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf Thread - Call(GetPlayerActionSuccess, LVar3) + Call(GetPlayerActionQuality, LVar3) Switch(LVar3) CaseGt(FALSE) Call(SetVirtualEntityJumpGravity, LVarA, Float(1.4)) @@ -337,7 +337,7 @@ EvtScript N(EVS_UseMove_Impl) = { Call(DeleteVirtualEntity, LVarA) EndSwitch EndThread - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -389,7 +389,7 @@ EvtScript N(EVS_UseMove_Impl) = { CaseEq(2) Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_D_DOWN_HIT_3) EndSwitch - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -417,11 +417,11 @@ EvtScript N(EVS_UseMove_Impl) = { Switch(LVar0) CaseOrEq(HIT_RESULT_NICE) CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_A)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashSuccess)) EndCaseGroup CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) EndCaseGroup EndSwitch Return diff --git a/src/battle/move/hammer/mega_quake.c b/src/battle/move/hammer/mega_quake.c index 2dcddcf35d8..ce6f17c73df 100644 --- a/src/battle/move/hammer/mega_quake.c +++ b/src/battle/move/hammer/mega_quake.c @@ -35,33 +35,33 @@ API_CALLABLE(func_802A10A4_756824) { } } -extern EvtScript N(EVS_802A3238); +extern EvtScript N(EVS_UseMove_Impl); EvtScript N(EVS_UseMove) = { Call(ShowActionHud, TRUE) Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 80) - Set(LVarE, 3) - Set(LVarF, 6) - ExecWait(N(EVS_802A3238)) + Set(LVarD, 80) // duration + Set(LVarE, ULTRA_HAMMER_DMG_BAD) + Set(LVarF, ULTRA_HAMMER_DMG_GOOD) + ExecWait(N(EVS_UseMove_Impl)) CaseEq(1) - Set(LVarD, 80) - Set(LVarE, 3) - Set(LVarF, 6) - ExecWait(N(EVS_802A3238)) + Set(LVarD, 80) // duration + Set(LVarE, ULTRA_HAMMER_DMG_BAD) + Set(LVarF, ULTRA_HAMMER_DMG_GOOD) + ExecWait(N(EVS_UseMove_Impl)) CaseEq(2) - Set(LVarD, 80) - Set(LVarE, 3) - Set(LVarF, 6) - ExecWait(N(EVS_802A3238)) + Set(LVarD, 80) // duration + Set(LVarE, ULTRA_HAMMER_DMG_BAD) + Set(LVarF, ULTRA_HAMMER_DMG_GOOD) + ExecWait(N(EVS_UseMove_Impl)) EndSwitch Return End }; -EvtScript N(EVS_802A3238) = { +EvtScript N(EVS_UseMove_Impl) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) @@ -82,7 +82,7 @@ EvtScript N(EVS_802A3238) = { Wait(2) PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar0, LVar1, LVar2, 60, 8, 66, 30, 0, 0, 0, 0, 0) EndThread - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(StartRumble, BTL_RUMBLE_PLAYER_MAX) @@ -141,7 +141,7 @@ EvtScript N(EVS_802A3238) = { PlayEffect(EFFECT_SHOCKWAVE, 1, LVar0, LVar1, LVar2, 0, 0, 0, 0, 0, 0, 0, 0, 0) EndThread EndSwitch - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) IfGt(LVar0, FALSE) Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_QUAKE) Call(MoveBattleCamOver, 5) @@ -188,7 +188,7 @@ EvtScript N(EVS_802A3238) = { IfEq(LVar0, HIT_RESULT_MISS) Goto(11) EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(PlayerDamageEnemy, LVar0, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_QUAKE_HAMMER | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, SUPPRESS_EVENTS_HAMMER, 0, LVarF, BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_NICE_HIT) @@ -207,10 +207,8 @@ EvtScript N(EVS_802A3238) = { Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle) EndThread Wait(10) - ExecWait(N(EVS_Hammer_ReturnHome_B)) + ExecWait(N(EVS_HammerSupport_ReturnHome_Quake)) Call(UseBattleCamPreset, BTL_CAM_DEFAULT) Return End }; - - diff --git a/src/battle/move/hammer/mega_smash.c b/src/battle/move/hammer/mega_smash.c index 748d99c6e80..e93a2fa1293 100644 --- a/src/battle/move/hammer/mega_smash.c +++ b/src/battle/move/hammer/mega_smash.c @@ -5,7 +5,7 @@ #include "battle/common/move/HammerSupport.inc.c" -extern EvtScript N(UseMove_Impl); +extern EvtScript N(EVS_UseMove_Impl); EvtScript N(EVS_UseMove) = { Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) @@ -13,20 +13,20 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 45) - Set(LVarE, 5) - Set(LVarF, 6) - ExecWait(N(UseMove_Impl)) + Set(LVarD, 45) // duration + Set(LVarE, BASIC_HAMMER_DMG_BAD + 4) + Set(LVarF, BASIC_HAMMER_DMG_GOOD + 4) + ExecWait(N(EVS_UseMove_Impl)) CaseEq(1) - Set(LVarD, 45) - Set(LVarE, 6) - Set(LVarF, 8) - ExecWait(N(UseMove_Impl)) + Set(LVarD, 45) // duration + Set(LVarE, SUPER_HAMMER_DMG_BAD + 4) + Set(LVarF, SUPER_HAMMER_DMG_GOOD + 4) + ExecWait(N(EVS_UseMove_Impl)) CaseEq(2) - Set(LVarD, 45) - Set(LVarE, 7) - Set(LVarF, 10) - ExecWait(N(UseMove_Impl)) + Set(LVarD, 45) // duration + Set(LVarE, ULTRA_HAMMER_DMG_BAD + 4) + Set(LVarF, ULTRA_HAMMER_DMG_GOOD + 4) + ExecWait(N(EVS_UseMove_Impl)) EndSwitch Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE) Return @@ -51,7 +51,7 @@ EvtScript N(EVS_802A3188) = { End }; -EvtScript N(UseMove_Impl) = { +EvtScript N(EVS_UseMove_Impl) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) @@ -67,10 +67,10 @@ EvtScript N(UseMove_Impl) = { ExecWait(N(EVS_802A3188)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16) IfEq(LVar0, HIT_RESULT_MISS) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -98,11 +98,11 @@ EvtScript N(UseMove_Impl) = { Switch(LVar0) CaseOrEq(HIT_RESULT_NICE) CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_A)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashSuccess)) EndCaseGroup CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) EndCaseGroup EndSwitch Return diff --git a/src/battle/move/hammer/power_quake.c b/src/battle/move/hammer/power_quake.c index e07fcdccbc0..cdfb695fb46 100644 --- a/src/battle/move/hammer/power_quake.c +++ b/src/battle/move/hammer/power_quake.c @@ -13,19 +13,19 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 80) - Set(LVarE, 2) - Set(LVarF, 4) + Set(LVarD, 80) // duration + Set(LVarE, SUPER_HAMMER_DMG_BAD) + Set(LVarF, SUPER_HAMMER_DMG_GOOD) ExecWait(N(EVS_802A3168)) CaseEq(1) - Set(LVarD, 80) - Set(LVarE, 2) - Set(LVarF, 4) + Set(LVarD, 80) // duration + Set(LVarE, SUPER_HAMMER_DMG_BAD) + Set(LVarF, SUPER_HAMMER_DMG_GOOD) ExecWait(N(EVS_802A3168)) CaseEq(2) - Set(LVarD, 80) - Set(LVarE, 2) - Set(LVarF, 4) + Set(LVarD, 80) // duration + Set(LVarE, SUPER_HAMMER_DMG_BAD) + Set(LVarF, SUPER_HAMMER_DMG_GOOD) ExecWait(N(EVS_802A3168)) EndSwitch Return @@ -53,7 +53,7 @@ EvtScript N(EVS_802A3168) = { Wait(2) PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar0, LVar1, LVar2, 60, 8, 66, 30, 0, 0, 0, 0, 0) EndThread - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(StartRumble, BTL_RUMBLE_PLAYER_EXTREME) @@ -102,7 +102,7 @@ EvtScript N(EVS_802A3168) = { PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 96, 8, 72, 30, 0, 0, 0, 0, 0) EndThread EndSwitch - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) IfGt(LVar0, FALSE) Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_QUAKE) Call(MoveBattleCamOver, 5) @@ -137,7 +137,7 @@ EvtScript N(EVS_802A3168) = { IfEq(LVar0, HIT_RESULT_MISS) Goto(11) EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(PlayerDamageEnemy, LVar0, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_QUAKE_HAMMER | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, SUPPRESS_EVENTS_HAMMER, 0, LVarF, BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_NICE_HIT) @@ -156,7 +156,7 @@ EvtScript N(EVS_802A3168) = { Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle) EndThread Wait(10) - ExecWait(N(EVS_Hammer_ReturnHome_B)) + ExecWait(N(EVS_HammerSupport_ReturnHome_Quake)) Call(UseBattleCamPreset, BTL_CAM_DEFAULT) Return End diff --git a/src/battle/move/hammer/power_smash.c b/src/battle/move/hammer/power_smash.c index ba7530c93dc..4f53085e835 100644 --- a/src/battle/move/hammer/power_smash.c +++ b/src/battle/move/hammer/power_smash.c @@ -5,7 +5,7 @@ #include "battle/common/move/HammerSupport.inc.c" -extern EvtScript N(UseMove_Impl); +extern EvtScript N(EVS_UseMove_Impl); EvtScript N(EVS_UseMove) = { Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) @@ -13,20 +13,20 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 45) - Set(LVarE, 3) - Set(LVarF, 4) - ExecWait(N(UseMove_Impl)) + Set(LVarD, 45) // duration + Set(LVarE, BASIC_HAMMER_DMG_BAD + 2) + Set(LVarF, BASIC_HAMMER_DMG_GOOD + 2) + ExecWait(N(EVS_UseMove_Impl)) CaseEq(1) - Set(LVarD, 45) - Set(LVarE, 4) - Set(LVarF, 6) - ExecWait(N(UseMove_Impl)) + Set(LVarD, 45) // duration + Set(LVarE, SUPER_HAMMER_DMG_BAD + 2) + Set(LVarF, SUPER_HAMMER_DMG_GOOD + 2) + ExecWait(N(EVS_UseMove_Impl)) CaseEq(2) - Set(LVarD, 45) - Set(LVarE, 5) - Set(LVarF, 8) - ExecWait(N(UseMove_Impl)) + Set(LVarD, 45) // duration + Set(LVarE, ULTRA_HAMMER_DMG_BAD + 2) + Set(LVarF, ULTRA_HAMMER_DMG_GOOD + 2) + ExecWait(N(EVS_UseMove_Impl)) EndSwitch Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE) Return @@ -45,7 +45,7 @@ EvtScript N(EVS_802A3188) = { End }; -EvtScript N(UseMove_Impl) = { +EvtScript N(EVS_UseMove_Impl) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) @@ -62,10 +62,10 @@ EvtScript N(UseMove_Impl) = { Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16) IfEq(LVar0, HIT_RESULT_MISS) Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -93,11 +93,11 @@ EvtScript N(UseMove_Impl) = { Switch(LVar0) CaseOrEq(HIT_RESULT_NICE) CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_A)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashSuccess)) EndCaseGroup CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) EndCaseGroup EndSwitch Return diff --git a/src/battle/move/hammer/quake_hammer.c b/src/battle/move/hammer/quake_hammer.c index 27e720a3842..21408a40b1b 100644 --- a/src/battle/move/hammer/quake_hammer.c +++ b/src/battle/move/hammer/quake_hammer.c @@ -6,33 +6,33 @@ #include "battle/common/move/HammerSupport.inc.c" -extern EvtScript N(EVS_802A3168); +extern EvtScript N(EVS_UseMove_Impl); -EvtScript N(EVS_UseMove0) = { +EvtScript N(EVS_UseMove) = { Call(ShowActionHud, TRUE) Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 80) - Set(LVarE, 1) - Set(LVarF, 2) - ExecWait(N(EVS_802A3168)) + Set(LVarD, 80) // duration + Set(LVarE, BASIC_HAMMER_DMG_BAD) + Set(LVarF, BASIC_HAMMER_DMG_GOOD) + ExecWait(N(EVS_UseMove_Impl)) CaseEq(1) - Set(LVarD, 80) - Set(LVarE, 1) - Set(LVarF, 2) - ExecWait(N(EVS_802A3168)) + Set(LVarD, 80) // duration + Set(LVarE, BASIC_HAMMER_DMG_BAD) + Set(LVarF, BASIC_HAMMER_DMG_GOOD) + ExecWait(N(EVS_UseMove_Impl)) CaseEq(2) - Set(LVarD, 80) - Set(LVarE, 1) - Set(LVarF, 2) - ExecWait(N(EVS_802A3168)) + Set(LVarD, 80) // duration + Set(LVarE, BASIC_HAMMER_DMG_BAD) + Set(LVarF, BASIC_HAMMER_DMG_GOOD) + ExecWait(N(EVS_UseMove_Impl)) EndSwitch Return End }; -EvtScript N(EVS_802A3168) = { +EvtScript N(EVS_UseMove_Impl) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) @@ -53,7 +53,7 @@ EvtScript N(EVS_802A3168) = { Wait(2) PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar0, LVar1, LVar2, 60, 8, 66, 30, 0, 0, 0, 0, 0) EndChildThread - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(StartRumble, BTL_RUMBLE_PLAYER_HEAVY) @@ -87,7 +87,7 @@ EvtScript N(EVS_802A3168) = { Call(ShakeCam, CAM_BATTLE, 0, 4, Float(0.025390625)) EndChildThread EndSwitch - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) IfGt(LVar0, FALSE) Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_QUAKE) Call(MoveBattleCamOver, 5) @@ -122,7 +122,7 @@ EvtScript N(EVS_802A3168) = { IfEq(LVar0, HIT_RESULT_MISS) Goto(11) EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(PlayerDamageEnemy, LVar0, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_QUAKE_HAMMER | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, SUPPRESS_EVENTS_HAMMER, 0, LVarF, BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_NICE_HIT) @@ -141,7 +141,7 @@ EvtScript N(EVS_802A3168) = { Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle) EndThread Wait(10) - ExecWait(N(EVS_Hammer_ReturnHome_B)) + ExecWait(N(EVS_HammerSupport_ReturnHome_Quake)) Call(UseBattleCamPreset, BTL_CAM_DEFAULT) Return End diff --git a/src/battle/move/hammer/shell_crack.c b/src/battle/move/hammer/shell_crack.c index 7a521d4389c..4aae594c0ac 100644 --- a/src/battle/move/hammer/shell_crack.c +++ b/src/battle/move/hammer/shell_crack.c @@ -20,27 +20,27 @@ API_CALLABLE(func_802A10A4_77F2E4) { return ApiStatus_DONE2; } -extern EvtScript N(UseMove_Impl); +extern EvtScript N(EVS_UseMove_Impl); EvtScript N(EVS_UseMove) = { Call(ShowActionHud, TRUE) Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 60) - Set(LVarE, 1) - Set(LVarF, 2) - ExecWait(N(UseMove_Impl)) + Set(LVarD, 60) // duration + Set(LVarE, BASIC_HAMMER_DMG_BAD) + Set(LVarF, BASIC_HAMMER_DMG_GOOD) + ExecWait(N(EVS_UseMove_Impl)) CaseEq(1) - Set(LVarD, 60) - Set(LVarE, 2) - Set(LVarF, 4) - ExecWait(N(UseMove_Impl)) + Set(LVarD, 60) // duration + Set(LVarE, SUPER_HAMMER_DMG_BAD) + Set(LVarF, SUPER_HAMMER_DMG_GOOD) + ExecWait(N(EVS_UseMove_Impl)) CaseEq(2) - Set(LVarD, 60) - Set(LVarE, 3) - Set(LVarF, 6) - ExecWait(N(UseMove_Impl)) + Set(LVarD, 60) // duration + Set(LVarE, ULTRA_HAMMER_DMG_BAD) + Set(LVarF, ULTRA_HAMMER_DMG_GOOD) + ExecWait(N(EVS_UseMove_Impl)) EndSwitch Return End @@ -64,7 +64,7 @@ EvtScript N(EVS_802A3248) = { End }; -EvtScript N(UseMove_Impl) = { +EvtScript N(EVS_UseMove_Impl) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) @@ -83,10 +83,10 @@ EvtScript N(UseMove_Impl) = { Wait(1) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16) IfEq(LVar0, HIT_RESULT_MISS) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -114,11 +114,11 @@ EvtScript N(UseMove_Impl) = { Switch(LVar0) CaseOrEq(HIT_RESULT_NICE) CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_A)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashSuccess)) EndCaseGroup CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) EndCaseGroup EndSwitch Return diff --git a/src/battle/move/hammer/shrink_smash.c b/src/battle/move/hammer/shrink_smash.c index 14286f82dfa..6cc1b7ca5da 100644 --- a/src/battle/move/hammer/shrink_smash.c +++ b/src/battle/move/hammer/shrink_smash.c @@ -11,19 +11,19 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 45) - Set(LVarE, 1) - Set(LVarF, 2) + Set(LVarD, 45) // duration + Set(LVarE, BASIC_HAMMER_DMG_BAD) + Set(LVarF, BASIC_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove_Impl)) CaseEq(1) - Set(LVarD, 45) - Set(LVarE, 2) - Set(LVarF, 4) + Set(LVarD, 45) // duration + Set(LVarE, SUPER_HAMMER_DMG_BAD) + Set(LVarF, SUPER_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove_Impl)) CaseEq(2) - Set(LVarD, 45) - Set(LVarE, 3) - Set(LVarF, 6) + Set(LVarD, 45) // duration + Set(LVarE, ULTRA_HAMMER_DMG_BAD) + Set(LVarF, ULTRA_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove_Impl)) EndSwitch Return @@ -41,7 +41,7 @@ EvtScript N(EVS_UseMove_Impl) = { ExecWait(N(EVS_UseUltraHammer)) EndSwitch Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16) - Call(GetActionSuccessCopy, LVar0) + Call(GetMashActionQuality, LVar0) // incorrect use, should use GetSmashActionQuality Switch(LVar0) CaseGt(0) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -86,10 +86,10 @@ EvtScript N(EVS_UseMove_Impl) = { Wait(1) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16) IfEq(LVar0, HIT_RESULT_MISS) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -117,15 +117,13 @@ EvtScript N(EVS_UseMove_Impl) = { Switch(LVar0) CaseOrEq(HIT_RESULT_NICE) CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_A)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashSuccess)) EndCaseGroup CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) EndCaseGroup EndSwitch Return End }; - - diff --git a/src/battle/move/hammer/spin_smash.c b/src/battle/move/hammer/spin_smash.c index 1f6615f4c79..844481983c2 100644 --- a/src/battle/move/hammer/spin_smash.c +++ b/src/battle/move/hammer/spin_smash.c @@ -40,19 +40,19 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 60) - Set(LVarE, 1) - Set(LVarF, 2) + Set(LVarD, 60) // duration + Set(LVarE, BASIC_HAMMER_DMG_BAD) + Set(LVarF, BASIC_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove1_Impl)) CaseEq(1) - Set(LVarD, 60) - Set(LVarE, 2) - Set(LVarF, 4) + Set(LVarD, 60) // duration + Set(LVarE, SUPER_HAMMER_DMG_BAD) + Set(LVarF, SUPER_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove2_Impl)) CaseEq(2) - Set(LVarD, 60) - Set(LVarE, 3) - Set(LVarF, 6) + Set(LVarD, 60) // duration + Set(LVarE, ULTRA_HAMMER_DMG_BAD) + Set(LVarF, ULTRA_HAMMER_DMG_GOOD) ExecWait(N(EVS_UseMove3_Impl)) EndSwitch Return @@ -63,7 +63,7 @@ EvtScript N(EVS_UseMove1_Impl) = { Call(LoadActionCommand, ACTION_COMMAND_SMASH) Call(action_command_hammer_init) Call(InitTargetIterator) - ExecWait(N(EVS_HammerSupport_A)) + ExecWait(N(EVS_HammerSupport_SmashApproach)) Set(LVar1, 0) Loop(10) Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0) @@ -107,12 +107,12 @@ EvtScript N(EVS_UseMove1_Impl) = { EndIf EndLoop EndIf - Call(action_command_hammer_start, 0, LVarD, 3) - Call(SetActionQuality, 0) + Call(action_command_hammer_start, 0, LVarD, AC_DIFFICULTY_3) + Call(SetActionProgress, 0) Set(LVar1, 0) Loop(30) Wait(1) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) IfNe(LVar0, 0) IfNe(LVar1, 1) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash1_Hold2) @@ -126,7 +126,7 @@ EvtScript N(EVS_UseMove1_Impl) = { EndLoop Label(0) Wait(1) - Call(GetActionSuccess, LVar0) + Call(GetSmashActionQuality, LVar0) IfEq(LVar0, 0) Goto(0) EndIf @@ -142,10 +142,10 @@ EvtScript N(EVS_UseMove1_Impl) = { Wait(10) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle) Wait(25) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(func_802A1000_737890) @@ -159,7 +159,7 @@ EvtScript N(EVS_UseMove1_Impl) = { CaseOrEq(HIT_RESULT_NO_DAMAGE) Wait(10) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle) - ExecWait(N(EVS_Hammer_ReturnHome_B)) + ExecWait(N(EVS_HammerSupport_ReturnHome_Quake)) Return EndCaseGroup CaseOrEq(HIT_RESULT_NICE) @@ -177,7 +177,7 @@ EvtScript N(EVS_UseMove1_Impl) = { Wait(10) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle) Call(SetActorYaw, ACTOR_PLAYER, 0) - ExecWait(N(EVS_Hammer_ReturnHome_B)) + ExecWait(N(EVS_HammerSupport_ReturnHome_Quake)) Return End }; @@ -186,7 +186,7 @@ EvtScript N(EVS_UseMove2_Impl) = { Call(LoadActionCommand, ACTION_COMMAND_SMASH) Call(action_command_hammer_init) Call(InitTargetIterator) - ExecWait(N(EVS_HammerSupport_A)) + ExecWait(N(EVS_HammerSupport_SmashApproach)) Set(LVar1, 0) Loop(10) Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0) @@ -229,12 +229,12 @@ EvtScript N(EVS_UseMove2_Impl) = { EndIf EndLoop EndIf - Call(action_command_hammer_start, 0, LVarD, 3) - Call(SetActionQuality, 0) + Call(action_command_hammer_start, 0, LVarD, AC_DIFFICULTY_3) + Call(SetActionProgress, 0) Set(LVar1, 0) Loop(30) Wait(1) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) IfNe(LVar0, 0) IfNe(LVar1, 1) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash2_Hold2) @@ -248,7 +248,7 @@ EvtScript N(EVS_UseMove2_Impl) = { EndLoop Label(0) Wait(1) - Call(GetActionSuccess, LVar0) + Call(GetSmashActionQuality, LVar0) IfEq(LVar0, 0) Goto(0) EndIf @@ -264,10 +264,10 @@ EvtScript N(EVS_UseMove2_Impl) = { Wait(10) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle) Wait(25) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(func_802A1000_737890) @@ -281,7 +281,7 @@ EvtScript N(EVS_UseMove2_Impl) = { CaseOrEq(HIT_RESULT_NO_DAMAGE) Wait(10) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle) - ExecWait(N(EVS_Hammer_ReturnHome_B)) + ExecWait(N(EVS_HammerSupport_ReturnHome_Quake)) Return EndCaseGroup CaseOrEq(HIT_RESULT_NICE) @@ -299,7 +299,7 @@ EvtScript N(EVS_UseMove2_Impl) = { Wait(10) Call(SetActorYaw, ACTOR_PLAYER, 0) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle) - ExecWait(N(EVS_Hammer_ReturnHome_B)) + ExecWait(N(EVS_HammerSupport_ReturnHome_Quake)) Return End }; @@ -308,7 +308,7 @@ EvtScript N(EVS_UseMove3_Impl) = { Call(LoadActionCommand, ACTION_COMMAND_SMASH) Call(action_command_hammer_init) Call(InitTargetIterator) - ExecWait(N(EVS_HammerSupport_A)) + ExecWait(N(EVS_HammerSupport_SmashApproach)) Set(LVar1, 0) Loop(10) Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0) @@ -349,12 +349,12 @@ EvtScript N(EVS_UseMove3_Impl) = { EndIf EndLoop EndIf - Call(action_command_hammer_start, 0, LVarD, 3) - Call(SetActionQuality, 0) + Call(action_command_hammer_start, 0, LVarD, AC_DIFFICULTY_3) + Call(SetActionProgress, 0) Set(LVar1, 0) Loop(30) Wait(1) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) IfNe(LVar0, 0) IfNe(LVar1, 1) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash3_Hold2) @@ -368,7 +368,7 @@ EvtScript N(EVS_UseMove3_Impl) = { EndLoop Label(0) Wait(1) - Call(GetActionSuccess, LVar0) + Call(GetSmashActionQuality, LVar0) IfEq(LVar0, 0) Goto(0) EndIf @@ -384,10 +384,10 @@ EvtScript N(EVS_UseMove3_Impl) = { Wait(10) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle) Wait(25) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(func_802A1000_737890) @@ -401,7 +401,7 @@ EvtScript N(EVS_UseMove3_Impl) = { CaseOrEq(HIT_RESULT_NO_DAMAGE) Wait(10) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle) - ExecWait(N(EVS_Hammer_ReturnHome_B)) + ExecWait(N(EVS_HammerSupport_ReturnHome_Quake)) Return EndCaseGroup CaseOrEq(HIT_RESULT_NICE) @@ -419,7 +419,7 @@ EvtScript N(EVS_UseMove3_Impl) = { Wait(10) Call(SetActorYaw, ACTOR_PLAYER, 0) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle) - ExecWait(N(EVS_Hammer_ReturnHome_B)) + ExecWait(N(EVS_HammerSupport_ReturnHome_Quake)) Return End }; diff --git a/src/battle/move/hammer/super_smash.c b/src/battle/move/hammer/super_smash.c index 9a6545e32df..741ddaffb1b 100644 --- a/src/battle/move/hammer/super_smash.c +++ b/src/battle/move/hammer/super_smash.c @@ -5,7 +5,7 @@ #include "battle/common/move/HammerSupport.inc.c" -extern EvtScript N(UseMove_Impl); +extern EvtScript N(EVS_UseMove_Impl); EvtScript N(EVS_UseMove) = { Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) @@ -13,20 +13,20 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - Set(LVarD, 45) - Set(LVarE, 4) - Set(LVarF, 5) - ExecWait(N(UseMove_Impl)) + Set(LVarD, 45) // duration + Set(LVarE, BASIC_HAMMER_DMG_BAD + 3) + Set(LVarF, BASIC_HAMMER_DMG_GOOD + 3) + ExecWait(N(EVS_UseMove_Impl)) CaseEq(1) - Set(LVarD, 45) - Set(LVarE, 5) - Set(LVarF, 7) - ExecWait(N(UseMove_Impl)) + Set(LVarD, 45) // duration + Set(LVarE, SUPER_HAMMER_DMG_BAD + 3) + Set(LVarF, SUPER_HAMMER_DMG_GOOD + 3) + ExecWait(N(EVS_UseMove_Impl)) CaseEq(2) - Set(LVarD, 45) - Set(LVarE, 6) - Set(LVarF, 9) - ExecWait(N(UseMove_Impl)) + Set(LVarD, 45) // duration + Set(LVarE, ULTRA_HAMMER_DMG_BAD + 3) + Set(LVarF, ULTRA_HAMMER_DMG_GOOD + 3) + ExecWait(N(EVS_UseMove_Impl)) EndSwitch Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE) Return @@ -47,7 +47,7 @@ EvtScript N(EVS_802A3188) = { End }; -EvtScript N(UseMove_Impl) = { +EvtScript N(EVS_UseMove_Impl) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) @@ -63,10 +63,10 @@ EvtScript N(UseMove_Impl) = { ExecWait(N(EVS_802A3188)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 0, 0, 0, 16) IfEq(LVar0, HIT_RESULT_MISS) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) Return EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(GetMenuSelection, LVar0, LVar1, LVar2) @@ -94,11 +94,11 @@ EvtScript N(UseMove_Impl) = { Switch(LVar0) CaseOrEq(HIT_RESULT_NICE) CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_A)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashSuccess)) EndCaseGroup CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) - ExecWait(N(EVS_Hammer_ReturnHome_C)) + ExecWait(N(EVS_HammerSupport_ReturnHome_SmashMiss)) EndCaseGroup EndSwitch Return diff --git a/src/battle/move/item/insecticide_herb.c b/src/battle/move/item/insecticide_herb.c index 538d63eeb50..d45a5e445b2 100644 --- a/src/battle/move/item/insecticide_herb.c +++ b/src/battle/move/item/insecticide_herb.c @@ -92,7 +92,6 @@ Gfx N(displayList)[] = { EntityModelScript N(modelCommandList) = STANDARD_ENTITY_MODEL_SCRIPT(N(displayList), RENDER_MODE_ALPHATEST); - EvtScript N(EVS_UseItem) = { SetConst(LVarA, ITEM_INSECTICIDE_HERB) ExecWait(N(UseItemWithEffect)) diff --git a/src/battle/move/item/mystery.c b/src/battle/move/item/mystery.c index 314317c0f12..52cd14489ca 100644 --- a/src/battle/move/item/mystery.c +++ b/src/battle/move/item/mystery.c @@ -110,7 +110,7 @@ API_CALLABLE(N(func_802A13E4_72C994)) { s32 temp_v1_3; s32 var_v0_2; s32 var_v0_3; - s32 id; + HudElemID hid; s32 i; if (isInitialCall) { @@ -135,9 +135,9 @@ API_CALLABLE(N(func_802A13E4_72C994)) { } for (i = 0; i < ARRAY_COUNT(D_802A25C8); i++) { - id = hud_element_create(gItemHudScripts[gItemTable[D_802A25FC[i]].hudElemID].enabled); - D_802A25C8[i] = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); + hid = hud_element_create(gItemHudScripts[gItemTable[D_802A25FC[i]].hudElemID].enabled); + D_802A25C8[i] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); } D_802A25E4 = 1; return ApiStatus_BLOCK; diff --git a/src/battle/move/item/strange_cake.c b/src/battle/move/item/strange_cake.c index 627578f0845..1ce9d919962 100644 --- a/src/battle/move/item/strange_cake.c +++ b/src/battle/move/item/strange_cake.c @@ -74,7 +74,7 @@ API_CALLABLE(N(func_802A13E4_7316E4)) { s32 temp_v1_3; s32 var_v0_2; s32 var_v0_3; - s32 id; + HudElemID hid; s32 i; if (isInitialCall) { @@ -88,9 +88,9 @@ API_CALLABLE(N(func_802A13E4_7316E4)) { D_802A2DF8 = 1000; for (i = 0; i < ARRAY_COUNT(D_802A2DD8); i++) { - id = hud_element_create(N(D_802A2848_732B48)[N(D_802A2858_732B58)[i]]); - D_802A2DD8[i] = id; - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80); + hid = hud_element_create(N(D_802A2848_732B48)[N(D_802A2858_732B58)[i]]); + D_802A2DD8[i] = hid; + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); } D_802A2DEC = 1; diff --git a/src/battle/move/jump/attack.c b/src/battle/move/jump/attack.c index bec60ece4c6..c3dbf2c2e00 100644 --- a/src/battle/move/jump/attack.c +++ b/src/battle/move/jump/attack.c @@ -25,7 +25,7 @@ API_CALLABLE(N(GetJumpDamage)) { return ApiStatus_DONE2; } -extern EvtScript N(EVS_UseMove_Normal); +extern EvtScript N(EVS_UseMove_Basic); extern EvtScript N(EVS_UseMove_Super); extern EvtScript N(EVS_UseMove_Ultra); extern EvtScript N(EVS_UseMove_Tutorial); @@ -40,7 +40,7 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - ExecWait(N(EVS_UseMove_Normal)) + ExecWait(N(EVS_UseMove_Basic)) CaseEq(1) ExecWait(N(EVS_UseMove_Super)) CaseEq(2) @@ -50,14 +50,14 @@ EvtScript N(EVS_UseMove) = { End }; -EvtScript N(EVS_UseMove_Normal) = { +EvtScript N(EVS_UseMove_Basic) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(GetActionCommandMode, LVar0) - IfEq(LVar0, ACTION_COMMAND_MODE_TUTORIAL) - Call(SetActionCommandMode, ACTION_COMMAND_MODE_TUTORIAL_WAIT_INPUT) + IfEq(LVar0, AC_MODE_TUTORIAL) + Call(SetActionCommandMode, AC_MODE_TUTORIAL_WAIT_INPUT) Loop(0) Call(GetActionCommandMode, LVar0) - IfLt(LVar0, ACTION_COMMAND_MODE_TUTORIAL) + IfLt(LVar0, AC_MODE_TUTORIAL) BreakLoop EndIf Wait(1) @@ -69,10 +69,10 @@ EvtScript N(EVS_UseMove_Normal) = { Return EndIf Call(GetActionCommandMode, LVar0) - IfGt(LVar0, ACTION_COMMAND_MODE_NOT_LEARNED) + IfGt(LVar0, AC_MODE_NOT_LEARNED) Wait(1) EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) @@ -99,12 +99,12 @@ EvtScript N(EVS_UseMove_Normal) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(GetActionResult, LVarF) - Call(CloseActionCommandInfo) + Call(GetJumpActionQuality, LVarF) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 24, 3) + Call(action_command_jump_start, 24, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall) Call(PlayerBasicJumpToGoal, 24, PLAYER_BASIC_JUMP_3) @@ -125,7 +125,7 @@ EvtScript N(EVS_UseMove_Super) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) @@ -144,18 +144,18 @@ EvtScript N(EVS_UseMove_Super) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarF) + Call(GetJumpActionQuality, LVarF) ChildThread Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_JUMP_FINISH) Wait(5) Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 37, 3) + Call(action_command_jump_start, 37, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Sit, ANIM_Mario1_SpinJump) @@ -180,7 +180,7 @@ EvtScript N(EVS_UseMove_Ultra) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) @@ -199,18 +199,18 @@ EvtScript N(EVS_UseMove_Ultra) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarF) + Call(GetJumpActionQuality, LVarF) ChildThread Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_ULTRA_JUMP_FINISH) Wait(5) Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 25, 3) + Call(action_command_jump_start, 25, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Jump, ANIM_Mario1_SpinFall) @@ -344,7 +344,7 @@ EvtScript N(EVS_UseBerserker_Normal) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) @@ -369,12 +369,12 @@ EvtScript N(EVS_UseBerserker_Normal) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(GetActionResult, LVarF) - Call(CloseActionCommandInfo) + Call(GetJumpActionQuality, LVarF) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 24, 3) + Call(action_command_jump_start, 24, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall) Call(PlayerBasicJumpToGoal, 24, PLAYER_BASIC_JUMP_3) @@ -395,7 +395,7 @@ EvtScript N(EVS_UseBerserker_Super) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) @@ -414,18 +414,18 @@ EvtScript N(EVS_UseBerserker_Super) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarF) + Call(GetJumpActionQuality, LVarF) ChildThread Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_JUMP_FINISH) Wait(5) Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 37, 3) + Call(action_command_jump_start, 37, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Sit, ANIM_Mario1_SpinJump) @@ -452,7 +452,7 @@ EvtScript N(EVS_UseBerserker_Ultra) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) @@ -471,18 +471,18 @@ EvtScript N(EVS_UseBerserker_Ultra) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarF) + Call(GetJumpActionQuality, LVarF) ChildThread Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_ULTRA_JUMP_FINISH) Wait(5) Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 25, 3) + Call(action_command_jump_start, 25, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Jump, ANIM_Mario1_SpinFall) @@ -502,18 +502,18 @@ EvtScript N(EVS_UseMove_Tutorial) = { Call(action_command_jump_init) ExecWait(N(EVS_JumpSupport_Approach)) ExecWait(N(EVS_JumpSupport_CalcJumpTime)) - Call(action_command_jump_start, LVarA, 3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR) Call(SetGoalToTarget, ACTOR_PLAYER) Call(AddGoalPos, ACTOR_PLAYER, -5, 10, 0) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_MarioB1_Stomp) Call(PlayerBasicJumpToGoal, LVarA, PLAYER_BASIC_JUMP_0) Call(GetActionCommandMode, LVar0) - IfEq(LVar0, 2) - Call(SetActionCommandMode, 3) + IfEq(LVar0, AC_MODE_TUTORIAL) + Call(SetActionCommandMode, AC_MODE_TUTORIAL_WAIT_INPUT) Loop(0) Call(GetActionCommandMode, LVar0) - IfLt(LVar0, 2) + IfLt(LVar0, AC_MODE_TUTORIAL) BreakLoop EndIf Wait(1) @@ -525,10 +525,10 @@ EvtScript N(EVS_UseMove_Tutorial) = { Return EndIf Call(GetActionCommandMode, LVar0) - IfGt(LVar0, 0) + IfGt(LVar0, AC_MODE_NOT_LEARNED) Wait(1) EndIf - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) @@ -553,12 +553,12 @@ EvtScript N(EVS_UseMove_Tutorial) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(GetActionResult, LVarF) - Call(CloseActionCommandInfo) + Call(GetJumpActionQuality, LVarF) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 24, 3) + Call(action_command_jump_start, 24, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall) Call(PlayerBasicJumpToGoal, 24, PLAYER_BASIC_JUMP_3) diff --git a/src/battle/move/jump/auto_jump.c b/src/battle/move/jump/auto_jump.c index 13b95855438..01cc25c13a3 100644 --- a/src/battle/move/jump/auto_jump.c +++ b/src/battle/move/jump/auto_jump.c @@ -7,9 +7,9 @@ #include "battle/common/move/JumpSupport.inc.c" -extern EvtScript N(EVS_UseMove_ImplA); -extern EvtScript N(EVS_UseMove_ImplB); -extern EvtScript N(EVS_UseMove_ImplC); +extern EvtScript N(EVS_UseMove_Basic); +extern EvtScript N(EVS_UseMove_Super); +extern EvtScript N(EVS_UseMove_Ultra); EvtScript N(EVS_UseMove) = { Call(SetBattleFlagBits, BS_FLAGS1_AUTO_SUCCEED_ACTION, TRUE) @@ -18,24 +18,24 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - ExecWait(N(EVS_UseMove_ImplA)) + ExecWait(N(EVS_UseMove_Basic)) CaseEq(1) - ExecWait(N(EVS_UseMove_ImplB)) + ExecWait(N(EVS_UseMove_Super)) CaseEq(2) - ExecWait(N(EVS_UseMove_ImplC)) + ExecWait(N(EVS_UseMove_Ultra)) EndSwitch Return End }; -EvtScript N(EVS_UseMove_ImplA) = { +EvtScript N(EVS_UseMove_Basic) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(GetActionCommandMode, LVar0) - IfEq(LVar0, 2) - Call(SetActionCommandMode, 3) + IfEq(LVar0, AC_MODE_TUTORIAL) + Call(SetActionCommandMode, AC_MODE_TUTORIAL_WAIT_INPUT) Loop(0) Call(GetActionCommandMode, LVar0) - IfLt(LVar0, 2) + IfLt(LVar0, AC_MODE_TUTORIAL) BreakLoop EndIf Wait(1) @@ -47,7 +47,7 @@ EvtScript N(EVS_UseMove_ImplA) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) @@ -72,12 +72,12 @@ EvtScript N(EVS_UseMove_ImplA) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(GetActionResult, LVarF) - Call(CloseActionCommandInfo) + Call(GetJumpActionQuality, LVarF) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 24, 3) + Call(action_command_jump_start, 24, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall) Call(PlayerBasicJumpToGoal, 24, PLAYER_BASIC_JUMP_3) @@ -90,7 +90,7 @@ EvtScript N(EVS_UseMove_ImplA) = { End }; -EvtScript N(EVS_UseMove_ImplB) = { +EvtScript N(EVS_UseMove_Super) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -98,7 +98,7 @@ EvtScript N(EVS_UseMove_ImplB) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) @@ -117,18 +117,18 @@ EvtScript N(EVS_UseMove_ImplB) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarF) + Call(GetJumpActionQuality, LVarF) ChildThread Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_JUMP_FINISH) Wait(5) Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 37, 3) + Call(action_command_jump_start, 37, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Sit, ANIM_Mario1_SpinJump) @@ -145,7 +145,7 @@ EvtScript N(EVS_UseMove_ImplB) = { End }; -EvtScript N(EVS_UseMove_ImplC) = { +EvtScript N(EVS_UseMove_Ultra) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -153,7 +153,7 @@ EvtScript N(EVS_UseMove_ImplC) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) @@ -172,18 +172,18 @@ EvtScript N(EVS_UseMove_ImplC) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarF) + Call(GetJumpActionQuality, LVarF) ChildThread Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_ULTRA_JUMP_FINISH) Wait(5) Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 25, 3) + Call(action_command_jump_start, 25, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Jump, ANIM_Mario1_SpinFall) diff --git a/src/battle/move/jump/auto_multibounce.c b/src/battle/move/jump/auto_multibounce.c index 2993498ff74..4df4e22a61d 100644 --- a/src/battle/move/jump/auto_multibounce.c +++ b/src/battle/move/jump/auto_multibounce.c @@ -7,9 +7,9 @@ #include "battle/common/move/JumpSupport.inc.c" -extern EvtScript N(EVS_UseMove_ImplA); -extern EvtScript N(EVS_UseMove_ImplB); -extern EvtScript N(EVS_UseMove_ImplC); +extern EvtScript N(EVS_UseMove_Basic); +extern EvtScript N(EVS_UseMove_Super); +extern EvtScript N(EVS_UseMove_Ultra); EvtScript N(EVS_UseMove) = { Call(ShowActionHud, TRUE) @@ -17,17 +17,17 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - ExecWait(N(EVS_UseMove_ImplA)) + ExecWait(N(EVS_UseMove_Basic)) CaseEq(1) - ExecWait(N(EVS_UseMove_ImplB)) + ExecWait(N(EVS_UseMove_Super)) CaseEq(2) - ExecWait(N(EVS_UseMove_ImplC)) + ExecWait(N(EVS_UseMove_Ultra)) EndSwitch Return End }; -EvtScript N(EVS_UseMove_ImplA) = { +EvtScript N(EVS_UseMove_Basic) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -40,7 +40,7 @@ EvtScript N(EVS_UseMove_ImplA) = { Set(LFlag0, TRUE) EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) @@ -73,7 +73,7 @@ EvtScript N(EVS_UseMove_ImplA) = { EndIf EndCaseGroup EndSwitch - Call(GetActionResult, LVarE) + Call(GetJumpActionQuality, LVarE) Add(LVarF, 1) Set(LFlag0, FALSE) Label(10) @@ -83,7 +83,7 @@ EvtScript N(EVS_UseMove_ImplA) = { IfEq(LVarF, LVar0) Set(LFlag0, TRUE) EndIf - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) IfEq(LFlag0, TRUE) @@ -93,7 +93,7 @@ EvtScript N(EVS_UseMove_ImplA) = { Call(SetGoalToTarget, ACTOR_PLAYER) ExecWait(N(EVS_JumpSupport_CalcJumpTime)) Add(LVarA, 5) - Call(action_command_jump_start, LVarA, 3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall) IfEq(LVarF, 1) @@ -107,7 +107,7 @@ EvtScript N(EVS_UseMove_ImplA) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) @@ -139,7 +139,7 @@ EvtScript N(EVS_UseMove_ImplA) = { Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) EndSwitch Call(SetActionResult, LVarE) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseOrEq(FALSE) CaseOrEq(2) @@ -169,7 +169,7 @@ EvtScript N(EVS_UseMove_ImplA) = { End }; -EvtScript N(EVS_UseMove_ImplB) = { +EvtScript N(EVS_UseMove_Super) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -182,7 +182,7 @@ EvtScript N(EVS_UseMove_ImplB) = { Set(LFlag0, TRUE) EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) @@ -215,7 +215,7 @@ EvtScript N(EVS_UseMove_ImplB) = { EndIf EndCaseGroup EndSwitch - Call(GetActionResult, LVarE) + Call(GetJumpActionQuality, LVarE) Set(LFlag0, FALSE) Set(LVarF, 0) Add(LVarF, 1) @@ -225,14 +225,14 @@ EvtScript N(EVS_UseMove_ImplB) = { IfEq(LVarF, LVar0) Set(LFlag0, TRUE) EndIf - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) IfEq(LFlag0, TRUE) Call(ShowActionHud, FALSE) EndIf Call(UseBattleCamPreset, BTL_CAM_PLAYER_MULTIBOUNCE) - Call(action_command_jump_start, 37, 3) + Call(action_command_jump_start, 37, AC_DIFFICULTY_3) Call(ChooseNextTarget, ITER_NEXT, LVar0) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetGoalToTarget, ACTOR_PLAYER) @@ -254,7 +254,7 @@ EvtScript N(EVS_UseMove_ImplB) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) @@ -286,7 +286,7 @@ EvtScript N(EVS_UseMove_ImplB) = { Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) EndSwitch Call(SetActionResult, LVarE) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseOrEq(FALSE) CaseOrEq(2) @@ -316,7 +316,7 @@ EvtScript N(EVS_UseMove_ImplB) = { End }; -EvtScript N(EVS_UseMove_ImplC) = { +EvtScript N(EVS_UseMove_Ultra) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -329,7 +329,7 @@ EvtScript N(EVS_UseMove_ImplC) = { Set(LFlag0, TRUE) EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) @@ -362,7 +362,7 @@ EvtScript N(EVS_UseMove_ImplC) = { EndIf EndCaseGroup EndSwitch - Call(GetActionResult, LVarE) + Call(GetJumpActionQuality, LVarE) Set(LFlag0, FALSE) Set(LVarF, 0) Add(LVarF, 1) @@ -372,14 +372,14 @@ EvtScript N(EVS_UseMove_ImplC) = { IfEq(LVarF, LVar0) Set(LFlag0, TRUE) EndIf - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) IfEq(LFlag0, TRUE) Call(ShowActionHud, FALSE) EndIf Call(UseBattleCamPreset, BTL_CAM_PLAYER_MULTIBOUNCE) - Call(action_command_jump_start, 25, 3) + Call(action_command_jump_start, 25, AC_DIFFICULTY_3) Call(ChooseNextTarget, ITER_NEXT, LVar0) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Jump, ANIM_Mario1_SpinFall) @@ -394,7 +394,7 @@ EvtScript N(EVS_UseMove_ImplC) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) @@ -426,7 +426,7 @@ EvtScript N(EVS_UseMove_ImplC) = { Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) EndSwitch Call(SetActionResult, LVarE) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseOrEq(FALSE) CaseOrEq(2) diff --git a/src/battle/move/jump/d_down_jump.c b/src/battle/move/jump/d_down_jump.c index 74a3c75434b..bda25b5fbdf 100644 --- a/src/battle/move/jump/d_down_jump.c +++ b/src/battle/move/jump/d_down_jump.c @@ -8,24 +8,24 @@ #include "battle/common/move/JumpSupport.inc.c" -API_CALLABLE(N(func_802A10E4_781A04)) { +API_CALLABLE(N(SpawnImpactFX)) { Bytecode* args = script->ptrReadPos; - s32 var0 = evt_get_variable(script, *args++); - s32 var1 = evt_get_variable(script, *args++); - s32 var2 = evt_get_variable(script, *args++); + s32 x = evt_get_variable(script, *args++); + s32 y = evt_get_variable(script, *args++); + s32 z = evt_get_variable(script, *args++); if (script->varTable[10] == 0) { - fx_green_impact(TRUE, var0, var1, var2, 0.0f); + fx_green_impact(TRUE, x, y, z, 0.0f); } else { - fx_green_impact(FALSE, var0, var1, var2, 0.0f); + fx_green_impact(FALSE, x, y, z, 0.0f); } return ApiStatus_DONE2; } -extern EvtScript N(EVS_UseMove_ImplA); -extern EvtScript N(EVS_UseMove_ImplB); -extern EvtScript N(EVS_UseMove_ImplC); +extern EvtScript N(EVS_UseMove_Basic); +extern EvtScript N(EVS_UseMove_Super); +extern EvtScript N(EVS_UseMove_Ultra); EvtScript N(EVS_UseMove) = { Call(ShowActionHud, TRUE) @@ -33,29 +33,29 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - ExecWait(N(EVS_UseMove_ImplA)) + ExecWait(N(EVS_UseMove_Basic)) CaseEq(1) - ExecWait(N(EVS_UseMove_ImplB)) + ExecWait(N(EVS_UseMove_Super)) CaseEq(2) - ExecWait(N(EVS_UseMove_ImplC)) + ExecWait(N(EVS_UseMove_Ultra)) EndSwitch Return End }; -EvtScript N(EVS_UseMove_ImplA) = { +EvtScript N(EVS_UseMove_Basic) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) ExecWait(N(EVS_JumpSupport_Miss)) Return EndIf - Call(GetPlayerActionSuccess, LVarA) + Call(GetPlayerActionQuality, LVarA) Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) - Call(N(func_802A10E4_781A04), LVar0, LVar1, LVar2) + Call(N(SpawnImpactFX), LVar0, LVar1, LVar2) Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_D_DOWN_HIT_1) Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) @@ -81,17 +81,17 @@ EvtScript N(EVS_UseMove_ImplA) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(GetActionResult, LVarF) - Call(CloseActionCommandInfo) + Call(GetJumpActionQuality, LVarF) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 24, 3) + Call(action_command_jump_start, 24, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall) Call(PlayerBasicJumpToGoal, 24, PLAYER_BASIC_JUMP_3) Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) - Call(N(func_802A10E4_781A04), LVar0, LVar1, LVar2) + Call(N(SpawnImpactFX), LVar0, LVar1, LVar2) Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_D_DOWN_HIT_1) Wait(1) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) @@ -102,7 +102,7 @@ EvtScript N(EVS_UseMove_ImplA) = { End }; -EvtScript N(EVS_UseMove_ImplB) = { +EvtScript N(EVS_UseMove_Super) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -110,10 +110,10 @@ EvtScript N(EVS_UseMove_ImplB) = { Return EndIf Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) - Call(N(func_802A10E4_781A04), LVar0, LVar1, LVar2) + Call(N(SpawnImpactFX), LVar0, LVar1, LVar2) Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_D_DOWN_HIT_2) Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) @@ -132,18 +132,18 @@ EvtScript N(EVS_UseMove_ImplB) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarF) + Call(GetJumpActionQuality, LVarF) ChildThread Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_JUMP_FINISH) Wait(5) Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 37, 3) + Call(action_command_jump_start, 37, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Sit, ANIM_Mario1_SpinJump) @@ -152,7 +152,7 @@ EvtScript N(EVS_UseMove_ImplB) = { Call(PlayerSuperJumpToGoal, 3, PLAYER_SUPER_JUMP_5) Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE) Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) - Call(N(func_802A10E4_781A04), LVar0, LVar1, LVar2) + Call(N(SpawnImpactFX), LVar0, LVar1, LVar2) Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_D_DOWN_HIT_2) Wait(1) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) @@ -163,7 +163,7 @@ EvtScript N(EVS_UseMove_ImplB) = { End }; -EvtScript N(EVS_UseMove_ImplC) = { +EvtScript N(EVS_UseMove_Ultra) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -171,10 +171,10 @@ EvtScript N(EVS_UseMove_ImplC) = { Return EndIf Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) - Call(N(func_802A10E4_781A04), LVar0, LVar1, LVar2) + Call(N(SpawnImpactFX), LVar0, LVar1, LVar2) Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_D_DOWN_HIT_3) Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) @@ -193,25 +193,25 @@ EvtScript N(EVS_UseMove_ImplC) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarF) + Call(GetJumpActionQuality, LVarF) ChildThread Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_ULTRA_JUMP_FINISH) Wait(5) Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 25, 3) + Call(action_command_jump_start, 25, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Jump, ANIM_Mario1_SpinFall) Call(PlayerUltraJumpToGoal, 25, PLAYER_ULTRA_JUMP_4) Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE) Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) - Call(N(func_802A10E4_781A04), LVar0, LVar1, LVar2) + Call(N(SpawnImpactFX), LVar0, LVar1, LVar2) Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_D_DOWN_HIT_3) Wait(1) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) diff --git a/src/battle/move/jump/demo_power_bounce.c b/src/battle/move/jump/demo_power_bounce.c index e2f24065b58..7c1bd06fdee 100644 --- a/src/battle/move/jump/demo_power_bounce.c +++ b/src/battle/move/jump/demo_power_bounce.c @@ -8,7 +8,7 @@ #include "battle/common/move/JumpSupport.inc.c" -s32 N(DifficultyTable)[] = { +Difficulty1D N(DifficultyTable) = { 7, 6, 5, 4, 3, 2, 1, 0 }; @@ -36,9 +36,9 @@ API_CALLABLE(N(GetHitChance)) { return ApiStatus_DONE2; } -extern EvtScript N(EVS_UseMove_ImplA); -extern EvtScript N(EVS_UseMove_ImplB); -extern EvtScript N(EVS_UseMove_ImplC); +extern EvtScript N(EVS_UseMove_Basic); +extern EvtScript N(EVS_UseMove_Super); +extern EvtScript N(EVS_UseMove_Ultra); EvtScript N(EVS_UseMove) = { Set(LFlagA, FALSE) @@ -48,25 +48,25 @@ EvtScript N(EVS_UseMove) = { Switch(LVar1) CaseEq(0) Set(LVarC, 1) - ExecWait(N(EVS_UseMove_ImplA)) + ExecWait(N(EVS_UseMove_Basic)) CaseEq(1) Set(LVarC, 2) - ExecWait(N(EVS_UseMove_ImplB)) + ExecWait(N(EVS_UseMove_Super)) CaseEq(2) Set(LVarC, 3) - ExecWait(N(EVS_UseMove_ImplC)) + ExecWait(N(EVS_UseMove_Ultra)) EndSwitch Return End }; -EvtScript N(EVS_UseMove_ImplA) = { +EvtScript N(EVS_UseMove_Basic) = { Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) ExecWait(N(EVS_JumpSupport_Approach)) ExecWait(N(EVS_JumpSupport_CalcJumpTime)) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_MarioB1_Stomp) @@ -77,7 +77,7 @@ EvtScript N(EVS_UseMove_ImplA) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) @@ -102,7 +102,7 @@ EvtScript N(EVS_UseMove_ImplA) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(GetActionResult, LVarE) + Call(GetJumpActionQuality, LVarE) Set(LVarD, 0) Set(LVarF, 0) Set(LFlag0, FALSE) @@ -113,22 +113,22 @@ EvtScript N(EVS_UseMove_ImplA) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Set(LVarA, 24) Switch(LVarF) CaseEq(0) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) CaseEq(1) - Call(action_command_jump_start, LVarA, 2) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_2) CaseEq(2) - Call(action_command_jump_start, LVarA, 3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) CaseEq(3) - Call(action_command_jump_start, LVarA, 4) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_4) CaseDefault - Call(action_command_jump_start, LVarA, 5) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_5) EndSwitch Sub(LVarD, 1) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall) @@ -149,7 +149,7 @@ EvtScript N(EVS_UseMove_ImplA) = { Set(LFlag0, TRUE) EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) @@ -196,13 +196,13 @@ EvtScript N(EVS_UseMove_ImplA) = { End }; -EvtScript N(EVS_UseMove_ImplB) = { +EvtScript N(EVS_UseMove_Super) = { Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) ExecWait(N(EVS_JumpSupport_Approach)) ExecWait(N(EVS_JumpSupport_CalcJumpTime)) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_MarioB1_Stomp) @@ -213,7 +213,7 @@ EvtScript N(EVS_UseMove_ImplB) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) @@ -232,7 +232,7 @@ EvtScript N(EVS_UseMove_ImplB) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarE) + Call(GetJumpActionQuality, LVarE) Set(LVarD, 0) Set(LVarF, 0) Set(LFlag0, FALSE) @@ -243,22 +243,22 @@ EvtScript N(EVS_UseMove_ImplB) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Set(LVarA, 37) Switch(LVarF) CaseEq(0) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) CaseEq(1) - Call(action_command_jump_start, LVarA, 2) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_2) CaseEq(2) - Call(action_command_jump_start, LVarA, 3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) CaseEq(3) - Call(action_command_jump_start, LVarA, 4) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_4) CaseDefault - Call(action_command_jump_start, LVarA, 5) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_5) EndSwitch Sub(LVarD, 1) Call(SetGoalToTarget, ACTOR_PLAYER) @@ -285,7 +285,7 @@ EvtScript N(EVS_UseMove_ImplB) = { Set(LFlag0, TRUE) EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) @@ -332,13 +332,13 @@ EvtScript N(EVS_UseMove_ImplB) = { End }; -EvtScript N(EVS_UseMove_ImplC) = { +EvtScript N(EVS_UseMove_Ultra) = { Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) ExecWait(N(EVS_JumpSupport_Approach)) ExecWait(N(EVS_JumpSupport_CalcJumpTime)) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_MarioB1_Stomp) @@ -349,7 +349,7 @@ EvtScript N(EVS_UseMove_ImplC) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) @@ -368,7 +368,7 @@ EvtScript N(EVS_UseMove_ImplC) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarE) + Call(GetJumpActionQuality, LVarE) Set(LVarD, 0) Set(LVarF, 0) Set(LFlag0, FALSE) @@ -379,22 +379,22 @@ EvtScript N(EVS_UseMove_ImplC) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Set(LVarA, 25) Switch(LVarF) CaseEq(0) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) CaseEq(1) - Call(action_command_jump_start, LVarA, 2) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_2) CaseEq(2) - Call(action_command_jump_start, LVarA, 3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) CaseEq(3) - Call(action_command_jump_start, LVarA, 4) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_4) CaseDefault - Call(action_command_jump_start, LVarA, 5) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_5) EndSwitch Sub(LVarD, 1) Call(SetGoalToTarget, ACTOR_PLAYER) @@ -417,7 +417,7 @@ EvtScript N(EVS_UseMove_ImplC) = { Set(LFlag0, TRUE) EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) diff --git a/src/battle/move/jump/dizzy_stomp.c b/src/battle/move/jump/dizzy_stomp.c index cf635bbf089..cced6aa7bb8 100644 --- a/src/battle/move/jump/dizzy_stomp.c +++ b/src/battle/move/jump/dizzy_stomp.c @@ -7,26 +7,26 @@ #include "battle/common/move/JumpSupport.inc.c" -extern EvtScript N(EVS_UseMove_ImplA); -extern EvtScript N(EVS_UseMove_ImplB); -extern EvtScript N(EVS_UseMove_ImplC); +extern EvtScript N(EVS_UseMove_Basic); +extern EvtScript N(EVS_UseMove_Super); +extern EvtScript N(EVS_UseMove_Ultra); EvtScript N(EVS_UseMove) = { Call(ShowActionHud, TRUE) Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - ExecWait(N(EVS_UseMove_ImplA)) + ExecWait(N(EVS_UseMove_Basic)) CaseEq(1) - ExecWait(N(EVS_UseMove_ImplB)) + ExecWait(N(EVS_UseMove_Super)) CaseEq(2) - ExecWait(N(EVS_UseMove_ImplC)) + ExecWait(N(EVS_UseMove_Ultra)) EndSwitch Return End }; -EvtScript N(EVS_UseMove_ImplA) = { +EvtScript N(EVS_UseMove_Basic) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -34,7 +34,7 @@ EvtScript N(EVS_UseMove_ImplA) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) @@ -59,12 +59,12 @@ EvtScript N(EVS_UseMove_ImplA) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(GetActionResult, LVarF) - Call(CloseActionCommandInfo) + Call(GetJumpActionQuality, LVarF) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 24, 3) + Call(action_command_jump_start, 24, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall) Call(PlayerBasicJumpToGoal, 24, PLAYER_BASIC_JUMP_3) @@ -77,7 +77,7 @@ EvtScript N(EVS_UseMove_ImplA) = { End }; -EvtScript N(EVS_UseMove_ImplB) = { +EvtScript N(EVS_UseMove_Super) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -85,7 +85,7 @@ EvtScript N(EVS_UseMove_ImplB) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) @@ -104,18 +104,18 @@ EvtScript N(EVS_UseMove_ImplB) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarF) + Call(GetJumpActionQuality, LVarF) ChildThread Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_JUMP_FINISH) Wait(5) Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 37, 3) + Call(action_command_jump_start, 37, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Sit, ANIM_Mario1_SpinJump) @@ -132,7 +132,7 @@ EvtScript N(EVS_UseMove_ImplB) = { End }; -EvtScript N(EVS_UseMove_ImplC) = { +EvtScript N(EVS_UseMove_Ultra) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -140,7 +140,7 @@ EvtScript N(EVS_UseMove_ImplC) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) @@ -159,18 +159,18 @@ EvtScript N(EVS_UseMove_ImplC) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarF) + Call(GetJumpActionQuality, LVarF) ChildThread Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_ULTRA_JUMP_FINISH) Wait(5) Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 25, 3) + Call(action_command_jump_start, 25, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Jump, ANIM_Mario1_SpinFall) diff --git a/src/battle/move/jump/earthquake_jump.c b/src/battle/move/jump/earthquake_jump.c index 01c932372bb..dee4b075b80 100644 --- a/src/battle/move/jump/earthquake_jump.c +++ b/src/battle/move/jump/earthquake_jump.c @@ -15,13 +15,13 @@ API_CALLABLE(N(func_802A10E4_785C04)) { MATCHING_BSS(0x3CC0); -s32 N(DifficultyTable)[] = { +Difficulty1D N(DifficultyTable) = { 11, 10, 9, 8, 7, 6, 5, 4 }; -extern EvtScript N(EVS_UseMove_ImplA); -extern EvtScript N(EVS_UseMove_ImplB); -extern EvtScript N(EVS_UseMove_ImplC); +extern EvtScript N(EVS_UseMove_Basic); +extern EvtScript N(EVS_UseMove_Super); +extern EvtScript N(EVS_UseMove_Ultra); EvtScript N(EVS_UseMove) = { Set(LFlagA, FALSE) @@ -29,17 +29,17 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - ExecWait(N(EVS_UseMove_ImplA)) + ExecWait(N(EVS_UseMove_Basic)) CaseEq(1) - ExecWait(N(EVS_UseMove_ImplB)) + ExecWait(N(EVS_UseMove_Super)) CaseEq(2) - ExecWait(N(EVS_UseMove_ImplC)) + ExecWait(N(EVS_UseMove_Ultra)) EndSwitch Return End }; -EvtScript N(EVS_UseMove_ImplA) = { +EvtScript N(EVS_UseMove_Basic) = { Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(SetGoalToFirstTarget, ACTOR_SELF) @@ -65,7 +65,7 @@ EvtScript N(EVS_UseMove_ImplA) = { ExecWait(N(EVS_JumpSupport_CalcJumpTime)) Set(LVarB, LVarA) Add(LVarB, 2) - Call(action_command_jump_start, LVarB, 3) + Call(action_command_jump_start, LVarB, AC_DIFFICULTY_3) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR) Call(SetGoalPos, ACTOR_PLAYER, 30, 0, 0) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_MarioB1_Stomp, ANIM_MarioB1_Stomp) @@ -89,29 +89,29 @@ EvtScript N(EVS_UseMove_ImplA) = { EndChildThread Wait(10) Call(InitTargetIterator) - Call(GetPlayerActionSuccess, LVarB) + Call(GetPlayerActionQuality, LVarB) Set(LVar9, 0) Label(1) - Call(SetGoalToTarget, ACTOR_PLAYER) - Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT, 0, 0, 0, 16) - IfEq(LVar0, HIT_RESULT_MISS) - Goto(2) - EndIf - Switch(LVarB) - CaseGt(FALSE) - Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) - Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_NICE_HIT) - CaseDefault - Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) - Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_TRIGGER_EVENTS) - EndSwitch - Label(2) - Call(ChooseNextTarget, ITER_NEXT, LVar0) - Add(LVar9, 1) - Call(GetTargetListLength, LVar0) - IfLt(LVar9, LVar0) - Goto(1) - EndIf + Call(SetGoalToTarget, ACTOR_PLAYER) + Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT, 0, 0, 0, 16) + IfEq(LVar0, HIT_RESULT_MISS) + Goto(2) + EndIf + Switch(LVarB) + CaseGt(FALSE) + Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) + Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_NICE_HIT) + CaseDefault + Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) + Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_TRIGGER_EVENTS) + EndSwitch + Label(2) + Call(ChooseNextTarget, ITER_NEXT, LVar0) + Add(LVar9, 1) + Call(GetTargetListLength, LVar0) + IfLt(LVar9, LVar0) + Goto(1) + EndIf Switch(LVarC) CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) @@ -128,136 +128,136 @@ EvtScript N(EVS_UseMove_ImplA) = { Call(SetGoalPos, ACTOR_PLAYER, 30, 0, 0) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(GetActionResult, LVarE) + Call(GetJumpActionQuality, LVarE) Set(LVarF, 0) Set(LFlag0, FALSE) Label(10) - ChildThread - Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_JUMP_FINISH) - Wait(5) + ChildThread + Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_JUMP_FINISH) + Wait(5) + Call(SetGoalPos, ACTOR_PLAYER, 30, 0, 0) + Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) + EndChildThread + Call(InterruptActionCommand) + Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) + Call(LoadActionCommand, ACTION_COMMAND_JUMP) + Call(action_command_jump_init) + Set(LVarA, 26) + Switch(LVarF) + CaseEq(0) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) + CaseEq(1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) + CaseEq(2) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_4) + CaseEq(3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_4) + CaseDefault + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_5) + EndSwitch + Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall) Call(SetGoalPos, ACTOR_PLAYER, 30, 0, 0) - Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) - EndChildThread - Call(CloseActionCommandInfo) - Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) - Call(LoadActionCommand, ACTION_COMMAND_JUMP) - Call(action_command_jump_init) - Set(LVarA, 26) - Switch(LVarF) - CaseEq(0) - Call(action_command_jump_start, LVarA, 3) - CaseEq(1) - Call(action_command_jump_start, LVarA, 3) - CaseEq(2) - Call(action_command_jump_start, LVarA, 4) - CaseEq(3) - Call(action_command_jump_start, LVarA, 4) - CaseDefault - Call(action_command_jump_start, LVarA, 5) - EndSwitch - Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall) - Call(SetGoalPos, ACTOR_PLAYER, 30, 0, 0) - IfEq(LVarF, 0) - Call(PlayerBasicJumpToGoal, 24, PLAYER_BASIC_JUMP_3) - Else - Call(PlayerBasicJumpToGoal, 24, PLAYER_BASIC_JUMP_4) - EndIf - ChildThread - Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.2)) - Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0)) - Call(ShakeCam, CAM_BATTLE, 0, 10, Float(2.0)) - Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0)) - Call(ShakeCam, CAM_BATTLE, 0, 3, Float(0.7)) - Call(ShakeCam, CAM_BATTLE, 0, 4, Float(0.4)) - Call(ShakeCam, CAM_BATTLE, 0, 6, Float(0.1)) - Call(ShakeCam, CAM_BATTLE, 0, 4, Float(0.05)) - EndChildThread - ChildThread - Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) - Add(LVar0, 24) - Add(LVar1, 10) - PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 72, 8, 0, 30, 0, 0, 0, 0, 0) - PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 72, 8, 24, 30, 0, 0, 0, 0, 0) - EndChildThread - Wait(10) - Call(GetCommandAutoSuccess, LVar1) - IfEq(LVar1, 1) - IfGt(LVarF, 3) + IfEq(LVarF, 0) + Call(PlayerBasicJumpToGoal, 24, PLAYER_BASIC_JUMP_3) + Else + Call(PlayerBasicJumpToGoal, 24, PLAYER_BASIC_JUMP_4) + EndIf + ChildThread + Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.2)) + Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0)) + Call(ShakeCam, CAM_BATTLE, 0, 10, Float(2.0)) + Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0)) + Call(ShakeCam, CAM_BATTLE, 0, 3, Float(0.7)) + Call(ShakeCam, CAM_BATTLE, 0, 4, Float(0.4)) + Call(ShakeCam, CAM_BATTLE, 0, 6, Float(0.1)) + Call(ShakeCam, CAM_BATTLE, 0, 4, Float(0.05)) + EndChildThread + ChildThread + Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) + Add(LVar0, 24) + Add(LVar1, 10) + PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 72, 8, 0, 30, 0, 0, 0, 0, 0) + PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 72, 8, 24, 30, 0, 0, 0, 0, 0) + EndChildThread + Wait(10) + Call(GetCommandAutoSuccess, LVar1) + IfEq(LVar1, 1) + IfGt(LVarF, 3) + Set(LFlag0, TRUE) + EndIf + EndIf + Set(LVar0, 3) + Call(N(func_802A10E4_785C04)) + IfGt(LVarF, LVar0) Set(LFlag0, TRUE) EndIf - EndIf - Set(LVar0, 3) - Call(N(func_802A10E4_785C04)) - IfGt(LVarF, LVar0) - Set(LFlag0, TRUE) - EndIf - Call(InitTargetIterator) - Call(GetPlayerActionSuccess, LVarB) - Set(LVar9, 0) - Label(11) - Call(SetGoalToTarget, ACTOR_PLAYER) - Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT, 0, 0, 0, 16) - IfEq(LVar0, HIT_RESULT_MISS) - Goto(12) - EndIf - Switch(LVarB) - CaseGt(FALSE) - IfEq(LFlag0, FALSE) - Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) - Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_NICE_HIT) - Else - Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) - Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_NICE_HIT | BS_FLAGS1_NO_RATING) + Call(InitTargetIterator) + Call(GetPlayerActionQuality, LVarB) + Set(LVar9, 0) + Label(11) + Call(SetGoalToTarget, ACTOR_PLAYER) + Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT, 0, 0, 0, 16) + IfEq(LVar0, HIT_RESULT_MISS) + Goto(12) EndIf - CaseDefault - Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) - Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_TRIGGER_EVENTS) - EndSwitch - Switch(LVarF) - CaseEq(0) - Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1) - CaseEq(1) - Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_2) - CaseEq(2) - Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_3) - CaseEq(3) - Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) - CaseDefault - Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) - EndSwitch - Call(SetActionResult, LVarE) - Label(12) - Call(ChooseNextTarget, ITER_NEXT, LVar0) - Add(LVar9, 1) - Call(GetTargetListLength, LVar0) - IfLt(LVar9, LVar0) - Goto(11) - EndIf - Switch(LVarC) - CaseOrEq(HIT_RESULT_HIT) - CaseOrEq(HIT_RESULT_NO_DAMAGE) - IfEq(LFlag0, TRUE) - ExecWait(N(EVS_JumpSupport_Rebound)) - Return + Switch(LVarB) + CaseGt(FALSE) + IfEq(LFlag0, FALSE) + Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) + Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_NICE_HIT) + Else + Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) + Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_NICE_HIT | BS_FLAGS1_NO_RATING) + EndIf + CaseDefault + Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) + Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_TRIGGER_EVENTS) + EndSwitch + Switch(LVarF) + CaseEq(0) + Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1) + CaseEq(1) + Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_2) + CaseEq(2) + Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_3) + CaseEq(3) + Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) + CaseDefault + Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) + EndSwitch + Call(SetActionResult, LVarE) + Label(12) + Call(ChooseNextTarget, ITER_NEXT, LVar0) + Add(LVar9, 1) + Call(GetTargetListLength, LVar0) + IfLt(LVar9, LVar0) + Goto(11) EndIf - ExecWait(N(EVS_JumpSupport_G)) - Return - EndCaseGroup - CaseOrEq(HIT_RESULT_NICE) - CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - IfEq(LFlag0, TRUE) - ExecWait(N(EVS_JumpSupport_Rebound)) + Switch(LVarC) + CaseOrEq(HIT_RESULT_HIT) + CaseOrEq(HIT_RESULT_NO_DAMAGE) + IfEq(LFlag0, TRUE) + ExecWait(N(EVS_JumpSupport_Rebound)) + Return + EndIf + ExecWait(N(EVS_JumpSupport_G)) Return - EndIf - EndCaseGroup - EndSwitch - Add(LVarF, 1) - Goto(10) + EndCaseGroup + CaseOrEq(HIT_RESULT_NICE) + CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) + IfEq(LFlag0, TRUE) + ExecWait(N(EVS_JumpSupport_Rebound)) + Return + EndIf + EndCaseGroup + EndSwitch + Add(LVarF, 1) + Goto(10) Return End }; -EvtScript N(EVS_UseMove_ImplB) = { +EvtScript N(EVS_UseMove_Super) = { Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(SetGoalToFirstTarget, ACTOR_SELF) @@ -285,7 +285,7 @@ EvtScript N(EVS_UseMove_ImplB) = { ExecWait(N(EVS_JumpSupport_CalcJumpTime)) Set(LVarB, LVarA) Add(LVarB, 2) - Call(action_command_jump_start, LVarB, 3) + Call(action_command_jump_start, LVarB, AC_DIFFICULTY_3) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR) Call(SetGoalPos, ACTOR_PLAYER, 30, 0, 0) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_MarioB1_Stomp, ANIM_MarioB1_Stomp) @@ -309,29 +309,29 @@ EvtScript N(EVS_UseMove_ImplB) = { EndChildThread Wait(10) Call(InitTargetIterator) - Call(GetPlayerActionSuccess, LVarB) + Call(GetPlayerActionQuality, LVarB) Set(LVar9, 0) Label(1) - Call(SetGoalToTarget, ACTOR_PLAYER) - Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT, 0, 0, 0, 16) - IfEq(LVar0, HIT_RESULT_MISS) - Goto(2) - EndIf - Switch(LVarB) - CaseGt(FALSE) - Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) - Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_NICE_HIT) - CaseDefault - Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) - Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_TRIGGER_EVENTS) - EndSwitch - Label(2) - Call(ChooseNextTarget, ITER_NEXT, LVar0) - Add(LVar9, 1) - Call(GetTargetListLength, LVar0) - IfLt(LVar9, LVar0) - Goto(1) - EndIf + Call(SetGoalToTarget, ACTOR_PLAYER) + Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT, 0, 0, 0, 16) + IfEq(LVar0, HIT_RESULT_MISS) + Goto(2) + EndIf + Switch(LVarB) + CaseGt(FALSE) + Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) + Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_NICE_HIT) + CaseDefault + Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) + Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_TRIGGER_EVENTS) + EndSwitch + Label(2) + Call(ChooseNextTarget, ITER_NEXT, LVar0) + Add(LVar9, 1) + Call(GetTargetListLength, LVar0) + IfLt(LVar9, LVar0) + Goto(1) + EndIf Switch(LVarC) CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) @@ -348,142 +348,142 @@ EvtScript N(EVS_UseMove_ImplB) = { Call(SetGoalPos, ACTOR_PLAYER, 30, 0, 0) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(GetActionResult, LVarE) + Call(GetJumpActionQuality, LVarE) Set(LVarF, 0) Set(LFlag0, FALSE) Label(10) - ChildThread - Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_JUMP_FINISH) - Wait(5) + ChildThread + Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_JUMP_FINISH) + Wait(5) + Call(SetGoalPos, ACTOR_PLAYER, 30, 0, 0) + Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) + EndChildThread + Call(InterruptActionCommand) + Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) + Call(LoadActionCommand, ACTION_COMMAND_JUMP) + Call(action_command_jump_init) + Set(LVarA, 39) + Switch(LVarF) + CaseEq(0) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) + CaseEq(1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) + CaseEq(2) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_4) + CaseEq(3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_4) + CaseDefault + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_5) + EndSwitch Call(SetGoalPos, ACTOR_PLAYER, 30, 0, 0) - Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) - EndChildThread - Call(CloseActionCommandInfo) - Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) - Call(LoadActionCommand, ACTION_COMMAND_JUMP) - Call(action_command_jump_init) - Set(LVarA, 39) - Switch(LVarF) - CaseEq(0) - Call(action_command_jump_start, LVarA, 3) - CaseEq(1) - Call(action_command_jump_start, LVarA, 3) - CaseEq(2) - Call(action_command_jump_start, LVarA, 4) - CaseEq(3) - Call(action_command_jump_start, LVarA, 4) - CaseDefault - Call(action_command_jump_start, LVarA, 5) - EndSwitch - Call(SetGoalPos, ACTOR_PLAYER, 30, 0, 0) - Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Sit, ANIM_Mario1_SpinJump) - Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) - IfEq(LVarF, 0) - Call(PlayerSuperJumpToGoal, 20, PLAYER_SUPER_JUMP_3) - Wait(7) - Call(PlayerSuperJumpToGoal, 3, PLAYER_SUPER_JUMP_6) - Else - Call(PlayerSuperJumpToGoal, 20, PLAYER_SUPER_JUMP_4) - Wait(7) - Call(PlayerSuperJumpToGoal, 3, PLAYER_SUPER_JUMP_5) - EndIf - Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE) - ChildThread - Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.2)) - Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0)) - Call(ShakeCam, CAM_BATTLE, 0, 10, Float(2.0)) - Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0)) - Call(ShakeCam, CAM_BATTLE, 0, 3, Float(0.7)) - Call(ShakeCam, CAM_BATTLE, 0, 4, Float(0.4)) - Call(ShakeCam, CAM_BATTLE, 0, 6, Float(0.1)) - Call(ShakeCam, CAM_BATTLE, 0, 4, Float(0.05)) - EndChildThread - ChildThread - Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) - Add(LVar0, 24) - Add(LVar1, 10) - PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 72, 8, 0, 30, 0, 0, 0, 0, 0) - PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 72, 8, 24, 30, 0, 0, 0, 0, 0) - EndChildThread - Wait(10) - Call(GetCommandAutoSuccess, LVar1) - IfEq(LVar1, 1) - IfGt(LVarF, 4) + Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Sit, ANIM_Mario1_SpinJump) + Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) + IfEq(LVarF, 0) + Call(PlayerSuperJumpToGoal, 20, PLAYER_SUPER_JUMP_3) + Wait(7) + Call(PlayerSuperJumpToGoal, 3, PLAYER_SUPER_JUMP_6) + Else + Call(PlayerSuperJumpToGoal, 20, PLAYER_SUPER_JUMP_4) + Wait(7) + Call(PlayerSuperJumpToGoal, 3, PLAYER_SUPER_JUMP_5) + EndIf + Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE) + ChildThread + Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.2)) + Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0)) + Call(ShakeCam, CAM_BATTLE, 0, 10, Float(2.0)) + Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0)) + Call(ShakeCam, CAM_BATTLE, 0, 3, Float(0.7)) + Call(ShakeCam, CAM_BATTLE, 0, 4, Float(0.4)) + Call(ShakeCam, CAM_BATTLE, 0, 6, Float(0.1)) + Call(ShakeCam, CAM_BATTLE, 0, 4, Float(0.05)) + EndChildThread + ChildThread + Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) + Add(LVar0, 24) + Add(LVar1, 10) + PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 72, 8, 0, 30, 0, 0, 0, 0, 0) + PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 72, 8, 24, 30, 0, 0, 0, 0, 0) + EndChildThread + Wait(10) + Call(GetCommandAutoSuccess, LVar1) + IfEq(LVar1, 1) + IfGt(LVarF, 4) + Set(LFlag0, TRUE) + EndIf + EndIf + Set(LVar0, 4) + Call(N(func_802A10E4_785C04)) + IfGt(LVarF, LVar0) Set(LFlag0, TRUE) EndIf - EndIf - Set(LVar0, 4) - Call(N(func_802A10E4_785C04)) - IfGt(LVarF, LVar0) - Set(LFlag0, TRUE) - EndIf - Call(InitTargetIterator) - Call(GetPlayerActionSuccess, LVarB) - Set(LVar9, 0) - Label(11) - Call(SetGoalToTarget, ACTOR_PLAYER) - Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT, 0, 0, 0, 16) - IfEq(LVar0, HIT_RESULT_MISS) - Goto(12) - EndIf - Switch(LVarB) - CaseGt(FALSE) - IfEq(LFlag0, FALSE) - Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) - Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_NICE_HIT) - Else - Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) - Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_NICE_HIT | BS_FLAGS1_NO_RATING) + Call(InitTargetIterator) + Call(GetPlayerActionQuality, LVarB) + Set(LVar9, 0) + Label(11) + Call(SetGoalToTarget, ACTOR_PLAYER) + Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT, 0, 0, 0, 16) + IfEq(LVar0, HIT_RESULT_MISS) + Goto(12) EndIf - CaseDefault - Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) - Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_TRIGGER_EVENTS) - EndSwitch - Switch(LVarF) - CaseEq(0) - Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1) - CaseEq(1) - Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_2) - CaseEq(2) - Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_3) - CaseEq(3) - Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) - CaseDefault - Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) - EndSwitch - Call(SetActionResult, LVarE) - Label(12) - Call(ChooseNextTarget, ITER_NEXT, LVar0) - Add(LVar9, 1) - Call(GetTargetListLength, LVar0) - IfLt(LVar9, LVar0) - Goto(1) - EndIf - Switch(LVarC) - CaseOrEq(HIT_RESULT_HIT) - CaseOrEq(HIT_RESULT_NO_DAMAGE) - IfEq(LFlag0, TRUE) - ExecWait(N(EVS_JumpSupport_Rebound)) - Return + Switch(LVarB) + CaseGt(FALSE) + IfEq(LFlag0, FALSE) + Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) + Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_NICE_HIT) + Else + Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) + Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_NICE_HIT | BS_FLAGS1_NO_RATING) + EndIf + CaseDefault + Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) + Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_TRIGGER_EVENTS) + EndSwitch + Switch(LVarF) + CaseEq(0) + Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1) + CaseEq(1) + Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_2) + CaseEq(2) + Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_3) + CaseEq(3) + Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) + CaseDefault + Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) + EndSwitch + Call(SetActionResult, LVarE) + Label(12) + Call(ChooseNextTarget, ITER_NEXT, LVar0) + Add(LVar9, 1) + Call(GetTargetListLength, LVar0) + IfLt(LVar9, LVar0) + Goto(1) // @bug? shouldn't this be Goto(11)? EndIf - ExecWait(N(EVS_JumpSupport_G)) - Return - EndCaseGroup - CaseOrEq(HIT_RESULT_NICE) - CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - IfEq(LFlag0, TRUE) - ExecWait(N(EVS_JumpSupport_Rebound)) + Switch(LVarC) + CaseOrEq(HIT_RESULT_HIT) + CaseOrEq(HIT_RESULT_NO_DAMAGE) + IfEq(LFlag0, TRUE) + ExecWait(N(EVS_JumpSupport_Rebound)) + Return + EndIf + ExecWait(N(EVS_JumpSupport_G)) Return - EndIf - EndCaseGroup - EndSwitch - Add(LVarF, 1) - Goto(10) + EndCaseGroup + CaseOrEq(HIT_RESULT_NICE) + CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) + IfEq(LFlag0, TRUE) + ExecWait(N(EVS_JumpSupport_Rebound)) + Return + EndIf + EndCaseGroup + EndSwitch + Add(LVarF, 1) + Goto(10) Return End }; -EvtScript N(EVS_UseMove_ImplC) = { +EvtScript N(EVS_UseMove_Ultra) = { Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(SetGoalToFirstTarget, ACTOR_SELF) @@ -511,7 +511,7 @@ EvtScript N(EVS_UseMove_ImplC) = { ExecWait(N(EVS_JumpSupport_CalcJumpTime)) Set(LVarB, LVarA) Add(LVarB, 2) - Call(action_command_jump_start, LVarB, 3) + Call(action_command_jump_start, LVarB, AC_DIFFICULTY_3) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR) Call(SetGoalPos, ACTOR_PLAYER, 30, 0, 0) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_MarioB1_Stomp, ANIM_MarioB1_Stomp) @@ -535,29 +535,29 @@ EvtScript N(EVS_UseMove_ImplC) = { EndChildThread Wait(10) Call(InitTargetIterator) - Call(GetPlayerActionSuccess, LVarB) + Call(GetPlayerActionQuality, LVarB) Set(LVar9, 0) Label(1) - Call(SetGoalToTarget, ACTOR_PLAYER) - Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT, 0, 0, 0, 16) - IfEq(LVar0, HIT_RESULT_MISS) - Goto(2) - EndIf - Switch(LVarB) - CaseGt(FALSE) - Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) - Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_NICE_HIT) - CaseDefault - Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) - Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_TRIGGER_EVENTS) - EndSwitch - Label(2) - Call(ChooseNextTarget, ITER_NEXT, LVar0) - Add(LVar9, 1) - Call(GetTargetListLength, LVar0) - IfLt(LVar9, LVar0) - Goto(1) - EndIf + Call(SetGoalToTarget, ACTOR_PLAYER) + Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT, 0, 0, 0, 16) + IfEq(LVar0, HIT_RESULT_MISS) + Goto(2) + EndIf + Switch(LVarB) + CaseGt(FALSE) + Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) + Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_NICE_HIT) + CaseDefault + Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) + Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_TRIGGER_EVENTS) + EndSwitch + Label(2) + Call(ChooseNextTarget, ITER_NEXT, LVar0) + Add(LVar9, 1) + Call(GetTargetListLength, LVar0) + IfLt(LVar9, LVar0) + Goto(1) + EndIf Switch(LVarC) CaseOrEq(HIT_RESULT_HIT) CaseOrEq(HIT_RESULT_NO_DAMAGE) @@ -574,133 +574,133 @@ EvtScript N(EVS_UseMove_ImplC) = { Call(SetGoalPos, ACTOR_PLAYER, 30, 0, 0) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(GetActionResult, LVarE) + Call(GetJumpActionQuality, LVarE) Set(LVarF, 0) Set(LFlag0, FALSE) Label(10) - ChildThread - Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_ULTRA_JUMP_FINISH) - Wait(5) + ChildThread + Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_ULTRA_JUMP_FINISH) + Wait(5) + Call(SetGoalPos, ACTOR_PLAYER, 30, 0, 0) + Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) + EndChildThread + Call(InterruptActionCommand) + Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) + Call(LoadActionCommand, ACTION_COMMAND_JUMP) + Call(action_command_jump_init) + Set(LVarA, 27) + Switch(LVarF) + CaseEq(0) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) + CaseEq(1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) + CaseEq(2) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_4) + CaseEq(3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_4) + CaseDefault + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_5) + EndSwitch Call(SetGoalPos, ACTOR_PLAYER, 30, 0, 0) - Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) - EndChildThread - Call(CloseActionCommandInfo) - Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) - Call(LoadActionCommand, ACTION_COMMAND_JUMP) - Call(action_command_jump_init) - Set(LVarA, 27) - Switch(LVarF) - CaseEq(0) - Call(action_command_jump_start, LVarA, 3) - CaseEq(1) - Call(action_command_jump_start, LVarA, 3) - CaseEq(2) - Call(action_command_jump_start, LVarA, 4) - CaseEq(3) - Call(action_command_jump_start, LVarA, 4) - CaseDefault - Call(action_command_jump_start, LVarA, 5) - EndSwitch - Call(SetGoalPos, ACTOR_PLAYER, 30, 0, 0) - Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) - Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Jump, ANIM_Mario1_SpinFall) - IfEq(LVarF, 0) - Call(PlayerUltraJumpToGoal, 25, PLAYER_ULTRA_JUMP_2) - Else - Call(PlayerUltraJumpToGoal, 25, PLAYER_ULTRA_JUMP_4) - EndIf - Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE) - ChildThread - Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.2)) - Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0)) - Call(ShakeCam, CAM_BATTLE, 0, 10, Float(2.0)) - Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0)) - Call(ShakeCam, CAM_BATTLE, 0, 3, Float(0.7)) - Call(ShakeCam, CAM_BATTLE, 0, 4, Float(0.4)) - Call(ShakeCam, CAM_BATTLE, 0, 6, Float(0.1)) - Call(ShakeCam, CAM_BATTLE, 0, 4, Float(0.05)) - EndChildThread - ChildThread - Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) - Add(LVar0, 24) - Add(LVar1, 10) - PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 72, 8, 0, 30, 0, 0, 0, 0, 0) - PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 72, 8, 24, 30, 0, 0, 0, 0, 0) - EndChildThread - Wait(10) - Call(GetCommandAutoSuccess, LVar1) - IfEq(LVar1, 1) - IfGt(LVarF, 5) + Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) + Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Jump, ANIM_Mario1_SpinFall) + IfEq(LVarF, 0) + Call(PlayerUltraJumpToGoal, 25, PLAYER_ULTRA_JUMP_2) + Else + Call(PlayerUltraJumpToGoal, 25, PLAYER_ULTRA_JUMP_4) + EndIf + Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE) + ChildThread + Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.2)) + Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0)) + Call(ShakeCam, CAM_BATTLE, 0, 10, Float(2.0)) + Call(ShakeCam, CAM_BATTLE, 0, 5, Float(1.0)) + Call(ShakeCam, CAM_BATTLE, 0, 3, Float(0.7)) + Call(ShakeCam, CAM_BATTLE, 0, 4, Float(0.4)) + Call(ShakeCam, CAM_BATTLE, 0, 6, Float(0.1)) + Call(ShakeCam, CAM_BATTLE, 0, 4, Float(0.05)) + EndChildThread + ChildThread + Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) + Add(LVar0, 24) + Add(LVar1, 10) + PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 72, 8, 0, 30, 0, 0, 0, 0, 0) + PlayEffect(EFFECT_SMOKE_IMPACT, 0, LVar0, LVar1, LVar2, 72, 8, 24, 30, 0, 0, 0, 0, 0) + EndChildThread + Wait(10) + Call(GetCommandAutoSuccess, LVar1) + IfEq(LVar1, 1) + IfGt(LVarF, 5) + Set(LFlag0, TRUE) + EndIf + EndIf + Set(LVar0, 5) + Call(N(func_802A10E4_785C04)) + IfGt(LVarF, LVar0) Set(LFlag0, TRUE) EndIf - EndIf - Set(LVar0, 5) - Call(N(func_802A10E4_785C04)) - IfGt(LVarF, LVar0) - Set(LFlag0, TRUE) - EndIf - Call(InitTargetIterator) - Call(GetPlayerActionSuccess, LVarB) - Set(LVar9, 0) - Label(11) - Call(SetGoalToTarget, ACTOR_PLAYER) - Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT, 0, 0, 0, 16) - IfEq(LVar0, HIT_RESULT_MISS) - Goto(12) - EndIf - Switch(LVarB) - CaseGt(FALSE) - IfEq(LFlag0, FALSE) - Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) - Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_NICE_HIT) - Else - Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) - Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_NICE_HIT | BS_FLAGS1_NO_RATING) + Call(InitTargetIterator) + Call(GetPlayerActionQuality, LVarB) + Set(LVar9, 0) + Label(11) + Call(SetGoalToTarget, ACTOR_PLAYER) + Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT, 0, 0, 0, 16) + IfEq(LVar0, HIT_RESULT_MISS) + Goto(12) EndIf - CaseDefault - Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) - Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_TRIGGER_EVENTS) - EndSwitch - Switch(LVarF) - CaseEq(0) - Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1) - CaseEq(1) - Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_2) - CaseEq(2) - Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_3) - CaseEq(3) - Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) - CaseDefault - Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) - EndSwitch - Call(SetActionResult, LVarE) - Label(12) - Call(ChooseNextTarget, ITER_NEXT, LVar0) - Add(LVar9, 1) - Call(GetTargetListLength, LVar0) - IfLt(LVar9, LVar0) - Goto(1) - EndIf - Switch(LVarC) - CaseOrEq(HIT_RESULT_HIT) - CaseOrEq(HIT_RESULT_NO_DAMAGE) - IfEq(LFlag0, TRUE) - ExecWait(N(EVS_JumpSupport_Rebound)) - Return + Switch(LVarB) + CaseGt(FALSE) + IfEq(LFlag0, FALSE) + Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) + Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_NICE_HIT) + Else + Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) + Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_NICE_HIT | BS_FLAGS1_NO_RATING) + EndIf + CaseDefault + Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) + Call(PlayerDamageEnemy, LVarC, DAMAGE_TYPE_QUAKE | DAMAGE_TYPE_IGNORE_DEFENSE | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, 0, 0, 1, BS_FLAGS1_TRIGGER_EVENTS) + EndSwitch + Switch(LVarF) + CaseEq(0) + Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1) + CaseEq(1) + Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_2) + CaseEq(2) + Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_3) + CaseEq(3) + Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) + CaseDefault + Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) + EndSwitch + Call(SetActionResult, LVarE) + Label(12) + Call(ChooseNextTarget, ITER_NEXT, LVar0) + Add(LVar9, 1) + Call(GetTargetListLength, LVar0) + IfLt(LVar9, LVar0) + Goto(1) // @bug? shouldn't this be Goto(11)? EndIf - ExecWait(N(EVS_JumpSupport_G)) - Return - EndCaseGroup - CaseOrEq(HIT_RESULT_NICE) - CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) - IfEq(LFlag0, TRUE) - ExecWait(N(EVS_JumpSupport_Rebound)) + Switch(LVarC) + CaseOrEq(HIT_RESULT_HIT) + CaseOrEq(HIT_RESULT_NO_DAMAGE) + IfEq(LFlag0, TRUE) + ExecWait(N(EVS_JumpSupport_Rebound)) + Return + EndIf + ExecWait(N(EVS_JumpSupport_G)) Return - EndIf - EndCaseGroup - EndSwitch - Add(LVarF, 1) - Goto(10) + EndCaseGroup + CaseOrEq(HIT_RESULT_NICE) + CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) + IfEq(LFlag0, TRUE) + ExecWait(N(EVS_JumpSupport_Rebound)) + Return + EndIf + EndCaseGroup + EndSwitch + Add(LVarF, 1) + Goto(10) Return End }; diff --git a/src/battle/move/jump/jump_charge_0.c b/src/battle/move/jump/jump_charge_0.c index 5b8da6720f3..5ad7958f203 100644 --- a/src/battle/move/jump/jump_charge_0.c +++ b/src/battle/move/jump/jump_charge_0.c @@ -43,12 +43,12 @@ API_CALLABLE(N(func_802A120C_74D77C)) { return ApiStatus_DONE2; } -EvtScript N(EVS_UseMove1) = { +EvtScript N(EVS_UseMove_Unimplemented) = { Return End }; -EvtScript N(EVS_UseMove0) = { +EvtScript N(EVS_UseMove) = { Call(UseBattleCamPreset, BTL_CAM_PLAYER_CHARGE_UP) Wait(10) ChildThread diff --git a/src/battle/move/jump/jump_charge_1.c b/src/battle/move/jump/jump_charge_1.c index b4d146f972a..4585fad1b8d 100644 --- a/src/battle/move/jump/jump_charge_1.c +++ b/src/battle/move/jump/jump_charge_1.c @@ -10,7 +10,7 @@ #include "world/common/todo/IsJumpMaxCharged.inc.c" -BSS s32 D_802A2C50; +BSS b32 N(HasCharged); API_CALLABLE(N(func_802A1108_74D678)) { Bytecode* args = script->ptrReadPos; @@ -18,13 +18,12 @@ API_CALLABLE(N(func_802A1108_74D678)) { s32 var1 = evt_get_variable(script, *args++); s32 var2 = evt_get_variable(script, *args++); s32 var3 = evt_get_variable(script, *args++); - s32* var4; fx_stat_change(1, var1, var2, var3, 1.0f, 60); - var4 = &D_802A2C50; - *var4 = 0; + + N(HasCharged) = FALSE; if (battleStatus->jumpCharge > 0) { - *var4 = 1; + N(HasCharged) = TRUE; } battleStatus->jumpCharge += 2; @@ -42,22 +41,22 @@ API_CALLABLE(N(func_802A1108_74D678)) { #include "world/common/todo/UnkMoveFunc2.inc.c" -API_CALLABLE(N(func_802A133C_75CCBC)) { - if (D_802A2C50 == 0) { - script->varTable[0] = 6; +API_CALLABLE(N(GetChargeMessage)) { + if (!N(HasCharged)) { + script->varTable[0] = BTL_MSG_CHARGE_JUMP; } else { - script->varTable[0] = 7; + script->varTable[0] = BTL_MSG_CHARGE_JUMP_MORE; } return ApiStatus_DONE2; } -EvtScript N(EVS_UseMove1) = { +EvtScript N(EVS_UseMove_Unimplemented) = { Return End }; -EvtScript N(EVS_UseMove0) = { +EvtScript N(EVS_UseMove) = { Call(UseBattleCamPreset, BTL_CAM_PLAYER_CHARGE_UP) Wait(10) ChildThread @@ -94,7 +93,7 @@ EvtScript N(EVS_UseMove0) = { Wait(4) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle) Call(UseIdleAnimation, ACTOR_PLAYER, TRUE) - Call(N(func_802A133C_75CCBC)) + Call(N(GetChargeMessage)) Call(ShowVariableMessageBox, LVar0, 60, 2) Else Call(ShowMessageBox, BTL_MSG_CANT_CHARGE, 60) diff --git a/src/battle/move/jump/jump_charge_2.c b/src/battle/move/jump/jump_charge_2.c index 5ce523afd32..08d21346ac9 100644 --- a/src/battle/move/jump/jump_charge_2.c +++ b/src/battle/move/jump/jump_charge_2.c @@ -10,7 +10,7 @@ #include "world/common/todo/IsJumpMaxCharged.inc.c" -BSS s32 D_802A2C20; +BSS b32 N(HasCharged); API_CALLABLE(N(func_802A1108_74D678)) { Bytecode* args = script->ptrReadPos; @@ -21,10 +21,10 @@ API_CALLABLE(N(func_802A1108_74D678)) { s32* var4; fx_stat_change(2, var1, var2, var3, 1.0f, 60); - var4 = &D_802A2C20; - *var4 = 0; + + N(HasCharged) = FALSE; if (battleStatus->jumpCharge > 0) { - *var4 = 1; + N(HasCharged) = TRUE; } battleStatus->jumpCharge += 3; @@ -42,22 +42,22 @@ API_CALLABLE(N(func_802A1108_74D678)) { #include "world/common/todo/UnkMoveFunc3.inc.c" -API_CALLABLE(N(func_802A133C_761C5C)) { - if (D_802A2C20 == 0) { - script->varTable[0] = 6; +API_CALLABLE(N(GetChargeMessage)) { + if (!N(HasCharged)) { + script->varTable[0] = BTL_MSG_CHARGE_JUMP; } else { - script->varTable[0] = 7; + script->varTable[0] = BTL_MSG_CHARGE_JUMP_MORE; } return ApiStatus_DONE2; } -EvtScript N(EVS_UseMove1) = { +EvtScript N(EVS_UseMove_Unimplemented) = { Return End }; -EvtScript N(EVS_UseMove0) = { +EvtScript N(EVS_UseMove) = { Call(UseBattleCamPreset, BTL_CAM_PLAYER_CHARGE_UP) Wait(10) ChildThread @@ -93,7 +93,7 @@ EvtScript N(EVS_UseMove0) = { Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Land) Wait(4) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle) - Call(N(func_802A133C_761C5C)) + Call(N(GetChargeMessage)) Call(ShowVariableMessageBox, LVar0, 60, 3) Else Call(ShowMessageBox, BTL_MSG_CANT_CHARGE, 60) diff --git a/src/battle/move/jump/mega_jump.c b/src/battle/move/jump/mega_jump.c index 36d434786a3..52f5d257740 100644 --- a/src/battle/move/jump/mega_jump.c +++ b/src/battle/move/jump/mega_jump.c @@ -54,7 +54,7 @@ EvtScript N(EVS_UseMove_Basic) = { EndIf ExecWait(N(EVS_PlayQuakeFX)) Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) @@ -82,7 +82,7 @@ EvtScript N(EVS_UseMove_Super) = { EndIf ExecWait(N(EVS_PlayQuakeFX)) Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) @@ -110,7 +110,7 @@ EvtScript N(EVS_UseMove_Ultra) = { EndIf ExecWait(N(EVS_PlayQuakeFX)) Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) diff --git a/src/battle/move/jump/multibounce.c b/src/battle/move/jump/multibounce.c index 666c2de2008..9145a4aba87 100644 --- a/src/battle/move/jump/multibounce.c +++ b/src/battle/move/jump/multibounce.c @@ -7,7 +7,7 @@ #include "battle/common/move/JumpSupport.inc.c" -s32 N(DifficultyTable)[] = { +Difficulty1D N(DifficultyTable) = { 7, 6, 5, 4, 3, 2, 1, 0 }; @@ -37,7 +37,7 @@ EvtScript N(EVS_UseMove_Basic) = { Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) ExecWait(N(EVS_JumpSupport_Approach)) ExecWait(N(EVS_JumpSupport_CalcJumpTime)) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_MarioB1_Stomp) @@ -53,7 +53,7 @@ EvtScript N(EVS_UseMove_Basic) = { Set(LFlag0, TRUE) EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(0) IfFalse(LFlag0) @@ -86,7 +86,7 @@ EvtScript N(EVS_UseMove_Basic) = { EndIf EndCaseGroup EndSwitch - Call(GetActionResult, LVarE) + Call(GetJumpActionQuality, LVarE) Add(LVarF, 1) Set(LFlag0, FALSE) Label(10) @@ -96,7 +96,7 @@ EvtScript N(EVS_UseMove_Basic) = { IfEq(LVarF, LVar0) Set(LFlag0, TRUE) EndIf - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) IfEq(LFlag0, TRUE) @@ -106,7 +106,7 @@ EvtScript N(EVS_UseMove_Basic) = { Call(SetGoalToTarget, ACTOR_PLAYER) ExecWait(N(EVS_JumpSupport_CalcJumpTime)) Add(LVarA, 5) - Call(action_command_jump_start, LVarA, 3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall) IfEq(LVarF, 1) @@ -120,7 +120,7 @@ EvtScript N(EVS_UseMove_Basic) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) @@ -152,7 +152,7 @@ EvtScript N(EVS_UseMove_Basic) = { Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) EndSwitch Call(SetActionResult, LVarE) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseOrEq(FALSE) CaseOrEq(2) @@ -188,7 +188,7 @@ EvtScript N(EVS_UseMove_Super) = { Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) ExecWait(N(EVS_JumpSupport_Approach)) ExecWait(N(EVS_JumpSupport_CalcJumpTime)) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_MarioB1_Stomp) @@ -204,7 +204,7 @@ EvtScript N(EVS_UseMove_Super) = { Set(LFlag0, TRUE) EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) @@ -237,7 +237,7 @@ EvtScript N(EVS_UseMove_Super) = { EndIf EndCaseGroup EndSwitch - Call(GetActionResult, LVarE) + Call(GetJumpActionQuality, LVarE) Set(LFlag0, FALSE) Set(LVarF, 0) Add(LVarF, 1) @@ -247,14 +247,14 @@ EvtScript N(EVS_UseMove_Super) = { IfEq(LVarF, LVar0) Set(LFlag0, TRUE) EndIf - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) IfEq(LFlag0, TRUE) Call(ShowActionHud, FALSE) EndIf Call(UseBattleCamPreset, BTL_CAM_PLAYER_MULTIBOUNCE) - Call(action_command_jump_start, 37, 3) + Call(action_command_jump_start, 37, AC_DIFFICULTY_3) Call(ChooseNextTarget, ITER_NEXT, LVar0) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetGoalToTarget, ACTOR_PLAYER) @@ -276,7 +276,7 @@ EvtScript N(EVS_UseMove_Super) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) @@ -308,7 +308,7 @@ EvtScript N(EVS_UseMove_Super) = { Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) EndSwitch Call(SetActionResult, LVarE) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseOrEq(FALSE) CaseOrEq(2) @@ -344,7 +344,7 @@ EvtScript N(EVS_UseMove_Ultra) = { Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) ExecWait(N(EVS_JumpSupport_Approach)) ExecWait(N(EVS_JumpSupport_CalcJumpTime)) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_MarioB1_Stomp) @@ -360,7 +360,7 @@ EvtScript N(EVS_UseMove_Ultra) = { Set(LFlag0, TRUE) EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) @@ -393,7 +393,7 @@ EvtScript N(EVS_UseMove_Ultra) = { EndIf EndCaseGroup EndSwitch - Call(GetActionResult, LVarE) + Call(GetJumpActionQuality, LVarE) Set(LFlag0, FALSE) Set(LVarF, 0) Add(LVarF, 1) @@ -403,14 +403,14 @@ EvtScript N(EVS_UseMove_Ultra) = { IfEq(LVarF, LVar0) Set(LFlag0, TRUE) EndIf - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) IfEq(LFlag0, TRUE) Call(ShowActionHud, FALSE) EndIf Call(UseBattleCamPreset, BTL_CAM_PLAYER_MULTIBOUNCE) - Call(action_command_jump_start, 25, 3) + Call(action_command_jump_start, 25, AC_DIFFICULTY_3) Call(ChooseNextTarget, ITER_NEXT, LVar0) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Jump, ANIM_Mario1_SpinFall) @@ -425,7 +425,7 @@ EvtScript N(EVS_UseMove_Ultra) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) @@ -457,7 +457,7 @@ EvtScript N(EVS_UseMove_Ultra) = { Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4) EndSwitch Call(SetActionResult, LVarE) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseOrEq(FALSE) CaseOrEq(2) diff --git a/src/battle/move/jump/power_bounce.c b/src/battle/move/jump/power_bounce.c index 29751acc0c3..1bc08ccb6bb 100644 --- a/src/battle/move/jump/power_bounce.c +++ b/src/battle/move/jump/power_bounce.c @@ -8,7 +8,7 @@ #include "battle/common/move/JumpSupport.inc.c" -s32 N(DifficultyTable)[] = { +Difficulty1D N(DifficultyTable) = { 7, 6, 5, 4, 3, 2, 1, 0 }; @@ -40,7 +40,7 @@ API_CALLABLE(N(InitializeHitCounter)) { } API_CALLABLE(N(IncrementHitCounter)) { - N(HitCounter) += 1; + N(HitCounter)++; return ApiStatus_DONE2; } @@ -54,9 +54,9 @@ API_CALLABLE(N(StoreHitCountRecord)) { return ApiStatus_DONE2; } -extern EvtScript N(EVS_UseMove_ImplA); -extern EvtScript N(EVS_UseMove_ImplB); -extern EvtScript N(EVS_UseMove_ImplC); +extern EvtScript N(EVS_UseMove_Basic); +extern EvtScript N(EVS_UseMove_Super); +extern EvtScript N(EVS_UseMove_Ultra); EvtScript N(EVS_UseMove) = { Set(LFlagA, FALSE) @@ -66,26 +66,26 @@ EvtScript N(EVS_UseMove) = { Switch(LVar1) CaseEq(0) Set(LVarC, 1) - ExecWait(N(EVS_UseMove_ImplA)) + ExecWait(N(EVS_UseMove_Basic)) CaseEq(1) Set(LVarC, 2) - ExecWait(N(EVS_UseMove_ImplB)) + ExecWait(N(EVS_UseMove_Super)) CaseEq(2) Set(LVarC, 3) - ExecWait(N(EVS_UseMove_ImplC)) + ExecWait(N(EVS_UseMove_Ultra)) EndSwitch Call(N(StoreHitCountRecord)) Return End }; -EvtScript N(EVS_UseMove_ImplA) = { +EvtScript N(EVS_UseMove_Basic) = { Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) ExecWait(N(EVS_JumpSupport_Approach)) ExecWait(N(EVS_JumpSupport_CalcJumpTime)) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_MarioB1_Stomp) @@ -96,7 +96,7 @@ EvtScript N(EVS_UseMove_ImplA) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) @@ -121,7 +121,7 @@ EvtScript N(EVS_UseMove_ImplA) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(GetActionResult, LVarE) + Call(GetJumpActionQuality, LVarE) Call(N(IncrementHitCounter)) Set(LVarD, 0) Set(LVarF, 0) @@ -133,22 +133,22 @@ EvtScript N(EVS_UseMove_ImplA) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Set(LVarA, 24) Switch(LVarF) CaseEq(0) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) CaseEq(1) - Call(action_command_jump_start, LVarA, 2) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_2) CaseEq(2) - Call(action_command_jump_start, LVarA, 3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) CaseEq(3) - Call(action_command_jump_start, LVarA, 4) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_4) CaseDefault - Call(action_command_jump_start, LVarA, 5) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_5) EndSwitch Sub(LVarD, 1) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall) @@ -169,7 +169,7 @@ EvtScript N(EVS_UseMove_ImplA) = { Set(LFlag0, TRUE) EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(0) IfEq(LFlag0, FALSE) @@ -221,13 +221,13 @@ EvtScript N(EVS_UseMove_ImplA) = { End }; -EvtScript N(EVS_UseMove_ImplB) = { +EvtScript N(EVS_UseMove_Super) = { Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) ExecWait(N(EVS_JumpSupport_Approach)) ExecWait(N(EVS_JumpSupport_CalcJumpTime)) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_MarioB1_Stomp) @@ -238,7 +238,7 @@ EvtScript N(EVS_UseMove_ImplB) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) @@ -257,7 +257,7 @@ EvtScript N(EVS_UseMove_ImplB) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarE) + Call(GetJumpActionQuality, LVarE) Call(N(IncrementHitCounter)) Set(LVarD, 0) Set(LVarF, 0) @@ -269,22 +269,22 @@ EvtScript N(EVS_UseMove_ImplB) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Set(LVarA, 37) Switch(LVarF) CaseEq(0) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) CaseEq(1) - Call(action_command_jump_start, LVarA, 2) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_2) CaseEq(2) - Call(action_command_jump_start, LVarA, 3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) CaseEq(3) - Call(action_command_jump_start, LVarA, 4) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_4) CaseDefault - Call(action_command_jump_start, LVarA, 5) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_5) EndSwitch Sub(LVarD, 1) Call(SetGoalToTarget, ACTOR_PLAYER) @@ -311,7 +311,7 @@ EvtScript N(EVS_UseMove_ImplB) = { Set(LFlag0, TRUE) EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) @@ -363,13 +363,13 @@ EvtScript N(EVS_UseMove_ImplB) = { End }; -EvtScript N(EVS_UseMove_ImplC) = { +EvtScript N(EVS_UseMove_Ultra) = { Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) ExecWait(N(EVS_JumpSupport_Approach)) ExecWait(N(EVS_JumpSupport_CalcJumpTime)) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_MarioB1_Stomp) @@ -380,7 +380,7 @@ EvtScript N(EVS_UseMove_ImplC) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) @@ -399,7 +399,7 @@ EvtScript N(EVS_UseMove_ImplC) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarE) + Call(GetJumpActionQuality, LVarE) Call(N(IncrementHitCounter)) Set(LVarD, 0) Set(LVarF, 0) @@ -411,22 +411,22 @@ EvtScript N(EVS_UseMove_ImplC) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(SetActionDifficultyTable, Ref(N(DifficultyTable))) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Set(LVarA, 25) Switch(LVarF) CaseEq(0) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) CaseEq(1) - Call(action_command_jump_start, LVarA, 2) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_2) CaseEq(2) - Call(action_command_jump_start, LVarA, 3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) CaseEq(3) - Call(action_command_jump_start, LVarA, 4) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_4) CaseDefault - Call(action_command_jump_start, LVarA, 5) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_5) EndSwitch Sub(LVarD, 1) Call(SetGoalToTarget, ACTOR_PLAYER) @@ -449,7 +449,7 @@ EvtScript N(EVS_UseMove_ImplC) = { Set(LFlag0, TRUE) EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) IfEq(LFlag0, FALSE) diff --git a/src/battle/move/jump/power_jump.c b/src/battle/move/jump/power_jump.c index b6f86a4a0ca..a6afa8bab8b 100644 --- a/src/battle/move/jump/power_jump.c +++ b/src/battle/move/jump/power_jump.c @@ -6,9 +6,9 @@ #include "battle/common/move/JumpSupport.inc.c" -extern EvtScript N(EVS_UseMove_ImplA); -extern EvtScript N(EVS_UseMove_ImplB); -extern EvtScript N(EVS_UseMove_ImplC); +extern EvtScript N(EVS_UseMove_Basic); +extern EvtScript N(EVS_UseMove_Super); +extern EvtScript N(EVS_UseMove_Ultra); EvtScript N(EVS_UseMove) = { Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) @@ -16,11 +16,11 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - ExecWait(N(EVS_UseMove_ImplA)) + ExecWait(N(EVS_UseMove_Basic)) CaseEq(1) - ExecWait(N(EVS_UseMove_ImplB)) + ExecWait(N(EVS_UseMove_Super)) CaseEq(2) - ExecWait(N(EVS_UseMove_ImplC)) + ExecWait(N(EVS_UseMove_Ultra)) EndSwitch Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE) Return @@ -39,7 +39,7 @@ EvtScript N(EVS_802A26B4) = { End }; -EvtScript N(EVS_UseMove_ImplA) = { +EvtScript N(EVS_UseMove_Basic) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -48,7 +48,7 @@ EvtScript N(EVS_UseMove_ImplA) = { EndIf ExecWait(N(EVS_802A26B4)) Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) @@ -67,7 +67,7 @@ EvtScript N(EVS_UseMove_ImplA) = { End }; -EvtScript N(EVS_UseMove_ImplB) = { +EvtScript N(EVS_UseMove_Super) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -76,7 +76,7 @@ EvtScript N(EVS_UseMove_ImplB) = { EndIf ExecWait(N(EVS_802A26B4)) Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) @@ -95,7 +95,7 @@ EvtScript N(EVS_UseMove_ImplB) = { End }; -EvtScript N(EVS_UseMove_ImplC) = { +EvtScript N(EVS_UseMove_Ultra) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -104,7 +104,7 @@ EvtScript N(EVS_UseMove_ImplC) = { EndIf ExecWait(N(EVS_802A26B4)) Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) diff --git a/src/battle/move/jump/shrink_stomp.c b/src/battle/move/jump/shrink_stomp.c index ec53c4ff2f7..6f344df03d0 100644 --- a/src/battle/move/jump/shrink_stomp.c +++ b/src/battle/move/jump/shrink_stomp.c @@ -34,7 +34,7 @@ EvtScript N(EVS_UseMove_Basic) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) @@ -59,12 +59,12 @@ EvtScript N(EVS_UseMove_Basic) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(GetActionResult, LVarF) - Call(CloseActionCommandInfo) + Call(GetJumpActionQuality, LVarF) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 24, 3) + Call(action_command_jump_start, 24, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall) Call(PlayerBasicJumpToGoal, 24, PLAYER_BASIC_JUMP_3) @@ -85,7 +85,7 @@ EvtScript N(EVS_UseMove_Super) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_ACTOR_JUMPED_2) @@ -104,18 +104,18 @@ EvtScript N(EVS_UseMove_Super) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarF) + Call(GetJumpActionQuality, LVarF) ChildThread Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_JUMP_FINISH) Wait(5) Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 37, 3) + Call(action_command_jump_start, 37, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Sit, ANIM_Mario1_SpinJump) @@ -140,7 +140,7 @@ EvtScript N(EVS_UseMove_Ultra) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_ACTOR_JUMPED_3) @@ -159,18 +159,18 @@ EvtScript N(EVS_UseMove_Ultra) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarF) + Call(GetJumpActionQuality, LVarF) ChildThread Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_ULTRA_JUMP_FINISH) Wait(5) Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 25, 3) + Call(action_command_jump_start, 25, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Jump, ANIM_Mario1_SpinFall) diff --git a/src/battle/move/jump/sleep_stomp.c b/src/battle/move/jump/sleep_stomp.c index 4c79b3a801e..4b46a8497e3 100644 --- a/src/battle/move/jump/sleep_stomp.c +++ b/src/battle/move/jump/sleep_stomp.c @@ -34,7 +34,7 @@ EvtScript N(EVS_UseMove_Basic) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) @@ -59,12 +59,12 @@ EvtScript N(EVS_UseMove_Basic) = { Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(GetActionResult, LVarF) - Call(CloseActionCommandInfo) + Call(GetJumpActionQuality, LVarF) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 24, 3) + Call(action_command_jump_start, 24, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall) Call(PlayerBasicJumpToGoal, 24, PLAYER_BASIC_JUMP_3) @@ -85,7 +85,7 @@ EvtScript N(EVS_UseMove_Super) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) @@ -104,18 +104,18 @@ EvtScript N(EVS_UseMove_Super) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarF) + Call(GetJumpActionQuality, LVarF) ChildThread Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_JUMP_FINISH) Wait(5) Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 37, 3) + Call(action_command_jump_start, 37, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Sit, ANIM_Mario1_SpinJump) @@ -140,7 +140,7 @@ EvtScript N(EVS_UseMove_Ultra) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(FALSE) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) @@ -159,18 +159,18 @@ EvtScript N(EVS_UseMove_Ultra) = { CaseOrEq(HIT_RESULT_NICE_NO_DAMAGE) EndCaseGroup EndSwitch - Call(GetActionResult, LVarF) + Call(GetJumpActionQuality, LVarF) ChildThread Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_ULTRA_JUMP_FINISH) Wait(5) Call(SetGoalToTarget, ACTOR_PLAYER) Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH) EndChildThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 25, 3) + Call(action_command_jump_start, 25, AC_DIFFICULTY_3) Call(SetGoalToTarget, ACTOR_PLAYER) Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Jump, ANIM_Mario1_SpinFall) diff --git a/src/battle/move/jump/super_jump.c b/src/battle/move/jump/super_jump.c index e1817707dc8..7d288a2f1d3 100644 --- a/src/battle/move/jump/super_jump.c +++ b/src/battle/move/jump/super_jump.c @@ -6,9 +6,9 @@ #include "battle/common/move/JumpSupport.inc.c" -extern EvtScript N(EVS_UseMove_ImplA); -extern EvtScript N(EVS_UseMove_ImplB); -extern EvtScript N(EVS_UseMove_ImplC); +extern EvtScript N(EVS_UseMove_Basic); +extern EvtScript N(EVS_UseMove_Super); +extern EvtScript N(EVS_UseMove_Ultra); EvtScript N(EVS_UseMove) = { Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE) @@ -16,11 +16,11 @@ EvtScript N(EVS_UseMove) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar1) CaseEq(0) - ExecWait(N(EVS_UseMove_ImplA)) + ExecWait(N(EVS_UseMove_Basic)) CaseEq(1) - ExecWait(N(EVS_UseMove_ImplB)) + ExecWait(N(EVS_UseMove_Super)) CaseEq(2) - ExecWait(N(EVS_UseMove_ImplC)) + ExecWait(N(EVS_UseMove_Ultra)) EndSwitch Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE) Return @@ -41,7 +41,7 @@ EvtScript N(EVS_802A26B4) = { End }; -EvtScript N(EVS_UseMove_ImplA) = { +EvtScript N(EVS_UseMove_Basic) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -50,7 +50,7 @@ EvtScript N(EVS_UseMove_ImplA) = { EndIf ExecWait(N(EVS_802A26B4)) Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_1, SOUND_NONE) @@ -69,7 +69,7 @@ EvtScript N(EVS_UseMove_ImplA) = { End }; -EvtScript N(EVS_UseMove_ImplB) = { +EvtScript N(EVS_UseMove_Super) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -78,7 +78,7 @@ EvtScript N(EVS_UseMove_ImplB) = { EndIf ExecWait(N(EVS_802A26B4)) Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_2, SOUND_NONE) @@ -97,7 +97,7 @@ EvtScript N(EVS_UseMove_ImplB) = { End }; -EvtScript N(EVS_UseMove_ImplC) = { +EvtScript N(EVS_UseMove_Ultra) = { ExecWait(N(EVS_JumpSupport_ApproachAndJump)) Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0) IfEq(LVar0, HIT_RESULT_MISS) @@ -105,7 +105,7 @@ EvtScript N(EVS_UseMove_ImplC) = { Return EndIf Wait(1) - Call(GetPlayerActionSuccess, LVar0) + Call(GetPlayerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(SetActorSounds, ACTOR_PLAYER, ACTOR_SOUND_HURT, SOUND_ACTOR_JUMPED_3, SOUND_NONE) diff --git a/src/battle/partner/bombette.c b/src/battle/partner/bombette.c index 6752d4e62a6..0950d485743 100644 --- a/src/battle/partner/bombette.c +++ b/src/battle/partner/bombette.c @@ -351,7 +351,7 @@ EvtScript N(EVS_Idle) = { EvtScript N(EVS_HandleEvent) = { Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(StopSound, SOUND_LRAW_BOMBETTE_FUSE) Call(GetLastEvent, ACTOR_PARTNER, LVar0) Switch(LVar0) @@ -824,7 +824,7 @@ EvtScript N(EVS_Attack_BodySlam) = { EndLoop Call(MoveBattleCamOver, 65) IfEq(LF_MashStarted, 1) - Call(action_command_body_slam_start, 0, 92, 3, 0) + Call(action_command_body_slam_start, 0, 92, AC_DIFFICULTY_3, ACV_SLAM_BOMBETTE) Set(LF_MashEnded, 0) ExecGetTID(N(runToTarget), LVarA) Loop(35) @@ -875,7 +875,7 @@ EvtScript N(EVS_Attack_BodySlam) = { Call(CheckButtonDown, BUTTON_A, LVar0) IfNe(LVar0, FALSE) IfEq(LF_MashStarted, 0) - Call(action_command_body_slam_start, 0, 92, 3, 0) + Call(action_command_body_slam_start, 0, 92, AC_DIFFICULTY_3, ACV_SLAM_BOMBETTE) Set(LF_MashStarted, 1) EndIf EndIf @@ -897,7 +897,7 @@ EvtScript N(EVS_Attack_BodySlam) = { Call(CheckButtonDown, BUTTON_A, LVar0) IfNe(LVar0, FALSE) IfEq(LF_MashStarted, 0) - Call(action_command_body_slam_start, 0, 92, 3, 0) + Call(action_command_body_slam_start, 0, 92, AC_DIFFICULTY_3, ACV_SLAM_BOMBETTE) Set(LF_MashStarted, 1) EndIf EndIf @@ -932,7 +932,7 @@ EvtScript N(EVS_Attack_BodySlam) = { Label(10) Call(SetActorDispOffset, ACTOR_PARTNER, 0, 0, 0) Wait(2) - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(PartnerTestEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT | SUPPRESS_EVENT_ALT_SPIKY, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS) IfEq(LVar0, HIT_RESULT_MISS) Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_BOMBETTE_BODY_SLAM) @@ -982,7 +982,7 @@ EvtScript N(EVS_Attack_BodySlam) = { Set(LVarF, 5) EndSwitch Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_BOMBETTE_BODY_SLAM) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) IfGt(LVar0, 0) Call(SetGoalToTarget, ACTOR_PARTNER) Call(AddGoalPos, ACTOR_PARTNER, -10, 0, 0) @@ -1025,19 +1025,19 @@ EvtScript N(EVS_Attack_Bomb) = { CaseEq(MOVE_BOMB) Call(GetActorLevel, ACTOR_PARTNER, LVar0) Switch(LVar0) - CaseEq(0) + CaseEq(PARTNER_RANK_NORMAL) Call(SetupMashMeter, 5, 35, 60, 80, 99, 100) - CaseEq(1) + CaseEq(PARTNER_RANK_SUPER) Call(SetupMashMeter, 5, 35, 60, 80, 99, 100) - CaseEq(2) + CaseEq(PARTNER_RANK_ULTRA) Call(SetupMashMeter, 5, 35, 60, 80, 99, 100) EndSwitch CaseEq(MOVE_POWER_BOMB) Call(GetActorLevel, ACTOR_PARTNER, LVar0) Switch(LVar0) - CaseEq(1) + CaseEq(PARTNER_RANK_SUPER) Call(SetupMashMeter, 5, 35, 60, 80, 99, 100) - CaseEq(2) + CaseEq(PARTNER_RANK_ULTRA) Call(SetupMashMeter, 5, 35, 60, 80, 99, 100) EndSwitch CaseEq(MOVE_MEGA_BOMB) @@ -1064,11 +1064,11 @@ EvtScript N(EVS_Attack_Bomb) = { Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar2) CaseEq(MOVE_BOMB) - Call(action_command_bomb_start, 0, 57 * DT, 3, 0) + Call(action_command_bomb_start, 0, 57 * DT, AC_DIFFICULTY_3, ACV_BOMB_BASIC) CaseEq(MOVE_POWER_BOMB) - Call(action_command_bomb_start, 0, 73 * DT - 1, 3, 1) + Call(action_command_bomb_start, 0, 73 * DT - 1, AC_DIFFICULTY_3, ACV_BOMB_SUPER) CaseEq(MOVE_MEGA_BOMB) - Call(action_command_bomb_start, 0, 87 * DT, 3, 2) + Call(action_command_bomb_start, 0, 87 * DT, AC_DIFFICULTY_3, ACV_BOMB_ULTRA) EndSwitch Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_LRAW_BOMBETTE_FUSE) ChildThread @@ -1119,7 +1119,7 @@ EvtScript N(EVS_Attack_Bomb) = { Call(SetActorDispOffset, ACTOR_PARTNER, 0, 0, 0) Call(UseBattleCamPreset, BTL_CAM_VIEW_ENEMIES) Call(MoveBattleCamOver, 8) - Call(GetActionSuccessCopy, LVar0) + Call(GetMashActionQuality, LVar0) Call(N(GetBombDamage), LVar0) Set(LVarA, LVar0) Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2) @@ -1240,7 +1240,7 @@ EvtScript N(EVS_Attack_Bomb) = { IfEq(LVar0, 6) BreakSwitch EndIf - Call(GetActionSuccessCopy, LVar0) + Call(GetMashActionQuality, LVar0) Call(N(GetBombDamage), LVar0) Switch(LVar0) CaseGt(0) @@ -1257,7 +1257,7 @@ EvtScript N(EVS_Attack_Bomb) = { IfEq(LVar0, 6) Goto(6) EndIf - Call(GetActionSuccessCopy, LVar0) + Call(GetMashActionQuality, LVar0) Call(N(GetPowerBombDamage), LVar0) Switch(LVar0) CaseGt(0) @@ -1279,7 +1279,7 @@ EvtScript N(EVS_Attack_Bomb) = { IfEq(LVar0, 6) Goto(11) EndIf - Call(GetActionSuccessCopy, LVar0) + Call(GetMashActionQuality, LVar0) Call(N(GetMegaBombDamage), LVar0) Switch(LVar0) CaseGt(0) diff --git a/src/battle/partner/bow.c b/src/battle/partner/bow.c index 5b58333d4b5..6f907a4acc2 100644 --- a/src/battle/partner/bow.c +++ b/src/battle/partner/bow.c @@ -244,7 +244,7 @@ EvtScript N(EVS_Idle) = { EvtScript N(EVS_HandleEvent) = { Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(GetLastEvent, ACTOR_PARTNER, LVar0) Switch(LVar0) CaseOrEq(EVENT_HIT_COMBO) @@ -489,7 +489,7 @@ EvtScript N(smack) = { Wait(10) Set(LVar0, LVarB) Add(LVar0, -3) - Call(action_command_smack_start, 0, LVar0, 3, 0) + Call(action_command_smack_start, 0, LVar0, AC_DIFFICULTY_3, ACV_SMACK_HAND) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) EndThread Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_BOO_VANISH_A) @@ -532,80 +532,80 @@ EvtScript N(smack) = { Call(SetActorDispOffset, ACTOR_PARTNER, Float(-0.5), 0, 0) Wait(1) EndLoop - Call(GetPartnerActionSuccess, LVarB) - Call(func_80269600, LVarD) + Call(GetPartnerActionQuality, LVarB) + Call(GetActionResultTier, LVarD) Label(0) - Call(PartnerTestEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS) - IfEq(LVar0, HIT_RESULT_MISS) - Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_SlapOnce) - Call(CloseActionCommandInfo) - Set(LVar0, 0) - Loop(20) - Add(LVar0, -45) - Call(SetActorYaw, ACTOR_PARTNER, LVar0) - Wait(1) - EndLoop - Call(SetActorYaw, ACTOR_PARTNER, 0) - Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_Injured) - Call(AddActorDecoration, ACTOR_SELF, PRT_ZERO, 0, ACTOR_DECORATION_SEEING_STARS) - Wait(30) - Call(RemoveActorDecoration, ACTOR_SELF, PRT_ZERO, 0) - Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_Idle) - Wait(10) - ExecWait(N(EVS_ReturnHome_Miss)) - Return - EndIf - Add(LVarE, 1) - IfGt(LVarE, LVarD) - Goto(2) - EndIf - Call(SetActorScale, ACTOR_PARTNER, Float(1.4), Float(1.4), Float(1.0)) - IfEq(LFlag0, FALSE) - Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_SlapOnce) - Set(LFlag0, TRUE) - Call(SetDamageSource, DMG_SRC_NEXT_SLAP_LEFT) - Else - Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_SlapBack) - Set(LFlag0, FALSE) - Call(SetDamageSource, DMG_SRC_NEXT_SLAP_RIGHT) - EndIf - Wait(2) - Call(SetActorScale, ACTOR_PARTNER, Float(1.0), Float(1.0), Float(1.0)) - Thread - Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.5)) - Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.5)) - Call(ShakeCam, CAM_BATTLE, 0, 1, Float(0.5)) - Call(ShakeCam, CAM_BATTLE, 0, 1, Float(0.2)) - EndThread - IfEq(LVarE, 1) - Call(N(GetBowSize)) - Call(AddBattleCamDist, LVar0) - Call(MoveBattleCamOver, 5) - Else - Call(AddBattleCamDist, 25) - Call(MoveBattleCamOver, 5) - EndIf - Call(SetActorSounds, ACTOR_PARTNER, ACTOR_SOUND_HURT, SOUND_BOW_SMACK, 0) - IfEq(LVarE, 1) - IfGt(LVarB, 99) - Call(PartnerDamageEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT, 0, LVarC, BS_FLAGS1_NICE_HIT | BS_FLAGS1_INCLUDE_POWER_UPS) + Call(PartnerTestEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS) + IfEq(LVar0, HIT_RESULT_MISS) + Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_SlapOnce) + Call(InterruptActionCommand) + Set(LVar0, 0) + Loop(20) + Add(LVar0, -45) + Call(SetActorYaw, ACTOR_PARTNER, LVar0) + Wait(1) + EndLoop + Call(SetActorYaw, ACTOR_PARTNER, 0) + Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_Injured) + Call(AddActorDecoration, ACTOR_SELF, PRT_ZERO, 0, ACTOR_DECORATION_SEEING_STARS) + Wait(30) + Call(RemoveActorDecoration, ACTOR_SELF, PRT_ZERO, 0) + Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_Idle) + Wait(10) + ExecWait(N(EVS_ReturnHome_Miss)) + Return + EndIf + Add(LVarE, 1) + IfGt(LVarE, LVarD) + Goto(2) + EndIf + Call(SetActorScale, ACTOR_PARTNER, Float(1.4), Float(1.4), Float(1.0)) + IfEq(LFlag0, FALSE) + Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_SlapOnce) + Set(LFlag0, TRUE) + Call(SetDamageSource, DMG_SRC_NEXT_SLAP_LEFT) Else - Call(PartnerDamageEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT, 0, LVarC, BS_FLAGS1_INCLUDE_POWER_UPS) + Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_SlapBack) + Set(LFlag0, FALSE) + Call(SetDamageSource, DMG_SRC_NEXT_SLAP_RIGHT) EndIf - Goto(1) - Else - IfGt(LVarB, 99) - Call(PartnerDamageEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT, 0, LVarC, BS_FLAGS1_NICE_HIT) + Wait(2) + Call(SetActorScale, ACTOR_PARTNER, Float(1.0), Float(1.0), Float(1.0)) + Thread + Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.5)) + Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.5)) + Call(ShakeCam, CAM_BATTLE, 0, 1, Float(0.5)) + Call(ShakeCam, CAM_BATTLE, 0, 1, Float(0.2)) + EndThread + IfEq(LVarE, 1) + Call(N(GetBowSize)) + Call(AddBattleCamDist, LVar0) + Call(MoveBattleCamOver, 5) Else - Call(PartnerDamageEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT, 0, LVarC, 0) + Call(AddBattleCamDist, 25) + Call(MoveBattleCamOver, 5) EndIf - Goto(1) - EndIf - Label(1) - Wait(8) - Add(LVarF, 10) - Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_Idle) - Goto(0) + Call(SetActorSounds, ACTOR_PARTNER, ACTOR_SOUND_HURT, SOUND_BOW_SMACK, 0) + IfEq(LVarE, 1) + IfGt(LVarB, 99) + Call(PartnerDamageEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT, 0, LVarC, BS_FLAGS1_NICE_HIT | BS_FLAGS1_INCLUDE_POWER_UPS) + Else + Call(PartnerDamageEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT, 0, LVarC, BS_FLAGS1_INCLUDE_POWER_UPS) + EndIf + Goto(1) + Else + IfGt(LVarB, 99) + Call(PartnerDamageEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT, 0, LVarC, BS_FLAGS1_NICE_HIT) + Else + Call(PartnerDamageEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT, 0, LVarC, 0) + EndIf + Goto(1) + EndIf + Label(1) + Wait(8) + Add(LVarF, 10) + Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_Idle) + Goto(0) Label(2) IfEq(LVarE, 1) Call(N(GetBowSize)) @@ -628,7 +628,7 @@ EvtScript N(smack) = { Wait(2) Call(SetActorScale, ACTOR_PARTNER, Float(1.0), Float(1.0), Float(1.0)) Call(SetActorSounds, ACTOR_PARTNER, ACTOR_SOUND_HURT, SOUND_BOW_SMACK, 0) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(99) Call(PartnerDamageEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT, 0, LVarC, BS_FLAGS1_NICE_HIT | BS_FLAGS1_TRIGGER_EVENTS) @@ -795,8 +795,8 @@ EvtScript N(spook) = { Call(SetActorDispOffset, ACTOR_PARTNER, 0, 0, 0) EndThread Call(N(AverageSpookChance)) - Call(action_command_spook_start, 0, 87 * DT, 3, LVar0) - Call(GetActionQuality, LVar1) + Call(action_command_spook_start, 0, 87 * DT, AC_DIFFICULTY_3, LVar0) + Call(GetActionProgress, LVar1) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_Conceal) Set(LVar1, 0) Set(LVar2, 0) @@ -887,7 +887,7 @@ EvtScript N(spook) = { EndThread Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_BOW_SPOOK) SetF(LVar0, Float(1.0)) - Call(GetActionQuality, LVar2) + Call(GetActionProgress, LVar2) Switch(LVar2) CaseLe(20) SetF(LVar1, Float(0.3)) @@ -926,7 +926,7 @@ EvtScript N(spook) = { PlayEffect(EFFECT_ENERGY_IN_OUT, 6, LVar0, LVar1, LVar2, Float(1.0), 45, 0) Wait(15) Call(InitTargetIterator) - Call(GetActionQuality, LVarF) + Call(GetActionProgress, LVarF) Loop(0) Call(SetGoalToTarget, ACTOR_SELF) Call(PartnerTestEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT, 0, 2, BS_FLAGS1_INCLUDE_POWER_UPS) @@ -947,7 +947,7 @@ EvtScript N(spook) = { BreakLoop EndIf EndLoop - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(99) Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME) @@ -963,7 +963,7 @@ EvtScript N(spook) = { Wait(1) EndLoop EndThread - Call(GetActionQuality, LVar2) + Call(GetActionProgress, LVar2) Switch(LVar2) CaseLe(20) SetF(LVar1, Float(0.3)) @@ -1001,7 +1001,7 @@ EvtScript N(fanSmack) = { Wait(10) Set(LVar0, LVarB) Add(LVar0, -3) - Call(action_command_smack_start, 0, LVar0, 3, 1) + Call(action_command_smack_start, 0, LVar0, AC_DIFFICULTY_3, ACV_SMACK_FAN) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) EndThread Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_BOO_VANISH_A) @@ -1044,102 +1044,102 @@ EvtScript N(fanSmack) = { Call(SetActorDispOffset, ACTOR_PARTNER, Float(-0.5), 0, 0) Wait(1) EndLoop - Call(GetPartnerActionSuccess, LVarB) - Call(func_80269600, LVarD) + Call(GetPartnerActionQuality, LVarB) + Call(GetActionResultTier, LVarD) Label(0) - Call(PartnerTestEnemy, LVar0, DAMAGE_TYPE_NO_CONTACT, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT | SUPPRESS_EVENT_ALT_SPIKY, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS) - IfEq(LVar0, HIT_RESULT_MISS) - Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_FanSmackOnce) - Call(CloseActionCommandInfo) - Set(LVar0, 0) - Loop(15) - Add(LVar0, -45) - Call(SetActorYaw, ACTOR_PARTNER, LVar0) - Wait(1) - EndLoop - Loop(15) - Add(LVar0, -90) - Call(SetActorYaw, ACTOR_PARTNER, LVar0) - Wait(1) - EndLoop - Call(SetActorYaw, ACTOR_PARTNER, 0) - Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_Injured) - Call(AddActorDecoration, ACTOR_SELF, PRT_ZERO, 0, ACTOR_DECORATION_SEEING_STARS) - Wait(40) - Call(RemoveActorDecoration, ACTOR_SELF, PRT_ZERO, 0) - Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_Idle) - Wait(10) - ExecWait(N(EVS_ReturnHome_Miss)) - Return - EndIf - Add(LVarE, 1) - IfGt(LVarE, LVarD) - Goto(2) - EndIf - Call(SetActorScale, ACTOR_PARTNER, Float(1.4), Float(1.4), Float(1.0)) - IfEq(LFlag0, FALSE) - Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_FanSmackOnce) - Set(LFlag0, TRUE) - Call(SetDamageSource, DMG_SRC_NEXT_FAN_SMACK_LEFT) - Else - Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_FanSmackBack) - Set(LFlag0, FALSE) - Call(SetDamageSource, DMG_SRC_NEXT_FAN_SMACK_RIGHT) - EndIf - Wait(2) - Call(SetActorScale, ACTOR_PARTNER, Float(1.0), Float(1.0), Float(1.0)) - Thread - Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.5)) - Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.5)) - Call(ShakeCam, CAM_BATTLE, 0, 1, Float(0.5)) - Call(ShakeCam, CAM_BATTLE, 0, 1, Float(0.2)) - EndThread - IfEq(LVarE, 1) - Call(N(GetBowSize)) - Call(AddBattleCamDist, LVar0) - Call(MoveBattleCamOver, 5) - Else - Call(AddBattleCamDist, 25) - Call(MoveBattleCamOver, 5) - EndIf - Call(GetGoalPos, ACTOR_PARTNER, LVar0, LVar1, LVar2) - PlayEffect(EFFECT_CONFETTI, 5, LVar0, LVar1, LVar2, Float(1.0), 20, 0) - Call(SetActorSounds, ACTOR_PARTNER, ACTOR_SOUND_HURT, SOUND_BOW_FAN_SMACK, 0) - IfEq(LVarE, 1) - IfGt(LVarB, 99) - Call(PartnerDamageEnemy, LVar0, DAMAGE_TYPE_NO_CONTACT, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT | SUPPRESS_EVENT_ALT_SPIKY, 0, LVarC, BS_FLAGS1_NICE_HIT | BS_FLAGS1_INCLUDE_POWER_UPS) + Call(PartnerTestEnemy, LVar0, DAMAGE_TYPE_NO_CONTACT, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT | SUPPRESS_EVENT_ALT_SPIKY, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS) + IfEq(LVar0, HIT_RESULT_MISS) + Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_FanSmackOnce) + Call(InterruptActionCommand) + Set(LVar0, 0) + Loop(15) + Add(LVar0, -45) + Call(SetActorYaw, ACTOR_PARTNER, LVar0) + Wait(1) + EndLoop + Loop(15) + Add(LVar0, -90) + Call(SetActorYaw, ACTOR_PARTNER, LVar0) + Wait(1) + EndLoop + Call(SetActorYaw, ACTOR_PARTNER, 0) + Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_Injured) + Call(AddActorDecoration, ACTOR_SELF, PRT_ZERO, 0, ACTOR_DECORATION_SEEING_STARS) + Wait(40) + Call(RemoveActorDecoration, ACTOR_SELF, PRT_ZERO, 0) + Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_Idle) + Wait(10) + ExecWait(N(EVS_ReturnHome_Miss)) + Return + EndIf + Add(LVarE, 1) + IfGt(LVarE, LVarD) + Goto(2) + EndIf + Call(SetActorScale, ACTOR_PARTNER, Float(1.4), Float(1.4), Float(1.0)) + IfEq(LFlag0, FALSE) + Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_FanSmackOnce) + Set(LFlag0, TRUE) + Call(SetDamageSource, DMG_SRC_NEXT_FAN_SMACK_LEFT) Else - Call(PartnerDamageEnemy, LVar0, DAMAGE_TYPE_NO_CONTACT, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT | SUPPRESS_EVENT_ALT_SPIKY, 0, LVarC, BS_FLAGS1_INCLUDE_POWER_UPS) + Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_FanSmackBack) + Set(LFlag0, FALSE) + Call(SetDamageSource, DMG_SRC_NEXT_FAN_SMACK_RIGHT) EndIf - Goto(1) - Else - IfGt(LVarB, 99) - Call(PartnerDamageEnemy, LVar0, DAMAGE_TYPE_NO_CONTACT, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT | SUPPRESS_EVENT_ALT_SPIKY, 0, LVarC, BS_FLAGS1_NICE_HIT) + Wait(2) + Call(SetActorScale, ACTOR_PARTNER, Float(1.0), Float(1.0), Float(1.0)) + Thread + Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.5)) + Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.5)) + Call(ShakeCam, CAM_BATTLE, 0, 1, Float(0.5)) + Call(ShakeCam, CAM_BATTLE, 0, 1, Float(0.2)) + EndThread + IfEq(LVarE, 1) + Call(N(GetBowSize)) + Call(AddBattleCamDist, LVar0) + Call(MoveBattleCamOver, 5) Else - Call(PartnerDamageEnemy, LVar0, DAMAGE_TYPE_NO_CONTACT, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT | SUPPRESS_EVENT_ALT_SPIKY, 0, LVarC, 0) + Call(AddBattleCamDist, 25) + Call(MoveBattleCamOver, 5) EndIf - Goto(1) - EndIf - Label(1) - IfEq(LVarE, 1) - Set(LVar0, 0) - Loop(8) - Add(LVar0, 144) - Call(SetActorYaw, ACTOR_PARTNER, LVar0) - Wait(1) - EndLoop - Else - Set(LVar0, 0) - Loop(8) - Sub(LVar0, 144) - Call(SetActorYaw, ACTOR_PARTNER, LVar0) - Wait(1) - EndLoop - EndIf - Call(SetActorYaw, ACTOR_PARTNER, 0) - Add(LVarF, 10) - Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_Idle) - Goto(0) + Call(GetGoalPos, ACTOR_PARTNER, LVar0, LVar1, LVar2) + PlayEffect(EFFECT_CONFETTI, 5, LVar0, LVar1, LVar2, Float(1.0), 20, 0) + Call(SetActorSounds, ACTOR_PARTNER, ACTOR_SOUND_HURT, SOUND_BOW_FAN_SMACK, 0) + IfEq(LVarE, 1) + IfGt(LVarB, 99) + Call(PartnerDamageEnemy, LVar0, DAMAGE_TYPE_NO_CONTACT, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT | SUPPRESS_EVENT_ALT_SPIKY, 0, LVarC, BS_FLAGS1_NICE_HIT | BS_FLAGS1_INCLUDE_POWER_UPS) + Else + Call(PartnerDamageEnemy, LVar0, DAMAGE_TYPE_NO_CONTACT, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT | SUPPRESS_EVENT_ALT_SPIKY, 0, LVarC, BS_FLAGS1_INCLUDE_POWER_UPS) + EndIf + Goto(1) + Else + IfGt(LVarB, 99) + Call(PartnerDamageEnemy, LVar0, DAMAGE_TYPE_NO_CONTACT, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT | SUPPRESS_EVENT_ALT_SPIKY, 0, LVarC, BS_FLAGS1_NICE_HIT) + Else + Call(PartnerDamageEnemy, LVar0, DAMAGE_TYPE_NO_CONTACT, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT | SUPPRESS_EVENT_ALT_SPIKY, 0, LVarC, 0) + EndIf + Goto(1) + EndIf + Label(1) + IfEq(LVarE, 1) + Set(LVar0, 0) + Loop(8) + Add(LVar0, 144) + Call(SetActorYaw, ACTOR_PARTNER, LVar0) + Wait(1) + EndLoop + Else + Set(LVar0, 0) + Loop(8) + Sub(LVar0, 144) + Call(SetActorYaw, ACTOR_PARTNER, LVar0) + Wait(1) + EndLoop + EndIf + Call(SetActorYaw, ACTOR_PARTNER, 0) + Add(LVarF, 10) + Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleBow_Idle) + Goto(0) Label(2) Thread Call(ShakeCam, CAM_BATTLE, 0, 2, Float(0.5)) @@ -1168,7 +1168,7 @@ EvtScript N(fanSmack) = { Wait(2) Call(SetActorScale, ACTOR_PARTNER, Float(1.0), Float(1.0), Float(1.0)) Call(SetActorSounds, ACTOR_PARTNER, ACTOR_SOUND_HURT, SOUND_BOW_FAN_SMACK, 0) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(99) Call(PartnerDamageEnemy, LVar0, DAMAGE_TYPE_NO_CONTACT, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT | SUPPRESS_EVENT_ALT_SPIKY, 0, LVarC, BS_FLAGS1_NICE_HIT | BS_FLAGS1_TRIGGER_EVENTS) diff --git a/src/battle/partner/goombario.c b/src/battle/partner/goombario.c index 942f2957b55..75887f1847a 100644 --- a/src/battle/partner/goombario.c +++ b/src/battle/partner/goombario.c @@ -46,11 +46,11 @@ API_CALLABLE(N(GetReturnMoveTime)) { script->varTable[0] = (dist3D(posX, posY, posZ, goalX, goalY, goalZ) * 15.0f) / 100.0f; - if (script->varTable[0] >= 21) { + if (script->varTable[0] > 20) { script->varTable[0] = 20; } - if (battleStatus->actionCommandMode != ACTION_COMMAND_MODE_NOT_LEARNED) { + if (battleStatus->actionCommandMode != AC_MODE_NOT_LEARNED) { if (script->varTable[0] < 10) { script->varTable[0] = 10; } @@ -212,7 +212,7 @@ API_CALLABLE(N(JumpOnTarget)) { } break; case 2: - if (battleStatus->actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { + if (battleStatus->actionCommandMode == AC_MODE_NOT_LEARNED) { return ApiStatus_DONE2; } state->moveTime = 1; @@ -574,7 +574,7 @@ EvtScript N(EVS_Idle) = { EvtScript N(EVS_HandleEvent) = { Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(GetLastEvent, ACTOR_PARTNER, LVar0) Switch(LVar0) CaseOrEq(EVENT_HIT_COMBO) @@ -936,7 +936,7 @@ EvtScript N(EVS_Attack_Headbonk1) = { Call(SetActorDispOffset, ACTOR_PARTNER, 0, 19, 0) Wait(1) Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR) - Call(action_command_jump_start, LVarA, 3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR) Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleGoombario_Headbonk) Call(SetActorDispOffset, ACTOR_PARTNER, 0, 9, 0) @@ -964,7 +964,7 @@ EvtScript N(EVS_Attack_Headbonk1) = { Call(SetActorScale, ACTOR_PARTNER, Float(1.0), Float(1.0), Float(1.0)) EndChildThread Wait(1) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(N(GetChargeAmount)) @@ -992,12 +992,12 @@ EvtScript N(EVS_Attack_Headbonk1) = { Call(SetGoalToTarget, ACTOR_PARTNER) Call(UseBattleCamPreset, BTL_CAM_GOOMBARIO_BONK_FOLLOWUP_2) EndThread - Call(GetActionResult, LVarF) - Call(CloseActionCommandInfo) + Call(GetJumpActionQuality, LVarF) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 24, 3) + Call(action_command_jump_start, 24, AC_DIFFICULTY_3) Set(LVarA, 24) Thread Wait(4) @@ -1041,7 +1041,7 @@ EvtScript N(EVS_Attack_Headbonk2) = { Call(SetActorDispOffset, ACTOR_PARTNER, 0, 19, 0) Wait(1) Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR) - Call(action_command_jump_start, LVarA, 3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR) Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleGoombario_Headbonk) Call(SetActorDispOffset, ACTOR_PARTNER, 0, 9, 0) @@ -1069,7 +1069,7 @@ EvtScript N(EVS_Attack_Headbonk2) = { Call(SetActorScale, ACTOR_PARTNER, Float(1.0), Float(1.0), Float(1.0)) EndChildThread Wait(1) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(N(GetChargeAmount)) @@ -1097,12 +1097,12 @@ EvtScript N(EVS_Attack_Headbonk2) = { Call(SetGoalToTarget, ACTOR_PARTNER) Call(UseBattleCamPreset, BTL_CAM_GOOMBARIO_BONK_FOLLOWUP_2) EndThread - Call(GetActionResult, LVarF) - Call(CloseActionCommandInfo) + Call(GetJumpActionQuality, LVarF) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 24, 3) + Call(action_command_jump_start, 24, AC_DIFFICULTY_3) Set(LVarA, 24) Thread Wait(4) @@ -1148,7 +1148,7 @@ EvtScript N(EVS_Attack_Headbonk3) = { Call(SetActorDispOffset, ACTOR_PARTNER, 0, 19, 0) Wait(1) Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR) - Call(action_command_jump_start, LVarA, 3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR) Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleGoombario_Headbonk) Call(SetActorDispOffset, ACTOR_PARTNER, 0, 9, 0) @@ -1176,7 +1176,7 @@ EvtScript N(EVS_Attack_Headbonk3) = { Call(SetActorScale, ACTOR_PARTNER, Float(1.0), Float(1.0), Float(1.0)) EndChildThread Wait(1) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(N(GetChargeAmount)) @@ -1204,12 +1204,12 @@ EvtScript N(EVS_Attack_Headbonk3) = { Call(SetGoalToTarget, ACTOR_PARTNER) Call(UseBattleCamPreset, BTL_CAM_GOOMBARIO_BONK_FOLLOWUP_2) EndThread - Call(GetActionResult, LVarF) - Call(CloseActionCommandInfo) + Call(GetJumpActionQuality, LVarF) + Call(InterruptActionCommand) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Call(ShowActionHud, FALSE) - Call(action_command_jump_start, 24, 3) + Call(action_command_jump_start, 24, AC_DIFFICULTY_3) Set(LVarA, 24) Thread Wait(4) @@ -1268,7 +1268,7 @@ EvtScript N(EVS_Move_Multibonk) = { Call(SetActorDispOffset, ACTOR_PARTNER, 0, 19, 0) Wait(1) Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR) Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BattleGoombario_Headbonk) Call(SetActorDispOffset, ACTOR_PARTNER, 0, 9, 0) @@ -1296,7 +1296,7 @@ EvtScript N(EVS_Move_Multibonk) = { Call(SetActorScale, ACTOR_PARTNER, Float(1.0), Float(1.0), Float(1.0)) EndChildThread Wait(1) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(N(GetChargeAmount)) @@ -1324,7 +1324,7 @@ EvtScript N(EVS_Move_Multibonk) = { Call(SetGoalToTarget, ACTOR_PARTNER) Call(UseBattleCamPreset, BTL_CAM_GOOMBARIO_BONK_FOLLOWUP_2) EndThread - Call(GetActionResult, LVarF) + Call(GetJumpActionQuality, LVarF) Set(LVarD, 0) Set(LVarF, 0) Set(LFlag0, FALSE) @@ -1335,22 +1335,22 @@ EvtScript N(EVS_Move_Multibonk) = { Call(SetGoalToTarget, ACTOR_PARTNER) Call(UseBattleCamPreset, BTL_CAM_GOOMBARIO_BONK_FOLLOWUP_2) EndThread - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(SetActionDifficultyTable, Ref(N(actionCommandTable))) Call(LoadActionCommand, ACTION_COMMAND_JUMP) Call(action_command_jump_init) Set(LVarA, 24) Switch(LVarF) CaseEq(0) - Call(action_command_jump_start, LVarA, 1) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_1) CaseEq(1) - Call(action_command_jump_start, LVarA, 2) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_2) CaseEq(2) - Call(action_command_jump_start, LVarA, 3) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_3) CaseEq(3) - Call(action_command_jump_start, LVarA, 4) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_4) CaseDefault - Call(action_command_jump_start, LVarA, 5) + Call(action_command_jump_start, LVarA, AC_DIFFICULTY_5) EndSwitch Thread Wait(4) @@ -1389,7 +1389,7 @@ EvtScript N(EVS_Move_Multibonk) = { Call(SetActorScale, ACTOR_PARTNER, Float(1.0), Float(1.0), Float(1.0)) EndChildThread Wait(1) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(0) IfEq(LFlag0, FALSE) diff --git a/src/battle/partner/goompa.c b/src/battle/partner/goompa.c index 37667caa082..57f79ef75ad 100644 --- a/src/battle/partner/goompa.c +++ b/src/battle/partner/goompa.c @@ -102,7 +102,7 @@ EvtScript N(EVS_Idle) = { EvtScript N(EVS_HandleEvent) = { Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(GetLastEvent, ACTOR_PARTNER, LVar0) Switch(LVar0) CaseOrEq(EVENT_HIT_COMBO) diff --git a/src/battle/partner/kooper.c b/src/battle/partner/kooper.c index 9ba25177cef..8d049a9f9bc 100644 --- a/src/battle/partner/kooper.c +++ b/src/battle/partner/kooper.c @@ -286,7 +286,7 @@ EvtScript N(EVS_Idle) = { EvtScript N(EVS_HandleEvent) = { Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(GetLastEvent, ACTOR_PARTNER, LVar0) Switch(LVar0) CaseOrEq(EVENT_HIT_COMBO) @@ -567,8 +567,8 @@ EvtScript N(shellToss) = { BreakLoop EndIf EndLoop - Call(action_command_hammer_start, 0, 50 * DT - 3, 3) - Call(SetActionQuality, 0) + Call(action_command_hammer_start, 0, 50 * DT - 3, AC_DIFFICULTY_3) + Call(SetActionProgress, 0) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleKooper_ShellSpinSlowest) Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_KOOPER_SHELL_SPINUP) Call(UseBattleCamPreset, BTL_CAM_PARTNER_CLOSE_UP) @@ -599,7 +599,7 @@ EvtScript N(shellToss) = { PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar4, LVar5, LVar6, 32, 4, 0, 10, 0) EndSwitch Add(LVar9, 1) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) IfNe(LVar0, 0) IfNe(LVar1, TRUE) Set(LVar1, 1) @@ -628,7 +628,7 @@ EvtScript N(shellToss) = { Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleKooper_ShellSpinFastest) EndSwitch Add(LVar9, 1) - Call(GetActionSuccess, LVar0) + Call(GetSmashActionQuality, LVar0) IfEq(LVar0, 0) Goto(0) EndIf @@ -680,7 +680,7 @@ EvtScript N(shellToss) = { Return EndIf Call(RemoveActorDecoration, ACTOR_SELF, PRT_ZERO, 0) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(PartnerDamageEnemy, LVar0, 0, SUPPRESS_EVENTS_KOOPER_DAMAGE, 0, LVarF, BS_FLAGS1_NICE_HIT | BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_INCLUDE_POWER_UPS) @@ -737,8 +737,8 @@ EvtScript N(powerShell) = { EndIf EndLoop Call(UseBattleCamPreset, BTL_CAM_PARTNER_CLOSE_UP) - Call(action_command_hammer_start, 0, 47, 3) - Call(SetActionQuality, 0) + Call(action_command_hammer_start, 0, 47, AC_DIFFICULTY_3) + Call(SetActionProgress, 0) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleKooper_ShellSpinSlowest) Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_KOOPER_SHELL_SPINUP) Set(LVar9, 0) @@ -768,7 +768,7 @@ EvtScript N(powerShell) = { PlayEffect(EFFECT_SMOKE_IMPACT, 1, LVar4, LVar5, LVar6, 32, 4, 0, 10, 0) EndSwitch Add(LVar9, 1) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) IfNe(LVar0, 0) IfNe(LVar1, TRUE) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleKooper_ShellSpinSlowest) @@ -798,7 +798,7 @@ EvtScript N(powerShell) = { Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleKooper_ShellSpinFastest) EndSwitch Add(LVar9, 1) - Call(GetActionSuccess, LVar0) + Call(GetSmashActionQuality, LVar0) IfEq(LVar0, 0) Goto(0) EndIf @@ -833,7 +833,7 @@ EvtScript N(powerShell) = { Goto(12) EndIf IfEq(LFlag0, FALSE) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME) @@ -842,7 +842,7 @@ EvtScript N(powerShell) = { EndSwitch EndIf Set(LFlag0, TRUE) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(PartnerDamageEnemy, LVar0, DAMAGE_TYPE_MULTIPLE_POPUPS, SUPPRESS_EVENTS_KOOPER_DAMAGE, 0, LVarF, BS_FLAGS1_NICE_HIT | BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_INCLUDE_POWER_UPS) @@ -856,7 +856,7 @@ EvtScript N(powerShell) = { Goto(10) EndIf IfEq(LFlag0, FALSE) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME) @@ -870,7 +870,7 @@ EvtScript N(powerShell) = { Wait(1) Goto(11) EndIf - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(0) ExecWait(N(EVS_ReturnHome_Success)) @@ -902,9 +902,9 @@ EvtScript N(dizzyShell) = { Set(LVarD, 75 * DT) Set(LVarA, LVarD) Add(LVarA, -3) - Call(battle_partner_kooper_AverageTargetDizzyChance) - Call(action_command_dizzy_shell_start, 0, LVarA, 3, LVar0) - Call(SetActionQuality, 0) + Call(N(AverageTargetDizzyChance)) + Call(action_command_dizzy_shell_start, 0, LVarA, AC_DIFFICULTY_3, LVar0) + Call(SetActionProgress, 0) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleKooper_ShellSpinSlowest) Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_KOOPER_SHELL_SPINUP) Set(LVar9, 0) @@ -915,7 +915,7 @@ EvtScript N(dizzyShell) = { Set(LVar9, 1) Loop(LVarD) Wait(1) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) Switch(LVar0) CaseLt(20 * DT) Set(LVarA, Float(10.0)) @@ -988,7 +988,7 @@ EvtScript N(dizzyShell) = { Goto(12) EndIf IfEq(LFlag0, FALSE) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(99) Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME) @@ -997,8 +997,8 @@ EvtScript N(dizzyShell) = { EndSwitch EndIf Set(LFlag0, TRUE) - Call(GetActionQuality, LVarF) - Call(GetPartnerActionSuccess, LVar0) + Call(GetActionProgress, LVarF) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(0) IfEq(LVar9, 1) @@ -1025,7 +1025,7 @@ EvtScript N(dizzyShell) = { Goto(10) EndIf IfEq(LFlag0, FALSE) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(99) Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME) @@ -1074,7 +1074,7 @@ EvtScript N(fireShell) = { Set(LVarD, 75 * DT) Set(LVarC, LVarD) Add(LVarC, -3) - Call(action_command_fire_shell_start, 0, LVarC, 3) + Call(action_command_fire_shell_start, 0, LVarC, AC_DIFFICULTY_3) Call(SetActorVar, ACTOR_SELF, AVAR_Unk_1, 0) Set(LVarA, Float(8.0)) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleKooper_ShellSpinSlowest) @@ -1093,7 +1093,7 @@ EvtScript N(fireShell) = { Set(LVar9, 30) Loop(LVarD) Wait(1) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) Switch(LVar0) CaseGe(80 * DT) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleKooper_ShellSpinFastest) @@ -1234,7 +1234,7 @@ EvtScript N(fireShell) = { Goto(12) EndIf IfEq(LFlag0, FALSE) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(99) Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME) @@ -1243,8 +1243,8 @@ EvtScript N(fireShell) = { EndSwitch EndIf Set(LFlag0, TRUE) - Call(GetActionQuality, LVar0) - Call(GetPartnerActionSuccess, LVar0) + Call(GetActionProgress, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(99) Call(PartnerDamageEnemy, LVar0, DAMAGE_TYPE_FIRE | DAMAGE_TYPE_MULTIPLE_POPUPS, SUPPRESS_EVENTS_KOOPER_DAMAGE, 0, LVarF, BS_FLAGS1_NICE_HIT | BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_INCLUDE_POWER_UPS) @@ -1258,7 +1258,7 @@ EvtScript N(fireShell) = { Goto(10) EndIf IfEq(LFlag0, FALSE) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(99) Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME) diff --git a/src/battle/partner/lakilester.c b/src/battle/partner/lakilester.c index b760f50d9dd..c453344e03c 100644 --- a/src/battle/partner/lakilester.c +++ b/src/battle/partner/lakilester.c @@ -4,7 +4,7 @@ #include "script_api/battle.h" #include "sprite/npc/BattleLakilester.h" #include "battle/action_cmd/spiny_surge.h" -#include "battle/action_cmd/water_block.h" +#include "battle/action_cmd/three_chances.h" #include "battle/action_cmd/hurricane.h" #include "hud_element.h" #include "sprite/player.h" @@ -33,8 +33,8 @@ extern HudScript HES_StickTapRight; static s32 sSavedHurricaneIntensity; static s32 sBreathSizeIncrease; static s32 sMaxPower; -static s32 HID_AimReticle; -static s32 HID_AimTarget; +static HudElemID HID_AimReticle; +static HudElemID HID_AimTarget; static s32 TargetMarkRotation; static s32 D_8023D294; static s32 AimingTime; @@ -46,14 +46,14 @@ static f32 D_8023D2AC; static f32 D_8023D2B0; static f32 AimMoveAngle; static s32 hudAim[1]; -static s32 HID_AnalogStick; +static HudElemID HID_AnalogStick; static s32 HudStickPosX; static s32 HudStickPosY; static b32 SpinyFlipTargetingDone; static s32 D_8023D2CC; -static s32 sTargetStates[24]; -static s32 sNumEnemiesBeingBlown; -static s32 sIsHurricaneActive; +static s32 EnemyHurricaneChances[MAX_ENEMY_ACTORS]; +static s32 NumEnemiesBeingBlown; +static s32 IsHurricaneActive; static s32 D_8023D338; enum N(ActorPartIDs) { @@ -193,7 +193,7 @@ EvtScript N(EVS_Idle) = { EvtScript N(EVS_HandleEvent) = { Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(GetLastEvent, ACTOR_PARTNER, LVar0) Switch(LVar0) CaseOrEq(EVENT_HIT_COMBO) @@ -374,7 +374,7 @@ API_CALLABLE(N(SpinyFlipUpdatePopup)) { } if (!SpinyFlipTargetingDone) { - btl_set_popup_duration(99); + btl_set_popup_duration(POPUP_MSG_ON); return ApiStatus_BLOCK; } else { return ApiStatus_DONE2; @@ -392,7 +392,7 @@ API_CALLABLE(N(SpinyFlipActionCommand)) { f32 speed; f32 stickAngle; s32 stickMagnitude; - s32 id; + HudElemID hid; s32 i; f32 temp_f0_5; @@ -406,7 +406,7 @@ API_CALLABLE(N(SpinyFlipActionCommand)) { s32 (*temp_a0)[0]; s32 temp_a0_2; s32 temp_f10; - s32 idAim; + HudElemID hidAim; s32 temp_v1_2; s32* var_s0; @@ -432,12 +432,12 @@ API_CALLABLE(N(SpinyFlipActionCommand)) { hud_element_create_transform_A(HID_AimTarget); HudStickPosX = -48; HudStickPosY = 70; - HID_AnalogStick = id = hud_element_create(&HES_StickNeutral); - hud_element_set_render_pos(id, HudStickPosX, HudStickPosY); - hud_element_set_render_depth(id, 0); + HID_AnalogStick = hid = hud_element_create(&HES_StickNeutral); + hud_element_set_render_pos(hid, HudStickPosX, HudStickPosY); + hud_element_set_render_depth(hid, 0); for (i = 0; i < ARRAY_COUNT(N(AimDotHudScripts)); i++) { - hudAim[i] = idAim = hud_element_create(N(AimDotHudScripts)[i]); - hud_element_set_render_depth(idAim, 10); + hudAim[i] = hidAim = hud_element_create(N(AimDotHudScripts)[i]); + hud_element_set_render_depth(hidAim, 10); } partnerState->curPos.x = partner->curPos.x + 33.0f; partnerState->curPos.y = partner->curPos.y + 34.0f; @@ -570,10 +570,10 @@ API_CALLABLE(N(SpinyFlipActionCommand)) { hud_element_free(HID_AimReticle); hud_element_free(HID_AnalogStick); for (i = 0; i < ARRAY_COUNT(N(AimDotHudScripts)); i++) { - id = hudAim[i]; - hud_element_free(id); + hid = hudAim[i]; + hud_element_free(hid); } - btl_set_popup_duration(0); + btl_set_popup_duration(POPUP_MSG_OFF); sfx_stop_sound(SOUND_AIM_SPINY_FLIP); return ApiStatus_DONE2; } @@ -581,9 +581,9 @@ API_CALLABLE(N(SpinyFlipActionCommand)) { get_screen_coords(gCurrentCameraID, partnerState->goalPos.x, partnerState->goalPos.y, partnerState->goalPos.z, &screenX, &screenY, &screenZ); - id = HID_AimTarget; - hud_element_set_render_pos(id, screenX, screenY); - hud_element_set_transform_rotation(id, 0.0f, 0.0f, TargetMarkRotation); + hid = HID_AimTarget; + hud_element_set_render_pos(hid, screenX, screenY); + hud_element_set_transform_rotation(hid, 0.0f, 0.0f, TargetMarkRotation); TargetMarkRotation -= 10; TargetMarkRotation = clamp_angle(TargetMarkRotation); get_screen_coords(gCurrentCameraID, @@ -612,13 +612,13 @@ API_CALLABLE(N(SpinyFlipActionCommand)) { playerState->curPos.z = partnerState->curPos.z; for (i = 0; i < ARRAY_COUNT(N(AimDotHudScripts)); i++) { get_screen_coords(gCurrentCameraID, playerState->curPos.x, playerState->curPos.y, playerState->curPos.z, &screenX, &screenY, &screenZ); - id = hudAim[i]; - hud_element_set_render_pos(id, screenX, screenY); + hid = hudAim[i]; + hud_element_set_render_pos(hid, screenX, screenY); } break; } - btl_set_popup_duration(99); + btl_set_popup_duration(POPUP_MSG_ON); return ApiStatus_BLOCK; } @@ -744,11 +744,11 @@ API_CALLABLE(N(InitHurricane)) { s32 avgHurricaneChance; s32 i; - sNumEnemiesBeingBlown = 0; - sIsHurricaneActive = FALSE; + NumEnemiesBeingBlown = 0; + IsHurricaneActive = FALSE; for (i = 0; i < partner->targetListLength; i++) { - sTargetStates[i] = 0; + EnemyHurricaneChances[i] = 0; } totalChance = 0; @@ -780,7 +780,7 @@ API_CALLABLE(N(InitHurricane)) { } affectedTargets++; } - sTargetStates[targetIdx] = hurricaneChance; + EnemyHurricaneChances[targetIdx] = hurricaneChance; totalChance += hurricaneChance; } @@ -797,9 +797,9 @@ API_CALLABLE(N(InitHurricane)) { actor = get_actor(target->actorID); part = get_actor_part(actor, target->partID); if (actor->transparentStatus == STATUS_KEY_TRANSPARENT || (part->eventFlags & ACTOR_EVENT_FLAG_ILLUSORY)) { - sTargetStates[targetIdx] = -1; - } else if (sTargetStates[targetIdx] != 0) { - sTargetStates[targetIdx] = avgHurricaneChance; + EnemyHurricaneChances[targetIdx] = -1; + } else if (EnemyHurricaneChances[targetIdx] != 0) { + EnemyHurricaneChances[targetIdx] = avgHurricaneChance; } } return ApiStatus_DONE2; @@ -809,7 +809,7 @@ API_CALLABLE(N(CanTargetBeBlown)) { BattleStatus* battleStatus = &gBattleStatus; Actor* partner = battleStatus->partnerActor; s32 targetIdx = partner->targetIndexList[partner->selectedTargetIndex]; - s32* hurricaneChance = &sTargetStates[targetIdx]; + s32* hurricaneChance = &EnemyHurricaneChances[targetIdx]; SelectableTarget* target = &partner->targetData[targetIdx]; script->varTable[0] = *hurricaneChance; @@ -823,7 +823,7 @@ API_CALLABLE(N(CanTargetBeBlown)) { } get_actor(target->actorID); - if (rand_int(99) < battleStatus->actionSuccess) { + if (rand_int(99) < battleStatus->actionQuality) { *hurricaneChance = -1; script->varTable[0] = target->actorID; } else { @@ -999,7 +999,7 @@ EvtScript N(EVS_Move_SpinySurge) = { EndSwitch Set(LVarB, LVarA) Add(LVarB, -3) - Call(action_command_spiny_surge_start, 0, LVarB, 3) + Call(action_command_spiny_surge_start, 0, LVarB, AC_DIFFICULTY_3) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) Call(InitTargetIterator) Call(SetActorVar, ACTOR_PARTNER, AVAR_Unk_0, 0) @@ -1007,20 +1007,20 @@ EvtScript N(EVS_Move_SpinySurge) = { Set(LFlag2, FALSE) Set(LFlag3, FALSE) Loop(LVarA) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) IfEq(LVar9, 2) - Set(LVar0, 3) + Set(LVar0, SPINY_SURGE_IGNORE) EndIf Switch(LVar0) - CaseEq(-1) + CaseEq(SPINY_SURGE_RESET) Set(LVar9, 0) - Call(SetPartFlagBits, ACTOR_PARTNER, 2, ACTOR_PART_FLAG_INVISIBLE, TRUE) + Call(SetPartFlagBits, ACTOR_PARTNER, PRT_2, ACTOR_PART_FLAG_INVISIBLE, TRUE) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Idle) - CaseEq(1) + CaseEq(SPINY_SURGE_HOLD) IfEq(LVar9, 1) BreakSwitch EndIf - Call(SetPartFlagBits, ACTOR_PARTNER, 2, ACTOR_PART_FLAG_INVISIBLE, FALSE) + Call(SetPartFlagBits, ACTOR_PARTNER, PRT_2, ACTOR_PART_FLAG_INVISIBLE, FALSE) Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2) Add(LVar0, 3) Add(LVar1, 34) @@ -1028,7 +1028,7 @@ EvtScript N(EVS_Move_SpinySurge) = { Call(SetPartPos, ACTOR_PARTNER, 2, LVar0, LVar1, LVar2) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_LiftSpiny) Set(LVar9, 1) - CaseEq(2) + CaseEq(SPINY_SURGE_THROW) IfEq(LVar9, 0) BreakSwitch EndIf @@ -1041,7 +1041,7 @@ EvtScript N(EVS_Move_SpinySurge) = { EndIf Call(N(ThrowSpinyFX)) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_ThrowSpinyAlt) - Call(SetPartFlagBits, ACTOR_PARTNER, 2, ACTOR_PART_FLAG_INVISIBLE, TRUE) + Call(SetPartFlagBits, ACTOR_PARTNER, PRT_2, ACTOR_PART_FLAG_INVISIBLE, TRUE) ChildThread Call(GetActorVar, ACTOR_PARTNER, AVAR_Unk_0, LVar0) Add(LVar0, 1) @@ -1056,7 +1056,7 @@ EvtScript N(EVS_Move_SpinySurge) = { EndSwitch Wait(1) EndLoop - Call(SetPartFlagBits, ACTOR_PARTNER, 2, ACTOR_PART_FLAG_INVISIBLE, TRUE) + Call(SetPartFlagBits, ACTOR_PARTNER, PRT_2, ACTOR_PART_FLAG_INVISIBLE, TRUE) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Idle) Loop(0) Call(GetActorVar, ACTOR_PARTNER, AVAR_Unk_0, LVar0) @@ -1079,7 +1079,7 @@ EvtScript N(EVS_Move_SpinySurge) = { IfEq(LVar0, HIT_RESULT_MISS) Goto(12) EndIf - Call(GetPartnerActionSuccess, LVarA) + Call(GetPartnerActionQuality, LVarA) Call(N(GetSpinySurgeDamage)) Switch(LVar0) CaseGt(0) @@ -1119,8 +1119,8 @@ EvtScript N(cloudNine_normal) = { Call(UseIdleAnimation, ACTOR_PLAYER, FALSE) Call(SetBattleFlagBits, BS_FLAGS1_SHOW_PLAYER_DECORATIONS, FALSE) Call(SetActorFlagBits, ACTOR_PLAYER, ACTOR_FLAG_NO_INACTIVE_ANIM, TRUE) - Call(LoadActionCommand, ACTION_COMMAND_WATER_BLOCK) - Call(action_command_water_block_init, 2) + Call(LoadActionCommand, ACTION_COMMAND_THREE_CHANCES) + Call(action_command_three_chances_init, ACV_THREE_CHANCES_CLOUD_NINE) Call(SetActionHudPrepareTime, 50) Call(InitTargetIterator) Call(SetGoalToHome, ACTOR_PARTNER) @@ -1161,7 +1161,7 @@ EvtScript N(cloudNine_normal) = { Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_FightingStance) Wait(3) Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle) - Call(action_command_water_block_start, 0, 97, 3) + Call(action_command_three_chances_start, 0, 97, AC_DIFFICULTY_3) Call(AddBattleCamDist, -75) Call(MoveBattleCamOver, 100) Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_NONE, BTL_CAM_XADJ_NONE, TRUE) @@ -1169,7 +1169,7 @@ EvtScript N(cloudNine_normal) = { Wait(3) Call(AddBattleCamDist, 50) Call(MoveBattleCamOver, 5) - Call(GetPartnerActionSuccess, LVarA) + Call(GetPartnerActionQuality, LVarA) IfGt(LVarA, 0) Call(N(RemoveCloudNineFX)) Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_LAKILESTER_MAKE_CLOUD_NINE) @@ -1238,8 +1238,8 @@ EvtScript N(cloudNine_normal) = { EvtScript N(cloudNine_immobile) = { Call(UseIdleAnimation, ACTOR_PLAYER, FALSE) - Call(LoadActionCommand, ACTION_COMMAND_WATER_BLOCK) - Call(action_command_water_block_init, 2) + Call(LoadActionCommand, ACTION_COMMAND_THREE_CHANCES) + Call(action_command_three_chances_init, ACV_THREE_CHANCES_CLOUD_NINE) Call(SetActionHudPrepareTime, 50) Call(N(RemoveCloudNineFX)) Call(InitTargetIterator) @@ -1276,7 +1276,7 @@ EvtScript N(cloudNine_immobile) = { Add(LVar1, 40) Call(SetGoalPos, ACTOR_PARTNER, LVar0, LVar1, LVar2) Call(FlyToGoal, ACTOR_PARTNER, 20, 0, EASING_COS_IN_OUT) - Call(action_command_water_block_start, 0, 97, 3) + Call(action_command_three_chances_start, 0, 97, AC_DIFFICULTY_3) Call(AddBattleCamDist, -75) Call(MoveBattleCamOver, 100) Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_NONE, BTL_CAM_XADJ_NONE, TRUE) @@ -1284,7 +1284,7 @@ EvtScript N(cloudNine_immobile) = { Wait(3) Call(AddBattleCamDist, 50) Call(MoveBattleCamOver, 5) - Call(GetPartnerActionSuccess, LVarA) + Call(GetPartnerActionQuality, LVarA) IfGt(LVarA, 0) Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_LAKILESTER_MAKE_CLOUD_NINE) Call(N(SpawnCloudNineFX)) @@ -1400,7 +1400,7 @@ API_CALLABLE(N(ProcessHurricane)) { partner->state.angle = 0.0f; partner->state.moveTime = HURRICANE_PARTNER_MOVE_TIME; partner->state.moveArcAmplitude = 0; - sIsHurricaneActive = TRUE; + IsHurricaneActive = TRUE; D_8023D338 = 255; sHuffPuffBreathEffect = effect = fx_huff_puff_breath(0, NPC_DISPOSE_LOCATION, 0.0f, -2.0f, 0.6f, 0); @@ -1420,7 +1420,6 @@ API_CALLABLE(N(ProcessHurricane)) { hurricaneState->intensity = 0; hurricaneState->startingTotalPower = -1; - sSavedHurricaneIntensity = 0; D_8023D278 = (1.0 - sin_rad(hurricaneState->intensity * PI_S * 0.5f / 750.0f)) * 8.0 + 13.0; sHuffPuffBreathState = -1; @@ -1439,7 +1438,7 @@ API_CALLABLE(N(ProcessHurricane)) { for (i = 0; i < partner->targetListLength; i++) { targetIndex = partner->targetIndexList[i]; - temp = sTargetStates[targetIndex]; + temp = EnemyHurricaneChances[targetIndex]; if (temp != -1) { if (temp != 0) { target = &partner->targetData[targetIndex]; @@ -1456,7 +1455,7 @@ API_CALLABLE(N(ProcessHurricane)) { for (i = 0; i < partner->targetListLength; i++) { targetIndex = partner->targetIndexList[i]; - temp = sTargetStates[targetIndex]; + temp = EnemyHurricaneChances[targetIndex]; if (temp != -1) { if (temp != 0) { target = &partner->targetData[targetIndex]; @@ -1466,7 +1465,7 @@ API_CALLABLE(N(ProcessHurricane)) { } } - sIsHurricaneActive = FALSE; + IsHurricaneActive = FALSE; remove_effect(sHuffPuffBreathEffect); return ApiStatus_DONE2; } @@ -1529,7 +1528,6 @@ API_CALLABLE(N(ProcessHurricane)) { break; } - if (gGameStatusPtr->frameCounter % (7 - sHurricaneIntensity / 2) == 0) { x = -220.0f; y = 176 - rand_int(100); @@ -1674,7 +1672,7 @@ API_CALLABLE(N(BlowTargetAway)) { target->state.curPos.y = target->curPos.y; target->state.curPos.z = target->curPos.z; target->state.speed = 5.5f; - sNumEnemiesBeingBlown += 1; + NumEnemiesBeingBlown++; battleStatus->curAttackElement = 0; dispatch_event_actor(target, EVENT_BLOW_AWAY); script->functionTemp[0] = 1; @@ -1689,7 +1687,7 @@ API_CALLABLE(N(BlowTargetAway)) { target->yaw += 33.0f; target->yaw = clamp_angle(target->yaw); if (target->state.curPos.x > 240.0f) { - sNumEnemiesBeingBlown -= 1; + NumEnemiesBeingBlown--; return ApiStatus_DONE2; } break; @@ -1701,14 +1699,14 @@ API_CALLABLE(N(BlowTargetAway)) { } API_CALLABLE(N(AllEnemiesBlownAway)) { - if (sNumEnemiesBeingBlown == 0) { + if (NumEnemiesBeingBlown == 0) { return ApiStatus_DONE2; } return ApiStatus_BLOCK; } API_CALLABLE(N(IsHurricaneActive)) { - script->varTable[0] = sIsHurricaneActive; + script->varTable[0] = IsHurricaneActive; return ApiStatus_DONE2; } @@ -1731,7 +1729,7 @@ EvtScript N(EVS_Move_Hurricane) = { Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleLakilester_Idle) Wait(15) Call(N(InitHurricane)) - Call(action_command_hurricane_start, 0, 147 * DT, 3, LVar0) + Call(action_command_hurricane_start, 0, 147 * DT, AC_DIFFICULTY_3, LVar0) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) Call(SetActorRotationOffset, ACTOR_PARTNER, 0, 20, 0) Call(UseBattleCamPreset, BTL_CAM_REPOSITION) @@ -1750,14 +1748,14 @@ EvtScript N(EVS_Move_Hurricane) = { IfEq(LVar0, 0) BreakLoop EndIf - Call(GetActionSuccessCopy, LVar0) + Call(GetMashActionQuality, LVar0) IfEq(LVar0, 100) BreakLoop EndIf Wait(1) EndLoop Wait(15) - Call(GetActionSuccessCopy, LVar0) + Call(GetMashActionQuality, LVar0) Switch(LVar0) CaseGt(99) Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME) diff --git a/src/battle/partner/parakarry.c b/src/battle/partner/parakarry.c index ff7454eb2dc..37bd502a020 100644 --- a/src/battle/partner/parakarry.c +++ b/src/battle/partner/parakarry.c @@ -68,7 +68,8 @@ API_CALLABLE(N(ShellShotActionCommand)) { s32 screenX, screenY, screenZ; f32 aimX, aimY, aimZ; f32 clampedAngleDiff, aimAngle; - s32 hudID, i; + HudElemID hid; + s32 i; if (isInitialCall) { script->functionTemp[0] = 0; @@ -76,68 +77,68 @@ API_CALLABLE(N(ShellShotActionCommand)) { switch (script->functionTemp[0]) { case 0: - hudMarkers[0] = hudID = hud_element_create(&HES_AimMarkerF); - hud_element_set_render_depth(hudID, 10); - hud_element_set_render_pos(hudID, -100, -100); + hudMarkers[0] = hid = hud_element_create(&HES_AimMarkerF); + hud_element_set_render_depth(hid, 10); + hud_element_set_render_pos(hid, -100, -100); - hudMarkers[1] = hudID = hud_element_create(&HES_AimMarkerE); - hud_element_set_render_depth(hudID, 10); - hud_element_set_render_pos(hudID, -100, -100); + hudMarkers[1] = hid = hud_element_create(&HES_AimMarkerE); + hud_element_set_render_depth(hid, 10); + hud_element_set_render_pos(hid, -100, -100); - hudMarkers[2] = hudID = hud_element_create(&HES_AimMarkerD); - hud_element_set_render_depth(hudID, 10); - hud_element_set_render_pos(hudID, -100, -100); + hudMarkers[2] = hid = hud_element_create(&HES_AimMarkerD); + hud_element_set_render_depth(hid, 10); + hud_element_set_render_pos(hid, -100, -100); - hudMarkers[3] = hudID = hud_element_create(&HES_AimMarkerC); - hud_element_set_render_depth(hudID, 10); - hud_element_set_render_pos(hudID, -100, -100); + hudMarkers[3] = hid = hud_element_create(&HES_AimMarkerC); + hud_element_set_render_depth(hid, 10); + hud_element_set_render_pos(hid, -100, -100); - hudMarkers[4] = hudID = hud_element_create(&HES_AimMarkerB); - hud_element_set_render_depth(hudID, 10); - hud_element_set_render_pos(hudID, -100, -100); + hudMarkers[4] = hid = hud_element_create(&HES_AimMarkerB); + hud_element_set_render_depth(hid, 10); + hud_element_set_render_pos(hid, -100, -100); - hudMarkers[5] = hudID = hud_element_create(&HES_AimMarkerA); - hud_element_set_render_depth(hudID, 10); - hud_element_set_render_pos(hudID, -100, -100); + hudMarkers[5] = hid = hud_element_create(&HES_AimMarkerA); + hud_element_set_render_depth(hid, 10); + hud_element_set_render_pos(hid, -100, -100); - hudMarkers[6] = hudID = hud_element_create(&HES_AimReticle); - hud_element_set_render_depth(hudID, 10); - hud_element_set_render_pos(hudID, -100, -100); + hudMarkers[6] = hid = hud_element_create(&HES_AimReticle); + hud_element_set_render_depth(hid, 10); + hud_element_set_render_pos(hid, -100, -100); - hudShimmers[0] = hudID = hud_element_create(&HES_AimShimmerF); - hud_element_set_render_depth(hudID, 9); - hud_element_set_render_pos(hudID, -100, -100); + hudShimmers[0] = hid = hud_element_create(&HES_AimShimmerF); + hud_element_set_render_depth(hid, 9); + hud_element_set_render_pos(hid, -100, -100); - hudShimmers[1] = hudID = hud_element_create(&HES_AimShimmerE); - hud_element_set_render_depth(hudID, 9); - hud_element_set_render_pos(hudID, -100, -100); + hudShimmers[1] = hid = hud_element_create(&HES_AimShimmerE); + hud_element_set_render_depth(hid, 9); + hud_element_set_render_pos(hid, -100, -100); - hudShimmers[2] = hudID = hud_element_create(&HES_AimShimmerD); - hud_element_set_render_depth(hudID, 9); - hud_element_set_render_pos(hudID, -100, -100); + hudShimmers[2] = hid = hud_element_create(&HES_AimShimmerD); + hud_element_set_render_depth(hid, 9); + hud_element_set_render_pos(hid, -100, -100); - hudShimmers[3] = hudID = hud_element_create(&HES_AimShimmerC); - hud_element_set_render_depth(hudID, 9); - hud_element_set_render_pos(hudID, -100, -100); + hudShimmers[3] = hid = hud_element_create(&HES_AimShimmerC); + hud_element_set_render_depth(hid, 9); + hud_element_set_render_pos(hid, -100, -100); - hudShimmers[4] = hudID = hud_element_create(&HES_AimShimmerB); - hud_element_set_render_depth(hudID, 9); - hud_element_set_render_pos(hudID, -100, -100); + hudShimmers[4] = hid = hud_element_create(&HES_AimShimmerB); + hud_element_set_render_depth(hid, 9); + hud_element_set_render_pos(hid, -100, -100); - hudShimmers[5] = hudID = hud_element_create(&HES_AimShimmerA); - hud_element_set_render_depth(hudID, 9); - hud_element_set_render_pos(hudID, -100, -100); + hudShimmers[5] = hid = hud_element_create(&HES_AimShimmerA); + hud_element_set_render_depth(hid, 9); + hud_element_set_render_pos(hid, -100, -100); - hudTarget = hudID = hud_element_create(&HES_AimTarget); - hud_element_set_render_depth(hudID, 10); + hudTarget = hid = hud_element_create(&HES_AimTarget); + hud_element_set_render_depth(hid, 10); hud_element_create_transform_A(hudTarget); - hud_element_set_render_pos(hudID, -100, -100); + hud_element_set_render_pos(hid, -100, -100); hudStickPosX = -48; hudStickPosY = 80; - hudStick = hudID = hud_element_create(&HES_StickHoldLeft); - hud_element_set_render_pos(hudID, hudStickPosX, hudStickPosY); - hud_element_set_render_depth(hudID, 0); + hudStick = hid = hud_element_create(&HES_StickHoldLeft); + hud_element_set_render_pos(hid, hudStickPosX, hudStickPosY); + hud_element_set_render_depth(hid, 0); set_goal_pos_to_part(state, parakarry->targetActorID, parakarry->targetPartID); targetActor = get_actor(parakarry->targetActorID); @@ -155,7 +156,6 @@ API_CALLABLE(N(ShellShotActionCommand)) { state->bounceDivisor = state->angle; state->dist = 116.0f; state->unk_18.x = state->angle; - i = 0; for (i = 0; i < 30; i++) { state->unk_18.x -= 1.0f; @@ -172,7 +172,6 @@ API_CALLABLE(N(ShellShotActionCommand)) { } state->unk_18.y = state->angle; - i = 0; for (i = 0; i < 30; i++) { state->unk_18.y += 1.0f; @@ -198,7 +197,7 @@ API_CALLABLE(N(ShellShotActionCommand)) { #endif battleStatus->actionResult = ACTION_RESULT_FAIL; action_command_init_status(); - func_80269118(); + increment_action_command_attempt_count(); script->functionTemp[0] = 1; break; case 1: @@ -271,14 +270,14 @@ API_CALLABLE(N(ShellShotActionCommand)) { } else { battleStatus->actionResult = ACTION_RESULT_FAIL; } - battleStatus->actionQuality = 0; + battleStatus->actionProgress = 0; if (aimAngle < 7.0f) { - battleStatus->actionQuality = 1; + battleStatus->actionProgress = 1; battleStatus->actionResult = ACTION_RESULT_SUCCESS; - func_80269160(); + increment_action_command_success_count(); } else if (state->angle < state->bounceDivisor) { - battleStatus->actionQuality = -1; + battleStatus->actionProgress = -1; } for (i = 0; i < ARRAY_COUNT(hudMarkers); i++) { @@ -291,35 +290,35 @@ API_CALLABLE(N(ShellShotActionCommand)) { hud_element_free(hudTarget); hud_element_free(hudStick); - btl_set_popup_duration(0); + btl_set_popup_duration(POPUP_MSG_OFF); return ApiStatus_DONE2; } if (script->functionTemp[0] < 3) { if (script->functionTemp[0] > 0) { - hudID = hudStick; + hid = hudStick; targetActor = get_actor(parakarry->targetActorID); clampedAngleDiff = get_clamped_angle_diff(state->angle, state->bounceDivisor); aimAngle = fabsf(clampedAngleDiff) / state->unk_24 * targetActor->scalingFactor; if (aimAngle < 7.0f) { - hud_element_set_script(hudID, &HES_StickNeutral); + hud_element_set_script(hid, &HES_StickNeutral); } else { - hud_element_set_script(hudID, &HES_StickHoldLeft); + hud_element_set_script(hid, &HES_StickHoldLeft); } hudStickPosX += 20; if (hudStickPosX >= 51) { hudStickPosX = 50; } - hud_element_set_render_pos(hudID, hudStickPosX, hudStickPosY); + hud_element_set_render_pos(hid, hudStickPosX, hudStickPosY); } } get_screen_coords(gCurrentCameraID, state->goalPos.x, state->goalPos.y, state->goalPos.z, &screenX, &screenY, &screenZ); - hudID = hudTarget; - hud_element_set_render_pos(hudID, screenX, screenY); - hud_element_set_transform_rotation(hudID, 0.0f, 0.0f, hudTargetRotation); + hid = hudTarget; + hud_element_set_render_pos(hid, screenX, screenY); + hud_element_set_transform_rotation(hid, 0.0f, 0.0f, hudTargetRotation); hudTargetRotation -= 10; hudTargetRotation = clamp_angle(hudTargetRotation); @@ -340,12 +339,12 @@ API_CALLABLE(N(ShellShotActionCommand)) { z += (aimZ - state->curPos.z) / 6.0f; get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); hud_element_set_render_pos(hudMarkers[i], screenX, screenY); - hudID = hudShimmers[i]; - hud_element_set_render_pos(hudID, screenX, screenY); + hid = hudShimmers[i]; + hud_element_set_render_pos(hid, screenX, screenY); } hud_element_set_render_pos(hudMarkers[i], screenX, screenY); - btl_set_popup_duration(99); + btl_set_popup_duration(POPUP_MSG_ON); } } @@ -357,13 +356,13 @@ API_CALLABLE(N(GetShellShotDamage)) { s32 damage = 0; switch (battleStatus->partnerActor->actorBlueprint->level) { - case 0: + case PARTNER_RANK_NORMAL: damage = 5; break; - case 1: + case PARTNER_RANK_SUPER: damage = 6; break; - case 2: + case PARTNER_RANK_ULTRA: damage = 7; break; } @@ -448,7 +447,7 @@ API_CALLABLE(N(CarryAway)) { } if (parakarry->state.curPos.x > 240.0f) { - battleStatus->actionQuality = temp_s4; + battleStatus->actionProgress = temp_s4; return ApiStatus_DONE2; } break; @@ -712,7 +711,7 @@ EvtScript N(EVS_Idle) = { EvtScript N(EVS_HandleEvent) = { Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(GetLastEvent, ACTOR_PARTNER, LVar0) Switch(LVar0) CaseOrEq(EVENT_HIT_COMBO) @@ -946,7 +945,7 @@ EvtScript N(skyDive) = { Call(FlyToGoal, ACTOR_PARTNER, 0, -10, EASING_COS_IN_OUT) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Still) Wait(3) - Call(action_command_jump_start, 32, 3) + Call(action_command_jump_start, 32, AC_DIFFICULTY_3) Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_PARAKARRY_PREDIVE) Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_FlyFast) @@ -987,7 +986,7 @@ EvtScript N(skyDive) = { Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_DISABLE) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_PostDive) Wait(2) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(PartnerDamageEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_FRONT, 0, LVarF, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_NICE_HIT) @@ -1022,7 +1021,7 @@ EvtScript N(shellShot) = { Call(N(ShellShotActionCommand)) Call(StopSound, SOUND_AIM_SHELL_SHOT) Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_PARAKARRY_SHELL_SHOT) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) Call(PartnerTestEnemy, LVarA, 0, SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS) IfEq(LVarA, HIT_RESULT_MISS) Set(LVar0, -2) @@ -1043,7 +1042,7 @@ EvtScript N(shellShot) = { Call(SetGoalToTarget, ACTOR_PARTNER) Call(AddGoalPos, ACTOR_PARTNER, 50, -50, 0) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_ShellFlyFastest) - Call(FlyToGoal, ACTOR_PARTNER, 7, 0, 0x00000064) + Call(FlyToGoal, ACTOR_PARTNER, 7, 0, 100) Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_DISABLE) CaseEq(0) Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR) @@ -1126,7 +1125,7 @@ EvtScript N(airLift) = { Wait(2) Call(PartnerTestEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_FRONT, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS) IfEq(LVar0, HIT_RESULT_MISS) - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(UseBattleCamPreset, BTL_CAM_PARTNER_MISTAKE) Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2) Add(LVar1, 20) @@ -1148,15 +1147,15 @@ EvtScript N(airLift) = { Call(PartnerTestEnemy, LVar0, DAMAGE_TYPE_AIR_LIFT, SUPPRESS_EVENT_SPIKY_FRONT, 0, 0, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_TRIGGER_EVENTS) Call(N(AirLiftChance)) IfNe(LVar0, -1) - Call(action_command_air_lift_start, 0, 87 * DT, 3, 0) + Call(action_command_air_lift_start, 0, 87 * DT, AC_DIFFICULTY_3, 0) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) ChildThread Wait(1) - Call(GetActionQuality, LVar1) + Call(GetActionProgress, LVar1) Div(LVar1, 10) Add(LVar1, 1) Loop(88 * DT) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) Set(LVar2, LVar1) Mul(LVar2, 10) IfGt(LVar0, LVar2) @@ -1169,9 +1168,9 @@ EvtScript N(airLift) = { EndLoop EndChildThread Wait(90 * DT) - Call(GetActionSuccessCopy, LVar0) + Call(GetMashActionQuality, LVar0) Else - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Set(LVar0, 0) EndIf Switch(LVar0) @@ -1221,7 +1220,7 @@ EvtScript N(airRaid) = { Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Run) Call(FlyToGoal, ACTOR_PARTNER, 15, -2, EASING_LINEAR) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_Idle) - Call(action_command_air_raid_start, 0, 90 * DT, 3) + Call(action_command_air_raid_start, 0, 90 * DT, AC_DIFFICULTY_3) Call(SetBattleFlagBits, BS_FLAGS1_4000, FALSE) Wait(2) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleParakarry_PreDive) @@ -1254,7 +1253,7 @@ EvtScript N(airRaid) = { Call(EnableActorBlur, ACTOR_PARTNER, ACTOR_BLUR_DISABLE) Call(UseBattleCamPreset, BTL_CAM_VIEW_ENEMIES) Call(MoveBattleCamOver, 20) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) Call(N(GetAirRaidDamage)) Call(InitTargetIterator) Label(10) @@ -1263,7 +1262,7 @@ EvtScript N(airRaid) = { IfEq(LVar0, 6) Goto(11) EndIf - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(99) Call(PartnerDamageEnemy, LVar0, DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_MULTIPLE_POPUPS, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT | SUPPRESS_EVENT_ALT_SPIKY, 0, LVarF, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_NICE_HIT) @@ -1278,7 +1277,7 @@ EvtScript N(airRaid) = { IfNe(LVar0, ITER_NO_MORE) Goto(10) EndIf - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(99) Call(UseBattleCamPreset, BTL_CAM_RETURN_HOME) diff --git a/src/battle/partner/sushie.c b/src/battle/partner/sushie.c index 57d2a8b81ef..14dfd4abd13 100644 --- a/src/battle/partner/sushie.c +++ b/src/battle/partner/sushie.c @@ -4,7 +4,7 @@ #include "script_api/battle.h" #include "battle/action_cmd/hammer.h" #include "battle/action_cmd/squirt.h" -#include "battle/action_cmd/water_block.h" +#include "battle/action_cmd/three_chances.h" #include "battle/action_cmd/tidal_wave.h" #include "sprite/npc/BattleSushie.h" @@ -482,7 +482,7 @@ EvtScript N(EVS_Idle) = { EvtScript N(EVS_HandleEvent) = { Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(GetLastEvent, ACTOR_PARTNER, LVar0) Switch(LVar0) CaseOrEq(EVENT_HIT_COMBO) @@ -744,8 +744,8 @@ EvtScript N(EVS_Move_BellyFlop) = { BreakLoop EndIf EndLoop - Call(action_command_hammer_start, 0, 57, 3) - Call(SetActionQuality, 0) + Call(action_command_hammer_start, 0, 57, AC_DIFFICULTY_3) + Call(SetActionProgress, 0) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleSushie_Tense1) Call(UseBattleCamPreset, BTL_CAM_PARTNER_CLOSE_UP) Set(LVar0, 30) @@ -761,7 +761,7 @@ EvtScript N(EVS_Move_BellyFlop) = { EndIf EndLoop Thread - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Call(UseBattleCamPreset, BTL_CAM_PARTNER_MIDAIR) Call(MoveBattleCamOver, 20) EndThread @@ -777,7 +777,7 @@ EvtScript N(EVS_Move_BellyFlop) = { Call(SetActorRotation, ACTOR_PARTNER, 0, 0, 20) EndThread Thread - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) IfGt(LVar0, 0) Call(GetMenuSelection, LVar0, LVar1, LVar2) Switch(LVar2) @@ -856,7 +856,7 @@ EvtScript N(EVS_Move_BellyFlop) = { EndThread Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_SUSHIE_BELLY_FLOP) Call(SetGoalToTarget, ACTOR_PARTNER) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) IfGt(LVar0, 0) Thread Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleSushie_Jump) @@ -910,7 +910,7 @@ EvtScript N(EVS_Move_BellyFlop) = { Wait(3) Call(SetActorScale, ACTOR_PARTNER, Float(1.0), Float(1.0), Float(1.0)) EndThread - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(PartnerDamageEnemy, LVar0, DAMAGE_TYPE_JUMP, SUPPRESS_EVENT_SPIKY_FRONT, 0, LVarF, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_NICE_HIT) @@ -939,11 +939,11 @@ EvtScript N(EVS_Move_Squirt) = { Call(action_command_squirt_init) Call(GetActorLevel, ACTOR_PARTNER, LVar0) Switch(LVar0) - CaseEq(0) + CaseEq(PARTNER_RANK_NORMAL) Call(SetupMashMeter, 3, 40, 75, 100, 0, 0) - CaseEq(1) + CaseEq(PARTNER_RANK_SUPER) Call(SetupMashMeter, 4, 35, 60, 80, 100, 0) - CaseEq(2) + CaseEq(PARTNER_RANK_ULTRA) Call(SetupMashMeter, 5, 20, 40, 60, 80, 100) EndSwitch Call(UseBattleCamPreset, BTL_CAM_ACTOR_CLOSE) @@ -963,9 +963,9 @@ EvtScript N(EVS_Move_Squirt) = { Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleSushie_Inhale) Call(AddBattleCamDist, -80) Call(MoveBattleCamOver, 90 * DT) - Call(action_command_squirt_start, 0, 87 * DT, 3) + Call(action_command_squirt_start, 0, 87 * DT, AC_DIFFICULTY_3) Loop(90 * DT) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) IfEq(LVar0, 0) Call(GetActorScale, ACTOR_SELF, LVar0, LVar1, LVar2) SetF(LVar1, LVar0) @@ -1009,7 +1009,7 @@ EvtScript N(EVS_Move_Squirt) = { Call(GetGoalPos, ACTOR_PARTNER, LVar3, LVar4, LVar5) PlayEffect(EFFECT_SQUIRT, 0, LVar0, LVar1, LVar2, LVar3, LVar4, LVar5, LVarE, 10, 0) Wait(10) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) Call(N(GetSquirtDamage)) Switch(LVar0) CaseGt(0) @@ -1048,8 +1048,8 @@ EvtScript N(EVS_Move_WaterBlock) = { Add(LVar0, 30) Call(SetGoalPos, ACTOR_PARTNER, LVar0, LVar1, LVar2) Call(JumpToGoal, ACTOR_PARTNER, 10, FALSE, TRUE, FALSE) - Call(LoadActionCommand, ACTION_COMMAND_WATER_BLOCK) - Call(action_command_water_block_init, 0) + Call(LoadActionCommand, ACTION_COMMAND_THREE_CHANCES) + Call(action_command_three_chances_init, ACV_THREE_CHANCES_WATER_BLOCK) Call(SetActionHudPrepareTime, 0) Set(LVar0, 0) Loop(4) @@ -1058,10 +1058,10 @@ EvtScript N(EVS_Move_WaterBlock) = { Wait(1) EndLoop Wait(4) - Call(action_command_water_block_start, 0, 100, 3) + Call(action_command_three_chances_start, 0, 100, AC_DIFFICULTY_3) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleSushie_HoldWater) Wait(110) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) IfEq(LVar0, 0) Set(LVarA, LVar0) Goto(10) @@ -1105,7 +1105,7 @@ EvtScript N(EVS_Move_WaterBlock) = { Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) Call(N(PlayWaterBlockFX), LVar0, LVar1, LVar2) Wait(30) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Call(N(ApplyWaterBlock)) Set(LVarA, LVar0) Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) @@ -1158,7 +1158,7 @@ EvtScript N(EVS_Move_TidalWave) = { Call(JumpToGoal, ACTOR_PARTNER, 15, FALSE, TRUE, FALSE) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleSushie_Idle) Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleSushie_HoldWater) - Call(action_command_tidal_wave_start, 0, 100, 3) + Call(action_command_tidal_wave_start, 0, 100, AC_DIFFICULTY_3) Call(SetActorRotationOffset, ACTOR_PARTNER, 0, 12, 0) Thread Wait(54) @@ -1183,7 +1183,7 @@ EvtScript N(EVS_Move_TidalWave) = { Call(SetActorDispOffset, ACTOR_PARTNER, 0, 0, 0) EndThread Loop(100) - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) Call(N(SetScaleTidalWaveCharge)) Wait(1) EndLoop @@ -1197,7 +1197,7 @@ EvtScript N(EVS_Move_TidalWave) = { Wait(15) Call(UseBattleCamPreset, BTL_CAM_VIEW_ENEMIES) Call(MoveBattleCamOver, 20) - Call(GetActionSuccessCopy, LVar0) + Call(GetMashActionQuality, LVar0) Set(LVarE, LVar0) Set(LVarF, LVar0) Call(InitTargetIterator) diff --git a/src/battle/partner/twink.c b/src/battle/partner/twink.c index c51855caeab..7c263cf7538 100644 --- a/src/battle/partner/twink.c +++ b/src/battle/partner/twink.c @@ -151,7 +151,7 @@ EvtScript N(EVS_Idle) = { EvtScript N(EVS_HandleEvent) = { Call(UseIdleAnimation, ACTOR_PLAYER, FALSE) Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(GetLastEvent, ACTOR_PARTNER, LVar0) Switch(LVar0) CaseOrEq(EVENT_HIT_COMBO) diff --git a/src/battle/partner/watt.c b/src/battle/partner/watt.c index efca1319ccb..ce31c7a98c6 100644 --- a/src/battle/partner/watt.c +++ b/src/battle/partner/watt.c @@ -4,7 +4,7 @@ #include "script_api/battle.h" #include "battle/action_cmd/body_slam.h" #include "battle/action_cmd/power_shock.h" -#include "battle/action_cmd/water_block.h" +#include "battle/action_cmd/three_chances.h" #include "battle/action_cmd/mega_shock.h" #include "sprite/npc/BattleWatt.h" #include "sprite/player.h" @@ -543,7 +543,7 @@ EvtScript N(EVS_Idle) = { EvtScript N(EVS_HandleEvent) = { Call(UseIdleAnimation, ACTOR_PARTNER, FALSE) - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(N(WattFXDisableBounce)) Call(N(WattFXEnable)) Call(N(WattFXSetEffect), 0) @@ -790,7 +790,7 @@ EvtScript N(EVS_Attack_ElectroDash) = { EndLoop Call(MoveBattleCamOver, 75) IfEq(LFlag2, TRUE) - Call(action_command_body_slam_start, 0, 102, 3, 1) + Call(action_command_body_slam_start, 0, 102, AC_DIFFICULTY_3, ACV_SLAM_WATT) Set(LFlag0, FALSE) ExecGetTID(N(dashToTarget), LVarA) Loop(20) @@ -842,7 +842,7 @@ EvtScript N(EVS_Attack_ElectroDash) = { Call(CheckButtonDown, BUTTON_A, LVar0) IfNe(LVar0, 0) IfEq(LFlag2, FALSE) - Call(action_command_body_slam_start, 0, 92, 3, 1) + Call(action_command_body_slam_start, 0, 92, AC_DIFFICULTY_3, ACV_SLAM_WATT) Set(LFlag2, TRUE) EndIf EndIf @@ -865,7 +865,7 @@ EvtScript N(EVS_Attack_ElectroDash) = { Call(CheckButtonDown, BUTTON_A, LVar0) IfNe(LVar0, 0) IfEq(LFlag2, FALSE) - Call(action_command_body_slam_start, 0, 92, 3, 1) + Call(action_command_body_slam_start, 0, 92, AC_DIFFICULTY_3, ACV_SLAM_WATT) Set(LFlag2, TRUE) EndIf EndIf @@ -899,7 +899,7 @@ EvtScript N(EVS_Attack_ElectroDash) = { EndIf Label(10) Wait(2) - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(N(ElectroDashFXDisable)) Call(StopLoopingSoundAtActor, ACTOR_PARTNER, 0) Call(SetDamageSource, DMG_SRC_ELECTRO_DASH) @@ -942,7 +942,7 @@ EvtScript N(EVS_Attack_ElectroDash) = { Set(LVarE, 1) Set(LVarF, 5) EndSwitch - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(PartnerDamageEnemy, LVar0, DAMAGE_TYPE_SHOCK | DAMAGE_TYPE_IGNORE_DEFENSE, SUPPRESS_EVENT_SPIKY_TOP | SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_SHOCK_CONTACT | SUPPRESS_EVENT_ALT_SPIKY, 0, LVarF, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_NICE_HIT) @@ -989,7 +989,7 @@ EvtScript N(EVS_Attack_PowerShock) = { Call(MoveBattleCamOver, 80) Call(N(WattFXDisable)) Call(N(TargetParalyzeChance)) - Call(action_command_power_shock_start, 0, 75 * DT - 3, 3, LVar0) + Call(action_command_power_shock_start, 0, 75 * DT - 3, AC_DIFFICULTY_3, LVar0) Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2) Add(LVar1, 15) Add(LVar2, 5) @@ -1056,8 +1056,8 @@ EvtScript N(EVS_Attack_PowerShock) = { ExecWait(N(EVS_ReturnHome_Miss)) Return EndIf - Call(GetActionQuality, LVarF) - Call(GetPartnerActionSuccess, LVar0) + Call(GetActionProgress, LVarF) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(0) Call(PartnerAfflictEnemy, LVar0, DAMAGE_TYPE_SHOCK | DAMAGE_TYPE_NO_CONTACT | DAMAGE_TYPE_STATUS_ALWAYS_HITS, 0, DMG_STATUS_ALWAYS(STATUS_FLAG_PARALYZE, 3), 254, 0, BS_FLAGS1_INCLUDE_POWER_UPS | BS_FLAGS1_TRIGGER_EVENTS | BS_FLAGS1_NICE_HIT) @@ -1088,8 +1088,8 @@ EvtScript N(EVS_Attack_PowerShock) = { }; EvtScript N(EVS_TurboCharge_HealthyPlayer) = { - Call(LoadActionCommand, ACTION_COMMAND_WATER_BLOCK) - Call(action_command_water_block_init, 1) + Call(LoadActionCommand, ACTION_COMMAND_THREE_CHANCES) + Call(action_command_three_chances_init, ACV_THREE_CHANCES_TURBO_CHARGE) Call(SetActionHudPrepareTime, 0) Call(SetActorFlagBits, ACTOR_PLAYER, ACTOR_FLAG_NO_INACTIVE_ANIM, TRUE) Call(UseIdleAnimation, ACTOR_PLAYER, FALSE) @@ -1112,7 +1112,7 @@ EvtScript N(EVS_TurboCharge_HealthyPlayer) = { Wait(1) Call(SetActorYaw, ACTOR_PARTNER, 180) Wait(10) - Call(action_command_water_block_start, 0, 100 * DT, 3) + Call(action_command_three_chances_start, 0, 100 * DT, AC_DIFFICULTY_3) Call(AddBattleCamDist, -75) Call(MoveBattleCamOver, 100 * DT) Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_NONE, BTL_CAM_XADJ_NONE, TRUE) @@ -1151,7 +1151,7 @@ EvtScript N(EVS_TurboCharge_HealthyPlayer) = { Call(UseBattleCamPreset, BTL_CAM_DEFAULT) Call(MoveBattleCamOver, 10) Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_GROW) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Call(N(ApplyTurboCharge)) Set(LVarE, LVarF) IfGt(LVarA, 0) @@ -1173,8 +1173,8 @@ EvtScript N(EVS_TurboCharge_HealthyPlayer) = { }; EvtScript N(EVS_TurboCharge_ImmobilePlayer) = { - Call(LoadActionCommand, ACTION_COMMAND_WATER_BLOCK) - Call(action_command_water_block_init, 1) + Call(LoadActionCommand, ACTION_COMMAND_THREE_CHANCES) + Call(action_command_three_chances_init, ACV_THREE_CHANCES_TURBO_CHARGE) Call(SetActionHudPrepareTime, 0) Call(UseIdleAnimation, ACTOR_PLAYER, FALSE) Wait(5) @@ -1195,7 +1195,7 @@ EvtScript N(EVS_TurboCharge_ImmobilePlayer) = { Wait(1) Call(SetActorYaw, ACTOR_PARTNER, 180) Wait(10) - Call(action_command_water_block_start, 0, 100 * DT, 3) + Call(action_command_three_chances_start, 0, 100 * DT, AC_DIFFICULTY_3) Call(AddBattleCamDist, -100) Call(MoveBattleCamOver, 100 * DT) Call(SetBattleCamTargetingModes, BTL_CAM_YADJ_NONE, BTL_CAM_XADJ_NONE, TRUE) @@ -1222,7 +1222,7 @@ EvtScript N(EVS_TurboCharge_ImmobilePlayer) = { Call(UseBattleCamPreset, BTL_CAM_DEFAULT) Call(MoveBattleCamOver, 10) Call(PlaySoundAtActor, ACTOR_PARTNER, SOUND_GROW) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Call(N(ApplyTurboCharge)) Set(LVarE, LVarF) IfGt(LVarA, 0) @@ -1283,7 +1283,7 @@ EvtScript N(EVS_Attack_MegaShock) = { EndLoop EndThread Call(N(AverageTargetParalyzeChance)) - Call(action_command_mega_shock_start, 0, 87 * DT, 3, LVar0) + Call(action_command_mega_shock_start, 0, 87 * DT, AC_DIFFICULTY_3, LVar0) Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2) Add(LVar1, 15) Add(LVar2, 5) @@ -1297,7 +1297,7 @@ EvtScript N(EVS_Attack_MegaShock) = { Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_BattleWatt_StrainBigger) Call(SetActorPaletteEffect, ACTOR_SELF, PRT_MAIN, ACTOR_PAL_ADJUST_WATT_ATTACK) Call(N(WattFXDisable)) - Call(GetActionQuality, LVar1) + Call(GetActionProgress, LVar1) Wait(90 * DT) Call(N(SetBackgroundAlpha), 0) Thread @@ -1341,13 +1341,13 @@ EvtScript N(EVS_Attack_MegaShock) = { Thread Call(N(PowerShockDischargeFX), 10) EndThread - Call(GetActionQuality, LVar0) + Call(GetActionProgress, LVar0) Call(GetActorPos, ACTOR_PARTNER, LVar1, LVar2, LVar3) Add(LVar2, 12) Call(N(MegaShockFX), LVar0, LVar1, LVar2, LVar3) Loop(0) Call(SetGoalToTarget, ACTOR_SELF) - Call(GetPartnerActionSuccess, LVarF) + Call(GetPartnerActionQuality, LVarF) Call(PartnerTestEnemy, LVar0, 0, SUPPRESS_EVENT_SPIKY_FRONT | SUPPRESS_EVENT_BURN_CONTACT, 0, 1, BS_FLAGS1_INCLUDE_POWER_UPS) IfEq(LVar0, HIT_RESULT_MISS) Goto(11) @@ -1367,7 +1367,7 @@ EvtScript N(EVS_Attack_MegaShock) = { Call(N(WattFXEnable)) Call(PartnerYieldTurn) Wait(30) - Call(GetPartnerActionSuccess, LVar0) + Call(GetPartnerActionQuality, LVar0) Switch(LVar0) CaseGt(99) ExecWait(N(EVS_ReturnHome_Success)) diff --git a/src/battle/player_events.c b/src/battle/player_events.c index ea114a3e429..21b5063c382 100644 --- a/src/battle/player_events.c +++ b/src/battle/player_events.c @@ -23,10 +23,10 @@ BSS s32 BattleMerleeEffectsTime; BSS f32 BattleMerleeBasePosY; BSS EffectInstance* BattleMerleeOrbEffect; BSS EffectInstance* BattleMerleeWaveEffect; -BSS s32 HID_Refund; +BSS HudElemID HID_Refund; BSS s16 BattleMerleeEffectsState; -BSS s32 HID_Happy; -BSS s32 HID_HPDrain; +BSS HudElemID HID_Happy; +BSS HudElemID HID_HPDrain; BSS s32 D_8029FBB0[3]; enum { @@ -242,7 +242,7 @@ API_CALLABLE(LifeShroomShroudWorld) { mdl_set_shroud_tint_params(0, 0, 0, ((20 - script->functionTemp[0]) * 12) & 0xFC); - script->functionTemp[0] -= 1; + script->functionTemp[0]--; if (script->functionTemp[0] == 0) { return ApiStatus_DONE2; @@ -259,7 +259,7 @@ API_CALLABLE(LifeShroomRevealWorld) { mdl_set_shroud_tint_params(0, 0, 0, (script->functionTemp[0] * 12) & 0xFC); - script->functionTemp[0] -= 1; + script->functionTemp[0]--; if (script->functionTemp[0] == 0) { mdl_set_shroud_tint_params(0, 0, 0, 0); return ApiStatus_DONE2; @@ -857,7 +857,7 @@ EvtScript EVS_Player_HandleEvent = { CaseNe(EVENT_32) Call(UseIdleAnimation, ACTOR_PLAYER, FALSE) EndSwitch - Call(CloseActionCommandInfo) + Call(InterruptActionCommand) Call(SetBattleFlagBits, BS_FLAGS1_EXECUTING_MOVE, FALSE) Call(func_802693F0) Call(ForceDisablePlayerBlurImmediately) @@ -1172,7 +1172,7 @@ EvtScript EVS_RunAwayNoCommand = { EvtScript EVS_RunAwayStart = { Call(UseIdleAnimation, ACTOR_PLAYER, FALSE) Call(GetActionCommandMode, LVar2) - IfEq(LVar2, ACTION_COMMAND_MODE_NOT_LEARNED) + IfEq(LVar2, AC_MODE_NOT_LEARNED) ExecWait(EVS_RunAwayNoCommand) Call(UseIdleAnimation, ACTOR_PLAYER, TRUE) Return @@ -1197,7 +1197,7 @@ EvtScript EVS_RunAwayStart = { Wait(1) Call(SetActorYaw, ACTOR_PLAYER, 180) Wait(5) - Call(action_command_flee_start, 0, 60, 3) + Call(action_command_flee_start, 0, 60, AC_DIFFICULTY_3) Call(func_80260E5C) Wait(5) Call(AddActorPos, ACTOR_PLAYER, 2, 0, 0) @@ -1222,7 +1222,7 @@ EvtScript EVS_RunAwayStart = { Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_Land) Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2) Call(PlayerHopToGoal, 8, 0, 0) - Call(GetActionSuccess, LVar0) + Call(GetSmashActionQuality, LVar0) Call(DetermineAutoRunAwaySuccess) IfEq(LVar0, 1) Call(SetFledBattleFlag) diff --git a/src/battle/popup_messages.c b/src/battle/popup_messages.c index 877555e5ad0..af9e7e6f181 100644 --- a/src/battle/popup_messages.c +++ b/src/battle/popup_messages.c @@ -765,7 +765,7 @@ void btl_update_message_popup(void* data) { case BTL_MSG_ACTION_TIP_NOT_USED_3: actionCommandMode = battleStatus->actionCommandMode; ActionCommandTipVisible = TRUE; - if (actionCommandMode == ACTION_COMMAND_MODE_NOT_LEARNED) { + if (actionCommandMode == AC_MODE_NOT_LEARNED) { ActionCommandTipVisible = FALSE; shouldDisposeWindow = TRUE; break; @@ -920,7 +920,7 @@ void btl_update_message_popup(void* data) { } if (!(gBattleStatus.flags1 & BS_FLAGS1_4000) - && (actionCommandMode != ACTION_COMMAND_MODE_TUTORIAL) + && (actionCommandMode != AC_MODE_TUTORIAL) ) { set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW_TRANSPARENT); switch (popup->messageIndex) { @@ -999,7 +999,7 @@ void btl_update_message_popup(void* data) { } break; case BTL_MSG_STATE_ACTION_TIP_DISPOSE: - if ((actionCommandMode != ACTION_COMMAND_MODE_TUTORIAL) + if ((actionCommandMode != AC_MODE_TUTORIAL) || (gBattleStatus.flags1 & BS_FLAGS1_10000) ) { s16* duration; diff --git a/src/battle/use_moves.c b/src/battle/use_moves.c index 1aa82dc86b4..c3bac30debe 100644 --- a/src/battle/use_moves.c +++ b/src/battle/use_moves.c @@ -15,7 +15,7 @@ extern EvtScript battle_move_auto_smash_EVS_UseMove; extern EvtScript battle_move_power_smash_EVS_UseMove; extern EvtScript battle_move_super_smash_EVS_UseMove; extern EvtScript battle_move_mega_smash_EVS_UseMove; -extern EvtScript battle_move_quake_hammer_EVS_UseMove0; +extern EvtScript battle_move_quake_hammer_EVS_UseMove; extern EvtScript battle_move_power_quake_EVS_UseMove; extern EvtScript battle_move_mega_quake_EVS_UseMove; extern EvtScript battle_move_hammer_throw_EVS_UseMove; @@ -27,12 +27,12 @@ extern EvtScript battle_move_shell_crack_EVS_UseMove; extern EvtScript battle_move_jump_attack_EVS_UseMove; extern EvtScript battle_move_jump_attack_EVS_FirstStrike; extern EvtScript battle_move_jump_attack_EVS_UseBerserker; -extern EvtScript battle_move_jump_charge_0_EVS_UseMove0; -extern EvtScript battle_move_jump_charge_0_EVS_UseMove1; -extern EvtScript battle_move_jump_charge_1_EVS_UseMove0; -extern EvtScript battle_move_jump_charge_1_EVS_UseMove1; -extern EvtScript battle_move_jump_charge_2_EVS_UseMove0; -extern EvtScript battle_move_jump_charge_2_EVS_UseMove1; +extern EvtScript battle_move_jump_charge_0_EVS_UseMove; +extern EvtScript battle_move_jump_charge_0_EVS_UseMove_Unimplemented; +extern EvtScript battle_move_jump_charge_1_EVS_UseMove; +extern EvtScript battle_move_jump_charge_1_EVS_UseMove_Unimplemented; +extern EvtScript battle_move_jump_charge_2_EVS_UseMove; +extern EvtScript battle_move_jump_charge_2_EVS_UseMove_Unimplemented; extern EvtScript battle_move_auto_jump_EVS_UseMove; extern EvtScript battle_move_power_jump_EVS_UseMove; extern EvtScript battle_move_super_jump_EVS_UseMove; @@ -56,7 +56,7 @@ BattleMoveEntry gMoveScriptTable[] = { [MOVE_FIRST_STRIKE_HAMMER] BTL_MOVE(hammer_attack, EVS_FirstStrike), [MOVE_BERSERKER_HAMMER] BTL_MOVE(hammer_attack, EVS_UseBerserker), [MOVE_SPIN_SMASH] BTL_MOVE(spin_smash, EVS_UseMove), - [MOVE_QUAKE_HAMMER] BTL_MOVE(quake_hammer, EVS_UseMove0), + [MOVE_QUAKE_HAMMER] BTL_MOVE(quake_hammer, EVS_UseMove), [MOVE_D_DOWN_POUND] BTL_MOVE(d_down_pound, EVS_UseMove), [MOVE_SMASH_CHARGE0] BTL_MOVE(hammer_charge_0, EVS_UseMove0), [MOVE_UNUSED_HAMMER_0C] BTL_MOVE(hammer_charge_0, EVS_UseMove1), @@ -82,12 +82,12 @@ BattleMoveEntry gMoveScriptTable[] = { [MOVE_POWER_BOUNCE] BTL_MOVE(power_bounce, EVS_UseMove), [MOVE_SLEEP_STOMP] BTL_MOVE(sleep_stomp, EVS_UseMove), [MOVE_DIZZY_STOMP] BTL_MOVE(dizzy_stomp, EVS_UseMove), - [MOVE_JUMP_CHARGE0] BTL_MOVE(jump_charge_0, EVS_UseMove0), - [MOVE_UNUSED_24] BTL_MOVE(jump_charge_0, EVS_UseMove1), - [MOVE_JUMP_CHARGE] BTL_MOVE(jump_charge_1, EVS_UseMove0), - [MOVE_UNUSED_26] BTL_MOVE(jump_charge_1, EVS_UseMove1), - [MOVE_SUPER_JUMP_CHARGE] BTL_MOVE(jump_charge_2, EVS_UseMove0), - [MOVE_UNUSED_28] BTL_MOVE(jump_charge_2, EVS_UseMove1), + [MOVE_JUMP_CHARGE0] BTL_MOVE(jump_charge_0, EVS_UseMove), + [MOVE_UNUSED_24] BTL_MOVE(jump_charge_0, EVS_UseMove_Unimplemented), + [MOVE_JUMP_CHARGE] BTL_MOVE(jump_charge_1, EVS_UseMove), + [MOVE_UNUSED_26] BTL_MOVE(jump_charge_1, EVS_UseMove_Unimplemented), + [MOVE_SUPER_JUMP_CHARGE] BTL_MOVE(jump_charge_2, EVS_UseMove), + [MOVE_UNUSED_28] BTL_MOVE(jump_charge_2, EVS_UseMove_Unimplemented), [MOVE_AUTO_JUMP] BTL_MOVE(auto_jump, EVS_UseMove), [MOVE_AUTO_MULTIBOUNCE] BTL_MOVE(auto_multibounce, EVS_UseMove), [MOVE_POWER_JUMP] BTL_MOVE(power_jump, EVS_UseMove), diff --git a/src/cam_main.c b/src/cam_main.c index 01516d79ec7..874c35753d7 100644 --- a/src/cam_main.c +++ b/src/cam_main.c @@ -205,8 +205,8 @@ void render_frame(s32 isSecondPass) { } render_player(); render_npcs(); - render_workers_world(); - render_effects_world(); + render_workers_scene(); + render_effects_scene(); execute_render_tasks(); render_transformed_hud_elements(); } else { @@ -219,7 +219,7 @@ void render_frame(s32 isSecondPass) { render_item_entities(); } } else { - render_workers_world(); + render_workers_scene(); execute_render_tasks(); } diff --git a/src/common/RemoveChillOut.inc.c b/src/common/RemoveChillOut.inc.c index 788854bc9d0..e868c6ad480 100644 --- a/src/common/RemoveChillOut.inc.c +++ b/src/common/RemoveChillOut.inc.c @@ -1,13 +1,14 @@ #include "common.h" #include "map.h" +#include "hud_element.h" API_CALLABLE(N(RemoveChillOut)) { Actor* actor = get_actor(script->owner1.actorID); - s32 hudElementDataIndex = actor->hudElementDataIndex; + HudElemID hid = actor->hudElementDataIndex; actor->chillOutTurns = 0; actor->chillOutAmount = 0; - remove_status_chill_out(hudElementDataIndex); + remove_status_chill_out(hid); return ApiStatus_DONE2; } diff --git a/src/draw_box.c b/src/draw_box.c index 3602ab8363b..84ea34dd699 100644 --- a/src/draw_box.c +++ b/src/draw_box.c @@ -537,7 +537,6 @@ s32 draw_box(s32 flags, WindowStyle windowStyle, s32 posX, s32 posY, s32 posZ, s masks = INTEGER_LOG2(cornerWidth); maskt = INTEGER_LOG2(cornerHeight); - switch (cornersBitDepth) { case G_IM_SIZ_4b: gDPLoadMultiTile_4b(gMainGfxPos++, cornersImage, tmem, 1, cornersFmt, cornerWidth, cornerHeight, 0, 0, cornerWidth - 1, cornerHeight - 1, 0, G_TX_CLAMP, G_TX_CLAMP, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); @@ -743,7 +742,6 @@ s32 draw_box(s32 flags, WindowStyle windowStyle, s32 posX, s32 posY, s32 posZ, s quads[3].v.ob[1] = height / 2; quads[3].v.ob[2] = 0; - quads[0].v.tc[0] = 0; quads[0].v.tc[1] = 0; diff --git a/src/draw_img_util.c b/src/draw_img_util.c index e01d427d0c9..17e495018ff 100644 --- a/src/draw_img_util.c +++ b/src/draw_img_util.c @@ -410,7 +410,6 @@ s32 draw_adjustable_tiled_image(IMG_PTR raster, u32 width, u32 height, u8 fmt, u drawRect.lry = drawRect.uly + lineHeight * scaleY; drawRect.lrx = (s16)(drawRect.ulx + width * scaleX); - texOffsetX = texOffsetY = 0; if (drawRect.lry <= clipY) { diff --git a/src/effects.c b/src/effects.c index 7dc47c95032..086d91e4cd8 100644 --- a/src/effects.c +++ b/src/effects.c @@ -2,20 +2,24 @@ #include "effects.h" #include "ld_addrs.h" -typedef s32 TlbEntry[0x1000 / 4]; +typedef s8 TlbEntry[0x1000]; typedef TlbEntry TlbMappablePage[15]; #define EFFECT_GLOBALS_TLB_IDX 0x10 -BSS EffectGraphics gEffectGraphicsData[15]; +BSS EffectSharedData gEffectSharedData[15]; EffectInstance* gEffectInstances[96]; extern TlbMappablePage gEffectDataBuffer; extern Addr gEffectGlobals; #define FX_ENTRY(name, gfx_name) { \ - name##_main, effect_##name##_ROM_START, effect_##name##_ROM_END, effect_##name##_VRAM, gfx_name##_ROM_START, \ - gfx_name##_ROM_END \ + .entryPoint = name##_main, \ + .dmaStart = effect_##name##_ROM_START, \ + .dmaEnd = effect_##name##_ROM_END, \ + .dmaDest = effect_##name##_VRAM, \ + .graphicsDmaStart = gfx_name##_ROM_START, \ + .graphicsDmaEnd = gfx_name##_ROM_END, \ } #include "effects/effect_table.c" @@ -37,8 +41,8 @@ void set_effect_pos_offset(EffectInstance* effect, f32 x, f32 y, f32 z) { void clear_effect_data(void) { s32 i; - for (i = 0; i < ARRAY_COUNT(gEffectGraphicsData); i++) { - gEffectGraphicsData[i].flags = 0; + for (i = 0; i < ARRAY_COUNT(gEffectSharedData); i++) { + gEffectSharedData[i].flags = 0; } for (i = 0; i < ARRAY_COUNT(gEffectInstances); i++) { @@ -55,15 +59,15 @@ void func_80059D48(void) { void update_effects(void) { if (!(gOverrideFlags & (GLOBAL_OVERRIDES_800 | GLOBAL_OVERRIDES_400))) { - EffectGraphics* effectGraphics; + EffectSharedData* sharedData; s32 i; - // reset free delay for each EffectGraphics touched in previous update - for (i = 0, effectGraphics = gEffectGraphicsData; i < ARRAY_COUNT(gEffectGraphicsData); i++, effectGraphics++) { - if (effectGraphics->flags & FX_GRAPHICS_LOADED) { - if (!(effectGraphics->flags & FX_GRAPHICS_CAN_FREE)) { - effectGraphics->flags |= FX_GRAPHICS_CAN_FREE; - effectGraphics->freeDelay = 3; + // reset free delay for each EffectSharedData touched in previous update + for (i = 0, sharedData = gEffectSharedData; i < ARRAY_COUNT(gEffectSharedData); i++, sharedData++) { + if (sharedData->flags & FX_SHARED_DATA_LOADED) { + if (!(sharedData->flags & FX_SHARED_DATA_CAN_FREE)) { + sharedData->flags |= FX_SHARED_DATA_CAN_FREE; + sharedData->freeDelay = 3; } } } @@ -73,34 +77,34 @@ void update_effects(void) { EffectInstance* effectInstance = gEffectInstances[i]; if (effectInstance != NULL && (effectInstance->flags & FX_INSTANCE_FLAG_ENABLED)) { - effectInstance->graphics->flags &= ~FX_GRAPHICS_CAN_FREE; + effectInstance->shared->flags &= ~FX_SHARED_DATA_CAN_FREE; if (gGameStatusPtr->context != CONTEXT_WORLD) { if (effectInstance->flags & FX_INSTANCE_FLAG_BATTLE) { - effectInstance->graphics->update(effectInstance); + effectInstance->shared->update(effectInstance); effectInstance->flags |= FX_INSTANCE_FLAG_HAS_UPDATED; } } else { if (!(effectInstance->flags & FX_INSTANCE_FLAG_BATTLE)) { - effectInstance->graphics->update(effectInstance); + effectInstance->shared->update(effectInstance); effectInstance->flags |= FX_INSTANCE_FLAG_HAS_UPDATED; } } } } - // free any EffectGraphics which haven't been used recently - for (i = 0, effectGraphics = gEffectGraphicsData; i < ARRAY_COUNT(gEffectGraphicsData); i++, effectGraphics++) { - if (effectGraphics->flags & FX_GRAPHICS_LOADED) { - if (effectGraphics->flags & FX_GRAPHICS_CAN_FREE) { - if (effectGraphics->freeDelay != 0) { - effectGraphics->freeDelay--; + // free any EffectSharedData which haven't been used recently + for (i = 0, sharedData = gEffectSharedData; i < ARRAY_COUNT(gEffectSharedData); i++, sharedData++) { + if (sharedData->flags & FX_SHARED_DATA_LOADED) { + if (sharedData->flags & FX_SHARED_DATA_CAN_FREE) { + if (sharedData->freeDelay != 0) { + sharedData->freeDelay--; } else { - if (effectGraphics->data != NULL) { - general_heap_free(effectGraphics->data); - effectGraphics->data = NULL; + if (sharedData->graphics != NULL) { + general_heap_free(sharedData->graphics); + sharedData->graphics = NULL; } - effectGraphics->flags = FX_GRAPHICS_DISABLED; + sharedData->flags = 0; osUnmapTLB(i); } } @@ -109,7 +113,7 @@ void update_effects(void) { } } -void render_effects_world(void) { +void render_effects_scene(void) { s32 i; for (i = 0; i < ARRAY_COUNT(gEffectInstances); i++) { @@ -120,11 +124,11 @@ void render_effects_world(void) { if (effectInstance->flags & FX_INSTANCE_FLAG_HAS_UPDATED) { if (gGameStatusPtr->context != CONTEXT_WORLD) { if (effectInstance->flags & FX_INSTANCE_FLAG_BATTLE) { - effectInstance->graphics->renderWorld(effectInstance); + effectInstance->shared->renderScene(effectInstance); } } else { if (!(effectInstance->flags & FX_INSTANCE_FLAG_BATTLE)) { - effectInstance->graphics->renderWorld(effectInstance); + effectInstance->shared->renderScene(effectInstance); } } } @@ -153,7 +157,7 @@ void render_effects_UI(void) { continue; } - renderUI = effectInstance->graphics->renderUI; + renderUI = effectInstance->shared->renderUI; if (renderUI != stub_effect_delegate) { if (cond) { Camera* camera = &gCameras[gCurrentCameraID]; @@ -189,7 +193,7 @@ void render_effects_UI(void) { EffectInstance* create_effect_instance(EffectBlueprint* effectBp) { EffectInstance* newEffectInst; - EffectGraphics* effectGraphics; + EffectSharedData* sharedData; s32 i; // Search for an unused instance @@ -205,41 +209,41 @@ EffectInstance* create_effect_instance(EffectBlueprint* effectBp) { gEffectInstances[i] = newEffectInst = general_heap_malloc(sizeof(*newEffectInst)); ASSERT(newEffectInst != NULL); - effectGraphics = &gEffectGraphicsData[0]; - newEffectInst->effectIndex = effectBp->effectID; + sharedData = &gEffectSharedData[0]; + newEffectInst->effectID = effectBp->effectID; newEffectInst->flags = FX_INSTANCE_FLAG_ENABLED; // Look for a loaded effect of the proper index - for (i = 0; i < ARRAY_COUNT(gEffectGraphicsData); i++) { - if ((effectGraphics->flags & FX_GRAPHICS_LOADED) && (effectGraphics->effectIndex == effectBp->effectID)) { + for (i = 0; i < ARRAY_COUNT(gEffectSharedData); i++) { + if ((sharedData->flags & FX_SHARED_DATA_LOADED) && (sharedData->effectIndex == effectBp->effectID)) { break; } - effectGraphics++; + sharedData++; } - ASSERT(i < ARRAY_COUNT(gEffectGraphicsData)); + ASSERT(i < ARRAY_COUNT(gEffectSharedData)); // If this is the first new instance of the effect, initialize the function pointers - if (effectGraphics->instanceCounter == 0) { - effectGraphics->update = effectBp->update; - if (effectGraphics->update == NULL) { - effectGraphics->renderWorld = stub_effect_delegate; + if (sharedData->instanceCounter == 0) { + sharedData->update = effectBp->update; + if (sharedData->update == NULL) { + sharedData->renderScene = stub_effect_delegate; } - effectGraphics->renderWorld = effectBp->renderWorld; + sharedData->renderScene = effectBp->renderScene; /// @bug? null check for renderUI instead of renderWorld - if (effectGraphics->renderUI == NULL) { - effectGraphics->renderUI = stub_effect_delegate; + if (sharedData->renderUI == NULL) { + sharedData->renderUI = stub_effect_delegate; } - effectGraphics->renderUI = effectBp->renderUI; - if (effectGraphics->renderUI == NULL) { - effectGraphics->renderUI = stub_effect_delegate; + sharedData->renderUI = effectBp->renderUI; + if (sharedData->renderUI == NULL) { + sharedData->renderUI = stub_effect_delegate; } } - effectGraphics->instanceCounter++; - newEffectInst->graphics = effectGraphics; + sharedData->instanceCounter++; + newEffectInst->shared = sharedData; if (effectBp->init != NULL) { effectBp->init(newEffectInst); @@ -290,55 +294,53 @@ void remove_all_effects(void) { s32 load_effect(s32 effectIndex) { EffectTableEntry* effectEntry = &gEffectTable[effectIndex]; - EffectGraphics* effectGraphics; - TlbMappablePage* tlbMappablePages; + EffectSharedData* sharedData; s32 i; // Look for a loaded effect matching the desired index - for (i = 0, effectGraphics = &gEffectGraphicsData[0]; i < ARRAY_COUNT(gEffectGraphicsData); i++) { - if (effectGraphics->flags & FX_GRAPHICS_LOADED && effectGraphics->effectIndex == effectIndex) { + for (i = 0, sharedData = &gEffectSharedData[0]; i < ARRAY_COUNT(gEffectSharedData); i++) { + if (sharedData->flags & FX_SHARED_DATA_LOADED && sharedData->effectIndex == effectIndex) { break; } - effectGraphics++; + sharedData++; } // If an effect was found within the table, initialize it and return - if (i < ARRAY_COUNT(gEffectGraphicsData)) { - effectGraphics->effectIndex = effectIndex; - effectGraphics->instanceCounter = 0; - effectGraphics->flags = FX_GRAPHICS_LOADED; + if (i < ARRAY_COUNT(gEffectSharedData)) { + sharedData->effectIndex = effectIndex; + sharedData->instanceCounter = 0; + sharedData->flags = FX_SHARED_DATA_LOADED; return 1; } // If a loaded effect wasn't found, look for the first empty space - for (i = 0, effectGraphics = &gEffectGraphicsData[0]; i < ARRAY_COUNT(gEffectGraphicsData); i++) { - if (!(effectGraphics->flags & FX_GRAPHICS_LOADED)) { + for (i = 0, sharedData = &gEffectSharedData[0]; i < ARRAY_COUNT(gEffectSharedData); i++) { + if (!(sharedData->flags & FX_SHARED_DATA_LOADED)) { break; } - effectGraphics++; + sharedData++; } // If no empty space was found, panic - ASSERT(i < ARRAY_COUNT(gEffectGraphicsData)); + ASSERT(i < ARRAY_COUNT(gEffectSharedData)); // Map space for the effect - tlbMappablePages = &gEffectDataBuffer; - osMapTLB(i, OS_PM_4K, effectEntry->dmaDest, (s32)((*tlbMappablePages)[i]) & 0xFFFFFF, -1, -1); + osMapTLB(i, OS_PM_4K, effectEntry->dmaDest, (s32)(gEffectDataBuffer[i]) & 0xFFFFFF, -1, -1); // Copy the effect into the newly mapped space dma_copy(effectEntry->dmaStart, effectEntry->dmaEnd, effectEntry->dmaDest); // If there's graphics data for the effect, allocate space and copy into the new space if (effectEntry->graphicsDmaStart != NULL) { - void* effectDataBuf = general_heap_malloc(effectEntry->graphicsDmaEnd - effectEntry->graphicsDmaStart); - effectGraphics->data = effectDataBuf; - ASSERT(effectDataBuf != NULL); - dma_copy(effectEntry->graphicsDmaStart, effectEntry->graphicsDmaEnd, effectGraphics->data); + void* graphics = general_heap_malloc(effectEntry->graphicsDmaEnd - effectEntry->graphicsDmaStart); + sharedData->graphics = graphics; + ASSERT(graphics != NULL); + dma_copy(effectEntry->graphicsDmaStart, effectEntry->graphicsDmaEnd, sharedData->graphics); } // Initialize the newly loaded effect data - effectGraphics->effectIndex = effectIndex; - effectGraphics->instanceCounter = 0; - effectGraphics->flags = FX_GRAPHICS_LOADED; + sharedData->effectIndex = effectIndex; + sharedData->instanceCounter = 0; + sharedData->flags = FX_SHARED_DATA_LOADED; return 1; } diff --git a/src/effects/attack_result_text.c b/src/effects/attack_result_text.c index afe7af4d0bd..e108d48db44 100644 --- a/src/effects/attack_result_text.c +++ b/src/effects/attack_result_text.c @@ -43,7 +43,7 @@ EffectInstance* attack_result_text_main(s32 type, f32 posX, f32 posY, f32 posZ, bp.unk_00 = 0; bp.init = attack_result_text_init; bp.update = attack_result_text_update; - bp.renderWorld = attack_result_text_render; + bp.renderScene = attack_result_text_render; bp.renderUI = func_E0090428; bp.effectID = EFFECT_ATTACK_RESULT_TEXT; @@ -183,7 +183,7 @@ void func_E0090444(EffectInstance* effect) { if (data->isVisible) { scale = data->scale; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->shared->graphics)); gDPSetDepthSource(gMainGfxPos++, G_ZS_PRIM); z = 200 - unk_1C; if (z < 0) { diff --git a/src/effects/aura.c b/src/effects/aura.c index 42c1d02fab9..c03fc2f3244 100644 --- a/src/effects/aura.c +++ b/src/effects/aura.c @@ -13,35 +13,35 @@ extern Gfx D_09002428_37A3A8[]; extern Gfx D_09002440_37A3C0[]; extern Gfx D_09002458_37A3D8[]; -Gfx* D_E0076E90[] = { +Gfx* D_E0076E90[] = { [FX_AURA_CAPTURE] D_090023E0_37A360, [FX_AURA_RED] D_090023E0_37A360, [FX_AURA_BLUE] D_09002440_37A3C0, [FX_AURA_GOLD] D_09002440_37A3C0 }; -Gfx* D_E0076EA0[] = { +Gfx* D_E0076EA0[] = { [FX_AURA_CAPTURE] D_090023F8_37A378, [FX_AURA_RED] D_090023F8_37A378, [FX_AURA_BLUE] D_09002458_37A3D8, [FX_AURA_GOLD] D_09002458_37A3D8 }; -Gfx* D_E0076EB0[] = { +Gfx* D_E0076EB0[] = { [FX_AURA_CAPTURE] D_090023B0_37A330, [FX_AURA_RED] D_090023B0_37A330, [FX_AURA_BLUE] D_09002410_37A390, [FX_AURA_GOLD] D_09002410_37A390 }; -Gfx* D_E0076EC0[] = { +Gfx* D_E0076EC0[] = { [FX_AURA_CAPTURE] D_090023C8_37A348, [FX_AURA_RED] D_090023C8_37A348, [FX_AURA_BLUE] D_09002428_37A3A8, [FX_AURA_GOLD] D_09002428_37A3A8 }; -Gfx* D_E0076ED0[] = { +Gfx* D_E0076ED0[] = { [FX_AURA_CAPTURE] D_09002000_379F80, [FX_AURA_RED] D_09002000_379F80, [FX_AURA_BLUE] D_090020E8_37A068, @@ -63,7 +63,7 @@ void aura_main(s32 type, f32 posX, f32 posY, f32 posZ, f32 scale, EffectInstance bp.init = aura_init; bp.update = aura_update; - bp.renderWorld = aura_render; + bp.renderScene = aura_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_AURA; @@ -300,7 +300,7 @@ void aura_appendGfx(void* argEffect) { s32 primA = data->primA; s32 v1, v2; - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_E0076ED0[type]); guTranslateF(translateMtx, data->posB.x, data->posB.y, data->posB.z); diff --git a/src/effects/balloon.c b/src/effects/balloon.c index 4c8fd93a4b6..35b365edf72 100644 --- a/src/effects/balloon.c +++ b/src/effects/balloon.c @@ -22,7 +22,7 @@ EffectInstance* balloon_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s bp.init = balloon_init; bp.update = balloon_update; - bp.renderWorld = balloon_render; + bp.renderScene = balloon_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_BALLOON; @@ -90,7 +90,7 @@ void balloon_appendGfx(void* effect) { s32 idx = data->unk_00; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, data->unk_04, data->unk_08, data->unk_0C); guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); diff --git a/src/effects/big_smoke_puff.c b/src/effects/big_smoke_puff.c index 84d43af3a5d..49d70e58438 100644 --- a/src/effects/big_smoke_puff.c +++ b/src/effects/big_smoke_puff.c @@ -38,7 +38,7 @@ void big_smoke_puff_main(f32 x, f32 y, f32 z) { bp.unk_00 = 0; bp.init = big_smoke_puff_init; bp.update = big_smoke_puff_update; - bp.renderWorld = big_smoke_puff_render; + bp.renderScene = big_smoke_puff_render; bp.renderUI = NULL; bp.effectID = EFFECT_BIG_SMOKE_PUFF; @@ -126,7 +126,7 @@ void big_smoke_puff_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guPositionF(mtx, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, data->x, data->y, data->z); guMtxF2L(mtx, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/big_snowflakes.c b/src/effects/big_snowflakes.c index afc780578ee..67e1523c3f2 100644 --- a/src/effects/big_snowflakes.c +++ b/src/effects/big_snowflakes.c @@ -23,7 +23,7 @@ void big_snowflakes_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3) { bp.unk_00 = 0; bp.init = big_snowflakes_init; bp.update = big_snowflakes_update; - bp.renderWorld = big_snowflakes_render; + bp.renderScene = big_snowflakes_render; bp.renderUI = NULL; bp.effectID = EFFECT_BIG_SNOWFLAKES; @@ -115,7 +115,7 @@ void big_snowflakes_appendGfx(void* effect) { Gfx* dlist = D_E0060738[0]; s32 i; - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, dlist); gDPSetPrimColor(gMainGfxPos++, 0, 0, 20, 100, 20, data->unk_24); diff --git a/src/effects/blast.c b/src/effects/blast.c index 062601a73c1..7d6e7693977 100644 --- a/src/effects/blast.c +++ b/src/effects/blast.c @@ -34,7 +34,7 @@ void blast_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5) { bp.init = blast_init; bp.update = blast_update; - bp.renderWorld = blast_render; + bp.renderScene = blast_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_BLAST; @@ -92,7 +92,7 @@ void blast_render(EffectInstance* effect) { retTask->renderMode |= RENDER_TASK_FLAG_REFLECT_FLOOR; } -void blast_appendGfx(void *effect) { +void blast_appendGfx(void* effect) { Matrix4f sp18; Matrix4f sp58; Matrix4f sp98; @@ -103,7 +103,7 @@ void blast_appendGfx(void *effect) { s32 envAlpha = (data->unk_20 - unk_20) * t; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09001300_37ECD0); gSPDisplayList(gMainGfxPos++, D_E007C510[unk_20]); diff --git a/src/effects/bombette_breaking.c b/src/effects/bombette_breaking.c index f9b0c77b438..73a8ffb5840 100644 --- a/src/effects/bombette_breaking.c +++ b/src/effects/bombette_breaking.c @@ -61,7 +61,7 @@ EffectInstance* bombette_breaking_main(s32 type, s32 modelID, s32 treeIndex, f32 bp.unk_00 = 0; bp.init = bombette_breaking_init; bp.update = bombette_breaking_update; - bp.renderWorld = bombette_breaking_render; + bp.renderScene = bombette_breaking_render; bp.renderUI = NULL; bp.effectID = EFFECT_BOMBETTE_BREAKING; @@ -217,7 +217,7 @@ void bombette_breaking_appendGfx(void* effect) { timeLeft *= 4; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp20, data->center.x, data->center.y, data->center.z); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW); diff --git a/src/effects/breaking_junk.c b/src/effects/breaking_junk.c index a92f5456cf8..3793e66fbcf 100644 --- a/src/effects/breaking_junk.c +++ b/src/effects/breaking_junk.c @@ -28,7 +28,7 @@ EffectInstance* breaking_junk_main(s32 arg0, f32 x, f32 y, f32 z, f32 scale, s32 bp.unk_00 = 0; bp.init = breaking_junk_init; bp.update = breaking_junk_update; - bp.renderWorld = breaking_junk_render; + bp.renderScene = breaking_junk_render; bp.renderUI = NULL; bp.effectID = EFFECT_BREAKING_JUNK; @@ -138,7 +138,7 @@ void breaking_junk_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_E01187C0[0]); for (i = 0; i < ((EffectInstance*)effect)->numParts; i++, data++) { diff --git a/src/effects/bulb_glow.c b/src/effects/bulb_glow.c index 404fcb0ae0e..f22e3141f49 100644 --- a/src/effects/bulb_glow.c +++ b/src/effects/bulb_glow.c @@ -55,7 +55,7 @@ void bulb_glow_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f32 arg4, EffectInst bp.init = bulb_glow_init; bp.update = bulb_glow_update; - bp.renderWorld = bulb_glow_render; + bp.renderScene = bulb_glow_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_BULB_GLOW; @@ -183,7 +183,7 @@ void bulb_glow_appendGfx(void* effect) { } gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); temp_s1 = &D_E0078918[type]; glowExtent = temp_s1->unk_10; diff --git a/src/effects/butterflies.c b/src/effects/butterflies.c index 0de39eba678..b79e63822d8 100644 --- a/src/effects/butterflies.c +++ b/src/effects/butterflies.c @@ -39,7 +39,7 @@ EffectInstance* butterflies_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3) { bp.unk_00 = 0; bp.init = butterflies_init; bp.update = butterflies_update; - bp.renderWorld = butterflies_render; + bp.renderScene = butterflies_render; bp.renderUI = NULL; bp.effectID = EFFECT_BUTTERFLIES; @@ -91,7 +91,7 @@ void butterflies_update(EffectInstance* effect) { if (temp_s0->unk_04 < 1000) { temp_s0->unk_04--; } - temp_s0->unk_08 += 1; + temp_s0->unk_08++; if (temp_s0->unk_04 < 0) { remove_effect(effect); return; @@ -160,7 +160,6 @@ void butterflies_render(EffectInstance* effect) { retTask->renderMode |= RENDER_TASK_FLAG_REFLECT_FLOOR; } - void butterflies_appendGfx(void* effect) { EffectInstance* effectTemp = effect; ButterfliesFXData* data = effectTemp->data.butterflies; @@ -171,7 +170,7 @@ void butterflies_appendGfx(void* effect) { s32 type = data->unk_00; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->shared->graphics)); guTranslateF(sp18, data->unk_0C, data->unk_10 + D_E00AA6EC[data->unk_2C] * 0.3f, data->unk_14); guRotateF(sp58, data->unk_28, 0.0f, 1.0f, 0.0f); diff --git a/src/effects/chapter_change.c b/src/effects/chapter_change.c index b4898180fb3..3dcb57f36a5 100644 --- a/src/effects/chapter_change.c +++ b/src/effects/chapter_change.c @@ -181,7 +181,7 @@ EffectInstance* chapter_change_main(s32 arg0, f32 posX, f32 posY, f32 arg3, f32 bp.init = chapter_change_init; bp.update = chapter_change_update; - bp.renderWorld = chapter_change_render; + bp.renderScene = chapter_change_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_CHAPTER_CHANGE; @@ -268,7 +268,7 @@ void chapter_change_appendGfx(void* effect) { UnkStruct* ptr1; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); switch (unk_00) { case 1: diff --git a/src/effects/chomp_drop.c b/src/effects/chomp_drop.c index 64ce7a903ac..e189ce420a7 100644 --- a/src/effects/chomp_drop.c +++ b/src/effects/chomp_drop.c @@ -20,7 +20,7 @@ EffectInstance* chomp_drop_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4 bp.init = chomp_drop_init; bp.update = chomp_drop_update; - bp.renderWorld = chomp_drop_render; + bp.renderScene = chomp_drop_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_CHOMP_DROP; @@ -146,7 +146,7 @@ void chomp_drop_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effectTemp)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effectTemp)->shared->graphics)); guScaleF(sp20, 0.01f, 0.01f, 0.01f); guPositionF(sp60, 0.0f, 0.0f, 0.0f, data->unk_24, data->unk_04 * 100.0f, data->unk_08 * 100.0f, data->unk_0C * 100.0f); diff --git a/src/effects/cloud_puff.c b/src/effects/cloud_puff.c index 9f28d221332..aa966400f1b 100644 --- a/src/effects/cloud_puff.c +++ b/src/effects/cloud_puff.c @@ -20,7 +20,7 @@ void cloud_puff_main(f32 arg0, f32 arg1, f32 arg2, f32 arg3) { bp.unk_00 = 0; bp.init = cloud_puff_init; bp.update = cloud_puff_update; - bp.renderWorld = cloud_puff_render; + bp.renderScene = cloud_puff_render; bp.renderUI = NULL; bp.effectID = EFFECT_CLOUD_PUFF; @@ -120,7 +120,7 @@ void cloud_puff_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_090000E0_32ED30); for (i = 0; i < effectTemp->numParts; i++, part++) { diff --git a/src/effects/cloud_trail.c b/src/effects/cloud_trail.c index c42d1c56478..639aef59ceb 100644 --- a/src/effects/cloud_trail.c +++ b/src/effects/cloud_trail.c @@ -19,7 +19,7 @@ void cloud_trail_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3) { bp.unk_00 = 0; bp.init = cloud_trail_init; bp.update = cloud_trail_update; - bp.renderWorld = cloud_trail_render; + bp.renderScene = cloud_trail_render; bp.renderUI = NULL; bp.effectID = EFFECT_CLOUD_TRAIL; @@ -121,7 +121,7 @@ void cloud_trail_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_090000E0_32ED30); for (i = 0; i < effectTemp->numParts; i++, part++) { diff --git a/src/effects/cold_breath.c b/src/effects/cold_breath.c index 35efa7cfcc7..4e313d08afd 100644 --- a/src/effects/cold_breath.c +++ b/src/effects/cold_breath.c @@ -84,7 +84,7 @@ EffectInstance* cold_breath_main(s32 type, f32 posX, f32 posY, f32 posZ, f32 sca bp.init = cold_breath_init; bp.update = cold_breath_update; - bp.renderWorld = cold_breath_render; + bp.renderScene = cold_breath_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_COLD_BREATH; @@ -194,7 +194,7 @@ void cold_breath_appendGfx(void* effect) { s32 cond; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp20, data->pos.x, data->pos.y, data->pos.z); guScaleF(sp60, data->scale, data->scale, data->scale); diff --git a/src/effects/confetti.c b/src/effects/confetti.c index 962cb44ce5a..c1503b3323a 100644 --- a/src/effects/confetti.c +++ b/src/effects/confetti.c @@ -103,7 +103,7 @@ EffectInstance* confetti_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, bpPtr->init = confetti_init; bpPtr->update = confetti_update; - bpPtr->renderWorld = confetti_render; + bpPtr->renderScene = confetti_render; bpPtr->unk_00 = 0; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_CONFETTI; @@ -267,7 +267,7 @@ void confetti_appendGfx(void* effect) { spA0 = D_E0088CC0[part->unk_00]; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09000940_38C4E0); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); diff --git a/src/effects/damage_indicator.c b/src/effects/damage_indicator.c index 1531f0f928c..f223d9c0bae 100644 --- a/src/effects/damage_indicator.c +++ b/src/effects/damage_indicator.c @@ -89,7 +89,7 @@ void damage_indicator_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f32 starsRadi bp.init = damage_indicator_init; bp.update = damage_indicator_update; - bp.renderWorld = damage_indicator_render; + bp.renderScene = damage_indicator_render; bp.renderUI = damage_indicator_render_ui; bp.unk_00 = 0; bp.effectID = EFFECT_DAMAGE_INDICATOR; @@ -202,7 +202,7 @@ void damage_indicator_render_impl(EffectInstance* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->shared->graphics)); guTranslateF(mtxTransform, part->basePos.x, part->basePos.y, part->basePos.z); guRotateF(mtxTemp, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); diff --git a/src/effects/damage_stars.c b/src/effects/damage_stars.c index 5e55044b997..21d31ff74ea 100644 --- a/src/effects/damage_stars.c +++ b/src/effects/damage_stars.c @@ -86,7 +86,7 @@ void damage_stars_main(s32 type, f32 x, f32 y, f32 z, f32 rotAxisX, f32 rotAxisY bpPtr->unk_00 = 0; bpPtr->init = damage_stars_init; bpPtr->update = damage_stars_update; - bpPtr->renderWorld = damage_stars_render; + bpPtr->renderScene = damage_stars_render; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_DAMAGE_STARS; @@ -241,7 +241,7 @@ void damage_stars_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_090004C0_343500); baseIdx = (part->lifetime - 1) * 3; diff --git a/src/effects/debuff.c b/src/effects/debuff.c index 2c2c330752d..700081ba923 100644 --- a/src/effects/debuff.c +++ b/src/effects/debuff.c @@ -22,7 +22,7 @@ EffectInstance* debuff_main(s32 type, f32 x, f32 y, f32 z) { bp.unk_00 = 0; bp.init = debuff_init; bp.update = debuff_update; - bp.renderWorld = debuff_render; + bp.renderScene = debuff_render; bp.renderUI = NULL; bp.effectID = EFFECT_DEBUFF; @@ -141,7 +141,7 @@ void debuff_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(eff->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(eff->shared->graphics)); gSPDisplayList(gMainGfxPos++, dlist2); guTranslateF(mtxTranslate, data->pos.x, data->pos.y, data->pos.z); diff --git a/src/effects/disable_x.c b/src/effects/disable_x.c index dbf8aadee71..3fa8f1318d5 100644 --- a/src/effects/disable_x.c +++ b/src/effects/disable_x.c @@ -43,7 +43,7 @@ EffectInstance* disable_x_main(s32 type, f32 x, f32 y, f32 z, s32 arg4) { bp.unk_00 = 0; bp.init = disable_x_init; bp.update = disable_x_update; - bp.renderWorld = disable_x_render; + bp.renderScene = disable_x_render; bp.renderUI = func_E0082528; bp.effectID = EFFECT_DISABLE_X; @@ -194,7 +194,7 @@ void disable_x_update(EffectInstance* effect) { if (unk_28 < 10) { data->alpha = unk_28 * 25; } - data->unk_28 += 1; + data->unk_28++; } } @@ -259,7 +259,7 @@ void func_E00828B4(EffectInstance* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->shared->graphics)); func_E0082580(data); unk_38 = data->unk_38; type = data->type; @@ -287,7 +287,7 @@ void func_E0082A84(EffectInstance* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->shared->graphics)); func_E0082580(data); unk_38 = data->unk_38; diff --git a/src/effects/drop_leaves.c b/src/effects/drop_leaves.c index 5afa1afbc32..f1141bdbd99 100644 --- a/src/effects/drop_leaves.c +++ b/src/effects/drop_leaves.c @@ -18,7 +18,7 @@ void drop_leaves_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4) { bp.init = drop_leaves_init; bp.update = drop_leaves_update; - bp.renderWorld = drop_leaves_render; + bp.renderScene = drop_leaves_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_DROP_LEAVES; @@ -133,7 +133,7 @@ void drop_leaves_appendGfx(void* effect) { Matrix4f sp98; s32 i; - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09001180_33E790); gDPSetPrimColor(gMainGfxPos++, 0, 0, 20, 100, 20, part->unk_24); diff --git a/src/effects/dust.c b/src/effects/dust.c index 41716c6bd5a..380bc62112e 100644 --- a/src/effects/dust.c +++ b/src/effects/dust.c @@ -28,7 +28,7 @@ EffectInstance* dust_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4) { bp.init = dust_init; bp.update = dust_update; - bp.renderWorld = dust_render; + bp.renderScene = dust_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_DUST; @@ -134,7 +134,7 @@ void dust_appendGfx(void* effect) { Mtx* matrix; s32 i; - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, part->unk_00 == 0 ? D_09000CC0_33FCC0 : D_09000D68_33FD68); gDPSetPrimColor(gMainGfxPos++, 0, 0, part->unk_30, part->unk_34, part->unk_38, part->unk_18); gDPSetEnvColor(gMainGfxPos++, part->unk_3C, part->unk_40, part->unk_44, 0); diff --git a/src/effects/effect_3D.c b/src/effects/effect_3D.c index b053fe2538d..92e060aa379 100644 --- a/src/effects/effect_3D.c +++ b/src/effects/effect_3D.c @@ -64,7 +64,7 @@ void effect_3D_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, bpPtr->unk_00 = 0; bpPtr->init = effect_3D_init; bpPtr->update = effect_3D_update; - bpPtr->renderWorld = effect_3D_render; + bpPtr->renderScene = effect_3D_render; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_3D; @@ -221,7 +221,7 @@ void effect_3D_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09000240_37D3C0); guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z); diff --git a/src/effects/effect_46.c b/src/effects/effect_46.c index 6e55f9beec2..6666c9de0c4 100644 --- a/src/effects/effect_46.c +++ b/src/effects/effect_46.c @@ -30,7 +30,7 @@ EffectInstance* effect_46_main(s32 type, PlayerStatus* player, f32 scale, s32 du bp.init = effect_46_init; bp.update = effect_46_update; - bp.renderWorld = effect_46_render; + bp.renderScene = effect_46_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_46; @@ -212,7 +212,7 @@ void effect_46_appendGfx(void* effect) { type = part->type; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09000420_38EDB0); guTranslateF(mtxTransform, part->pos.x, part->pos.y, part->pos.z); diff --git a/src/effects/effect_63.c b/src/effects/effect_63.c index e6088339212..d9bb29a459c 100644 --- a/src/effects/effect_63.c +++ b/src/effects/effect_63.c @@ -45,7 +45,7 @@ EffectInstance* effect_63_main( bpPtr->init = effect_63_init; bpPtr->update = effect_63_update; - bpPtr->renderWorld = effect_63_render; + bpPtr->renderScene = effect_63_render; bpPtr->unk_00 = 0; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_63; @@ -222,7 +222,7 @@ void effect_63_appendGfx(void* effect) { if (part->unk_00 != 0) { gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gDPSetPrimColor(gMainGfxPos++, 0, 0, part->unk_28, part->unk_2C, part->unk_30, unk_34); gDPSetEnvColor(gMainGfxPos++, part->unk_38, part->unk_3C, part->unk_40, part->unk_44); gSPDisplayList(gMainGfxPos++, D_E00C6C9C[unk_00]); diff --git a/src/effects/effect_65.c b/src/effects/effect_65.c index 48c85898cb2..e74e1deee2b 100644 --- a/src/effects/effect_65.c +++ b/src/effects/effect_65.c @@ -29,7 +29,7 @@ EffectInstance* effect_65_main( bp.init = effect_65_init; bp.update = effect_65_update; - bp.renderWorld = effect_65_render; + bp.renderScene = effect_65_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_65; @@ -248,7 +248,7 @@ void effect_65_appendGfx(void* effect) { scale = data->scale; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(mtx, 0.0f, 0.0f, 0.0f); guMtxF2L(mtx, &gDisplayContext->matrixStack[gMatrixListPos]); @@ -268,7 +268,7 @@ void effect_65_appendGfx(void* effect) { // reserve space in the display list for the vertices vtxBuffer = (Vtx_t*)gMainGfxPos; gMainGfxPos += VTX_BUF_SIZE; - + firstPointIdx = -1; baseTexOffset = (lifeTime & 0x3F) << 5; diff --git a/src/effects/effect_75.c b/src/effects/effect_75.c index 144369b6710..5c8c60f5372 100644 --- a/src/effects/effect_75.c +++ b/src/effects/effect_75.c @@ -22,7 +22,7 @@ EffectInstance* effect_75_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f32 scale bp.init = effect_75_init; bp.update = effect_75_update; - bp.renderWorld = effect_75_render; + bp.renderScene = effect_75_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_75; @@ -201,7 +201,7 @@ void effect_75_appendGfx(void* effect) { Matrix4f mtxTemp; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(mtxTransfrom, data->pos.x, data->pos.y, data->pos.z); guScaleF(mtxTemp, data->scale, data->scale, data->scale); diff --git a/src/effects/effect_86.c b/src/effects/effect_86.c index 847911115ac..a6cde8f5113 100644 --- a/src/effects/effect_86.c +++ b/src/effects/effect_86.c @@ -37,7 +37,7 @@ EffectInstance* effect_86_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, bp.init = effect_86_init; bp.update = effect_86_update; - bp.renderWorld = effect_86_render; + bp.renderScene = effect_86_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_86; @@ -116,7 +116,7 @@ void effect_86_appendGfx(void* effect) { s32 dlistIdx = part->unk_00; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp10, part->unk_04, part->unk_08, part->unk_0C); guScaleF(sp50, part->unk_34, part->unk_34, part->unk_34); diff --git a/src/effects/embers.c b/src/effects/embers.c index f57bc2d3029..30525f4c8c8 100644 --- a/src/effects/embers.c +++ b/src/effects/embers.c @@ -43,7 +43,7 @@ EffectInstance* embers_main( bp.init = embers_init; bp.update = embers_update; - bp.renderWorld = embers_render; + bp.renderScene = embers_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_EMBERS; @@ -194,7 +194,7 @@ void embers_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp10, part->unk_04, part->unk_08, part->unk_0C); guScaleF(sp50, part->unk_40, part->unk_40, part->unk_40); diff --git a/src/effects/emote.c b/src/effects/emote.c index af46fe4a810..8796ce6875d 100644 --- a/src/effects/emote.c +++ b/src/effects/emote.c @@ -101,7 +101,7 @@ void emote_main(s32 arg0, Npc* arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 bp.unk_00 = 0; bp.init = emote_init; bp.update = emote_update; - bp.renderWorld = emote_render; + bp.renderScene = emote_render; bp.renderUI = NULL; bp.effectID = EFFECT_EMOTE; @@ -218,7 +218,7 @@ void emote_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); if (type != 1) { guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); diff --git a/src/effects/ending_decals.c b/src/effects/ending_decals.c index 1723c337f58..3e1c2e1ed07 100644 --- a/src/effects/ending_decals.c +++ b/src/effects/ending_decals.c @@ -36,7 +36,7 @@ void ending_decals_main(s32 type, f32 posX, f32 posY, f32 posZ, f32 arg4, Effect bp.init = ending_decals_init; bp.update = ending_decals_update; - bp.renderWorld = ending_decals_render; + bp.renderScene = ending_decals_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_ENDING_DECALS; @@ -143,7 +143,7 @@ void ending_decals_appendGfx(void* effect) { dlist2 = D_E00685B0[data->type]; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->scale, data->pos.x, data->pos.y, data->pos.z); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/energy_in_out.c b/src/effects/energy_in_out.c index 6d2f1620c2f..6bc6fc9a426 100644 --- a/src/effects/energy_in_out.c +++ b/src/effects/energy_in_out.c @@ -43,7 +43,7 @@ EffectInstance* energy_in_out_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 a bp.init = energy_in_out_init; bp.update = energy_in_out_update; - bp.renderWorld = energy_in_out_render; + bp.renderScene = energy_in_out_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_ENERGY_IN_OUT; @@ -253,7 +253,7 @@ void energy_in_out_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, scale, part->pos.x, part->pos.y, part->pos.z); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/energy_orb_wave.c b/src/effects/energy_orb_wave.c index 4cdbd9e57a2..4e0df27a846 100644 --- a/src/effects/energy_orb_wave.c +++ b/src/effects/energy_orb_wave.c @@ -20,7 +20,7 @@ EffectInstance* energy_orb_wave_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 bp.init = energy_orb_wave_init; bp.update = energy_orb_wave_update; - bp.renderWorld = energy_orb_wave_render; + bp.renderScene = energy_orb_wave_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_ENERGY_ORB_WAVE; @@ -234,7 +234,7 @@ void energy_orb_wave_appendGfx(void* effect) { Matrix4f sp58; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); guScaleF(sp58, data->scale, data->scale, data->scale); diff --git a/src/effects/energy_shockwave.c b/src/effects/energy_shockwave.c index 19941e7559d..f375572e7d1 100644 --- a/src/effects/energy_shockwave.c +++ b/src/effects/energy_shockwave.c @@ -24,7 +24,7 @@ void energy_shockwave_main( bp.init = energy_shockwave_init; bp.update = energy_shockwave_update; - bp.renderWorld = energy_shockwave_render; + bp.renderScene = energy_shockwave_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_ENERGY_SHOCKWAVE; @@ -147,7 +147,7 @@ void energy_shockwave_appendGfx(void* effect) { s32 ult2; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09000E60_376370); gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 179, 30, data->unk_24); gDPSetEnvColor(gMainGfxPos++, data->unk_50, data->unk_51, data->unk_52, 128); diff --git a/src/effects/explosion.c b/src/effects/explosion.c index d586d783c37..9268151b2d0 100644 --- a/src/effects/explosion.c +++ b/src/effects/explosion.c @@ -35,11 +35,10 @@ void explosion_main(s32 type, f32 x, f32 y, f32 z) { bpPtr->unk_00 = 0; bpPtr->init = explosion_init; bpPtr->update = explosion_update; - bpPtr->renderWorld = explosion_render; + bpPtr->renderScene = explosion_render; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_EXPLOSION; - effect = create_effect_instance(bpPtr); effect->numParts = numParts; effect->data.explosion = data = general_heap_malloc(effect->numParts * sizeof(*data)); @@ -93,7 +92,6 @@ void explosion_main(s32 type, f32 x, f32 y, f32 z) { void explosion_init(EffectInstance* effect) { } - EFFECT_DEF_SMOKE_RING(smoke_ring_main); EFFECT_DEF_CONFETTI(confetti_main); @@ -173,7 +171,7 @@ void explosion_appendGfx(void* effect) { s32 cond; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z); guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); diff --git a/src/effects/falling_leaves.c b/src/effects/falling_leaves.c index 9690e125c5c..4363d935653 100644 --- a/src/effects/falling_leaves.c +++ b/src/effects/falling_leaves.c @@ -18,7 +18,7 @@ void falling_leaves_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3) { bp.init = falling_leaves_init; bp.update = falling_leaves_update; - bp.renderWorld = falling_leaves_render; + bp.renderScene = falling_leaves_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_FALLING_LEAVES; @@ -128,7 +128,7 @@ void falling_leaves_appendGfx(void* effect) { Matrix4f sp98; s32 i; - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09001100_3601E0); gDPSetPrimColor(gMainGfxPos++, 0, 0, 20, 100, 20, part->unk_24); diff --git a/src/effects/fire_breath.c b/src/effects/fire_breath.c index 13c65983b23..6a4c9ba5181 100644 --- a/src/effects/fire_breath.c +++ b/src/effects/fire_breath.c @@ -30,7 +30,7 @@ EffectInstance* fire_breath_main( bp.unk_00 = 0; bp.init = fire_breath_init; bp.update = fire_breath_update; - bp.renderWorld = fire_breath_render; + bp.renderScene = fire_breath_render; bp.renderUI = NULL; bp.effectID = EFFECT_FIRE_BREATH; @@ -189,7 +189,7 @@ void fire_breath_appendGfx(void* effect) { s32 imgFrame = data->animTime; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); if (type == FIRE_BREATH_SMALL) { guTranslateF(transformMtx, data->initPos.x, data->initPos.y, data->initPos.z); diff --git a/src/effects/fire_flower.c b/src/effects/fire_flower.c index 1a592380600..592be76a423 100644 --- a/src/effects/fire_flower.c +++ b/src/effects/fire_flower.c @@ -27,7 +27,7 @@ EffectInstance* fire_flower_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg bp.unk_00 = 0; bp.init = fire_flower_init; bp.update = fire_flower_update; - bp.renderWorld = fire_flower_render; + bp.renderScene = fire_flower_render; bp.renderUI = NULL; bp.effectID = EFFECT_FIRE_FLOWER; @@ -212,7 +212,7 @@ void fire_flower_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z); guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); diff --git a/src/effects/firework.c b/src/effects/firework.c index ac2a93542b5..7139346acab 100644 --- a/src/effects/firework.c +++ b/src/effects/firework.c @@ -57,7 +57,7 @@ EffectInstance* firework_main( bp.unk_00 = 0; bp.init = firework_init; bp.update = firework_update; - bp.renderWorld = firework_render; + bp.renderScene = firework_render; bp.renderUI = func_E0086398; bp.effectID = EFFECT_FIREWORK; @@ -194,7 +194,7 @@ void func_E00863B4(EffectInstance* effect) { f32 unk_28; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->shared->graphics)); unk_28 = part->unk_28; diff --git a/src/effects/firework_rocket.c b/src/effects/firework_rocket.c index 46e662f593c..51946cd29de 100644 --- a/src/effects/firework_rocket.c +++ b/src/effects/firework_rocket.c @@ -89,7 +89,7 @@ EffectInstance* firework_rocket_main(s32 variation, f32 centerX, f32 centerY, f3 bp.init = firework_rocket_init; bp.update = firework_rocket_update; - bp.renderWorld = firework_rocket_render; + bp.renderScene = firework_rocket_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_FIREWORK_ROCKET; @@ -253,7 +253,7 @@ void firework_rocket_appendGfx(void* effect) { } gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); mtx_0_0 = camera->mtxPerspective[0][0]; mtx_0_1 = camera->mtxPerspective[0][1]; diff --git a/src/effects/flame.c b/src/effects/flame.c index 12a764014fd..4f78e02e22e 100644 --- a/src/effects/flame.c +++ b/src/effects/flame.c @@ -78,7 +78,7 @@ void flame_main( bpPtr->init = flame_init; bpPtr->update = flame_update; - bpPtr->renderWorld = flame_render; + bpPtr->renderScene = flame_render; bpPtr->unk_00 = 0; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_FLAME; @@ -177,7 +177,7 @@ void flame_appendGfx(void* effect) { Matrix4f sp98; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); if (LastFlameRenderFrame != gGameStatusPtr->frameCounter) { LastFlameRenderFrame = gGameStatusPtr->frameCounter; diff --git a/src/effects/flashing_box_shockwave.c b/src/effects/flashing_box_shockwave.c index 5ebdd3dcca8..d0e8176d8d4 100644 --- a/src/effects/flashing_box_shockwave.c +++ b/src/effects/flashing_box_shockwave.c @@ -26,7 +26,7 @@ EffectInstance* flashing_box_shockwave_main( bp.init = flashing_box_shockwave_init; bp.update = flashing_box_shockwave_update; - bp.renderWorld = flashing_box_shockwave_render; + bp.renderScene = flashing_box_shockwave_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_FLASHING_BOX_SHOCKWAVE; @@ -149,7 +149,7 @@ void flashing_box_shockwave_appendGfx(void* effect) { guRotateF(mtxCamRot, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(mtxTransform, data->pos.x, data->pos.y, data->pos.z); guMtxCatF(mtxCamRot, mtxTransform, mtxTransform); diff --git a/src/effects/floating_cloud_puff.c b/src/effects/floating_cloud_puff.c index f3732c5d255..aaa69ece1ea 100644 --- a/src/effects/floating_cloud_puff.c +++ b/src/effects/floating_cloud_puff.c @@ -27,7 +27,7 @@ EffectInstance* floating_cloud_puff_main( bp.init = floating_cloud_puff_init; bp.update = floating_cloud_puff_update; - bp.renderWorld = floating_cloud_puff_render; + bp.renderScene = floating_cloud_puff_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_FLOATING_CLOUD_PUFF; @@ -122,7 +122,7 @@ void floating_cloud_puff_appendGfx(void* effect) { Matrix4f sp50; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp10, data->unk_04, data->unk_08, data->unk_0C); guScaleF(sp50, scale, scale, scale); diff --git a/src/effects/floating_flower.c b/src/effects/floating_flower.c index 4be78ed89a1..1fdf8d7b94d 100644 --- a/src/effects/floating_flower.c +++ b/src/effects/floating_flower.c @@ -20,7 +20,7 @@ void floating_flower_main(s32 type, f32 posX, f32 posY, f32 posZ, s32 duration) bp.unk_00 = 0; bp.init = floating_flower_init; bp.update = floating_flower_update; - bp.renderWorld = floating_flower_render; + bp.renderScene = floating_flower_render; bp.renderUI = NULL; bp.effectID = EFFECT_FLOATING_FLOWER; @@ -148,7 +148,7 @@ void floating_flower_appendGfx(void* effect) { u8 rgb, a; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->shared->graphics)); guPositionF(mtxTransform, part->rot.x, part->rot.y, 0.0f, 1.0f, part->pos.x, part->pos.y, part->pos.z); guMtxF2L(mtxTransform, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/floating_rock.c b/src/effects/floating_rock.c index e9a5c6e465e..768609f9d0f 100644 --- a/src/effects/floating_rock.c +++ b/src/effects/floating_rock.c @@ -24,7 +24,7 @@ EffectInstance* floating_rock_main(s32 type, f32 posX, f32 posY, f32 posZ, f32 f bp.init = floating_rock_init; bp.update = floating_rock_update; - bp.renderWorld = floating_rock_render; + bp.renderScene = floating_rock_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_FLOATING_ROCK; @@ -115,7 +115,7 @@ void floating_rock_appendGfx(void* effect) { Matrix4f mtxTransform; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guPositionF(mtxTransform, data->rot.x, data->rot.z, data->rot.y, data->scale, data->pos.x, data->pos.y, data->pos.z); guMtxF2L(mtxTransform, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/flower_splash.c b/src/effects/flower_splash.c index fceed4ba70d..248ae86e12c 100644 --- a/src/effects/flower_splash.c +++ b/src/effects/flower_splash.c @@ -53,7 +53,7 @@ void flower_splash_main(f32 posX, f32 posY, f32 posZ, f32 angle) { bp.init = flower_splash_init; bp.update = flower_splash_update; - bp.renderWorld = flower_splash_render; + bp.renderScene = flower_splash_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_FLOWER_SPLASH; @@ -148,7 +148,7 @@ void flower_splash_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->shared->graphics)); for (i = 0; i < effectTemp->numParts; i++, data++) { if (data->alive) { diff --git a/src/effects/flower_trail.c b/src/effects/flower_trail.c index e80f773bae2..894aea6060f 100644 --- a/src/effects/flower_trail.c +++ b/src/effects/flower_trail.c @@ -55,7 +55,7 @@ void flower_trail_main(s32 triggeredByNpc, f32 posX, f32 posY, f32 posZ, f32 ang bp.init = flower_trail_init; bp.update = flower_trail_update; - bp.renderWorld = flower_trail_render; + bp.renderScene = flower_trail_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_FLOWER_TRAIL; @@ -165,7 +165,7 @@ void flower_trail_appendGfx(void* argEffect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->shared->graphics)); for (i = 0; i < effect->numParts; i++, part++) { if (part->alive) { diff --git a/src/effects/footprint.c b/src/effects/footprint.c index 459aca41d57..fb2a38c96e4 100644 --- a/src/effects/footprint.c +++ b/src/effects/footprint.c @@ -31,7 +31,7 @@ void footprint_main(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { bp.unk_00 = 0; bp.init = footprint_init; bp.update = footprint_update; - bp.renderWorld = footprint_render; + bp.renderScene = footprint_render; bp.renderUI = NULL; bp.effectID = EFFECT_FOOTPRINT; @@ -115,14 +115,14 @@ void func_E00183BC(EffectInstance* effect) { } void footprint_appendGfx(void* effect) { - EffectInstance* effectTemp = effect; - FootprintFXData* part = effectTemp->data.footprint; + EffectInstance* effectInst = effect; + FootprintFXData* part = effectInst->data.footprint; s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectInst->shared->graphics)); - for (i = 0; i < effectTemp->numParts; i++, part++) { + for (i = 0; i < effectInst->numParts; i++, part++) { if (part->alive) { Gfx* dlist = D_09000240_32FD90; diff --git a/src/effects/fright_jar.c b/src/effects/fright_jar.c index bdc8f8cadc5..037c4fd87d4 100644 --- a/src/effects/fright_jar.c +++ b/src/effects/fright_jar.c @@ -31,7 +31,7 @@ EffectInstance* fright_jar_main( bp.init = fright_jar_init; bp.update = fright_jar_update; - bp.renderWorld = fright_jar_render; + bp.renderScene = fright_jar_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_FRIGHT_JAR; @@ -124,7 +124,7 @@ void fright_jar_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp10, data->unk_04, data->unk_08, data->unk_0C); guScaleF(sp50, -data->unk_28, data->unk_28, data->unk_28); diff --git a/src/effects/gather_energy_pink.c b/src/effects/gather_energy_pink.c index 66184d0653f..3b6a5e6bac7 100644 --- a/src/effects/gather_energy_pink.c +++ b/src/effects/gather_energy_pink.c @@ -28,7 +28,7 @@ void gather_energy_pink_main(s32 type, f32 posX, f32 posY, f32 posZ, f32 scale, bp.unk_00 = 0; bp.init = gather_energy_pink_init; bp.update = gather_energy_pink_update; - bp.renderWorld = gather_energy_pink_render; + bp.renderScene = gather_energy_pink_render; bp.renderUI = NULL; bp.effectID = EFFECT_GATHER_ENERGY_PINK; @@ -172,7 +172,7 @@ void gather_energy_pink_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, dlist); guTranslateF(sp20, part->posB.x, part->posB.y, part->posB.z); diff --git a/src/effects/gather_magic.c b/src/effects/gather_magic.c index fd9dadc1ce4..99fa0a589b1 100644 --- a/src/effects/gather_magic.c +++ b/src/effects/gather_magic.c @@ -22,7 +22,7 @@ EffectInstance* gather_magic_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 ar bp.unk_00 = 0; bp.init = gather_magic_init; bp.update = gather_magic_update; - bp.renderWorld = gather_magic_render; + bp.renderScene = gather_magic_render; bp.renderUI = NULL; bp.effectID = EFFECT_GATHER_MAGIC; @@ -162,7 +162,7 @@ void gather_magic_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, part->unk_08, part->unk_0C, part->unk_10); guRotateF(sp98, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); diff --git a/src/effects/got_item_outline.c b/src/effects/got_item_outline.c index 4cac7886f12..985835d420c 100644 --- a/src/effects/got_item_outline.c +++ b/src/effects/got_item_outline.c @@ -36,7 +36,7 @@ void got_item_outline_main( bp.init = got_item_outline_init; bp.update = got_item_outline_update; - bp.renderWorld = got_item_outline_render; + bp.renderScene = got_item_outline_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_GOT_ITEM_OUTLINE; @@ -117,7 +117,7 @@ void got_item_outline_appendGfx(void* effect) { if (scale != 0.0f) { gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09008100_34DC40); if (type == 0) { diff --git a/src/effects/green_impact.c b/src/effects/green_impact.c index 1af70ce4934..aa4ba0380a1 100644 --- a/src/effects/green_impact.c +++ b/src/effects/green_impact.c @@ -31,7 +31,7 @@ EffectInstance* green_impact_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 ar bpPtr->unk_00 = 0; bpPtr->init = green_impact_init; bpPtr->update = green_impact_update; - bpPtr->renderWorld = green_impact_render; + bpPtr->renderScene = green_impact_render; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_GREEN_IMPACT; @@ -160,7 +160,7 @@ void green_impact_appendGfx(void* effect) { envB = part->unk_53.b; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, dlist); guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, part->unk_04, part->unk_08, part->unk_0C); diff --git a/src/effects/hieroglyphs.c b/src/effects/hieroglyphs.c index 5ed896773e1..88f66d94416 100644 --- a/src/effects/hieroglyphs.c +++ b/src/effects/hieroglyphs.c @@ -34,7 +34,7 @@ EffectInstance* hieroglyphs_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f32 arg effectBp.init = hieroglyphs_init; effectBp.update = hieroglyphs_update; - effectBp.renderWorld = hieroglyphs_render; + effectBp.renderScene = hieroglyphs_render; effectBp.unk_00 = 0; effectBp.renderUI = NULL; effectBp.effectID = EFFECT_HIEROGLYPHS; @@ -123,7 +123,7 @@ void hieroglyphs_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp20, data->pos.x, data->pos.y, data->pos.z); guScaleF(sp60, data->unk_38, data->unk_38, data->unk_38); diff --git a/src/effects/huff_puff_breath.c b/src/effects/huff_puff_breath.c index 7c0a9cfb35f..0d0e73c5e20 100644 --- a/src/effects/huff_puff_breath.c +++ b/src/effects/huff_puff_breath.c @@ -21,7 +21,7 @@ EffectInstance* huff_puff_breath_main(s32 type, f32 posX, f32 posY, f32 posZ, f3 effectBp.init = huff_puff_breath_init; effectBp.update = huff_puff_breath_update; - effectBp.renderWorld = huff_puff_breath_render; + effectBp.renderScene = huff_puff_breath_render; effectBp.unk_00 = 0; effectBp.renderUI = NULL; effectBp.effectID = EFFECT_HUFF_PUFF_BREATH; @@ -135,7 +135,7 @@ void huff_puff_breath_appendGfx(void* effect) { Matrix4f sp58; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); guRotateF(sp58, data->angle, 0.0f, 0.0f, 1.0f); diff --git a/src/effects/ice_pillar.c b/src/effects/ice_pillar.c index 9fa2e9375d9..3fe556077d5 100644 --- a/src/effects/ice_pillar.c +++ b/src/effects/ice_pillar.c @@ -27,7 +27,7 @@ EffectInstance* ice_pillar_main(s32 arg0, f32 x, f32 y, f32 z, f32 scale, s32 ar effectBp.init = ice_pillar_init; effectBp.update = ice_pillar_update; - effectBp.renderWorld = ice_pillar_render; + effectBp.renderScene = ice_pillar_render; effectBp.unk_00 = 0; effectBp.renderUI = NULL; effectBp.effectID = EFFECT_ICE_PILLAR; @@ -158,7 +158,7 @@ void ice_pillar_appendGfx(void* effect) { Camera* camera; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); camera = &gCameras[gCurrentCameraID]; guTranslateF(sp10, data->pos.x, data->pos.y, data->pos.z); diff --git a/src/effects/ice_shard.c b/src/effects/ice_shard.c index 01ba8e640f9..c93ff34a2fa 100644 --- a/src/effects/ice_shard.c +++ b/src/effects/ice_shard.c @@ -28,7 +28,7 @@ EffectInstance* ice_shard_main( bp.init = ice_shard_init; bp.update = ice_shard_update; - bp.renderWorld = ice_shard_render; + bp.renderScene = ice_shard_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_ICE_SHARD; @@ -141,7 +141,7 @@ void ice_shard_appendGfx(void* effect) { Matrix4f unused; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->scale, data->pos.x, data->pos.y, data->pos.z); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/landing_dust.c b/src/effects/landing_dust.c index 6a3bd21706c..663fc173c4b 100644 --- a/src/effects/landing_dust.c +++ b/src/effects/landing_dust.c @@ -96,7 +96,7 @@ void landing_dust_main(s32 type, f32 x, f32 y, f32 z, f32 arg4) { bpPtr->init = landing_dust_init; bpPtr->update = landing_dust_update; - bpPtr->renderWorld = landing_dust_render; + bpPtr->renderScene = landing_dust_render; bpPtr->unk_00 = 0; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_LANDING_DUST; @@ -280,7 +280,7 @@ void landing_dust_appendGfx(void* effect) { dlist2 = sDlists2[type]; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, dlist2); spD8 = temp_t0 & 7; diff --git a/src/effects/lens_flare.c b/src/effects/lens_flare.c index 688957bad66..611208a82fc 100644 --- a/src/effects/lens_flare.c +++ b/src/effects/lens_flare.c @@ -31,7 +31,7 @@ void lens_flare_main(s32 type, f32 posX, f32 posY, f32 posZ, s32 duration) { bp.init = lens_flare_init; bp.update = lens_flare_update; - bp.renderWorld = lens_flare_render; + bp.renderScene = lens_flare_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_LENS_FLARE; @@ -116,7 +116,7 @@ void lens_flare_appendGfx(void* effect) { Matrix4f mtxShared; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_E0034788[type]); guTranslateF(mtxTransform, data->pos.x, data->pos.y, data->pos.z); diff --git a/src/effects/light_rays.c b/src/effects/light_rays.c index fb23bf83251..7920248405c 100644 --- a/src/effects/light_rays.c +++ b/src/effects/light_rays.c @@ -102,7 +102,7 @@ void light_rays_main( bpPtr->init = light_rays_init; bpPtr->update = light_rays_update; - bpPtr->renderWorld = light_rays_render; + bpPtr->renderScene = light_rays_render; bpPtr->unk_00 = 0; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_LIGHT_RAYS; @@ -288,7 +288,7 @@ void light_rays_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, dlist2); guTranslateF(mtxTranslate, part->pos.x, part->pos.y, part->pos.z); diff --git a/src/effects/lightning.c b/src/effects/lightning.c index 9590a71f34c..e396e6838be 100644 --- a/src/effects/lightning.c +++ b/src/effects/lightning.c @@ -45,7 +45,7 @@ EffectInstance* lightning_main( bp.init = lightning_init; bp.update = lightning_update; - bp.renderWorld = lightning_render; + bp.renderScene = lightning_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_LIGHTNING; @@ -229,7 +229,7 @@ void lightning_appendGfx(void* effect) { u16 perspNorm; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); if (unk_00 != 1 || unk_18 >= 18) { s32 ult2; diff --git a/src/effects/lightning_bolt.c b/src/effects/lightning_bolt.c index b3a9ddb2407..fc6f1ce2afd 100644 --- a/src/effects/lightning_bolt.c +++ b/src/effects/lightning_bolt.c @@ -62,7 +62,7 @@ EffectInstance* lightning_bolt_main( bp.init = lightning_bolt_init; bp.update = lightning_bolt_update; - bp.renderWorld = lightning_bolt_render; + bp.renderScene = lightning_bolt_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_LIGHTNING_BOLT; @@ -206,7 +206,7 @@ void lightning_bolt_appendGfx(void* effect) { widthScale = data->widthScale; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guScaleF(sp10, 0.1f, 0.1f, 0.1f); guMtxF2L(sp10, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/lil_oink.c b/src/effects/lil_oink.c index f5e1c302ecd..112540330a4 100644 --- a/src/effects/lil_oink.c +++ b/src/effects/lil_oink.c @@ -59,7 +59,7 @@ EffectInstance* lil_oink_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, bp.unk_00 = 0; bp.init = lil_oink_init; bp.update = lil_oink_update; - bp.renderWorld = lil_oink_render; + bp.renderScene = lil_oink_render; bp.renderUI = NULL; bp.effectID = EFFECT_LIL_OINK; @@ -176,7 +176,7 @@ void lil_oink_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x9, VIRTUAL_TO_PHYSICAL(eff->graphics->data)); + gSPSegment(gMainGfxPos++, 0x9, VIRTUAL_TO_PHYSICAL(eff->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09002D70_401FC0); gSPLookAt(gMainGfxPos++, &gDisplayContext->lookAt); diff --git a/src/effects/merlin_house_stars.c b/src/effects/merlin_house_stars.c index 68a452dc4e4..da81c0765c1 100644 --- a/src/effects/merlin_house_stars.c +++ b/src/effects/merlin_house_stars.c @@ -17,7 +17,7 @@ EffectInstance* merlin_house_stars_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3) bp.init = merlin_house_stars_init; bp.update = merlin_house_stars_update; - bp.renderWorld = merlin_house_stars_render; + bp.renderScene = merlin_house_stars_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_MERLIN_HOUSE_STARS; @@ -138,7 +138,7 @@ void merlin_house_stars_appendGfx(void* effect) { s32 ult; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp10, data->unk_0C, data->unk_10, data->unk_14); guScaleF(sp50, 0.96f, 0.96f, 0.96f); diff --git a/src/effects/misc_particles.c b/src/effects/misc_particles.c index 538a63e69b4..b1b028b2c0b 100644 --- a/src/effects/misc_particles.c +++ b/src/effects/misc_particles.c @@ -64,7 +64,7 @@ EffectInstance* misc_particles_main( bp.init = misc_particles_init; bp.update = misc_particles_update; - bp.renderWorld = misc_particles_render; + bp.renderScene = misc_particles_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_MISC_PARTICLES; @@ -307,7 +307,7 @@ void misc_particles_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gDPSetEnvColor(gMainGfxPos++, particle->glowColor.r, particle->glowColor.g, particle->glowColor.b, particle->glowColor.a); gSPDisplayList(gMainGfxPos++, D_E00E4DA8[variation]); diff --git a/src/effects/motion_blur_flame.c b/src/effects/motion_blur_flame.c index d21c29086d9..2cd0317c76b 100644 --- a/src/effects/motion_blur_flame.c +++ b/src/effects/motion_blur_flame.c @@ -39,7 +39,7 @@ EffectInstance* motion_blur_flame_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f bp.init = motion_blur_flame_init; bp.update = motion_blur_flame_update; - bp.renderWorld = motion_blur_flame_render; + bp.renderScene = motion_blur_flame_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_MOTION_BLUR_FLAME; @@ -154,7 +154,7 @@ void motion_blur_flame_appendGfx(void* effect) { s32 var_v1; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_E00A29D0[temp_a2]); for (i = 0; i < UNK_ARRAY_SIZE_1; i++) { diff --git a/src/effects/moving_cloud.c b/src/effects/moving_cloud.c index 0a6f7189e5f..0b5ef855b81 100644 --- a/src/effects/moving_cloud.c +++ b/src/effects/moving_cloud.c @@ -35,7 +35,7 @@ EffectInstance* moving_cloud_main( bp.init = moving_cloud_init; bp.update = moving_cloud_update; - bp.renderWorld = moving_cloud_render; + bp.renderScene = moving_cloud_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_MOVING_CLOUD; @@ -184,7 +184,7 @@ void moving_cloud_appendGfx(void* effect) { Matrix4f sp50; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp10, data->unk_04, data->unk_08, data->unk_0C); guScaleF(sp50, data->unk_44, data->unk_44, data->unk_44); diff --git a/src/effects/music_note.c b/src/effects/music_note.c index 2d3dffbdac8..81f15176cd6 100644 --- a/src/effects/music_note.c +++ b/src/effects/music_note.c @@ -44,7 +44,7 @@ void music_note_main(s32 type, f32 posX, f32 posY, f32 posZ) { bp.unk_00 = 0; bp.init = music_note_init; bp.update = music_note_update; - bp.renderWorld = music_note_render; + bp.renderScene = music_note_render; bp.renderUI = NULL; bp.effectID = EFFECT_MUSIC_NOTE; @@ -141,7 +141,7 @@ void music_note_appendGfx(void* data) { rgbOffset = (colorIdx * 3) % ARRAY_COUNT(D_E004C67C); gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09000FC0_35B5A0); gDPSetPrimColor(gMainGfxPos++, 0, 0, D_E004C67C[rgbOffset], D_E004C67C[rgbOffset + 1], D_E004C67C[rgbOffset + 2], fxData->alpha diff --git a/src/effects/partner_buff.c b/src/effects/partner_buff.c index d21f00f10fa..62c9be29861 100644 --- a/src/effects/partner_buff.c +++ b/src/effects/partner_buff.c @@ -45,7 +45,7 @@ EffectInstance* partner_buff_main(s32 useRandomValues, f32 arg1, f32 arg2, f32 a bp.unk_00 = 0; bp.init = partner_buff_init; bp.update = partner_buff_update; - bp.renderWorld = partner_buff_render; + bp.renderScene = partner_buff_render; bp.renderUI = func_E011A3A0; bp.effectID = EFFECT_PARTNER_BUFF; @@ -222,7 +222,7 @@ void func_E011A700(EffectInstance* effect) { if (data->visible) { gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_E011AC20[0]); diff --git a/src/effects/peach_star_beam.c b/src/effects/peach_star_beam.c index 3ff1bd93e46..1c59289eda1 100644 --- a/src/effects/peach_star_beam.c +++ b/src/effects/peach_star_beam.c @@ -44,7 +44,7 @@ EffectInstance* peach_star_beam_main(s32 type, f32 x, f32 y, f32 z, f32 arg4, s3 bp.unk_00 = 0; bp.init = peach_star_beam_init; bp.update = peach_star_beam_update; - bp.renderWorld = peach_star_beam_render; + bp.renderScene = peach_star_beam_render; bp.renderUI = NULL; bp.effectID = EFFECT_PEACH_STAR_BEAM; @@ -172,7 +172,7 @@ void peach_star_beam_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x9, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x9, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09005090_3EAFC0); for (i = 0; i < ARRAY_COUNT(data->spirits); i++) { diff --git a/src/effects/pink_sparkles.c b/src/effects/pink_sparkles.c index dec62f3f315..569a369b677 100644 --- a/src/effects/pink_sparkles.c +++ b/src/effects/pink_sparkles.c @@ -108,7 +108,7 @@ EffectInstance* pink_sparkles_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 a bp.init = pink_sparkles_init; bp.update = pink_sparkles_update; - bp.renderWorld = pink_sparkles_render; + bp.renderScene = pink_sparkles_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_PINK_SPARKLES; @@ -186,7 +186,7 @@ void pink_sparkles_update(EffectInstance* effect) { part->unk_28 = (unk_20 + i + i) & 7; if (part->unk_1C < 0) { - count += 1; + count++; } part->unk_1C--; @@ -241,7 +241,7 @@ void pink_sparkles_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09000F20_338EE0); colorIdx = (part->unk_20 - 1) * 3; diff --git a/src/effects/purple_ring.c b/src/effects/purple_ring.c index dc1986e859b..1e138dde9ce 100644 --- a/src/effects/purple_ring.c +++ b/src/effects/purple_ring.c @@ -87,7 +87,7 @@ EffectInstance* purple_ring_main( bpPtr->init = purple_ring_init; bpPtr->update = purple_ring_update; - bpPtr->renderWorld = purple_ring_render; + bpPtr->renderScene = purple_ring_render; bpPtr->unk_00 = 0; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_PURPLE_RING; @@ -196,7 +196,7 @@ void purple_ring_appendGfx(void* effect) { Matrix4f sp50; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09000200_352EE0); gDPSetPrimColor(gMainGfxPos++, 0, 0, data->unk_74, data->unk_75, data->unk_76, data->unk_68); diff --git a/src/effects/quizmo_answer.c b/src/effects/quizmo_answer.c index b8bfedca8a0..a6025c22c62 100644 --- a/src/effects/quizmo_answer.c +++ b/src/effects/quizmo_answer.c @@ -11,7 +11,7 @@ EffectInstance* quizmo_answer_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3) { bp.unk_00 = 0; bp.init = NULL; bp.update = NULL; - bp.renderWorld = NULL; + bp.renderScene = NULL; bp.renderUI = NULL; bp.effectID = EFFECT_QUIZMO_ANSWER; @@ -19,7 +19,7 @@ EffectInstance* quizmo_answer_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3) { effect->data.quizmoAnswer = NULL; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->shared->graphics)); if (arg0 == 0) { gSPDisplayList(gMainGfxPos++, D_09000400_3A2840); diff --git a/src/effects/quizmo_assistant.c b/src/effects/quizmo_assistant.c index 713d7ac4d35..44519857d6b 100644 --- a/src/effects/quizmo_assistant.c +++ b/src/effects/quizmo_assistant.c @@ -31,7 +31,7 @@ EffectInstance* quizmo_assistant_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f3 bp.init = quizmo_assistant_init; bp.update = quizmo_assistant_update; - bp.renderWorld = quizmo_assistant_render; + bp.renderScene = quizmo_assistant_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_QUIZMO_ASSISTANT; @@ -106,7 +106,7 @@ void quizmo_assistant_appendGfx(void* effect) { Matrix4f sp58; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); diff --git a/src/effects/quizmo_audience.c b/src/effects/quizmo_audience.c index 0d9e22277b7..16ba554ce5b 100644 --- a/src/effects/quizmo_audience.c +++ b/src/effects/quizmo_audience.c @@ -84,7 +84,7 @@ EffectInstance* quizmo_audience_main(s32 arg0, f32 posX, f32 posY, f32 posZ) { effectBp.init = quizmo_audience_init; effectBp.update = quizmo_audience_update; - effectBp.renderWorld = quizmo_audience_render; + effectBp.renderScene = quizmo_audience_render; effectBp.unk_00 = 0; effectBp.renderUI = NULL; effectBp.effectID = EFFECT_QUIZMO_AUDIENCE; @@ -188,7 +188,7 @@ void quizmo_audience_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); diff --git a/src/effects/quizmo_stage.c b/src/effects/quizmo_stage.c index 9093f155c71..a3116684bce 100644 --- a/src/effects/quizmo_stage.c +++ b/src/effects/quizmo_stage.c @@ -28,7 +28,7 @@ EffectInstance* quizmo_stage_main(s32 arg0, f32 posX, f32 posY, f32 posZ) { effectBp.init = quizmo_stage_init; effectBp.update = quizmo_stage_update; - effectBp.renderWorld = quizmo_stage_render; + effectBp.renderScene = quizmo_stage_render; effectBp.unk_00 = 0; effectBp.renderUI = NULL; effectBp.effectID = EFFECT_QUIZMO_STAGE; @@ -112,7 +112,7 @@ void quizmo_stage_appendGfx(void* effect) { Matrix4f sp58; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, data->origin.x, data->origin.y, data->origin.z); guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); diff --git a/src/effects/radial_shimmer.c b/src/effects/radial_shimmer.c index 25b1c0277e9..121ef505f1a 100644 --- a/src/effects/radial_shimmer.c +++ b/src/effects/radial_shimmer.c @@ -41,7 +41,7 @@ EffectInstance* radial_shimmer_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 bp.init = radial_shimmer_init; bp.update = radial_shimmer_update; - bp.renderWorld = radial_shimmer_render; + bp.renderScene = radial_shimmer_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_RADIAL_SHIMMER; @@ -311,7 +311,7 @@ void radial_shimmer_appendGfx(void* effect) { dlist2 = D_E0066C50[temp_s5]; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp20, data->unk_10, data->unk_14, data->unk_18); guScaleF(sp60, data->unk_1C, data->unk_1C, 1.0f); diff --git a/src/effects/radiating_energy_orb.c b/src/effects/radiating_energy_orb.c index 42af6b70b5d..7b51533f1da 100644 --- a/src/effects/radiating_energy_orb.c +++ b/src/effects/radiating_energy_orb.c @@ -36,7 +36,7 @@ EffectInstance* radiating_energy_orb_main( bp.unk_00 = 0; bp.init = radiating_energy_orb_init; bp.update = radiating_energy_orb_update; - bp.renderWorld = radiating_energy_orb_render; + bp.renderScene = radiating_energy_orb_render; bp.renderUI = NULL; bp.effectID = EFFECT_RADIATING_ENERGY_ORB; @@ -144,7 +144,7 @@ void radiating_energy_orb_appendGfx(void* effect) { } gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, part->unk_08, part->unk_0C, part->unk_10); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/recover.c b/src/effects/recover.c index 7b4aff2a5b1..3a9173bf893 100644 --- a/src/effects/recover.c +++ b/src/effects/recover.c @@ -50,7 +50,7 @@ EffectInstance* recover_main(s32 type, f32 posX, f32 posY, f32 posZ, s32 duratio bp.init = recover_init; bp.update = recover_update; - bp.renderWorld = recover_render; + bp.renderScene = recover_render; bp.renderUI = func_E008042C; bp.unk_00 = 0; bp.effectID = EFFECT_RECOVER; @@ -174,7 +174,7 @@ void func_E0080448(EffectInstance* effect) { Matrix4f sp98; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z); guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); diff --git a/src/effects/red_impact.c b/src/effects/red_impact.c index 02a5d6f6af5..c7f3a7b63fd 100644 --- a/src/effects/red_impact.c +++ b/src/effects/red_impact.c @@ -32,7 +32,7 @@ EffectInstance* red_impact_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4 bpPtr->unk_00 = 0; bpPtr->init = red_impact_init; bpPtr->update = red_impact_update; - bpPtr->renderWorld = red_impact_render; + bpPtr->renderScene = red_impact_render; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_RED_IMPACT; @@ -167,7 +167,7 @@ void red_impact_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, dlist); guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, part->unk_04, part->unk_08, part->unk_0C); diff --git a/src/effects/ring_blast.c b/src/effects/ring_blast.c index 6df7a1e55f8..520d2f2d1d3 100644 --- a/src/effects/ring_blast.c +++ b/src/effects/ring_blast.c @@ -20,7 +20,7 @@ void ring_blast_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f32 arg4, s32 arg5) effectBp.init = ring_blast_init; effectBp.update = ring_blast_update; - effectBp.renderWorld = ring_blast_render; + effectBp.renderScene = ring_blast_render; effectBp.unk_00 = 0; effectBp.renderUI = NULL; effectBp.effectID = EFFECT_RING_BLAST; @@ -95,7 +95,7 @@ void ring_blast_appendGfx(void* effect) { Matrix4f sp60; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, dlist2); guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->unk_10, data->pos.x, data->pos.y, data->pos.z); diff --git a/src/effects/rising_bubble.c b/src/effects/rising_bubble.c index 19fa80e9f29..c78f5cf1c8f 100644 --- a/src/effects/rising_bubble.c +++ b/src/effects/rising_bubble.c @@ -31,7 +31,7 @@ void rising_bubble_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f32 arg4) { effectBp.unk_00 = 0; effectBp.init = rising_bubble_init; effectBp.update = rising_bubble_update; - effectBp.renderWorld = rising_bubble_render; + effectBp.renderScene = rising_bubble_render; effectBp.renderUI = NULL; effectBp.effectID = EFFECT_RISING_BUBBLE; @@ -112,7 +112,7 @@ void rising_bubble_appendGfx(void* effect) { Matrix4f sp60; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); if (data->pos.y >= data->unk_24) { s32 uls; diff --git a/src/effects/shape_spell.c b/src/effects/shape_spell.c index 9af181ab14c..bf477f9cbd8 100644 --- a/src/effects/shape_spell.c +++ b/src/effects/shape_spell.c @@ -38,7 +38,7 @@ EffectInstance* shape_spell_main(s32 isChild, f32 x, f32 y, f32 z, f32 arg4, f32 bp.init = shape_spell_init; bp.update = shape_spell_update; - bp.renderWorld = shape_spell_render; + bp.renderScene = shape_spell_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_SHAPE_SPELL; @@ -168,7 +168,7 @@ void shape_spell_appendGfx(void* effect) { s32 j; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09001080_33AFE0); savedGfxPos = gMainGfxPos++; diff --git a/src/effects/shattering_stones.c b/src/effects/shattering_stones.c index 60f751e78f4..ab5e2a11041 100644 --- a/src/effects/shattering_stones.c +++ b/src/effects/shattering_stones.c @@ -47,7 +47,7 @@ void shattering_stones_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { bp.init = shattering_stones_init; bp.update = shattering_stones_update; - bp.renderWorld = shattering_stones_render; + bp.renderScene = shattering_stones_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_SHATTERING_STONES; @@ -146,7 +146,7 @@ void shattering_stones_appendGfx(void* effect) { Matrix4f spE0; s32 i; - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09000C00_341480); if (part->unk_24 == 0) { diff --git a/src/effects/shimmer_burst.c b/src/effects/shimmer_burst.c index dd63f9e8121..05120c1e9ec 100644 --- a/src/effects/shimmer_burst.c +++ b/src/effects/shimmer_burst.c @@ -41,7 +41,7 @@ EffectInstance* shimmer_burst_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 a bp.init = shimmer_burst_init; bp.update = shimmer_burst_update; - bp.renderWorld = shimmer_burst_render; + bp.renderScene = shimmer_burst_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_SHIMMER_BURST; @@ -211,7 +211,7 @@ void shimmer_burst_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp20, part->unk_04, part->unk_08, part->unk_0C); guScaleF(sp60, part->unk_60, part->unk_60, part->unk_60); diff --git a/src/effects/shimmer_wave.c b/src/effects/shimmer_wave.c index 209c85f55d1..15aa33aa141 100644 --- a/src/effects/shimmer_wave.c +++ b/src/effects/shimmer_wave.c @@ -51,7 +51,7 @@ EffectInstance* shimmer_wave_main( bp.init = shimmer_wave_init; bp.update = shimmer_wave_update; - bp.renderWorld = shimmer_wave_render; + bp.renderScene = shimmer_wave_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_SHIMMER_WAVE; @@ -196,7 +196,7 @@ void shimmer_wave_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp20, part->unk_04, part->unk_08, part->unk_0C); guScaleF(sp60, part->unk_60, part->unk_60, part->unk_60); diff --git a/src/effects/shiny_flare.c b/src/effects/shiny_flare.c index 4530d33331d..0301923864f 100644 --- a/src/effects/shiny_flare.c +++ b/src/effects/shiny_flare.c @@ -28,7 +28,7 @@ EffectInstance* shiny_flare_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg effectBp.init = shiny_flare_init; effectBp.update = shiny_flare_update; - effectBp.renderWorld = shiny_flare_render; + effectBp.renderScene = shiny_flare_render; effectBp.unk_00 = 0; effectBp.renderUI = NULL; effectBp.effectID = EFFECT_SHINY_FLARE; @@ -107,7 +107,7 @@ void shiny_flare_appendGfx(void* effect) { Matrix4f sp50; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp10, data->pos.x, data->pos.y, data->pos.z); guScaleF(sp50, scale, scale, scale); diff --git a/src/effects/shockwave.c b/src/effects/shockwave.c index ec67535e007..f459192561f 100644 --- a/src/effects/shockwave.c +++ b/src/effects/shockwave.c @@ -57,7 +57,7 @@ void shockwave_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3) { bpPtr->init = shockwave_init; bpPtr->update = shockwave_update; - bpPtr->renderWorld = shockwave_render; + bpPtr->renderScene = shockwave_render; bpPtr->unk_00 = 0; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_SHOCKWAVE; @@ -306,7 +306,7 @@ void shockwave_appendGfx(void* effect) { } gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, dlist2); guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, diff --git a/src/effects/sleep_bubble.c b/src/effects/sleep_bubble.c index bab33aa20ae..712c87803be 100644 --- a/src/effects/sleep_bubble.c +++ b/src/effects/sleep_bubble.c @@ -28,7 +28,7 @@ void sleep_bubble_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg bp.unk_00 = 0; bp.init = sleep_bubble_init; bp.update = sleep_bubble_update; - bp.renderWorld = sleep_bubble_render; + bp.renderScene = sleep_bubble_render; bp.renderUI = NULL; bp.effectID = EFFECT_SLEEP_BUBBLE; @@ -131,7 +131,7 @@ void sleep_bubble_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); timeLeft = data->timeLeft; if (timeLeft == 0) { diff --git a/src/effects/small_gold_sparkle.c b/src/effects/small_gold_sparkle.c index 9b227421413..c9305049295 100644 --- a/src/effects/small_gold_sparkle.c +++ b/src/effects/small_gold_sparkle.c @@ -33,7 +33,7 @@ EffectInstance* small_gold_sparkle_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, bp.init = small_gold_sparkle_init; bp.update = small_gold_sparkle_update; - bp.renderWorld = small_gold_sparkle_render; + bp.renderScene = small_gold_sparkle_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_SMALL_GOLD_SPARKLE; @@ -121,7 +121,7 @@ void small_gold_sparkle_appendGfx(void* effect) { guMtxF2L(sp98, &gDisplayContext->matrixStack[gMatrixListPos]); spD8 = &gDisplayContext->matrixStack[gMatrixListPos++]; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, part->unk_08, part->unk_0C, part->unk_10); guMtxF2L(sp18, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/smoke_burst.c b/src/effects/smoke_burst.c index 59477baefa8..c9c4607e9db 100644 --- a/src/effects/smoke_burst.c +++ b/src/effects/smoke_burst.c @@ -26,7 +26,7 @@ void smoke_burst_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f32 arg4, s32 time effectBp.init = smoke_burst_init; effectBp.update = smoke_burst_update; - effectBp.renderWorld = smoke_burst_render; + effectBp.renderScene = smoke_burst_render; effectBp.unk_00 = 0; effectBp.renderUI = NULL; effectBp.effectID = EFFECT_SMOKE_BURST; @@ -110,7 +110,7 @@ void smoke_burst_appendGfx(void* effect) { Matrix4f sp60; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, dlist2); guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->unk_10, data->pos.x, data->pos.y, data->pos.z); diff --git a/src/effects/smoke_impact.c b/src/effects/smoke_impact.c index 0fecf8fa66f..418eeeefc68 100644 --- a/src/effects/smoke_impact.c +++ b/src/effects/smoke_impact.c @@ -37,7 +37,7 @@ void smoke_impact_main( bp.init = smoke_impact_init; bp.update = smoke_impact_update; - bp.renderWorld = smoke_impact_render; + bp.renderScene = smoke_impact_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_SMOKE_IMPACT; @@ -131,7 +131,7 @@ void smoke_impact_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, dlist2); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); diff --git a/src/effects/smoke_ring.c b/src/effects/smoke_ring.c index 439c2900b5e..ab638684ca0 100644 --- a/src/effects/smoke_ring.c +++ b/src/effects/smoke_ring.c @@ -43,7 +43,7 @@ void smoke_ring_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3) { bpPtr->init = smoke_ring_init; bpPtr->update = smoke_ring_update; - bpPtr->renderWorld = smoke_ring_render; + bpPtr->renderScene = smoke_ring_render; bpPtr->unk_00 = 0; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_SMOKE_RING; @@ -137,7 +137,7 @@ void smoke_ring_appendGfx(void* effect) { } gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09002950_32B7F0); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); diff --git a/src/effects/snaking_static.c b/src/effects/snaking_static.c index c0fbe0bf89c..7c9a3f3246a 100644 --- a/src/effects/snaking_static.c +++ b/src/effects/snaking_static.c @@ -18,7 +18,7 @@ EffectInstance* snaking_static_main(s32 type, f32 posX, f32 posY, f32 posZ, f32 effectBp.init = snaking_static_init; effectBp.update = snaking_static_update; - effectBp.renderWorld = snaking_static_render; + effectBp.renderScene = snaking_static_render; effectBp.unk_00 = 0; effectBp.renderUI = NULL; effectBp.effectID = EFFECT_SNAKING_STATIC; @@ -171,7 +171,7 @@ void snaking_static_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); guScaleF(sp58, data->scale, data->scale, data->scale); diff --git a/src/effects/snowfall.c b/src/effects/snowfall.c index 742aa565663..4e3be5b9fb0 100644 --- a/src/effects/snowfall.c +++ b/src/effects/snowfall.c @@ -32,7 +32,7 @@ EffectInstance* snowfall_main(s32 arg0, s32 arg1) { effectBp.init = snowfall_init; effectBp.update = snowfall_update; - effectBp.renderWorld = snowfall_render; + effectBp.renderScene = snowfall_render; effectBp.unk_00 = 0; effectBp.renderUI = NULL; effectBp.effectID = EFFECT_SNOWFALL; @@ -184,7 +184,7 @@ void snowfall_appendGfx(void* effect) { if (unk_28 != 0) { gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09000C00_38DC70); gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 255, unk_28); diff --git a/src/effects/snowflake.c b/src/effects/snowflake.c index 316cf563a07..3c64ebeef0f 100644 --- a/src/effects/snowflake.c +++ b/src/effects/snowflake.c @@ -21,7 +21,7 @@ void snowflake_main(f32 x, f32 y, f32 z, s32 arg3) { bp.unk_00 = 0; bp.init = snowflake_init; bp.update = snowflake_update; - bp.renderWorld = snowflake_render; + bp.renderScene = snowflake_render; bp.renderUI = NULL; bp.effectID = EFFECT_SNOWFLAKE; @@ -123,7 +123,7 @@ void snowflake_appendGfx(void* effect) { SnowflakeFXData* data = effectTemp->data.snowflake; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09000900_331800); guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); diff --git a/src/effects/snowman_doll.c b/src/effects/snowman_doll.c index 5298f7d3863..4753e5297a2 100644 --- a/src/effects/snowman_doll.c +++ b/src/effects/snowman_doll.c @@ -76,7 +76,7 @@ EffectInstance* snowman_doll_main( bp.init = snowman_doll_init; bp.update = snowman_doll_update; - bp.renderWorld = snowman_doll_render; + bp.renderScene = snowman_doll_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_SNOWMAN_DOLL; @@ -296,7 +296,7 @@ void snowman_doll_appendGfx(void* effect) { Matrix4f sp58; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, data->unk_04, data->unk_08, data->unk_0C); guScaleF(sp58, data->unk_28, data->unk_28, data->unk_28); diff --git a/src/effects/something_rotating.c b/src/effects/something_rotating.c index 156e6c9fe5b..4096be39957 100644 --- a/src/effects/something_rotating.c +++ b/src/effects/something_rotating.c @@ -89,7 +89,7 @@ EffectInstance* something_rotating_main( bp.init = something_rotating_init; bp.update = something_rotating_update; - bp.renderWorld = something_rotating_render; + bp.renderScene = something_rotating_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_SOMETHING_ROTATING; @@ -285,7 +285,7 @@ void something_rotating_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_090042E0_3FE790); gDPSetEnvColor(gMainGfxPos++, 0, 0, 0, 255); diff --git a/src/effects/sparkles.c b/src/effects/sparkles.c index 958bb694119..a4b1f6a8828 100644 --- a/src/effects/sparkles.c +++ b/src/effects/sparkles.c @@ -78,7 +78,7 @@ void sparkles_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { bpPtr->init = sparkles_init; bpPtr->update = sparkles_update; - bpPtr->renderWorld = sparkles_render; + bpPtr->renderScene = sparkles_render; bpPtr->unk_00 = 0; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_SPARKLES; @@ -251,7 +251,7 @@ void sparkles_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09000F20_338EE0); colorIdx = (part->unk_20 - 1) * 3; diff --git a/src/effects/spiky_white_aura.c b/src/effects/spiky_white_aura.c index 61c7178aa86..1856b9c498a 100644 --- a/src/effects/spiky_white_aura.c +++ b/src/effects/spiky_white_aura.c @@ -76,7 +76,7 @@ void spiky_white_aura_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4) { bpPtr->init = spiky_white_aura_init; bpPtr->update = spiky_white_aura_update; - bpPtr->renderWorld = spiky_white_aura_render; + bpPtr->renderScene = spiky_white_aura_render; bpPtr->unk_00 = 0; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_SPIKY_WHITE_AURA; @@ -181,7 +181,7 @@ void spiky_white_aura_appendGfx(void* effect) { Matrix4f sp58; s32 i; - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09000440_34EBB0); gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 255, part->unk_24); diff --git a/src/effects/spirit_card.c b/src/effects/spirit_card.c index 42f000ee54a..dbc9d821e3d 100644 --- a/src/effects/spirit_card.c +++ b/src/effects/spirit_card.c @@ -44,7 +44,7 @@ EffectInstance* spirit_card_main( bp.init = spirit_card_init; bp.update = spirit_card_update; - bp.renderWorld = spirit_card_render; + bp.renderScene = spirit_card_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_SPIRIT_CARD; @@ -154,7 +154,7 @@ void spirit_card_appendGfx(void* effect) { s32 unk_00 = data->unk_00; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_090042E0_3FE790); gDPSetEnvColor(gMainGfxPos++, 0, 0, 0, 255); diff --git a/src/effects/squirt.c b/src/effects/squirt.c index cda27ece7cb..e6d784c9ed2 100644 --- a/src/effects/squirt.c +++ b/src/effects/squirt.c @@ -20,7 +20,7 @@ EffectInstance* squirt_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f3 bp.init = squirt_init; bp.update = squirt_update; - bp.renderWorld = squirt_render; + bp.renderScene = squirt_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_SQUIRT; @@ -173,7 +173,7 @@ void squirt_appendGfx(void* effect) { f32 theta; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp10, 0.0f, 0.0f, 0.0f); guScaleF(sp50, 0.05f, 0.05f, 0.05f); diff --git a/src/effects/star.c b/src/effects/star.c index e56394838df..22a572403da 100644 --- a/src/effects/star.c +++ b/src/effects/star.c @@ -35,7 +35,7 @@ EffectInstance* star_main(s32 type, f32 startX, f32 startY, f32 startZ, f32 endX bp.unk_00 = 0; bp.init = star_init; bp.update = star_update; - bp.renderWorld = star_render; + bp.renderScene = star_render; bp.renderUI = NULL; bp.effectID = EFFECT_STAR; @@ -214,7 +214,7 @@ void star_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, scale, data->pos.x, data->pos.y, data->pos.z); guRotateF(sp60, data->starAngle, 0.0f, 0.0f, 1.0f); diff --git a/src/effects/star_outline.c b/src/effects/star_outline.c index ec978259839..26bf21ee81f 100644 --- a/src/effects/star_outline.c +++ b/src/effects/star_outline.c @@ -22,7 +22,7 @@ EffectInstance* star_outline_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f32 ar effectBp.init = star_outline_init; effectBp.update = star_outline_update; - effectBp.renderWorld = star_outline_render; + effectBp.renderScene = star_outline_render; effectBp.unk_00 = 0; effectBp.renderUI = NULL; effectBp.effectID = EFFECT_STAR_OUTLINE; @@ -207,7 +207,7 @@ void star_outline_appendGfx(void* effect) { } gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_E0126BC8[0]); if (unk_34 != 0) { diff --git a/src/effects/star_spirits_energy.c b/src/effects/star_spirits_energy.c index b9d3383e883..dc390835200 100644 --- a/src/effects/star_spirits_energy.c +++ b/src/effects/star_spirits_energy.c @@ -100,7 +100,7 @@ EffectInstance* star_spirits_energy_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, bp.init = star_spirits_energy_init; bp.update = star_spirits_energy_update; - bp.renderWorld = star_spirits_energy_render; + bp.renderScene = star_spirits_energy_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_STAR_SPIRITS_ENERGY; @@ -343,7 +343,7 @@ void star_spirits_energy_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->unk_3C, data->unk_08, data->unk_0C, data->unk_10); diff --git a/src/effects/stars_burst.c b/src/effects/stars_burst.c index 95632fc9ef2..0ba42a17741 100644 --- a/src/effects/stars_burst.c +++ b/src/effects/stars_burst.c @@ -47,7 +47,7 @@ void stars_burst_main( bpPtr->init = stars_burst_init; bpPtr->update = stars_burst_update; - bpPtr->renderWorld = stars_burst_render; + bpPtr->renderScene = stars_burst_render; bpPtr->unk_00 = 0; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_STARS_BURST; @@ -138,7 +138,7 @@ void stars_burst_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_090004C0_343500); unk_2C = part->unk_2C; diff --git a/src/effects/stars_orbiting.c b/src/effects/stars_orbiting.c index 448e6b51efe..493444d8428 100644 --- a/src/effects/stars_orbiting.c +++ b/src/effects/stars_orbiting.c @@ -31,7 +31,7 @@ void stars_orbiting_main( bp.init = stars_orbiting_init; bp.update = stars_orbiting_update; - bp.renderWorld = stars_orbiting_render; + bp.renderScene = stars_orbiting_render; bp.unk_00 = 0; bp.renderUI = func_E005E318; bp.effectID = EFFECT_STARS_ORBITING; @@ -113,7 +113,7 @@ void func_E005E334(EffectInstance* effect) { Gfx* dlist2 = D_E005E674[0]; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, dlist2); guTranslateF(sp18, part->pos.x, part->pos.y, part->pos.z); diff --git a/src/effects/stars_shimmer.c b/src/effects/stars_shimmer.c index 157597290ed..501526059f6 100644 --- a/src/effects/stars_shimmer.c +++ b/src/effects/stars_shimmer.c @@ -64,7 +64,7 @@ void stars_shimmer_main(s32 type, f32 x, f32 y, f32 z, f32 arg4, f32 arg5, s32 n bpPtr->init = stars_shimmer_init; bpPtr->update = stars_shimmer_update; - bpPtr->renderWorld = stars_shimmer_render; + bpPtr->renderScene = stars_shimmer_render; bpPtr->unk_00 = 0; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_STARS_SHIMMER; @@ -292,7 +292,7 @@ void stars_shimmer_appendGfx(void* effect) { state = data->state; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09000F20_338EE0); temp_s4 = (data->lifeTime - 1) * 3; diff --git a/src/effects/stars_spread.c b/src/effects/stars_spread.c index 30bbb2a8e34..31cc2e86b9d 100644 --- a/src/effects/stars_spread.c +++ b/src/effects/stars_spread.c @@ -26,7 +26,7 @@ void stars_spread_main( bp.init = stars_spread_init; bp.update = stars_spread_update; - bp.renderWorld = stars_spread_render; + bp.renderScene = stars_spread_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_STARS_SPREAD; @@ -127,7 +127,7 @@ void stars_spread_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09000440_360E70); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); diff --git a/src/effects/stat_change.c b/src/effects/stat_change.c index 47b7f1f288a..b9bff3520c1 100644 --- a/src/effects/stat_change.c +++ b/src/effects/stat_change.c @@ -147,7 +147,7 @@ EffectInstance* stat_change_main(s32 arg0, f32 x, f32 y, f32 z, f32 scale, s32 t bp.init = stat_change_init; bp.update = stat_change_update; - bp.renderWorld = stat_change_render; + bp.renderScene = stat_change_render; bp.renderUI = func_E00AC288; bp.unk_00 = 0; bp.effectID = EFFECT_STAT_CHANGE; @@ -243,7 +243,7 @@ void func_E00AC2A4(EffectInstance* effect) { if (data->scaleX != 0.0f && data->scaleY != 0.0f) { gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->scale, data->pos.x, data->pos.y, data->pos.z); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/static_status.c b/src/effects/static_status.c index dc0bd84173e..b55e54dcde7 100644 --- a/src/effects/static_status.c +++ b/src/effects/static_status.c @@ -54,7 +54,7 @@ EffectInstance* static_status_main( bp.init = static_status_init; bp.update = static_status_update; - bp.renderWorld = static_status_render; + bp.renderScene = static_status_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_STATIC_STATUS; @@ -198,7 +198,7 @@ void static_status_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(mtxTransform, part->pos.x, part->pos.y, part->pos.z); guScaleF(mtxTemp, part->scale, part->scale, part->scale); diff --git a/src/effects/steam_burst.c b/src/effects/steam_burst.c index 360c7029a71..f0439172102 100644 --- a/src/effects/steam_burst.c +++ b/src/effects/steam_burst.c @@ -28,7 +28,7 @@ void steam_burst_main( bp.init = steam_burst_init; bp.update = steam_burst_update; - bp.renderWorld = steam_burst_render; + bp.renderScene = steam_burst_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_STEAM_BURST; @@ -120,7 +120,7 @@ void steam_burst_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, dlist2); guTranslateF(sp18, part->unk_04, part->unk_08, part->unk_0C); diff --git a/src/effects/stop_watch.c b/src/effects/stop_watch.c index db630c1d105..e1df8a43857 100644 --- a/src/effects/stop_watch.c +++ b/src/effects/stop_watch.c @@ -60,7 +60,7 @@ EffectInstance* stop_watch_main( bp.init = stop_watch_init; bp.update = stop_watch_update; - bp.renderWorld = stop_watch_render; + bp.renderScene = stop_watch_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_STOP_WATCH; @@ -189,7 +189,7 @@ void stop_watch_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp20, data->unk_04, data->unk_08, data->unk_0C); guScaleF(sp60, data->unk_28, data->unk_28, data->unk_28); diff --git a/src/effects/sun.c b/src/effects/sun.c index 4b74c5cd401..89ffa4c84c9 100644 --- a/src/effects/sun.c +++ b/src/effects/sun.c @@ -29,7 +29,7 @@ EffectInstance* sun_main(s32 shineFromRight, f32 offsetX, f32 offsetY, f32 offse bp.init = sun_init; bp.update = sun_update; - bp.renderWorld = sun_render; + bp.renderScene = sun_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_SUN; @@ -161,7 +161,7 @@ void sun_appendGfx(void* argEffect) { if (alpha != 0) { gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x9, VIRTUAL_TO_PHYSICAL(effect->graphics->data)); + gSPSegment(gMainGfxPos++, 0x9, VIRTUAL_TO_PHYSICAL(effect->shared->graphics)); if (!fromRight) { guOrthoF(mtx, -1600.0f, 1600.0f, -1200.0f, 1200.0f, -100.0f, 100.0f, 1.0f); diff --git a/src/effects/sweat.c b/src/effects/sweat.c index 99763226e74..b8c3aa80fea 100644 --- a/src/effects/sweat.c +++ b/src/effects/sweat.c @@ -21,7 +21,7 @@ void sweat_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, s32 effectBp.init = (void*)sweat_init; effectBp.update = sweat_update; - effectBp.renderWorld = sweat_render; + effectBp.renderScene = sweat_render; effectBp.unk_00 = 0; effectBp.renderUI = NULL; effectBp.effectID = EFFECT_SWEAT; @@ -45,7 +45,6 @@ void sweat_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, s32 data->timeLeft = timeLeft; } - void sweat_init(EffectInstance* effect) { } @@ -87,7 +86,7 @@ void sweat_appendGfx(void* effect) { Matrix4f sp58; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f); diff --git a/src/effects/tattle_window.c b/src/effects/tattle_window.c index a4551ba6bd5..7fc7c99883e 100644 --- a/src/effects/tattle_window.c +++ b/src/effects/tattle_window.c @@ -67,7 +67,7 @@ EffectInstance* tattle_window_main(s32 type, f32 x, f32 y, f32 z, f32 arg4, s32 bp.init = tattle_window_init; bp.update = tattle_window_update; - bp.renderWorld = tattle_window_render; + bp.renderScene = tattle_window_render; bp.renderUI = func_E00D8264; bp.unk_00 = 0; bp.effectID = EFFECT_TATTLE_WINDOW; @@ -226,7 +226,7 @@ void func_E00D8630(EffectInstance* effect) { s32 flags; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); if (data->scale == 1.0f && data->rot.x == 0.0f && data->rot.y == 0.0f && data->rot.z == 0.0f) { flags = 0; diff --git a/src/effects/throw_spiny.c b/src/effects/throw_spiny.c index a23437bb83a..0f92f9dedba 100644 --- a/src/effects/throw_spiny.c +++ b/src/effects/throw_spiny.c @@ -28,7 +28,7 @@ EffectInstance* throw_spiny_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg bp.init = throw_spiny_init; bp.update = throw_spiny_update; - bp.renderWorld = throw_spiny_render; + bp.renderScene = throw_spiny_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_THROW_SPINY; @@ -113,7 +113,7 @@ void throw_spiny_update(EffectInstance* effectInstance) { if (state < 7) { spinyObject->xScale = D_E00C8718[state] * 0.01f; spinyObject->yScale = D_E00C8720[state] * 0.01f; - spinyObject->state += 1; + spinyObject->state++; spinyObject->yaw -= 40.0f; } else { spinyObject->gravity += -0.2f; @@ -166,7 +166,7 @@ void throw_spiny_appendGfx(void* effect) { f32 scale = data->unk_40 * SPRITE_WORLD_SCALE_D; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); guScaleF(sp58, scale * data->xScale, scale * data->yScale, scale); diff --git a/src/effects/thunderbolt_ring.c b/src/effects/thunderbolt_ring.c index 7a0d4907629..d8be94987fe 100644 --- a/src/effects/thunderbolt_ring.c +++ b/src/effects/thunderbolt_ring.c @@ -17,7 +17,7 @@ EffectInstance* thunderbolt_ring_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f3 effectBp.init = thunderbolt_ring_init; effectBp.update = thunderbolt_ring_update; - effectBp.renderWorld = thunderbolt_ring_render; + effectBp.renderScene = thunderbolt_ring_render; effectBp.unk_00 = 0; effectBp.renderUI = NULL; effectBp.effectID = EFFECT_THUNDERBOLT_RING; @@ -108,7 +108,7 @@ void thunderbolt_ring_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->unk_28, data->pos.x, data->pos.y, data->pos.z); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/tubba_heart_attack.c b/src/effects/tubba_heart_attack.c index 7eb5c963168..1664e2f52a2 100644 --- a/src/effects/tubba_heart_attack.c +++ b/src/effects/tubba_heart_attack.c @@ -69,7 +69,7 @@ EffectInstance* tubba_heart_attack_main( bp.init = tubba_heart_attack_init; bp.update = tubba_heart_attack_update; - bp.renderWorld = tubba_heart_attack_render; + bp.renderScene = tubba_heart_attack_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_TUBBA_HEART_ATTACK; @@ -312,7 +312,7 @@ void tubba_heart_attack_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, data->centerX, data->centerY, data->centerZ); guScaleF(sp58, data->overallScale, data->overallScale, data->overallScale); diff --git a/src/effects/underwater.c b/src/effects/underwater.c index cdc5c3bee9c..b7820d94997 100644 --- a/src/effects/underwater.c +++ b/src/effects/underwater.c @@ -21,7 +21,7 @@ EffectInstance* underwater_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4 bp.init = underwater_init; bp.update = underwater_update; - bp.renderWorld = underwater_render; + bp.renderScene = underwater_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_UNDERWATER; @@ -163,7 +163,7 @@ void underwater_appendGfx(void* effect) { s32 i, j; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, nuGfxZBuffer); gSPDisplayList(gMainGfxPos++, D_09000528_3B9F98); diff --git a/src/effects/walking_dust.c b/src/effects/walking_dust.c index 8d8586c2925..96825d4d124 100644 --- a/src/effects/walking_dust.c +++ b/src/effects/walking_dust.c @@ -28,7 +28,7 @@ void walking_dust_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg bp.unk_00 = 0; bp.init = walking_dust_init; bp.update = walking_dust_update; - bp.renderWorld = walking_dust_render; + bp.renderScene = walking_dust_render; bp.renderUI = NULL; bp.effectID = EFFECT_WALKING_DUST; @@ -125,13 +125,12 @@ void walking_dust_appendGfx(void* effect) { break; } - if ((data->unk_6C == 0 && temp_t4 == 6) || (data->unk_6C == 1 && temp_t4 == 7)) { cond = TRUE; } gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->shared->graphics)); gSPDisplayList(gMainGfxPos++, dlist); gDPSetEnvColor(gMainGfxPos++, 0, 0, 0, 127); gDPSetPrimColor(gMainGfxPos++, 0, 0, 230, 222, 222, 110); diff --git a/src/effects/water_block.c b/src/effects/water_block.c index a4b19810015..ea963200604 100644 --- a/src/effects/water_block.c +++ b/src/effects/water_block.c @@ -73,7 +73,7 @@ EffectInstance* water_block_main(s32 type, f32 x, f32 y, f32 z, f32 arg4, s32 du bpPtr->init = water_block_init; bpPtr->update = &water_block_update; - bpPtr->renderWorld = water_block_render; + bpPtr->renderScene = water_block_render; bpPtr->unk_00 = 0; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_WATER_BLOCK; @@ -191,7 +191,7 @@ void water_block_update(EffectInstance* effect) { data->unk_58[i] *= 0.97; data->unk_68[i] += (10.0f - data->unk_68[i]) * 0.1; if (data->unk_48[i] > 480.0f) { - data->unk_88[i] = ~rand_int(10); + data->unk_88[i] = -rand_int(10) - 1; } } } @@ -213,7 +213,7 @@ void water_block_render(EffectInstance* effect) { void func_E00B4574(void) { } -void water_block_appendGfx(void *effect) { +void water_block_appendGfx(void* effect) { Matrix4f sp20; Matrix4f sp60; WaterBlockFXData* data = ((EffectInstance*)effect)->data.waterBlock; @@ -226,7 +226,7 @@ void water_block_appendGfx(void *effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effectTemp->shared->graphics)); guTranslateF(sp20, data->pos.x, data->pos.y, data->pos.z); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/water_fountain.c b/src/effects/water_fountain.c index f69da63b5ae..4067e3b1db4 100644 --- a/src/effects/water_fountain.c +++ b/src/effects/water_fountain.c @@ -129,7 +129,7 @@ EffectInstance* water_fountain_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f32 effectBp.init = water_fountain_init; effectBp.update = water_fountain_update; - effectBp.renderWorld = water_fountain_render; + effectBp.renderScene = water_fountain_render; effectBp.unk_00 = 0; effectBp.renderUI = NULL; effectBp.effectID = EFFECT_WATER_FOUNTAIN; @@ -188,7 +188,6 @@ void water_fountain_update(EffectInstance* effect) { } } - void water_fountain_render(EffectInstance* effect) { RenderTask renderTask; RenderTask* retTask; @@ -205,7 +204,7 @@ void water_fountain_render(EffectInstance* effect) { void func_E00B8200(void) { } -void water_fountain_appendGfx(void *effect) { +void water_fountain_appendGfx(void* effect) { WaterFountainFXData* data = ((EffectInstance*)effect)->data.waterFountain; Camera* camera = &gCameras[gCurrentCameraID]; s32 lifeTime = data->lifeTime; @@ -236,7 +235,7 @@ void water_fountain_appendGfx(void *effect) { } gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z); guScaleF(sp58, data->unk_34, data->unk_34, data->unk_34); diff --git a/src/effects/water_splash.c b/src/effects/water_splash.c index 97658d1ae1d..8416a438004 100644 --- a/src/effects/water_splash.c +++ b/src/effects/water_splash.c @@ -39,7 +39,7 @@ EffectInstance* water_splash_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 ar bpPtr->init = water_splash_init; bpPtr->update = water_splash_update; - bpPtr->renderWorld = water_splash_render; + bpPtr->renderScene = water_splash_render; bpPtr->unk_00 = 0; bpPtr->renderUI = NULL; bpPtr->effectID = EFFECT_WATER_SPLASH; @@ -177,7 +177,7 @@ void water_splash_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, OS_K0_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, OS_K0_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp10, sp94, temp_fp, data->unk_04.z); guScaleF(sp50, data->unk_34, data->unk_34, data->unk_34); guMtxCatF(sp50, sp10, sp10); diff --git a/src/effects/waterfall.c b/src/effects/waterfall.c index b4600fa97d6..9ad57001441 100644 --- a/src/effects/waterfall.c +++ b/src/effects/waterfall.c @@ -24,7 +24,7 @@ EffectInstance* waterfall_main( bp.init = waterfall_init; bp.update = waterfall_update; - bp.renderWorld = waterfall_render; + bp.renderScene = waterfall_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_WATERFALL; @@ -130,7 +130,7 @@ void waterfall_appendGfx(void* effect) { s32 i; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); guTranslateF(sp10, data->unk_04, data->unk_08, data->unk_0C); guScaleF(sp50, scale, scale, scale); diff --git a/src/effects/whirlwind.c b/src/effects/whirlwind.c index 500fa8c34f0..5e2467c291b 100644 --- a/src/effects/whirlwind.c +++ b/src/effects/whirlwind.c @@ -18,7 +18,7 @@ EffectInstance* whirlwind_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, bp.init = whirlwind_init; bp.update = whirlwind_update; - bp.renderWorld = whirlwind_render; + bp.renderScene = whirlwind_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_WHIRLWIND; @@ -172,7 +172,7 @@ void whirlwind_appendGfx(void* effect) { spB0 = data->unk_13C * 4.0f; spB4 = data->unk_140 * 4.0f; gDPPipeSync(gMainGfxPos++); - gSPSegment(gMainGfxPos++, 0x09, OS_K0_TO_PHYSICAL(eff->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, OS_K0_TO_PHYSICAL(eff->shared->graphics)); guTranslateF(sp20, 0.0f, 0.0f, 0.0f); guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); diff --git a/src/effects/windy_leaves.c b/src/effects/windy_leaves.c index dd79041b14e..9f8c4d75889 100644 --- a/src/effects/windy_leaves.c +++ b/src/effects/windy_leaves.c @@ -20,7 +20,7 @@ void windy_leaves_main(s32 type, f32 arg1, f32 arg2, f32 arg3) { bp.init = windy_leaves_init; bp.update = windy_leaves_update; - bp.renderWorld = windy_leaves_render; + bp.renderScene = windy_leaves_render; bp.unk_00 = 0; bp.renderUI = NULL; bp.effectID = EFFECT_WINDY_LEAVES; @@ -241,7 +241,7 @@ void windy_leaves_appendGfx(void* effect) { dlist = D_09001258_33E868; } - gSPSegment(gMainGfxPos++, 0x09, OS_K0_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); + gSPSegment(gMainGfxPos++, 0x09, OS_K0_TO_PHYSICAL(((EffectInstance*)effect)->shared->graphics)); gSPDisplayList(gMainGfxPos++, D_09001180_33E790); gDPSetPrimColor(gMainGfxPos++, 0, 0, 20, 100, 20, part->alpha); guTranslateF(sp18, part->unk_04.x, part->unk_04.y, part->unk_04.z); diff --git a/src/encounter.c b/src/encounter.c index e80bd743090..c6e2b7e380b 100644 --- a/src/encounter.c +++ b/src/encounter.c @@ -175,8 +175,8 @@ s32 gEncounterSubState; EncounterStatus gCurrentEncounter; s8 HasPreBattleSongPushed; -b8 PendingPartnerAbilityResume; -b8 LastBattleStartedBySpin; +s8 PendingPartnerAbilityResume; +s8 LastBattleStartedBySpin; s16 gFirstStrikeMessagePos; BSS s32 WorldMerleeEffectsTime; @@ -2552,7 +2552,6 @@ void create_encounters(void) { enemy->instigatorValue = 0; enemy->aiDetectFlags = npcData->aiDetectFlags; - enemy->aiFlags = npcData->aiFlags; enemy->unk_DC = 0; enemy->aiSuspendTime = 0; diff --git a/src/entity/Block.c b/src/entity/Block.c index 7e4be396c2e..5e0b6f45f31 100644 --- a/src/entity/Block.c +++ b/src/entity/Block.c @@ -279,7 +279,7 @@ void entity_MulticoinBlock_spawn_coin(Entity* entity) { } make_item_entity_nodelay(ITEM_COIN, entity->pos.x, entity->pos.y + 28.0, entity->pos.z, itemSpawnMode, flagIndex); - data->coinsLeft -= 1; + data->coinsLeft--; } if ((data->coinsLeft == 0) || (data->timeLeft == 0)) { @@ -296,7 +296,7 @@ void entity_MulticoinBlock_update_timer(Entity* entity) { if (entity->type == ENTITY_TYPE_MULTI_COIN_BRICK) { if (data->coinsLeft != MULTICOIN_BLOCK_MAX_COINS) { - data->timeLeft -= 1; + data->timeLeft--; if (data->timeLeft < 0) { data->timeLeft = 0; data->coinsLeft = 1; diff --git a/src/entity/model/RedSwitch.c b/src/entity/model/RedSwitch.c index 995a699a093..ea2149168e3 100644 --- a/src/entity/model/RedSwitch.c +++ b/src/entity/model/RedSwitch.c @@ -47,7 +47,6 @@ Mtx Entity_RedSwitch_mtxRedBubble = RDP_MATRIX( 0.000000, 0.000000, 0.000000, 1.000000 ); - Gfx Entity_RedSwitch_RenderRedBubble[] = { gsDPPipeSync(), gsDPSetCycleType(G_CYC_1CYCLE), diff --git a/src/entity/model/ShatteringHammer2Block.c b/src/entity/model/ShatteringHammer2Block.c index 96ed1f77b16..b28acb37059 100644 --- a/src/entity/model/ShatteringHammer2Block.c +++ b/src/entity/model/ShatteringHammer2Block.c @@ -1308,5 +1308,3 @@ Gfx* Entity_ShatteringHammer2Block_FragmentsRender[] = { D_0A001D38_E373A8, D_0A001C30_E372A0, }; - - diff --git a/src/entity/model/UltraBlockContent.c b/src/entity/model/UltraBlockContent.c index 367bbf50716..e5f165df468 100644 --- a/src/entity/model/UltraBlockContent.c +++ b/src/entity/model/UltraBlockContent.c @@ -12,7 +12,6 @@ unsigned char D_0A000400_E4AE80[] = { unsigned char D_0A000600_E4B080[] = { 89, 138, 247, 171, 231, 69, 49, 193, 196, 193, 230, 231, 204, 145, 89, 139, 83, 183, 59, 47, 42, 101, 0, 209, 93, 119, 92, 183, 0, 1, 0, 1 }; - Vtx Entity_UltraBlockContent_vtx[] = { {{{ 13, 13, 0 }, 0, { 0, 0 }, { 255, 255, 255, 255 }}}, {{{ -13, 13, 0 }, 0, { 1024, 0 }, { 255, 255, 255, 255 }}}, diff --git a/src/entity/sbk_omo/Tweester.c b/src/entity/sbk_omo/Tweester.c index d9f5c93aa03..4b652c538a1 100644 --- a/src/entity/sbk_omo/Tweester.c +++ b/src/entity/sbk_omo/Tweester.c @@ -21,7 +21,6 @@ extern Gfx Entity_Tweester_RenderInnerWhirl[]; extern Gfx Entity_Tweester_RenderOuterWhirl[]; extern Gfx Entity_Tweester_Render[]; - void entity_Tweester_render_inner_whirl(s32 entityIndex) { Entity* entity = get_entity_by_index(entityIndex); TweesterData* data = entity->dataBuf.tweester; @@ -109,7 +108,6 @@ void entity_Tweester_setupGfx(s32 entityIndex) { entity_Tweester_render_face(entityIndex); } - void entity_Tweester_update_face_anim(Entity* entity) { TweesterData* data = entity->dataBuf.tweester; s32 i; diff --git a/src/entity_model.c b/src/entity_model.c index 108c890125f..18ecf03664d 100644 --- a/src/entity_model.c +++ b/src/entity_model.c @@ -402,7 +402,6 @@ void appendGfx_entity_model(EntityModel* model) { gDPPipeSync(gMainGfxPos++); } - void draw_entity_model_A(s32 modelIdx, Mtx* transformMtx) { EntityModel* model; RenderTask rt; diff --git a/src/evt/evt.c b/src/evt/evt.c index 25447ae6efd..75fdc811278 100644 --- a/src/evt/evt.c +++ b/src/evt/evt.c @@ -86,7 +86,7 @@ ApiStatus evt_handle_end_loop(Evt* script) { ApiStatus evt_handle_break_loop(Evt* script) { ASSERT(script->loopDepth >= 0); script->ptrNextLine = evt_goto_end_loop(script); - script->loopDepth -= 1; + script->loopDepth--; return ApiStatus_DONE2; } @@ -102,7 +102,7 @@ ApiStatus evt_handle_wait(Evt* script) { return ApiStatus_DONE2; } - script->functionTemp[0] -= 1; + script->functionTemp[0]--; return !script->functionTemp[0]; } @@ -537,7 +537,7 @@ ApiStatus evt_handle_end_switch(Evt* script) { ASSERT(switchDepth >= 0); script->switchBlockState[switchDepth] = 0; - script->switchDepth -= 1; + script->switchDepth--; return ApiStatus_DONE2; } @@ -943,7 +943,6 @@ ApiStatus evt_handle_exec1(Evt* script) { return ApiStatus_DONE2; } - ApiStatus evt_handle_exec1_get_id(Evt* script) { Bytecode* args = script->ptrReadPos; EvtScript* newSource = (EvtScript*)evt_get_variable(script, *args++); diff --git a/src/evt/map_api.c b/src/evt/map_api.c index 6205dec89df..83ec3499024 100644 --- a/src/evt/map_api.c +++ b/src/evt/map_api.c @@ -285,7 +285,7 @@ void apply_transform_to_children(ApiStatus (*apiFunc)(Evt*, s32), Evt* script) { ModelTreeInfo* childModelInfo; s32 parentModelID; s32 originalArg; - s32* argsPtr; + Bytecode* argsPtr; s32 modelIndex; s32 firstChild; s32 lastChild; diff --git a/src/evt/model_api.c b/src/evt/model_api.c index ea6b75379d6..5bbda0244e6 100644 --- a/src/evt/model_api.c +++ b/src/evt/model_api.c @@ -272,7 +272,7 @@ void reset_model_animators(void) { (*gCurrentMeshAnimationListPtr)[i]->animModelID = -1; } - create_worker_world(update_animated_models, render_animated_models); + create_worker_scene(update_animated_models, render_animated_models); } void init_model_animators(void) { diff --git a/src/evt/player_api.c b/src/evt/player_api.c index feae679228b..c32c0b12da1 100644 --- a/src/evt/player_api.c +++ b/src/evt/player_api.c @@ -389,7 +389,7 @@ API_CALLABLE(InterpPlayerYaw) { API_CALLABLE(PlayerFaceNpc) { PlayerStatus* playerStatus = &gPlayerStatus; - s32* args = script->ptrReadPos; + Bytecode* args = script->ptrReadPos; f32* playerTargetYaw = &script->functionTempF[1]; f32* angle = &script->functionTempF[2]; s32* ft3 = &script->functionTemp[3]; diff --git a/src/evt/script_list.c b/src/evt/script_list.c index e73813434a5..58986dabdaf 100644 --- a/src/evt/script_list.c +++ b/src/evt/script_list.c @@ -398,7 +398,6 @@ Evt* start_child_script(Evt* parentScript, EvtScript* source, s32 flags) { child->stateFlags = flags | EVT_FLAG_ACTIVE; child->ptrCurLine = child->ptrFirstLine = child->ptrNextLine = (Bytecode*)source; - child->curOpcode = EVT_OP_INTERNAL_FETCH; child->userData = NULL; child->blockingParent = parentScript; diff --git a/src/evt/virtual_entity.c b/src/evt/virtual_entity.c index 0012a011ec4..678ac4e9f6d 100644 --- a/src/evt/virtual_entity.c +++ b/src/evt/virtual_entity.c @@ -401,7 +401,6 @@ API_CALLABLE(VirtualEntityJumpTo) { yTemp = virtualEntity->goalPos.y - yTemp; goalPosZ = virtualEntity->goalPos.z; - virtualEntity->moveTime = moveTime; virtualEntity->moveAngle = atan2(xTemp, zTemp, goalPosX, goalPosZ); virtualEntity->moveDist = dist2D(xTemp, zTemp, goalPosX, goalPosZ); @@ -666,7 +665,7 @@ void clear_virtual_entity_list(void) { (*gCurrentVirtualEntityListPtr)[i]->entityModelIndex = -1; } - create_worker_world(virtual_entity_list_update, virtual_entity_list_render_world); + create_worker_scene(virtual_entity_list_update, virtual_entity_list_render_world); create_worker_backUI(NULL, virtual_entity_list_render_UI); } diff --git a/src/filemenu/filemenu_common.c b/src/filemenu/filemenu_common.c index 5e587c615d4..558be82edfd 100644 --- a/src/filemenu/filemenu_common.c +++ b/src/filemenu/filemenu_common.c @@ -161,19 +161,19 @@ extern Gfx D_8024B708[]; BSS s32 filemenu_iterFileIdx; BSS s32 filemenu_pressedButtons; -BSS s32 filemenu_cursorHudElem; +BSS HudElemID filemenu_cursorHID; BSS s32 filemenu_heldButtons; BSS s8 filemenu_filename_pos; BSS s32 filemenu_loadedFileIdx; BSS s8 filemenu_currentMenu; BSS s32 filemenu_8024C09C; -BSS s32 filemenu_cursorHudElemID[1]; +BSS HudElemID filemenu_cursorHIDs[1]; BSS s32 filemenu_8024C0A4[3]; -BSS s32 filemenu_hudElemIDs[20]; -BSS s32 filemenu_createfile_hudElems[4]; +BSS HudElemID filemenu_mainHIDs[20]; +BSS HudElemID filemenu_createfile_HIDs[4]; #if VERSION_PAL -BSS s32 D_802517D0[1]; +BSS HudElemID PauseLanguageHIDs[1]; BSS s32 D_802517D4[1]; BSS u16 D_802517E0[2][0x400] ALIGNED(16); #endif @@ -888,9 +888,9 @@ void filemenu_draw_cursor(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 if (temp_a1 > 255) { temp_a1 = 255; } - hud_element_set_alpha(filemenu_cursorHudElemID[0], temp_a1); - hud_element_set_render_pos(filemenu_cursorHudElemID[0], baseX + filemenu_cursor_posX, baseY + filemenu_cursor_posY); - hud_element_draw_without_clipping(filemenu_cursorHudElemID[0]); + hud_element_set_alpha(filemenu_cursorHIDs[0], temp_a1); + hud_element_set_render_pos(filemenu_cursorHIDs[0], baseX + filemenu_cursor_posX, baseY + filemenu_cursor_posY); + hud_element_draw_without_clipping(filemenu_cursorHIDs[0]); } } @@ -1023,12 +1023,12 @@ void filemenu_init(s32 arg0) { DMA_COPY_SEGMENT(ui_images_filemenu_pause); - for (i = 0; i < ARRAY_COUNT(filemenu_cursorHudElemID); i++) { - filemenu_cursorHudElemID[i] = hud_element_create(filemenu_cursor_hudElemScripts[i]); - hud_element_set_flags(filemenu_cursorHudElemID[i], HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); + for (i = 0; i < ARRAY_COUNT(filemenu_cursorHIDs); i++) { + filemenu_cursorHIDs[i] = hud_element_create(filemenu_cursor_hudElemScripts[i]); + hud_element_set_flags(filemenu_cursorHIDs[i], HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); } - filemenu_cursorHudElem = filemenu_cursorHudElemID[0]; + filemenu_cursorHID = filemenu_cursorHIDs[0]; if (arg0 == 0) { filemenu_common_windowBPs[0].style.customStyle->background.imgData = NULL; // ??? } @@ -1118,8 +1118,8 @@ void filemenu_cleanup(void) { MenuPanel** panelIt; s32 i; - for (i = 0; i < ARRAY_COUNT(filemenu_cursorHudElemID); i++) { - hud_element_free(filemenu_cursorHudElemID[i]); + for (i = 0; i < ARRAY_COUNT(filemenu_cursorHIDs); i++) { + hud_element_free(filemenu_cursorHIDs[i]); } panelIt = filemenu_menus; diff --git a/src/filemenu/filemenu_createfile.c b/src/filemenu/filemenu_createfile.c index 68c4a395cc1..dfba79b9419 100644 --- a/src/filemenu/filemenu_createfile.c +++ b/src/filemenu/filemenu_createfile.c @@ -6,7 +6,7 @@ extern HudScript HES_FilenameCaret; extern HudScript HES_FilenameSpace; extern HudScript HES_134F60_135120; -HudScript* filemenu_createfile_hudElemScripts[] = { +HudScript* filemenu_createfile_hudScripts[] = { &HES_FilenameCaret, &HES_FilenameSpace, &HES_134F60_135120 }; @@ -110,11 +110,11 @@ void filemenu_draw_contents_file_create_header( for (i = 0; i < ARRAY_COUNT(filemenu_filename); i++) { xOffset = temp_s2 + 6 + i * 11; - hud_element_set_render_pos(filemenu_createfile_hudElems[1], baseX + xOffset, baseY + yOffset); + hud_element_set_render_pos(filemenu_createfile_HIDs[1], baseX + xOffset, baseY + yOffset); if (i == 0) { - hud_element_draw_without_clipping(filemenu_createfile_hudElems[1]); + hud_element_draw_without_clipping(filemenu_createfile_HIDs[1]); } else { - hud_element_draw_next(filemenu_createfile_hudElems[1]); + hud_element_draw_next(filemenu_createfile_HIDs[1]); } } @@ -125,8 +125,8 @@ void filemenu_draw_contents_file_create_header( xOffset = temp_s2 + 9 + filemenu_filename_pos * 11; } yOffset = 45; - hud_element_set_render_pos(filemenu_createfile_hudElems[0], baseX + xOffset, baseY + yOffset); - hud_element_draw_next(filemenu_createfile_hudElems[0]); + hud_element_set_render_pos(filemenu_createfile_HIDs[0], baseX + xOffset, baseY + yOffset); + hud_element_draw_next(filemenu_createfile_HIDs[0]); } #else s32 xOffset; @@ -139,11 +139,11 @@ void filemenu_draw_contents_file_create_header( xOffset = 41; for (i = 0; i < ARRAY_COUNT(filemenu_filename); i++) { - hud_element_set_render_pos(filemenu_createfile_hudElems[1], baseX + 42 + (i * 11), baseY + xOffset); + hud_element_set_render_pos(filemenu_createfile_HIDs[1], baseX + 42 + (i * 11), baseY + xOffset); if (i == 0) { - hud_element_draw_without_clipping(filemenu_createfile_hudElems[1]); + hud_element_draw_without_clipping(filemenu_createfile_HIDs[1]); } else { - hud_element_draw_next(filemenu_createfile_hudElems[1]); + hud_element_draw_next(filemenu_createfile_HIDs[1]); } } @@ -154,8 +154,8 @@ void filemenu_draw_contents_file_create_header( if (filemenu_filename_pos != tempAmt) { phi_v0 = (filemenu_filename_pos * 11) + 45; } - hud_element_set_render_pos(filemenu_createfile_hudElems[0], baseX + phi_v0, baseY + 45); - hud_element_draw_next(filemenu_createfile_hudElems[0]); + hud_element_set_render_pos(filemenu_createfile_HIDs[0], baseX + phi_v0, baseY + 45); + hud_element_draw_next(filemenu_createfile_HIDs[0]); } #endif } @@ -237,13 +237,13 @@ void filemenu_draw_contents_choose_name( specialChar = c; if (c >= 0xA2 && c < 0xF0) { if (c >= 0xC6) { - hud_element_set_render_pos(filemenu_createfile_hudElems[2], baseX + xOffset + 22, baseY + yOffset + 8); - hud_element_draw_without_clipping(filemenu_createfile_hudElems[2]); + hud_element_set_render_pos(filemenu_createfile_HIDs[2], baseX + xOffset + 22, baseY + yOffset + 8); + hud_element_draw_without_clipping(filemenu_createfile_HIDs[2]); flags = 0; } } if (specialChar == 0xC6) { - xOffset -= 1; + xOffset--; } if (specialChar == 0xC9) { #if VERSION_PAL @@ -264,7 +264,7 @@ void filemenu_draw_contents_choose_name( #endif } if (specialChar == 0xC6 || specialChar == 0xCA || specialChar == 0xC9) { - yOffset -= 1; + yOffset--; xNudge = 9; } #if VERSION_PAL @@ -297,13 +297,13 @@ void filemenu_draw_contents_choose_name( specialChar = c; if (c >= 0xA2 && c < 0xF0) { if (c >= 0xC6) { - hud_element_set_render_pos(filemenu_createfile_hudElems[2], baseX + xOffset + 22, baseY + yOffset + 8); - hud_element_draw_without_clipping(filemenu_createfile_hudElems[2]); + hud_element_set_render_pos(filemenu_createfile_HIDs[2], baseX + xOffset + 22, baseY + yOffset + 8); + hud_element_draw_without_clipping(filemenu_createfile_HIDs[2]); flags = 0; } } if (specialChar == 0xC6) { - xOffset -= 1; + xOffset--; } if (specialChar == 0xC9) { xOffset += FILEMENU_C9_OFFSET; @@ -320,7 +320,7 @@ void filemenu_draw_contents_choose_name( #endif } if (specialChar == 0xC6 || specialChar == 0xCA || specialChar == 0xC9) { - yOffset -= 1; + yOffset--; xNudge = 9; } #if VERSION_PAL @@ -348,9 +348,9 @@ void filemenu_draw_contents_choose_name( void filemenu_choose_name_init(MenuPanel* menu) { s32 i; - for (i = 0; i < ARRAY_COUNT(filemenu_createfile_hudElemScripts); i++) { - filemenu_createfile_hudElems[i] = hud_element_create(filemenu_createfile_hudElemScripts[i]); - hud_element_set_flags(filemenu_createfile_hudElems[i], HUD_ELEMENT_FLAG_80); + for (i = 0; i < ARRAY_COUNT(filemenu_createfile_hudScripts); i++) { + filemenu_createfile_HIDs[i] = hud_element_create(filemenu_createfile_hudScripts[i]); + hud_element_set_flags(filemenu_createfile_HIDs[i], HUD_ELEMENT_FLAG_80); } for (i = 0; i < ARRAY_COUNT(filemenu_createfile_windowBPs); i++) { @@ -532,7 +532,6 @@ void filemenu_choose_name_handle_input(MenuPanel* menu) { } } - if ((filemenu_pressedButtons & BUTTON_B) || ((filemenu_pressedButtons & BUTTON_A) && menu->selected == 0xC9)) { sfx_play_sound(SOUND_CREATE_FILE_BACKSPACE); filemenu_filename_pos--; @@ -615,6 +614,6 @@ void filemenu_choose_name_cleanup(MenuPanel* menu) { s32 i; for (i = 0; i < 3; i++) { - hud_element_free(filemenu_createfile_hudElems[i]); + hud_element_free(filemenu_createfile_HIDs[i]); } } diff --git a/src/filemenu/filemenu_main.c b/src/filemenu/filemenu_main.c index 4dc2a2a8247..b9938d139e9 100644 --- a/src/filemenu/filemenu_main.c +++ b/src/filemenu/filemenu_main.c @@ -81,7 +81,7 @@ extern HudScript HES_OptionMonoOff_es; extern HudScript HES_OptionStereoOn_es; extern HudScript HES_OptionStereoOff_es; -HudScript* filemenu_main_hudElemScripts[][20] = { +HudScript* filemenu_main_hudScripts[][20] = { [LANGUAGE_DEFAULT] = { &HES_Spirit1, &HES_Spirit2, &HES_Spirit3, &HES_Spirit4, &HES_Spirit5, &HES_Spirit6, &HES_Spirit7, &HES_Spirit1Missing, &HES_Spirit2Missing, &HES_Spirit3Missing, &HES_Spirit4Missing, &HES_Spirit5Missing, @@ -390,11 +390,11 @@ void filemenu_draw_contents_stereo( s32 opacity, s32 darkening ) { if (gGameStatusPtr->soundOutputMode == SOUND_OUT_STEREO) { - hud_element_set_render_pos(filemenu_hudElemIDs[18], baseX + 34, baseY + 10); - hud_element_draw_without_clipping(filemenu_hudElemIDs[18]); + hud_element_set_render_pos(filemenu_mainHIDs[18], baseX + 34, baseY + 10); + hud_element_draw_without_clipping(filemenu_mainHIDs[18]); } else { - hud_element_set_render_pos(filemenu_hudElemIDs[19], baseX + 34, baseY + 10); - hud_element_draw_without_clipping(filemenu_hudElemIDs[19]); + hud_element_set_render_pos(filemenu_mainHIDs[19], baseX + 34, baseY + 10); + hud_element_draw_without_clipping(filemenu_mainHIDs[19]); } } @@ -405,11 +405,11 @@ void filemenu_draw_contents_mono( s32 opacity, s32 darkening ) { if (gGameStatusPtr->soundOutputMode == SOUND_OUT_MONO) { - hud_element_set_render_pos(filemenu_hudElemIDs[16], baseX + 34, baseY + 10); - hud_element_draw_without_clipping(filemenu_hudElemIDs[16]); + hud_element_set_render_pos(filemenu_mainHIDs[16], baseX + 34, baseY + 10); + hud_element_draw_without_clipping(filemenu_mainHIDs[16]); } else { - hud_element_set_render_pos(filemenu_hudElemIDs[17], baseX + 34, baseY + 10); - hud_element_draw_without_clipping(filemenu_hudElemIDs[17]); + hud_element_set_render_pos(filemenu_mainHIDs[17], baseX + 34, baseY + 10); + hud_element_draw_without_clipping(filemenu_mainHIDs[17]); } } @@ -598,9 +598,9 @@ void filemenu_draw_contents_file_info(s32 fileIdx, for (i = 0; i < 7; i++) { if (i < gSaveSlotMetadata[fileIdx].spiritsRescued) { - id = filemenu_hudElemIDs[i]; + id = filemenu_mainHIDs[i]; } else { - id = filemenu_hudElemIDs[i + 7]; + id = filemenu_mainHIDs[i + 7]; } hud_element_set_render_pos(id, baseX + 17 + (i * 16), baseY + 44); if (i == 0) { @@ -748,9 +748,9 @@ void filemenu_main_init(MenuPanel* menu) { s32 i; s32 tmp; - for (i = 0; i < ARRAY_COUNT(filemenu_hudElemIDs); i++) { - filemenu_hudElemIDs[i] = hud_element_create(filemenu_main_hudElemScripts[gCurrentLanguage][i]); - hud_element_set_flags(filemenu_hudElemIDs[i], HUD_ELEMENT_FLAG_80); + for (i = 0; i < ARRAY_COUNT(filemenu_mainHIDs); i++) { + filemenu_mainHIDs[i] = hud_element_create(filemenu_main_hudScripts[gCurrentLanguage][i]); + hud_element_set_flags(filemenu_mainHIDs[i], HUD_ELEMENT_FLAG_80); } for (i = 0; i < ARRAY_COUNT(filemenu_main_windowBPs); i++) { @@ -794,9 +794,9 @@ void filemenu_main_init(MenuPanel* menu) { s32 i; s32 tmp; - for (i = 0; i < ARRAY_COUNT(filemenu_hudElemIDs); i++) { - filemenu_hudElemIDs[i] = hud_element_create(filemenu_main_hudElemScripts[gCurrentLanguage][i]); - hud_element_set_flags(filemenu_hudElemIDs[i], HUD_ELEMENT_FLAG_80); + for (i = 0; i < ARRAY_COUNT(filemenu_mainHIDs); i++) { + filemenu_mainHIDs[i] = hud_element_create(filemenu_main_hudScripts[gCurrentLanguage][i]); + hud_element_set_flags(filemenu_mainHIDs[i], HUD_ELEMENT_FLAG_80); } for (i = 0; i < ARRAY_COUNT(filemenu_main_windowBPs); i++) { @@ -1342,7 +1342,7 @@ void filemenu_main_update(MenuPanel* menu) { void filemenu_main_cleanup(MenuPanel* menu) { s32 i; - for (i = 0; i < ARRAY_COUNT(filemenu_hudElemIDs); i++) { - hud_element_free(filemenu_hudElemIDs[i]); + for (i = 0; i < ARRAY_COUNT(filemenu_mainHIDs); i++) { + hud_element_free(filemenu_mainHIDs[i]); } } diff --git a/src/filemenu/filemenu_msg.c b/src/filemenu/filemenu_msg.c index 69471084cb9..59c3f9551c2 100644 --- a/src/filemenu/filemenu_msg.c +++ b/src/filemenu/filemenu_msg.c @@ -106,7 +106,6 @@ u8 D_filemenu_80250964[] = {0xB8, 0xB4, 0xA0, 0xCC}; u8 D_filemenu_80250968[] = {0x00, 0x00, 0x00, 0x10}; #endif - #if VERSION_IQUE u8 filemenu_msg_01[] = { 0xF7, 0xF7, 0xF7, 0xF7, 0xF7, 0x7A, 0x14, 0x7B, 0x14, 0x79, 0x19, 0x7F, 0x06, 0x79, 0x04, 0x7A, 0x04, 0xFD }; u8 filemenu_msg_02[] = { 0xF7, 0xF7, 0xF7, 0xF7, 0xF7, 0x7A, 0x14, 0x7B, 0x14, 0x79, 0x19, 0x7F, 0x06, 0x8C, 0x30, 0x6C, 0x12, 0xFD }; @@ -152,7 +151,6 @@ u8 filemenu_msg_33[] = { 0x74, 0x08, 0xFD }; u8 filemenu_msg_34[] = { 0x75, 0x05, 0xFD }; #elif VERSION_PAL - u8 filemenu_msg_24[] = {0x1F, 0xFD}; // Select file to start @@ -276,7 +274,6 @@ u8 filemenu_msg_38[] = {0x13, 0xFD}; u8 filemenu_msg_39[] = {0x14, 0xFD}; u8 filemenu_createfile_gridData[] = {0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x61, 0x66, 0x6A, 0x6D, 0x6F, 0x73, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x81, 0x82, 0x84, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x10, 0x0E, 0x0D, 0xF7, 0x00, 0x90, 0x91, 0x20, 0xF7, 0xF7, 0xF7, 0xC9, 0xF7, 0xF7, 0xCA, 0xF7, 0xF7}; - #else u8 filemenu_msg_01[] = { 0x33, 0x45, 0x4C, 0x45, 0x43, 0x54, 0xF7, 0x46, 0x49, 0x4C, 0x45, 0xF7, 0x54, 0x4F, 0xF7, 0x53, 0x54, 0x41, 0x52, 0x54, 0x1A, 0xFD }; @@ -492,7 +489,6 @@ u8 **gFileMenuMessages_intl[] = { }; #endif - s32 filemenu_draw_char(s32 c, s32 x, s32 y, s32 flag1, s32 color, s32 flag2) { MessageCharset* charset; s32 texSizeX; diff --git a/src/filemenu/filemenu_selectlanguage.c b/src/filemenu/filemenu_selectlanguage.c index 7ff46218008..01734f654cd 100644 --- a/src/filemenu/filemenu_selectlanguage.c +++ b/src/filemenu/filemenu_selectlanguage.c @@ -7,7 +7,7 @@ extern HudScript HES_Spirit1; -HudScript* D_filemenu_8024F120[] = { &HES_Spirit1 }; +HudScript* PauseLanguageHudScripts[] = { &HES_Spirit1 }; u32 D_filemenu_8024F124 = 0x00000000; @@ -207,9 +207,9 @@ void filemenu_selectlanguage_init(MenuPanel* menu) { s16* posXPtr; s32 i; - for (i = 0; i < ARRAY_COUNT(D_filemenu_8024F120); i++) { - D_802517D0[i] = hud_element_create(D_filemenu_8024F120[i]); - hud_element_set_flags(D_802517D0[i], HUD_ELEMENT_FLAG_80); + for (i = 0; i < ARRAY_COUNT(PauseLanguageHudScripts); i++) { + PauseLanguageHIDs[i] = hud_element_create(PauseLanguageHudScripts[i]); + hud_element_set_flags(PauseLanguageHIDs[i], HUD_ELEMENT_FLAG_80); } for (i = 0; i < ARRAY_COUNT(D_filemenu_8024F1D8); i++) { @@ -367,7 +367,7 @@ void filemenu_selectlanguage_update(MenuPanel* menu) { void filemenu_selectlanguage_cleanup(MenuPanel* arg0) { s32 i; - for (i = 0; i < ARRAY_COUNT(D_802517D0); i++) { - hud_element_free(D_802517D0[i]); + for (i = 0; i < ARRAY_COUNT(PauseLanguageHIDs); i++) { + hud_element_free(PauseLanguageHIDs[i]); } } diff --git a/src/game_states.c b/src/game_states.c index bb480eacf60..7a8750e143a 100644 --- a/src/game_states.c +++ b/src/game_states.c @@ -16,7 +16,6 @@ void clear_game_modes(void) { } } - // Function is unused. GameMode* set_next_game_mode(GameMode* mode) { GameMode* gameMode; diff --git a/src/global_hud_scripts.c b/src/global_hud_scripts.c index b22a8d44c24..1b95bd0651c 100644 --- a/src/global_hud_scripts.c +++ b/src/global_hud_scripts.c @@ -31,8 +31,8 @@ INCLUDE_PAL("ui/input/analog_stick_down.pal", ui_input_analog_stick_down_pal); INCLUDE_IMG("ui/input/analog_stick_up.png", ui_input_analog_stick_up_png); INCLUDE_PAL("ui/input/analog_stick_up.pal", ui_input_analog_stick_up_pal); -INCLUDE_IMG("ui/unk_bar.png", ui_unk_bar_png); -INCLUDE_PAL("ui/unk_bar.pal", ui_unk_bar_pal); +INCLUDE_IMG("ui/input/mash_bar.png", ui_input_mash_bar_png); +INCLUDE_PAL("ui/input/mash_bar.pal", ui_input_mash_bar_pal); INCLUDE_IMG("ui/ok.png", ui_ok_png); INCLUDE_PAL("ui/ok.pal", ui_ok_pal); @@ -2308,7 +2308,7 @@ HudScript HES_Happy_es = HES_TEMPLATE_CI_ENUM_SIZE(ui_battle_status_happy_es, 40 HudScript HES_HPDrain_es = HES_TEMPLATE_CI_ENUM_SIZE(ui_battle_status_hp_drain_es, 40, 16); #endif -HudScript HES_BlueMeter = HES_TEMPLATE_CI_CUSTOM_SIZE(ui_unk_bar, 72, 16); +HudScript HES_BlueMeter = HES_TEMPLATE_CI_CUSTOM_SIZE(ui_input_mash_bar, 72, 16); HudScript HES_AButton = HES_TEMPLATE_CI_CUSTOM_SIZE(ui_input_a_button_unpressed, 48, 40); diff --git a/src/heaps.c b/src/heaps.c index 76bad8a06a7..d7359af0fc1 100644 --- a/src/heaps.c +++ b/src/heaps.c @@ -2,7 +2,7 @@ #include "audio.h" #include "model.h" -typedef s32 TlbEntry[0x1000 / 4]; +typedef s8 TlbEntry[0x1000]; typedef TlbEntry TlbMappablePage[15]; BSS TlbMappablePage gEffectDataBuffer ALIGNED(0x1000); diff --git a/src/hud_element.c b/src/hud_element.c index a1d6f4eb522..7c5d1b03a65 100644 --- a/src/hud_element.c +++ b/src/hud_element.c @@ -726,7 +726,7 @@ s32 hud_element_create(HudScript* anim) { ASSERT(id < ARRAY_COUNT(*gHudElements)); (*gHudElements)[id] = hudElement = heap_malloc(sizeof(*hudElement)); - gHudElementsNumber += 1; + gHudElementsNumber++; ASSERT(hudElement != NULL); diff --git a/src/hud_element.h b/src/hud_element.h index ea9d0fe92ed..9dfbfddf850 100644 --- a/src/hud_element.h +++ b/src/hud_element.h @@ -8,8 +8,6 @@ typedef s32 HudScript[]; -typedef s32 HudElemID; - enum { HUD_ELEMENT_OP_End, HUD_ELEMENT_OP_SetRGBA, @@ -122,7 +120,7 @@ typedef struct PopupMenu { /* 0x104 */ char unk_104[0x4]; /* 0x108 */ s32 userIndex[32]; // used to map menu order to a user-ID for each item /* 0x188 */ char unk_188[0x4]; - /* 0x18C */ s32 enabled[32]; + /* 0x18C */ b32 enabled[32]; /* 0x20C */ char unk_20C[0x4]; /* 0x210 */ s32 value[32]; // sale price, etc /* 0x290 */ char unk_290[0x4]; @@ -155,7 +153,7 @@ typedef struct Shop { /* 0x014 */ ShopItemLocation* itemDataPositions; /* 0x018 */ ShopItemData* staticInventory; /* 0x01C */ ShopSellPriceData* staticPriceList; - /* 0x020 */ s32 costIconID; + /* 0x020 */ HudElemID costHID; /* 0x024 */ s32 inventoryItemFlags; /* 0x028 */ PopupMenu itemSelectMenu; /* 0x358 */ s32 unk_358; diff --git a/src/i_spy.c b/src/i_spy.c index 30a19e452f7..24d3d1f2e69 100644 --- a/src/i_spy.c +++ b/src/i_spy.c @@ -159,5 +159,3 @@ void ispy_notification_update(void) { break; } } - - diff --git a/src/imgfx.c b/src/imgfx.c index 7ba39647f73..3af6fb8ee26 100644 --- a/src/imgfx.c +++ b/src/imgfx.c @@ -3,7 +3,6 @@ #include "sprite.h" #include "imgfx.h" - #if VERSION_JP // TODO remove once segments are split extern Addr imgfx_data_ROM_START; #endif diff --git a/src/inventory.c b/src/inventory.c index 78b623ad7fa..7ab6285c4ad 100644 --- a/src/inventory.c +++ b/src/inventory.c @@ -9,8 +9,14 @@ enum BlinkModes { BLINK_ON = 1, }; -BSS b16 D_8010CD10; -BSS b16 D_8010CD12; +enum ShimmerStates { + STATUS_SHIMMER_OFF = 0, + STATUS_SHIMMER_BEGIN = 1, + STATUS_SHIMMER_ON = 2, +}; + +BSS b16 ShowingCoinCounter; +BSS b16 HidingCoinCounter; StatusBar gStatusBar; @@ -48,8 +54,8 @@ void clear_player_data(void) { PlayerData* playerData = &gPlayerData; s32 i; - D_8010CD10 = FALSE; - D_8010CD12 = FALSE; + ShowingCoinCounter = FALSE; + HidingCoinCounter = FALSE; playerData->hammerLevel = -1; playerData->curHP = 10; @@ -321,11 +327,11 @@ void enforce_hpfp_limits(void) { void initialize_status_bar(void) { StatusBar* statusBar = &gStatusBar; PlayerData* playerData = &gPlayerData; - s32 iconIndex; + HudElemID hid; statusBar->drawPosX = 12; - D_8010CD10 = FALSE; - D_8010CD12 = FALSE; + ShowingCoinCounter = FALSE; + HidingCoinCounter = FALSE; statusBar->drawPosY = FULLY_RETRACTED_Y; statusBar->hidden = FALSE; statusBar->showTimer = 210; @@ -334,16 +340,16 @@ void initialize_status_bar(void) { statusBar->openInputDisabled = FALSE; statusBar->alwaysShown = FALSE; statusBar->hpBlinking = BLINK_OFF; - statusBar->hpBlinkCounter = 0; - statusBar->hpBlinkTimer = 0; + statusBar->hpBlinkAnimTime = 0; + statusBar->hpBlinkTimeLeft = 0; statusBar->fpBlinking = BLINK_OFF; - statusBar->fpBlinkCounter = 0; - statusBar->fpBlinkTimer = 0; - statusBar->spBlinking = BLINK_OFF; - statusBar->spBlinkCounter = 0; + statusBar->fpBlinkAnimTime = 0; + statusBar->fpBlinkTimeLeft = 0; + statusBar->starPowerBlinking = BLINK_OFF; + statusBar->starPowerBlinkCounter = 0; statusBar->coinsBlinking = BLINK_OFF; - statusBar->coinsBlinkCounter = 0; - statusBar->coinsBlinkTimer = 0; + statusBar->coinsBlinkAnimTime = 0; + statusBar->coinsBlinkTimeLeft = 0; statusBar->disabled = 0; statusBar->starpointsBlinking = BLINK_OFF; statusBar->displayHP = playerData->curHP; @@ -351,15 +357,15 @@ void initialize_status_bar(void) { statusBar->displayCoins = playerData->coins; statusBar->displayStarpoints = playerData->starPoints; statusBar->displayStarPower = playerData->starPower; - statusBar->starpointsBlinkCounter = 0; - statusBar->unk_6E = -1; + statusBar->starpointsBlinkAnimTime = 0; + statusBar->prevIgnoreChanges = -1; statusBar->unk_3C = FALSE; - statusBar->unk_57 = 0; - statusBar->unk_58 = 0; - statusBar->unk_59 = 0; - statusBar->spBarsToBlink = 0; - statusBar->coinCounterHideTime = 0; - statusBar->unk_6D = 0; + statusBar->shimmerState = STATUS_SHIMMER_OFF; + statusBar->shimmerTime = 0; + statusBar->shimmerLimit = 0; + statusBar->powBarsToBlink = 0; + statusBar->coinCounterHideDelay = 0; + statusBar->coinCountDisposeTime = 0; statusBar->iconIndex12 = -1; close_status_bar(); @@ -367,96 +373,96 @@ void initialize_status_bar(void) { #if VERSION_PAL switch (gCurrentLanguage) { case LANGUAGE_EN: - iconIndex = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP); + hid = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP); break; case LANGUAGE_DE: - iconIndex = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP_de); + hid = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP_de); break; case LANGUAGE_FR: - iconIndex = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP_fr); + hid = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP_fr); break; case LANGUAGE_ES: - iconIndex = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP_es); + hid = statusBar->hpIconHIDs[0] = hud_element_create(&HES_StatusHP_es); break; } - hud_element_set_flags(iconIndex, HUD_ELEMENT_FLAG_80); - hud_element_clear_flags(iconIndex, HUD_ELEMENT_FLAG_FILTER_TEX); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); #else - statusBar->hpIconHIDs[0] = iconIndex = hud_element_create(&HES_StatusHP); - hud_element_set_flags(iconIndex, HUD_ELEMENT_FLAG_80); - hud_element_clear_flags(iconIndex, HUD_ELEMENT_FLAG_FILTER_TEX); + statusBar->hpIconHIDs[0] = hid = hud_element_create(&HES_StatusHP); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); #endif - statusBar->hpIconHIDs[1] = iconIndex = hud_element_create(&HES_StatusHeart); - hud_element_set_flags(iconIndex, HUD_ELEMENT_FLAG_80); - hud_element_clear_flags(iconIndex, HUD_ELEMENT_FLAG_FILTER_TEX); + statusBar->hpIconHIDs[1] = hid = hud_element_create(&HES_StatusHeart); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); #if VERSION_PAL switch (gCurrentLanguage) { case LANGUAGE_EN: - iconIndex = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP); + hid = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP); break; case LANGUAGE_DE: - iconIndex = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP_de); + hid = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP_de); break; case LANGUAGE_FR: - iconIndex = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP_fr); + hid = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP_fr); break; case LANGUAGE_ES: - iconIndex = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP_es); + hid = statusBar->fpIconHIDs[0] = hud_element_create(&HES_StatusFP_es); break; } - hud_element_set_flags(iconIndex, HUD_ELEMENT_FLAG_80); - hud_element_clear_flags(iconIndex, HUD_ELEMENT_FLAG_FILTER_TEX); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); #else - statusBar->fpIconHIDs[0] = iconIndex = hud_element_create(&HES_StatusFP); - hud_element_set_flags(iconIndex, HUD_ELEMENT_FLAG_80); - hud_element_clear_flags(iconIndex, HUD_ELEMENT_FLAG_FILTER_TEX); + statusBar->fpIconHIDs[0] = hid = hud_element_create(&HES_StatusFP); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); #endif - statusBar->fpIconHIDs[1] = iconIndex = hud_element_create(&HES_StatusFlower); - hud_element_set_flags(iconIndex, HUD_ELEMENT_FLAG_80); - hud_element_clear_flags(iconIndex, HUD_ELEMENT_FLAG_FILTER_TEX); + statusBar->fpIconHIDs[1] = hid = hud_element_create(&HES_StatusFlower); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); - statusBar->coinIconHID = iconIndex = hud_element_create(&HES_StatusCoin); - hud_element_set_flags(iconIndex, HUD_ELEMENT_FLAG_80); - hud_element_clear_flags(iconIndex, HUD_ELEMENT_FLAG_FILTER_TEX); + statusBar->coinIconHID = hid = hud_element_create(&HES_StatusCoin); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); - statusBar->coinSparkleHID = iconIndex = hud_element_create(&HES_Item_CoinSparkleRandom); - hud_element_set_flags(iconIndex, HUD_ELEMENT_FLAG_80); - hud_element_clear_flags(iconIndex, HUD_ELEMENT_FLAG_FILTER_TEX); + statusBar->coinSparkleHID = hid = hud_element_create(&HES_Item_CoinSparkleRandom); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); - statusBar->spIconHID = iconIndex = hud_element_create(&HES_StatusStarPoint); - hud_element_set_flags(iconIndex, HUD_ELEMENT_FLAG_80); - hud_element_clear_flags(iconIndex, HUD_ELEMENT_FLAG_FILTER_TEX); + statusBar->spIconHID = hid = hud_element_create(&HES_StatusStarPoint); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); - statusBar->spShineHID = iconIndex = hud_element_create(&HES_StatusSPShine); - hud_element_set_flags(iconIndex, HUD_ELEMENT_FLAG_80); - hud_element_clear_flags(iconIndex, HUD_ELEMENT_FLAG_FILTER_TEX); + statusBar->spShineHID = hid = hud_element_create(&HES_StatusSPShine); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); - statusBar->hpTimesHID = iconIndex = hud_element_create(&HES_StatusTimes); - hud_element_set_flags(iconIndex, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_clear_flags(iconIndex, HUD_ELEMENT_FLAG_FILTER_TEX); + statusBar->hpTimesHID = hid = hud_element_create(&HES_StatusTimes); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); - statusBar->fpTimesHID = iconIndex = hud_element_create(&HES_StatusTimes); - hud_element_set_flags(iconIndex, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_clear_flags(iconIndex, HUD_ELEMENT_FLAG_FILTER_TEX); + statusBar->fpTimesHID = hid = hud_element_create(&HES_StatusTimes); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); - statusBar->spTimesHID = iconIndex = hud_element_create(&HES_StatusTimes); - hud_element_set_flags(iconIndex, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_clear_flags(iconIndex, HUD_ELEMENT_FLAG_FILTER_TEX); + statusBar->spTimesHID = hid = hud_element_create(&HES_StatusTimes); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); - statusBar->coinTimesHID = iconIndex = hud_element_create(&HES_StatusTimes); - hud_element_set_flags(iconIndex, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - hud_element_clear_flags(iconIndex, HUD_ELEMENT_FLAG_FILTER_TEX); + statusBar->coinTimesHID = hid = hud_element_create(&HES_StatusTimes); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); - statusBar->starIconHID = iconIndex = hud_element_create(&HES_StatusStar1); - hud_element_set_flags(iconIndex, HUD_ELEMENT_FLAG_80); - hud_element_clear_flags(iconIndex, HUD_ELEMENT_FLAG_FILTER_TEX); + statusBar->starIconHID = hid = hud_element_create(&HES_StatusStar1); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_FILTER_TEX); - func_800F0D5C(); + star_power_shimmer_init(); } void status_bar_draw_number(s32 iconID, s32 startX, s32 startY, s32 value, s32 numDigits) { @@ -558,7 +564,7 @@ void update_status_bar(void) { PlayerData* playerData = &gPlayerData; PlayerStatus* playerStatus = &gPlayerStatus; s32 sp50; - s32 sp54; + b32 showAddedBar; s32 i; s32 x; s32 y; @@ -740,23 +746,23 @@ void update_status_bar(void) { draw_box(0, WINDOW_STYLE_5, x, y, 0, 174, 35, 255, 0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, NULL, NULL, NULL, SCREEN_WIDTH, SCREEN_HEIGHT, NULL); draw_box(0, WINDOW_STYLE_6, x + 174, y, 0, 122, 25, 255, 0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, NULL, NULL, NULL, SCREEN_WIDTH, SCREEN_HEIGHT, NULL); - if (statusBar->hpBlinkTimer > 0) { - statusBar->hpBlinkTimer--; - if (statusBar->hpBlinkTimer == 0) { + if (statusBar->hpBlinkTimeLeft > 0) { + statusBar->hpBlinkTimeLeft--; + if (statusBar->hpBlinkTimeLeft == 0) { status_bar_stop_blinking_hp(); } } showStat = TRUE; if (statusBar->hpBlinking != BLINK_OFF) { - if (statusBar->hpBlinkCounter > 8) { + if (statusBar->hpBlinkAnimTime > 8) { showStat = FALSE; - if (statusBar->hpBlinkCounter > 12) { - statusBar->hpBlinkCounter = 0; + if (statusBar->hpBlinkAnimTime > 12) { + statusBar->hpBlinkAnimTime = 0; showStat = TRUE; } } - statusBar->hpBlinkCounter++; + statusBar->hpBlinkAnimTime++; } if (showStat) { @@ -777,23 +783,23 @@ void update_status_bar(void) { status_bar_draw_stat(statusBar->hpTimesHID, x, y, statusBar->displayHP, playerData->curMaxHP); } - if (statusBar->fpBlinkTimer > 0) { - statusBar->fpBlinkTimer--; - if (statusBar->fpBlinkTimer == 0) { + if (statusBar->fpBlinkTimeLeft > 0) { + statusBar->fpBlinkTimeLeft--; + if (statusBar->fpBlinkTimeLeft == 0) { status_bar_stop_blinking_fp(); } } showStat = TRUE; if (statusBar->fpBlinking != BLINK_OFF) { - if (statusBar->fpBlinkCounter > 8) { + if (statusBar->fpBlinkAnimTime > 8) { showStat = FALSE; - if (statusBar->fpBlinkCounter > 12) { - statusBar->fpBlinkCounter = 0; + if (statusBar->fpBlinkAnimTime > 12) { + statusBar->fpBlinkAnimTime = 0; showStat = TRUE; } } - statusBar->fpBlinkCounter++; + statusBar->fpBlinkAnimTime++; } if (showStat) { @@ -820,14 +826,14 @@ void update_status_bar(void) { showStat = TRUE; if (statusBar->starpointsBlinking != BLINK_OFF) { - if (statusBar->starpointsBlinkCounter > 8) { - if (statusBar->starpointsBlinkCounter <= 12) { + if (statusBar->starpointsBlinkAnimTime > 8) { + if (statusBar->starpointsBlinkAnimTime <= 12) { showStat = FALSE; } else { - statusBar->starpointsBlinkCounter = 0; + statusBar->starpointsBlinkAnimTime = 0; } } - statusBar->starpointsBlinkCounter++; + statusBar->starpointsBlinkAnimTime++; } if (showStat) { @@ -848,23 +854,23 @@ void update_status_bar(void) { status_bar_draw_number(statusBar->spTimesHID, x, y, playerData->starPoints, 2); } - if (statusBar->coinsBlinkTimer > 0) { - statusBar->coinsBlinkTimer--; - if (statusBar->coinsBlinkTimer == 0) { + if (statusBar->coinsBlinkTimeLeft > 0) { + statusBar->coinsBlinkTimeLeft--; + if (statusBar->coinsBlinkTimeLeft == 0) { status_bar_stop_blinking_coins(); } } showStat = TRUE; if (statusBar->coinsBlinking != BLINK_OFF) { - if (statusBar->coinsBlinkCounter > 8) { + if (statusBar->coinsBlinkAnimTime > 8) { showStat = FALSE; - if (statusBar->coinsBlinkCounter > 12) { - statusBar->coinsBlinkCounter = 0; + if (statusBar->coinsBlinkAnimTime > 12) { + statusBar->coinsBlinkAnimTime = 0; showStat = TRUE; } } - statusBar->coinsBlinkCounter++; + statusBar->coinsBlinkAnimTime++; } if (showStat) { @@ -887,16 +893,16 @@ void update_status_bar(void) { id = statusBar->starIconHID; showStat = TRUE; - if (statusBar->spBlinking != BLINK_OFF) { - if (statusBar->spBlinkCounter > 5) { - if (statusBar->spBlinkCounter <= 8) { + if (statusBar->starPowerBlinking != BLINK_OFF) { + if (statusBar->starPowerBlinkCounter > 5) { + if (statusBar->starPowerBlinkCounter <= 8) { showStat = FALSE; } else { - statusBar->spBlinkCounter = 0; + statusBar->starPowerBlinkCounter = 0; showStat = TRUE; } } - statusBar->spBlinkCounter++; + statusBar->starPowerBlinkCounter++; } x = statusBar->drawPosX + 20; @@ -906,28 +912,30 @@ void update_status_bar(void) { limit = statusBar->displayStarPower % SP_PER_BAR; limit /= 32; limit += spBars * 8; - if (statusBar->unk_57 == 1) { + if (statusBar->shimmerState == STATUS_SHIMMER_BEGIN) { spBars = playerData->starPower / SP_PER_BAR; limit = playerData->starPower % SP_PER_BAR; limit = limit / 32; limit += spBars * 8; - func_800F0CB0(0, x + limit * 25 / 10, y, 1.0f); - statusBar->unk_57 = 2; + star_power_shimmer_start(0, x + limit * 25 / 10, y, 1.0f); + statusBar->shimmerState = STATUS_SHIMMER_ON; } - sp54 = FALSE; - if (statusBar->unk_57 != 0) { - if (statusBar->unk_58 != 0) { - statusBar->unk_58--; + showAddedBar = FALSE; + if (statusBar->shimmerState != STATUS_SHIMMER_OFF) { + if (statusBar->shimmerTime != 0) { + statusBar->shimmerTime--; } else { - statusBar->unk_57 = 0; + statusBar->shimmerState = STATUS_SHIMMER_OFF; } - if ((statusBar->unk_58 / 5) & 1) { - sp54 = TRUE; + // creates a stipple pattern repeating 5x zero, 5x one, ... + if ((statusBar->shimmerTime / 5) & 1) { + showAddedBar = TRUE; } - maxStarPower = statusBar->unk_59; // required to match - s7 = statusBar->unk_59 % 8; - s7 += statusBar->unk_59 / 8 * 8; + maxStarPower = statusBar->shimmerLimit; // required to match + // added together, these just equal shimmerLimit + s7 = statusBar->shimmerLimit % 8; + s7 += (statusBar->shimmerLimit / 8) * 8; } else { s7 = limit; } @@ -936,9 +944,9 @@ void update_status_bar(void) { sp50 = 0; s1 = 0; - if (statusBar->spBlinking != BLINK_OFF) { + if (statusBar->starPowerBlinking != BLINK_OFF) { if (!showStat) { - s32 limit = statusBar->spBarsToBlink * 8; + s32 limit = statusBar->powBarsToBlink * 8; do {} while (0); if (sp50 < limit) { while (TRUE) { @@ -961,7 +969,7 @@ void update_status_bar(void) { } while (TRUE) { - if (i >= limit || i >= s7 && !sp54) { + if (i >= limit || i >= s7 && !showAddedBar) { break; } i++; @@ -971,7 +979,7 @@ void update_status_bar(void) { hud_element_draw_next(id); s1++; - if (i >= limit || i >= s7 && !sp54) { + if (i >= limit || i >= s7 && !showAddedBar) { break; } i++; @@ -980,7 +988,7 @@ void update_status_bar(void) { hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[1], y - 2); hud_element_draw_next(id); s1++; - if (i >= limit || i >= s7 && !sp54) { + if (i >= limit || i >= s7 && !showAddedBar) { break; } i++; @@ -988,7 +996,7 @@ void update_status_bar(void) { hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[2], y - 2); hud_element_draw_next(id); s1++; - if (i >= limit || i >= s7 && !sp54) { + if (i >= limit || i >= s7 && !showAddedBar) { break; } i++; @@ -996,7 +1004,7 @@ void update_status_bar(void) { hud_element_set_render_pos(id, x + sp50 * 20 + StatusBarSPIncrementOffsets[3], y - 2); hud_element_draw_next(id); s1++; - if (i >= limit || i >= s7 && !sp54) { + if (i >= limit || i >= s7 && !showAddedBar) { break; } i++; @@ -1005,7 +1013,7 @@ void update_status_bar(void) { hud_element_draw_next(id); s1++; - if (i >= limit || i >= s7 && !sp54) { + if (i >= limit || i >= s7 && !showAddedBar) { break; } i++; @@ -1014,7 +1022,7 @@ void update_status_bar(void) { hud_element_draw_next(id); s1++; - if (i >= limit || i >= s7 && !sp54) { + if (i >= limit || i >= s7 && !showAddedBar) { break; } i++; @@ -1023,7 +1031,7 @@ void update_status_bar(void) { hud_element_draw_next(id); s1++; - if (i >= limit || i >= s7 && !sp54) { + if (i >= limit || i >= s7 && !showAddedBar) { break; } i++; @@ -1033,7 +1041,7 @@ void update_status_bar(void) { s1 = 0; sp50++; - if (i >= limit || i >= s7 && !sp54) { + if (i >= limit || i >= s7 && !showAddedBar) { break; } } @@ -1128,8 +1136,8 @@ void update_status_bar(void) { sp50++; } - func_800F0D80(); - func_800F102C(); + star_power_shimmer_update(); + star_power_shimmer_draw(); } void coin_counter_draw_content(UNK_TYPE arg0, s32 posX, s32 posY) { @@ -1157,92 +1165,95 @@ void update_coin_counter(void) { do {} while (0); // Needed to match - if (statusBar->unk_6D != 0) { - statusBar->unk_6D--; - if ((statusBar->unk_6D == 0) && (statusBar->iconIndex12 > -1)) { + if (statusBar->coinCountDisposeTime != 0) { + statusBar->coinCountDisposeTime--; + if ((statusBar->coinCountDisposeTime == 0) && (statusBar->iconIndex12 > -1)) { hud_element_free(statusBar->iconIndex12); hud_element_free(statusBar->iconIndex13); statusBar->iconIndex12 = -1; } - D_8010CD12 = FALSE; + HidingCoinCounter = FALSE; } - if (statusBar->coinCounterHideTime == 0) { + if (statusBar->coinCounterHideDelay == 0) { return; } - if ((statusBar->displayCoins == playerData->coins) && (statusBar->coinCounterHideTime > 30)) { - statusBar->coinCounterHideTime = 30; + if ((statusBar->displayCoins == playerData->coins) && (statusBar->coinCounterHideDelay > 30)) { + statusBar->coinCounterHideDelay = 30; } - if ((statusBar->displayCoins == playerData->coins) || (statusBar->coinCounterHideTime <= 30)) { - statusBar->coinCounterHideTime--; - if (statusBar->coinCounterHideTime == 0) { - set_window_update(WINDOW_ID_CURRENCY_COUNTER, (s32)basic_hidden_window_update); - statusBar->unk_6D = 15; - D_8010CD10 = FALSE; - D_8010CD12 = TRUE; - statusBar->iconIndex12 = statusBar->coinCountTimesHID; - statusBar->iconIndex13 = statusBar->coinCountIconHID; - statusBar->displayCoins = playerData->coins; - if (statusBar->unk_6E > -1) { - statusBar->ignoreChanges = statusBar->unk_6E; - statusBar->unk_6E = -1; - } + if ((statusBar->displayCoins == playerData->coins) || (statusBar->coinCounterHideDelay <= 30)) { + statusBar->coinCounterHideDelay--; + if (statusBar->coinCounterHideDelay != 0) { + return; + } + + set_window_update(WINDOW_ID_CURRENCY_COUNTER, (s32)basic_hidden_window_update); + statusBar->coinCountDisposeTime = 15; + ShowingCoinCounter = FALSE; + HidingCoinCounter = TRUE; + statusBar->iconIndex12 = statusBar->coinCountTimesHID; + statusBar->iconIndex13 = statusBar->coinCountIconHID; + statusBar->displayCoins = playerData->coins; + if (statusBar->prevIgnoreChanges > -1) { + statusBar->ignoreChanges = statusBar->prevIgnoreChanges; + statusBar->prevIgnoreChanges = -1; } } } void show_coin_counter(void) { StatusBar* statusBar = &gStatusBar; - s32 index; + HudElemID hid; - if (D_8010CD10 || D_8010CD12) { + // if a coin counter is already visible, dispose of previous counter and reset state + if (ShowingCoinCounter || HidingCoinCounter) { set_window_update(WINDOW_ID_CURRENCY_COUNTER, WINDOW_UPDATE_HIDE); if (statusBar->iconIndex12 > -1) { hud_element_free(statusBar->coinCountTimesHID); hud_element_free(statusBar->coinCountIconHID); statusBar->iconIndex12 = -1; } - statusBar->coinCounterHideTime = 0; - statusBar->unk_6D = 0; - D_8010CD10 = FALSE; - D_8010CD12 = FALSE; + statusBar->coinCounterHideDelay = 0; + statusBar->coinCountDisposeTime = 0; + ShowingCoinCounter = FALSE; + HidingCoinCounter = FALSE; } - if (statusBar->coinCounterHideTime == 0) { + if (statusBar->coinCounterHideDelay == 0) { set_window_properties(WINDOW_ID_CURRENCY_COUNTER, 32, 164, 64, 20, WINDOW_PRIORITY_21, coin_counter_draw_content, 0, -1); set_window_update(WINDOW_ID_CURRENCY_COUNTER, (s32)basic_window_update); - statusBar->coinCountTimesHID = index = hud_element_create(&HES_MenuTimes); - hud_element_set_flags(index, HUD_ELEMENT_FLAG_80); - hud_element_set_tint(index, 255, 255, 255); - statusBar->coinCountIconHID = index = hud_element_create(&HES_StatusCoin); - hud_element_set_flags(index, HUD_ELEMENT_FLAG_80); - hud_element_set_tint(index, 255, 255, 255); - statusBar->coinCounterHideTime = 0; - - if (statusBar->unk_6E < 0) { - statusBar->unk_6E = statusBar->ignoreChanges; + statusBar->coinCountTimesHID = hid = hud_element_create(&HES_MenuTimes); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_set_tint(hid, 255, 255, 255); + statusBar->coinCountIconHID = hid = hud_element_create(&HES_StatusCoin); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + hud_element_set_tint(hid, 255, 255, 255); + statusBar->coinCounterHideDelay = 0; + + if (statusBar->prevIgnoreChanges < 0) { + statusBar->prevIgnoreChanges = statusBar->ignoreChanges; } statusBar->ignoreChanges = TRUE; - D_8010CD10 = TRUE; + ShowingCoinCounter = TRUE; } } void hide_coin_counter(void) { StatusBar* statusBar = &gStatusBar; - if (D_8010CD10 && (statusBar->coinCounterHideTime == 0)) { - statusBar->coinCounterHideTime = 60; + if (ShowingCoinCounter && (statusBar->coinCounterHideDelay == 0)) { + statusBar->coinCounterHideDelay = 60; } } void hide_coin_counter_immediately(void) { StatusBar* statusBar = &gStatusBar; - if (D_8010CD10 && (statusBar->coinCounterHideTime == 0)) { - statusBar->coinCounterHideTime = 1; + if (ShowingCoinCounter && (statusBar->coinCounterHideDelay == 0)) { + statusBar->coinCounterHideDelay = 1; } } @@ -1373,12 +1384,12 @@ void status_bar_start_blinking_hp(void) { StatusBar* statusBar = &gStatusBar; if (gGameStatusPtr->context == CONTEXT_WORLD) { - statusBar->hpBlinkTimer = 120; + statusBar->hpBlinkTimeLeft = 120; } if (statusBar->hpBlinking != BLINK_ON) { statusBar->hpBlinking = BLINK_ON; - statusBar->hpBlinkCounter = 0; + statusBar->hpBlinkAnimTime = 0; } } @@ -1387,8 +1398,8 @@ void status_bar_stop_blinking_hp(void) { if (statusBar->hpBlinking != BLINK_OFF) { statusBar->hpBlinking = BLINK_OFF; - statusBar->hpBlinkCounter = 0; - statusBar->hpBlinkTimer = 0; + statusBar->hpBlinkAnimTime = 0; + statusBar->hpBlinkTimeLeft = 0; } } @@ -1396,12 +1407,12 @@ void status_bar_start_blinking_fp(void) { StatusBar* statusBar = &gStatusBar; if (gGameStatusPtr->context == CONTEXT_WORLD) { - statusBar->fpBlinkTimer = 120; + statusBar->fpBlinkTimeLeft = 120; } if (statusBar->fpBlinking != BLINK_ON) { statusBar->fpBlinking = BLINK_ON; - statusBar->fpBlinkCounter = 0; + statusBar->fpBlinkAnimTime = 0; } } @@ -1410,7 +1421,7 @@ void status_bar_stop_blinking_fp(void) { if (statusBar->fpBlinking != BLINK_OFF) { statusBar->fpBlinking = BLINK_OFF; - statusBar->fpBlinkCounter = 0; + statusBar->fpBlinkAnimTime = 0; } } @@ -1418,12 +1429,12 @@ void status_bar_start_blinking_coins(void) { StatusBar* statusBar = &gStatusBar; if (gGameStatusPtr->context == CONTEXT_WORLD) { - statusBar->coinsBlinkTimer = 120; + statusBar->coinsBlinkTimeLeft = 120; } if (statusBar->coinsBlinking != BLINK_ON) { statusBar->coinsBlinking = BLINK_ON; - statusBar->coinsBlinkCounter = 0; + statusBar->coinsBlinkAnimTime = 0; } } @@ -1432,8 +1443,8 @@ void status_bar_stop_blinking_coins(void) { if (statusBar->coinsBlinking != BLINK_OFF) { statusBar->coinsBlinking = BLINK_OFF; - statusBar->coinsBlinkCounter = 0; - statusBar->coinsBlinkTimer = 0; + statusBar->coinsBlinkAnimTime = 0; + statusBar->coinsBlinkTimeLeft = 0; } } @@ -1441,29 +1452,29 @@ void status_bar_start_blinking_sp(void) { PlayerData* playerData = &gPlayerData; StatusBar* statusBar = &gStatusBar; - statusBar->spBarsToBlink = playerData->maxStarPower; - if (statusBar->spBlinking != BLINK_ON) { - statusBar->spBlinking = BLINK_ON; - statusBar->spBlinkCounter = 0; + statusBar->powBarsToBlink = playerData->maxStarPower; + if (statusBar->starPowerBlinking != BLINK_ON) { + statusBar->starPowerBlinking = BLINK_ON; + statusBar->starPowerBlinkCounter = 0; } } void status_bar_stop_blinking_sp(void) { StatusBar* statusBar = &gStatusBar; - if (statusBar->spBlinking != BLINK_OFF) { - statusBar->spBlinking = BLINK_OFF; - statusBar->spBlinkCounter = 0; + if (statusBar->starPowerBlinking != BLINK_OFF) { + statusBar->starPowerBlinking = BLINK_OFF; + statusBar->starPowerBlinkCounter = 0; } } void status_bar_start_blinking_sp_bars(s32 numBarsToBlink) { StatusBar* statusBar = &gStatusBar; - statusBar->spBarsToBlink = numBarsToBlink; - if (statusBar->spBlinking != BLINK_ON) { - statusBar->spBlinking = BLINK_ON; - statusBar->spBlinkCounter = 0; + statusBar->powBarsToBlink = numBarsToBlink; + if (statusBar->starPowerBlinking != BLINK_ON) { + statusBar->starPowerBlinking = BLINK_ON; + statusBar->starPowerBlinkCounter = 0; } } @@ -1472,7 +1483,7 @@ void status_bar_start_blinking_starpoints(void) { if (statusBar->starpointsBlinking != BLINK_ON) { statusBar->starpointsBlinking = BLINK_ON; - statusBar->starpointsBlinkCounter = 0; + statusBar->starpointsBlinkAnimTime = 0; } } @@ -1481,7 +1492,7 @@ void status_bar_stop_blinking_starpoints(void) { if (statusBar->starpointsBlinking != BLINK_OFF) { statusBar->starpointsBlinking = BLINK_OFF; - statusBar->starpointsBlinkCounter = 0; + statusBar->starpointsBlinkAnimTime = 0; } } @@ -1524,20 +1535,20 @@ void reset_status_bar(void) { statusBar->openInputDisabled = FALSE; statusBar->alwaysShown = FALSE; statusBar->hpBlinking = BLINK_OFF; - statusBar->hpBlinkCounter = 0; - statusBar->hpBlinkTimer = 0; + statusBar->hpBlinkAnimTime = 0; + statusBar->hpBlinkTimeLeft = 0; statusBar->fpBlinking = BLINK_OFF; - statusBar->fpBlinkCounter = 0; - statusBar->fpBlinkTimer = 0; + statusBar->fpBlinkAnimTime = 0; + statusBar->fpBlinkTimeLeft = 0; statusBar->coinsBlinking = BLINK_OFF; - statusBar->coinsBlinkCounter = 0; - statusBar->coinsBlinkTimer = 0; - statusBar->spBlinking = BLINK_OFF; - statusBar->spBlinkCounter = 0; + statusBar->coinsBlinkAnimTime = 0; + statusBar->coinsBlinkTimeLeft = 0; + statusBar->starPowerBlinking = BLINK_OFF; + statusBar->starPowerBlinkCounter = 0; statusBar->disabled = 0; statusBar->starpointsBlinking = BLINK_OFF; - statusBar->starpointsBlinkCounter = 0; - statusBar->unk_6E = -1; + statusBar->starpointsBlinkAnimTime = 0; + statusBar->prevIgnoreChanges = -1; statusBar->displayHP = playerData->curHP; statusBar->displayFP = playerData->curFP; statusBar->displayCoins = playerData->coins; @@ -1978,17 +1989,17 @@ void add_star_power(s32 amt) { // TODO cleanup PlayerData* playerData = &gPlayerData; StatusBar* statusBar = &gStatusBar; - s32 phi_v1; s32 maxPower; + s32 newPower; - statusBar->unk_57 = 1; - statusBar->unk_58 = 60; + statusBar->shimmerState = STATUS_SHIMMER_BEGIN; + statusBar->shimmerTime = 60; - phi_v1 = playerData->starPower; + newPower = playerData->starPower; if (playerData->starPower < 0) { - phi_v1 = playerData->starPower + 31; + newPower = playerData->starPower + 31; } - statusBar->unk_59 = phi_v1 >> 5; // same as / SP_PER_SEG + statusBar->shimmerLimit = newPower >> 5; // same as / SP_PER_SEG playerData->starPower += amt; diff --git a/src/item_entity.c b/src/item_entity.c index a7f4bb2471b..16f58cfcc74 100644 --- a/src/item_entity.c +++ b/src/item_entity.c @@ -44,7 +44,7 @@ BSS s16 D_801565A8; BSS s32 D_801565AC; #endif BSS PopupMenu ItemPickupMenu; -BSS s32 ItemPickupIconID; +BSS HudElemID ItemPickupIconHID; BSS s32 ItemPickupStateDelay; BSS s32 ThrowAwayMenuIdx; BSS s32 ThrowAwayItemID; @@ -262,7 +262,7 @@ void clear_item_entity_data(void) { ItemEntityRenderGroup = 0; } - create_worker_world(NULL, draw_item_entities); + create_worker_scene(NULL, draw_item_entities); create_worker_frontUI(NULL, draw_ui_item_entities); isPickingUpItem = FALSE; #if !VERSION_JP @@ -2152,9 +2152,9 @@ void update_item_entity_pickup(ItemEntity* item) { } } - ItemPickupIconID = hud_element_create(gItemHudScripts[gItemTable[item->itemID].hudElemID].enabled); - hud_element_set_flags(ItemPickupIconID, HUD_ELEMENT_FLAG_80); - hud_element_set_render_pos(ItemPickupIconID, -100, -100); + ItemPickupIconHID = hud_element_create(gItemHudScripts[gItemTable[item->itemID].hudElemID].enabled); + hud_element_set_flags(ItemPickupIconHID, HUD_ELEMENT_FLAG_80); + hud_element_set_render_pos(ItemPickupIconHID, -100, -100); item->state = ITEM_PICKUP_STATE_SHOW_GOT_ITEM; if (!(item->flags & ITEM_ENTITY_FLAG_2000000)) { @@ -2369,7 +2369,7 @@ void update_item_entity_pickup(ItemEntity* item) { partner_enable_input(); gOverrideFlags &= ~GLOBAL_OVERRIDES_40; } - hud_element_free(ItemPickupIconID); + hud_element_free(ItemPickupIconHID); remove_item_entity_by_reference(item); sort_items(); decrement_status_bar_disabled(); @@ -2431,7 +2431,7 @@ void update_item_entity_pickup(ItemEntity* item) { ThrowAwayMenuIdx = 1; } ThrowAwayItemID = menu->userIndex[ThrowAwayMenuIdx - 1]; - hud_element_set_script(ItemPickupIconID, menu->ptrIcon[ThrowAwayMenuIdx - 1]); + hud_element_set_script(ItemPickupIconHID, menu->ptrIcon[ThrowAwayMenuIdx - 1]); get_item_entity( make_item_entity_delayed( @@ -2474,7 +2474,7 @@ void update_item_entity_pickup(ItemEntity* item) { enable_player_input(); partner_enable_input(); gOverrideFlags &= ~GLOBAL_OVERRIDES_40; - hud_element_free(ItemPickupIconID); + hud_element_free(ItemPickupIconHID); remove_item_entity_by_reference(item); sort_items(); decrement_status_bar_disabled(); @@ -2685,8 +2685,8 @@ void draw_content_pickup_item_header(ItemEntity* item, s32 posX, s32 posY) { } else { draw_msg(itemMsg, posX + X_PICKUP_ITEM_2, posY + Y_PICKUP_ITEM_2, 255, MSG_PAL_2F, 0); if (!(item->pickupMsgFlags & (ITEM_PICKUP_FLAG_1_COIN | ITEM_PICKUP_FLAG_3_STAR_PIECES))) { - hud_element_set_render_pos(ItemPickupIconID, posX + 20, posY + 20); - hud_element_draw_next(ItemPickupIconID); + hud_element_set_render_pos(ItemPickupIconHID, posX + 20, posY + 20); + hud_element_draw_next(ItemPickupIconHID); } } break; @@ -2694,8 +2694,8 @@ void draw_content_pickup_item_header(ItemEntity* item, s32 posX, s32 posY) { case ITEM_PICKUP_STATE_HIDE_THREW_AWAY: set_message_text_var(gItemTable[ThrowAwayItemID].nameMsg, 0); draw_msg(MSG_Menus_005F, posX + X_PICKUP_THREW, posY + Y_PICKUP_THREW, 255, MSG_PAL_2F, 0); - hud_element_set_render_pos(ItemPickupIconID, posX + 20, posY + 20); - hud_element_draw_next(ItemPickupIconID); + hud_element_set_render_pos(ItemPickupIconHID, posX + 20, posY + 20); + hud_element_draw_next(ItemPickupIconHID); break; } } diff --git a/src/model.c b/src/model.c index f739a540e61..3143c0a5994 100644 --- a/src/model.c +++ b/src/model.c @@ -1296,7 +1296,7 @@ s32 RenderTaskBasePriorities[] = { [RENDER_MODE_CLOUD_NO_ZB] = 700000, }; -b8 D_8014C248 = FALSE; // possibly a 'warm-up done' flag for boot. never read. +s8 D_8014C248 = FALSE; // possibly a 'warm-up done' flag for boot. never read. ModelCustomGfxBuilderList* gCurrentCustomModelGfxBuildersPtr; ModelNode** gCurrentModelTreeRoot; @@ -3111,7 +3111,6 @@ void make_texture_gfx(TextureHeader* header, Gfx** gfxPos, IMG_PTR raster, PAL_P auxFmt = header->auxFmt; auxBitDepth = header->auxBitDepth; - if (extraTileType == EXTRA_TILE_AUX_INDEPENDENT) { if (palette != NULL) { auxPaletteIndex = 1; @@ -3378,7 +3377,7 @@ void load_model_transforms(ModelNode* model, ModelNode* parent, Matrix4f mdlTran (*gCurrentModelTreeNodeInfo)[TreeIterPos].modelIndex = -1; (*gCurrentModelTreeNodeInfo)[TreeIterPos].treeDepth = treeDepth; - TreeIterPos += 1; + TreeIterPos++; return; } } @@ -3401,7 +3400,7 @@ void load_model_transforms(ModelNode* model, ModelNode* parent, Matrix4f mdlTran mdl_create_model(modelBPptr, 4); (*gCurrentModelTreeNodeInfo)[TreeIterPos].treeDepth = treeDepth; - TreeIterPos += 1; + TreeIterPos++; } s32 get_model_list_index_from_tree_index(s32 treeIndex) { @@ -4047,7 +4046,6 @@ void mdl_local_gfx_copy_vertices(Vtx* src, s32 num, Vtx* dest) { } } - void mdl_make_local_vertex_copy(s32 copyIndex, u16 modelID, s32 isMakingCopy) { s32 numVertices; Vtx* baseVtx; diff --git a/src/msg.c b/src/msg.c index ba3c5708a7c..21f0a3ebc87 100644 --- a/src/msg.c +++ b/src/msg.c @@ -482,7 +482,7 @@ s32 _update_message(MessagePrintState* printer) { } break; case MSG_WINDOW_STATE_B: - printer->unk_4CC += 1; + printer->unk_4CC++; endPosDist = abs(printer->curLinePos - printer->lineEndPos[printer->unkArraySize]); lineIncAmt = 2; @@ -2184,7 +2184,7 @@ void msg_draw_choice_pointer(MessagePrintState* printer) { posY = baseY + (targetY - baseY) * moveToTargetAlpha; } - posY += 1; + posY++; posX += (cosine(posInterpPhase * 38 + 270) + 1.0) * 0.5 * 3.2; posX -= 2; diff --git a/src/msg_draw.c b/src/msg_draw.c index a2f38d17674..4c677f7bc98 100644 --- a/src/msg_draw.c +++ b/src/msg_draw.c @@ -606,7 +606,7 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit if (printer->fadeOutCounter >= 5) { printer->stateFlags |= MSG_STATE_FLAG_1; } - frameAlpha = ~(printer->fadeOutCounter * 0x2E); + frameAlpha = -(printer->fadeOutCounter * 46) - 1; sp8E = ((u8)frameAlpha) * 0.6; frameFading = 1; if (sp8E >= 32) { @@ -1562,7 +1562,7 @@ void appendGfx_message(MessagePrintState* printer, s16 posX, s16 posY, u16 addit if (msg_drawState->printModeFlags & MSG_PRINT_FLAG_2) { msg_drawState->printModeFlags &= ~MSG_PRINT_FLAG_2; } - msg_drawState->visiblePrintedCount += 1; + msg_drawState->visiblePrintedCount++; msg_drawState->nextPos[0] += #if VERSION_IQUE msg_drawState->msgScale.x * 14.0f; diff --git a/src/npc.c b/src/npc.c index 5a71e31016c..59a8be94672 100644 --- a/src/npc.c +++ b/src/npc.c @@ -10,7 +10,7 @@ s16 gNpcCount; static NpcList gWorldNpcList; static NpcList gBattleNpcList; static NpcList* gCurrentNpcListPtr; -static b8 gNpcPlayerCollisionsEnabled; +static s8 gNpcPlayerCollisionsEnabled; #define PAL_ANIM_END 0xFF @@ -903,7 +903,6 @@ void appendGfx_npc(void* data) { guMtxCatF(mtx2, mtx1, mtx1); } - if (npc->scale.x * SPRITE_WORLD_SCALE_D != 1.0f || (npc->scale.y * npc->verticalStretch) * SPRITE_WORLD_SCALE_D != 1.0f || npc->scale.z * SPRITE_WORLD_SCALE_D != 1.0f @@ -2467,7 +2466,7 @@ void init_encounter_status(void) { func_80045AC0(); gEncounterState = ENCOUNTER_STATE_NONE; - create_worker_world(NULL, npc_render_worker_do_nothing); + create_worker_scene(NULL, npc_render_worker_do_nothing); } void clear_encounter_status(void) { @@ -2506,7 +2505,7 @@ void clear_encounter_status(void) { func_80045AC0(); gEncounterState = ENCOUNTER_STATE_NONE; - create_worker_world(NULL, npc_render_worker_do_nothing); + create_worker_scene(NULL, npc_render_worker_do_nothing); } void func_8003E50C(void) { diff --git a/src/39210_len_aa0.c b/src/npc_follow.c similarity index 100% rename from src/39210_len_aa0.c rename to src/npc_follow.c diff --git a/src/pause/pause_badges.c b/src/pause/pause_badges.c index 6554df0a0e1..ad306e0f5c1 100644 --- a/src/pause/pause_badges.c +++ b/src/pause/pause_badges.c @@ -917,10 +917,8 @@ void pause_badges_init(MenuPanel* panel) { } for (i = 0; i < ARRAY_COUNT(gPauseBadgesIconIDs); i++) { - s32 iconID = hud_element_create(gPauseBadgesElements[gCurrentLanguage][i]); - - gPauseBadgesIconIDs[i] = iconID; - hud_element_set_flags(iconID, HUD_ELEMENT_FLAG_80); + gPauseBadgesIconIDs[i] = hud_element_create(gPauseBadgesElements[gCurrentLanguage][i]); + hud_element_set_flags(gPauseBadgesIconIDs[i], HUD_ELEMENT_FLAG_80); } for (i = 0; i < ARRAY_COUNT(gPauseBadgesWindowBPs); i++) { @@ -994,16 +992,16 @@ void pause_badges_handle_input(MenuPanel* panel) { if (heldButtons & (BUTTON_STICK_UP | BUTTON_Z)) { if (heldButtons & BUTTON_STICK_UP) { - selectedRow -= 1; + selectedRow--; if (selectedRow < 0) { selectedRow = 0; } if (selectedRow < gPauseBadgesPages[gPauseBadgesCurrentPage].listStart) { - gPauseBadgesCurrentPage -= 1; + gPauseBadgesCurrentPage--; } } else { // Z button press - gPauseBadgesCurrentPage -= 1; + gPauseBadgesCurrentPage--; if (gPauseBadgesCurrentPage < 0) { gPauseBadgesCurrentPage = 0; } @@ -1021,8 +1019,8 @@ void pause_badges_handle_input(MenuPanel* panel) { if (selectedRow >= (page->listStart + page->numRows)) { gPauseBadgesCurrentPage += 1; if (!gPauseBadgesPages[gPauseBadgesCurrentPage].enabled) { - gPauseBadgesCurrentPage -= 1; - selectedRow -= 1; + gPauseBadgesCurrentPage--; + selectedRow--; } } } else { @@ -1033,7 +1031,7 @@ void pause_badges_handle_input(MenuPanel* panel) { newPage = &gPauseBadgesPages[gPauseBadgesCurrentPage]; if (!newPage->enabled) { - gPauseBadgesCurrentPage -= 1; + gPauseBadgesCurrentPage--; } else { selectedRow = newPage->listStart; } @@ -1043,7 +1041,7 @@ void pause_badges_handle_input(MenuPanel* panel) { newPageNumCols = gPauseBadgesPages[gPauseBadgesCurrentPage].numCols; if (gPauseBadgesItemIds[selectedRow * newPageNumCols] != BADGE_NONE_STANDIN) { if (gPauseHeldButtons & BUTTON_STICK_LEFT) { - selectedCol -= 1; + selectedCol--; if (selectedCol < 0) { selectedCol = newPageNumCols - 1; } diff --git a/src/pause/pause_common.h b/src/pause/pause_common.h index e8dfa161c46..d148bf55c83 100644 --- a/src/pause/pause_common.h +++ b/src/pause/pause_common.h @@ -103,7 +103,7 @@ extern s32 gPauseHeldButtons; extern s32 gPausePressedButtons; extern s32 gPauseCurrentDescMsg; extern HudScript* gPauseCurrentDescIconScript; -extern s32 gPauseCursorIconID; +extern HudElemID gPauseCursorHID; extern s8 gPauseMenuCurrentTab; void pause_update_tab_default(s32 windowIndex, s32* flags, s32* posX, s32* posY, s32* posZ, f32* scaleX, f32* scaleY, diff --git a/src/pause/pause_items.c b/src/pause/pause_items.c index 8795af791d3..9e9584d2f3b 100644 --- a/src/pause/pause_items.c +++ b/src/pause/pause_items.c @@ -21,12 +21,12 @@ static s32 gPauseItemsTargetScrollPos; static s32 gPauseItemsTargetScrollIndex; static s32 gPauseItemsLevel; static s32 gPauseItemsCurrentTab; -static s32 gPauseItemsIconIDs[20]; +static HudElemID gPauseItemsHIDs[20]; #define ITEM_NONE_STANDIN 0x7FFE #define ITEM_INVALID 0x7FFF -HudScript* gPauseItemsElements[] = { +HudScript* gPauseItemsHudScripts[] = { &HES_StatBp, &HES_StatBp, &HES_StatBp, &HES_StatBp, &HES_StatBp, &HES_StatBp, &HES_StatBp, &HES_StatBp, &HES_StatBp, &HES_StatBp, &HES_StatBp, &HES_StatBp, &HES_StatBp, &HES_StatBp, &HES_StatBp, @@ -166,7 +166,7 @@ void pause_items_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, for (i = 0; i < 3; i++) { for (pageIndex = 0; pageIndex < 20; pageIndex++) { - iconIDs = gPauseItemsIconIDs; + iconIDs = gPauseItemsHIDs; page = &gPauseItemsPages[pageIndex]; if (!page->enabled) { @@ -233,7 +233,7 @@ void pause_items_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, hud_element_clear_flags(itemIcon, HUD_ELEMENT_FLAG_DROP_SHADOW); hud_element_set_flags(itemIcon, HUD_ELEMENT_FLAG_FILTER_TEX); if (isNone) { - itemIcon = gPauseItemsIconIDs[19]; + itemIcon = gPauseItemsHIDs[19]; } else { if (isSelected) { hud_element_set_flags(itemIcon, HUD_ELEMENT_FLAG_DROP_SHADOW); @@ -286,13 +286,13 @@ void pause_items_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, if (gPauseMenuCurrentTab == 3 && gPauseItemsLevel == 1) { if (gPauseItemsCurrentPage > 0) { - hud_element_set_render_pos(gPauseItemsIconIDs[16], baseX + 278, baseY + 14); - hud_element_draw_without_clipping(gPauseItemsIconIDs[16]); + hud_element_set_render_pos(gPauseItemsHIDs[16], baseX + 278, baseY + 14); + hud_element_draw_without_clipping(gPauseItemsHIDs[16]); } if (gPauseItemsPages [gPauseItemsCurrentPage + 1].enabled) { - hud_element_set_render_pos(gPauseItemsIconIDs[17], baseX + 278, baseY + 146); - hud_element_draw_without_clipping(gPauseItemsIconIDs[17]); + hud_element_set_render_pos(gPauseItemsHIDs[17], baseX + 278, baseY + 146); + hud_element_draw_without_clipping(gPauseItemsHIDs[17]); } } @@ -434,9 +434,9 @@ void pause_items_init(MenuPanel* panel) { gPauseItemsCurrentTab = 0; pause_items_load_items(FALSE); - for (i = 0; i < ARRAY_COUNT(gPauseItemsIconIDs); i++) { - gPauseItemsIconIDs[i] = hud_element_create(gPauseItemsElements[i]); - hud_element_set_flags(gPauseItemsIconIDs[i], HUD_ELEMENT_FLAG_80); + for (i = 0; i < ARRAY_COUNT(gPauseItemsHIDs); i++) { + gPauseItemsHIDs[i] = hud_element_create(gPauseItemsHudScripts[i]); + hud_element_set_flags(gPauseItemsHIDs[i], HUD_ELEMENT_FLAG_80); } for (i = 0; i < ARRAY_COUNT(gPauseItemsWindowBPs); i++) { @@ -591,7 +591,7 @@ void pause_items_update(MenuPanel* panel) { void pause_items_cleanup(MenuPanel* panel) { s32 i; - for (i = 0; i < ARRAY_COUNT(gPauseItemsIconIDs); i++) { - hud_element_free(gPauseItemsIconIDs[i]); + for (i = 0; i < ARRAY_COUNT(gPauseItemsHIDs); i++) { + hud_element_free(gPauseItemsHIDs[i]); } } diff --git a/src/pause/pause_main.c b/src/pause/pause_main.c index 02b5bcb4b83..dfbc83f1f7b 100644 --- a/src/pause/pause_main.c +++ b/src/pause/pause_main.c @@ -24,7 +24,7 @@ BSS s32 gPauseHeldButtons; BSS s32 gPausePressedButtons; BSS s32 gPauseCurrentDescMsg; BSS HudScript* gPauseCurrentDescIconScript; -BSS s32 gPauseCursorIconID; +BSS HudElemID gPauseCursorHID; BSS s8 gPauseMenuCurrentTab; BSS s8 D_802700D[7]; //padding @@ -32,7 +32,7 @@ static s32 gPauseTutorialFrameCounter; #if !VERSION_IQUE static s32 D_802700E4; #endif -static s32 gPauseCommonIconIDs[8]; +static HudElemID gPauseCommonHIDs[8]; static s32 gPauseShownDescMsg; static s32 gPauseDescTextMaxPos; static s32 gPauseDescTextPos; @@ -40,7 +40,7 @@ static s32 gPauseDescTextOffset; static HudScript* gPauseShownDescIconScript; static s32 gPauseTutorialSprites[3]; -static HudScript* gPauseIconScripts[] = { +static HudScript* gPauseHudScripts[] = { &HES_AnimatedCursorHand, &HES_DescMsgPrev, &HES_DescMsgNext, &HES_UnusedBadge, &HES_StickTapRight, &HES_PressAButton, &HES_PressStartButton, &HES_StartButtonText }; @@ -478,9 +478,9 @@ void pause_draw_cursor(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 hei if (currentOpacity > 255) { currentOpacity = 255; } - hud_element_set_alpha(gPauseCommonIconIDs[0], currentOpacity); - hud_element_set_render_pos(gPauseCommonIconIDs[0], baseX + gPauseCursorPosX, baseY + gPauseCursorPosY); - hud_element_draw_without_clipping(gPauseCommonIconIDs[0]); + hud_element_set_alpha(gPauseCommonHIDs[0], currentOpacity); + hud_element_set_render_pos(gPauseCommonHIDs[0], baseX + gPauseCursorPosX, baseY + gPauseCursorPosY); + hud_element_draw_without_clipping(gPauseCommonHIDs[0]); } } @@ -495,13 +495,13 @@ void pause_textbox_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 widt } if (gPauseDescTextPos != 0) { - hud_element_set_render_pos(gPauseCommonIconIDs[1], baseX + width - 4, baseY + 4); - hud_element_draw_without_clipping(gPauseCommonIconIDs[1]); + hud_element_set_render_pos(gPauseCommonHIDs[1], baseX + width - 4, baseY + 4); + hud_element_draw_without_clipping(gPauseCommonHIDs[1]); } if (gPauseDescTextPos < gPauseDescTextMaxPos) { - hud_element_set_render_pos(gPauseCommonIconIDs[2], baseX + width - 4, baseY + height - 4); - hud_element_draw_without_clipping(gPauseCommonIconIDs[2]); + hud_element_set_render_pos(gPauseCommonHIDs[2], baseX + width - 4, baseY + height - 4); + hud_element_draw_without_clipping(gPauseCommonHIDs[2]); } gDPPipeSync(gMainGfxPos++); @@ -509,12 +509,12 @@ void pause_textbox_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 widt draw_msg(msgID, baseX + 10, baseY - gPauseDescTextOffset, 255, MSG_PAL_STANDARD, 0); if (gPauseShownDescIconScript != 0) { gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - hud_element_set_render_pos(gPauseCommonIconIDs[3], baseX - 4, baseY + 16); - hud_element_set_script(gPauseCommonIconIDs[3], gPauseShownDescIconScript); - hud_element_set_flags(gPauseCommonIconIDs[3], HUD_ELEMENT_FLAG_DROP_SHADOW); - hud_element_clear_flags(gPauseCommonIconIDs[3], HUD_ELEMENT_FLAG_FILTER_TEX); - hud_element_set_scale(gPauseCommonIconIDs[3], 1.0f); - hud_element_draw_without_clipping(gPauseCommonIconIDs[3]); + hud_element_set_render_pos(gPauseCommonHIDs[3], baseX - 4, baseY + 16); + hud_element_set_script(gPauseCommonHIDs[3], gPauseShownDescIconScript); + hud_element_set_flags(gPauseCommonHIDs[3], HUD_ELEMENT_FLAG_DROP_SHADOW); + hud_element_clear_flags(gPauseCommonHIDs[3], HUD_ELEMENT_FLAG_FILTER_TEX); + hud_element_set_scale(gPauseCommonHIDs[3], 1.0f); + hud_element_draw_without_clipping(gPauseCommonHIDs[3]); } } @@ -593,14 +593,14 @@ void pause_tutorial_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 wid get_msg_properties(pause_get_menu_msg(gPauseTutorialDescMessages[state]), &msgHeight2, &msgWidth2, &msgMaxLineChars2, &msgNumLines2, &msgMaxLinesPerPage2, NULL, 1); margin2 = (s32)(width - msgWidth2) >> 1; draw_msg(pause_get_menu_msg(gPauseTutorialDescMessages[state]), baseX + margin2, baseY + 13 + state * 140 - gPauseTutorialScrollPos, 255, MSG_PAL_STANDARD, DRAW_MSG_STYLE_MENU); - hud_element_set_render_pos(gPauseCommonIconIDs[gPauseTutorialIconIDs[gPauseTutorialState]], baseX + width / 2 - 2, baseY + 52); - hud_element_set_flags(gPauseCommonIconIDs[gPauseTutorialIconIDs[gPauseTutorialState]], HUD_ELEMENT_FLAG_FILTER_TEX); - hud_element_set_scale(gPauseCommonIconIDs[gPauseTutorialIconIDs[gPauseTutorialState]], 0.5f); - hud_element_draw_without_clipping(gPauseCommonIconIDs[gPauseTutorialIconIDs[gPauseTutorialState]]); + hud_element_set_render_pos(gPauseCommonHIDs[gPauseTutorialIconIDs[gPauseTutorialState]], baseX + width / 2 - 2, baseY + 52); + hud_element_set_flags(gPauseCommonHIDs[gPauseTutorialIconIDs[gPauseTutorialState]], HUD_ELEMENT_FLAG_FILTER_TEX); + hud_element_set_scale(gPauseCommonHIDs[gPauseTutorialIconIDs[gPauseTutorialState]], 0.5f); + hud_element_draw_without_clipping(gPauseCommonHIDs[gPauseTutorialIconIDs[gPauseTutorialState]]); if (gPauseTutorialIconIDs[gPauseTutorialState] == 6) { - hud_element_set_render_pos(gPauseCommonIconIDs[7], baseX + width / 2 + 1, baseY + 50); - hud_element_draw_without_clipping(gPauseCommonIconIDs[7]); + hud_element_set_render_pos(gPauseCommonHIDs[7], baseX + width / 2 + 1, baseY + 50); + hud_element_draw_without_clipping(gPauseCommonHIDs[7]); } draw_msg(pause_get_menu_msg(gPauseTutorialCmdMessages[gPauseTutorialState]), baseX + width / 2 + 10, baseY + 44, 255, MSG_PAL_STANDARD, 0); @@ -615,16 +615,16 @@ void pause_init(void) { DMA_COPY_SEGMENT(ui_images_filemenu_pause); - for (i = 0; i < ARRAY_COUNT(gPauseIconScripts); i++) { - gPauseCommonIconIDs[i] = hud_element_create(gPauseIconScripts[i]); - if (gPauseIconScripts[i] == &HES_AnimatedCursorHand) { - hud_element_set_flags(gPauseCommonIconIDs[i], HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); + for (i = 0; i < ARRAY_COUNT(gPauseHudScripts); i++) { + gPauseCommonHIDs[i] = hud_element_create(gPauseHudScripts[i]); + if (gPauseHudScripts[i] == &HES_AnimatedCursorHand) { + hud_element_set_flags(gPauseCommonHIDs[i], HUD_ELEMENT_FLAG_DROP_SHADOW | HUD_ELEMENT_FLAG_80); } else { - hud_element_set_flags(gPauseCommonIconIDs[i], HUD_ELEMENT_FLAG_80); + hud_element_set_flags(gPauseCommonHIDs[i], HUD_ELEMENT_FLAG_80); } } - gPauseCursorIconID = gPauseCommonIconIDs[0]; + gPauseCursorHID = gPauseCommonHIDs[0]; setup_pause_menu_tab(gPauseCommonWindowsBPs, ARRAY_COUNT(gPauseCommonWindowsBPs)); gPauseShownDescMsg = 0; gPauseDescTextPos = 0; @@ -702,7 +702,7 @@ void pause_tutorial_input(s32 *pressed, s32 *held) { case 3: gPauseTutorialFrameCounter = 16; gPauseTutorialInputState = 4; - gPauseTutorialState += 1; + gPauseTutorialState++; pressedNew = 0; heldNew = 0; break; @@ -801,8 +801,8 @@ void pause_cleanup(void) { s32 i; MenuPanel** menuPanels; - for (i = 0; i < ARRAY_COUNT(gPauseCommonIconIDs); i++) { - hud_element_free(gPauseCommonIconIDs[i]); + for (i = 0; i < ARRAY_COUNT(gPauseCommonHIDs); i++) { + hud_element_free(gPauseCommonHIDs[i]); } if (evt_get_variable(NULL, GF_Tutorial_Badges)) { diff --git a/src/pause/pause_map.c b/src/pause/pause_map.c index 690bb6fdbe1..39c0cb4a12d 100644 --- a/src/pause/pause_map.c +++ b/src/pause/pause_map.c @@ -21,7 +21,7 @@ void pause_map_handle_input(MenuPanel* tab); void pause_map_update(MenuPanel* tab); void pause_map_cleanup(MenuPanel* tab); -static s32 PauseMapIconIDs[1]; +static HudElemID PauseMapHIDs[1]; static f32 PauseMapCameraX; static f32 PauseMapCameraY; static s32 PauseMapMarioX; @@ -32,7 +32,7 @@ static s32 PauseMapCursorCurrentOption; static s32 PauseMapCursorCurrentOptionCopy; static s32 PauseMapSpacesInSnapRange; -HudScript* PauseMapIconScripts[] = { &HES_MapWalk0 }; +HudScript* PauseMapHudScripts[] = { &HES_MapWalk0 }; s32 D_8024FA34 = -1; #include "world_map.inc.c" @@ -204,7 +204,6 @@ void pause_map_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s posX = mapSpace->pos.x; posY = mapSpace->pos.y; - if (evt_get_variable(NULL, GF_MAP_ToadTown + i) == 0) { continue; } @@ -238,8 +237,8 @@ void pause_map_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s mapULX = baseX + 26 + cameraX; mapULY = baseY + 22 + cameraY; - hud_element_set_render_pos(PauseMapIconIDs[0], mapULX + PauseMapMarioX, mapULY + PauseMapMarioY - 7); - hud_element_draw_without_clipping(PauseMapIconIDs[0]); + hud_element_set_render_pos(PauseMapHIDs[0], mapULX + PauseMapMarioX, mapULY + PauseMapMarioY - 7); + hud_element_draw_without_clipping(PauseMapHIDs[0]); currentTab = gPauseMenuCurrentTab; if (currentTab == 6) { @@ -323,9 +322,9 @@ void pause_map_init(MenuPanel* tab) { s32 currentLocation; s32 i; - for (i = 0; i < ARRAY_COUNT(PauseMapIconScripts); i++) { - PauseMapIconIDs[i] = hud_element_create(PauseMapIconScripts[i]); - hud_element_set_flags(PauseMapIconIDs[i], HUD_ELEMENT_FLAG_80); + for (i = 0; i < ARRAY_COUNT(PauseMapHudScripts); i++) { + PauseMapHIDs[i] = hud_element_create(PauseMapHudScripts[i]); + hud_element_set_flags(PauseMapHIDs[i], HUD_ELEMENT_FLAG_80); } for (i = 0; i < ARRAY_COUNT(PauseMapWindowBPs); i++) { @@ -501,7 +500,7 @@ void pause_map_update(MenuPanel* tab) { void pause_map_cleanup(MenuPanel* tab) { s32 i; - for (i = 0; i < ARRAY_COUNT(PauseMapIconIDs); i++) { - hud_element_free(PauseMapIconIDs[i]); + for (i = 0; i < ARRAY_COUNT(PauseMapHIDs); i++) { + hud_element_free(PauseMapHIDs[i]); } } diff --git a/src/pause/pause_partners.c b/src/pause/pause_partners.c index 00020419a93..3932d2add4e 100644 --- a/src/pause/pause_partners.c +++ b/src/pause/pause_partners.c @@ -26,7 +26,7 @@ void pause_partners_handle_input(MenuPanel* panel); void pause_partners_update(MenuPanel* panel); void pause_partners_cleanup(MenuPanel* panel); -static s32 gPausePartnersIconIDs[8]; +static HudElemID gPausePartnersHIDs[8]; static s32 gPausePartnersSpriteIDs[8]; static s32 gPausePartnersPartnerIdx[8]; static s32 gPausePartnersCurrentPartnerIdx; @@ -49,7 +49,7 @@ extern u8 D_PAL_80271B4C[]; extern u8 D_PAL_80271B50[]; #endif -HudScript* gPausePartnersIconScripts[][8] = { +HudScript* gPausePartnersHudScripts[][8] = { [LANGUAGE_DEFAULT] = { &HES_FPCost, &HES_StatFp_1, &HES_PartnerRank, &HES_PartnerRank, &HES_MoveDiamond, &HES_MoveBlueOrb, &HES_MoveGreenOrb, &HES_MoveRedOrb @@ -491,13 +491,13 @@ void pause_partners_draw_title(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, draw_msg(msgID, baseX + ((width - offset - msgWidth) >> 1), baseY + 1, 255, MSG_PAL_WHITE, 0); if (level == 1) { - hud_element_set_render_pos(gPausePartnersIconIDs[2], baseX + 95, baseY + 10); - hud_element_draw_without_clipping(gPausePartnersIconIDs[2]); + hud_element_set_render_pos(gPausePartnersHIDs[2], baseX + 95, baseY + 10); + hud_element_draw_without_clipping(gPausePartnersHIDs[2]); } else if (level == 2) { - hud_element_set_render_pos(gPausePartnersIconIDs[2], baseX + 91, baseY + 10); - hud_element_draw_without_clipping(gPausePartnersIconIDs[2]); - hud_element_set_render_pos(gPausePartnersIconIDs[3], baseX + 101, baseY + 10); - hud_element_draw_without_clipping(gPausePartnersIconIDs[3]); + hud_element_set_render_pos(gPausePartnersHIDs[2], baseX + 91, baseY + 10); + hud_element_draw_without_clipping(gPausePartnersHIDs[2]); + hud_element_set_render_pos(gPausePartnersHIDs[3], baseX + 101, baseY + 10); + hud_element_draw_without_clipping(gPausePartnersHIDs[3]); } } @@ -509,7 +509,6 @@ void pause_partners_draw_movelist(MenuPanel* menu, s32 baseX, s32 baseY, s32 wid s32 style; s32 level = get_player_data()->partners[gPausePartnersPartnerIDs[gPausePartnersPartnerIdx[gPausePartnersCurrentPartnerIdx]]].level; - if (level == PARTNER_RANK_ULTRA) { level = 4; } else if (level == PARTNER_RANK_SUPER) { @@ -540,10 +539,10 @@ void pause_partners_draw_movelist(MenuPanel* menu, s32 baseX, s32 baseY, s32 wid } draw_msg(moveNameID, msgX, msgY, 255, MSG_PAL_STANDARD, style); - hud_element_set_scale(gPausePartnersIconIDs[i + 4], 0.5f); + hud_element_set_scale(gPausePartnersHIDs[i + 4], 0.5f); //TODO find better match - hud_element_set_render_pos(gPausePartnersIconIDs[i + 4], 12 - (-baseX), baseY + 28 + i * 13); - hud_element_draw_without_clipping(gPausePartnersIconIDs[i + 4]); + hud_element_set_render_pos(gPausePartnersHIDs[i + 4], 12 - (-baseX), baseY + 28 + i * 13); + hud_element_draw_without_clipping(gPausePartnersHIDs[i + 4]); if (costFP != 0) { s32 xOffset = 125; @@ -555,11 +554,11 @@ void pause_partners_draw_movelist(MenuPanel* menu, s32 baseX, s32 baseY, s32 wid draw_number(costFP, baseX + xOffset, baseY + 22 + i * 13, style, MSG_PAL_STANDARD, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); if (costFP > 0) { #if VERSION_PAL - hud_element_set_render_pos(gPausePartnersIconIDs[0], baseX + D_PAL_80271B44[gCurrentLanguage] + 9, baseY + 29 + i * 13); + hud_element_set_render_pos(gPausePartnersHIDs[0], baseX + D_PAL_80271B44[gCurrentLanguage] + 9, baseY + 29 + i * 13); #else - hud_element_set_render_pos(gPausePartnersIconIDs[0], baseX + 134, baseY + 29 + i * 13); + hud_element_set_render_pos(gPausePartnersHIDs[0], baseX + 134, baseY + 29 + i * 13); #endif - hud_element_draw_without_clipping(gPausePartnersIconIDs[0]); + hud_element_draw_without_clipping(gPausePartnersHIDs[0]); } } } @@ -583,8 +582,8 @@ void pause_partners_draw_movelist_title(MenuPanel* menu, s32 baseX, s32 baseY, s } void pause_partners_draw_movelist_flower(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { - hud_element_set_render_pos(gPausePartnersIconIDs[1], baseX + 17, baseY + 16); - hud_element_draw_without_clipping(gPausePartnersIconIDs[1]); + hud_element_set_render_pos(gPausePartnersHIDs[1], baseX + 17, baseY + 16); + hud_element_draw_without_clipping(gPausePartnersHIDs[1]); } void pause_partners_init(MenuPanel* panel) { @@ -609,9 +608,9 @@ void pause_partners_init(MenuPanel* panel) { gPausePartnersSpriteIDs[i] = spr_load_npc_sprite(gPausePartnersSpriteAnims[i][0], gPausePartnersSpriteAnims[i]); } - for (i = 0; i < ARRAY_COUNT(gPausePartnersIconScripts[0]); i++) { - gPausePartnersIconIDs[i] = hud_element_create(gPausePartnersIconScripts[gCurrentLanguage][i]); - hud_element_set_flags(gPausePartnersIconIDs[i], HUD_ELEMENT_FLAG_80); + for (i = 0; i < ARRAY_COUNT(gPausePartnersHudScripts[0]); i++) { + gPausePartnersHIDs[i] = hud_element_create(gPausePartnersHudScripts[gCurrentLanguage][i]); + hud_element_set_flags(gPausePartnersHIDs[i], HUD_ELEMENT_FLAG_80); } for (i = 0; i < ARRAY_COUNT(gPausePartnersWindowBPs); i++) { @@ -790,8 +789,8 @@ void pause_partners_update(MenuPanel* panel) { void pause_partners_cleanup(MenuPanel* panel) { s32 i; - for (i = 0; i < ARRAY_COUNT(gPausePartnersIconIDs); i++) { - hud_element_free(gPausePartnersIconIDs[i]); + for (i = 0; i < ARRAY_COUNT(gPausePartnersHIDs); i++) { + hud_element_free(gPausePartnersHIDs[i]); } for (i = 0; i < ARRAY_COUNT(gPausePartnersSpriteIDs); i++) { diff --git a/src/pause/pause_spirits.c b/src/pause/pause_spirits.c index 815f600a647..efb9c48ae3d 100644 --- a/src/pause/pause_spirits.c +++ b/src/pause/pause_spirits.c @@ -176,7 +176,6 @@ void pause_spirits_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 widt guMtxF2L(matrix1, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - for (i = 0; i < gPauseSpiritsNumSpirits; i++) { index = gPauseSpiritsDrawOrder[i]; frameCounter = gGameStatusPtr->frameCounter * 4; diff --git a/src/pause/pause_stats.c b/src/pause/pause_stats.c index 736caa55df5..beb7fcad24f 100644 --- a/src/pause/pause_stats.c +++ b/src/pause/pause_stats.c @@ -95,7 +95,6 @@ s8 gPauseStatsGridData[] = { #define COLLECTABLES_X 125 #endif - StatsEntryData gStatsMenuEntries[] = { { .cursorX = 9, .cursorY = 20, .baseMsgID = PAUSE_MSG_TIP_CONTROLS }, { .cursorX = 17, .cursorY = 55, .baseMsgID = PAUSE_MSG_TIP_HP }, @@ -146,6 +145,7 @@ MenuWindowBP gStatsMenuWindowBPs[] = { .style = { .customStyle = &gPauseWS_12 } } }; + MenuPanel gPausePanelStats = { .initialized = FALSE, .col = 0, @@ -162,7 +162,6 @@ MenuPanel gPausePanelStats = { .fpCleanup = &pause_stats_cleanup }; - #if VERSION_PAL INCLUDE_ASM(void, "pause/pause_stats", pause_stats_draw_contents); #else @@ -436,7 +435,7 @@ void pause_stats_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, powIncIdx++; powIncIdx = 0; - powBarIdx += 1; + powBarIdx++; if (curIncrement >= powIncrements) { break; } @@ -602,10 +601,8 @@ void pause_stats_init(MenuPanel* panel) { s32 i; for (i = 0; i < ARRAY_COUNT(gPauseStatsIconIDs); i++) { - s32 iconID = hud_element_create(gStatsMenuElements[i]); - - gPauseStatsIconIDs[i] = iconID; - hud_element_set_flags(iconID, HUD_ELEMENT_FLAG_80); + gPauseStatsIconIDs[i] = hud_element_create(gStatsMenuElements[i]); + hud_element_set_flags(gPauseStatsIconIDs[i], HUD_ELEMENT_FLAG_80); } for (i = 0; i < ARRAY_COUNT(gStatsMenuWindowBPs); i++) { diff --git a/src/pause/pause_tabs.c b/src/pause/pause_tabs.c index e8750611519..4168048f8f3 100644 --- a/src/pause/pause_tabs.c +++ b/src/pause/pause_tabs.c @@ -19,7 +19,7 @@ void pause_tabs_handle_input(MenuPanel* tab); void pause_tabs_update(MenuPanel* tab); void pause_tabs_cleanup(MenuPanel* tab); -static s32 gPauseTabsIconIDs[6]; +static HudElemID gPauseTabsHIDs[6]; static s32 gPauseTabsPreviousTab; static s32 gPauseTabsHorizScrollPos; @@ -203,15 +203,15 @@ void pause_tabs_draw_invis(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 void pause_tabs_draw_stats(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { if (darkening != 0) { - hud_element_set_flags(gPauseTabsIconIDs[0], HUD_ELEMENT_FLAG_TRANSPARENT); - hud_element_set_alpha(gPauseTabsIconIDs[0], 255.0 - darkening * 0.5); + hud_element_set_flags(gPauseTabsHIDs[0], HUD_ELEMENT_FLAG_TRANSPARENT); + hud_element_set_alpha(gPauseTabsHIDs[0], 255.0 - darkening * 0.5); } else { - hud_element_clear_flags(gPauseTabsIconIDs[0], HUD_ELEMENT_FLAG_TRANSPARENT); - hud_element_set_alpha(gPauseTabsIconIDs[0], 255); + hud_element_clear_flags(gPauseTabsHIDs[0], HUD_ELEMENT_FLAG_TRANSPARENT); + hud_element_set_alpha(gPauseTabsHIDs[0], 255); } - hud_element_set_render_pos(gPauseTabsIconIDs[0], baseX + 22, baseY + 7); - hud_element_draw_without_clipping(gPauseTabsIconIDs[0]); + hud_element_set_render_pos(gPauseTabsHIDs[0], baseX + 22, baseY + 7); + hud_element_draw_without_clipping(gPauseTabsHIDs[0]); if (gPauseMenuCurrentTab == 0) { if (gPauseTabsWindowIDs[menu->col] == WINDOW_ID_PAUSE_TAB_STATS) { pause_set_cursor_pos(gPauseTabsWindowIDs[menu->col], baseX + TABS_CURSOR_OFFSET_X, baseY + 6); @@ -221,15 +221,15 @@ void pause_tabs_draw_stats(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 void pause_tabs_draw_badges(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { if (darkening != 0) { - hud_element_set_flags(gPauseTabsIconIDs[1], HUD_ELEMENT_FLAG_TRANSPARENT); - hud_element_set_alpha(gPauseTabsIconIDs[1], 255.0 - darkening * 0.5); + hud_element_set_flags(gPauseTabsHIDs[1], HUD_ELEMENT_FLAG_TRANSPARENT); + hud_element_set_alpha(gPauseTabsHIDs[1], 255.0 - darkening * 0.5); } else { - hud_element_clear_flags(gPauseTabsIconIDs[1], HUD_ELEMENT_FLAG_TRANSPARENT); - hud_element_set_alpha(gPauseTabsIconIDs[1], 255); + hud_element_clear_flags(gPauseTabsHIDs[1], HUD_ELEMENT_FLAG_TRANSPARENT); + hud_element_set_alpha(gPauseTabsHIDs[1], 255); } - hud_element_set_render_pos(gPauseTabsIconIDs[1], baseX + 22, baseY + 7); - hud_element_draw_without_clipping(gPauseTabsIconIDs[1]); + hud_element_set_render_pos(gPauseTabsHIDs[1], baseX + 22, baseY + 7); + hud_element_draw_without_clipping(gPauseTabsHIDs[1]); if (gPauseMenuCurrentTab == 0) { if (gPauseTabsWindowIDs[menu->col] == WINDOW_ID_PAUSE_TAB_BADGES) { pause_set_cursor_pos(gPauseTabsWindowIDs[menu->col], baseX + TABS_CURSOR_OFFSET_X, baseY + 6); @@ -239,15 +239,15 @@ void pause_tabs_draw_badges(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s3 void pause_tabs_draw_items(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { if (darkening != 0) { - hud_element_set_flags(gPauseTabsIconIDs[2], HUD_ELEMENT_FLAG_TRANSPARENT); - hud_element_set_alpha(gPauseTabsIconIDs[2], 255.0 - darkening * 0.5); + hud_element_set_flags(gPauseTabsHIDs[2], HUD_ELEMENT_FLAG_TRANSPARENT); + hud_element_set_alpha(gPauseTabsHIDs[2], 255.0 - darkening * 0.5); } else { - hud_element_clear_flags(gPauseTabsIconIDs[2], HUD_ELEMENT_FLAG_TRANSPARENT); - hud_element_set_alpha(gPauseTabsIconIDs[2], 255); + hud_element_clear_flags(gPauseTabsHIDs[2], HUD_ELEMENT_FLAG_TRANSPARENT); + hud_element_set_alpha(gPauseTabsHIDs[2], 255); } - hud_element_set_render_pos(gPauseTabsIconIDs[2], baseX + 22, baseY + 7); - hud_element_draw_without_clipping(gPauseTabsIconIDs[2]); + hud_element_set_render_pos(gPauseTabsHIDs[2], baseX + 22, baseY + 7); + hud_element_draw_without_clipping(gPauseTabsHIDs[2]); if (gPauseMenuCurrentTab == 0) { if (gPauseTabsWindowIDs[menu->col] == WINDOW_ID_PAUSE_TAB_ITEMS) { pause_set_cursor_pos(gPauseTabsWindowIDs[menu->col], baseX + TABS_CURSOR_OFFSET_X, baseY + 6); @@ -257,15 +257,15 @@ void pause_tabs_draw_items(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 void pause_tabs_draw_party(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { if (darkening != 0) { - hud_element_set_flags(gPauseTabsIconIDs[3], HUD_ELEMENT_FLAG_TRANSPARENT); - hud_element_set_alpha(gPauseTabsIconIDs[3], 255.0 - darkening * 0.5); + hud_element_set_flags(gPauseTabsHIDs[3], HUD_ELEMENT_FLAG_TRANSPARENT); + hud_element_set_alpha(gPauseTabsHIDs[3], 255.0 - darkening * 0.5); } else { - hud_element_clear_flags(gPauseTabsIconIDs[3], HUD_ELEMENT_FLAG_TRANSPARENT); - hud_element_set_alpha(gPauseTabsIconIDs[3], 255); + hud_element_clear_flags(gPauseTabsHIDs[3], HUD_ELEMENT_FLAG_TRANSPARENT); + hud_element_set_alpha(gPauseTabsHIDs[3], 255); } - hud_element_set_render_pos(gPauseTabsIconIDs[3], baseX + 22, baseY + 7); - hud_element_draw_without_clipping(gPauseTabsIconIDs[3]); + hud_element_set_render_pos(gPauseTabsHIDs[3], baseX + 22, baseY + 7); + hud_element_draw_without_clipping(gPauseTabsHIDs[3]); if (gPauseMenuCurrentTab == 0) { if (gPauseTabsWindowIDs[menu->col] == WINDOW_ID_PAUSE_TAB_PARTY) { pause_set_cursor_pos(gPauseTabsWindowIDs[menu->col], baseX + TABS_CURSOR_OFFSET_X, baseY + 6); @@ -275,15 +275,15 @@ void pause_tabs_draw_party(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 void pause_tabs_draw_spirits(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { if (darkening != 0) { - hud_element_set_flags(gPauseTabsIconIDs[4], HUD_ELEMENT_FLAG_TRANSPARENT); - hud_element_set_alpha(gPauseTabsIconIDs[4], 255.0 - darkening * 0.5); + hud_element_set_flags(gPauseTabsHIDs[4], HUD_ELEMENT_FLAG_TRANSPARENT); + hud_element_set_alpha(gPauseTabsHIDs[4], 255.0 - darkening * 0.5); } else { - hud_element_clear_flags(gPauseTabsIconIDs[4], HUD_ELEMENT_FLAG_TRANSPARENT); - hud_element_set_alpha(gPauseTabsIconIDs[4], 255); + hud_element_clear_flags(gPauseTabsHIDs[4], HUD_ELEMENT_FLAG_TRANSPARENT); + hud_element_set_alpha(gPauseTabsHIDs[4], 255); } - hud_element_set_render_pos(gPauseTabsIconIDs[4], baseX + 22, baseY + 7); - hud_element_draw_without_clipping(gPauseTabsIconIDs[4]); + hud_element_set_render_pos(gPauseTabsHIDs[4], baseX + 22, baseY + 7); + hud_element_draw_without_clipping(gPauseTabsHIDs[4]); if (gPauseMenuCurrentTab == 0) { if (gPauseTabsWindowIDs[menu->col] == WINDOW_ID_PAUSE_TAB_SPIRITS) { pause_set_cursor_pos(gPauseTabsWindowIDs[menu->col], baseX + TABS_CURSOR_OFFSET_X, baseY + 6); @@ -293,15 +293,15 @@ void pause_tabs_draw_spirits(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s void pause_tabs_draw_map(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { if (darkening != 0) { - hud_element_set_flags(gPauseTabsIconIDs[5], HUD_ELEMENT_FLAG_TRANSPARENT); - hud_element_set_alpha(gPauseTabsIconIDs[5], 255.0 - darkening * 0.5); + hud_element_set_flags(gPauseTabsHIDs[5], HUD_ELEMENT_FLAG_TRANSPARENT); + hud_element_set_alpha(gPauseTabsHIDs[5], 255.0 - darkening * 0.5); } else { - hud_element_clear_flags(gPauseTabsIconIDs[5], HUD_ELEMENT_FLAG_TRANSPARENT); - hud_element_set_alpha(gPauseTabsIconIDs[5], 255); + hud_element_clear_flags(gPauseTabsHIDs[5], HUD_ELEMENT_FLAG_TRANSPARENT); + hud_element_set_alpha(gPauseTabsHIDs[5], 255); } - hud_element_set_render_pos(gPauseTabsIconIDs[5], baseX + 23, baseY + 7); - hud_element_draw_without_clipping(gPauseTabsIconIDs[5]); + hud_element_set_render_pos(gPauseTabsHIDs[5], baseX + 23, baseY + 7); + hud_element_draw_without_clipping(gPauseTabsHIDs[5]); if (gPauseMenuCurrentTab == 0) { if (gPauseTabsWindowIDs[menu->col] == WINDOW_ID_PAUSE_TAB_MAP) { pause_set_cursor_pos(gPauseTabsWindowIDs[menu->col], baseX + TABS_CURSOR_OFFSET_X, baseY + 6); @@ -313,13 +313,8 @@ void pause_tabs_init(MenuPanel* tab) { s32 i; for (i = 0; i < ARRAY_COUNT(gPauseTabsHudScripts[0]); i++) { - HudScript* hs; - - //hs = gPauseTabsHudScripts[i]; - hs = gPauseTabsHudScripts[gCurrentLanguage][i]; - - gPauseTabsIconIDs[i] = hud_element_create(hs); - hud_element_set_flags(gPauseTabsIconIDs[i], HUD_ELEMENT_FLAG_80); + gPauseTabsHIDs[i] = hud_element_create(gPauseTabsHudScripts[gCurrentLanguage][i]); + hud_element_set_flags(gPauseTabsHIDs[i], HUD_ELEMENT_FLAG_80); } for (i = 0; i < ARRAY_COUNT(gPauseTabsWindowBPs); i++) { @@ -459,7 +454,7 @@ void pause_tabs_update(MenuPanel* tab) { void pause_tabs_cleanup(MenuPanel* tab) { s32 i; - for (i = 0; i < ARRAY_COUNT(gPauseTabsIconIDs); i++) { - hud_element_free(gPauseTabsIconIDs[i]); + for (i = 0; i < ARRAY_COUNT(gPauseTabsHIDs); i++) { + hud_element_free(gPauseTabsHIDs[i]); } } diff --git a/src/sprite.c b/src/sprite.c index 9786be66725..f4abb2537b0 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -945,7 +945,6 @@ s32 spr_draw_player_sprite(s32 spriteInstanceID, s32 yaw, s32 alphaIn, PAL_PTR* D_802DFEA0[1] = yaw; D_802DFEA0[2] = 0; - if (spriteInstanceID & DRAW_SPRITE_OVERRIDE_ALPHA) { alpha = alphaIn & 0xFF; if (alphaIn == 0) { diff --git a/src/state_title_screen.c b/src/state_title_screen.c index fa3944afd52..022bf12e08b 100644 --- a/src/state_title_screen.c +++ b/src/state_title_screen.c @@ -24,7 +24,6 @@ #define TITLE_NUM_TILES (TITLE_HEIGHT / TITLE_TILE_HEIGHT) // Number of tiles in the texture #define TITLE_TILE_PIXELS (TITLE_WIDTH * TITLE_TILE_HEIGHT) // Number of pixels in a single tile of the texture - enum TitleScreenStates { TITLE_STATE_INIT = 0x00000000, TITLE_STATE_APPEAR = 0x00000001, diff --git a/src/status_icons.c b/src/status_icons.c index c02c442e65d..0bf1904fc6c 100644 --- a/src/status_icons.c +++ b/src/status_icons.c @@ -33,8 +33,8 @@ typedef struct HudComplexStatusIcon { /* 0x3 */ s8 removingTask; /* 0x4 */ s8 unk_04; /* 0x5 */ s8 frameCounter; - /* 0x8 */ s32 activeElementID; - /* 0xC */ s32 removingElementID; + /* 0x8 */ HudElemID activeElementHID; + /* 0xC */ HudElemID removingElementHID; } HudComplexStatusIcon; // size = 0x10 typedef struct HudSimpleStatusIcon { @@ -131,7 +131,7 @@ void func_80045AC0(void) { popup->message = NULL; } - create_worker_world(NULL, func_80045BC8); + create_worker_scene(NULL, func_80045BC8); init_all_status_icons(); } @@ -354,8 +354,8 @@ void init_all_status_icons(void) { void update_all_status_icons(void* data) { PopupMessage* popup = data; HudStatusIcon* icon; - int i; s32 elementID; + s32 i; for (i = 0, icon = D_800A0F44; i < MAX_ICONS; i++, icon++) { if (icon->flags == 0) { @@ -365,31 +365,31 @@ void update_all_status_icons(void* data) { if (icon->status1.activeTask == STATUS_ICON_TASK_LOAD) { switch (icon->status1.active) { case STATUS_KEY_SLEEP: - elementID = icon->status1.activeElementID = hud_element_create(&HES_AsleepBegin); + elementID = icon->status1.activeElementHID = hud_element_create(&HES_AsleepBegin); break; case STATUS_KEY_PARALYZE: - elementID = icon->status1.activeElementID = hud_element_create(&HES_ParalyzedBegin); + elementID = icon->status1.activeElementHID = hud_element_create(&HES_ParalyzedBegin); break; case STATUS_KEY_DIZZY: - elementID = icon->status1.activeElementID = hud_element_create(&HES_DizzyBegin); + elementID = icon->status1.activeElementHID = hud_element_create(&HES_DizzyBegin); break; case STATUS_KEY_FEAR: - elementID = icon->status1.activeElementID = hud_element_create(&HES_WeakenedLoop); + elementID = icon->status1.activeElementHID = hud_element_create(&HES_WeakenedLoop); break; case STATUS_KEY_STOP: - elementID = icon->status1.activeElementID = hud_element_create(&HES_StoppedBegin); + elementID = icon->status1.activeElementHID = hud_element_create(&HES_StoppedBegin); break; case STATUS_KEY_POISON: - elementID = icon->status1.activeElementID = hud_element_create(&HES_PoisonedBegin); + elementID = icon->status1.activeElementHID = hud_element_create(&HES_PoisonedBegin); break; case STATUS_KEY_SHRINK: - elementID = icon->status1.activeElementID = hud_element_create(&HES_ShrunkBegin); + elementID = icon->status1.activeElementHID = hud_element_create(&HES_ShrunkBegin); break; case STATUS_KEY_FROZEN: - elementID = icon->status1.activeElementID = hud_element_create(&HES_FrozenBegin); + elementID = icon->status1.activeElementHID = hud_element_create(&HES_FrozenBegin); break; default: - elementID = icon->status1.activeElementID = hud_element_create(&HES_Item_Present); + elementID = icon->status1.activeElementHID = hud_element_create(&HES_Item_Present); break; } hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_DISABLED); @@ -403,31 +403,31 @@ void update_all_status_icons(void* data) { case STATUS_ICON_TASK_LOAD: switch (icon->status1.removing) { case STATUS_KEY_SLEEP: - hud_element_set_script(icon->status1.removingElementID, &HES_AsleepEnd); + hud_element_set_script(icon->status1.removingElementHID, &HES_AsleepEnd); break; case STATUS_KEY_PARALYZE: - hud_element_set_script(icon->status1.removingElementID, &HES_ParalyzedEnd); + hud_element_set_script(icon->status1.removingElementHID, &HES_ParalyzedEnd); break; case STATUS_KEY_DIZZY: - hud_element_set_script(icon->status1.removingElementID, &HES_DizzyEnd); + hud_element_set_script(icon->status1.removingElementHID, &HES_DizzyEnd); break; case STATUS_KEY_FEAR: - hud_element_set_script(icon->status1.removingElementID, &HES_WeakenedLoop); + hud_element_set_script(icon->status1.removingElementHID, &HES_WeakenedLoop); break; case STATUS_KEY_STOP: - hud_element_set_script(icon->status1.removingElementID, &HES_StoppedEnd); + hud_element_set_script(icon->status1.removingElementHID, &HES_StoppedEnd); break; case STATUS_KEY_POISON: - hud_element_set_script(icon->status1.removingElementID, &HES_PoisonedEnd); + hud_element_set_script(icon->status1.removingElementHID, &HES_PoisonedEnd); break; case STATUS_KEY_SHRINK: - hud_element_set_script(icon->status1.removingElementID, &HES_ShrunkEnd); + hud_element_set_script(icon->status1.removingElementHID, &HES_ShrunkEnd); break; case STATUS_KEY_FROZEN: - hud_element_set_script(icon->status1.removingElementID, &HES_FrozenEnd); + hud_element_set_script(icon->status1.removingElementHID, &HES_FrozenEnd); break; default: - hud_element_set_script(icon->status1.removingElementID, &HES_Item_Present); + hud_element_set_script(icon->status1.removingElementHID, &HES_Item_Present); break; } @@ -440,7 +440,7 @@ void update_all_status_icons(void* data) { icon->status1.frameCounter--; } else { icon->status1.removing = 0; - hud_element_free(icon->status1.removingElementID); + hud_element_free(icon->status1.removingElementHID); icon->status1.removingTask = STATUS_ICON_TASK_NONE; } break; @@ -449,10 +449,10 @@ void update_all_status_icons(void* data) { if (icon->status2.activeTask == STATUS_ICON_TASK_LOAD) { switch (icon->status2.active) { case STATUS_KEY_STATIC: - elementID = icon->status2.activeElementID = hud_element_create(&HES_ElectrifiedBegin); + elementID = icon->status2.activeElementHID = hud_element_create(&HES_ElectrifiedBegin); break; default: - elementID = icon->status2.activeElementID = hud_element_create(&HES_Item_Present); + elementID = icon->status2.activeElementHID = hud_element_create(&HES_Item_Present); break; } @@ -467,10 +467,10 @@ void update_all_status_icons(void* data) { case STATUS_ICON_TASK_LOAD: switch (icon->status2.removing) { case STATUS_KEY_STATIC: - hud_element_set_script(icon->status2.removingElementID, &HES_ElectrifiedEnd); + hud_element_set_script(icon->status2.removingElementHID, &HES_ElectrifiedEnd); break; default: - hud_element_set_script(icon->status2.removingElementID, &HES_Item_Present); + hud_element_set_script(icon->status2.removingElementHID, &HES_Item_Present); break; } @@ -482,7 +482,7 @@ void update_all_status_icons(void* data) { icon->status2.frameCounter--; } else { icon->status2.removing = 0; - hud_element_free(icon->status2.removingElementID); + hud_element_free(icon->status2.removingElementHID); icon->status2.removingTask = STATUS_ICON_TASK_NONE; } break; @@ -491,10 +491,10 @@ void update_all_status_icons(void* data) { if (icon->status3.activeTask == STATUS_ICON_TASK_LOAD) { switch (icon->status3.active) { case STATUS_KEY_TRANSPARENT: - elementID = icon->status3.activeElementID = hud_element_create(&HES_TransparentBegin); + elementID = icon->status3.activeElementHID = hud_element_create(&HES_TransparentBegin); break; default: - elementID = icon->status3.activeElementID = hud_element_create(&HES_Item_Present); + elementID = icon->status3.activeElementHID = hud_element_create(&HES_Item_Present); break; } @@ -509,10 +509,10 @@ void update_all_status_icons(void* data) { case STATUS_ICON_TASK_LOAD: switch (icon->status3.removing) { case STATUS_KEY_TRANSPARENT: - hud_element_set_script(icon->status3.removingElementID, &HES_TransparentEnd); + hud_element_set_script(icon->status3.removingElementHID, &HES_TransparentEnd); break; default: - hud_element_set_script(icon->status3.removingElementID, &HES_Item_Present); + hud_element_set_script(icon->status3.removingElementHID, &HES_Item_Present); break; } @@ -524,14 +524,14 @@ void update_all_status_icons(void* data) { icon->status3.frameCounter--; } else { icon->status3.removing = 0; - hud_element_free(icon->status3.removingElementID); + hud_element_free(icon->status3.removingElementHID); icon->status3.removingTask = STATUS_ICON_TASK_NONE; } break; } if (icon->status4.activeTask == STATUS_ICON_TASK_LOAD) { - elementID = icon->status4.activeElementID = hud_element_create(&HES_WeakenedBegin); + elementID = icon->status4.activeElementHID = hud_element_create(&HES_WeakenedBegin); hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_DISABLED); hud_element_set_flags(elementID, HUD_ELEMENT_FLAG_80); icon->status4.activeTask = STATUS_ICON_TASK_DRAW; @@ -541,7 +541,7 @@ void update_all_status_icons(void* data) { case STATUS_ICON_TASK_NONE: break; case STATUS_ICON_TASK_LOAD: - hud_element_set_script(icon->status4.removingElementID, &HES_WeakenedEnd); + hud_element_set_script(icon->status4.removingElementHID, &HES_WeakenedEnd); icon->status4.frameCounter = 20; icon->status4.removingTask = STATUS_ICON_TASK_DRAW; break; @@ -550,7 +550,7 @@ void update_all_status_icons(void* data) { icon->status4.frameCounter--; } else { icon->status4.removing = 0; - hud_element_free(icon->status4.removingElementID); + hud_element_free(icon->status4.removingElementHID); icon->status4.removingTask = STATUS_ICON_TASK_NONE; } break; @@ -614,9 +614,9 @@ void draw_all_status_icons(void* data) { isActiveDrawn = 0; if (icon->status1.activeTask == STATUS_ICON_TASK_DRAW) { if (icon->flags & STATUS_ICON_FLAG_DEBUFF) { - hud_element_set_flags(icon->status1.activeElementID, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_flags(icon->status1.activeElementHID, HUD_ELEMENT_FLAG_DISABLED); } else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) { - hud_element_clear_flags(icon->status1.activeElementID, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(icon->status1.activeElementHID, HUD_ELEMENT_FLAG_DISABLED); x = icon->worldPos.x; y = icon->worldPos.y + icon->status1OffsetY; @@ -624,7 +624,7 @@ void draw_all_status_icons(void* data) { add_vec2D_polar(&x, &z, icon->status1Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); - elementId = icon->status1.activeElementID; + elementId = icon->status1.activeElementHID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); hud_element_draw_next(elementId); iconCounter = 1; @@ -635,7 +635,7 @@ void draw_all_status_icons(void* data) { if (icon->status1.removingTask == STATUS_ICON_TASK_DRAW && (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) ) { - hud_element_clear_flags(icon->status1.removingElementID, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(icon->status1.removingElementHID, HUD_ELEMENT_FLAG_DISABLED); if (isActiveDrawn == 0) { iconCounter++; @@ -647,7 +647,7 @@ void draw_all_status_icons(void* data) { add_vec2D_polar(&x, &z, icon->status1Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); - elementId = icon->status1.removingElementID; + elementId = icon->status1.removingElementHID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); hud_element_draw_next(elementId); } @@ -655,9 +655,9 @@ void draw_all_status_icons(void* data) { isActiveDrawn = 0; if (icon->status2.activeTask == STATUS_ICON_TASK_DRAW) { if (icon->flags & STATUS_ICON_FLAG_STATIC) { - hud_element_set_flags(icon->status2.activeElementID, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_flags(icon->status2.activeElementHID, HUD_ELEMENT_FLAG_DISABLED); } else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) { - hud_element_clear_flags(icon->status2.activeElementID, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(icon->status2.activeElementHID, HUD_ELEMENT_FLAG_DISABLED); offsetY = 0; if (iconCounter == 0) { @@ -670,7 +670,7 @@ void draw_all_status_icons(void* data) { add_vec2D_polar(&x, &z, icon->status2Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); - elementId = icon->status2.activeElementID; + elementId = icon->status2.activeElementHID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); hud_element_draw_next(elementId); @@ -682,7 +682,7 @@ void draw_all_status_icons(void* data) { if (icon->status2.removingTask == STATUS_ICON_TASK_DRAW && (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) ) { - hud_element_clear_flags(icon->status2.removingElementID, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(icon->status2.removingElementHID, HUD_ELEMENT_FLAG_DISABLED); offsetY = 0; if (iconCounter == 0) { @@ -698,7 +698,7 @@ void draw_all_status_icons(void* data) { add_vec2D_polar(&x, &z, icon->status2Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); - elementId = icon->status2.removingElementID; + elementId = icon->status2.removingElementHID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); hud_element_draw_next(elementId); } @@ -706,9 +706,9 @@ void draw_all_status_icons(void* data) { isActiveDrawn = 0; if (icon->status3.activeTask == STATUS_ICON_TASK_DRAW) { if (icon->flags & STATUS_ICON_FLAG_TRANSPARENT) { - hud_element_set_flags(icon->status3.activeElementID, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_flags(icon->status3.activeElementHID, HUD_ELEMENT_FLAG_DISABLED); } else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) { - hud_element_clear_flags(icon->status3.activeElementID, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(icon->status3.activeElementHID, HUD_ELEMENT_FLAG_DISABLED); offsetY = 0; if (iconCounter == 1) { @@ -723,7 +723,7 @@ void draw_all_status_icons(void* data) { add_vec2D_polar(&x, &z, icon->status3Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); - elementId = icon->status3.activeElementID; + elementId = icon->status3.activeElementHID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); hud_element_draw_next(elementId); iconCounter++; @@ -734,7 +734,7 @@ void draw_all_status_icons(void* data) { if (icon->status3.removingTask == STATUS_ICON_TASK_DRAW && (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) ) { - hud_element_clear_flags(icon->status3.removingElementID, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(icon->status3.removingElementHID, HUD_ELEMENT_FLAG_DISABLED); offsetY = 0; if (iconCounter == 1) { @@ -753,7 +753,7 @@ void draw_all_status_icons(void* data) { add_vec2D_polar(&x, &z, icon->status3Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); - elementId = icon->status3.removingElementID; + elementId = icon->status3.removingElementHID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); hud_element_draw_next(elementId); } @@ -761,9 +761,9 @@ void draw_all_status_icons(void* data) { isActiveDrawn = 0; if (icon->status4.activeTask == STATUS_ICON_TASK_DRAW) { if (icon->flags & STATUS_ICON_FLAG_STATUS_CHILL_OUT) { - hud_element_set_flags(icon->status4.activeElementID, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_flags(icon->status4.activeElementHID, HUD_ELEMENT_FLAG_DISABLED); } else if (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) { - hud_element_clear_flags(icon->status4.activeElementID, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(icon->status4.activeElementHID, HUD_ELEMENT_FLAG_DISABLED); offsetY = 0; if (iconCounter == 2) { @@ -782,7 +782,7 @@ void draw_all_status_icons(void* data) { add_vec2D_polar(&x, &z, icon->status4Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); - elementId = icon->status4.activeElementID; + elementId = icon->status4.activeElementHID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); hud_element_draw_next(elementId); iconCounter++; @@ -793,7 +793,7 @@ void draw_all_status_icons(void* data) { if (icon->status4.removingTask == STATUS_ICON_TASK_DRAW && (icon->flags & STATUS_ICON_FLAG_BATTLE || gGameStatusPtr->context != CONTEXT_BATTLE) ) { - hud_element_clear_flags(icon->status4.removingElementID, HUD_ELEMENT_FLAG_DISABLED); + hud_element_clear_flags(icon->status4.removingElementHID, HUD_ELEMENT_FLAG_DISABLED); offsetY = 0; if (iconCounter == 2) { @@ -815,7 +815,7 @@ void draw_all_status_icons(void* data) { add_vec2D_polar(&x, &z, icon->status4Radius, clamp_angle(camera->curYaw + 90)); get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ); - elementId = icon->status4.removingElementID; + elementId = icon->status4.removingElementHID; hud_element_set_render_pos(elementId, screenX - 8, screenY - 8); hud_element_draw_next(elementId); } @@ -1071,7 +1071,7 @@ void remove_status_debuff(s32 iconID) { statusIcon->status1.active = 0; statusIcon->status1.activeTask = STATUS_ICON_TASK_NONE; statusIcon->status1.frameCounter = 10; - statusIcon->status1.removingElementID = statusIcon->status1.activeElementID; + statusIcon->status1.removingElementHID = statusIcon->status1.activeElementHID; } } @@ -1101,7 +1101,7 @@ void remove_status_static(s32 iconID) { statusIcon->status2.active = FALSE; statusIcon->status2.activeTask = FALSE; statusIcon->status2.frameCounter = 10; - statusIcon->status2.removingElementID = statusIcon->status2.activeElementID; + statusIcon->status2.removingElementHID = statusIcon->status2.activeElementHID; } } @@ -1131,7 +1131,7 @@ void remove_status_transparent(s32 iconID) { statusIcon->status3.active = FALSE; statusIcon->status3.activeTask = FALSE; statusIcon->status3.frameCounter = 10; - statusIcon->status3.removingElementID = statusIcon->status3.activeElementID; + statusIcon->status3.removingElementHID = statusIcon->status3.activeElementHID; } } @@ -1160,7 +1160,7 @@ void remove_status_chill_out(s32 iconID) { statusIcon->status4.active = FALSE; statusIcon->status4.activeTask = FALSE; statusIcon->status4.frameCounter = 10; - statusIcon->status4.removingElementID = statusIcon->status4.activeElementID; + statusIcon->status4.removingElementHID = statusIcon->status4.activeElementHID; } } @@ -1172,15 +1172,15 @@ void enable_status_chill_out(s32 iconID) { void create_status_icon_boost_jump(s32 iconID) { HudStatusIcon* statusIcon = &D_800A0F44[iconID]; - s32 hudElement; + HudElemID hid; statusIcon->flags &= ~STATUS_ICON_FLAG_BOOST_JUMP; if (!statusIcon->boostJump.active) { statusIcon->boostJump.active = TRUE; - hudElement = hud_element_create(&HES_BoostJumpBegin); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80); - statusIcon->boostJump.activeElementID = hudElement; + hid = hud_element_create(&HES_BoostJumpBegin); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + statusIcon->boostJump.activeElementID = hid; } } @@ -1188,11 +1188,11 @@ void remove_status_icon_boost_jump(s32 iconID) { HudStatusIcon* statusIcon = &D_800A0F44[iconID]; if (statusIcon->boostJump.active) { - s32 hudElemIndex = statusIcon->boostJump.activeElementID; + HudElemID hid = statusIcon->boostJump.activeElementID; statusIcon->boostJump.active = FALSE; statusIcon->boostJump.removing = TRUE; - statusIcon->prevIndexBoostJump = hudElemIndex; - hud_element_set_script(hudElemIndex, &HES_BoostJumpEnd); + statusIcon->prevIndexBoostJump = hid; + hud_element_set_script(hid, &HES_BoostJumpEnd); } } @@ -1204,15 +1204,15 @@ void enable_status_icon_boost_jump(s32 iconID) { void create_status_icon_boost_hammer(s32 iconID) { HudStatusIcon* statusIcon = &D_800A0F44[iconID]; - s32 hudElement; + HudElemID hid; statusIcon->flags &= ~STATUS_ICON_FLAG_BOOST_HAMMER; if (!statusIcon->boostHammer.active) { statusIcon->boostHammer.active = TRUE; - hudElement = hud_element_create(&HES_BoostHammerBegin); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80); - statusIcon->boostHammer.activeElementID = hudElement; + hid = hud_element_create(&HES_BoostHammerBegin); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + statusIcon->boostHammer.activeElementID = hid; } } @@ -1220,11 +1220,11 @@ void remove_status_icon_boost_hammer(s32 iconID) { HudStatusIcon* statusIcon = &D_800A0F44[iconID]; if (statusIcon->boostHammer.active) { - s32 hudElemIndex = statusIcon->boostHammer.activeElementID; + HudElemID hid = statusIcon->boostHammer.activeElementID; statusIcon->boostHammer.active = FALSE; statusIcon->boostHammer.removing = FALSE; - statusIcon->prevIndexBoostHammer = hudElemIndex; - hud_element_set_script(hudElemIndex, &HES_BoostHammerEnd); + statusIcon->prevIndexBoostHammer = hid; + hud_element_set_script(hid, &HES_BoostHammerEnd); } } @@ -1236,15 +1236,15 @@ void enable_status_icon_boost_hammer(s32 iconID) { void create_status_icon_boost_partner(s32 iconID) { HudStatusIcon* statusIcon = &D_800A0F44[iconID]; - s32 hudElement; + HudElemID hid; statusIcon->flags &= ~STATUS_ICON_FLAG_BOOST_PARTNER; if (!statusIcon->boostPartner.active) { statusIcon->boostPartner.active = TRUE; - hudElement = hud_element_create(&HES_BoostPartner); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80); - statusIcon->boostPartner.activeElementID = hudElement; + hid = hud_element_create(&HES_BoostPartner); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + statusIcon->boostPartner.activeElementID = hid; } } @@ -1265,15 +1265,15 @@ void enable_status_icon_boost_partner(s32 iconID) { void create_status_icon_surprise(s32 iconID) { HudStatusIcon* statusIcon = &D_800A0F44[iconID]; - s32 hudElement; + HudElemID hid; statusIcon->flags &= ~STATUS_ICON_FLAG_SURPRISE; if (!statusIcon->surprise.active) { statusIcon->surprise.active = TRUE; - hudElement = hud_element_create(&HES_Surprise); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80); - statusIcon->surprise.activeElementID = hudElement; + hid = hud_element_create(&HES_Surprise); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + statusIcon->surprise.activeElementID = hid; } } @@ -1294,15 +1294,15 @@ void enable_status_icon_surprise(s32 iconID) { void create_status_icon_peril(s32 iconID) { HudStatusIcon* statusIcon = &D_800A0F44[iconID]; - s32 hudElement; + HudElemID hid; statusIcon->flags &= ~STATUS_ICON_FLAG_PERIL; if (!statusIcon->peril.active) { statusIcon->peril.active = TRUE; - hudElement = hud_element_create(&HES_Peril); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80); - statusIcon->peril.activeElementID = hudElement; + hid = hud_element_create(&HES_Peril); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + statusIcon->peril.activeElementID = hid; } } @@ -1323,15 +1323,15 @@ void enable_status_icon_peril(s32 iconID) { void create_status_icon_danger(s32 iconID) { HudStatusIcon* statusIcon = &D_800A0F44[iconID]; - s32 hudElement; + HudElemID hid; statusIcon->flags &= ~STATUS_ICON_FLAG_DANGER; if (!statusIcon->danger.active) { statusIcon->danger.active = TRUE; - hudElement = hud_element_create(&HES_Danger); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_DISABLED); - hud_element_set_flags(hudElement, HUD_ELEMENT_FLAG_80); - statusIcon->danger.activeElementID = hudElement; + hid = hud_element_create(&HES_Danger); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80); + statusIcon->danger.activeElementID = hid; } } diff --git a/src/status_star_shimmer.c b/src/status_star_shimmer.c new file mode 100644 index 00000000000..f75719ca4b8 --- /dev/null +++ b/src/status_star_shimmer.c @@ -0,0 +1,192 @@ +#include "common.h" +#include "include_asset.h" + +INCLUDE_IMG("ui/status/shimmer_particle.png", ui_status_shimmer_particle_png); + +Vp ShimmerViewport = { + .vp = { + .vscale = { 640, 480, 511, 0 }, + .vtrans = { 640, 480, 511, 0 } + } +}; + +#include "A2B70.vtx.inc.c" // Vtx_StatusShimmer_Particle + +#include "A2BC0.gfx.inc.c" // Gfx_StatusShimmer_SetupTex +#include "A2C88.gfx.inc.c" // Gfx_StatusShimmer_DrawParticle + +#define NUM_PARTICLES 56 + +u8 AnimatedScale[] = { + 40, 90, 81, 72, 65, 59, 53, 47, 43, 38, 34, 31, 28, 25, 22, 20, 18, 16, 15, 13, 12, 10, 9, 8, 7, 7, 6, 5, 5, 4 +}; + +Vec2b InitialVelocities[NUM_PARTICLES] = { + { 247, 105 }, { 239, 87 }, { 17, 87 }, { 9, 105 }, { 0, 122 }, { 230, 69 }, { 26, 69 }, { 221, 52 }, { 35, 52 }, + { 202, 49 }, { 186, 255 }, { 200, 241 }, { 0, 200 }, { 56, 241 }, { 70, 255 }, { 54, 49 }, { 196, 222 }, + { 239, 191 }, { 17, 191 }, { 60, 222 }, { 85, 13 }, { 74, 46 }, { 99, 27 }, { 93, 43 }, { 12, 33 }, { 12, 22 }, + { 24, 22 }, { 24, 33 }, { 12, 10 }, { 24, 10 }, { 24, 45 }, { 232, 33 }, { 232, 22 }, { 232, 45 }, { 113, 40 }, + { 193, 203 }, { 190, 183 }, { 182, 46 }, { 163, 43 }, { 35, 182 }, { 52, 173 }, { 12, 45 }, { 244, 22 }, + { 244, 33 }, { 232, 10 }, { 244, 10 }, { 244, 45 }, { 204, 173 }, { 221, 182 }, { 186, 164 }, { 171, 13 }, + { 157, 27 }, { 143, 40 }, { 63, 203 }, { 66, 183 }, { 70, 164 } +}; + +typedef struct ShimmerParticle { + /* 0x00 */ u8 alive; + /* 0x01 */ s8 timeLeft; + /* 0x02 */ u8 lifetime; + /* 0x03 */ Color_RGBA8 rgba; + /* 0x07 */ s8 animTime; + /* 0x08 */ Vec2f pos; + /* 0x10 */ Vec2f vel; + /* 0x18 */ f32 scale; +} ShimmerParticle; // size = 0x1C + +typedef struct ShimmerEmitter { + /* 0x00 */ ShimmerParticle particles[1 + NUM_PARTICLES]; // one dummy master + 56 actually visible ones +} ShimmerEmitter; + +BSS ShimmerEmitter ShimmerEmitters[1]; + +void star_power_shimmer_start(s32 emitterIdx, f32 x, f32 y, f32 scale) { + ShimmerEmitter* emitter = &ShimmerEmitters[emitterIdx]; + ShimmerParticle* particle = &emitter->particles[0]; + s32 numParticles = ARRAY_COUNT(emitter->particles); + s32 j; + + if (emitterIdx < ARRAY_COUNT(ShimmerEmitters)) { + particle->alive = TRUE; + particle->pos.x = x; + particle->pos.y = y; + particle->scale = scale; + particle->timeLeft = 40; + particle->lifetime = 0; + particle = &emitter->particles[1]; + + for (j = 1; j < numParticles; j++, particle++) { + particle->animTime = (s32) (-((f32) j) * 0.0f) - 1; + } + } +} + +void star_power_shimmer_init(void) { + s32 i; + + for (i = 0; i < ARRAY_COUNT(ShimmerEmitters); i++) { + ShimmerEmitters[i].particles[0].alive = FALSE; + } +} + +void star_power_shimmer_update(void) { + ShimmerEmitter* emitter; + ShimmerParticle* particle; + s32 emitterTimeLeft; + f32 emitterX; + f32 emitterY; + s32 i, j; + + for (i = 0; i < ARRAY_COUNT(ShimmerEmitters); i++, emitter++) { + emitter = &ShimmerEmitters[i]; + + if (!emitter->particles[0].alive) { + continue; + } + + emitter->particles[0].timeLeft--; + emitter->particles[0].lifetime++; + + if (emitter->particles[0].timeLeft < 0) { + emitter->particles[0].alive = FALSE; + continue; + } + + emitterTimeLeft = emitter->particles[0].timeLeft; + emitterX = emitter->particles[0].pos.x; + emitterY = emitter->particles[0].pos.y; + + particle = &emitter->particles[1]; + for (j = 1; j < ARRAY_COUNT(emitter->particles); j++, particle++) { + particle->animTime++; + if (particle->animTime >= ARRAY_COUNT(AnimatedScale)) { + if (emitterTimeLeft < 30) { + particle->animTime = -31; + } else { + particle->animTime = 0; + } + } + + if (particle->animTime < 0) { + continue; + } + + if (particle->animTime == 0) { + f32 initialVelX = InitialVelocities[j - 1].x; + f32 initialVelY = InitialVelocities[j - 1].y; + s8 t = 127; + + particle->vel.x = initialVelX * 0.1; + particle->vel.y = -initialVelY * 0.1; + particle->pos.x = emitterX; + particle->pos.y = emitterY; + particle->scale = 1.0f; + particle->rgba.r = rand_int(t); + particle->rgba.g = rand_int(t - particle->rgba.r); + particle->rgba.b = rand_int(t - particle->rgba.g - particle->rgba.r); + particle->rgba.a = 255; + particle->rgba.r += 128; + particle->rgba.g += 128; + particle->rgba.b += 128; + } + + particle->pos.x += particle->vel.x; + particle->pos.y += particle->vel.y; + particle->vel.x *= 0.92; + particle->vel.y *= 0.92; + particle->scale = (f32) AnimatedScale[particle->animTime] * 0.04; + } + } +} + +// draws small diamond shaped shimmer particles over the star power bar +void star_power_shimmer_draw(void) { + Matrix4f viewMtx, transformMtx; + ShimmerEmitter* emitter; + ShimmerParticle* particle; + f32 emitterScale; + s32 i, j; + + gDPPipeSync(gMainGfxPos++); + gSPSegment(gMainGfxPos++, 0x00, 0x00000000); + gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + gSPViewport(gMainGfxPos++, &ShimmerViewport); + + guOrthoF(viewMtx, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, -100.0f, 100.0f, 1.0f); + guMtxF2L(viewMtx, &gDisplayContext->matrixStack[gMatrixListPos]); + + gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPDisplayList(gMainGfxPos++, D_80109710); // setup texture + gDPSetEnvColor(gMainGfxPos++, 127, 127, 127, 127); + + for (i = 0; i < ARRAY_COUNT(ShimmerEmitters); i++, emitter++) { + emitter = &ShimmerEmitters[i]; + + if (emitter->particles[0].alive) { + emitterScale = emitter->particles[0].scale; + + particle = &emitter->particles[1]; + for (j = 1; j < ARRAY_COUNT(emitter->particles); j++, particle++) { + if (particle->animTime >= 0) { + guPositionF(transformMtx, 0.0f, 0.0f, gGameStatusPtr->frameCounter * 10, particle->scale * emitterScale, + particle->pos.x, particle->pos.y, 0.0f); + guMtxF2L(transformMtx, &gDisplayContext->matrixStack[gMatrixListPos]); + + gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], + G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW); + gDPSetPrimColor(gMainGfxPos++, 0, 80 - particle->animTime, particle->rgba.r, particle->rgba.g, particle->rgba.b, particle->rgba.a); + gSPDisplayList(gMainGfxPos++, D_801097D8); // draw particle + gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW); + } + } + } + } +} diff --git a/src/891b0_len_fb0.c b/src/surfaces.c similarity index 100% rename from src/891b0_len_fb0.c rename to src/surfaces.c diff --git a/src/worker.c b/src/worker.c index ca8fa7c521b..a9fbe346570 100644 --- a/src/worker.c +++ b/src/worker.c @@ -29,7 +29,7 @@ void init_worker_list(void) { } } -s32 create_worker_world(void (*updateFunc)(void), void (*drawFunc)(void)) { +s32 create_worker_scene(void (*updateFunc)(void), void (*renderFunc)(void)) { Worker* worker; s32 i; @@ -49,8 +49,8 @@ s32 create_worker_world(void (*updateFunc)(void), void (*drawFunc)(void)) { if (updateFunc == NULL) { worker->update = worker_delegate_do_nothing; } - worker->draw = drawFunc; - if (drawFunc == NULL) { + worker->draw = renderFunc; + if (renderFunc == NULL) { worker->draw = worker_delegate_do_nothing; } @@ -134,7 +134,7 @@ void update_workers(void) { } } -void render_workers_world(void) { +void render_workers_scene(void) { s32 i; for (i = 0; i < MAX_WORKERS; i++) { diff --git a/src/world/area_dro/dro_02/npc_merlee.c b/src/world/area_dro/dro_02/npc_merlee.c index 6012337f884..8322368ba57 100644 --- a/src/world/area_dro/dro_02/npc_merlee.c +++ b/src/world/area_dro/dro_02/npc_merlee.c @@ -187,7 +187,7 @@ API_CALLABLE(N(CreateRitualCards)) { imgfx_update(imgfxIdx, IMGFX_SET_ANIM, IMGFX_ANIM_FLIP_CARD_3, 1, 1, 0, IMGFX_FLAG_800); evt_set_variable(script, RITUAL_VAR_FILP3_IMGFX, imgfxIdx); - evt_set_variable(script, RITUAL_VAR_WORKER, create_worker_world( + evt_set_variable(script, RITUAL_VAR_WORKER, create_worker_scene( N(card_worker_update), N(card_worker_render))); return ApiStatus_DONE2; @@ -345,7 +345,6 @@ void N(card_worker_update)(void) { N(RitualCards)[1].rasterIndex = 48; N(RitualCards)[1].xoffset = 0; - N(RitualCards)[2].spriteID = 8; N(RitualCards)[2].rasterIndex = 5; N(RitualCards)[2].unk_00 = 1; @@ -762,7 +761,6 @@ EvtScript N(EVS_EndMerleeCamera) = { End }; - EvtScript N(EVS_NpcInteract_Merlee) = { Call(func_802D2C14, 1) ExecWait(N(EVS_BeginMerleeCamera)) diff --git a/src/world/area_end/common/Credits.inc.c b/src/world/area_end/common/Credits.inc.c index 30530bbe308..f5b9411a6f2 100644 --- a/src/world/area_end/common/Credits.inc.c +++ b/src/world/area_end/common/Credits.inc.c @@ -140,7 +140,6 @@ void N(CharAnim_FadeIn_0)(CreditsLine* line, CreditsChar* chr) { gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW); } - void N(CharAnim_FadeIn_1)(CreditsLine* line, CreditsChar* chr) { ImgFXTexture ifxImg; MesasgeFontGlyphData glyph; diff --git a/src/world/area_hos/common/FallingStars.inc.c b/src/world/area_hos/common/FallingStars.inc.c index 6d11a239cea..d5349936b39 100644 --- a/src/world/area_hos/common/FallingStars.inc.c +++ b/src/world/area_hos/common/FallingStars.inc.c @@ -44,7 +44,6 @@ API_CALLABLE(N(SpawnRandomBackgroundShootingStarFX)) { return ApiStatus_DONE2; } - API_CALLABLE(N(SpawnRandomForegroundShootingStarFX)) { PlayerStatus* playerStatus = &gPlayerStatus; f32 yaw = gCameras[CAM_DEFAULT].curYaw / 180.0f * PI; diff --git a/src/world/area_hos/hos_05/intro.c b/src/world/area_hos/hos_05/intro.c index 372a2214d87..af008c5ff3b 100644 --- a/src/world/area_hos/hos_05/intro.c +++ b/src/world/area_hos/hos_05/intro.c @@ -1381,7 +1381,6 @@ void N(appendGfx_image_strips)(s32 baseX, s32 baseY, IMG_PTR img, PAL_PTR pal, s gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); gDPSetRenderMode(gMainGfxPos++, G_RM_CLD_SURF, G_RM_CLD_SURF2); - for (i = 0; i < height / lineHeight; i++) { gDPLoadTextureTile(gMainGfxPos++, img, pal != NULL ? G_IM_FMT_CI : G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 0, i * lineHeight, width - 1, i * lineHeight + lineHeight - 1, 0, diff --git a/src/world/area_isk/isk_04/demo.c b/src/world/area_isk/isk_04/demo.c index bbeaa53b2bd..4224e200ee1 100644 --- a/src/world/area_isk/isk_04/demo.c +++ b/src/world/area_isk/isk_04/demo.c @@ -136,7 +136,6 @@ API_CALLABLE(N(SetupDemoScene)) { return ApiStatus_BLOCK; } - EvtScript N(EVS_SetupDemo) = { Call(GetPlayerPos, LVar0, LVar1, LVar2) Call(UseSettingsFrom, CAM_DEFAULT, 530, 25, -50) diff --git a/src/world/area_jan/jan_03/entity.c b/src/world/area_jan/jan_03/entity.c index 30648d59d61..385230a99a1 100644 --- a/src/world/area_jan/jan_03/entity.c +++ b/src/world/area_jan/jan_03/entity.c @@ -9,7 +9,6 @@ EvtScript N(EVS_GotoMap_tik_08_4) = { End }; - API_CALLABLE(N(GiveInitialSpringBoost)) { f32 x = gPlayerStatus.curSpeed * 5.0f * sin_deg(gPlayerStatus.targetYaw); f32 z = gPlayerStatus.curSpeed * 5.0f * -cos_deg(gPlayerStatus.targetYaw); diff --git a/src/world/area_jan/jan_03/npc.c b/src/world/area_jan/jan_03/npc.c index 430d72e8499..5e9f894bc92 100644 --- a/src/world/area_jan/jan_03/npc.c +++ b/src/world/area_jan/jan_03/npc.c @@ -132,7 +132,6 @@ API_CALLABLE(N(CountFoodItems)) { return ApiStatus_DONE2; } - EvtScript N(EVS_GetRescuedYoshiCount) = { Set(LVar0, 0) Add(LVar0, GF_JAN05_SavedYoshi) diff --git a/src/world/area_kkj/kkj_02/npc.c b/src/world/area_kkj/kkj_02/npc.c index cd9d44bf78c..10c1012b1d3 100644 --- a/src/world/area_kkj/kkj_02/npc.c +++ b/src/world/area_kkj/kkj_02/npc.c @@ -66,5 +66,3 @@ NpcGroupList N(DefaultNPCs) = { NPC_GROUP(N(NpcData_Toads)), {} }; - - diff --git a/src/world/area_kkj/kkj_10/npcs_later.c b/src/world/area_kkj/kkj_10/npcs_later.c index b59705217af..1e8b0d5b406 100644 --- a/src/world/area_kkj/kkj_10/npcs_later.c +++ b/src/world/area_kkj/kkj_10/npcs_later.c @@ -134,7 +134,6 @@ EvtScript N(EVS_NpcIdle_Koopatrol_02) = { End }; - EvtScript N(EVS_NpcInteract_Koopatrol_01) = { Call(DisablePlayerInput, TRUE) Call(GetSelfVar, 0, LVar0) diff --git a/src/world/area_kkj/kkj_19/baking.c b/src/world/area_kkj/kkj_19/baking.c index e315d83ba17..b9a42f3db75 100644 --- a/src/world/area_kkj/kkj_19/baking.c +++ b/src/world/area_kkj/kkj_19/baking.c @@ -60,7 +60,7 @@ enum MixingAnimStates { // basically the typical mash meter with the gauge removed API_CALLABLE(N(RunMixingMinigame)) { Bytecode* args = script->ptrReadPos; - s32 hudElemID; + HudElemID hid; s32 maxMashAmount; s32 i; @@ -89,25 +89,25 @@ API_CALLABLE(N(RunMixingMinigame)) { N(MixingGameUIBaseX) = -48; N(MixingGameUIBaseY) = 64; - hudElemID = hud_element_create(&HES_AButton); - N(MixingGameHudElems)[0] = hudElemID; - hud_element_set_render_pos(hudElemID, N(MixingGameUIBaseX), N(MixingGameUIBaseY)); - hud_element_set_render_depth(hudElemID, 0); - hud_element_set_flags(hudElemID, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElemID = hud_element_create(&HES_BlueMeter); - N(MixingGameHudElems)[1] = hudElemID; - hud_element_set_render_pos(hudElemID, N(MixingGameUIBaseX), N(MixingGameUIBaseY) + 28); - hud_element_set_render_depth(hudElemID, 0); - hud_element_set_flags(hudElemID, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - - hudElemID = N(MixingGameHudElems)[0]; - hud_element_set_alpha(hudElemID, 255); - hud_element_clear_flags(hudElemID, HUD_ELEMENT_FLAG_DISABLED); - - hudElemID = N(MixingGameHudElems)[1]; - hud_element_set_alpha(hudElemID, 255); - hud_element_clear_flags(hudElemID, HUD_ELEMENT_FLAG_DISABLED); + hid = hud_element_create(&HES_AButton); + N(MixingGameHudElems)[0] = hid; + hud_element_set_render_pos(hid, N(MixingGameUIBaseX), N(MixingGameUIBaseY)); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = hud_element_create(&HES_BlueMeter); + N(MixingGameHudElems)[1] = hid; + hud_element_set_render_pos(hid, N(MixingGameUIBaseX), N(MixingGameUIBaseY) + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + + hid = N(MixingGameHudElems)[0]; + hud_element_set_alpha(hid, 255); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); + + hid = N(MixingGameHudElems)[1]; + hud_element_set_alpha(hid, 255); + hud_element_clear_flags(hid, HUD_ELEMENT_FLAG_DISABLED); N(MixingGameState) = MIXING_STATE_APPEAR; script->functionTemp[0] = 10; diff --git a/src/world/area_kmr/kmr_06/sticker_sign.c b/src/world/area_kmr/kmr_06/sticker_sign.c index ad13ce70a55..f605e7f659a 100644 --- a/src/world/area_kmr/kmr_06/sticker_sign.c +++ b/src/world/area_kmr/kmr_06/sticker_sign.c @@ -108,7 +108,7 @@ API_CALLABLE(N(CreateSticker)) { iconPal); sticker->imgfxIdx = imgfx_get_free_instances(1); - sticker->workerID = create_worker_world(NULL, N(worker_render_sticker)); + sticker->workerID = create_worker_scene(NULL, N(worker_render_sticker)); evt_set_variable(script, MV_StickerData, (s32) sticker); evt_set_variable(script, MV_StickerImage, (s32) iconImg); evt_set_variable(script, MV_StickerPalette, (s32) iconPal); diff --git a/src/world/area_kmr/kmr_20/records.c b/src/world/area_kmr/kmr_20/records.c index fff70ba9494..a5f8189b405 100644 --- a/src/world/area_kmr/kmr_20/records.c +++ b/src/world/area_kmr/kmr_20/records.c @@ -287,7 +287,7 @@ API_CALLABLE(N(ShowGameRecords)) { records = script->functionTempPtr[0] = heap_malloc(sizeof(*records)); records->state = RECORDS_STATE_BEGIN_FADE_IN; records->alpha = 255; - records->workerID = create_worker_world(0, N(worker_draw_game_records)); + records->workerID = create_worker_scene(NULL, N(worker_draw_game_records)); evt_set_variable(script, MV_RecordsDataPtr, (s32) records); N(calculate_records)(records); } diff --git a/src/world/area_kmr/kmr_22/main.c b/src/world/area_kmr/kmr_22/main.c index 476fc4985dd..c0e0eeb8fdb 100644 --- a/src/world/area_kmr/kmr_22/main.c +++ b/src/world/area_kmr/kmr_22/main.c @@ -11,7 +11,6 @@ BSS s32 N(ChapterEffectTime); #define CHUNK_SIZE (10) #endif - s16 N(AnimTextOffsets)[CHUNK_SIZE * 2] = { #if VERSION_PAL 310, 270, 240, 210, diff --git a/src/world/area_kpa/kpa_40/main.c b/src/world/area_kpa/kpa_40/main.c index 825804971d4..f6ca92590c5 100644 --- a/src/world/area_kpa/kpa_40/main.c +++ b/src/world/area_kpa/kpa_40/main.c @@ -50,5 +50,3 @@ EvtScript N(EVS_Main) = { Return End }; - - diff --git a/src/world/area_kpa/kpa_62/main.c b/src/world/area_kpa/kpa_62/main.c index a66a8e58550..b741e4b9c62 100644 --- a/src/world/area_kpa/kpa_62/main.c +++ b/src/world/area_kpa/kpa_62/main.c @@ -230,5 +230,3 @@ EvtScript N(EVS_Main) = { Return End }; - - diff --git a/src/world/area_kzn/kzn_23/npc.c b/src/world/area_kzn/kzn_23/npc.c index 597f2f6c0f3..e12e5fe5913 100644 --- a/src/world/area_kzn/kzn_23/npc.c +++ b/src/world/area_kzn/kzn_23/npc.c @@ -62,7 +62,7 @@ API_CALLABLE(N(AnimateChestSize)) { entity->rot.y = (1.0f - cos_rad(entity->scale.y * PI)) * 990.0 / 2.0; script->functionTemp[1]--; - if (~script->functionTemp[1] == 0) { //TODO remove ~ optimization + if (script->functionTemp[1] == -1) { return ApiStatus_DONE2; } else { return ApiStatus_BLOCK; diff --git a/src/world/area_mac/mac_01/bulletin.c b/src/world/area_mac/mac_01/bulletin.c index e01fd760500..5f53fe9a99f 100644 --- a/src/world/area_mac/mac_01/bulletin.c +++ b/src/world/area_mac/mac_01/bulletin.c @@ -86,7 +86,6 @@ API_CALLABLE(N(SelectBulletinMessages)) { return ApiStatus_DONE2; } - EvtScript N(EVS_ReadBulletin_News) = { Call(N(SelectBulletinMessages)) Call(DisablePlayerInput, TRUE) diff --git a/src/world/area_mac/mac_01/music_mix.c b/src/world/area_mac/mac_01/music_mix.c index b153189187e..341b1ae230c 100644 --- a/src/world/area_mac/mac_01/music_mix.c +++ b/src/world/area_mac/mac_01/music_mix.c @@ -26,7 +26,6 @@ MusicProximityTrigger N(MusicMixTrigger3) = { .manualActivationFlag = MF_MusicMixTrigger3, }; - EvtScript N(EVS_SetupMusicMix) = { Call(SetMusicTrack, 0, SONG_TOAD_TOWN, 0, 8) Call(EnableMusicProximityMix, 0) diff --git a/src/world/area_mac/mac_02/rooms.c b/src/world/area_mac/mac_02/rooms.c index 7be4565b987..16a2572748f 100644 --- a/src/world/area_mac/mac_02/rooms.c +++ b/src/world/area_mac/mac_02/rooms.c @@ -23,7 +23,6 @@ API_CALLABLE(N(InitEntryFromTunnels)) { return ApiStatus_DONE2; } - EvtScript N(EVS_SetDoorRot_TayceT) = { Call(RotateModel, MODEL_c_door, LVar0, 0, -1, 0) Return diff --git a/src/world/area_mac/mac_04/entity.c b/src/world/area_mac/mac_04/entity.c index 854bf497912..d56ba5803be 100644 --- a/src/world/area_mac/mac_04/entity.c +++ b/src/world/area_mac/mac_04/entity.c @@ -9,7 +9,7 @@ MAP_RODATA_PAD(2,unk); API_CALLABLE(N(CreateShrinkingWorker)) { gPlayerStatus.animFlags |= PA_FLAG_INVISIBLE; - evt_set_variable(script, MV_DrawShinkingPlayerWorker, create_worker_world(NULL, N(render_shrunk_player))); + evt_set_variable(script, MV_DrawShinkingPlayerWorker, create_worker_scene(NULL, N(render_shrunk_player))); return ApiStatus_DONE2; } diff --git a/src/world/area_mgm/mgm_00/scoreboard.c b/src/world/area_mgm/mgm_00/scoreboard.c index 59e7f07d9ee..afc16068d7f 100644 --- a/src/world/area_mgm/mgm_00/scoreboard.c +++ b/src/world/area_mgm/mgm_00/scoreboard.c @@ -168,7 +168,7 @@ API_CALLABLE(N(UpdateRecordDisplay)) { script->functionTempPtr[0] = data; data->state = RECORD_START_SHOW; data->alpha = 255; - data->workerID = create_worker_world(NULL, &N(work_draw_record)); + data->workerID = create_worker_scene(NULL, &N(work_draw_record)); data->gameType = gameType; evt_set_variable(script, MV_RecordDisplayData, (s32)data); } diff --git a/src/world/area_mgm/mgm_01/npc.c b/src/world/area_mgm/mgm_01/npc.c index 22eb2265166..0b6f9a55822 100644 --- a/src/world/area_mgm/mgm_01/npc.c +++ b/src/world/area_mgm/mgm_01/npc.c @@ -54,7 +54,7 @@ typedef struct JumpGamePanel { typedef struct JumpGameData { /* 0x000 */ s32 workerID; - /* 0x004 */ s32 hudElemID; + /* 0x004 */ HudElemID hudElemID; /* 0x008 */ s32 unk_08; // unused -- likely hudElemID for an unused/removed hud element /* 0x00C */ s32 curScore; /* 0x010 */ s32 targetScore; @@ -98,7 +98,7 @@ extern EvtScript N(EVS_InitializePanels); void N(appendGfx_score_display) (void* renderData) { Enemy* scorekeeper = get_enemy(SCOREKEEPER_ENEMY_IDX); JumpGameData* data = (JumpGameData*)scorekeeper->varTable[JUMP_DATA_VAR_IDX]; - s32 hudElemID; + HudElemID hid; s32 diff; if (scorekeeper->varTable[BROKEN_BLOCKS_VAR_IDX] == -1) { @@ -119,9 +119,9 @@ void N(appendGfx_score_display) (void* renderData) { if (data->scoreWindowPosX < SCREEN_WIDTH + 1) { draw_box(0, WINDOW_STYLE_9, data->scoreWindowPosX, 28, 0, 72, 20, 255, 0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, NULL, NULL, NULL, SCREEN_WIDTH, SCREEN_HEIGHT, NULL); - hudElemID = data->hudElemID; - hud_element_set_render_pos(hudElemID, data->scoreWindowPosX + 15, 39); - hud_element_draw_clipped(hudElemID); + hid = data->hudElemID; + hud_element_set_render_pos(hid, data->scoreWindowPosX + 15, 39); + hud_element_draw_clipped(hid); if (data->curScore > data->targetScore) { data->curScore = data->targetScore; } else if (data->curScore < data->targetScore) { @@ -624,13 +624,13 @@ API_CALLABLE(N(InitializePanels)) { API_CALLABLE(N(CreateMinigame)) { Enemy* scorekeeper = get_enemy(SCOREKEEPER_ENEMY_IDX); JumpGameData* data = general_heap_malloc(sizeof(*data)); - s32 hudElemID; + HudElemID hid; scorekeeper->varTablePtr[JUMP_DATA_VAR_IDX] = data; - data->workerID = create_worker_world(NULL, &mgm_01_worker_draw_score); + data->workerID = create_worker_scene(NULL, &mgm_01_worker_draw_score); - hudElemID = hud_element_create(&HES_StatusCoin); - data->hudElemID = hudElemID; + hid = hud_element_create(&HES_StatusCoin); + data->hudElemID = hid; hud_element_set_flags(data->hudElemID, HUD_ELEMENT_FLAG_80); hud_element_set_tint(data->hudElemID, 255, 255, 255); diff --git a/src/world/area_mgm/mgm_02/npc.c b/src/world/area_mgm/mgm_02/npc.c index ccd4e90a195..c83ea5d3321 100644 --- a/src/world/area_mgm/mgm_02/npc.c +++ b/src/world/area_mgm/mgm_02/npc.c @@ -101,8 +101,8 @@ typedef struct SmashGameData { /* 0x000 */ s32 workerID; /* 0x004 */ s32 found; /* 0x008 */ s32 timeLeft; // num frames at 30fps - /* 0x00C */ s32 hudElemID_AButton; - /* 0x010 */ s32 hudElemID_Meter; + /* 0x00C */ HudElemID buttonHID; + /* 0x010 */ HudElemID meterHID; /* 0x014 */ s32 windowA_posX; /* 0x018 */ s32 windowB_posX; /* 0x01C */ s32 signpostEntity; @@ -123,20 +123,20 @@ typedef struct SmashGameData { void N(appendGfx_score_display)(void* renderData) { Enemy* scorekeeper = get_enemy(SCOREKEEPER_ENEMY_IDX); SmashGameData* data = scorekeeper->varTablePtr[SMASH_DATA_VAR_IDX]; - s32 hudElemA; - s32 hudElemMeter; + HudElemID buttonHID; + HudElemID meterHID; s32 timeLeft; s32 seconds; s32 deciseconds; // show mash meter while grabbed by a fuzzy if (data->stunFlags & STUN_FLAG_GRABBED) { - hudElemA = data->hudElemID_AButton; - hud_element_set_render_pos(hudElemA, 90, 90); - hud_element_draw_clipped(hudElemA); - hudElemMeter = data->hudElemID_Meter; - hud_element_set_render_pos(hudElemMeter, 90, 120); - hud_element_draw_clipped(hudElemMeter); + buttonHID = data->buttonHID; + hud_element_set_render_pos(buttonHID, 90, 90); + hud_element_draw_clipped(buttonHID); + meterHID = data->meterHID; + hud_element_set_render_pos(meterHID, 90, 120); + hud_element_draw_clipped(meterHID); startup_draw_prim_rect_COPY(62, 116, 62 + (s32)(((f32)data->mashProgress / 12.0) * 59.0), 116 + 5, 0, 228, 134, 255); } @@ -204,22 +204,23 @@ void N(worker_draw_score)(void) { API_CALLABLE(N(CreateScoreDisplay)) { SmashGameData* data = get_enemy(SCOREKEEPER_ENEMY_IDX)->varTablePtr[SMASH_DATA_VAR_IDX]; - s32 hudElemA, hudElemMeter; + HudElemID hidButton; + HudElemID hidMeter; if (isInitialCall) { - data->workerID = create_worker_world(NULL, &N(worker_draw_score)); - - hudElemA = hud_element_create(&HES_AButton); - data->hudElemID_AButton = hudElemA; - hud_element_set_render_depth(hudElemA, 0); - hud_element_set_flags(hudElemA, HUD_ELEMENT_FLAG_80); - hud_element_set_tint(hudElemA, 255, 255, 255); - hud_element_set_script(hudElemA, &HES_AButton); - - hudElemMeter = hud_element_create(&HES_BlueMeter); - data->hudElemID_Meter = hudElemMeter; - hud_element_set_render_depth(hudElemMeter, 0); - hud_element_set_flags(hudElemMeter, HUD_ELEMENT_FLAG_80); + data->workerID = create_worker_scene(NULL, &N(worker_draw_score)); + + hidButton = hud_element_create(&HES_AButton); + data->buttonHID = hidButton; + hud_element_set_render_depth(hidButton, 0); + hud_element_set_flags(hidButton, HUD_ELEMENT_FLAG_80); + hud_element_set_tint(hidButton, 255, 255, 255); + hud_element_set_script(hidButton, &HES_AButton); + + hidMeter = hud_element_create(&HES_BlueMeter); + data->meterHID = hidMeter; + hud_element_set_render_depth(hidMeter, 0); + hud_element_set_flags(hidMeter, HUD_ELEMENT_FLAG_80); } return ApiStatus_BLOCK; @@ -490,9 +491,9 @@ API_CALLABLE(N(RunMinigame)) { } break; case BOX_STATE_FUZZY_HIT: - hud_element_set_script(data->hudElemID_AButton, &HES_AButton); - hud_element_set_alpha(data->hudElemID_AButton, 160); - hud_element_set_alpha(data->hudElemID_Meter, 160); + hud_element_set_script(data->buttonHID, &HES_AButton); + hud_element_set_alpha(data->buttonHID, 160); + hud_element_set_alpha(data->meterHID, 160); data->mashProgress = 0; data->stunFlags |= STUN_FLAG_GRABBED; enable_npc_shadow(npc); @@ -534,9 +535,9 @@ API_CALLABLE(N(RunMinigame)) { npc->pos.x = gPlayerStatusPtr->pos.x; npc->pos.y = gPlayerStatusPtr->pos.y + 28.0; npc->pos.z = gPlayerStatusPtr->pos.z + 2.0; - hud_element_set_script(data->hudElemID_AButton, &HES_MashAButton); - hud_element_set_alpha(data->hudElemID_AButton, 255); - hud_element_set_alpha(data->hudElemID_Meter, 255); + hud_element_set_script(data->buttonHID, &HES_MashAButton); + hud_element_set_alpha(data->buttonHID, 255); + hud_element_set_alpha(data->meterHID, 255); data->box[i].state = BOX_STATE_FUZZY_GRAB; } break; @@ -551,9 +552,9 @@ API_CALLABLE(N(RunMinigame)) { data->stunFlags |= STUN_FLAG_CHANGED; data->box[i].state = BOX_STATE_FUZZY_DETACH; npc->duration = 10; - hud_element_set_script(data->hudElemID_AButton, &HES_AButton); - hud_element_set_alpha(data->hudElemID_AButton, 160); - hud_element_set_alpha(data->hudElemID_Meter, 160); + hud_element_set_script(data->buttonHID, &HES_AButton); + hud_element_set_alpha(data->buttonHID, 160); + hud_element_set_alpha(data->meterHID, 160); npc->curAnim = ANIM_Fuzzy_Hurt; npc->pos.y += 3.0; } @@ -989,8 +990,8 @@ API_CALLABLE(N(DestroyMinigame)) { SmashGameData* data = get_enemy(SCOREKEEPER_ENEMY_IDX)->varTablePtr[SMASH_DATA_VAR_IDX]; free_worker(data->workerID); - hud_element_free(data->hudElemID_AButton); - hud_element_free(data->hudElemID_Meter); + hud_element_free(data->buttonHID); + hud_element_free(data->meterHID); return ApiStatus_DONE2; } diff --git a/src/world/area_nok/nok_12/demo.c b/src/world/area_nok/nok_12/demo.c index 94733a020ca..22ab99f7353 100644 --- a/src/world/area_nok/nok_12/demo.c +++ b/src/world/area_nok/nok_12/demo.c @@ -157,7 +157,6 @@ API_CALLABLE(N(SetupDemoScene1)) { return ApiStatus_BLOCK; } - EvtScript N(EVS_PlayDemoScene1) = { Call(N(SetupDemoScene1)) Set(GF_DemoSceneDone, FALSE) diff --git a/src/world/area_obk/obk_01/npc.c b/src/world/area_obk/obk_01/npc.c index 23deb74cd1e..ac5154c6f9d 100644 --- a/src/world/area_obk/obk_01/npc.c +++ b/src/world/area_obk/obk_01/npc.c @@ -98,7 +98,6 @@ API_CALLABLE(N(UpdateTrafficBooAlpha)) { return ApiStatus_DONE2; } - EvtScript N(EVS_NpcIdle_TrafficBoo) = { Call(N(UpdateTrafficBooMotion)) Return diff --git a/src/world/area_obk/obk_07/phonograph.c b/src/world/area_obk/obk_07/phonograph.c index c860529b336..f5cfdf891f1 100644 --- a/src/world/area_obk/obk_07/phonograph.c +++ b/src/world/area_obk/obk_07/phonograph.c @@ -31,9 +31,9 @@ typedef struct PhonographData { /* 0x030 */ s32 state; /* 0x034 */ s32 hudBaseX; /* 0x038 */ s32 hudBaseY; - /* 0x03C */ s32 hudElemAButton; - /* 0x040 */ s32 hudElemBlueMeter; - /* 0x044 */ s32 hudElemOK; + /* 0x03C */ HudElemID buttonHID; + /* 0x040 */ HudElemID meterHID; + /* 0x044 */ HudElemID okHID; /* 0x048 */ char unk_48[0x4]; /* 0x04C */ s32 updateScaleScriptID; /* 0x050 */ s32 updateCrankScriptID; @@ -203,13 +203,13 @@ void N(worker_update_phonograph_hud)(void) { switch (data->state) { case PHONOGRAPH_HUD_STATE_INIT: - id = data->hudElemAButton; + id = data->buttonHID; hud_element_set_alpha(id, 255); hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - id = data->hudElemBlueMeter; + id = data->meterHID; hud_element_set_alpha(id, 255); hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); - id = data->hudElemOK; + id = data->okHID; hud_element_set_alpha(id, 255); hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED); data->state = PHONOGRAPH_HUD_STATE_APPEAR; @@ -219,12 +219,12 @@ void N(worker_update_phonograph_hud)(void) { if (data->hudBaseX > 50) { data->hudBaseX = 50; } - hud_element_set_render_pos(data->hudElemAButton, data->hudBaseX, data->hudBaseY); - hud_element_set_render_pos(data->hudElemBlueMeter, data->hudBaseX, data->hudBaseY + 28); - hud_element_set_render_pos(data->hudElemOK, data->hudBaseX + 2, data->hudBaseY + 14); + hud_element_set_render_pos(data->buttonHID, data->hudBaseX, data->hudBaseY); + hud_element_set_render_pos(data->meterHID, data->hudBaseX, data->hudBaseY + 28); + hud_element_set_render_pos(data->okHID, data->hudBaseX + 2, data->hudBaseY + 14); break; case PHONOGRAPH_HUD_STATE_MASHING: - hud_element_set_script(data->hudElemAButton, &HES_SlowlyMashAButton); + hud_element_set_script(data->buttonHID, &HES_SlowlyMashAButton); data->state = PHONOGRAPH_HUD_STATE_FINAL; // fallthrough case PHONOGRAPH_HUD_STATE_FINAL: @@ -290,19 +290,19 @@ API_CALLABLE(N(func_80240EF8_BCFAE8)) { void N(worker_draw_phonograph_hud)(void) { PhonographData* data = N(GetPhonographData)(); - s32 hudElemIndex; + HudElemID hid; s32 x, y; - hudElemIndex = data->hudElemAButton; - hud_element_draw_clipped(hudElemIndex); + hid = data->buttonHID; + hud_element_draw_clipped(hid); - hudElemIndex = data->hudElemBlueMeter; - hud_element_draw_clipped(hudElemIndex); - hud_element_get_render_pos(hudElemIndex, &x, &y); + hid = data->meterHID; + hud_element_draw_clipped(hid); + hud_element_get_render_pos(hid, &x, &y); N(DrawMashMeterWithDivisor)(x, y, data->fillValue, 2); - hudElemIndex = data->hudElemOK; - hud_element_draw_clipped(hudElemIndex); + hid = data->okHID; + hud_element_draw_clipped(hid); } API_CALLABLE(N(GetSelectedRecordIndex)) { @@ -324,7 +324,7 @@ API_CALLABLE(N(GetSelectedRecordIndex)) { API_CALLABLE(N(CreatePhonographHudData)) { PhonographData* data = N(GetPhonographData)(); - s32 id; + HudElemID hid; s32 i; gOverrideFlags |= GLOBAL_OVERRIDES_MESSAGES_OVER_FRONTUI; @@ -352,20 +352,20 @@ API_CALLABLE(N(CreatePhonographHudData)) { data->timeScale = 1.0f; data->modelScale = 1.0f; - data->hudElemAButton = id = hud_element_create(&HES_AButton); - hud_element_set_render_pos(id, data->hudBaseX, data->hudBaseY); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + data->buttonHID = hid = hud_element_create(&HES_AButton); + hud_element_set_render_pos(hid, data->hudBaseX, data->hudBaseY); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - data->hudElemBlueMeter = id = hud_element_create(&HES_BlueMeter); - hud_element_set_render_pos(id, data->hudBaseX, data->hudBaseY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + data->meterHID = hid = hud_element_create(&HES_BlueMeter); + hud_element_set_render_pos(hid, data->hudBaseX, data->hudBaseY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); - data->hudElemOK = id = hud_element_create(&HES_RunAwayOK); - hud_element_set_render_pos(id, data->hudBaseX, data->hudBaseY + 28); - hud_element_set_render_depth(id, 0); - hud_element_set_flags(id, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); + data->okHID = hid = hud_element_create(&HES_RunAwayOK); + hud_element_set_render_pos(hid, data->hudBaseX, data->hudBaseY + 28); + hud_element_set_render_depth(hid, 0); + hud_element_set_flags(hid, HUD_ELEMENT_FLAG_80 | HUD_ELEMENT_FLAG_DISABLED); return ApiStatus_DONE2; } @@ -390,9 +390,9 @@ API_CALLABLE(N(DestroyPhonographHudData)) { data->state = PHONOGRAPH_HUD_STATE_DESTROYED; gOverrideFlags &= ~GLOBAL_OVERRIDES_MESSAGES_OVER_FRONTUI; - hud_element_free(data->hudElemAButton); - hud_element_free(data->hudElemBlueMeter); - hud_element_free(data->hudElemOK); + hud_element_free(data->buttonHID); + hud_element_free(data->meterHID); + hud_element_free(data->okHID); free_worker(data->hudWorker); return ApiStatus_DONE2; } diff --git a/src/world/area_omo/omo_09/npc.c b/src/world/area_omo/omo_09/npc.c index a91ed75391c..de82396f975 100644 --- a/src/world/area_omo/omo_09/npc.c +++ b/src/world/area_omo/omo_09/npc.c @@ -75,7 +75,6 @@ EvtScript N(EVS_ShyGuy_CarryItem) = { End }; - EvtScript N(EVS_NpcDefeat_ShyGuy_Thief) = { Call(GetBattleOutcome, LVar0) Switch(LVar0) diff --git a/src/world/area_pra/common/Reflection.inc.c b/src/world/area_pra/common/Reflection.inc.c index 625c2bd1a7a..4675fe56684 100644 --- a/src/world/area_pra/common/Reflection.inc.c +++ b/src/world/area_pra/common/Reflection.inc.c @@ -66,7 +66,7 @@ s32 N(reflection_unk_change_anim_facing)(s32 playerAnim) { } API_CALLABLE(N(EnableWallReflection)){ - script->array[0] = (s32) create_worker_world(NULL, N(worker_reflect_player_wall)); + script->array[0] = (s32) create_worker_scene(NULL, N(worker_reflect_player_wall)); return ApiStatus_DONE2; } @@ -143,7 +143,7 @@ API_CALLABLE(N(EnableFloorReflection)){ switch (script->varTable[0]) { case REFLECTION_FLOOR_WALL: case REFLECTION_FLOOR_ONLY: - script->array[0] = create_worker_world(NULL, N(worker_reflect_player_floor)); + script->array[0] = create_worker_scene(NULL, N(worker_reflect_player_floor)); gOverrideFlags |= GLOBAL_OVERRIDES_ENABLE_FLOOR_REFLECTION; break; case REFLECTION_WALL_ONLY: @@ -323,20 +323,20 @@ API_CALLABLE(N(EnablePartnerReflection)){ if (script->varTable[1] == FALSE) { switch (script->varTable[0]) { case REFLECTION_FLOOR_WALL: - script->array[1] = create_worker_world(N(worker_reflect_partner_all), NULL); + script->array[1] = create_worker_scene(N(worker_reflect_partner_all), NULL); break; case REFLECTION_FLOOR_ONLY: - script->array[1] = create_worker_world(N(worker_reflect_partner_floor), NULL); + script->array[1] = create_worker_scene(N(worker_reflect_partner_floor), NULL); break; case REFLECTION_WALL_ONLY: - script->array[1] = create_worker_world(N(worker_reflect_partner_wall), NULL); + script->array[1] = create_worker_scene(N(worker_reflect_partner_wall), NULL); break; } } else { switch (script->varTable[0]) { case REFLECTION_FLOOR_WALL: case REFLECTION_FLOOR_ONLY: - script->array[1] = create_worker_world(N(worker_reflect_partner_floor), NULL); + script->array[1] = create_worker_scene(N(worker_reflect_partner_floor), NULL); break; case REFLECTION_WALL_ONLY: break; diff --git a/src/world/area_pra/pra_13/npc.c b/src/world/area_pra/pra_13/npc.c index 0b8be263288..7f2d4fa5bfa 100644 --- a/src/world/area_pra/pra_13/npc.c +++ b/src/world/area_pra/pra_13/npc.c @@ -29,7 +29,7 @@ void N(appendGfx_fake_player)(void* data); void N(worker_draw_fake_player)(void); API_CALLABLE(N(CreateFakePlayerRenderer)) { - script->array[0] = create_worker_world(NULL, N(worker_draw_fake_player)); + script->array[0] = create_worker_scene(NULL, N(worker_draw_fake_player)); return ApiStatus_DONE2; } @@ -269,5 +269,3 @@ NpcGroupList N(DefaultNPCs) = { NPC_GROUP(N(NpcData_Imposters), BTL_PRA3_FORMATION_02, BTL_PRA3_STAGE_00), {} }; - - diff --git a/src/world/area_pra/pra_19/npc.c b/src/world/area_pra/pra_19/npc.c index 11056c7ad7c..c445cafc273 100644 --- a/src/world/area_pra/pra_19/npc.c +++ b/src/world/area_pra/pra_19/npc.c @@ -84,7 +84,7 @@ void N(appendGfx_example_player)(void* data); void N(worker_draw_example_player)(void); API_CALLABLE(N(CreateExamplePlayerRenderer)) { - script->array[0] = create_worker_world(NULL, N(worker_draw_example_player)); + script->array[0] = create_worker_scene(NULL, N(worker_draw_example_player)); return ApiStatus_DONE2; } @@ -119,7 +119,6 @@ void N(appendGfx_example_player)(void* data) { spr_draw_player_sprite(PLAYER_SPRITE_AUX2, 0, 0, 0, mtxTransform); } - API_CALLABLE(N(SetPlayerFacingAngle)) { gPlayerStatus.spriteFacingAngle = script->varTable[0]; return ApiStatus_DONE2; diff --git a/src/world/area_sam/sam_11/entity.c b/src/world/area_sam/sam_11/entity.c index aeab2d0fffc..4d2dedbe575 100644 --- a/src/world/area_sam/sam_11/entity.c +++ b/src/world/area_sam/sam_11/entity.c @@ -29,7 +29,7 @@ API_CALLABLE(N(UpdateHouseShowHide)) { if (script->varTable[0] == 0) { alpha = script->functionTemp[0]; } else { - alpha = ~script->functionTemp[0]; + alpha = -script->functionTemp[0] - 1; } a = alpha; mdl_set_shroud_tint_params(0, 0, 0, a); diff --git a/src/world/area_sam/sam_11/rooms.c b/src/world/area_sam/sam_11/rooms.c index 7f0b3a91fd4..03757a73e5a 100644 --- a/src/world/area_sam/sam_11/rooms.c +++ b/src/world/area_sam/sam_11/rooms.c @@ -106,7 +106,6 @@ EvtScript N(EVS_DropDoor_RightHouse) = { End }; - s32 N(KeyList)[] = { ITEM_WAREHOUSE_KEY, ITEM_NONE diff --git a/src/world/area_trd/trd_05/trap.c b/src/world/area_trd/trd_05/trap.c index 06bcd3ae34e..6662e265cc2 100644 --- a/src/world/area_trd/trd_05/trap.c +++ b/src/world/area_trd/trd_05/trap.c @@ -88,7 +88,7 @@ API_CALLABLE(N(InitializeFallingSprite)) { falling->scale.y = SPRITE_WORLD_SCALE_F; falling->scale.z = SPRITE_WORLD_SCALE_F; falling->imgfxIdx = imgfx_get_free_instances(1); - falling->workerID = create_worker_world(0, &N(appendGfx_FallingSprite)); + falling->workerID = create_worker_scene(NULL, &N(appendGfx_FallingSprite)); return ApiStatus_DONE2; } diff --git a/src/world/area_trd/trd_06/falling.c b/src/world/area_trd/trd_06/falling.c index 2a3bf8e6c99..116a77f4d21 100644 --- a/src/world/area_trd/trd_06/falling.c +++ b/src/world/area_trd/trd_06/falling.c @@ -96,7 +96,7 @@ API_CALLABLE(N(InitializeFallingSprite)) { falling->scale.z = SPRITE_WORLD_SCALE_F; falling->imgfxIdx = imgfx_get_free_instances(1); - falling->workerID = create_worker_world(0, &N(appendGfx_FallingSprite)); + falling->workerID = create_worker_scene(NULL, &N(appendGfx_FallingSprite)); return ApiStatus_DONE2; } diff --git a/src/world/area_tst/tst_04/reflection.c b/src/world/area_tst/tst_04/reflection.c index 537c8dd08f6..665b325da49 100644 --- a/src/world/area_tst/tst_04/reflection.c +++ b/src/world/area_tst/tst_04/reflection.c @@ -64,7 +64,7 @@ void N(appendGfx_test_player_reflection)(void* data) { API_CALLABLE(N(EnablePartnerReflection)) { Npc* partner; - script->array[1] = create_worker_world(&N(worker_update_partner_reflection), NULL); + script->array[1] = create_worker_scene(&N(worker_update_partner_reflection), NULL); partner = get_npc_safe(NPC_PARTNER); if (partner == NULL) { @@ -102,7 +102,7 @@ void N(worker_render_animator)(void) { } API_CALLABLE(N(SetupAnimatedModel)) { - create_worker_world(N(worker_update_animator), N(worker_render_animator)); + create_worker_scene(N(worker_update_animator), N(worker_render_animator)); return ApiStatus_DONE2; } diff --git a/src/world/area_tst/tst_11/extra.c b/src/world/area_tst/tst_11/extra.c index 982a2546259..98b79395dcf 100644 --- a/src/world/area_tst/tst_11/extra.c +++ b/src/world/area_tst/tst_11/extra.c @@ -128,7 +128,7 @@ void N(appendGfx_test_reflection_floor)(void* data) { API_CALLABLE(N(PartnerReflectTest)) { Npc* partner; - script->array[1] = create_worker_world(N(test_reflection_worker_partner), NULL); + script->array[1] = create_worker_scene(N(test_reflection_worker_partner), NULL); partner = get_npc_safe(NPC_PARTNER); if (partner == NULL) { diff --git a/src/world/area_tst/tst_13/main.c b/src/world/area_tst/tst_13/main.c index e5fc3f0b724..056fbf68a32 100644 --- a/src/world/area_tst/tst_13/main.c +++ b/src/world/area_tst/tst_13/main.c @@ -307,7 +307,6 @@ void N(build_gfx_floor)(void) { gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW); } - s32 N(BetaPanelData)[] = { MODEL_point, COLLIDER_point, -35, 0, -45, ITEM_HEART }; diff --git a/src/world/common/complete/GiveReward.inc.c b/src/world/common/complete/GiveReward.inc.c index d8a72968ff5..19e12587b48 100644 --- a/src/world/common/complete/GiveReward.inc.c +++ b/src/world/common/complete/GiveReward.inc.c @@ -80,7 +80,6 @@ EvtScript N(GiveCoinReward) = { ExecWait(N(GiveItemReward)) \ Call(AddStarPieces, 1) - #define EVT_GIVE_COIN() \ Set(LVar0, ITEM_COIN) \ Set(LVar1, 0) \ diff --git a/src/world/common/complete/KnockDownPlayer.inc.c b/src/world/common/complete/KnockDownPlayer.inc.c index 523fc7e5ad8..a0cd814b962 100644 --- a/src/world/common/complete/KnockDownPlayer.inc.c +++ b/src/world/common/complete/KnockDownPlayer.inc.c @@ -74,7 +74,7 @@ API_CALLABLE(N(KnockdownCreate)) { data->scale.y = SPRITE_WORLD_SCALE_F; data->scale.z = SPRITE_WORLD_SCALE_F; data->imgfxIdx = imgfx_get_free_instances(1); - data->workerID = create_worker_world(0, N(gfx_build_knocked_down_player)); + data->workerID = create_worker_scene(NULL, N(gfx_build_knocked_down_player)); evt_set_variable(script, KNOCK_DOWN_MAP_VAR, (s32) data); return ApiStatus_DONE2; } diff --git a/src/world/common/enemy/ai/FlyingMagikoopaAI.inc.c b/src/world/common/enemy/ai/FlyingMagikoopaAI.inc.c index b2842aa9961..925ec81b3b3 100644 --- a/src/world/common/enemy/ai/FlyingMagikoopaAI.inc.c +++ b/src/world/common/enemy/ai/FlyingMagikoopaAI.inc.c @@ -105,7 +105,7 @@ void N(FlyingMagikoopaAI_15)(Evt* arg0, MobileAISettings* arg1, EnemyDetectVolum isCCW = TRUE; } else { angleAdjust += 5; - iterations += 1; + iterations++; isCCW = FALSE; } diff --git a/src/world/common/enemy/ai/States_PatrolAI.inc.c b/src/world/common/enemy/ai/States_PatrolAI.inc.c index 6062f5ca92f..a256fe0806b 100644 --- a/src/world/common/enemy/ai/States_PatrolAI.inc.c +++ b/src/world/common/enemy/ai/States_PatrolAI.inc.c @@ -103,7 +103,6 @@ void N(PatrolAI_LoiterInit)(Evt* script, MobileAISettings* aiSettings, EnemyDete script->AI_TEMP_STATE = AI_STATE_LOITER; } - void N(PatrolAI_Loiter)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); diff --git a/src/world/common/enemy/ai/States_TackleAI.inc.c b/src/world/common/enemy/ai/States_TackleAI.inc.c index fcb2ab84bed..21d2e2e1197 100644 --- a/src/world/common/enemy/ai/States_TackleAI.inc.c +++ b/src/world/common/enemy/ai/States_TackleAI.inc.c @@ -17,7 +17,6 @@ void N(set_script_owner_npc_anim)(Evt* script, MobileAISettings* aiSettings, Ene script->AI_TEMP_STATE = 13; } - ApiStatus N(UnkDistFunc)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); diff --git a/src/world/common/entity/Chest.inc.c b/src/world/common/entity/Chest.inc.c index 61aed3a21f4..431e7884e3f 100644 --- a/src/world/common/entity/Chest.inc.c +++ b/src/world/common/entity/Chest.inc.c @@ -48,7 +48,6 @@ EvtScript N(EVS_Chest_GetItem) = { End \ } - #define EVT_OPEN_CHEST_KEY(item, flag) \ { \ Set(LVarA, item) \ diff --git a/src/world/common/lava_piranha/part2.inc.c b/src/world/common/lava_piranha/part2.inc.c index b841c503e54..63750bc073c 100644 --- a/src/world/common/lava_piranha/part2.inc.c +++ b/src/world/common/lava_piranha/part2.inc.c @@ -291,6 +291,6 @@ API_CALLABLE(N(CreateVineRenderer)) { LavaPiranhaVine* data = heap_malloc(NUM_VINES * sizeof(*data)); evt_set_variable(script, MV_VinesData, (s32) data); N(VineRenderState) = -1; - create_worker_world(NULL, &N(worker_render_piranha_vines)); + create_worker_scene(NULL, &N(worker_render_piranha_vines)); return ApiStatus_DONE2; } diff --git a/src/world/common/todo/HeartPlant_SpawnHeart.inc.c b/src/world/common/todo/HeartPlant_SpawnHeart.inc.c index 56aeae0e759..2b27c0b9e93 100644 --- a/src/world/common/todo/HeartPlant_SpawnHeart.inc.c +++ b/src/world/common/todo/HeartPlant_SpawnHeart.inc.c @@ -7,7 +7,7 @@ API_CALLABLE(N(HeartPlant_SpawnHeart)) { if ((enemy->varTable[0] < 5) && (rand_int(1000) > 300)) { make_item_entity_nodelay(ITEM_HEART, npc->pos.x, npc->pos.y + npc->collisionHeight, npc->pos.z + 5.0, ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS, 0); - enemy->varTable[0] += 1; + enemy->varTable[0]++; } return ApiStatus_DONE2; } diff --git a/src/world/common/todo/IsBerserkerEquipped.inc.c b/src/world/common/todo/IsBerserkerEquipped.inc.c deleted file mode 100644 index 00e7bf08200..00000000000 --- a/src/world/common/todo/IsBerserkerEquipped.inc.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "common.h" -#include "npc.h" -#include "battle/action_cmd.h" - -API_CALLABLE(N(IsBerserkerEquipped)) { - script->varTable[0] = gBattleStatus.actionCommandMode; - script->varTable[1] = 15; - - if (is_ability_active(ABILITY_BERSERKER)) { - script->varTable[0] = ACTION_COMMAND_MODE_NOT_LEARNED; - script->varTable[1] = 40; - } - - return ApiStatus_DONE2; -} - diff --git a/src/world/dead/area_flo/flo_10/waterfx.c b/src/world/dead/area_flo/flo_10/waterfx.c index 81c09c55a39..400c04ba2e9 100644 --- a/src/world/dead/area_flo/flo_10/waterfx.c +++ b/src/world/dead/area_flo/flo_10/waterfx.c @@ -75,7 +75,6 @@ void N(UnkModelFunc000)(s32 x1, s32 y1, s32 x2, s32 y2) { //x1, y1 - 6 * i - 6, x2 - 1, y1 - 6 * i - 1, 0, //G_TX_WRAP, G_TX_WRAP, 9, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - //gDPSetTextureImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, osVirtualToPhysical(img)); { Gfx *_g = (Gfx *)(gMainGfxPos++); diff --git a/src/world/dead/area_kzn/kzn_19/npc.c b/src/world/dead/area_kzn/kzn_19/npc.c index 45d523dbac3..ab0b677c4c5 100644 --- a/src/world/dead/area_kzn/kzn_19/npc.c +++ b/src/world/dead/area_kzn/kzn_19/npc.c @@ -332,7 +332,7 @@ API_CALLABLE(N(CreateVineRenderer)) { LavaPiranhaVine* data = heap_malloc(NUM_VINES * sizeof(*data)); evt_set_variable(script, MV_VinesData, (s32) data); N(VineRenderState) = -1; - create_worker_world(NULL, &N(worker_render_piranha_vines)); + create_worker_scene(NULL, &N(worker_render_piranha_vines)); return ApiStatus_DONE2; } diff --git a/src/world/dead/area_kzn/kzn_23/npc.c b/src/world/dead/area_kzn/kzn_23/npc.c index 597f2f6c0f3..e12e5fe5913 100644 --- a/src/world/dead/area_kzn/kzn_23/npc.c +++ b/src/world/dead/area_kzn/kzn_23/npc.c @@ -62,7 +62,7 @@ API_CALLABLE(N(AnimateChestSize)) { entity->rot.y = (1.0f - cos_rad(entity->scale.y * PI)) * 990.0 / 2.0; script->functionTemp[1]--; - if (~script->functionTemp[1] == 0) { //TODO remove ~ optimization + if (script->functionTemp[1] == -1) { return ApiStatus_DONE2; } else { return ApiStatus_BLOCK; diff --git a/src/world/partner/lakilester.c b/src/world/partner/lakilester.c index 2b3b42a63de..52e1b031a2e 100644 --- a/src/world/partner/lakilester.c +++ b/src/world/partner/lakilester.c @@ -1238,7 +1238,7 @@ API_CALLABLE(N(EnterMap)) { playerStatus->pos.z = lakilester->pos.z; playerStatus->targetYaw = lakilester->yaw; N(offset_player_from_camera)(2.0f); - script->functionTemp[1] -= 1; + script->functionTemp[1]--; if (script->functionTemp[1] == 0) { if (script->varTable[12]) { diff --git a/src/world/partners.c b/src/world/partners.c index 0128db624c1..8637eafd54b 100644 --- a/src/world/partners.c +++ b/src/world/partners.c @@ -652,7 +652,7 @@ void _use_partner_ability(void) { wPartnerCurrentScript->owner2.npc = wPartnerNpc; wPartnerCurrentScriptID = wPartnerCurrentScript->id; wPartnerCurrentScript->groupFlags = EVT_GROUP_PASSIVE_NPC; - PartnerCommandState += 1; + PartnerCommandState++; set_time_freeze_mode(TIME_FREEZE_PARTIAL); break; case 1: // free old partner and create new one @@ -665,14 +665,14 @@ void _use_partner_ability(void) { create_partner_npc(); sfx_play_sound(SOUND_PARTNER_GET_OUT); wPartner->init(wPartnerNpc); - PartnerCommandState += 1; + PartnerCommandState++; // fallthrough case 2: // take out new partner wPartnerCurrentScript = start_script(wPartner->takeOut, EVT_PRIORITY_14, EVT_FLAG_RUN_IMMEDIATELY); wPartnerCurrentScript->owner2.npc = wPartnerNpc; wPartnerCurrentScriptID = wPartnerCurrentScript->id; wPartnerCurrentScript->groupFlags = EVT_GROUP_PASSIVE_NPC; - PartnerCommandState += 1; + PartnerCommandState++; set_time_freeze_mode(TIME_FREEZE_PARTIAL); break; case 3: // resume normal partner behaviour @@ -694,7 +694,7 @@ void _use_partner_ability(void) { switch (PartnerCommandState) { case 0: kill_script_by_ID(wPartnerCurrentScriptID); - PartnerCommandState += 1; + PartnerCommandState++; case 1: partner_free_npc(); playerData->curPartner = wCurrentPartnerId = NextPartnerID; @@ -707,10 +707,10 @@ void _use_partner_ability(void) { wPartnerNpc->scale.y = 1.0f; wPartnerNpc->scale.z = 1.0f; wPartner->init(wPartnerNpc); - PartnerCommandState += 1; + PartnerCommandState++; // fallthrough case 2: - PartnerCommandState += 1; + PartnerCommandState++; break; case 3: wPartnerCurrentScript = start_script(wPartner->update, EVT_PRIORITY_14, EVT_FLAG_RUN_IMMEDIATELY); @@ -731,7 +731,7 @@ void _use_partner_ability(void) { wPartnerCurrentScript->owner2.npc = wPartnerNpc; wPartnerCurrentScriptID = wPartnerCurrentScript->id; wPartnerCurrentScript->groupFlags = EVT_GROUP_PASSIVE_NPC; - PartnerCommandState += 1; + PartnerCommandState++; break; case 1: // free old partner and resume game if (does_script_exist(wPartnerCurrentScriptID)) { @@ -760,14 +760,14 @@ void _use_partner_ability(void) { playerData->curPartner = wCurrentPartnerId = NextPartnerID; create_partner_npc(); wPartner->init(wPartnerNpc); - PartnerCommandState += 1; + PartnerCommandState++; // fallthrough case 1: // take out new partner wPartnerCurrentScript = start_script(wPartner->takeOut, EVT_PRIORITY_14, EVT_FLAG_RUN_IMMEDIATELY); wPartnerCurrentScript->owner2.npc = wPartnerNpc; wPartnerCurrentScriptID = wPartnerCurrentScript->id; wPartnerCurrentScript->groupFlags = EVT_GROUP_PASSIVE_NPC; - PartnerCommandState += 1; + PartnerCommandState++; break; case 2: // resume standard partner behaviour if (does_script_exist(wPartnerCurrentScriptID)) { @@ -797,7 +797,7 @@ void _use_partner_ability(void) { wPartnerNpc->scale.y = 1.0f; wPartnerNpc->scale.z = 1.0f; wPartner->init(wPartnerNpc); - PartnerCommandState += 1; + PartnerCommandState++; break; case 1: wPartnerCurrentScript = start_script(wPartner->update, EVT_PRIORITY_14, EVT_FLAG_RUN_IMMEDIATELY); @@ -818,7 +818,7 @@ void _use_partner_ability(void) { wPartnerCurrentScript->owner2.npc = wPartnerNpc; wPartnerCurrentScriptID = wPartnerCurrentScript->id; wPartnerCurrentScript->groupFlags = EVT_GROUP_PASSIVE_NPC; - PartnerCommandState += 1; + PartnerCommandState++; break; case 1: if (does_script_exist(wPartnerCurrentScriptID)) { @@ -838,10 +838,10 @@ void _use_partner_ability(void) { case 0: disable_player_input(); wPartner->init(wPartnerNpc); - PartnerCommandState += 1; + PartnerCommandState++; // fallthrough case 1: - PartnerCommandState += 1; + PartnerCommandState++; break; case 2: if (partnerStatus->partnerActionState != 1) { @@ -863,7 +863,7 @@ void _use_partner_ability(void) { if (does_script_exist(wPartnerCurrentScriptID)) { kill_script_by_ID(wPartnerCurrentScriptID); } - PartnerCommandState += 1; + PartnerCommandState++; } break; case PARTNER_CMD_INIT: diff --git a/src/world/script_api/shops.c b/src/world/script_api/shops.c index 5adbc19526a..80a5bbf0920 100644 --- a/src/world/script_api/shops.c +++ b/src/world/script_api/shops.c @@ -850,9 +850,9 @@ void draw_shop_items(void) { } if (i == shop->curItemSlot) { - hud_element_set_render_pos(shop->costIconID, (xTemp + xOffset) - 6, yTemp + 5); - hud_element_set_scale(shop->costIconID, 0.7f); - hud_element_draw_clipped(shop->costIconID); + hud_element_set_render_pos(shop->costHID, (xTemp + xOffset) - 6, yTemp + 5); + hud_element_set_scale(shop->costHID, 0.7f); + hud_element_draw_clipped(shop->costHID); } } } @@ -945,9 +945,9 @@ API_CALLABLE(MakeShop) { numShopItems++; } - shop->costIconID = hud_element_create(&HES_Item_Coin); - hud_element_set_flags(shop->costIconID, HUD_ELEMENT_FLAG_80); - hud_element_clear_flags(shop->costIconID, HUD_ELEMENT_FLAG_FILTER_TEX); + shop->costHID = hud_element_create(&HES_Item_Coin); + hud_element_set_flags(shop->costHID, HUD_ELEMENT_FLAG_80); + hud_element_clear_flags(shop->costHID, HUD_ELEMENT_FLAG_FILTER_TEX); get_worker(create_worker_frontUI(NULL, draw_shop_items)); set_window_properties(WINDOW_ID_ITEM_INFO_NAME, 100, 66, 120, 28, WINDOW_PRIORITY_0, shop_draw_item_name, NULL, -1); #if VERSION_JP diff --git a/tools/ignored_funcs.txt b/tools/ignored_funcs.txt index 7cb6a7e0522..dfc5a115c69 100644 --- a/tools/ignored_funcs.txt +++ b/tools/ignored_funcs.txt @@ -48,7 +48,7 @@ func_8004D8E0 = 0x8004D8E0; dead_LoadPath = 0x802E2A80; dead_GetNextPathPos = 0x802E2B74; dead_queue_render_task = 0x80128510; -dead_create_worker_world = 0x8012DFE8; +dead_create_worker_scene = 0x8012DFE8; dead_GetEntryID = 0x802D790C; dead_SetMusicTrack = 0x802E339C; dead_FadeInMusic = 0x802E3444; diff --git a/ver/ique/splat.yaml b/ver/ique/splat.yaml index fe4d005ca51..4da9c848ebf 100644 --- a/ver/ique/splat.yaml +++ b/ver/ique/splat.yaml @@ -101,7 +101,7 @@ segments: - [auto, c, world/world] - [auto, c, collision] - [auto, c, 38F00] - - [auto, c, 39210_len_aa0] + - [auto, c, npc_follow] - [auto, c, os/nusys/nuboot] - [auto, c, os/nusys/nusched] - [auto, c, os/nusys/nugfxfuncset] @@ -349,8 +349,8 @@ segments: - [auto, c, world/actions] - [auto, c, world/partners] - [auto, c, global_hud_scripts] - - [auto, c, 891b0_len_fb0] - - [auto, c, 8a160_len_700] + - [auto, c, surfaces] + - [auto, c, status_star_shimmer] - [auto, c, 8a860_len_3f30] - [auto, c, draw_box] - [auto, c, bss/engine1_post_bss] @@ -376,8 +376,8 @@ segments: - [auto, palette, ui/input/analog_stick_down] - [auto, ci4, ui/input/analog_stick_up, 32, 32] - [auto, palette, ui/input/analog_stick_up] - - [auto, ci4, ui/unk_bar, 72, 16] - - [auto, palette, ui/unk_bar] + - [auto, ci4, ui/input/mash_bar, 72, 16] + - [auto, palette, ui/input/mash_bar] - [auto, ci4, ui/ok, 24, 16] - [auto, palette, ui/ok] - [auto, ci4, ui/input/start_button, 48, 40] @@ -739,9 +739,9 @@ segments: - [0x9CA20] - start: 0xA1520 type: .data - name: 8a160_len_700 + name: status_star_shimmer subsegments: - - [0xA1520, ia8, A2960, 32, 16] + - [0xA1520, ia8, ui/status/shimmer_particle, 32, 16] - [0xA1720] # Vp - [0xA1730, vtx, A2B70] - [0xA1780, gfx, A2BC0] @@ -5695,9 +5695,9 @@ segments: start: 0x46E5A0 vram: 0x802A9000 dir: battle/action_cmd - name: action_cmd_07 + name: action_cmd_unused_flee subsegments: - - [auto, c, "07"] + - [auto, c, unused_flee] - type: code start: 0x46EBC0 vram: 0x802A9000 @@ -5716,9 +5716,9 @@ segments: start: 0x46FE00 vram: 0x802A9000 dir: battle/action_cmd - name: action_cmd_0A + name: action_cmd_unused_mash_a subsegments: - - [auto, c, 0A] + - [auto, c, unused_mash_a] - type: code start: 0x4704C0 vram: 0x802A9000 @@ -5758,29 +5758,29 @@ segments: start: 0x472F40 vram: 0x802A9000 dir: battle/action_cmd - name: action_cmd_water_block + name: action_cmd_three_chances subsegments: - - [auto, c, water_block] + - [auto, c, three_chances] - start: 0x4740A0 type: .data - name: water_block - subsegments: - - [0x4740A0, ci4, water_block_1, 24, 24] - - [0x4741C0, palette, water_block_1] - - [0x4741E0, ci4, water_block_2, 24, 24] - - [0x474300, palette, water_block_2] - - [0x474320, ci4, water_block_3, 24, 24] - - [0x474440, palette, water_block_3] - - [0x474460, ci4, water_block_0, 24, 24] - - [0x474580, palette, water_block_0] - - [0x4745A0, ci4, water_block_block, 32, 32] - - [0x4747A0, palette, water_block_block] - - [0x4747C0, ci4, water_block_circle, 40, 40] - - [0x474AE0, palette, water_block_circle] - - [0x474B00, ci4, water_block_cloud, 40, 40] - - [0x474E20, palette, water_block_cloud] - - [0x474E40, ci4, water_block_4, 24, 24] - - [0x474F60, palette, water_block_4] + name: three_chances + subsegments: + - [0x4740A0, ci4, three_chances_1, 24, 24] + - [0x4741C0, palette, three_chances_1] + - [0x4741E0, ci4, three_chances_2, 24, 24] + - [0x474300, palette, three_chances_2] + - [0x474320, ci4, three_chances_3, 24, 24] + - [0x474440, palette, three_chances_3] + - [0x474460, ci4, three_chances_0, 24, 24] + - [0x474580, palette, three_chances_0] + - [0x4745A0, ci4, three_chances_block, 32, 32] + - [0x4747A0, palette, three_chances_block] + - [0x4747C0, ci4, three_chances_circle, 40, 40] + - [0x474AE0, palette, three_chances_circle] + - [0x474B00, ci4, three_chances_cloud, 40, 40] + - [0x474E20, palette, three_chances_cloud] + - [0x474E40, ci4, three_chances_4, 24, 24] + - [0x474F60, palette, three_chances_4] - [0x474F80] - [0x475140] - type: code diff --git a/ver/ique/symbol_addrs.txt b/ver/ique/symbol_addrs.txt index add3e95f43e..942d0ef2bc2 100644 --- a/ver/ique/symbol_addrs.txt +++ b/ver/ique/symbol_addrs.txt @@ -471,7 +471,7 @@ filemenu_draw_file_name = 0x80249e7c; // segment:filemenu filemenu_draw_message = 0x80249d08; // segment:filemenu filemenu_draw_char = 0x802493a0; // segment:filemenu filemenu_get_menu_message = 0x80249e68; // segment:filemenu -filemenu_hudElemIDs = 0x8024c470; // segment:filemenu +filemenu_mainHIDs = 0x8024c470; // segment:filemenu filemenu_menus = 0x80249f64; // segment:filemenu filemenu_specialSymbols = 0x8024bb30; // segment:filemenu filemenu_draw_rect = 0x80242ba0; // segment:filemenu @@ -686,8 +686,8 @@ ui_input_analog_stick_down_png = 0x800f7c40; // rom:0x918d0 ui_input_analog_stick_down_pal = 0x800f7e40; // rom:0x91ad0 ui_input_analog_stick_up_png = 0x800f7e60; // rom:0x91af0 ui_input_analog_stick_up_pal = 0x800f8060; // rom:0x91cf0 -ui_unk_bar_png = 0x800f8080; // rom:0x91d10 -ui_unk_bar_pal = 0x800f82c0; // rom:0x91f50 +ui_input_mash_bar_png = 0x800f8080; // rom:0x91d10 +ui_input_mash_bar_pal = 0x800f82c0; // rom:0x91f50 ui_ok_png = 0x800f82e0; // rom:0x91f70 ui_ok_pal = 0x800f83a0; // rom:0x92030 ui_input_start_button_png = 0x800f83c0; // rom:0x92050 @@ -1044,7 +1044,7 @@ ui_move_partner_3_pal = 0x80102540; // rom:0x9c1d0 ui_move_partner_3_disabled_pal = 0x80102560; // rom:0x9c1f0 ui_stat_heart_png = 0x80102588; // rom:0x9c218 ui_stat_flower_png = 0x80102990; // rom:0x9c620 -D_801094B0 = 0x80107890; // rom:0xa1520 +ui_status_shimmer_particle_png = 0x80107890; // rom:0xa1520 D_801096C0 = 0x80107aa0; // rom:0xa1730 D_80109710 = 0x80107af0; // rom:0xa1780 D_801097D8 = 0x80107bb8; // rom:0xa1848 @@ -2046,22 +2046,22 @@ monstar_bubbles = 0x80223680; // rom:0x6912B0 D_8021C940_5A3020 = 0x8021C940; // rom:0x5EBA70 D_8021CD40_5A3420 = 0x8021CD40; // rom:0x5EBE70 D_8021CF40_5A3620 = 0x8021CF40; // rom:0x5EC070 -battle_action_cmd_water_block_1_png = 0x802AA160; // rom:0x4740A0 -battle_action_cmd_water_block_1_pal = 0x802AA280; // rom:0x4741C0 -battle_action_cmd_water_block_2_png = 0x802AA2A0; // rom:0x4741E0 -battle_action_cmd_water_block_2_pal = 0x802AA3C0; // rom:0x474300 -battle_action_cmd_water_block_3_png = 0x802AA3E0; // rom:0x474320 -battle_action_cmd_water_block_3_pal = 0x802AA500; // rom:0x474440 -battle_action_cmd_water_block_0_png = 0x802AA520; // rom:0x474460 -battle_action_cmd_water_block_0_pal = 0x802AA640; // rom:0x474580 -battle_action_cmd_water_block_block_png = 0x802AA660; // rom:0x4745A0 -battle_action_cmd_water_block_block_pal = 0x802AA860; // rom:0x4747A0 -battle_action_cmd_water_block_circle_png = 0x802AA880; // rom:0x4747C0 -battle_action_cmd_water_block_circle_pal = 0x802AABA0; // rom:0x474AE0 -battle_action_cmd_water_block_cloud_png = 0x802AABC0; // rom:0x474B00 -battle_action_cmd_water_block_cloud_pal = 0x802AAEE0; // rom:0x474E20 -battle_action_cmd_water_block_4_png = 0x802AAF00; // rom:0x474E40 -battle_action_cmd_water_block_4_pal = 0x802AB020; // rom:0x474F60 +battle_action_cmd_three_chances_1_png = 0x802AA160; // rom:0x4740A0 +battle_action_cmd_three_chances_1_pal = 0x802AA280; // rom:0x4741C0 +battle_action_cmd_three_chances_2_png = 0x802AA2A0; // rom:0x4741E0 +battle_action_cmd_three_chances_2_pal = 0x802AA3C0; // rom:0x474300 +battle_action_cmd_three_chances_3_png = 0x802AA3E0; // rom:0x474320 +battle_action_cmd_three_chances_3_pal = 0x802AA500; // rom:0x474440 +battle_action_cmd_three_chances_0_png = 0x802AA520; // rom:0x474460 +battle_action_cmd_three_chances_0_pal = 0x802AA640; // rom:0x474580 +battle_action_cmd_three_chances_block_png = 0x802AA660; // rom:0x4745A0 +battle_action_cmd_three_chances_block_pal = 0x802AA860; // rom:0x4747A0 +battle_action_cmd_three_chances_circle_png = 0x802AA880; // rom:0x4747C0 +battle_action_cmd_three_chances_circle_pal = 0x802AABA0; // rom:0x474AE0 +battle_action_cmd_three_chances_cloud_png = 0x802AABC0; // rom:0x474B00 +battle_action_cmd_three_chances_cloud_pal = 0x802AAEE0; // rom:0x474E20 +battle_action_cmd_three_chances_4_png = 0x802AAF00; // rom:0x474E40 +battle_action_cmd_three_chances_4_pal = 0x802AB020; // rom:0x474F60 battle_action_cmd_whirlwind_1_png = 0x802A98E0; // rom:0x46CFA0 battle_action_cmd_whirlwind_1_pal = 0x802A9A00; // rom:0x46D0C0 battle_action_cmd_whirlwind_2_png = 0x802A9A20; // rom:0x46D0E0 @@ -3680,20 +3680,20 @@ btl_update_ko_status = 0x8026773C; CheckButtonPress = 0x8026E058; CheckButtonDown = 0x8026E0C8; EnablePlayerBlur = 0x80274938; -CloseActionCommandInfo = 0x802693D0; +InterruptActionCommand = 0x802693D0; EnableBattleStatusBar = 0x80253574; PlayerBasicJumpToGoal = 0x802749D8; func_802693F0 = 0x802693B0; PlayerSuperJumpToGoal = 0x8027526C; PlayerUltraJumpToGoal = 0x80275EC0; GetActionCommandMode = 0x802692D8; -GetActionQuality = 0x80269568; -GetActionResult = 0x802694E4; -GetActionSuccess = 0x80269254; -GetActionSuccessCopy = 0x802694B8; +GetActionProgress = 0x80269568; +GetJumpActionQuality = 0x802694E4; +GetSmashActionQuality = 0x80269254; +GetMashActionQuality = 0x802694B8; GetCommandAutoSuccess = 0x80269330; GetMenuSelection = 0x80273384; -GetPlayerActionSuccess = 0x80276E74; +GetPlayerActionQuality = 0x80276E74; GetTargetListLength = 0x8026E824; IsMessageBoxDisplayed = 0x8025134C; LoadActionCommand = 0x80268180; @@ -3703,7 +3703,7 @@ PlayerPowerBounceEnemy = 0x80274460; PlayerTestEnemy = 0x802746B0; SetActionCommandMode = 0x802692AC; SetActionDifficultyTable = 0x8026915C; -SetActionQuality = 0x80269594; +SetActionProgress = 0x80269594; SetActionResult = 0x80269510; SetActorDispOffset = 0x8026B9C4; SetActorRotation = 0x8026C36C; @@ -3764,9 +3764,9 @@ EVS_Partner_SpikeContact = 0x80294FA4; FallToGoal = 0x80279BAC; FlyToGoal = 0x8027B5E4; DisableBattleCamClampX = 0x8024EDA4; -func_80269118 = 0x802690D8; -func_80269160 = 0x80269120; -func_80269600 = 0x802695C0; +increment_action_command_attempt_count = 0x802690D8; +increment_action_command_success_count = 0x80269120; +GetActionResultTier = 0x802695C0; gActionCommandStatus = 0x8029FBA0; GetActorFlags = 0x8026CEE0; GetActorLevel = 0x8027FD08; @@ -3774,7 +3774,7 @@ GetActorScale = 0x8026CA44; GetBattlePhase = 0x80269DE8; GetDistanceToGoal = 0x8026E9BC; GetLastEvent = 0x8027C4A0; -GetPartnerActionSuccess = 0x80280790; +GetPartnerActionQuality = 0x80280790; GetStatusFlags = 0x8026F1F0; HES_AimBlinkA = 0x802936CC; HES_AimMarkerA = 0x80292CDC; @@ -3918,7 +3918,7 @@ GetInstigatorValue = 0x8027D71C; SetPartRotation = 0x8026C5F4; EVS_Enemy_ShockHit_Impl = 0x8029A72C; EnableBattleFloorReflections = 0x80253668; -func_80269470 = 0x80269430; +InterruptLeechActionCommand = 0x80269430; GetActorYaw = 0x8026B388; lookup_defense = 0x80265E04; GetPlayerHP = 0x802741F4; @@ -4090,7 +4090,7 @@ battle_item_repel_gel_EVS_UseItem = 0x802A185C; battle_item_dizzy_dial_EatItem = 0x802A189C; battle_item_fright_jar_EVS_UseItem = 0x802A191C; battle_item_pow_block_EVS_UseItem = 0x802A195C; -battle_move_shell_crack_EVS_Hammer_ReturnHome_A = 0x802A198C; +battle_move_shell_crack_EVS_HammerSupport_ReturnHome_SmashSuccess = 0x802A198C; battle_item_fire_flower_EVS_UseItem = 0x802A19BC; battle_item_super_soda_EatItem = 0x802A19FC; battle_item_thunder_bolt_EVS_UseItem = 0x802A1A5C; @@ -4312,7 +4312,7 @@ free_entity_model_by_index = 0x801211DC; set_entity_model_flags = 0x801212C8; clear_entity_model_flags = 0x80121304; bind_entity_model_setupGfx = 0x80121344; -create_worker_world = 0x80121538; +create_worker_scene = 0x80121538; set_message_text_var = 0x80123EA8; close_message = 0x80123FDC; get_msg_lines = 0x80124860; @@ -4356,14 +4356,14 @@ action_command_break_free_update = 0x802A92DC; action_command_whirlwind_update = 0x802A92F0; action_command_power_shock_update = 0x802A9310; action_command_flee_update = 0x802A9378; -action_command_water_block_update = 0x802A948C; -action_command_07_draw = 0x802A94D8; +action_command_three_chances_update = 0x802A948C; +action_command_unused_flee_draw = 0x802A94D8; action_command_stop_leech_free = 0x802A9544; -action_command_0A_draw = 0x802A955C; +action_command_unused_mash_a_draw = 0x802A955C; action_command_jump_free = 0x802A9590; -action_command_07_free = 0x802A959C; +action_command_unused_flee_free = 0x802A959C; action_command_squirt_draw = 0x802A9634; -action_command_0A_free = 0x802A963C; +action_command_unused_mash_a_free = 0x802A963C; action_command_body_slam_draw = 0x802A9664; action_command_break_free_draw = 0x802A96B8; action_command_dizzy_shell_draw = 0x802A96DC; @@ -4393,10 +4393,10 @@ action_command_hammer_free = 0x802A9A30; action_command_power_shock_free = 0x802A9A54; btl_state_draw_partner_menu = 0x802A9AE8; btl_state_update_peach_menu = 0x802A9B44; -action_command_water_block_draw = 0x802AA014; +action_command_three_chances_draw = 0x802AA014; btl_state_draw_peach_menu = 0x802AA05C; btl_state_update_twink_menu = 0x802AA0B8; -action_command_water_block_free = 0x802AA0D8; +action_command_three_chances_free = 0x802AA0D8; btl_state_update_select_target = 0x802AA688; btl_state_draw_select_target = 0x802AACD8; btl_state_update_22 = 0x802AB330; diff --git a/ver/jp/splat.yaml b/ver/jp/splat.yaml index f679960dc3a..ccae1df2f14 100644 --- a/ver/jp/splat.yaml +++ b/ver/jp/splat.yaml @@ -108,7 +108,7 @@ segments: - [auto, c, world/world] - [auto, c, collision] - [auto, c, 38F00] - - [auto, c, 39210_len_aa0] + - [auto, c, npc_follow] - [auto, c, os/nusys/nuboot] - [auto, c, os/nusys/nusched] @@ -354,8 +354,8 @@ segments: - [auto, c, world/actions] # DUMMY ROM - [auto, c, world/partners] - [auto, c, global_hud_scripts] - - [auto, c, 891b0_len_fb0] - - [auto, c, 8a160_len_700] + - [auto, c, surfaces] + - [auto, c, status_star_shimmer] - [auto, c, 8a860_len_3f30] - [auto, c, draw_box] - [auto, c, bss/engine1_post_bss] @@ -381,8 +381,8 @@ segments: - [auto, palette, ui/input/analog_stick_down] - [auto, ci4, ui/input/analog_stick_up, 32, 32] - [auto, palette, ui/input/analog_stick_up] - - [auto, ci4, ui/unk_bar, 72, 16] - - [auto, palette, ui/unk_bar] + - [auto, ci4, ui/input/mash_bar, 72, 16] + - [auto, palette, ui/input/mash_bar] - [auto, ci4, ui/ok, 24, 16] - [auto, palette, ui/ok] - [auto, ci4, ui/input/start_button, 48, 40] @@ -744,9 +744,9 @@ segments: - [0x9DFF0] - start: 0xA2AF0 type: .data - name: 8a160_len_700 + name: status_star_shimmer subsegments: - - [0xA2AF0, ia8, A2960, 32, 16] + - [0xA2AF0, ia8, ui/status/shimmer_particle, 32, 16] - [0xA2CF0] # Vp - [0xA2D00, vtx, A2B70] - [0xA2D50, gfx, A2BC0] @@ -5612,9 +5612,9 @@ segments: start: 0x42D490 vram: 0x802A9000 dir: battle/action_cmd - name: action_cmd_07 + name: action_cmd_unused_flee subsegments: - - [auto, c, "07"] + - [auto, c, unused_flee] - type: code start: 0x42DAB0 vram: 0x802A9000 @@ -5633,9 +5633,9 @@ segments: start: 0x42ECF0 vram: 0x802A9000 dir: battle/action_cmd - name: action_cmd_0A + name: action_cmd_unused_mash_a subsegments: - - [auto, c, 0A] + - [auto, c, unused_mash_a] - type: code start: 0x42F3B0 vram: 0x802A9000 @@ -5675,29 +5675,29 @@ segments: start: 0x431E30 vram: 0x802A9000 dir: battle/action_cmd - name: action_cmd_water_block + name: action_cmd_three_chances subsegments: - - [auto, c, water_block] + - [auto, c, three_chances] - start: 0x432F90 type: .data - name: water_block - subsegments: - - [0x432F90, ci4, water_block_1, 24, 24] - - [0x4330B0, palette, water_block_1] - - [0x4330D0, ci4, water_block_2, 24, 24] - - [0x4331F0, palette, water_block_2] - - [0x433210, ci4, water_block_3, 24, 24] - - [0x433330, palette, water_block_3] - - [0x433350, ci4, water_block_0, 24, 24] - - [0x433470, palette, water_block_0] - - [0x433490, ci4, water_block_block, 32, 32] - - [0x433690, palette, water_block_block] - - [0x4336B0, ci4, water_block_circle, 40, 40] - - [0x4339D0, palette, water_block_circle] - - [0x4339F0, ci4, water_block_cloud, 40, 40] - - [0x433D10, palette, water_block_cloud] - - [0x433D30, ci4, water_block_4, 24, 24] - - [0x433E50, palette, water_block_4] + name: three_chances + subsegments: + - [0x432F90, ci4, three_chances_1, 24, 24] + - [0x4330B0, palette, three_chances_1] + - [0x4330D0, ci4, three_chances_2, 24, 24] + - [0x4331F0, palette, three_chances_2] + - [0x433210, ci4, three_chances_3, 24, 24] + - [0x433330, palette, three_chances_3] + - [0x433350, ci4, three_chances_0, 24, 24] + - [0x433470, palette, three_chances_0] + - [0x433490, ci4, three_chances_block, 32, 32] + - [0x433690, palette, three_chances_block] + - [0x4336B0, ci4, three_chances_circle, 40, 40] + - [0x4339D0, palette, three_chances_circle] + - [0x4339F0, ci4, three_chances_cloud, 40, 40] + - [0x433D10, palette, three_chances_cloud] + - [0x433D30, ci4, three_chances_4, 24, 24] + - [0x433E50, palette, three_chances_4] - [0x433E70] - [0x434030] - type: code diff --git a/ver/jp/symbol_addrs.txt b/ver/jp/symbol_addrs.txt index 393da6c28be..c5de16f8d35 100644 --- a/ver/jp/symbol_addrs.txt +++ b/ver/jp/symbol_addrs.txt @@ -58,7 +58,7 @@ npc_get_render_yaw = 0x80039A64; // type:func rom:0x14E64 render_npcs = 0x8003A4B0; init_encounter_status = 0x8003DFF8; clear_effect_data = 0x8005994C; -render_effects_world = 0x80059BA4; +render_effects_scene = 0x80059BA4; render_effects_UI = 0x80059C44; nuBoot = 0x8005E560; nuGfxFuncSet = 0x8005EF00; @@ -275,7 +275,7 @@ clear_animator_list = 0x80123434; clear_entity_models = 0x80125DC0; clear_worker_list = 0x801282C8; update_workers = 0x80128614; -render_workers_world = 0x80128680; +render_workers_scene = 0x80128680; render_workers_frontUI = 0x801286F0; render_workers_backUI = 0x80128760; clear_character_set = 0x80128870; @@ -342,8 +342,8 @@ ui_input_analog_stick_down_png = 0x800F99F0; // rom:0x92EA0 ui_input_analog_stick_down_pal = 0x800F9BF0; // rom:0x930A0 ui_input_analog_stick_up_png = 0x800F9C10; // rom:0x930C0 ui_input_analog_stick_up_pal = 0x800F9E10; // rom:0x932C0 -ui_unk_bar_png = 0x800F9E30; // rom:0x932E0 -ui_unk_bar_pal = 0x800FA070; // rom:0x93520 +ui_input_mash_bar_png = 0x800F9E30; // rom:0x932E0 +ui_input_mash_bar_pal = 0x800FA070; // rom:0x93520 ui_ok_png = 0x800FA090; // rom:0x93540 ui_ok_pal = 0x800FA150; // rom:0x93600 ui_input_start_button_png = 0x800FA170; // rom:0x93620 @@ -700,7 +700,7 @@ ui_move_partner_3_pal = 0x801042F0; // rom:0x9D7A0 ui_move_partner_3_disabled_pal = 0x80104310; // rom:0x9D7C0 ui_stat_heart_png = 0x80104338; // rom:0x9D7E8 ui_stat_flower_png = 0x80104740; // rom:0x9DBF0 -D_801094B0 = 0x80109640; // rom:0xA2AF0 +ui_status_shimmer_particle_png = 0x80109640; // rom:0xA2AF0 D_801096C0 = 0x80109850; // rom:0xA2D00 D_80109710 = 0x801098A0; // rom:0xA2D50 D_801097D8 = 0x80109968; // rom:0xA2E18 @@ -720,21 +720,21 @@ PopupMenu_WasStatusBarIgnoringChanges = 0x8010D85A; draw_number = 0x8012C8B0; // type:func rom:0xC1740 PopupNotDipping = 0x8010D858; create_worker_frontUI = 0x8012844C; // type:func rom:0xBD2DC -PopupMenu_TimesHEID = 0x8010D824; +PopupMenu_TimesHID = 0x8010D824; get_msg_width = 0x8012B6D4; // type:func rom:0xC0564 hud_element_create = 0x80146554; // type:func rom:0xDB3E4 HES_GreenArrowDown = 0x80107928; // rom:0xA0DD8 -PopupMenu_DownArrowHEID = 0x8010D834; +PopupMenu_DownArrowHID = 0x8010D834; PopupMenu_Alpha = 0x8010D810; -PopupMenu_CursorHEID = 0x8010D82C; +PopupMenu_CursorHID = 0x8010D82C; PopupNotBattle = 0x8010D84E; D_8010D684 = 0x8010D844; PopupMenu_LastDisplayIndex = 0x8010D815; -PopupMenu_PartnerLevelHEID = 0x8010D828; +PopupMenu_PartnerLevelHID = 0x8010D828; PopupMenu_FirstDisplayIndex = 0x8010D814; D_8010D6A0 = 0x8010D860; D_80109898 = 0x80109A28; // rom:0xA2ED8 -PopupMenu_EmptybarHEID = 0x8010D81C; +PopupMenu_EmptybarHID = 0x8010D81C; D_8010D682 = 0x8010D842; HES_MenuTimes = 0x80109400; // rom:0xA28B0 set_window_properties = 0x8014CD78; // type:func rom:0xE1C08 @@ -742,7 +742,7 @@ HES_GreenArrowUp = 0x80107974; // rom:0xA0E24 hud_element_set_tint = 0x80149FAC; // type:func rom:0xDEE3C D_8010D644 = 0x8010D804; hud_element_free = 0x801499A4; // type:func rom:0xDE834 -PopupMenu_TitleIconHEID = 0x8010D820; +PopupMenu_TitleIconHID = 0x8010D820; HES_StatusStarPiece = 0x80104DA0; // rom:0x9E250 D_8010D692 = 0x8010D852; sfx_play_sound = 0x8014ED64; // type:func rom:0xE3BF4 @@ -751,7 +751,7 @@ D_80109890 = 0x80109A20; // rom:0xA2ED0 D_8010D686 = 0x8010D846; hud_element_set_script = 0x801498AC; // type:func rom:0xDE73C draw_msg = 0x8012B710; // type:func rom:0xC05A0 -PopupMenu_UpArrowHEID = 0x8010D830; +PopupMenu_UpArrowHID = 0x8010D830; PopupMenu_StarPieceCounterPosX = 0x8010D848; PopupMenu_SelectedIndex = 0x8010D808; PopupDipMode = 0x8010D859; @@ -759,7 +759,7 @@ D_8010D67C = 0x8010D83C; PopupMenu_MaxDisplayableEntryCount = 0x8010D84F; D_8010D690 = 0x8010D850; PopupMenu_DisplayedEntryCount = 0x8010D816; -PopupMenu_EntryIconHEID = 0x8010D838; +PopupMenu_EntryIconHID = 0x8010D838; open_status_bar_quickly = 0x800E972C; // type:func rom:0x82BDC HES_StatusCoin = 0x801086E8; // rom:0xA1B98 hud_element_draw_clipped = 0x80149858; // type:func rom:0xDE6E8 @@ -960,7 +960,7 @@ fx_effect_63 = 0x80071D90; // type:func rom:0x4D190 add_star_pieces = 0x800EA110; // type:func rom:0x835C0 npc_set_imgfx_params = 0x8003D2E4; // type:func rom:0x186E4 fx_moving_cloud = 0x800723F0; // type:func rom:0x4D7F0 -create_worker_world = 0x80128368; // type:func rom:0xBD1F8 +create_worker_scene = 0x80128368; // type:func rom:0xBD1F8 fx_bulb_glow = 0x80070EF0; // type:func rom:0x4C2F0 fx_blast = 0x80070FB0; // type:func rom:0x4C3B0 bgm_poll_music_events = 0x80055D3C; // type:func rom:0x3113C @@ -2861,7 +2861,7 @@ gCurrentItemEntities = 0x8015B520; isPickingUpItem = 0x8015B524; ItemSpawnWithinPlayerPickupDelay = 0x8015B526; ItemPickupMenu = 0x8015B528; -ItemPickupIconID = 0x8015B858; +ItemPickupIconHID = 0x8015B858; ItemPickupStateDelay = 0x8015B85C; ThrowAwayMenuIdx = 0x8015B860; ThrowAwayItemID = 0x8015B864; diff --git a/ver/pal/asm/nonmatchings/8a860_len_3f30/popup_menu_update.s b/ver/pal/asm/nonmatchings/8a860_len_3f30/popup_menu_update.s index 3b7b388c024..3eae3cd53cf 100755 --- a/ver/pal/asm/nonmatchings/8a860_len_3f30/popup_menu_update.s +++ b/ver/pal/asm/nonmatchings/8a860_len_3f30/popup_menu_update.s @@ -318,8 +318,8 @@ glabel popup_menu_update /* 8748C 800EE37C 00000000 */ nop /* 87490 800EE380 0040802D */ daddu $s0, $v0, $zero /* 87494 800EE384 0200202D */ daddu $a0, $s0, $zero -/* 87498 800EE388 3C018011 */ lui $at, %hi(PopupMenu_EmptybarHEID) -/* 8749C 800EE38C AC30C15C */ sw $s0, %lo(PopupMenu_EmptybarHEID)($at) +/* 87498 800EE388 3C018011 */ lui $at, %hi(PopupMenu_EmptybarHID) +/* 8749C 800EE38C AC30C15C */ sw $s0, %lo(PopupMenu_EmptybarHID)($at) /* 874A0 800EE390 0C050D6C */ jal hud_element_set_flags /* 874A4 800EE394 24050080 */ addiu $a1, $zero, 0x80 /* 874A8 800EE398 0200202D */ daddu $a0, $s0, $zero @@ -345,8 +345,8 @@ glabel popup_menu_update /* 874F4 800EE3E4 0040802D */ daddu $s0, $v0, $zero /* 874F8 800EE3E8 3C053EE6 */ lui $a1, (0x3EE66666 >> 16) /* 874FC 800EE3EC 34A56666 */ ori $a1, $a1, (0x3EE66666 & 0xFFFF) -/* 87500 800EE3F0 3C018011 */ lui $at, %hi(PopupMenu_EntryIconHEID) -/* 87504 800EE3F4 AC30C178 */ sw $s0, %lo(PopupMenu_EntryIconHEID)($at) +/* 87500 800EE3F0 3C018011 */ lui $at, %hi(PopupMenu_EntryIconHID) +/* 87504 800EE3F4 AC30C178 */ sw $s0, %lo(PopupMenu_EntryIconHID)($at) /* 87508 800EE3F8 0C050DF4 */ jal hud_element_set_scale /* 8750C 800EE3FC 0200202D */ daddu $a0, $s0, $zero /* 87510 800EE400 0200202D */ daddu $a0, $s0, $zero @@ -359,8 +359,8 @@ glabel popup_menu_update /* 8752C 800EE41C 0040802D */ daddu $s0, $v0, $zero /* 87530 800EE420 0200202D */ daddu $a0, $s0, $zero /* 87534 800EE424 3C052000 */ lui $a1, (0x20000080 >> 16) -/* 87538 800EE428 3C018011 */ lui $at, %hi(PopupMenu_CursorHEID) -/* 8753C 800EE42C AC24C16C */ sw $a0, %lo(PopupMenu_CursorHEID)($at) +/* 87538 800EE428 3C018011 */ lui $at, %hi(PopupMenu_CursorHID) +/* 8753C 800EE42C AC24C16C */ sw $a0, %lo(PopupMenu_CursorHID)($at) /* 87540 800EE430 0C050D6C */ jal hud_element_set_flags /* 87544 800EE434 34A50080 */ ori $a1, $a1, (0x20000080 & 0xFFFF) /* 87548 800EE438 3C048010 */ lui $a0, %hi(HES_GreenArrowUp) @@ -370,8 +370,8 @@ glabel popup_menu_update /* 87558 800EE448 0040802D */ daddu $s0, $v0, $zero /* 8755C 800EE44C 0200202D */ daddu $a0, $s0, $zero /* 87560 800EE450 3C052000 */ lui $a1, (0x20000080 >> 16) -/* 87564 800EE454 3C018011 */ lui $at, %hi(PopupMenu_UpArrowHEID) -/* 87568 800EE458 AC24C170 */ sw $a0, %lo(PopupMenu_UpArrowHEID)($at) +/* 87564 800EE454 3C018011 */ lui $at, %hi(PopupMenu_UpArrowHID) +/* 87568 800EE458 AC24C170 */ sw $a0, %lo(PopupMenu_UpArrowHID)($at) /* 8756C 800EE45C 0C050D6C */ jal hud_element_set_flags /* 87570 800EE460 34A50080 */ ori $a1, $a1, (0x20000080 & 0xFFFF) /* 87574 800EE464 3C048010 */ lui $a0, %hi(HES_GreenArrowDown) @@ -381,8 +381,8 @@ glabel popup_menu_update /* 87584 800EE474 0040802D */ daddu $s0, $v0, $zero /* 87588 800EE478 0200202D */ daddu $a0, $s0, $zero /* 8758C 800EE47C 3C052000 */ lui $a1, (0x20000080 >> 16) -/* 87590 800EE480 3C018011 */ lui $at, %hi(PopupMenu_DownArrowHEID) -/* 87594 800EE484 AC24C174 */ sw $a0, %lo(PopupMenu_DownArrowHEID)($at) +/* 87590 800EE480 3C018011 */ lui $at, %hi(PopupMenu_DownArrowHID) +/* 87594 800EE484 AC24C174 */ sw $a0, %lo(PopupMenu_DownArrowHID)($at) /* 87598 800EE488 0C050D6C */ jal hud_element_set_flags /* 8759C 800EE48C 34A50080 */ ori $a1, $a1, (0x20000080 & 0xFFFF) /* 875A0 800EE490 8E220000 */ lw $v0, 0x0($s1) @@ -394,8 +394,8 @@ glabel popup_menu_update /* 875B8 800EE4A8 24842F00 */ addiu $a0, $a0, %lo(HES_StatusStarPiece) /* 875BC 800EE4AC 0C050015 */ jal hud_element_create /* 875C0 800EE4B0 00000000 */ nop -/* 875C4 800EE4B4 3C018011 */ lui $at, %hi(PopupMenu_TitleIconHEID) -/* 875C8 800EE4B8 AC22C160 */ sw $v0, %lo(PopupMenu_TitleIconHEID)($at) +/* 875C4 800EE4B4 3C018011 */ lui $at, %hi(PopupMenu_TitleIconHID) +/* 875C8 800EE4B8 AC22C160 */ sw $v0, %lo(PopupMenu_TitleIconHID)($at) /* 875CC 800EE4BC 0040802D */ daddu $s0, $v0, $zero /* 875D0 800EE4C0 0040202D */ daddu $a0, $v0, $zero /* 875D4 800EE4C4 0C050D6C */ jal hud_element_set_flags @@ -415,8 +415,8 @@ glabel popup_menu_update /* 87608 800EE4F8 24842F00 */ addiu $a0, $a0, %lo(HES_StatusStarPiece) /* 8760C 800EE4FC 0C050015 */ jal hud_element_create /* 87610 800EE500 00000000 */ nop -/* 87614 800EE504 3C018011 */ lui $at, %hi(PopupMenu_TitleIconHEID) -/* 87618 800EE508 AC22C160 */ sw $v0, %lo(PopupMenu_TitleIconHEID)($at) +/* 87614 800EE504 3C018011 */ lui $at, %hi(PopupMenu_TitleIconHID) +/* 87618 800EE508 AC22C160 */ sw $v0, %lo(PopupMenu_TitleIconHID)($at) /* 8761C 800EE50C 0040802D */ daddu $s0, $v0, $zero /* 87620 800EE510 0040202D */ daddu $a0, $v0, $zero /* 87624 800EE514 0C050D6C */ jal hud_element_set_flags @@ -436,8 +436,8 @@ glabel popup_menu_update /* 87658 800EE548 24846D58 */ addiu $a0, $a0, %lo(HES_StatusCoin) /* 8765C 800EE54C 0C050015 */ jal hud_element_create /* 87660 800EE550 00000000 */ nop -/* 87664 800EE554 3C018011 */ lui $at, %hi(PopupMenu_TitleIconHEID) -/* 87668 800EE558 AC22C160 */ sw $v0, %lo(PopupMenu_TitleIconHEID)($at) +/* 87664 800EE554 3C018011 */ lui $at, %hi(PopupMenu_TitleIconHID) +/* 87668 800EE558 AC22C160 */ sw $v0, %lo(PopupMenu_TitleIconHID)($at) /* 8766C 800EE55C 0040802D */ daddu $s0, $v0, $zero /* 87670 800EE560 0040202D */ daddu $a0, $v0, $zero /* 87674 800EE564 0C050D6C */ jal hud_element_set_flags @@ -458,8 +458,8 @@ glabel popup_menu_update /* 876AC 800EE59C 24847E18 */ addiu $a0, $a0, %lo(HES_MenuTimes) /* 876B0 800EE5A0 0C050015 */ jal hud_element_create /* 876B4 800EE5A4 00000000 */ nop -/* 876B8 800EE5A8 3C018011 */ lui $at, %hi(PopupMenu_TimesHEID) -/* 876BC 800EE5AC AC22C164 */ sw $v0, %lo(PopupMenu_TimesHEID)($at) +/* 876B8 800EE5A8 3C018011 */ lui $at, %hi(PopupMenu_TimesHID) +/* 876BC 800EE5AC AC22C164 */ sw $v0, %lo(PopupMenu_TimesHID)($at) /* 876C0 800EE5B0 0040802D */ daddu $s0, $v0, $zero /* 876C4 800EE5B4 0040202D */ daddu $a0, $v0, $zero /* 876C8 800EE5B8 0C050D6C */ jal hud_element_set_flags @@ -482,8 +482,8 @@ glabel popup_menu_update /* 87704 800EE5F4 8C848430 */ lw $a0, %lo(D_80109890)($a0) /* 87708 800EE5F8 0040802D */ daddu $s0, $v0, $zero /* 8770C 800EE5FC 0200202D */ daddu $a0, $s0, $zero -/* 87710 800EE600 3C018011 */ lui $at, %hi(PopupMenu_PartnerLevelHEID) -/* 87714 800EE604 AC30C168 */ sw $s0, %lo(PopupMenu_PartnerLevelHEID)($at) +/* 87710 800EE600 3C018011 */ lui $at, %hi(PopupMenu_PartnerLevelHID) +/* 87714 800EE604 AC30C168 */ sw $s0, %lo(PopupMenu_PartnerLevelHID)($at) /* 87718 800EE608 0C050D6C */ jal hud_element_set_flags /* 8771C 800EE60C 24050080 */ addiu $a1, $zero, 0x80 /* 87720 800EE610 0200202D */ daddu $a0, $s0, $zero @@ -1415,33 +1415,33 @@ glabel popup_menu_update .LPAL_800EF33C: /* 8844C 800EF33C 240500A0 */ addiu $a1, $zero, 0xA0 /* 88450 800EF340 00A0302D */ daddu $a2, $a1, $zero -/* 88454 800EF344 3C048011 */ lui $a0, %hi(PopupMenu_EmptybarHEID) -/* 88458 800EF348 8C84C15C */ lw $a0, %lo(PopupMenu_EmptybarHEID)($a0) +/* 88454 800EF344 3C048011 */ lui $a0, %hi(PopupMenu_EmptybarHID) +/* 88458 800EF348 8C84C15C */ lw $a0, %lo(PopupMenu_EmptybarHID)($a0) /* 8845C 800EF34C 0C050EAB */ jal hud_element_set_tint /* 88460 800EF350 00A0382D */ daddu $a3, $a1, $zero /* 88464 800EF354 240500A0 */ addiu $a1, $zero, 0xA0 /* 88468 800EF358 00A0302D */ daddu $a2, $a1, $zero -/* 8846C 800EF35C 3C048011 */ lui $a0, %hi(PopupMenu_EntryIconHEID) -/* 88470 800EF360 8C84C178 */ lw $a0, %lo(PopupMenu_EntryIconHEID)($a0) +/* 8846C 800EF35C 3C048011 */ lui $a0, %hi(PopupMenu_EntryIconHID) +/* 88470 800EF360 8C84C178 */ lw $a0, %lo(PopupMenu_EntryIconHID)($a0) /* 88474 800EF364 0C050EAB */ jal hud_element_set_tint /* 88478 800EF368 00A0382D */ daddu $a3, $a1, $zero /* 8847C 800EF36C 240500A0 */ addiu $a1, $zero, 0xA0 /* 88480 800EF370 00A0302D */ daddu $a2, $a1, $zero -/* 88484 800EF374 3C108011 */ lui $s0, %hi(PopupMenu_CursorHEID) -/* 88488 800EF378 2610C16C */ addiu $s0, $s0, %lo(PopupMenu_CursorHEID) +/* 88484 800EF374 3C108011 */ lui $s0, %hi(PopupMenu_CursorHID) +/* 88488 800EF378 2610C16C */ addiu $s0, $s0, %lo(PopupMenu_CursorHID) /* 8848C 800EF37C 8E040000 */ lw $a0, 0x0($s0) /* 88490 800EF380 0C050EAB */ jal hud_element_set_tint /* 88494 800EF384 00A0382D */ daddu $a3, $a1, $zero /* 88498 800EF388 240500A0 */ addiu $a1, $zero, 0xA0 /* 8849C 800EF38C 00A0302D */ daddu $a2, $a1, $zero -/* 884A0 800EF390 3C048011 */ lui $a0, %hi(PopupMenu_UpArrowHEID) -/* 884A4 800EF394 8C84C170 */ lw $a0, %lo(PopupMenu_UpArrowHEID)($a0) +/* 884A0 800EF390 3C048011 */ lui $a0, %hi(PopupMenu_UpArrowHID) +/* 884A4 800EF394 8C84C170 */ lw $a0, %lo(PopupMenu_UpArrowHID)($a0) /* 884A8 800EF398 0C050EAB */ jal hud_element_set_tint /* 884AC 800EF39C 00A0382D */ daddu $a3, $a1, $zero /* 884B0 800EF3A0 240500A0 */ addiu $a1, $zero, 0xA0 /* 884B4 800EF3A4 00A0302D */ daddu $a2, $a1, $zero -/* 884B8 800EF3A8 3C048011 */ lui $a0, %hi(PopupMenu_DownArrowHEID) -/* 884BC 800EF3AC 8C84C174 */ lw $a0, %lo(PopupMenu_DownArrowHEID)($a0) +/* 884B8 800EF3A8 3C048011 */ lui $a0, %hi(PopupMenu_DownArrowHID) +/* 884BC 800EF3AC 8C84C174 */ lw $a0, %lo(PopupMenu_DownArrowHID)($a0) /* 884C0 800EF3B0 0C050EAB */ jal hud_element_set_tint /* 884C4 800EF3B4 00A0382D */ daddu $a3, $a1, $zero /* 884C8 800EF3B8 8E040000 */ lw $a0, 0x0($s0) @@ -1457,14 +1457,14 @@ glabel popup_menu_update /* 884F0 800EF3E0 1462000C */ bne $v1, $v0, .LPAL_800EF414 /* 884F4 800EF3E4 240500A0 */ addiu $a1, $zero, 0xA0 /* 884F8 800EF3E8 00A0302D */ daddu $a2, $a1, $zero -/* 884FC 800EF3EC 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHEID) -/* 88500 800EF3F0 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHEID)($a0) +/* 884FC 800EF3EC 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHID) +/* 88500 800EF3F0 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHID)($a0) /* 88504 800EF3F4 0C050EAB */ jal hud_element_set_tint /* 88508 800EF3F8 00A0382D */ daddu $a3, $a1, $zero /* 8850C 800EF3FC 240500A0 */ addiu $a1, $zero, 0xA0 /* 88510 800EF400 00A0302D */ daddu $a2, $a1, $zero -/* 88514 800EF404 3C048011 */ lui $a0, %hi(PopupMenu_TimesHEID) -/* 88518 800EF408 8C84C164 */ lw $a0, %lo(PopupMenu_TimesHEID)($a0) +/* 88514 800EF404 3C048011 */ lui $a0, %hi(PopupMenu_TimesHID) +/* 88518 800EF408 8C84C164 */ lw $a0, %lo(PopupMenu_TimesHID)($a0) /* 8851C 800EF40C 0C050EAB */ jal hud_element_set_tint /* 88520 800EF410 00A0382D */ daddu $a3, $a1, $zero .LPAL_800EF414: @@ -1474,14 +1474,14 @@ glabel popup_menu_update /* 88530 800EF420 1451000C */ bne $v0, $s1, .LPAL_800EF454 /* 88534 800EF424 240500A0 */ addiu $a1, $zero, 0xA0 /* 88538 800EF428 00A0302D */ daddu $a2, $a1, $zero -/* 8853C 800EF42C 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHEID) -/* 88540 800EF430 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHEID)($a0) +/* 8853C 800EF42C 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHID) +/* 88540 800EF430 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHID)($a0) /* 88544 800EF434 0C050EAB */ jal hud_element_set_tint /* 88548 800EF438 00A0382D */ daddu $a3, $a1, $zero /* 8854C 800EF43C 240500A0 */ addiu $a1, $zero, 0xA0 /* 88550 800EF440 00A0302D */ daddu $a2, $a1, $zero -/* 88554 800EF444 3C048011 */ lui $a0, %hi(PopupMenu_TimesHEID) -/* 88558 800EF448 8C84C164 */ lw $a0, %lo(PopupMenu_TimesHEID)($a0) +/* 88554 800EF444 3C048011 */ lui $a0, %hi(PopupMenu_TimesHID) +/* 88558 800EF448 8C84C164 */ lw $a0, %lo(PopupMenu_TimesHID)($a0) /* 8855C 800EF44C 0C050EAB */ jal hud_element_set_tint /* 88560 800EF450 00A0382D */ daddu $a3, $a1, $zero .LPAL_800EF454: @@ -1493,8 +1493,8 @@ glabel popup_menu_update /* 88578 800EF468 14710007 */ bne $v1, $s1, .LPAL_800EF488 /* 8857C 800EF46C 00000000 */ nop .LPAL_800EF470: -/* 88580 800EF470 3C048011 */ lui $a0, %hi(PopupMenu_PartnerLevelHEID) -/* 88584 800EF474 8C84C168 */ lw $a0, %lo(PopupMenu_PartnerLevelHEID)($a0) +/* 88580 800EF470 3C048011 */ lui $a0, %hi(PopupMenu_PartnerLevelHID) +/* 88584 800EF474 8C84C168 */ lw $a0, %lo(PopupMenu_PartnerLevelHID)($a0) /* 88588 800EF478 240500A0 */ addiu $a1, $zero, 0xA0 /* 8858C 800EF47C 00A0302D */ daddu $a2, $a1, $zero /* 88590 800EF480 0C050EAB */ jal hud_element_set_tint @@ -1507,8 +1507,8 @@ glabel popup_menu_update /* 885A8 800EF498 24020005 */ addiu $v0, $zero, 0x5 /* 885AC 800EF49C 14620006 */ bne $v1, $v0, .LPAL_800EF4B8 /* 885B0 800EF4A0 240500A0 */ addiu $a1, $zero, 0xA0 -/* 885B4 800EF4A4 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHEID) -/* 885B8 800EF4A8 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHEID)($a0) +/* 885B4 800EF4A4 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHID) +/* 885B8 800EF4A8 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHID)($a0) /* 885BC 800EF4AC 00A0302D */ daddu $a2, $a1, $zero /* 885C0 800EF4B0 0C050EAB */ jal hud_element_set_tint /* 885C4 800EF4B4 00A0382D */ daddu $a3, $a1, $zero @@ -1757,33 +1757,33 @@ glabel popup_menu_update .LPAL_800EF824: /* 88934 800EF824 240500A0 */ addiu $a1, $zero, 0xA0 /* 88938 800EF828 00A0302D */ daddu $a2, $a1, $zero -/* 8893C 800EF82C 3C048011 */ lui $a0, %hi(PopupMenu_EmptybarHEID) -/* 88940 800EF830 8C84C15C */ lw $a0, %lo(PopupMenu_EmptybarHEID)($a0) +/* 8893C 800EF82C 3C048011 */ lui $a0, %hi(PopupMenu_EmptybarHID) +/* 88940 800EF830 8C84C15C */ lw $a0, %lo(PopupMenu_EmptybarHID)($a0) /* 88944 800EF834 0C050EAB */ jal hud_element_set_tint /* 88948 800EF838 00A0382D */ daddu $a3, $a1, $zero /* 8894C 800EF83C 240500A0 */ addiu $a1, $zero, 0xA0 /* 88950 800EF840 00A0302D */ daddu $a2, $a1, $zero -/* 88954 800EF844 3C048011 */ lui $a0, %hi(PopupMenu_EntryIconHEID) -/* 88958 800EF848 8C84C178 */ lw $a0, %lo(PopupMenu_EntryIconHEID)($a0) +/* 88954 800EF844 3C048011 */ lui $a0, %hi(PopupMenu_EntryIconHID) +/* 88958 800EF848 8C84C178 */ lw $a0, %lo(PopupMenu_EntryIconHID)($a0) /* 8895C 800EF84C 0C050EAB */ jal hud_element_set_tint /* 88960 800EF850 00A0382D */ daddu $a3, $a1, $zero /* 88964 800EF854 240500A0 */ addiu $a1, $zero, 0xA0 /* 88968 800EF858 00A0302D */ daddu $a2, $a1, $zero -/* 8896C 800EF85C 3C108011 */ lui $s0, %hi(PopupMenu_CursorHEID) -/* 88970 800EF860 2610C16C */ addiu $s0, $s0, %lo(PopupMenu_CursorHEID) +/* 8896C 800EF85C 3C108011 */ lui $s0, %hi(PopupMenu_CursorHID) +/* 88970 800EF860 2610C16C */ addiu $s0, $s0, %lo(PopupMenu_CursorHID) /* 88974 800EF864 8E040000 */ lw $a0, 0x0($s0) /* 88978 800EF868 0C050EAB */ jal hud_element_set_tint /* 8897C 800EF86C 00A0382D */ daddu $a3, $a1, $zero /* 88980 800EF870 240500A0 */ addiu $a1, $zero, 0xA0 /* 88984 800EF874 00A0302D */ daddu $a2, $a1, $zero -/* 88988 800EF878 3C048011 */ lui $a0, %hi(PopupMenu_UpArrowHEID) -/* 8898C 800EF87C 8C84C170 */ lw $a0, %lo(PopupMenu_UpArrowHEID)($a0) +/* 88988 800EF878 3C048011 */ lui $a0, %hi(PopupMenu_UpArrowHID) +/* 8898C 800EF87C 8C84C170 */ lw $a0, %lo(PopupMenu_UpArrowHID)($a0) /* 88990 800EF880 0C050EAB */ jal hud_element_set_tint /* 88994 800EF884 00A0382D */ daddu $a3, $a1, $zero /* 88998 800EF888 240500A0 */ addiu $a1, $zero, 0xA0 /* 8899C 800EF88C 00A0302D */ daddu $a2, $a1, $zero -/* 889A0 800EF890 3C048011 */ lui $a0, %hi(PopupMenu_DownArrowHEID) -/* 889A4 800EF894 8C84C174 */ lw $a0, %lo(PopupMenu_DownArrowHEID)($a0) +/* 889A0 800EF890 3C048011 */ lui $a0, %hi(PopupMenu_DownArrowHID) +/* 889A4 800EF894 8C84C174 */ lw $a0, %lo(PopupMenu_DownArrowHID)($a0) /* 889A8 800EF898 0C050EAB */ jal hud_element_set_tint /* 889AC 800EF89C 00A0382D */ daddu $a3, $a1, $zero /* 889B0 800EF8A0 8E040000 */ lw $a0, 0x0($s0) @@ -1799,14 +1799,14 @@ glabel popup_menu_update /* 889D8 800EF8C8 1462000C */ bne $v1, $v0, .LPAL_800EF8FC /* 889DC 800EF8CC 240500A0 */ addiu $a1, $zero, 0xA0 /* 889E0 800EF8D0 00A0302D */ daddu $a2, $a1, $zero -/* 889E4 800EF8D4 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHEID) -/* 889E8 800EF8D8 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHEID)($a0) +/* 889E4 800EF8D4 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHID) +/* 889E8 800EF8D8 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHID)($a0) /* 889EC 800EF8DC 0C050EAB */ jal hud_element_set_tint /* 889F0 800EF8E0 00A0382D */ daddu $a3, $a1, $zero /* 889F4 800EF8E4 240500A0 */ addiu $a1, $zero, 0xA0 /* 889F8 800EF8E8 00A0302D */ daddu $a2, $a1, $zero -/* 889FC 800EF8EC 3C048011 */ lui $a0, %hi(PopupMenu_TimesHEID) -/* 88A00 800EF8F0 8C84C164 */ lw $a0, %lo(PopupMenu_TimesHEID)($a0) +/* 889FC 800EF8EC 3C048011 */ lui $a0, %hi(PopupMenu_TimesHID) +/* 88A00 800EF8F0 8C84C164 */ lw $a0, %lo(PopupMenu_TimesHID)($a0) /* 88A04 800EF8F4 0C050EAB */ jal hud_element_set_tint /* 88A08 800EF8F8 00A0382D */ daddu $a3, $a1, $zero .LPAL_800EF8FC: @@ -1816,14 +1816,14 @@ glabel popup_menu_update /* 88A18 800EF908 1451000C */ bne $v0, $s1, .LPAL_800EF93C /* 88A1C 800EF90C 240500A0 */ addiu $a1, $zero, 0xA0 /* 88A20 800EF910 00A0302D */ daddu $a2, $a1, $zero -/* 88A24 800EF914 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHEID) -/* 88A28 800EF918 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHEID)($a0) +/* 88A24 800EF914 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHID) +/* 88A28 800EF918 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHID)($a0) /* 88A2C 800EF91C 0C050EAB */ jal hud_element_set_tint /* 88A30 800EF920 00A0382D */ daddu $a3, $a1, $zero /* 88A34 800EF924 240500A0 */ addiu $a1, $zero, 0xA0 /* 88A38 800EF928 00A0302D */ daddu $a2, $a1, $zero -/* 88A3C 800EF92C 3C048011 */ lui $a0, %hi(PopupMenu_TimesHEID) -/* 88A40 800EF930 8C84C164 */ lw $a0, %lo(PopupMenu_TimesHEID)($a0) +/* 88A3C 800EF92C 3C048011 */ lui $a0, %hi(PopupMenu_TimesHID) +/* 88A40 800EF930 8C84C164 */ lw $a0, %lo(PopupMenu_TimesHID)($a0) /* 88A44 800EF934 0C050EAB */ jal hud_element_set_tint /* 88A48 800EF938 00A0382D */ daddu $a3, $a1, $zero .LPAL_800EF93C: @@ -1835,8 +1835,8 @@ glabel popup_menu_update /* 88A60 800EF950 14710007 */ bne $v1, $s1, .LPAL_800EF970 /* 88A64 800EF954 00000000 */ nop .LPAL_800EF958: -/* 88A68 800EF958 3C048011 */ lui $a0, %hi(PopupMenu_PartnerLevelHEID) -/* 88A6C 800EF95C 8C84C168 */ lw $a0, %lo(PopupMenu_PartnerLevelHEID)($a0) +/* 88A68 800EF958 3C048011 */ lui $a0, %hi(PopupMenu_PartnerLevelHID) +/* 88A6C 800EF95C 8C84C168 */ lw $a0, %lo(PopupMenu_PartnerLevelHID)($a0) /* 88A70 800EF960 240500A0 */ addiu $a1, $zero, 0xA0 /* 88A74 800EF964 00A0302D */ daddu $a2, $a1, $zero /* 88A78 800EF968 0C050EAB */ jal hud_element_set_tint @@ -1849,8 +1849,8 @@ glabel popup_menu_update /* 88A90 800EF980 24020005 */ addiu $v0, $zero, 0x5 /* 88A94 800EF984 14620006 */ bne $v1, $v0, .LPAL_800EF9A0 /* 88A98 800EF988 240500A0 */ addiu $a1, $zero, 0xA0 -/* 88A9C 800EF98C 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHEID) -/* 88AA0 800EF990 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHEID)($a0) +/* 88A9C 800EF98C 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHID) +/* 88AA0 800EF990 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHID)($a0) /* 88AA4 800EF994 00A0302D */ daddu $a2, $a1, $zero /* 88AA8 800EF998 0C050EAB */ jal hud_element_set_tint /* 88AAC 800EF99C 00A0382D */ daddu $a3, $a1, $zero @@ -1966,32 +1966,32 @@ glabel popup_menu_update .LPAL_800EFB28: /* 88C38 800EFB28 240500FF */ addiu $a1, $zero, 0xFF /* 88C3C 800EFB2C 00A0302D */ daddu $a2, $a1, $zero -/* 88C40 800EFB30 3C048011 */ lui $a0, %hi(PopupMenu_EmptybarHEID) -/* 88C44 800EFB34 8C84C15C */ lw $a0, %lo(PopupMenu_EmptybarHEID)($a0) +/* 88C40 800EFB30 3C048011 */ lui $a0, %hi(PopupMenu_EmptybarHID) +/* 88C44 800EFB34 8C84C15C */ lw $a0, %lo(PopupMenu_EmptybarHID)($a0) /* 88C48 800EFB38 0C050EAB */ jal hud_element_set_tint /* 88C4C 800EFB3C 00A0382D */ daddu $a3, $a1, $zero /* 88C50 800EFB40 240500FF */ addiu $a1, $zero, 0xFF /* 88C54 800EFB44 00A0302D */ daddu $a2, $a1, $zero -/* 88C58 800EFB48 3C048011 */ lui $a0, %hi(PopupMenu_EntryIconHEID) -/* 88C5C 800EFB4C 8C84C178 */ lw $a0, %lo(PopupMenu_EntryIconHEID)($a0) +/* 88C58 800EFB48 3C048011 */ lui $a0, %hi(PopupMenu_EntryIconHID) +/* 88C5C 800EFB4C 8C84C178 */ lw $a0, %lo(PopupMenu_EntryIconHID)($a0) /* 88C60 800EFB50 0C050EAB */ jal hud_element_set_tint /* 88C64 800EFB54 00A0382D */ daddu $a3, $a1, $zero /* 88C68 800EFB58 240500FF */ addiu $a1, $zero, 0xFF /* 88C6C 800EFB5C 00A0302D */ daddu $a2, $a1, $zero -/* 88C70 800EFB60 3C048011 */ lui $a0, %hi(PopupMenu_CursorHEID) -/* 88C74 800EFB64 8C84C16C */ lw $a0, %lo(PopupMenu_CursorHEID)($a0) +/* 88C70 800EFB60 3C048011 */ lui $a0, %hi(PopupMenu_CursorHID) +/* 88C74 800EFB64 8C84C16C */ lw $a0, %lo(PopupMenu_CursorHID)($a0) /* 88C78 800EFB68 0C050EAB */ jal hud_element_set_tint /* 88C7C 800EFB6C 00A0382D */ daddu $a3, $a1, $zero /* 88C80 800EFB70 240500FF */ addiu $a1, $zero, 0xFF /* 88C84 800EFB74 00A0302D */ daddu $a2, $a1, $zero -/* 88C88 800EFB78 3C048011 */ lui $a0, %hi(PopupMenu_UpArrowHEID) -/* 88C8C 800EFB7C 8C84C170 */ lw $a0, %lo(PopupMenu_UpArrowHEID)($a0) +/* 88C88 800EFB78 3C048011 */ lui $a0, %hi(PopupMenu_UpArrowHID) +/* 88C8C 800EFB7C 8C84C170 */ lw $a0, %lo(PopupMenu_UpArrowHID)($a0) /* 88C90 800EFB80 0C050EAB */ jal hud_element_set_tint /* 88C94 800EFB84 00A0382D */ daddu $a3, $a1, $zero /* 88C98 800EFB88 240500FF */ addiu $a1, $zero, 0xFF /* 88C9C 800EFB8C 00A0302D */ daddu $a2, $a1, $zero -/* 88CA0 800EFB90 3C048011 */ lui $a0, %hi(PopupMenu_DownArrowHEID) -/* 88CA4 800EFB94 8C84C174 */ lw $a0, %lo(PopupMenu_DownArrowHEID)($a0) +/* 88CA0 800EFB90 3C048011 */ lui $a0, %hi(PopupMenu_DownArrowHID) +/* 88CA4 800EFB94 8C84C174 */ lw $a0, %lo(PopupMenu_DownArrowHID)($a0) /* 88CA8 800EFB98 0C050EAB */ jal hud_element_set_tint /* 88CAC 800EFB9C 00A0382D */ daddu $a3, $a1, $zero /* 88CB0 800EFBA0 3C108011 */ lui $s0, %hi(gPopupMenu) @@ -2002,14 +2002,14 @@ glabel popup_menu_update /* 88CC4 800EFBB4 1462000C */ bne $v1, $v0, .LPAL_800EFBE8 /* 88CC8 800EFBB8 240500A0 */ addiu $a1, $zero, 0xA0 /* 88CCC 800EFBBC 00A0302D */ daddu $a2, $a1, $zero -/* 88CD0 800EFBC0 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHEID) -/* 88CD4 800EFBC4 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHEID)($a0) +/* 88CD0 800EFBC0 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHID) +/* 88CD4 800EFBC4 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHID)($a0) /* 88CD8 800EFBC8 0C050EAB */ jal hud_element_set_tint /* 88CDC 800EFBCC 00A0382D */ daddu $a3, $a1, $zero /* 88CE0 800EFBD0 240500A0 */ addiu $a1, $zero, 0xA0 /* 88CE4 800EFBD4 00A0302D */ daddu $a2, $a1, $zero -/* 88CE8 800EFBD8 3C048011 */ lui $a0, %hi(PopupMenu_TimesHEID) -/* 88CEC 800EFBDC 8C84C164 */ lw $a0, %lo(PopupMenu_TimesHEID)($a0) +/* 88CE8 800EFBD8 3C048011 */ lui $a0, %hi(PopupMenu_TimesHID) +/* 88CEC 800EFBDC 8C84C164 */ lw $a0, %lo(PopupMenu_TimesHID)($a0) /* 88CF0 800EFBE0 0C050EAB */ jal hud_element_set_tint /* 88CF4 800EFBE4 00A0382D */ daddu $a3, $a1, $zero .LPAL_800EFBE8: @@ -2019,14 +2019,14 @@ glabel popup_menu_update /* 88D04 800EFBF4 1451000C */ bne $v0, $s1, .LPAL_800EFC28 /* 88D08 800EFBF8 240500A0 */ addiu $a1, $zero, 0xA0 /* 88D0C 800EFBFC 00A0302D */ daddu $a2, $a1, $zero -/* 88D10 800EFC00 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHEID) -/* 88D14 800EFC04 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHEID)($a0) +/* 88D10 800EFC00 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHID) +/* 88D14 800EFC04 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHID)($a0) /* 88D18 800EFC08 0C050EAB */ jal hud_element_set_tint /* 88D1C 800EFC0C 00A0382D */ daddu $a3, $a1, $zero /* 88D20 800EFC10 240500A0 */ addiu $a1, $zero, 0xA0 /* 88D24 800EFC14 00A0302D */ daddu $a2, $a1, $zero -/* 88D28 800EFC18 3C048011 */ lui $a0, %hi(PopupMenu_TimesHEID) -/* 88D2C 800EFC1C 8C84C164 */ lw $a0, %lo(PopupMenu_TimesHEID)($a0) +/* 88D28 800EFC18 3C048011 */ lui $a0, %hi(PopupMenu_TimesHID) +/* 88D2C 800EFC1C 8C84C164 */ lw $a0, %lo(PopupMenu_TimesHID)($a0) /* 88D30 800EFC20 0C050EAB */ jal hud_element_set_tint /* 88D34 800EFC24 00A0382D */ daddu $a3, $a1, $zero .LPAL_800EFC28: @@ -2038,8 +2038,8 @@ glabel popup_menu_update /* 88D4C 800EFC3C 14710007 */ bne $v1, $s1, .LPAL_800EFC5C /* 88D50 800EFC40 00000000 */ nop .LPAL_800EFC44: -/* 88D54 800EFC44 3C048011 */ lui $a0, %hi(PopupMenu_PartnerLevelHEID) -/* 88D58 800EFC48 8C84C168 */ lw $a0, %lo(PopupMenu_PartnerLevelHEID)($a0) +/* 88D54 800EFC44 3C048011 */ lui $a0, %hi(PopupMenu_PartnerLevelHID) +/* 88D58 800EFC48 8C84C168 */ lw $a0, %lo(PopupMenu_PartnerLevelHID)($a0) /* 88D5C 800EFC4C 240500A0 */ addiu $a1, $zero, 0xA0 /* 88D60 800EFC50 00A0302D */ daddu $a2, $a1, $zero /* 88D64 800EFC54 0C050EAB */ jal hud_element_set_tint @@ -2052,14 +2052,14 @@ glabel popup_menu_update /* 88D7C 800EFC6C 24020005 */ addiu $v0, $zero, 0x5 /* 88D80 800EFC70 14620006 */ bne $v1, $v0, .LPAL_800EFC8C /* 88D84 800EFC74 240500A0 */ addiu $a1, $zero, 0xA0 -/* 88D88 800EFC78 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHEID) -/* 88D8C 800EFC7C 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHEID)($a0) +/* 88D88 800EFC78 3C048011 */ lui $a0, %hi(PopupMenu_TitleIconHID) +/* 88D8C 800EFC7C 8C84C160 */ lw $a0, %lo(PopupMenu_TitleIconHID)($a0) /* 88D90 800EFC80 00A0302D */ daddu $a2, $a1, $zero /* 88D94 800EFC84 0C050EAB */ jal hud_element_set_tint /* 88D98 800EFC88 00A0382D */ daddu $a3, $a1, $zero .LPAL_800EFC8C: -/* 88D9C 800EFC8C 3C048011 */ lui $a0, %hi(PopupMenu_CursorHEID) -/* 88DA0 800EFC90 8C84C16C */ lw $a0, %lo(PopupMenu_CursorHEID)($a0) +/* 88D9C 800EFC8C 3C048011 */ lui $a0, %hi(PopupMenu_CursorHID) +/* 88DA0 800EFC90 8C84C16C */ lw $a0, %lo(PopupMenu_CursorHID)($a0) /* 88DA4 800EFC94 3C058010 */ lui $a1, %hi(HES_HandPointer) /* 88DA8 800EFC98 24A52CF0 */ addiu $a1, $a1, %lo(HES_HandPointer) /* 88DAC 800EFC9C 0C050CEB */ jal hud_element_set_script diff --git a/ver/pal/asm/nonmatchings/filemenu/filemenu_createfile/filemenu_draw_contents_choose_name.s b/ver/pal/asm/nonmatchings/filemenu/filemenu_createfile/filemenu_draw_contents_choose_name.s index 7300cb30834..2cd1bfa1a7b 100644 --- a/ver/pal/asm/nonmatchings/filemenu/filemenu_createfile/filemenu_draw_contents_choose_name.s +++ b/ver/pal/asm/nonmatchings/filemenu/filemenu_createfile/filemenu_draw_contents_choose_name.s @@ -228,16 +228,16 @@ glabel filemenu_draw_contents_choose_name /* 175270 8024C850 14400010 */ bnez $v0, .Lfilemenu_8024C894 /* 175274 8024C854 240A00C6 */ addiu $t2, $zero, 0xC6 /* 175278 8024C858 8FAA0084 */ lw $t2, 0x84($sp) -/* 17527C 8024C85C 3C048025 */ lui $a0, %hi(filemenu_createfile_hudElems+0x8) -/* 175280 8024C860 8C8417C8 */ lw $a0, %lo(filemenu_createfile_hudElems+0x8)($a0) +/* 17527C 8024C85C 3C048025 */ lui $a0, %hi(filemenu_createfile_HIDs+0x8) +/* 175280 8024C860 8C8417C8 */ lw $a0, %lo(filemenu_createfile_HIDs+0x8)($a0) /* 175284 8024C864 8FA90088 */ lw $t1, 0x88($sp) /* 175288 8024C868 01502821 */ addu $a1, $t2, $s0 /* 17528C 8024C86C 24A50016 */ addiu $a1, $a1, 0x16 /* 175290 8024C870 01333021 */ addu $a2, $t1, $s3 /* 175294 8024C874 0C050D4D */ jal hud_element_set_render_pos /* 175298 8024C878 24C60008 */ addiu $a2, $a2, 0x8 -/* 17529C 8024C87C 3C048025 */ lui $a0, %hi(filemenu_createfile_hudElems+0x8) -/* 1752A0 8024C880 8C8417C8 */ lw $a0, %lo(filemenu_createfile_hudElems+0x8)($a0) +/* 17529C 8024C87C 3C048025 */ lui $a0, %hi(filemenu_createfile_HIDs+0x8) +/* 1752A0 8024C880 8C8417C8 */ lw $a0, %lo(filemenu_createfile_HIDs+0x8)($a0) /* 1752A4 8024C884 0C050CE4 */ jal hud_element_draw_without_clipping /* 1752A8 8024C888 0000A02D */ daddu $s4, $zero, $zero /* 1752AC 8024C88C 8FA80048 */ lw $t0, 0x48($sp) @@ -439,16 +439,16 @@ glabel filemenu_draw_contents_choose_name /* 175580 8024CB60 14400010 */ bnez $v0, .Lfilemenu_8024CBA4 /* 175584 8024CB64 240A00C6 */ addiu $t2, $zero, 0xC6 /* 175588 8024CB68 8FAA0084 */ lw $t2, 0x84($sp) -/* 17558C 8024CB6C 3C048025 */ lui $a0, %hi(filemenu_createfile_hudElems+0x8) -/* 175590 8024CB70 8C8417C8 */ lw $a0, %lo(filemenu_createfile_hudElems+0x8)($a0) +/* 17558C 8024CB6C 3C048025 */ lui $a0, %hi(filemenu_createfile_HIDs+0x8) +/* 175590 8024CB70 8C8417C8 */ lw $a0, %lo(filemenu_createfile_HIDs+0x8)($a0) /* 175594 8024CB74 8FA90088 */ lw $t1, 0x88($sp) /* 175598 8024CB78 01502821 */ addu $a1, $t2, $s0 /* 17559C 8024CB7C 24A50016 */ addiu $a1, $a1, 0x16 /* 1755A0 8024CB80 01333021 */ addu $a2, $t1, $s3 /* 1755A4 8024CB84 0C050D4D */ jal hud_element_set_render_pos /* 1755A8 8024CB88 24C60008 */ addiu $a2, $a2, 0x8 -/* 1755AC 8024CB8C 3C048025 */ lui $a0, %hi(filemenu_createfile_hudElems+0x8) -/* 1755B0 8024CB90 8C8417C8 */ lw $a0, %lo(filemenu_createfile_hudElems+0x8)($a0) +/* 1755AC 8024CB8C 3C048025 */ lui $a0, %hi(filemenu_createfile_HIDs+0x8) +/* 1755B0 8024CB90 8C8417C8 */ lw $a0, %lo(filemenu_createfile_HIDs+0x8)($a0) /* 1755B4 8024CB94 0C050CE4 */ jal hud_element_draw_without_clipping /* 1755B8 8024CB98 0000A02D */ daddu $s4, $zero, $zero /* 1755BC 8024CB9C 8FA80048 */ lw $t0, 0x48($sp) diff --git a/ver/pal/asm/nonmatchings/pause/pause_items/pause_items_draw_contents.s b/ver/pal/asm/nonmatchings/pause/pause_items/pause_items_draw_contents.s index 090906a21eb..97f00f805d5 100644 --- a/ver/pal/asm/nonmatchings/pause/pause_items/pause_items_draw_contents.s +++ b/ver/pal/asm/nonmatchings/pause/pause_items/pause_items_draw_contents.s @@ -187,8 +187,8 @@ glabel pause_items_draw_contents /* 142BD0 8024DD90 184000D5 */ blez $v0, .Lpause_8024E0E8 /* 142BD4 8024DD94 0000902D */ daddu $s2, $zero, $zero /* 142BD8 8024DD98 8FAA0054 */ lw $t2, 0x54($sp) -/* 142BDC 8024DD9C 3C0B8027 */ lui $t3, %hi(gPauseItemsIconIDs) -/* 142BE0 8024DDA0 256B29B8 */ addiu $t3, $t3, %lo(gPauseItemsIconIDs) +/* 142BDC 8024DD9C 3C0B8027 */ lui $t3, %hi(gPauseItemsHIDs) +/* 142BE0 8024DDA0 256B29B8 */ addiu $t3, $t3, %lo(gPauseItemsHIDs) /* 142BE4 8024DDA4 000A1080 */ sll $v0, $t2, 2 /* 142BE8 8024DDA8 004B5821 */ addu $t3, $v0, $t3 /* 142BEC 8024DDAC AFAB0078 */ sw $t3, 0x78($sp) @@ -330,8 +330,8 @@ glabel pause_items_draw_contents /* 142DF0 8024DFB0 8FAB0074 */ lw $t3, 0x74($sp) /* 142DF4 8024DFB4 11600005 */ beqz $t3, .Lpause_8024DFCC /* 142DF8 8024DFB8 00000000 */ nop -/* 142DFC 8024DFBC 3C118027 */ lui $s1, %hi(gPauseItemsIconIDs+0x4C) -/* 142E00 8024DFC0 8E312A04 */ lw $s1, %lo(gPauseItemsIconIDs+0x4C)($s1) +/* 142DFC 8024DFBC 3C118027 */ lui $s1, %hi(gPauseItemsHIDs+0x4C) +/* 142E00 8024DFC0 8E312A04 */ lw $s1, %lo(gPauseItemsHIDs+0x4C)($s1) /* 142E04 8024DFC4 08093815 */ j .Lpause_8024E054 /* 142E08 8024DFC8 00000000 */ nop .Lpause_8024DFCC: @@ -526,8 +526,8 @@ glabel pause_items_draw_contents /* 1430D0 8024E290 8E220000 */ lw $v0, 0x0($s1) /* 1430D4 8024E294 1840000E */ blez $v0, .Lpause_8024E2D0 /* 1430D8 8024E298 24420001 */ addiu $v0, $v0, 0x1 -/* 1430DC 8024E29C 3C108027 */ lui $s0, %hi(gPauseItemsIconIDs) -/* 1430E0 8024E2A0 261029B8 */ addiu $s0, $s0, %lo(gPauseItemsIconIDs) +/* 1430DC 8024E29C 3C108027 */ lui $s0, %hi(gPauseItemsHIDs) +/* 1430E0 8024E2A0 261029B8 */ addiu $s0, $s0, %lo(gPauseItemsHIDs) /* 1430E4 8024E2A4 8FAB00AC */ lw $t3, 0xAC($sp) /* 1430E8 8024E2A8 8E040040 */ lw $a0, 0x40($s0) /* 1430EC 8024E2AC 8FAA00B0 */ lw $t2, 0xB0($sp) @@ -548,8 +548,8 @@ glabel pause_items_draw_contents /* 143124 8024E2E4 904228A0 */ lbu $v0, %lo(gPauseItemsPages)($v0) /* 143128 8024E2E8 1040000C */ beqz $v0, .Lpause_8024E31C /* 14312C 8024E2EC 00000000 */ nop -/* 143130 8024E2F0 3C108027 */ lui $s0, %hi(gPauseItemsIconIDs) -/* 143134 8024E2F4 261029B8 */ addiu $s0, $s0, %lo(gPauseItemsIconIDs) +/* 143130 8024E2F0 3C108027 */ lui $s0, %hi(gPauseItemsHIDs) +/* 143134 8024E2F4 261029B8 */ addiu $s0, $s0, %lo(gPauseItemsHIDs) /* 143138 8024E2F8 8FAB00AC */ lw $t3, 0xAC($sp) /* 14313C 8024E2FC 8E040044 */ lw $a0, 0x44($s0) /* 143140 8024E300 8FAA00B0 */ lw $t2, 0xB0($sp) diff --git a/ver/pal/splat.yaml b/ver/pal/splat.yaml index 48f7d403397..874c784b6de 100644 --- a/ver/pal/splat.yaml +++ b/ver/pal/splat.yaml @@ -52,8 +52,8 @@ segments: - [auto, c, world/actions] # DUMMY ROM - [auto, c, world/partners] - [auto, c, global_hud_scripts] - - [auto, c, 891b0_len_fb0] - - [auto, c, 8a160_len_700] + - [auto, c, surfaces] + - [auto, c, status_star_shimmer] - [auto, c, 8a860_len_3f30] - [auto, c, draw_box] - [auto, c, bss/engine1_post_bss] @@ -79,8 +79,8 @@ segments: - [auto, palette, ui/input/analog_stick_down] - [auto, ci4, ui/input/analog_stick_up, 32, 32] - [auto, palette, ui/input/analog_stick_up] - - [auto, ci4, ui/unk_bar, 72, 16] - - [auto, palette, ui/unk_bar] + - [auto, ci4, ui/input/mash_bar, 72, 16] + - [auto, palette, ui/input/mash_bar] - [auto, ci4, ui/ok, 24, 16] - [auto, palette, ui/ok] - [auto, ci4, ui/input/start_button, 48, 40] @@ -514,9 +514,9 @@ segments: - [0x9BDB0] - start: 0xA1160 type: .data - name: 8a160_len_700 + name: status_star_shimmer subsegments: - - [0xA1160, ia8, A2960, 32, 16] + - [0xA1160, ia8, ui/status/shimmer_particle, 32, 16] - [0xA1360] # Vp - [0xA1370, vtx, A2B70] - [0xA13C0, gfx, A2BC0] diff --git a/ver/pal/symbol_addrs.txt b/ver/pal/symbol_addrs.txt index 9bca6090a20..2d23f1c2a70 100644 --- a/ver/pal/symbol_addrs.txt +++ b/ver/pal/symbol_addrs.txt @@ -2184,7 +2184,7 @@ mgm_01_panel_bowser_img = 0x80243380; // rom:0xE82510 mgm_01_panel_bowser_pal = 0x80243580; // rom:0xE82710 mgm_02_panel_peach_img = 0x80248380; // rom:0xE8AB70 mgm_02_panel_peach_pal = 0x80248580; // rom:0xE8AD70 -D_801094B0 = 0x80108050; // rom:0xA1160 +ui_status_shimmer_particle_png = 0x80108050; // rom:0xA1160 D_80109710 = 0x801082B0; // rom:0xA13C0 D_801097D8 = 0x80108378; // rom:0xA1488 ui_box_corners9_png = 0x80108580; // rom:0xA1690 @@ -2219,8 +2219,8 @@ ui_input_analog_stick_down_png = 0x800F5C90; // rom:0x8EDA0 ui_input_analog_stick_down_pal = 0x800F5E90; // rom:0x8EFA0 ui_input_analog_stick_up_png = 0x800F5EB0; // rom:0x8EFC0 ui_input_analog_stick_up_pal = 0x800F60B0; // rom:0x8F1C0 -ui_unk_bar_png = 0x800F60D0; // rom:0x8F1E0 -ui_unk_bar_pal = 0x800F6310; // rom:0x8F420 +ui_input_mash_bar_png = 0x800F60D0; // rom:0x8F1E0 +ui_input_mash_bar_pal = 0x800F6310; // rom:0x8F420 ui_ok_png = 0x800F6330; // rom:0x8F440 ui_ok_pal = 0x800F63F0; // rom:0x8F500 ui_input_start_button_png = 0x800F6410; // rom:0x8F520 diff --git a/ver/pal/undefined_syms.txt b/ver/pal/undefined_syms.txt index 8b0cd19d0f1..a772fb990e7 100644 --- a/ver/pal/undefined_syms.txt +++ b/ver/pal/undefined_syms.txt @@ -381,26 +381,26 @@ btl_update_ko_status = 0x80267B74; LoadItemScript = 0x802682C0; LoadActionCommand = 0x802685B0; action_command_init_status = 0x80268C48; -func_80269118 = 0x80269508; -func_80269160 = 0x80269550; +increment_action_command_attempt_count = 0x80269508; +increment_action_command_success_count = 0x80269550; SetActionDifficultyTable = 0x8026958C; SetupMashMeter = 0x802695B8; -GetActionSuccess = 0x80269684; +GetSmashActionQuality = 0x80269684; SetActionSuccess = 0x802696B0; SetActionCommandMode = 0x802696DC; GetActionCommandMode = 0x80269708; SetActionHudPrepareTime = 0x80269734; SetCommandAutoSuccess = 0x8026978C; -CloseActionCommandInfo = 0x80269800; -func_80269470 = 0x80269860; +InterruptActionCommand = 0x80269800; +InterruptLeechActionCommand = 0x80269860; ShowActionHud = 0x80269894; -GetActionSuccessCopy = 0x802698E8; -GetActionResult = 0x80269914; +GetMashActionQuality = 0x802698E8; +GetJumpActionQuality = 0x80269914; SetActionResult = 0x80269940; GetBlockResult = 0x8026996C; -GetActionQuality = 0x80269998; -SetActionQuality = 0x802699C4; -func_80269600 = 0x802699F0; +GetActionProgress = 0x80269998; +SetActionProgress = 0x802699C4; +GetActionResultTier = 0x802699F0; set_goal_pos_to_part = 0x80269B44; get_actor = 0x8026A15C; LoadBattleSection = 0x8026A1D4; @@ -596,7 +596,7 @@ PartnerDamageEnemy = 0x802801A4; PartnerAfflictEnemy = 0x802803F4; PartnerPowerBounceEnemy = 0x80280660; PartnerTestEnemy = 0x802808C0; -GetPartnerActionSuccess = 0x80280BC0; +GetPartnerActionQuality = 0x80280BC0; PartnerYieldTurn = 0x80280C08; GetDamageIntensity = 0x80280C30; LoadStarPowerScript = 0x80280D40; @@ -696,7 +696,7 @@ action_command_spook_init = 0x802A9000; action_command_squirt_init = 0x802A9000; action_command_stop_leech_init = 0x802A9000; action_command_tidal_wave_init = 0x802A9000; -action_command_water_block_init = 0x802A9000; +action_command_three_chances_init = 0x802A9000; action_command_whirlwind_init = 0x802A9000; action_command_stop_leech_start = 0x802A9110; action_command_squirt_start = 0x802A911C; @@ -717,7 +717,7 @@ action_command_body_slam_start = 0x802A91B8; action_command_whirlwind_start = 0x802A91E0; action_command_power_shock_start = 0x802A9210; action_command_hammer_start = 0x802A9258; -action_command_water_block_start = 0x802A9398; +action_command_three_chances_start = 0x802A9398; BattleEntityHeapBottom = 0x802C3000; spr_get_npc_raster_info = 0x802E4CB8; MsgCharsets = 0x802F18A8; diff --git a/ver/us/splat.yaml b/ver/us/splat.yaml index ea61ac0b12e..29183f22995 100644 --- a/ver/us/splat.yaml +++ b/ver/us/splat.yaml @@ -150,7 +150,7 @@ segments: - [auto, c, world/world] - [auto, c, collision] - [auto, c, 38F00] - - [auto, c, 39210_len_aa0] + - [auto, c, npc_follow] - [auto, c, os/nusys/nuboot] - [auto, c, os/nusys/nusched] - [auto, c, os/nusys/nugfxfuncset] @@ -396,8 +396,8 @@ segments: - [auto, c, world/actions] # DUMMY ROM - [auto, c, world/partners] - [auto, c, global_hud_scripts] - - [auto, c, 891b0_len_fb0] - - [auto, c, 8a160_len_700] + - [auto, c, surfaces] + - [auto, c, status_star_shimmer] - [auto, c, 8a860_len_3f30] - [auto, c, draw_box] - [auto, c, bss/engine1_post_bss] @@ -423,8 +423,8 @@ segments: - [auto, palette, ui/input/analog_stick_down] - [auto, ci4, ui/input/analog_stick_up, 32, 32] - [auto, palette, ui/input/analog_stick_up] - - [auto, ci4, ui/unk_bar, 72, 16] - - [auto, palette, ui/unk_bar] + - [auto, ci4, ui/input/mash_bar, 72, 16] + - [auto, palette, ui/input/mash_bar] - [auto, ci4, ui/ok, 24, 16] - [auto, palette, ui/ok] - [auto, ci4, ui/input/start_button, 48, 40] @@ -786,9 +786,9 @@ segments: - [0x9DE60] - start: 0xA2960 type: .data - name: 8a160_len_700 + name: status_star_shimmer subsegments: - - [0xA2960, ia8, A2960, 32, 16] + - [0xA2960, ia8, ui/status/shimmer_particle, 32, 16] - [0xA2B60] # Vp - [0xA2B70, vtx, A2B70] - [0xA2BC0, gfx, A2BC0] @@ -5775,9 +5775,9 @@ segments: start: 0x425B50 vram_class: action_cmd dir: battle/action_cmd - name: action_cmd_07 + name: action_cmd_unused_flee subsegments: - - [auto, c, "07"] + - [auto, c, unused_flee] - type: code start: 0x426170 vram_class: action_cmd @@ -5796,9 +5796,9 @@ segments: start: 0x4273B0 vram_class: action_cmd dir: battle/action_cmd - name: action_cmd_0A + name: action_cmd_unused_mash_a subsegments: - - [auto, c, 0A] + - [auto, c, unused_mash_a] - type: code start: 0x427A70 vram_class: action_cmd @@ -5838,29 +5838,29 @@ segments: start: 0x42A4F0 vram_class: action_cmd dir: battle/action_cmd - name: action_cmd_water_block + name: action_cmd_three_chances subsegments: - - [auto, c, water_block] + - [auto, c, three_chances] - start: 0x42B650 type: .data - name: water_block - subsegments: - - [0x42B650, ci4, water_block_1, 24, 24] - - [0x42B770, palette, water_block_1] - - [0x42B790, ci4, water_block_2, 24, 24] - - [0x42B8B0, palette, water_block_2] - - [0x42B8D0, ci4, water_block_3, 24, 24] - - [0x42B9F0, palette, water_block_3] - - [0x42BA10, ci4, water_block_0, 24, 24] - - [0x42BB30, palette, water_block_0] - - [0x42BB50, ci4, water_block_block, 32, 32] - - [0x42BD50, palette, water_block_block] - - [0x42BD70, ci4, water_block_circle, 40, 40] - - [0x42C090, palette, water_block_circle] - - [0x42C0B0, ci4, water_block_cloud, 40, 40] - - [0x42C3D0, palette, water_block_cloud] - - [0x42C3F0, ci4, water_block_4, 24, 24] - - [0x42C510, palette, water_block_4] + name: three_chances + subsegments: + - [0x42B650, ci4, three_chances_1, 24, 24] + - [0x42B770, palette, three_chances_1] + - [0x42B790, ci4, three_chances_2, 24, 24] + - [0x42B8B0, palette, three_chances_2] + - [0x42B8D0, ci4, three_chances_3, 24, 24] + - [0x42B9F0, palette, three_chances_3] + - [0x42BA10, ci4, three_chances_0, 24, 24] + - [0x42BB30, palette, three_chances_0] + - [0x42BB50, ci4, three_chances_block, 32, 32] + - [0x42BD50, palette, three_chances_block] + - [0x42BD70, ci4, three_chances_circle, 40, 40] + - [0x42C090, palette, three_chances_circle] + - [0x42C0B0, ci4, three_chances_cloud, 40, 40] + - [0x42C3D0, palette, three_chances_cloud] + - [0x42C3F0, ci4, three_chances_4, 24, 24] + - [0x42C510, palette, three_chances_4] - [0x42C530] - [0x42C6F0] - type: code diff --git a/ver/us/symbol_addrs.txt b/ver/us/symbol_addrs.txt index b2bf1338655..a89cc3d9a6f 100644 --- a/ver/us/symbol_addrs.txt +++ b/ver/us/symbol_addrs.txt @@ -811,7 +811,7 @@ set_effect_pos_offset = 0x80059C88; // type:func rom:0x35088 clear_effect_data = 0x80059C9C; // type:func rom:0x3509C func_80059D48 = 0x80059D48; // type:func rom:0x35148 update_effects = 0x80059D50; // type:func rom:0x35150 -render_effects_world = 0x80059EF4; // type:func rom:0x352F4 +render_effects_scene = 0x80059EF4; // type:func rom:0x352F4 render_effects_UI = 0x80059F94; // type:func rom:0x35394 create_effect_instance = 0x8005A2BC; // type:func rom:0x356BC remove_effect = 0x8005A450; // type:func rom:0x35850 @@ -2836,7 +2836,7 @@ AuDelayedVoiceGroup = 0x800A3FEC; // rom:0x7F3EC AuDelayedChannel = 0x800A3FEE; // rom:0x7F3EE AuDelayCount = 0x800A3FF0; // rom:0x7F3F0 D_800A3FF4 = 0x800A3FF4; // rom:0x7F3F4 -gEffectGraphicsData = 0x800A4000; // rom:0x7F400 +gEffectSharedData = 0x800A4000; // rom:0x7F400 update_locomotion_state = 0x800E5F68; // type:func rom:0x7F418 start_falling = 0x800E5FD0; // type:func rom:0x7F480 start_bounce_a = 0x800E6034; // type:func rom:0x7F4E4 @@ -3021,10 +3021,10 @@ func_800F0864 = 0x800F0864; // type:func rom:0x89D14 func_800F09EC = 0x800F09EC; // type:func rom:0x89E9C func_800F0B3C = 0x800F0B3C; // type:func rom:0x89FEC func_800F0C9C = 0x800F0C9C; // type:func rom:0x8A14C -func_800F0CB0 = 0x800F0CB0; // type:func rom:0x8A160 -func_800F0D5C = 0x800F0D5C; // type:func rom:0x8A20C -func_800F0D80 = 0x800F0D80; // type:func rom:0x8A230 -func_800F102C = 0x800F102C; // type:func rom:0x8A4DC +star_power_shimmer_start = 0x800F0CB0; // type:func rom:0x8A160 +star_power_shimmer_init = 0x800F0D5C; // type:func rom:0x8A20C +star_power_shimmer_update = 0x800F0D80; // type:func rom:0x8A230 +star_power_shimmer_draw = 0x800F102C; // type:func rom:0x8A4DC hide_popup_menu = 0x800F13B0; // type:func rom:0x8A860 destroy_popup_menu = 0x800F1538; // type:func rom:0x8A9E8 func_800F16CC = 0x800F16CC; // type:func rom:0x8AB7C @@ -3158,8 +3158,8 @@ ui_input_analog_stick_down_png = 0x800F9860; // rom:0x92D10 ui_input_analog_stick_down_pal = 0x800F9A60; // rom:0x92F10 ui_input_analog_stick_up_png = 0x800F9A80; // rom:0x92F30 ui_input_analog_stick_up_pal = 0x800F9C80; // rom:0x93130 -ui_unk_bar_png = 0x800F9CA0; // rom:0x93150 -ui_unk_bar_pal = 0x800F9EE0; // rom:0x93390 +ui_input_mash_bar_png = 0x800F9CA0; // rom:0x93150 +ui_input_mash_bar_pal = 0x800F9EE0; // rom:0x93390 ui_ok_png = 0x800F9F00; // rom:0x933B0 ui_ok_pal = 0x800F9FC0; // rom:0x93470 ui_input_start_button_png = 0x800F9FE0; // rom:0x93490 @@ -3720,6 +3720,7 @@ HES_MoveDiamond_disabled = 0x801093D8; // rom:0xA2888 HES_MoveBlueOrbDisabled = 0x80109400; // rom:0xA28B0 HES_MoveGreenOrbDisabled = 0x80109428; // rom:0xA28D8 HES_MoveRedOrbDisabled = 0x80109450; // rom:0xA2900 +ui_status_shimmer_particle_png = 0x801094B0; // rom:0xA2960 D_80109890 = 0x80109890; // rom:0xA2D40 D_80109898 = 0x80109898; // rom:0xA2D48 D_801098A0 = 0x801098A0; // rom:0xA2D50 @@ -3801,8 +3802,8 @@ WorldPopupResult = 0x8010CCFC; // rom:0xA61AC OpenMenuDisableCount = 0x8010CCFE; // rom:0xA61AE WorldMenuState = 0x8010CD00; // rom:0xA61B0 D_8010CD04 = 0x8010CD04; // rom:0xA61B4 -D_8010CD10 = 0x8010CD10; // rom:0xA61C0 -D_8010CD12 = 0x8010CD12; // rom:0xA61C2 +ShowingCoinCounter = 0x8010CD10; // rom:0xA61C0 +HidingCoinCounter = 0x8010CD12; // rom:0xA61C2 D_8010CD14 = 0x8010CD14; // rom:0xA61C4 D_8010CD20 = 0x8010CD20; // rom:0xA61D0 D_8010CD24 = 0x8010CD24; // rom:0xA61D4 @@ -3831,7 +3832,7 @@ wPartner = 0x8010CFEC; // rom:0xA649C PrevTimeInAir = 0x8010CFF0; // rom:0xA64A0 LandedTimeInAir = 0x8010CFF4; // rom:0xA64A4 D_8010CFF8 = 0x8010CFF8; // rom:0xA64A8 -D_8010D000 = 0x8010D000; // rom:0xA64B0 +ShimmerEmitters = 0x8010D000; // rom:0xA64B0 D_8010D004 = 0x8010D004; // rom:0xA64B4 func_8010FE44 = 0x8010FE44; // type:func rom:0xA6544 entity_model_set_shadow_color = 0x8010FE68; // type:func rom:0xA6568 @@ -3849,8 +3850,8 @@ PopupMenu_LastDisplayIndex = 0x8010D655; // rom:0xA6B05 PopupMenu_DisplayedEntryCount = 0x8010D656; // rom:0xA6B06 D_8010D658 = 0x8010D658; // rom:0xA6B08 D_8010D65A = 0x8010D65A; // rom:0xA6B0A -PopupMenu_EmptybarHEID = 0x8010D65C; // rom:0xA6B0C -PopupTitleIconHEID = 0x8010D660; // rom:0xA6B10 +PopupMenu_EmptybarHID = 0x8010D65C; // rom:0xA6B0C +PopupTitleIconHID = 0x8010D660; // rom:0xA6B10 D_8010D664 = 0x8010D664; // rom:0xA6B14 D_8010D668 = 0x8010D668; // rom:0xA6B18 D_8010D66C = 0x8010D66C; // rom:0xA6B1C @@ -4152,11 +4153,11 @@ get_entity_fog_color = 0x8012307C; // type:func rom:0xB977C worker_delegate_do_nothing = 0x801230B0; // type:func rom:0xB97B0 clear_worker_list = 0x801230B8; // type:func rom:0xB97B8 init_worker_list = 0x80123114; // type:func rom:0xB9814 -create_worker_world = 0x80123158; // type:func rom:0xB9858 +create_worker_scene = 0x80123158; // type:func rom:0xB9858 create_worker_frontUI = 0x8012323C; // type:func rom:0xB993C create_worker_backUI = 0x80123320; // type:func rom:0xB9A20 update_workers = 0x80123404; // type:func rom:0xB9B04 -render_workers_world = 0x80123470; // type:func rom:0xB9B70 +render_workers_scene = 0x80123470; // type:func rom:0xB9B70 render_workers_frontUI = 0x801234E0; // type:func rom:0xB9BE0 render_workers_backUI = 0x80123550; // type:func rom:0xB9C50 free_worker = 0x801235C0; // type:func rom:0xB9CC0 @@ -5060,7 +5061,7 @@ D_801565A8 = 0x801565A8; // rom:0xECCA8 D_801565AC = 0x801565AC; // rom:0xECCAC ItemPickupMenu = 0x801565B0; // rom:0xECCB0 evt_get_float_variable = 0x802C842C; // type:func rom:0xECDDC -ItemPickupIconID = 0x801568E0; // rom:0xECFE0 +ItemPickupIconHID = 0x801568E0; // rom:0xECFE0 ItemPickupStateDelay = 0x801568E4; // rom:0xECFE4 ThrowAwayMenuIdx = 0x801568E8; // rom:0xECFE8 ThrowAwayItemID = 0x801568EC; // rom:0xECFEC @@ -6429,8 +6430,8 @@ filemenu_currentMenu = 0x8024C098; // rom:0x16C8F8 filemenu_8024C09C = 0x8024C09C; // rom:0x16C8FC filemenu_cursorHudElemID = 0x8024C0A0; // rom:0x16C900 filemenu_8024C0A4 = 0x8024C0A4; // rom:0x16C904 -filemenu_hudElemIDs = 0x8024C0B0; // rom:0x16C910 -filemenu_createfile_hudElems = 0x8024C100; // rom:0x16C960 +filemenu_mainHIDs = 0x8024C0B0; // rom:0x16C910 +filemenu_createfile_HIDs = 0x8024C100; // rom:0x16C960 filemenu_filename = 0x8024C110; // rom:0x16C970 func_8023E104 = 0x8023E104; // type:func rom:0x16C9E4 func_8023E11C = 0x8023E11C; // type:func rom:0x16C9FC @@ -6856,13 +6857,13 @@ action_command_init_status = 0x80268858; // type:func rom:0x197138 action_command_update = 0x80268938; // type:func rom:0x197218 action_command_draw = 0x80268AF8; // type:func rom:0x1973D8 action_command_free = 0x80268C9C; // type:func rom:0x19757C -func_80268E88 = 0x80268E88; // type:func rom:0x197768 +create_action_command_ui_worker = 0x80268E88; // type:func rom:0x197768 check_block_input = 0x80268ECC; // type:func rom:0x1977AC -func_80269118 = 0x80269118; // type:func rom:0x1979F8 -func_80269160 = 0x80269160; // type:func rom:0x197A40 +increment_action_command_attempt_count = 0x80269118; // type:func rom:0x1979F8 +increment_action_command_success_count = 0x80269160; // type:func rom:0x197A40 SetActionDifficultyTable = 0x8026919C; // type:func rom:0x197A7C SetupMashMeter = 0x802691C8; // type:func rom:0x197AA8 -GetActionSuccess = 0x80269294; // type:func rom:0x197B74 +GetSmashActionQuality = 0x80269294; // type:func rom:0x197B74 SetActionSuccess = 0x802692C0; // type:func rom:0x197BA0 SetActionCommandMode = 0x802692EC; // type:func rom:0x197BCC GetActionCommandMode = 0x80269318; // type:func rom:0x197BF8 @@ -6870,17 +6871,17 @@ SetActionHudPrepareTime = 0x80269344; // type:func rom:0x197C24 GetCommandAutoSuccess = 0x80269370; // type:func rom:0x197C50 SetCommandAutoSuccess = 0x8026939C; // type:func rom:0x197C7C func_802693F0 = 0x802693F0; // type:func rom:0x197CD0 -CloseActionCommandInfo = 0x80269410; // type:func rom:0x197CF0 -func_80269470 = 0x80269470; // type:func rom:0x197D50 +InterruptActionCommand = 0x80269410; // type:func rom:0x197CF0 +InterruptLeechActionCommand = 0x80269470; // type:func rom:0x197D50 ShowActionHud = 0x802694A4; // type:func rom:0x197D84 -GetActionSuccessCopy = 0x802694F8; // type:func rom:0x197DD8 -GetActionResult = 0x80269524; // type:func rom:0x197E04 +GetMashActionQuality = 0x802694F8; // type:func rom:0x197DD8 +GetJumpActionQuality = 0x80269524; // type:func rom:0x197E04 SetActionResult = 0x80269550; // type:func rom:0x197E30 GetBlockResult = 0x8026957C; // type:func rom:0x197E5C -GetActionQuality = 0x802695A8; // type:func rom:0x197E88 -SetActionQuality = 0x802695D4; // type:func rom:0x197EB4 -func_80269600 = 0x80269600; // type:func rom:0x197EE0 -func_8026962C = 0x8026962C; // type:func rom:0x197F0C +GetActionProgress = 0x802695A8; // type:func rom:0x197E88 +SetActionProgress = 0x802695D4; // type:func rom:0x197EB4 +GetActionResultTier = 0x80269600; // type:func rom:0x197EE0 +SetActionResultTier = 0x8026962C; // type:func rom:0x197F0C count_targets = 0x80269660; // type:func rom:0x197F40 get_nearest_home_index = 0x80269698; // type:func rom:0x197F78 set_goal_pos_to_part = 0x80269754; // type:func rom:0x198034 @@ -7073,7 +7074,7 @@ ForceDisablePlayerBlurImmediately = 0x802749F8; // type:func rom:0x1A32D8 PlayerBasicJumpToGoal = 0x80274A18; // type:func rom:0x1A32F8 PlayerSuperJumpToGoal = 0x802752AC; // type:func rom:0x1A3B8C PlayerUltraJumpToGoal = 0x80275F00; // type:func rom:0x1A47E0 -GetPlayerActionSuccess = 0x80276EB4; // type:func rom:0x1A5794 +GetPlayerActionQuality = 0x80276EB4; // type:func rom:0x1A5794 PlayerYieldTurn = 0x80276EFC; // type:func rom:0x1A57DC DispatchEventPlayer = 0x80276F1C; // type:func rom:0x1A57FC has_enchanted_part = 0x80276F50; // type:func rom:0x1A5830 @@ -7161,7 +7162,7 @@ PartnerPowerBounceEnemy = 0x80280270; // type:func rom:0x1AEB50 PartnerTestEnemy = 0x802804D0; // type:func rom:0x1AEDB0 func_8028070C = 0x8028070C; // type:func rom:0x1AEFEC DeletePartner = 0x802807A8; // type:func rom:0x1AF088 -GetPartnerActionSuccess = 0x802807D0; // type:func rom:0x1AF0B0 +GetPartnerActionQuality = 0x802807D0; // type:func rom:0x1AF0B0 PartnerYieldTurn = 0x80280818; // type:func rom:0x1AF0F8 GetDamageIntensity = 0x80280840; // type:func rom:0x1AF120 AddEffectOffset = 0x80280880; // type:func rom:0x1AF160 @@ -9125,51 +9126,50 @@ HES_Whirlwind5 = 0x802AA7A0; // rom:0x425410 HES_Whirlwind6 = 0x802AA7C8; // rom:0x425438 HES_Whirlwind7 = 0x802AA7F0; // rom:0x425460 HES_WhirlwindBubble = 0x802AA818; // rom:0x425488 -D_802AA844_4254B4 = 0x802AA844; // rom:0x4254B4 -D_802AA85C_4254CC = 0x802AA85C; // rom:0x4254CC -D_802AA888_4254F8 = 0x802AA888; // rom:0x4254F8 -D_802AA8A0_425510 = 0x802AA8A0; // rom:0x425510 -D_802AA8B4_425524 = 0x802AA8B4; // rom:0x425524 +action_command_whirlwind_DrainRateTable0 = 0x802AA844; // rom:0x4254B4 +action_command_whirlwind_DrainRateTable1 = 0x802AA85C; // rom:0x4254CC +action_command_whirlwind_HuffDigits = 0x802AA888; // rom:0x4254F8 +action_command_whirlwind_BuzzarDigits = 0x802AA8A0; // rom:0x425510 +action_command_whirlwind_BuzzarQuality = 0x802AA8B4; // rom:0x425524 D_802AA8B7_425527 = 0x802AA8B7; // rom:0x425527 action_command_stop_leech_init = 0x802A9000; // type:func rom:0x425590 action_command_stop_leech_start = 0x802A9110; // type:func rom:0x4256A0 action_cmd_stop_leech_update = 0x802A91F8; // type:func rom:0x425788 action_command_stop_leech_draw = 0x802A94A4; // type:func rom:0x425A34 action_command_stop_leech_free = 0x802A9544; // type:func rom:0x425AD4 -action_command_07_init = 0x802A9000; // type:func rom:0x425B50 -action_command_07_start = 0x802A916C; // type:func rom:0x425CBC +action_command_unused_flee_init = 0x802A9000; // type:func rom:0x425B50 +action_command_unused_flee_start = 0x802A916C; // type:func rom:0x425CBC action_command_and_07_update = 0x802A9228; // type:func rom:0x425D78 -action_command_07_draw = 0x802A94D8; // type:func rom:0x426028 -action_command_07_free = 0x802A959C; // type:func rom:0x4260EC +action_command_unused_flee_draw = 0x802A94D8; // type:func rom:0x426028 +action_command_unused_flee_free = 0x802A959C; // type:func rom:0x4260EC action_command_dizzy_shell_init = 0x802A9000; // type:func rom:0x426170 action_command_dizzy_shell_start = 0x802A9170; // type:func rom:0x4262E0 action_command_dizzy_shell_update = 0x802A928C; // type:func rom:0x4263FC action_command_dizzy_shell_draw = 0x802A96DC; // type:func rom:0x42684C action_command_dizzy_shell_free = 0x802A97BC; // type:func rom:0x42692C -D_802A9800_426970 = 0x802A9800; // rom:0x426970 +action_command_dizzy_shell_DrainRateTable = 0x802A9800; // rom:0x426970 D_802A9802_426972 = 0x802A9802; // rom:0x426972 action_command_fire_shell_init = 0x802A9000; // type:func rom:0x4269D0 action_command_fire_shell_start = 0x802A9178; // type:func rom:0x426B48 action_command_fire_shell_update = 0x802A9294; // type:func rom:0x426C64 action_command_fire_shell_draw = 0x802A9834; // type:func rom:0x427204 action_command_fire_shell_free = 0x802A9914; // type:func rom:0x4272E4 -D_802A9950_427320 = 0x802A9950; // rom:0x427320 +battle_partner_kooper_DrainRateTable = 0x802A9950; // rom:0x427320 D_802A9952_427322 = 0x802A9952; // rom:0x427322 -D_802A9964_427334 = 0x802A9964; // rom:0x427334 -D_802A9974_427344 = 0x802A9974; // rom:0x427344 -D_802A9988_427358 = 0x802A9988; // rom:0x427358 -action_command_0A_init = 0x802A9000; // type:func rom:0x4273B0 -action_command_0A_start = 0x802A9170; // type:func rom:0x427520 -action_command_0A_update = 0x802A928C; // type:func rom:0x42763C -action_command_0A_draw = 0x802A955C; // type:func rom:0x42790C -action_command_0A_free = 0x802A963C; // type:func rom:0x4279EC +battle_partner_kooper_BasicThresholds = 0x802A9964; // rom:0x427334 +battle_partner_kooper_SuperThresholds = 0x802A9974; // rom:0x427344 +battle_partner_kooper_UltraThresholds = 0x802A9988; // rom:0x427358 +action_command_unused_mash_a_init = 0x802A9000; // type:func rom:0x4273B0 +action_command_unused_mash_a_start = 0x802A9170; // type:func rom:0x427520 +action_command_unused_mash_a_update = 0x802A928C; // type:func rom:0x42763C +action_command_unused_mash_a_draw = 0x802A955C; // type:func rom:0x42790C +action_command_unused_mash_a_free = 0x802A963C; // type:func rom:0x4279EC action_command_bomb_init = 0x802A9000; // type:func rom:0x427A70 action_command_bomb_start = 0x802A9170; // type:func rom:0x427BE0 action_command_bomb_update = 0x802A928C; // type:func rom:0x427CFC action_command_bomb_draw = 0x802A96EC; // type:func rom:0x42815C action_command_bomb_free = 0x802A97CC; // type:func rom:0x42823C -D_802A9810_428280 = 0x802A9810; // rom:0x428280 -D_802A9812_428282 = 0x802A9812; // rom:0x428282 +action_command_bomb_DrainRateTable = 0x802A9810; // rom:0x428280 action_command_body_slam_init = 0x802A9000; // type:func rom:0x4282E0 action_command_body_slam_start = 0x802A91B8; // type:func rom:0x428498 action_command_body_slam_update = 0x802A92D4; // type:func rom:0x4285B4 @@ -9180,7 +9180,7 @@ action_command_air_lift_start = 0x802A9184; // type:func rom:0x428BF4 action_command_air_lift_update = 0x802A9278; // type:func rom:0x428CE8 action_command_air_lift_draw = 0x802A96EC; // type:func rom:0x42915C action_command_air_lift_free = 0x802A9810; // type:func rom:0x429280 -D_802A9852_4292C0 = 0x802A9850; // rom:0x4292C0 +action_command_air_lift_DrainRateTable = 0x802A9850; // rom:0x4292C0 D_802A9852_4292C2 = 0x802A9852; // rom:0x4292C2 air_lift_bss_pre = 0x802A98A8; // rom:0x429318 action_command_air_raid_init = 0x802A9000; // type:func rom:0x429320 @@ -9188,50 +9188,49 @@ action_command_air_raid_start = 0x802A9178; // type:func rom:0x429498 action_command_air_raid_update = 0x802A9294; // type:func rom:0x4295B4 action_command_air_raid_draw = 0x802A984C; // type:func rom:0x429B6C action_command_air_raid_free = 0x802A992C; // type:func rom:0x429C4C -D_802A9970_429C90 = 0x802A9970; // rom:0x429C90 +action_command_air_raid_DrainRateTable = 0x802A9970; // rom:0x429C90 D_802A9972_429C92 = 0x802A9972; // rom:0x429C92 -D_802A9984_429CA4 = 0x802A9984; // rom:0x429CA4 -D_802A9994_429CB4 = 0x802A9994; // rom:0x429CB4 -D_802A99A8_429CC8 = 0x802A99A8; // rom:0x429CC8 +action_command_air_raid_BasicThresholds = 0x802A9984; // rom:0x429CA4 +action_command_air_raid_SuperThresholds = 0x802A9994; // rom:0x429CB4 +action_command_air_raid_UltraThresholds = 0x802A99A8; // rom:0x429CC8 action_command_squirt_init = 0x802A9000; // type:func rom:0x429D20 action_command_squirt_start = 0x802A911C; // type:func rom:0x429E3C action_command_squirt_update = 0x802A9208; // type:func rom:0x429F28 action_command_squirt_draw = 0x802A9634; // type:func rom:0x42A354 action_command_squirt_free = 0x802A9720; // type:func rom:0x42A440 -D_802A9760_42A480 = 0x802A9760; // rom:0x42A480 +action_command_squirt_DrainRateTable = 0x802A9760; // rom:0x42A480 D_802A9762_42A482 = 0x802A9762; // rom:0x42A482 -D_802A9778_42A498 = 0x802A9778; // rom:0x42A498 -action_command_water_block_init = 0x802A9000; // type:func rom:0x42A4F0 -action_command_water_block_start = 0x802A9398; // type:func rom:0x42A888 -action_command_water_block_update = 0x802A948C; // type:func rom:0x42A97C -action_command_water_block_draw = 0x802AA014; // type:func rom:0x42B504 -action_command_water_block_free = 0x802AA0D8; // type:func rom:0x42B5C8 -battle_action_cmd_water_block_1_png = 0x802AA160; // rom:0x42B650 -battle_action_cmd_water_block_1_pal = 0x802AA280; // rom:0x42B770 -battle_action_cmd_water_block_2_png = 0x802AA2A0; // rom:0x42B790 -battle_action_cmd_water_block_2_pal = 0x802AA3C0; // rom:0x42B8B0 -battle_action_cmd_water_block_3_png = 0x802AA3E0; // rom:0x42B8D0 -battle_action_cmd_water_block_3_pal = 0x802AA500; // rom:0x42B9F0 -battle_action_cmd_water_block_0_png = 0x802AA520; // rom:0x42BA10 -battle_action_cmd_water_block_0_pal = 0x802AA640; // rom:0x42BB30 -battle_action_cmd_water_block_block_png = 0x802AA660; // rom:0x42BB50 -battle_action_cmd_water_block_block_pal = 0x802AA860; // rom:0x42BD50 -battle_action_cmd_water_block_circle_png = 0x802AA880; // rom:0x42BD70 -battle_action_cmd_water_block_circle_pal = 0x802AABA0; // rom:0x42C090 -battle_action_cmd_water_block_cloud_png = 0x802AABC0; // rom:0x42C0B0 -battle_action_cmd_water_block_cloud_pal = 0x802AAEE0; // rom:0x42C3D0 -battle_action_cmd_water_block_4_png = 0x802AAF00; // rom:0x42C3F0 -battle_action_cmd_water_block_4_pal = 0x802AB020; // rom:0x42C510 -HES_WaterBlock1 = 0x802AB040; // rom:0x42C530 -HES_WaterBlock2 = 0x802AB068; // rom:0x42C558 -HES_WaterBlock3 = 0x802AB090; // rom:0x42C580 -HES_WaterBlock0 = 0x802AB0B8; // rom:0x42C5A8 -HES_WaterBlock4 = 0x802AB0E0; // rom:0x42C5D0 -HES_WaterBlockBlock = 0x802AB108; // rom:0x42C5F8 -HES_WaterBlockCircle = 0x802AB130; // rom:0x42C620 -HES_WaterBlockCloud = 0x802AB158; // rom:0x42C648 -D_802AB180_42C670 = 0x802AB180; // rom:0x42C670 -D_802AB184_42C674 = 0x802AB184; // rom:0x42C674 +action_command_squirt_FillRateTable = 0x802A9778; // rom:0x42A498 +action_command_three_chances_init = 0x802A9000; // type:func rom:0x42A4F0 +action_command_three_chances_start = 0x802A9398; // type:func rom:0x42A888 +action_command_three_chances_update = 0x802A948C; // type:func rom:0x42A97C +action_command_three_chances_draw = 0x802AA014; // type:func rom:0x42B504 +action_command_three_chances_free = 0x802AA0D8; // type:func rom:0x42B5C8 +battle_action_cmd_three_chances_1_png = 0x802AA160; // rom:0x42B650 +battle_action_cmd_three_chances_1_pal = 0x802AA280; // rom:0x42B770 +battle_action_cmd_three_chances_2_png = 0x802AA2A0; // rom:0x42B790 +battle_action_cmd_three_chances_2_pal = 0x802AA3C0; // rom:0x42B8B0 +battle_action_cmd_three_chances_3_png = 0x802AA3E0; // rom:0x42B8D0 +battle_action_cmd_three_chances_3_pal = 0x802AA500; // rom:0x42B9F0 +battle_action_cmd_three_chances_0_png = 0x802AA520; // rom:0x42BA10 +battle_action_cmd_three_chances_0_pal = 0x802AA640; // rom:0x42BB30 +battle_action_cmd_three_chances_block_png = 0x802AA660; // rom:0x42BB50 +battle_action_cmd_three_chances_block_pal = 0x802AA860; // rom:0x42BD50 +battle_action_cmd_three_chances_circle_png = 0x802AA880; // rom:0x42BD70 +battle_action_cmd_three_chances_circle_pal = 0x802AABA0; // rom:0x42C090 +battle_action_cmd_three_chances_cloud_png = 0x802AABC0; // rom:0x42C0B0 +battle_action_cmd_three_chances_cloud_pal = 0x802AAEE0; // rom:0x42C3D0 +battle_action_cmd_three_chances_4_png = 0x802AAF00; // rom:0x42C3F0 +battle_action_cmd_three_chances_4_pal = 0x802AB020; // rom:0x42C510 +HES_Digit1 = 0x802AB040; // rom:0x42C530 +HES_Digit2 = 0x802AB068; // rom:0x42C558 +HES_Digit3 = 0x802AB090; // rom:0x42C580 +HES_Digit0 = 0x802AB0B8; // rom:0x42C5A8 +HES_Digit4 = 0x802AB0E0; // rom:0x42C5D0 +HES_WaterBlock = 0x802AB108; // rom:0x42C5F8 +HES_TurboCharge = 0x802AB130; // rom:0x42C620 +HES_CloudNine = 0x802AB158; // rom:0x42C648 +DigitScripts = 0x802AB180; // rom:0x42C670 action_command_tidal_wave_init = 0x802A9000; // type:func rom:0x42C6F0 action_command_tidal_wave_start = 0x802A9138; // type:func rom:0x42C828 action_command_tidal_wave_update = 0x802A9228; // type:func rom:0x42C918 @@ -9244,46 +9243,44 @@ action_command_power_shock_start = 0x802A9210; // type:func rom:0x42D120 action_command_power_shock_update = 0x802A9310; // type:func rom:0x42D220 action_command_power_shock_draw = 0x802A98D0; // type:func rom:0x42D7E0 action_command_power_shock_free = 0x802A9A54; // type:func rom:0x42D964 -D_802A9AA0_42D9B0 = 0x802A9AA0; // rom:0x42D9B0 +action_command_power_shock_DrainRateTable = 0x802A9AA0; // rom:0x42D9B0 D_802A9AA2_42D9B2 = 0x802A9AA2; // rom:0x42D9B2 action_command_mega_shock_init = 0x802A9000; // type:func rom:0x42DA10 action_command_mega_shock_start = 0x802A91A0; // type:func rom:0x42DBB0 action_command_mega_shock_update = 0x802A92A0; // type:func rom:0x42DCB0 action_command_mega_shock_draw = 0x802A97F8; // type:func rom:0x42E208 action_command_mega_shock_free = 0x802A98E0; // type:func rom:0x42E2F0 -D_802A9930_42E340 = 0x802A9930; // rom:0x42E340 +action_command_mega_shock_DrainRateTable = 0x802A9930; // rom:0x42E340 D_802A9932_42E342 = 0x802A9932; // rom:0x42E342 action_command_smack_init = 0x802A9000; // type:func rom:0x42E3A0 action_command_smack_start = 0x802A917C; // type:func rom:0x42E51C action_command_smack_update = 0x802A9298; // type:func rom:0x42E638 action_command_smack_draw = 0x802A98B0; // type:func rom:0x42EC50 action_command_smack_free = 0x802A9990; // type:func rom:0x42ED30 -D_802A99D2_42ED72 = 0x802A99D2; // rom:0x42ED70 -D_802A99E4_42ED84 = 0x802A99E4; // rom:0x42ED84 -D_802A99F4_42ED94 = 0x802A99F4; // rom:0x42ED94 -D_802A9A08_42EDA8 = 0x802A9A08; // rom:0x42EDA8 -D_802A9A20_42EDC0 = 0x802A9A20; // rom:0x42EDC0 +action_command_smack_DrainRateTable = 0x802A99D2; // rom:0x42ED70 +action_command_smack_BasicHitThresholds = 0x802A99E4; // rom:0x42ED84 +action_command_smack_SuperHitThresholds = 0x802A99F4; // rom:0x42ED94 +action_command_smack_UltraHitThresholds = 0x802A9A08; // rom:0x42EDA8 +action_command_smack_FanHitThresholds = 0x802A9A20; // rom:0x42EDC0 action_command_spiny_surge_init = 0x802A9000; // type:func rom:0x42EE20 action_command_spiny_surge_start = 0x802A916C; // type:func rom:0x42EF8C action_command_spiny_surge_update = 0x802A9254; // type:func rom:0x42F074 action_command_spiny_surge_draw = 0x802A973C; // type:func rom:0x42F55C action_command_spiny_surge_free = 0x802A981C; // type:func rom:0x42F63C -D_802A9860_42F680 = 0x802A9860; // rom:0x42F680 -D_802A9862_42F682 = 0x802A9862; // rom:0x42F682 +action_command_spiny_surge_DrainRateTable = 0x802A9860; // rom:0x42F680 action_command_hurricane_init = 0x802A9000; // type:func rom:0x42F6E0 action_command_hurricane_start = 0x802A91A0; // type:func rom:0x42F880 action_command_hurricane_update = 0x802A92A0; // type:func rom:0x42F980 action_command_hurricane_draw = 0x802A97AC; // type:func rom:0x42FE8C action_command_hurricane_free = 0x802A9894; // type:func rom:0x42FF74 -D_802A98E0_42FFC0 = 0x802A98E0; // rom:0x42FFC0 +action_command_hurricane_DrainRateTable = 0x802A98E0; // rom:0x42FFC0 D_802A98E2_42FFC2 = 0x802A98E2; // rom:0x42FFC2 action_command_spook_init = 0x802A9000; // type:func rom:0x430020 action_command_spook_start = 0x802A917C; // type:func rom:0x43019C action_command_spook_update = 0x802A9298; // type:func rom:0x4302B8 action_command_spook_draw = 0x802A97FC; // type:func rom:0x43081C action_command_spook_free = 0x802A98DC; // type:func rom:0x4308FC -D_802A9920_430940 = 0x802A9920; // rom:0x430940 -D_802A9922_430942 = 0x802A9922; // rom:0x430942 +action_command_spook_DrainRateTable = 0x802A9920; // rom:0x430940 b_area_kmr_part_1_goomba_ArcsinDeg = 0x80218000; // type:func rom:0x4309A0 b_area_kmr_part_1_goomba_CalculateRotationZ = 0x8021818C; // type:func rom:0x430B2C b_area_kmr_part_1_spiked_goomba_ArcsinDeg = 0x80218280; // type:func rom:0x430C20 @@ -10801,7 +10798,7 @@ b_area_iwa_Formation_08 = 0x802183EC; // rom:0x4D05DC b_area_iwa_Formation_09 = 0x8021845C; // rom:0x4D064C b_area_iwa_Formation_0A = 0x80218494; // rom:0x4D0684 b_area_iwa_Formation_0B = 0x802184E8; // rom:0x4D06D8 -b_area_iwa_vector3D_8021853C = 0x8021853C; // rom:0x4D072C +b_area_iwa_BossPos = 0x8021853C; // rom:0x4D072C b_area_iwa_Formation_0C = 0x80218548; // rom:0x4D0738 b_area_iwa_Formation_0D = 0x80218564; // rom:0x4D0754 b_area_iwa_Formations = 0x802185B8; // rom:0x4D07A8 @@ -14477,7 +14474,7 @@ battle_move_sleep_stomp_CalcJumpReboundTime = 0x802A1000; // type:func rom:0x746 battle_move_dizzy_stomp_CalcJumpReboundTime = 0x802A1000; // type:func rom:0x748DD0 battle_move_d_down_pound_IsBerserkerEquipped = 0x802A1000; // type:func rom:0x74AD90 battle_move_d_down_pound_ShouldMovesAutoSucceed = 0x802A1050; // type:func rom:0x74ADE0 -func_802A10A4_74AE34 = 0x802A10A4; // type:func rom:0x74AE34 +battle_move_d_down_pound_MakeGreenImpactFX = 0x802A10A4; // type:func rom:0x74AE34 battle_move_jump_charge_0_CalcJumpReboundTime = 0x802A1000; // type:func rom:0x74D570 battle_move_jump_charge_0_IsJumpMaxCharged = 0x802A10E4; // type:func rom:0x74D654 func_802A1108_74D678 = 0x802A1108; // type:func rom:0x74D678 @@ -14502,7 +14499,7 @@ battle_move_jump_charge_1_CalcJumpReboundTime = 0x802A1000; // type:func rom:0x7 battle_move_jump_charge_1_IsJumpMaxCharged = 0x802A10E4; // type:func rom:0x75CA64 func_802A1108_75CA88 = 0x802A1108; // type:func rom:0x75CA88 battle_move_jump_charge_1_UnkMoveFunc2 = 0x802A1228; // type:func rom:0x75CBA8 -func_802A133C_75CCBC = 0x802A133C; // type:func rom:0x75CCBC +battle_move_jump_charge_1_GetChargeMessage = 0x802A133C; // type:func rom:0x75CCBC battle_move_hammer_charge_2_IsBerserkerEquipped = 0x802A1000; // type:func rom:0x75E5D0 battle_move_hammer_charge_2_ShouldMovesAutoSucceed = 0x802A1050; // type:func rom:0x75E620 battle_move_hammer_charge_2_IsHammerMaxCharged = 0x802A10A4; // type:func rom:0x75E674 @@ -14511,9 +14508,9 @@ battle_move_hammer_charge_2_UnkMoveFunc3 = 0x802A11E8; // type:func rom:0x75E7B8 func_802A12FC_75E8CC = 0x802A12FC; // type:func rom:0x75E8CC battle_move_jump_charge_2_CalcJumpReboundTime = 0x802A1000; // type:func rom:0x761920 battle_move_jump_charge_2_IsJumpMaxCharged = 0x802A10E4; // type:func rom:0x761A04 -func_802A1108_761A28 = 0x802A1108; // type:func rom:0x761A28 +battle_move_jump_charge_2_func_802A1108_761A28 = 0x802A1108; // type:func rom:0x761A28 battle_move_jump_charge_2_UnkMoveFunc3 = 0x802A1228; // type:func rom:0x761B48 -func_802A133C_761C5C = 0x802A133C; // type:func rom:0x761C5C +battle_move_jump_charge_2_GetChargeMessage = 0x802A133C; // type:func rom:0x761C5C battle_move_auto_smash_IsBerserkerEquipped = 0x802A1000; // type:func rom:0x763540 battle_move_auto_smash_ShouldMovesAutoSucceed = 0x802A1050; // type:func rom:0x763590 battle_move_auto_jump_CalcJumpReboundTime = 0x802A1000; // type:func rom:0x765C20 @@ -14574,7 +14571,7 @@ battle_move_shell_crack_IsBerserkerEquipped = 0x802A1000; // type:func rom:0x77F battle_move_shell_crack_ShouldMovesAutoSucceed = 0x802A1050; // type:func rom:0x77F290 func_802A10A4_77F2E4 = 0x802A10A4; // type:func rom:0x77F2E4 battle_move_d_down_jump_CalcJumpReboundTime = 0x802A1000; // type:func rom:0x781920 -func_802A10E4_781A04 = 0x802A10E4; // type:func rom:0x781A04 +battle_move_d_down_jump_SpawnImpactFX = 0x802A10E4; // type:func rom:0x781A04 battle_move_shrink_stomp_CalcJumpReboundTime = 0x802A1000; // type:func rom:0x783BA0 battle_move_earthquake_jump_CalcJumpReboundTime = 0x802A1000; // type:func rom:0x785B20 func_802A10E4_785C04 = 0x802A10E4; // type:func rom:0x785C04 @@ -25821,7 +25818,7 @@ gPauseDescTextPos = 0x80270110; // gPauseDescTextOffset = 0x80270114; // gPauseShownDescIconScript = 0x80270118; // gPauseTutorialSprites = 0x8027011C; // -gPauseTabsIconIDs = 0x80270130; // +gPauseTabsHIDs = 0x80270130; // gPauseTabsPreviousTab = 0x80270148; // gPauseTabsHorizScrollPos = 0x8027014C; // gPauseStatsIconIDs = 0x80270150; // @@ -25857,8 +25854,8 @@ gPauseItemsTargetScrollPos = 0x802705D8; // gPauseItemsTargetScrollIndex = 0x802705DC; // gPauseItemsLevel = 0x802705E0; // gPauseItemsCurrentTab = 0x802705E4; // -gPauseItemsIconIDs = 0x802705E8; // -gPausePartnersIconIDs = 0x80270640; // +gPauseItemsHIDs = 0x802705E8; // +gPausePartnersHIDs = 0x80270640; // gPausePartnersSpriteIDs = 0x80270660; // gPausePartnersPartnerIdx = 0x80270680; // gPausePartnersCurrentPartnerIdx = 0x802706A0; // @@ -25947,7 +25944,7 @@ SavedWorldCameras = 0x8029DA50; // SavedWorldPlayerPosX = 0x8029EFB0; // SavedWorldPlayerPosY = 0x8029EFB4; // SavedWorldPlayerPosZ = 0x8029EFB8; // -D_8029EFBC = 0x8029EFBC; // +HPBarHID = 0x8029EFBC; // BtlStarPointTensHIDs = 0x8029EFC0; // BtlStarPointShinesHIDs = 0x8029EFE8; // BtlStarPointOnesHIDs = 0x8029F010; // @@ -26136,8 +26133,8 @@ D_802AD610 = 0x802AD610; // D_802AD612 = 0x802AD612; // D_802AD614 = 0x802AD614; // D_802AD618 = 0x802AD618; // -GreenArrowUpID = 0x802AD61C; // -GreenArrowDownID = 0x802AD620; // +HID_GreenArrowUp = 0x802AD61C; // +HID_GreenArrowDown = 0x802AD620; // D_802AD624 = 0x802AD624; // D_802AD628 = 0x802AD628; // D_802AD63C = 0x802AD63C; // diff --git a/ver/us/undefined_syms.txt b/ver/us/undefined_syms.txt index 5f175ad2404..76f8a6d1dc2 100644 --- a/ver/us/undefined_syms.txt +++ b/ver/us/undefined_syms.txt @@ -181,7 +181,7 @@ dead_set_aux_pan_v = set_aux_pan_v + 0xA448; dead_mdl_get_copied_vertices = mdl_get_copied_vertices + 0xA448; dead_mdl_get_copied_gfx = mdl_get_copied_gfx + 0xA448; dead_queue_render_task = queue_render_task + 0xAC00; -dead_create_worker_world = create_worker_world + 0xAE90; +dead_create_worker_scene = create_worker_scene + 0xAE90; dead_set_message_images = set_message_images + 0xB138; dead_set_message_text_var = set_message_text_var + 0xB138; dead_get_item_entity = get_item_entity + 0xC040;