enemy+npc flags (#946)

* npc flags 1

* enemy & npc flags

* removed item headers

* minor item cleanup

* coverage

---------

Co-authored-by: HailSanta <Hail2Santa@gmail.com>
This commit is contained in:
HailSanta 2023-02-18 03:13:07 -05:00 committed by GitHub
parent f033bbae6d
commit e55556ddcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
604 changed files with 3576 additions and 4479 deletions

View File

@ -192,13 +192,22 @@ typedef struct NpcHistoryPoint {
/* 0x04 */ Vec3f pos;
} NpcHistoryPoint; // size = 0x10
typedef struct FollowAnims {
/* 0x00 */ AnimID walk;
/* 0x04 */ AnimID jump;
/* 0x08 */ AnimID fall;
/* 0x0C */ AnimID land;
/* 0x10 */ AnimID idle;
/* 0x14 */ AnimID run;
} FollowAnims; // size = 0x18
typedef struct NpcFollowData {
/* 0x000 */ NpcHistoryPoint moveHistory[40];
/* 0x280 */ s32 lastPointIdx;
/* 0x284 */ s32 targetPointIdx;
/* 0x288 */ s32 followState;
/* 0x28C */ s32 targetNpcID;
/* 0x290 */ s32* animIDs;
/* 0x290 */ FollowAnims* anims;
/* 0x294 */ f32 walkSpeed;
/* 0x298 */ f32 runSpeed;
/* 0x29C */ f32 idleRadius;

View File

@ -1,60 +0,0 @@
#ifndef _DEAD_STRUCTS_H_
#define _DEAD_STRUCTS_H_
#include "common_structs.h"
#include "enums.h"
#include "script_api/map.h"
typedef struct DeadEnemy {
/* 0x000 */ s32 flags;
/* 0x004 */ s8 encounterIndex;
/* 0x005 */ s8 encountered;
/* 0x006 */ u8 scriptGroup; /* scripts launched for this npc controller will be assigned this group */
/* 0x007 */ s8 unk_07;
/* 0x008 */ s16 npcID;
/* 0x00A */ s16 spawnPos[3];
/* 0x010 */ Vec3s unk_10;
/* 0x016 */ char unk_16[2];
/* 0x018 */ struct NpcSettings* npcSettings;
/* 0x01C */ EvtScript* initBytecode;
/* 0x020 */ EvtScript* interactBytecode;
/* 0x024 */ EvtScript* aiBytecode;
/* 0x028 */ EvtScript* hitBytecode;
/* 0x02C */ EvtScript* auxBytecode;
/* 0x030 */ EvtScript* defeatBytecode;
/* 0x034 */ struct Evt* initScript;
/* 0x038 */ struct Evt* interactScript;
/* 0x03C */ struct Evt* aiScript;
/* 0x040 */ struct Evt* hitScript;
/* 0x044 */ struct Evt* auxScript;
/* 0x048 */ struct Evt* defeatScript;
/* 0x04C */ s32 initScriptID;
/* 0x050 */ s32 interactScriptID;
/* 0x054 */ s32 aiScriptID;
/* 0x058 */ s32 hitScriptID;
/* 0x05C */ s32 auxScriptID;
/* 0x060 */ s32 defeatScriptID;
/* 0x064 */ void* unk_64;
/* 0x068 */ char unk_68[4];
/* 0x06C */ s32 varTable[16];
/* 0x0AC */ s32 aiDetectFlags;
/* 0x0B0 */ s32 aiFlags;
/* 0x0B4 */ s8 aiSuspendTime;
/* 0x0B5 */ s8 instigatorValue;
/* 0x0B6 */ char unk_B6[2];
/* 0x0B8 */ EvtScript* unk_B8; // some bytecode
/* 0x0BC */ struct Evt* unk_BC; // some script
/* 0x0C0 */ s32 unk_C0; // some script ID
/* 0x0C4 */ s32 unk_C4;
/* 0x0C8 */ s32 unk_C8;
/* 0x0CC */ s32* animList;
/* 0x0D0 */ EnemyTerritory* territory;
/* 0x0D4 */ EnemyDrops* drops;
/* 0x0D8 */ u32 tattleMsg;
/* 0x0DC */ char unk_DC[42];
/* 0x108 */ Vec3f unk_108; // Associated NPC Pos?
/* 0x114 */ f32 unk_114;
/* 0x118 */ f32 unk_118;
} DeadEnemy; // size = 0x11C
#endif

View File

@ -3450,41 +3450,38 @@ enum NpcPalSwapState {
};
enum NpcFlags {
NPC_FLAG_1 = 0x00000001,
NPC_FLAG_2 = 0x00000002,
NPC_FLAG_4 = 0x00000004,
NPC_FLAG_8 = 0x00000008,
NPC_FLAG_HAS_SHADOW = 0x00000010, ///< Set by default and by enable_npc_shadow
NPC_FLAG_20 = 0x00000020,
NPC_FLAG_IGNORE_WORLD_COLLISION = 0x00000040,
NPC_FLAG_UPSIDE_DOWN = 0x00000080, ///< Render NPCs upside-down
NPC_FLAG_100 = 0x00000100, // TODO
NPC_FLAG_GRAVITY = 0x00000200, ///< Enables gravity. Does nothing if NPC_FLAG_JUMPING is set.
NPC_FLAG_LOCK_ANIMS = 0x00000400, ///< Do not allow scripts to change animation
NPC_FLAG_JUMPING = 0x00000800, ///< Causes NpcMoveTo() to ignore stairs
NPC_FLAG_1000 = 0x00001000,
NPC_FLAG_NO_PROJECT_SHADOW = 0x00002000, ///< Draw shadow at base of sprite instead of projecting to ground
NPC_FLAG_4000 = 0x00004000,
NPC_FLAG_8000 = 0x00008000,
NPC_FLAG_DIRTY_SHADOW = 0x00010000, ///< Set if shadow model is dirty (needs to be repositioned etc.)
NPC_FLAG_REFLECT_WALL = 0x00020000, ///< Mirror rendering across z=0
NPC_FLAG_40000 = 0x00040000, ///< Yaw?
NPC_FLAG_REFLECT_FLOOR = 0x00080000, ///< Mirror rendering across y=0
NPC_FLAG_MOTION_BLUR = 0x00100000, ///< Gives motion blur effect as NPC moves. Set by enable_npc_blur
NPC_FLAG_200000 = 0x00200000,
NPC_FLAG_400000 = 0x00400000,
NPC_FLAG_HIDING = 0x00800000,
NPC_FLAG_1000000 = 0x01000000, // TODO. fails assert in set_npc_sprite
NPC_FLAG_SIMPLIFIED_PHYSICS = 0x02000000,
/// Use simpler, faster physics calculations:
/// - Perform only one lateral collision test during motion
/// - Allow falling below Y=-2000 (by default, NPC_FLAG_JUMPING is set when an NPC falls out-of-bounds)
NPC_FLAG_PARTICLE = 0x04000000,
NPC_FLAG_WORLD_COLLISION_DIRTY = 0x08000000,
NPC_FLAG_10000000 = 0x10000000,
NPC_FLAG_20000000 = 0x20000000,
NPC_FLAG_NO_ANIMS_LOADED = 0x40000000, ///< Npc has no animations loaded
NPC_FLAG_80000000 = 0x80000000,
NPC_FLAG_ENABLED = 0x00000001, // Does nothing aside from making npc->flags !=
NPC_FLAG_INVISIBLE = 0x00000002, // NPC will not be drawn or cause surface effects while moving
NPC_FLAG_INACTIVE = 0x00000004, // NPC will not render, move, or have collisions with other NPCs. They may still be interacted with.
NPC_FLAG_8 = 0x00000008,
NPC_FLAG_HAS_SHADOW = 0x00000010, // Set by default and by enable_npc_shadow
NPC_FLAG_NO_SHADOW_RAYCAST = 0x00000020, // Shadows are tied to NPC position instead of raycasting below the NPC
NPC_FLAG_IGNORE_WORLD_COLLISION = 0x00000040,
NPC_FLAG_UPSIDE_DOWN = 0x00000080, // Render NPCs upside-down
NPC_FLAG_IGNORE_PLAYER_COLLISION = 0x00000100,
NPC_FLAG_GRAVITY = 0x00000200, // Enables gravity. Does nothing if NPC_FLAG_JUMPING is set.
NPC_FLAG_DONT_UPDATE_SHADOW_Y = 0x00000400, // When shadow raycasting is off, only X and Z update as NPC moves
NPC_FLAG_JUMPING = 0x00000800,
NPC_FLAG_FALLING = 0x00001000,
NPC_FLAG_COLLDING_WITH_WORLD = 0x00002000, // Colliding with world in front or to the sides of the NPC
NPC_FLAG_COLLDING_FORWARD_WITH_WORLD = 0x00004000, // Colliding with world directly in front of NPC
NPC_FLAG_IGNORE_ENTITY_COLLISION = 0x00008000,
NPC_FLAG_DIRTY_SHADOW = 0x00010000, // Set if shadow is dirty (needs to be repositioned etc.)
NPC_FLAG_REFLECT_WALL = 0x00020000, // Mirror rendering across z=0
NPC_FLAG_IGNORE_CAMERA_FOR_YAW = 0x00040000, // Do not adjust renderYaw to face the camera
NPC_FLAG_REFLECT_FLOOR = 0x00080000, // Mirror rendering across y=0
NPC_FLAG_MOTION_BLUR = 0x00100000, // Gives motion blur effect as NPC moves. Set by enable_npc_blur
NPC_FLAG_200000 = 0x00200000,
NPC_FLAG_TOUCHES_GROUND = 0x00400000, // Can cause effects to play when touching special surface types
NPC_FLAG_HIDING = 0x00800000,
NPC_FLAG_HAS_NO_SPRITE = 0x01000000,
NPC_FLAG_COLLIDING_WITH_NPC = 0x02000000,
NPC_FLAG_PARTNER = 0x04000000,
NPC_FLAG_WORLD_COLLISION_DIRTY = 0x08000000,
NPC_FLAG_10000000 = 0x10000000,
NPC_FLAG_20000000 = 0x20000000,
NPC_FLAG_NO_ANIMS_LOADED = 0x40000000, // Npc has no animations loaded
NPC_FLAG_SUSPENDED = 0x80000000,
};
enum PlayerStatusFlags {
@ -3524,7 +3521,7 @@ enum PlayerStatusFlags {
/* Forces Mario's sprite to either face exactly left or right, without transitioning. */
PS_FLAG_NO_FLIPPING = 0x00200000,
/* Prevents Mario from moving laterally */
PS_FLAG_MOVEMENT_LOCKED = 0x00400000,
PS_FLAG_MOVEMENT_LOCKED = 0x00400000, //TODO misnamed
/* Stops Mario from air steering or using a special jump during a scripted fall */
PS_FLAG_SCRIPTED_FALL = 0x00800000,
/* Not fully sure about this one, but appears to mark the frame that the check for what to hammer occurs */
@ -5015,45 +5012,45 @@ enum MapRoomNotifications {
};
enum EnemyFlags {
ENEMY_FLAG_PASSIVE = 0x00000001, ///< Collision does not trigger battle
ENEMY_FLAG_2 = 0x00000002,
ENEMY_FLAG_4 = 0x00000004,
ENEMY_FLAG_ENABLE_HIT_SCRIPT = 0x00000008,
ENEMY_FLAG_FLED = 0x00000010,
ENEMY_FLAG_DISABLE_AI = 0x00000020, ///< Disable movement AI and collision (idle animation plays)
ENEMY_FLAG_40 = 0x00000040,
ENEMY_FLAG_80 = 0x00000080,
ENEMY_FLAG_100 = 0x00000100,
ENEMY_FLAG_200 = 0x00000200,
ENEMY_FLAG_400 = 0x00000400,
ENEMY_FLAG_800 = 0x00000800,
ENEMY_FLAG_GRAVITY = 0x00001000,
ENEMY_FLAG_2000 = 0x00002000,
ENEMY_FLAG_4000 = 0x00004000,
ENEMY_FLAG_8000 = 0x00008000,
ENEMY_FLAG_10000 = 0x00010000,
ENEMY_FLAG_USE_PLAYER_SPRITE = 0x00020000, ///< Used for Peach NPCs
ENEMY_FLAG_40000 = 0x00040000,
ENEMY_FLAG_80000 = 0x00080000,
ENEMY_FLAG_100000 = 0x00100000,
ENEMY_FLAG_200000 = 0x00200000,
ENEMY_FLAG_400000 = 0x00400000,
ENEMY_FLAG_NO_DROPS = 0x00800000, ///< Do not drop hearts, flowers, or coins on defeat
ENEMY_FLAG_IGNORE_TOUCH = 0x01000000,
ENEMY_FLAG_IGNORE_JUMP = 0x02000000,
ENEMY_FLAG_IGNORE_HAMMER = 0x04000000,
ENEMY_FLAG_8000000 = 0x08000000,
ENEMY_FLAG_10000000 = 0x10000000,
ENEMY_FLAG_20000000 = 0x20000000,
ENEMY_FLAG_40000000 = 0x40000000, // spawn in AI_STATE_CHASE_INIT
ENEMY_FLAG_80000000 = 0x80000000,
ENEMY_FLAG_PASSIVE = 0x00000001, // Not hostile; collision does not trigger battle
ENEMY_FLAG_2 = 0x00000002, // Unused
ENEMY_FLAG_4 = 0x00000004,
ENEMY_FLAG_ENABLE_HIT_SCRIPT = 0x00000008,
ENEMY_FLAG_FLED = 0x00000010,
ENEMY_FLAG_DISABLE_AI = 0x00000020, // Disable movement AI and collision (idle animation plays)
ENEMY_FLAG_PROJECTILE = 0x00000040,
ENEMY_FLAG_DONT_UPDATE_SHADOW_Y = 0x00000080,
ENEMY_FLAG_IGNORE_WORLD_COLLISION = 0x00000100,
ENEMY_FLAG_IGNORE_PLAYER_COLLISION = 0x00000200,
ENEMY_FLAG_IGNORE_ENTITY_COLLISION = 0x00000400,
ENEMY_FLAG_800 = 0x00000800, // Corresponds with NPC_FLAG_8
ENEMY_FLAG_GRAVITY = 0x00001000,
ENEMY_FLAG_NO_SHADOW_RAYCAST = 0x00002000,
ENEMY_FLAG_HAS_NO_SPRITE = 0x00004000,
ENEMY_FLAG_8000 = 0x00008000, // Corresponds with NPC_FLAG_10000000
ENEMY_FLAG_10000 = 0x00010000, // Corresponds with NPC_FLAG_20000000
ENEMY_FLAG_USE_PLAYER_SPRITE = 0x00020000, // Used for Peach NPCs
ENEMY_FLAG_40000 = 0x00040000,
ENEMY_FLAG_80000 = 0x00080000,
ENEMY_FLAG_100000 = 0x00100000,
ENEMY_FLAG_ACTIVE_WHILE_OFFSCREEN = 0x00200000,
ENEMY_FLAG_400000 = 0x00400000,
ENEMY_FLAG_NO_DROPS = 0x00800000, // Do not drop hearts, flowers, or coins on defeat
ENEMY_FLAG_IGNORE_TOUCH = 0x01000000,
ENEMY_FLAG_IGNORE_JUMP = 0x02000000,
ENEMY_FLAG_IGNORE_HAMMER = 0x04000000,
ENEMY_FLAG_CANT_INTERACT = 0x08000000, // Makes passive NPCs non-interactable. Hostile NPCs are always non-interactible.
ENEMY_FLAG_IGNORE_PARTNER = 0x10000000,
ENEMY_FLAG_IGNORE_SPIN = 0x20000000,
ENEMY_FLAG_BEGIN_WITH_CHASING = 0x40000000, // Starts in state AI_STATE_CHASE_INIT instead of AI_STATE_WANDER_INIT on spawn or AI resume
ENEMY_FLAG_SUSPENDED = 0x80000000,
};
#define COMMON_PASSIVE_FLAGS \
ENEMY_FLAG_PASSIVE \
| ENEMY_FLAG_ENABLE_HIT_SCRIPT \
| ENEMY_FLAG_100 \
| ENEMY_FLAG_400 \
| ENEMY_FLAG_IGNORE_WORLD_COLLISION \
| ENEMY_FLAG_IGNORE_ENTITY_COLLISION \
| ENEMY_FLAG_800
// used with enemy->aiFlags

View File

@ -376,7 +376,7 @@ void btl_draw_upgrade_windows(s32);
void btl_state_draw_celebration(void);
void func_8024F7C8(void);
void func_80263E08(Actor*, ActorPart*, s32);
void func_80263E08(Actor*, ActorPart*, AnimID);
void func_80266978(void);
void func_80266B14(void);
s32 btl_cam_is_moving_done(void);
@ -446,7 +446,7 @@ void set_npc_shadow_scale(Shadow* shadow, f32 height, f32 npcRadius);
void set_npc_animation(Npc* npc, u32 animID);
void set_peach_shadow_scale(Shadow* shadow, f32 scale);
s32 is_block_on_ground(Entity* block);
void set_animation(s32 actorID, s32, s32 animationIndex);
void set_animation(s32 actorID, s32 partID, AnimID animID);
void set_animation_rate(s32 actorID, s32 partID, f32 rate);
void set_model_flags(u16, s32, s32);
void init_enter_world_shared(void);
@ -1025,7 +1025,7 @@ void sync_status_menu(void);
void create_cameras_a(void);
void func_80045AC0(void);
void func_8005AF84(void);
void npc_follow_init(Npc*, s32, s32*, f32, f32, s32, s32);
void npc_follow_init(Npc*, s32, FollowAnims*, f32, f32, s32, s32);
void npc_update_npc_tracking(Npc*);
void npc_follow_npc(Npc*);
void create_encounters(void);

View File

@ -305,10 +305,10 @@ typedef struct Enemy {
/* 0x04 */ s8 encounterIndex;
/* 0x05 */ s8 encountered;
/* 0x06 */ u8 scriptGroup; /* scripts launched for this npc controller will be assigned this group */
/* 0x07 */ s8 unk_07;
/* 0x07 */ s8 hitboxIsActive; // when set, contact will trigger a first strike
/* 0x08 */ s16 npcID;
/* 0x0A */ s16 spawnPos[3];
/* 0x10 */ Vec3s unk_10;
/* 0x10 */ Vec3s unk_10; //TODO hitbox pos?
/* 0x16 */ char unk_16[2];
/* 0x18 */ NpcSettings* npcSettings;
/* 0x1C */ EvtScript* initBytecode;
@ -352,9 +352,15 @@ typedef struct Enemy {
/* 0xD4 */ EnemyDrops* drops;
/* 0xD8 */ u32 tattleMsg;
/* 0xDC */ s32 unk_DC;
/* 0xE0 */ s16 unk_E0;
/* 0xE0 */ s16 savedNpcYaw;
/* 0xE2 */ char unk_E2[6];
} Enemy; // size = 0xE8
#ifdef _DEAD_H_
/* 0x0DC */ char unk_E8[32];
/* 0x108 */ Vec3f unk_108; // Associated NPC Pos?
/* 0x114 */ f32 unk_114;
/* 0x118 */ f32 unk_118;
#endif
} Enemy; // size = 0xE8, dead size = 0x11C
typedef struct Encounter {
/* 0x00 */ s32 count;
@ -457,7 +463,7 @@ s32 npc_do_player_collision(Npc* npc);
void npc_do_gravity(Npc* npc);
s32 func_800397E8(Npc* npc, f32 arg1);
s32 func_800397E8(Npc* npc, f32 velocity);
/// Updates all NPCs.
void update_npcs(void);
@ -558,8 +564,8 @@ void npc__reset_current_decoration(Npc* npc, s32 idx);
/// Finds the closest NPC to a given point within a radius. Ignores Y position.
///
/// NPCs with NPC_FLAG_PARTICLE set are ignored.
/// See also npc_find_closest_simple(), which requires that NPC_FLAG_PARTICLE be set.
/// NPCs with NPC_FLAG_PARTNER set are ignored.
/// See also npc_find_closest_simple(), which requires that NPC_FLAG_PARTNER be set.
///
/// @param x X position
/// @param y Y position (unused)
@ -571,8 +577,8 @@ Npc* npc_find_closest(f32 x, f32 y, f32 z, f32 radius);
/// Finds the closest simple-hitbox NPC to a given point within a radius. Ignores Y position.
///
/// Only NPCs with NPC_FLAG_PARTICLE set are considered.
/// See also npc_find_closest(), which requires that NPC_FLAG_PARTICLE be unset.
/// Only NPCs with NPC_FLAG_PARTNER set are considered.
/// See also npc_find_closest(), which requires that NPC_FLAG_PARTNER be unset.
///
/// @param x X position
/// @param y Y position (unused)

View File

@ -27,6 +27,7 @@ ApiStatus WaitForMessageBoxDone(Evt* script, s32 isInitialCall);
ApiStatus ForceCloseMessageBox(Evt* script, s32 isInitialCall);
ApiStatus SetMessageBoxDuration(Evt* script, s32 isInitialCall);
ApiStatus ItemDamageEnemy(Evt* script, s32 isInitialCall);
ApiStatus ItemAfflictEnemy(Evt* script, s32 isInitialCall);
ApiStatus ItemSpookEnemy(Evt* script, s32 isInitialCall);
ApiStatus ItemCheckHit(Evt* script, s32 isInitialCall);
ApiStatus ActorSpeak(Evt* script, s32 isInitialCall);
@ -53,7 +54,6 @@ ApiStatus IncrementPlayerHP(Evt* script, s32 isInitialCall);
ApiStatus IncrementPlayerFP(Evt* script, s32 isInitialCall);
ApiStatus StartRumbleWithParams(Evt* script, s32 isInitialCall);
ApiStatus LoadItemScript(Evt* script, s32 isInitialCall);
ApiStatus LoadFreeItemScript(Evt* script, s32 isInitialCall);
ApiStatus LoadMoveScript(Evt* script, s32 isInitialCall);
ApiStatus LoadBattleSection(Evt* script, s32 isInitialCall);
ApiStatus GetBattlePhase(Evt* script, s32 isInitialCall);

View File

@ -306,8 +306,11 @@ ApiStatus SetVirtualEntityRotation(Evt* script, s32 isInitialCall);
ApiStatus SetVirtualEntityJumpGravity(Evt* script, s32 isInitialCall);
ApiStatus SetVirtualEntityFlags(Evt* script, s32 isInitialCall);
ApiStatus GetVirtualEntityPosition(Evt* script, s32 isInitialCall);
ApiStatus SetVirtualEntityMoveSpeed(Evt* script, s32 isInitialCall);
ApiStatus VirtualEntityMoveTo(Evt* script, s32 isInitialCall);
ApiStatus VirtualEntityJumpTo(Evt* script, s32 isInitialCall);
ApiStatus VirtualEntityLandJump(Evt* script, s32 isInitialCall);
ApiStatus FacePlayerTowardPoint(Evt* script, s32 isInitialCall);
ApiStatus func_802D2C14(Evt* script, s32 isInitialCall);
ApiStatus ShowConsumableChoicePopup(Evt* script, s32 isInitialCall);

View File

@ -161,7 +161,7 @@ extern s32 PrevPlayerCamRelativeYaw;
extern s32 D_800F7B44;
extern f32 D_8010C938;
extern f32 D_8010C990;
extern s32 D_8010C978;
extern s32 NpcHitQueryColliderID;
extern Vec3s btl_actorHomePositions[];
extern SaveData gCurrentSaveFile;

View File

@ -33,7 +33,7 @@ void func_80260A60(void) {
if (battleStatus->flags2 & BS_FLAGS2_PEACH_BATTLE) {
actorPart->idleAnimations = bPeachIdleAnims;
set_animation(0, 0, 0xA0002);
set_animation(0, 0, ANIM_Peach_A0002);
} else if (!battleStatus->outtaSightActive) {
actorPart->idleAnimations = bMarioIdleAnims;
}
@ -63,7 +63,7 @@ ApiStatus activate_defend_command(Evt* script, s32 isInitialCall) {
deduct_current_move_fp();
gBattleStatus.flags1 |= BS_FLAGS1_PLAYER_DEFENDING;
actorPart->idleAnimations = bMarioDefendAnims;
set_animation(0, 0, 0x10014);
set_animation(0, 0, ANIM_Mario_Crouch);
return ApiStatus_DONE2;
}
@ -1568,7 +1568,7 @@ EvtScript MerleeRunOut = {
EVT_RETURN
EVT_END_IF
EVT_WAIT(15)
EVT_CALL(ShowMessageBox, 3, 60)
EVT_CALL(ShowMessageBox, BTL_MSG_03, 60)
EVT_CALL(WaitForMessageBoxDone)
EVT_RETURN
EVT_END
@ -1585,7 +1585,7 @@ EvtScript MerleeAttackBonus = {
EVT_CALL(MoveBattleCamOver, 20)
EVT_WAIT(10)
EVT_CALL(CreateNpc, -10, ANIM_BattleMerlee_Gather)
EVT_CALL(SetNpcFlagBits, NPC_BTL_MERLEE, NPC_FLAG_40000, TRUE)
EVT_CALL(SetNpcFlagBits, NPC_BTL_MERLEE, NPC_FLAG_IGNORE_CAMERA_FOR_YAW, TRUE)
EVT_CALL(SetNpcRenderMode, -10, 34)
EVT_CALL(SetNpcPos, NPC_BTL_MERLEE, 0, 65, 20)
EVT_CHILD_THREAD
@ -1634,7 +1634,7 @@ EvtScript MerleeDefenseBonus = {
EVT_CALL(MoveBattleCamOver, 20)
EVT_WAIT(10)
EVT_CALL(CreateNpc, -10, ANIM_BattleMerlee_Gather)
EVT_CALL(SetNpcFlagBits, NPC_BTL_MERLEE, NPC_FLAG_40000, TRUE)
EVT_CALL(SetNpcFlagBits, NPC_BTL_MERLEE, NPC_FLAG_IGNORE_CAMERA_FOR_YAW, TRUE)
EVT_CALL(SetNpcRenderMode, -10, 34)
EVT_CALL(SetNpcPos, NPC_BTL_MERLEE, 0, 65, 20)
EVT_CHILD_THREAD
@ -1688,7 +1688,7 @@ EvtScript MerleeExpBonus = {
EVT_CALL(MoveBattleCamOver, 20)
EVT_WAIT(10)
EVT_CALL(CreateNpc, -10, ANIM_BattleMerlee_Gather)
EVT_CALL(SetNpcFlagBits, NPC_BTL_MERLEE, NPC_FLAG_40000, TRUE)
EVT_CALL(SetNpcFlagBits, NPC_BTL_MERLEE, NPC_FLAG_IGNORE_CAMERA_FOR_YAW, TRUE)
EVT_CALL(SetNpcRenderMode, -10, 34)
EVT_CALL(SetNpcPos, NPC_BTL_MERLEE, 0, 65, 20)
EVT_CHILD_THREAD

View File

@ -967,17 +967,17 @@ void func_80263CC4(s32 arg0) {
start_script(&D_80293820, 10, 0)->varTable[0] = arg0;
}
void set_animation(s32 actorID, s32 partID, s32 animationIndex) {
if (animationIndex >= 0) {
void set_animation(s32 actorID, s32 partID, AnimID animID) {
if ((s32) animID >= 0) {
Actor* actor = get_actor(actorID);
ActorPart* part;
switch (actorID & ACTOR_CLASS_MASK) {
case ACTOR_CLASS_PLAYER:
part = &actor->partsTable[0];
if (part->currentAnimation != animationIndex) {
part->currentAnimation = animationIndex;
spr_update_player_sprite(PLAYER_SPRITE_MAIN, animationIndex, part->animationRate);
if (part->currentAnimation != animID) {
part->currentAnimation = animID;
spr_update_player_sprite(PLAYER_SPRITE_MAIN, animID, part->animationRate);
}
break;
case ACTOR_CLASS_PARTNER:
@ -991,17 +991,17 @@ void set_animation(s32 actorID, s32 partID, s32 animationIndex) {
part = &actor->partsTable[0];
}
if (part->currentAnimation != animationIndex) {
part->currentAnimation = animationIndex;
spr_update_sprite(part->spriteInstanceID, animationIndex, part->animationRate);
if (part->currentAnimation != animID) {
part->currentAnimation = animID;
spr_update_sprite(part->spriteInstanceID, animID, part->animationRate);
part->animNotifyValue = spr_get_notify_value(part->spriteInstanceID);
}
break;
case ACTOR_CLASS_ENEMY:
part = get_actor_part(actor, partID);
if (part->currentAnimation != animationIndex) {
part->currentAnimation = animationIndex;
spr_update_sprite(part->spriteInstanceID, animationIndex, part->animationRate);
if (part->currentAnimation != animID) {
part->currentAnimation = animID;
spr_update_sprite(part->spriteInstanceID, animID, part->animationRate);
part->animNotifyValue = spr_get_notify_value(part->spriteInstanceID);
}
break;
@ -1009,8 +1009,8 @@ void set_animation(s32 actorID, s32 partID, s32 animationIndex) {
}
}
void func_80263E08(Actor* actor, ActorPart* part, s32 anim) {
if (anim >= 0) {
void func_80263E08(Actor* actor, ActorPart* part, AnimID anim) {
if ((s32) anim >= 0) {
switch (actor->actorID & ACTOR_CLASS_MASK) {
case ACTOR_CLASS_PLAYER:
if (part->currentAnimation != anim) {

View File

@ -2,7 +2,7 @@
#include "npc.h"
#include "effects.h"
extern s32 D_8014B7F0;
extern s32 gLastRenderTaskCount;
void spawn_drops(Enemy* enemy) {
PlayerData* playerData = &gPlayerData;
@ -11,34 +11,34 @@ void spawn_drops(Enemy* enemy) {
Npc* npc = get_npc_unsafe(enemy->npcID);
Camera* camera = &gCameras[gCurrentCameraID];
s32 pickupDelay;
s32 sp28;
s32 numShadowSpaces;
s32 availableRenderTasks;
s32 availableShadows;
s32 itemToDrop;
f32 x, y, z;
f32 temp_f20;
f32 threshold;
f32 chance;
f32 attempts;
f32 temp_f24;
f32 fraction;
s32 maxCoinBonus;
s32 minCoinBonus;
s32 tempMax;
s32 var_fp;
s32 var_s1;
s32 spawnCounter;
s32 dropCount;
s32 totalWeight;
s32 facingAngleSign;
s32 angleMult;
s32 i, j;
s32 flags;
numShadowSpaces = 0;
availableShadows = 0;
for (i = 0; i < MAX_SHADOWS; i++) {
if (get_shadow_by_index(i) == NULL) {
numShadowSpaces++;
availableShadows++;
}
}
var_fp = 0;
sp28 = 246 - D_8014B7F0;
spawnCounter = 0;
availableRenderTasks = 256 - 10 - gLastRenderTaskCount;
facingAngleSign = clamp_angle(camera->currentYaw + 90.0f);
x = npc->pos.x;
y = npc->pos.y + (npc->collisionHeight / 2);
@ -47,7 +47,7 @@ void spawn_drops(Enemy* enemy) {
angleMult = 0;
pickupDelay = 0;
var_s1 = drops->itemDropChance;
dropCount = drops->itemDropChance;
if (drops->itemDropChance > rand_int(100)) {
tempMax = 0;
@ -60,7 +60,7 @@ void spawn_drops(Enemy* enemy) {
}
totalWeight = 0;
var_s1 = rand_int(tempMax);
dropCount = rand_int(tempMax);
itemToDrop = ITEM_NONE;
for (i = 0; i < 8; i++) {
@ -75,7 +75,7 @@ void spawn_drops(Enemy* enemy) {
}
}
if (totalWeight >= var_s1) {
if (totalWeight >= dropCount) {
itemToDrop = drops->itemDrops[3 * i];
do { } while (0); // TODO required to match
break;
@ -90,13 +90,13 @@ void spawn_drops(Enemy* enemy) {
if (itemToDrop != ITEM_NONE) {
make_item_entity(itemToDrop, x, y, z, 4, pickupDelay, facingAngleSign + angleMult * 360, 0);
var_fp++;
spawnCounter++;
pickupDelay += 2;
facingAngleSign += 30.0;
if (var_fp >= 12) {
if (spawnCounter >= 12) {
angleMult++;
facingAngleSign = angleMult * 8;
var_fp = 0;
spawnCounter = 0;
}
if (drops->itemDrops[3 * i + 2] >= 0) {
@ -108,35 +108,33 @@ void spawn_drops(Enemy* enemy) {
if (encounter->dropWhackaBump) {
encounter->dropWhackaBump = FALSE;
make_item_entity(ITEM_WHACKAS_BUMP, x, y, z, 4, pickupDelay, facingAngleSign + angleMult * 360, 0);
var_fp++;
spawnCounter++;
pickupDelay += 2;
facingAngleSign += 30.0;
if (var_fp >= 12) {
if (spawnCounter >= 12) {
angleMult++;
facingAngleSign = angleMult * 8;
var_fp = 0;
spawnCounter = 0;
}
}
var_s1 = 0;
temp_f24 = playerData->curHP / (f32) playerData->curMaxHP;
dropCount = 0;
itemToDrop = ITEM_NONE;
fraction = playerData->curHP / (f32) playerData->curMaxHP;
for (i = 0; i < 8; i++) {
attempts = drops->heartDrops[4 * i];
temp_f20 = drops->heartDrops[4 * i + 1];
attempts /= 32767.0f;
temp_f20 /= 32767.0f;
attempts = drops->heartDrops[4 * i];
threshold = drops->heartDrops[4 * i + 1];
attempts /= 32767.0f;
threshold /= 32767.0f;
if (temp_f24 <= attempts &&
rand_int(100) <= temp_f20 * 100.0f)
{
if (fraction <= attempts && rand_int(100) <= threshold * 100.0f) {
attempts = drops->heartDrops[4 * i + 2];
chance = drops->heartDrops[4 * i + 3];
chance /= 32767.0f;
for (j = 0; j < attempts; j++) {
if (rand_int(100) <= chance * 100.0f) {
var_s1++;
dropCount++;
}
}
break;
@ -144,56 +142,53 @@ void spawn_drops(Enemy* enemy) {
}
if (is_ability_active(ABILITY_HEART_FINDER) != 0) {
s32 temp = var_s1 + 1;
var_s1 = temp + rand_int(2);
dropCount += 1 + rand_int(2);
}
if (enemy->flags & ENEMY_FLAG_NO_DROPS) {
var_s1 = 0;
dropCount = 0;
}
if (var_s1 != 0) {
if (dropCount != 0) {
itemToDrop = ITEM_HEART;
}
if (var_s1 * 2 > sp28) {
var_s1 = sp28 / 2;
if (dropCount * 2 > availableRenderTasks) {
dropCount = availableRenderTasks / 2;
}
sp28 -= 2 * var_s1;
if (var_s1 > numShadowSpaces) {
var_s1 = numShadowSpaces;
availableRenderTasks -= 2 * dropCount;
if (dropCount > availableShadows) {
dropCount = availableShadows;
}
numShadowSpaces -= var_s1;
availableShadows -= dropCount;
for (i = 0; i < var_s1; i++) {
for (i = 0; i < dropCount; i++) {
make_item_entity(itemToDrop, x, y, z, 4, pickupDelay, facingAngleSign + (angleMult * 360), 0);
var_fp++;
spawnCounter++;
pickupDelay += 2;
facingAngleSign += 30.0;
if (var_fp >= 12) {
var_fp = 0;
if (spawnCounter >= 12) {
spawnCounter = 0;
angleMult++;
facingAngleSign = angleMult * 8;
}
}
var_s1 = 0;
dropCount = 0;
itemToDrop = ITEM_NONE;
temp_f24 = playerData->curFP / (f32) playerData->curMaxFP;
fraction = playerData->curFP / (f32) playerData->curMaxFP;
for (i = 0; i < 8; i++) {
attempts = drops->flowerDrops[4 * i + 0];
temp_f20 = drops->flowerDrops[4 * i + 1];
attempts /= 32767.0f;
temp_f20 /= 32767.0f;
attempts = drops->flowerDrops[4 * i + 0];
threshold = drops->flowerDrops[4 * i + 1];
attempts /= 32767.0f;
threshold /= 32767.0f;
if (temp_f24 <= attempts &&
rand_int(100) <= temp_f20 * 100.0f)
{
if (fraction <= attempts && rand_int(100) <= threshold * 100.0f) {
attempts = drops->flowerDrops[4 * i + 2];
chance = drops->flowerDrops[4 * i + 3];
chance /= 32767.0f;
for (j = 0; j < attempts; j++) {
if (rand_int(100) <= chance * 100.0f) {
var_s1++;
dropCount++;
}
}
break;
@ -201,32 +196,31 @@ void spawn_drops(Enemy* enemy) {
}
if (is_ability_active(ABILITY_FLOWER_FINDER) != 0) {
s32 temp = var_s1 + 1;
var_s1 = temp + rand_int(2);
dropCount += 1 + rand_int(2);
}
if (enemy->flags & ENEMY_FLAG_NO_DROPS) {
var_s1 = 0;
dropCount = 0;
}
if (var_s1 != 0) {
if (dropCount != 0) {
itemToDrop = ITEM_FLOWER_POINT;
}
if (var_s1 * 2 > sp28) {
var_s1 = sp28 / 2;
if (dropCount * 2 > availableRenderTasks) {
dropCount = availableRenderTasks / 2;
}
sp28 -= 2 * var_s1;
if (var_s1 > numShadowSpaces) {
var_s1 = numShadowSpaces;
availableRenderTasks -= 2 * dropCount;
if (dropCount > availableShadows) {
dropCount = availableShadows;
}
numShadowSpaces -= var_s1;
availableShadows -= dropCount;
for (i = 0; i < var_s1; i++) {
for (i = 0; i < dropCount; i++) {
make_item_entity(itemToDrop, x, y, z, 4, pickupDelay, facingAngleSign + (angleMult * 360), 0);
var_fp++;
spawnCounter++;
pickupDelay += 2;
facingAngleSign += 30.0;
if (var_fp >= 12) {
var_fp = 0;
if (spawnCounter >= 12) {
spawnCounter = 0;
angleMult++;
facingAngleSign = angleMult * 8;
}
@ -238,61 +232,60 @@ void spawn_drops(Enemy* enemy) {
tempMax = drops->maxCoinBonus;
if (drops->maxCoinBonus < drops->minCoinBonus) {
var_s1 = minCoinBonus;
dropCount = minCoinBonus;
minCoinBonus = tempMax;
tempMax = var_s1;
tempMax = dropCount;
}
if (minCoinBonus < 0) {
var_s1 = rand_int(tempMax - minCoinBonus) + minCoinBonus;
dropCount = rand_int(tempMax - minCoinBonus) + minCoinBonus;
} else {
var_s1 = tempMax - minCoinBonus;
if (var_s1 != 0) {
var_s1 = rand_int(var_s1) + minCoinBonus;
dropCount = tempMax - minCoinBonus;
if (dropCount != 0) {
dropCount = rand_int(dropCount) + minCoinBonus;
} else {
var_s1 = minCoinBonus;
dropCount = minCoinBonus;
}
}
if (var_s1 < 0) {
var_s1 = 0;
if (dropCount < 0) {
dropCount = 0;
}
var_s1 = var_s1 + encounter->coinsEarned;
dropCount = dropCount + encounter->coinsEarned;
if (is_ability_active(ABILITY_PAY_OFF) != 0) {
var_s1 += encounter->damageTaken / 2;
dropCount += encounter->damageTaken / 2;
encounter->damageTaken = 0;
}
if (encounter->merleeCoinBonus != 0) {
encounter->merleeCoinBonus = 0;
var_s1 *= 3;
dropCount *= 3;
}
if (is_ability_active(ABILITY_MONEY_MONEY) != 0) {
var_s1 *= 2;
dropCount *= 2;
}
if (var_s1 > 20) {
var_s1 = 20;
if (dropCount > 20) {
dropCount = 20;
}
if (enemy->flags & ENEMY_FLAG_NO_DROPS) {
var_s1 = 0;
dropCount = 0;
}
if (var_s1 * 2 > sp28) {
var_s1 = sp28 / 2;
if (dropCount * 2 > availableRenderTasks) {
dropCount = availableRenderTasks / 2;
}
sp28 -= 2 * var_s1;
availableRenderTasks -= 2 * dropCount;
if (var_s1 > numShadowSpaces) {
var_s1 = numShadowSpaces;
if (dropCount > availableShadows) {
dropCount = availableShadows;
}
for (i = 0; i < var_s1; i++) {
for (i = 0; i < dropCount; i++) {
make_item_entity(itemToDrop, x, y, z, 4, pickupDelay, facingAngleSign + (angleMult * 360), 0);
var_fp++;
spawnCounter++;
pickupDelay += 2;
facingAngleSign = facingAngleSign + 30.0;
if (var_fp >= 12) {
var_fp = 0;
if (spawnCounter >= 12) {
spawnCounter = 0;
angleMult++;
facingAngleSign = angleMult * 8;
}
@ -878,12 +871,12 @@ ApiStatus BasicAI_Main(Evt* script, s32 isInitialCall) {
if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) {
script->AI_TEMP_STATE = AI_STATE_SUSPEND;
script->functionTemp[1] = AI_STATE_WANDER_INIT;
} else if (enemy->flags & ENEMY_FLAG_40000000) {
} else if (enemy->flags & ENEMY_FLAG_BEGIN_WITH_CHASING) {
script->AI_TEMP_STATE = AI_STATE_CHASE_INIT;
}
enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND;
enemy->flags &= ~ENEMY_FLAG_40000000;
enemy->flags &= ~ENEMY_FLAG_BEGIN_WITH_CHASING;
}
switch (script->AI_TEMP_STATE) {

View File

@ -63,7 +63,7 @@ EvtScript D_800939B4 = {
EVT_IF_EQ(LVar0, 0)
EVT_CALL(SetSelfVar, 0, 1)
EVT_CALL(BindNpcAI, NPC_SELF, EVT_PTR(D_800939A4))
EVT_CALL(SetNpcFlagBits, NPC_SELF, NPC_FLAG_GRAVITY | NPC_FLAG_40000, TRUE)
EVT_CALL(SetNpcFlagBits, NPC_SELF, NPC_FLAG_GRAVITY | NPC_FLAG_IGNORE_CAMERA_FOR_YAW, TRUE)
EVT_CALL(SetNpcFlagBits, NPC_SELF, NPC_FLAG_8 | NPC_FLAG_JUMPING, FALSE)
EVT_CALL(SetNpcAnimation, NPC_SELF, LVar2)
EVT_SET(LVar0, 0)
@ -76,7 +76,7 @@ EvtScript D_800939B4 = {
EVT_END_LOOP
EVT_CALL(SetNpcRotation, NPC_SELF, 0, 0, 0)
EVT_CALL(func_802CFD30, NPC_SELF, FOLD_TYPE_6, 255, 255, 255, 0)
EVT_CALL(SetNpcFlagBits, NPC_SELF, NPC_FLAG_40000, FALSE)
EVT_CALL(SetNpcFlagBits, NPC_SELF, NPC_FLAG_IGNORE_CAMERA_FOR_YAW, FALSE)
EVT_CALL(SetSelfVar, 0, 0)
EVT_CALL(func_8005DDF0)
EVT_CALL(BindNpcAI, NPC_SELF, LVar1)

View File

@ -35,7 +35,7 @@ void get_npc_pos(s32 npcID, f32* outX, f32* outY, f32* outZ, s32* outAirborne) {
}
void npc_follow_init(Npc* npc, s32 targetNpcID, s32* animIDs, f32 walkSpeed, f32 runSpeed, s32 idleRadius, s32 walkRadius) {
void npc_follow_init(Npc* npc, s32 targetNpcID, FollowAnims* anims, f32 walkSpeed, f32 runSpeed, s32 idleRadius, s32 walkRadius) {
PlayerStatus* playerStatus = &gPlayerStatus;
NpcFollowData* followData;
s32 i;
@ -53,15 +53,15 @@ void npc_follow_init(Npc* npc, s32 targetNpcID, s32* animIDs, f32 walkSpeed, f32
followData->targetPointIdx = 0;
followData->followState = NPC_FOLLOW_STATE_RUN;
followData->targetNpcID = targetNpcID;
followData->animIDs = animIDs;
followData->anims = anims;
followData->walkSpeed = walkSpeed;
followData->runSpeed = runSpeed;
followData->idleRadius = idleRadius;
followData->walkRadius = walkRadius;
npc->currentAnim = followData->animIDs[4];
npc->currentAnim = followData->anims->idle;
npc->jumpVelocity = 0.0f;
npc->flags |= NPC_FLAG_GRAVITY;
npc->flags &= ~NPC_FLAG_100;
npc->flags &= ~NPC_FLAG_IGNORE_PLAYER_COLLISION;
npc->collisionChannel = COLLISION_CHANNEL_10000;
}
@ -129,9 +129,9 @@ void npc_follow_npc(Npc* npc) {
npc->moveSpeed = followData->runSpeed;
}
npc->currentAnim = followData->animIDs[5];
if (!(npc->flags & NPC_FLAG_1000)) {
npc->currentAnim = followData->animIDs[2];
npc->currentAnim = followData->anims->run;
if (!(npc->flags & NPC_FLAG_FALLING)) {
npc->currentAnim = followData->anims->fall;
}
while (TRUE) {
@ -157,7 +157,7 @@ void npc_follow_npc(Npc* npc) {
if (followData->targetPointIdx == followData->lastPointIdx) {
npc->moveSpeed = 0.0f;
yaw = npc->yaw;
npc->currentAnim = followData->animIDs[4];
npc->currentAnim = followData->anims->idle;
break;
}
@ -165,7 +165,7 @@ void npc_follow_npc(Npc* npc) {
if (dist <= followData->idleRadius) {
npc->moveSpeed = 0.0f;
yaw = npc->yaw;
npc->currentAnim = followData->animIDs[4];
npc->currentAnim = followData->anims->idle;
followData->followState = NPC_FOLLOW_STATE_IDLE;
break;
}
@ -177,7 +177,7 @@ void npc_follow_npc(Npc* npc) {
historyPoint = &followData->moveHistory[followData->targetPointIdx];
targetX = historyPoint->pos.x;
targetZ = historyPoint->pos.z;
if (npc->flags & NPC_FLAG_1000) {
if (npc->flags & NPC_FLAG_FALLING) {
if (historyPoint->isAirborne) {
followData->followState = NPC_FOLLOW_STATE_JUMP;
break;
@ -185,12 +185,12 @@ void npc_follow_npc(Npc* npc) {
}
}
if (!(npc->flags & NPC_FLAG_1000)) {
if (!(npc->flags & NPC_FLAG_FALLING)) {
npc->moveSpeed *= 0.5f;
}
npc->yaw = yaw;
npc_move_heading(npc, npc->moveSpeed, yaw);
if ((npc->flags & NPC_FLAG_4000) && (npc->flags & NPC_FLAG_1000)) {
if ((npc->flags & NPC_FLAG_COLLDING_FORWARD_WITH_WORLD) && (npc->flags & NPC_FLAG_FALLING)) {
followData->followState = NPC_FOLLOW_STATE_JUMP;
}
break;
@ -230,7 +230,7 @@ void npc_follow_npc(Npc* npc) {
}
npc->moveSpeed = npc->planarFlyDist / npc->duration;
npc->jumpVelocity = (currentY + (npc->jumpScale * npc->duration * npc->duration * 0.5f)) / npc->duration;
npc->currentAnim = followData->animIDs[1];
npc->currentAnim = followData->anims->jump;
npc->flags &= ~NPC_FLAG_GRAVITY;
followData->followState = NPC_FOLLOW_STATE_FALL;
}
@ -239,7 +239,7 @@ void npc_follow_npc(Npc* npc) {
npc->jumpVelocity -= npc->jumpScale;
npc->pos.y += npc->jumpVelocity;
if (npc->jumpVelocity <= 0.0f) {
npc->currentAnim = followData->animIDs[2];
npc->currentAnim = followData->anims->fall;
}
npc_move_heading(npc, npc->moveSpeed, npc->yaw);
if (npc->jumpVelocity <= 0.0f) {
@ -250,7 +250,7 @@ void npc_follow_npc(Npc* npc) {
if (npc_raycast_down_sides(npc->collisionChannel, &currentX, &currentY, &currentZ, &dist) != 0 &&
dist <= fabsf(npc->jumpVelocity) + 8.0)
{
npc->currentAnim = followData->animIDs[3];
npc->currentAnim = followData->anims->land;
npc->jumpVelocity = 0.0f;
npc->pos.y = currentY;
npc->flags |= NPC_FLAG_GRAVITY;

View File

@ -41,7 +41,7 @@ void check_for_interactables(void);
void func_800E0AD0(void);
void func_800E0B14(void);
void update_partner_timers(void);
void player_sprite_behaviour(void);
void player_update_sprite(void);
s32 get_player_back_anim(s32 arg0);
void appendGfx_player(void* data);
void appendGfx_player_spin(void* data);
@ -655,7 +655,7 @@ void update_player(void) {
handle_floor_behavior();
}
player_sprite_behaviour();
player_update_sprite();
gameStatus = gGameStatusPtr;
gameStatus->playerPos.x = playerStatus->position.x;
@ -1071,8 +1071,7 @@ s32 has_valid_conversation_npc(void) {
s32 cond;
if (npc != NULL && !(npc->flags & NPC_FLAG_10000000)) {
cond = (playerStatus->flags & (PS_FLAG_HAS_CONVERSATION_NPC | PS_FLAG_INPUT_DISABLED))
== PS_FLAG_HAS_CONVERSATION_NPC;
cond = (playerStatus->flags & (PS_FLAG_HAS_CONVERSATION_NPC | PS_FLAG_INPUT_DISABLED)) == PS_FLAG_HAS_CONVERSATION_NPC;
ret = cond;
}
return ret;
@ -1202,8 +1201,11 @@ void check_for_interactables(void) {
curInteraction = -1;
break;
}
} else if (((playerStatus->flags & (PS_FLAG_HAS_CONVERSATION_NPC | PS_FLAG_INPUT_DISABLED)) == PS_FLAG_HAS_CONVERSATION_NPC)
&& (npc != NULL) && (npc->flags & NPC_FLAG_10000000)) {
} else if (
((playerStatus->flags & (PS_FLAG_HAS_CONVERSATION_NPC | PS_FLAG_INPUT_DISABLED)) == PS_FLAG_HAS_CONVERSATION_NPC)
&& (npc != NULL)
&& (npc->flags & NPC_FLAG_10000000)
) {
curInteraction = npc->npcID | COLLISION_WITH_NPC_BIT;
if (playerStatus->interactingWithID == curInteraction) {
return;
@ -1295,7 +1297,7 @@ void update_partner_timers(void) {
}
}
void player_sprite_behaviour(void) {
void player_update_sprite(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
f32 cameraYaw = gCameras[gCurrentCameraID].currentYaw;
f32 camRelativeYaw = get_clamped_angle_diff(cameraYaw, playerStatus->currentYaw);

View File

@ -586,7 +586,7 @@ void peach_check_for_parasol_input(void) {
disguiseNpc = peach_make_disguise_npc(gGameStatusPtr->peachDisguise);
if (disguiseNpc != NULL) {
disguiseNpc->flags &= ~NPC_FLAG_40000;
disguiseNpc->flags &= ~NPC_FLAG_IGNORE_CAMERA_FOR_YAW;
}
}
}
@ -602,7 +602,7 @@ void peach_sync_disguise_npc(void) {
if (PeachDisguiseNpcIndex >= 0) {
Npc* npc = get_npc_by_index(PeachDisguiseNpcIndex);
if (npc->flags & NPC_FLAG_40000) {
if (npc->flags & NPC_FLAG_IGNORE_CAMERA_FOR_YAW) {
npc->renderYaw = playerStatus->spriteFacingAngle;
} else {
npc->yaw = playerStatus->targetYaw;
@ -630,7 +630,7 @@ Npc* peach_make_disguise_npc(s32 peachDisguise) {
playerStatus->peachDisguise = peachDisguise;
gGameStatusPtr->peachDisguise = peachDisguise;
bpPtr->flags = NPC_FLAG_8 | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_100 | NPC_FLAG_40000;
bpPtr->flags = NPC_FLAG_8 | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_CAMERA_FOR_YAW;
bpPtr->initialAnim = BasicPeachDisguiseAnims[playerStatus->peachDisguise].idle;
bpPtr->onUpdate = NULL;
bpPtr->onRender = NULL;

View File

@ -681,7 +681,6 @@ void collision_main_lateral(void) {
}
collisionStatus->currentWall = result;
if (!(playerStatus->flags & PS_FLAG_MOVEMENT_LOCKED) && playerStatus->actionState != ACTION_STATE_HAMMER) {
if (speed == 0.0f) {
collision_check_player_intersecting_world(0, 0,
playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw);

View File

@ -484,7 +484,7 @@ DepthFloatFactors depthFloatLookupTable[] = {
// The multiplication by 32 comes from scaling the RSP does to increase depth precision.
#define MAX_VIEWPORT_DEPTH (2 * 32 * ((G_MAXZ / 2)))
s32 D_8014B7F0 = 0;
s32 gLastRenderTaskCount = 0;
// padding?
s32 D_8014B7F4 = 0;
@ -6231,7 +6231,7 @@ void execute_render_tasks(void) {
}
}
D_8014B7F0 = taskCount;
gLastRenderTaskCount = taskCount;
taskList = mdl_renderTaskLists[mdl_renderTaskQueueIdx];
if (gOverrideFlags & GLOBAL_OVERRIDES_ENABLE_FLOOR_REFLECTION) {
Mtx* dispMtx;

View File

@ -810,17 +810,17 @@ ApiStatus SetAnimation(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 actorID = evt_get_variable(script, *args++);
Actor* actor;
s32 a1;
s32 animationIndex;
s32 partID;
AnimID animID;
if (actorID == ACTOR_SELF) {
actorID = script->owner1.actorID;
}
a1 = evt_get_variable(script, *args++);
animationIndex = evt_get_variable(script, *args++);
partID = evt_get_variable(script, *args++);
animID = evt_get_variable(script, *args++);
set_animation(actorID, a1, animationIndex);
set_animation(actorID, partID, animID);
return ApiStatus_DONE2;
}

View File

@ -426,7 +426,7 @@ EvtScript N(leechAttack) = {
EVT_WAIT(30)
EVT_END_LOOP
EVT_ELSE
EVT_CALL(ShowMessageBox, 49, 32767)
EVT_CALL(ShowMessageBox, BTL_MSG_31, 32767)
EVT_CALL(ShowActionHud, 1)
EVT_CALL(LoadActionCommand, ACTION_COMMAND_STOP_LEECH)
EVT_CALL(action_command_stop_leech_init)
@ -437,7 +437,7 @@ EvtScript N(leechAttack) = {
EVT_SET(LVarD, 0)
EVT_LOOP(5)
EVT_CALL(UseIdleAnimation, ACTOR_PLAYER, FALSE)
EVT_CALL(SetAnimation, ACTOR_PLAYER, 0, 0x03000C)
EVT_CALL(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario_3000C)
EVT_CALL(PlaySoundAtActor, ACTOR_SELF, SOUND_3E0)
EVT_CALL(SetAnimation, ACTOR_SELF, 1, ANIM_Fuzzy_Jungle_Bite)
EVT_SET(LocalFlag(0), 0)

View File

@ -298,7 +298,7 @@ typedef struct BattleMoveEntry {
.romStart = name##_ROM_START, \
.romEnd = name##_ROM_END, \
.vramStart = name##_VRAM, \
.mainScript = &battle_item_##name##_##main \
.mainScript = &battle_item_##name##_##EVS_UseItem \
}
typedef struct ActorBlueprint {

View File

@ -124,7 +124,7 @@ EvtScript N(802A2C20) = {
EVT_CALL(PlaySound, SOUND_2041)
EVT_CALL(CreateNpc, 100, LVar0)
EVT_CALL(N(SetNpcCollision32))
EVT_CALL(SetNpcFlagBits, 100, NPC_FLAG_40000, TRUE)
EVT_CALL(SetNpcFlagBits, 100, NPC_FLAG_IGNORE_CAMERA_FOR_YAW, TRUE)
EVT_CALL(SetNpcPos, 100, -75, 150, 0)
EVT_CALL(SetNpcDecoration, 100, 0, 5)
EVT_CALL(N(UnkStarFunc3), -75, 167, 0)

View File

@ -1,14 +1,16 @@
#include "coconut.h"
#include "common.h"
#include "script_api/battle.h"
#include "entity.h"
#include "ld_addrs.h"
#include "battle/move/item/coconut.png.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_coconut
#include "UseItem.inc.c"
#include "battle/common/move/ItemRefund.inc.c"
#include "battle/common/move/UseItem.inc.c"
static s32 _pad = 0;
#include "battle/move/item/coconut.png.h"
#include "battle/move/item/coconut.png.inc.c"
#include "battle/move/item/coconut.pal.inc.c"
@ -44,7 +46,7 @@ Gfx N(displayList)[] = {
EntityModelScript N(modelCommandList) = STANDARD_ENTITY_MODEL_SCRIPT(N(displayList), RENDER_MODE_ALPHATEST);
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_COCONUT)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_D)

View File

@ -1,16 +0,0 @@
#ifndef BATTLE_ITEM_COCONUT
#define BATTLE_ITEM_COCONUT
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_coconut
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
API_CALLABLE(func_802A1000_72F720);
API_CALLABLE(func_802A11D4_72F8F4);
#endif

View File

@ -1,9 +1,12 @@
#include "dizzy_dial.h"
#include "common.h"
#include "script_api/battle.h"
#include "camera.h"
#define NAMESPACE battle_item_dizzy_dial
static s32 D_802A1CD0;
#include "ItemRefund.inc.c"
#include "battle/common/move/ItemRefund.inc.c"
void func_802A123C_727B4C(void) {
func_80138D88(0, 0, 0x140, 0xF0, 160.0f);
@ -43,10 +46,10 @@ API_CALLABLE(N(func_802A1270_727B80)) {
return ApiStatus_BLOCK;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x0000009A)
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_DIZZY_DIAL)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_C)
EVT_CALL(MoveBattleCamOver, 20)

View File

@ -1,16 +0,0 @@
#ifndef BATTLE_ITEM_DIZZY_DIAL
#define BATTLE_ITEM_DIZZY_DIAL
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_dizzy_dial
API_CALLABLE(ItemAfflictEnemy);
API_CALLABLE(N(func_802A1270_727B80));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
#endif

View File

@ -1,9 +1,12 @@
#include "dried_shroom.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_dried_shroom
API_CALLABLE(N(func_802A123C_71CF1C)) {
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(ShowHeartRecoveryFX)) {
Bytecode* args = script->ptrReadPos;
s32 a = evt_get_variable(script, *args++);
s32 b = evt_get_variable(script, *args++);
@ -25,17 +28,17 @@ API_CALLABLE(N(func_802A12FC_71CFDC)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x0000008D)
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_DRIED_SHROOM)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_EXEC_WAIT(N(EatItem))
EVT_CALL(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario_StickOutTongue)
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar0, 0)
EVT_ADD(LVar1, 35)
EVT_CALL(N(func_802A123C_71CF1C), LVar0, LVar1, LVar2, 1)
EVT_CALL(N(ShowHeartRecoveryFX), LVar0, LVar1, LVar2, 1)
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar1, 25)
EVT_ADD(LVar2, 5)

View File

@ -1,17 +0,0 @@
#ifndef BATTLE_ITEM_DRIED_SHROOM
#define BATTLE_ITEM_DRIED_SHROOM
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_dried_shroom
API_CALLABLE(N(func_802A123C_71CF1C));
API_CALLABLE(N(func_802A12FC_71CFDC));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
extern EvtScript N(EatItem);
#endif

View File

@ -1,25 +1,27 @@
#include "dusty_hammer.h"
#include "common.h"
#include "script_api/battle.h"
#include "entity.h"
#include "ld_addrs.h"
#include "battle/move/item/dusty_hammer.png.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_dusty_hammer
#include "UseItem.inc.c"
#include "battle/common/move/ItemRefund.inc.c"
#include "battle/common/move/UseItem.inc.c"
static s32 _pad = 0; // XXX
#include "battle/move/item/dusty_hammer.png.h"
#include "battle/move/item/dusty_hammer.png.inc.c"
#include "battle/move/item/dusty_hammer.pal.inc.c"
Vtx N(model)[] = {
Vtx N(DustyHammerVtx)[] = {
{ .v = {{ -16, -16, 0 }, FALSE, { 0, 0 }, { 0, 0, 0, 255 }}},
{ .v = {{ 15, -16, 0 }, FALSE, { 1024, 0 }, { 0, 0, 0, 255 }}},
{ .v = {{ 15, 15, 0 }, FALSE, { 1024, 1024 }, { 0, 0, 0, 255 }}},
{ .v = {{ -16, 15, 0 }, FALSE, { 0, 1024 }, { 0, 0, 0, 255 }}},
};
Gfx N(displayList)[] = {
Gfx N(DustyHammerGfx)[] = {
gsDPPipeSync(),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
@ -34,16 +36,16 @@ Gfx N(displayList)[] = {
gsDPLoadTextureTile_4b(battle_item_dusty_hammer_png, G_IM_FMT_CI, battle_item_dusty_hammer_png_width, battle_item_dusty_hammer_png_height, 0, 0, battle_item_dusty_hammer_png_width - 1, battle_item_dusty_hammer_png_height - 1, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD),
gsSPClearGeometryMode(G_LIGHTING),
gsSPClearGeometryMode(G_SHADING_SMOOTH),
gsSPVertex(N(model), ARRAY_COUNT(N(model)), 0),
gsSPVertex(N(DustyHammerVtx), ARRAY_COUNT(N(DustyHammerVtx)), 0),
gsSP1Triangle(0, 1, 2, 0),
gsSP1Triangle(0, 2, 3, 0),
gsDPPipeSync(),
gsSPEndDisplayList(),
};
EntityModelScript N(modelCommandList) = STANDARD_ENTITY_MODEL_SCRIPT(N(displayList), RENDER_MODE_ALPHATEST);
EntityModelScript N(EMS_DustyHammer) = STANDARD_ENTITY_MODEL_SCRIPT(N(DustyHammerGfx), RENDER_MODE_ALPHATEST);
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_DUSTY_HAMMER)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_D)
@ -51,7 +53,7 @@ EvtScript N(main) = {
EVT_CALL(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario_Throw)
EVT_CALL(PlaySound, SOUND_THROW)
EVT_WAIT(3)
EVT_CALL(CreateVirtualEntity, LVarA, EVT_PTR(N(modelCommandList)))
EVT_CALL(CreateVirtualEntity, LVarA, EVT_PTR(N(EMS_DustyHammer)))
EVT_SETF(LVar0, EVT_FLOAT(1.0))
EVT_CALL(MultiplyByActorScale, LVar0)
EVT_CALL(SetVirtualEntityScale, LVarA, LVar0, LVar0, LVar0)

View File

@ -1,13 +0,0 @@
#ifndef BATTLE_ITEM_DUSTY_HAMMER
#define BATTLE_ITEM_DUSTY_HAMMER
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_dusty_hammer
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
#endif

View File

@ -1,13 +1,12 @@
#include "egg_missile.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "entity.h"
#include "ld_addrs.h"
#include "battle/move/item/egg_missile1.png.h"
#include "battle/move/item/egg_missile2.png.h"
#include "battle/move/item/egg_missile3.png.h"
#include "battle/move/item/egg_missile4.png.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_egg_missile
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_71CF1C)) {
Bytecode* args = script->ptrReadPos;
@ -21,27 +20,34 @@ API_CALLABLE(N(func_802A123C_71CF1C)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
static s32 _pad = 0;
#include "battle/move/item/egg_missile1.png.h"
#include "battle/move/item/egg_missile1.png.inc.c"
#include "battle/move/item/egg_missile1.pal.inc.c"
#include "battle/move/item/egg_missile2.png.h"
#include "battle/move/item/egg_missile2.png.inc.c"
#include "battle/move/item/egg_missile2.pal.inc.c"
#include "battle/move/item/egg_missile3.png.h"
#include "battle/move/item/egg_missile3.png.inc.c"
#include "battle/move/item/egg_missile3.pal.inc.c"
#include "battle/move/item/egg_missile4.png.h"
#include "battle/move/item/egg_missile4.png.inc.c"
#include "battle/move/item/egg_missile4.pal.inc.c"
Vtx N(model)[] = {
Vtx N(EggMissileVtx)[] = {
{ .v = {{ -16, -16, 0 }, FALSE, { 0, 0 }, { 0, 0, 0, 255 }}},
{ .v = {{ 15, -16, 0 }, FALSE, { 1024, 0 }, { 0, 0, 0, 255 }}},
{ .v = {{ 15, 15, 0 }, FALSE, { 1024, 1024 }, { 0, 0, 0, 255 }}},
{ .v = {{ -16, 15, 0 }, FALSE, { 0, 1024 }, { 0, 0, 0, 255 }}},
};
Gfx N(frame1_displayList)[] = {
Gfx N(Frame1Gfx)[] = {
gsDPPipeSync(),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
@ -56,14 +62,14 @@ Gfx N(frame1_displayList)[] = {
gsDPLoadTextureTile_4b(battle_item_egg_missile1_png, G_IM_FMT_CI, battle_item_egg_missile1_png_width, battle_item_egg_missile1_png_height, 0, 0, battle_item_egg_missile1_png_width - 1, battle_item_egg_missile1_png_height - 1, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD),
gsSPClearGeometryMode(G_LIGHTING),
gsSPClearGeometryMode(G_SHADING_SMOOTH),
gsSPVertex(N(model), ARRAY_COUNT(N(model)), 0),
gsSPVertex(N(EggMissileVtx), ARRAY_COUNT(N(EggMissileVtx)), 0),
gsSP1Triangle(0, 1, 2, 0),
gsSP1Triangle(0, 2, 3, 0),
gsDPPipeSync(),
gsSPEndDisplayList(),
};
Gfx N(frame2_displayList)[] = {
Gfx N(Frame2Gfx)[] = {
gsDPPipeSync(),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
@ -78,14 +84,14 @@ Gfx N(frame2_displayList)[] = {
gsDPLoadTextureTile_4b(battle_item_egg_missile2_png, G_IM_FMT_CI, battle_item_egg_missile2_png_width, 0, 0, 0, battle_item_egg_missile2_png_width - 1, battle_item_egg_missile2_png_height - 1, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD),
gsSPClearGeometryMode(G_LIGHTING),
gsSPClearGeometryMode(G_SHADING_SMOOTH),
gsSPVertex(N(model), ARRAY_COUNT(N(model)), 0),
gsSPVertex(N(EggMissileVtx), ARRAY_COUNT(N(EggMissileVtx)), 0),
gsSP1Triangle(0, 1, 2, 0),
gsSP1Triangle(0, 2, 3, 0),
gsDPPipeSync(),
gsSPEndDisplayList(),
};
Gfx N(frame3_displayList)[] = {
Gfx N(Frame3Gfx)[] = {
gsDPPipeSync(),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
@ -100,14 +106,14 @@ Gfx N(frame3_displayList)[] = {
gsDPLoadTextureTile_4b(battle_item_egg_missile3_png, G_IM_FMT_CI, battle_item_egg_missile3_png_width, 0, 0, 0, battle_item_egg_missile3_png_width - 1, battle_item_egg_missile3_png_height - 1, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD),
gsSPClearGeometryMode(G_LIGHTING),
gsSPClearGeometryMode(G_SHADING_SMOOTH),
gsSPVertex(N(model), ARRAY_COUNT(N(model)), 0),
gsSPVertex(N(EggMissileVtx), ARRAY_COUNT(N(EggMissileVtx)), 0),
gsSP1Triangle(0, 1, 2, 0),
gsSP1Triangle(0, 2, 3, 0),
gsDPPipeSync(),
gsSPEndDisplayList(),
};
Gfx N(frame4_displayList)[] = {
Gfx N(Frame4Gfx)[] = {
gsDPPipeSync(),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
@ -122,34 +128,34 @@ Gfx N(frame4_displayList)[] = {
gsDPLoadTextureTile_4b(battle_item_egg_missile4_png, G_IM_FMT_CI, battle_item_egg_missile4_png_width, 0, 0, 0, battle_item_egg_missile4_png_width - 1, battle_item_egg_missile4_png_height - 1, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD),
gsSPClearGeometryMode(G_LIGHTING),
gsSPClearGeometryMode(G_SHADING_SMOOTH),
gsSPVertex(N(model), ARRAY_COUNT(N(model)), 0),
gsSPVertex(N(EggMissileVtx), ARRAY_COUNT(N(EggMissileVtx)), 0),
gsSP1Triangle(0, 1, 2, 0),
gsSP1Triangle(0, 2, 3, 0),
gsDPPipeSync(),
gsSPEndDisplayList(),
};
EntityModelScript N(modelCommandList) = {
EntityModelScript N(EMS_EggMissile) = {
ems_SetRenderMode(RENDER_MODE_ALPHATEST)
ems_Draw(N(frame1_displayList), 2)
ems_Draw(N(frame2_displayList), 2)
ems_Draw(N(frame3_displayList), 2)
ems_Draw(N(Frame1Gfx), 2)
ems_Draw(N(Frame2Gfx), 2)
ems_Draw(N(Frame3Gfx), 2)
ems_Restart
ems_End
};
EntityModelScript unusedModelScript = STANDARD_ENTITY_MODEL_SCRIPT(
N(frame4_displayList), RENDER_MODE_ALPHATEST);
N(Frame4Gfx), RENDER_MODE_ALPHATEST);
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_EGG_MISSILE)
EVT_EXEC_WAIT(battle_item_egg_missile_UseItemWithEffect)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_D)
EVT_CALL(MoveBattleCamOver, 15)
EVT_CALL(SetAnimation, 0, 0, 65558)
EVT_CALL(SetAnimation, 0, 0, ANIM_Mario_Throw)
EVT_CALL(PlaySound, 1018)
EVT_WAIT(3)
EVT_CALL(CreateVirtualEntity, LVarA, EVT_PTR(battle_item_egg_missile_modelCommandList))
EVT_CALL(CreateVirtualEntity, LVarA, EVT_PTR(N(EMS_EggMissile)))
EVT_CALL(GetActorPos, 0, LVar0, LVar1, LVar2)
EVT_ADD(LVar0, 20)
EVT_ADD(LVar1, 42)
@ -170,8 +176,8 @@ EvtScript N(main) = {
EVT_ADD(LVar2, 5)
EVT_CALL(VirtualEntityJumpTo, LVarA, LVar0, LVar1, LVar2, 18)
EVT_CALL(DeleteVirtualEntity, LVarA)
EVT_CALL(PlaySound, 8208)
EVT_CALL(battle_item_egg_missile_func_802A123C_71CF1C, LVar0, LVar1, LVar2)
EVT_CALL(PlaySound, SOUND_2010)
EVT_CALL(N(func_802A123C_71CF1C), LVar0, LVar1, LVar2)
EVT_THREAD
EVT_CALL(StartRumble, 5)
EVT_CALL(ShakeCam, 1, 0, 2, EVT_FLOAT(0.75))
@ -181,7 +187,7 @@ EvtScript N(main) = {
EVT_END_THREAD
EVT_CALL(GetItemPower, 200, LVar0, LVar1)
EVT_CALL(ItemDamageEnemy, LVar0, 402653698, 0, LVar0, BS_FLAGS1_SP_EVT_ACTIVE)
EVT_EXEC_WAIT(battle_item_egg_missile_PlayerGoHome)
EVT_EXEC_WAIT(N(PlayerGoHome))
EVT_RETURN
EVT_END
};

View File

@ -1,15 +0,0 @@
#ifndef BATTLE_ITEM_EGG_MISSILE
#define BATTLE_ITEM_EGG_MISSILE
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_egg_missile
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
API_CALLABLE(N(func_802A123C_71CF1C));
#endif

View File

@ -1,7 +1,11 @@
#include "electro_pop.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_electro_pop
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_7307DC)) {
BattleStatus* battleStatus = &gBattleStatus;
@ -12,7 +16,7 @@ API_CALLABLE(N(func_802A123C_7307DC)) {
return ApiStatus_DONE2;
}
API_CALLABLE(N(func_802A127C_73081C)) {
API_CALLABLE(N(ShowHeartRecoveryFX)) {
Bytecode* args = script->ptrReadPos;
s32 a = evt_get_variable(script, *args++);
s32 b = evt_get_variable(script, *args++);
@ -24,7 +28,7 @@ API_CALLABLE(N(func_802A127C_73081C)) {
return ApiStatus_DONE2;
}
API_CALLABLE(N(func_802A133C_7308DC)) {
API_CALLABLE(N(ShowFlowerRecoveryFX)) {
Bytecode* args = script->ptrReadPos;
s32 a = evt_get_variable(script, *args++);
s32 b = evt_get_variable(script, *args++);
@ -82,15 +86,15 @@ API_CALLABLE(N(func_802A14F0_730A90)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x000000CC)
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_ELECTRO_POP)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_EXEC_WAIT(N(EatItem))
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar1, 20)
EVT_CALL(PlayEffect, 0x57, 0, LVar0, LVar1, LVar2, EVT_FLOAT(1.0), 30, 0, 0, 0, 0, 0, 0, 0)
EVT_CALL(PlayEffect, EFFECT_SNAKING_STATIC, 0, LVar0, LVar1, LVar2, EVT_FLOAT(1.0), 30, 0, 0, 0, 0, 0, 0, 0)
EVT_CALL(PlaySound, SOUND_379)
EVT_CALL(GetItemPower, ITEM_VOLT_SHROOM, LVar0, LVar1)
EVT_CALL(N(func_802A123C_7307DC))
@ -99,7 +103,7 @@ EvtScript N(main) = {
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar0, 20)
EVT_ADD(LVar1, 25)
EVT_CALL(N(func_802A133C_7308DC), LVar0, LVar1, LVar2, LVar3)
EVT_CALL(N(ShowFlowerRecoveryFX), LVar0, LVar1, LVar2, LVar3)
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar1, 25)
EVT_CALL(ShowStartRecoveryShimmer, LVar0, LVar1, LVar2, LVar3)

View File

@ -1,19 +0,0 @@
#ifndef BATTLE_ITEM_ELECTRO_POP
#define BATTLE_ITEM_ELECTRO_POP
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_electro_pop
API_CALLABLE(N(func_802A123C_7307DC));
API_CALLABLE(N(func_802A14F0_730A90));
API_CALLABLE(N(func_802A133C_7308DC));
API_CALLABLE(N(AddFP));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
extern EvtScript N(EatItem);
#endif

View File

@ -1,8 +1,11 @@
#include "fire_flower.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "model.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_fire_flower
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_716E9C)) {
Bytecode* args = script->ptrReadPos;
@ -33,10 +36,10 @@ API_CALLABLE(N(func_802A1378_716FD8)) {
return ApiStatus_BLOCK;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x00000080)
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_FIRE_FLOWER)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(N(FadeBackgroundToBlack))
EVT_CALL(PlaySound, SOUND_377)

View File

@ -1,17 +0,0 @@
#ifndef BATTLE_ITEM_FIRE_FLOWER
#define BATTLE_ITEM_FIRE_FLOWER
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_fire_flower
API_CALLABLE(N(FadeBackgroundToBlack));
API_CALLABLE(N(func_802A123C_716E9C));
API_CALLABLE(N(func_802A1378_716FD8));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
#endif

View File

@ -1,10 +1,13 @@
#include "food.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "entity.h"
#define NAMESPACE battle_item_food
extern EntityModelScript D_80283EE8;
#include "ItemRefund.inc.c"
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_73330C)) {
Bytecode* args = script->ptrReadPos;
@ -44,7 +47,7 @@ API_CALLABLE(N(func_802A12EC_7333BC)) {
return ApiStatus_DONE2;
}
API_CALLABLE(N(func_802A1378_733448)) {
API_CALLABLE(N(ShowHeartRecoveryFX)) {
Bytecode* args = script->ptrReadPos;
s32 a = evt_get_variable(script, *args++);
s32 b = evt_get_variable(script, *args++);
@ -56,7 +59,7 @@ API_CALLABLE(N(func_802A1378_733448)) {
return ApiStatus_DONE2;
}
API_CALLABLE(N(func_802A1438_733508)) {
API_CALLABLE(N(ShowFlowerRecoveryFX)) {
Bytecode* args = script->ptrReadPos;
s32 a = evt_get_variable(script, *args++);
s32 b = evt_get_variable(script, *args++);
@ -69,7 +72,6 @@ API_CALLABLE(N(func_802A1438_733508)) {
}
#include "common/AddHP.inc.c"
#include "common/AddFP.inc.c"
API_CALLABLE(N(func_802A15A0_733670)) {
@ -96,9 +98,9 @@ API_CALLABLE(N(func_802A15A0_733670)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(script6) = {
EvtScript N(EVS_FeedPartner) = {
EVT_CALL(SetActorYaw, ACTOR_PLAYER, 30)
EVT_WAIT(1)
EVT_CALL(SetActorYaw, ACTOR_PLAYER, 60)
@ -176,15 +178,15 @@ EvtScript N(script6) = {
EVT_END
};
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET(LVarE, LVar1)
EVT_CALL(GetMenuSelection, LVar0, LVar1, LVar2)
EVT_SET(LVarA, LVar1)
EVT_CALL(N(func_802A15A0_733670), LVarA)
EVT_CALL(InitTargetIterator)
EVT_CALL(GetOwnerTarget, LVar0, LVar1)
EVT_IF_EQ(LVar0, 256)
EVT_EXEC_WAIT(N(script6))
EVT_IF_EQ(LVar0, ACTOR_PARTNER)
EVT_EXEC_WAIT(N(EVS_FeedPartner))
EVT_RETURN
EVT_END_IF
EVT_SET(LVar1, LVarE)
@ -201,19 +203,19 @@ EvtScript N(main) = {
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar0, 0)
EVT_ADD(LVar1, 35)
EVT_CALL(N(func_802A1378_733448), LVar0, LVar1, LVar2, LVarB)
EVT_CALL(N(ShowHeartRecoveryFX), LVar0, LVar1, LVar2, LVarB)
EVT_END_IF
EVT_IF_LT(LVarB, 0)
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar0, 0)
EVT_ADD(LVar1, 35)
EVT_CALL(N(func_802A1378_733448), LVar0, LVar1, LVar2, LVarB)
EVT_CALL(N(ShowHeartRecoveryFX), LVar0, LVar1, LVar2, LVarB)
EVT_END_IF
EVT_IF_GT(LVarC, 0)
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar0, 20)
EVT_ADD(LVar1, 25)
EVT_CALL(N(func_802A1438_733508), LVar0, LVar1, LVar2, LVarC)
EVT_CALL(N(ShowFlowerRecoveryFX), LVar0, LVar1, LVar2, LVarC)
EVT_END_IF
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar1, 25)

View File

@ -1,24 +0,0 @@
#ifndef BATTLE_ITEM_FOOD
#define BATTLE_ITEM_FOOD
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_food
API_CALLABLE(N(func_802A123C_73330C));
API_CALLABLE(N(func_802A12EC_7333BC));
API_CALLABLE(N(func_802A15A0_733670));
API_CALLABLE(N(func_802A1378_733448));
API_CALLABLE(N(func_802A1438_733508));
API_CALLABLE(N(AddHP));
API_CALLABLE(N(AddFP));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
extern EvtScript N(UseItem);
extern EvtScript N(EatItem);
extern EvtScript N(DrinkItem);
#endif

View File

@ -1,7 +1,10 @@
#include "fright_jar.h"
#include "common.h"
#include "script_api/battle.h"
#include "model.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_fright_jar
#include "battle/common/move/ItemRefund.inc.c"
#include "common/FadeBackgroundToBlack.inc.c"
@ -21,10 +24,10 @@ API_CALLABLE(N(func_802A12D4_72BBE4)) {
return ApiStatus_BLOCK;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x00000098)
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_FRIGHT_JAR)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(N(FadeBackgroundToBlack))
EVT_THREAD

View File

@ -1,16 +0,0 @@
#ifndef BATTLE_ITEM_FRIGHT_JAR
#define BATTLE_ITEM_FRIGHT_JAR
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_fright_jar
API_CALLABLE(N(FadeBackgroundToBlack));
API_CALLABLE(N(func_802A12D4_72BBE4));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
#endif

View File

@ -1,6 +1,9 @@
#include "hustle_drink.h"
#include "common.h"
#include "script_api/battle.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_hustle_drink
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_72619C)) {
BattleStatus* battleStatus = &gBattleStatus;
@ -34,9 +37,9 @@ API_CALLABLE(N(func_802A12C4_726224)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_HUSTLE_DRINK)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_EXEC_WAIT(N(DrinkItem))

View File

@ -1,17 +0,0 @@
#ifndef BATTLE_ITEM_HUSTLE_DRINK
#define BATTLE_ITEM_HUSTLE_DRINK
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_hustle_drink
API_CALLABLE(N(func_802A12C4_726224));
API_CALLABLE(N(func_802A123C_72619C));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
extern EvtScript N(DrinkItem);
#endif

View File

@ -1,10 +1,12 @@
#include "insecticide_herb.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "entity.h"
#include "ld_addrs.h"
#include "battle/move/item/insecticide_herb.png.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_insecticide_herb
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_72A98C)) {
BattleStatus* battleStatus = &gBattleStatus;
@ -49,10 +51,11 @@ API_CALLABLE(N(func_802A12E0_72AA30)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
static s32 _pad = 0; // XXX
#include "battle/move/item/insecticide_herb.png.h"
#include "battle/move/item/insecticide_herb.png.inc.c"
#include "battle/move/item/insecticide_herb.pal.inc.c"
@ -88,7 +91,7 @@ Gfx N(displayList)[] = {
EntityModelScript N(modelCommandList) = STANDARD_ENTITY_MODEL_SCRIPT(N(displayList), RENDER_MODE_ALPHATEST);
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_INSECTICIDE_HERB)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_D)

View File

@ -1,16 +0,0 @@
#ifndef BATTLE_ITEM_INSECTICIDE_HERB
#define BATTLE_ITEM_INSECTICIDE_HERB
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_insecticide_herb
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
API_CALLABLE(N(func_802A12E0_72AA30));
API_CALLABLE(N(func_802A123C_72A98C));
API_CALLABLE(N(func_802A1280_72A9D0));
#endif

View File

@ -1,10 +1,13 @@
#include "life_shroom.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "entity.h"
#define NAMESPACE battle_item_life_shroom
extern EntityModelScript D_80283EE8;
#include "ItemRefund.inc.c"
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_72E76C)) {
Bytecode* args = script->ptrReadPos;
@ -44,7 +47,7 @@ API_CALLABLE(N(func_802A12EC_72E81C)) {
return ApiStatus_DONE2;
}
API_CALLABLE(N(func_802A1378_72E8A8)) {
API_CALLABLE(N(ShowHeartRecoveryFX)) {
Bytecode* args = script->ptrReadPos;
s32 a = evt_get_variable(script, *args++);
s32 b = evt_get_variable(script, *args++);
@ -85,7 +88,7 @@ API_CALLABLE(N(func_802A1484_72E9B4)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(script6) = {
EVT_CALL(SetActorYaw, ACTOR_PLAYER, 30)
@ -165,7 +168,7 @@ EvtScript N(script6) = {
EVT_END
};
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET(LVarF, LVar1)
EVT_CALL(GetMenuSelection, LVar0, LVar1, LVar2)
EVT_SET(LVarA, LVar1)
@ -176,7 +179,7 @@ EvtScript N(main) = {
EVT_EXEC_WAIT(N(script6))
EVT_RETURN
EVT_END_IF
EVT_SET_CONST(LVarA, 0x00000095)
EVT_SET_CONST(LVarA, ITEM_LIFE_SHROOM)
EVT_SET(LVar1, LVarF)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_EXEC_WAIT(N(EatItem))
@ -184,7 +187,7 @@ EvtScript N(main) = {
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar0, 0)
EVT_ADD(LVar1, 35)
EVT_CALL(N(func_802A1378_72E8A8), LVar0, LVar1, LVar2, LVar3)
EVT_CALL(N(ShowHeartRecoveryFX), LVar0, LVar1, LVar2, LVar3)
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar1, 25)
EVT_CALL(ShowStartRecoveryShimmer, LVar0, LVar1, LVar2, LVar3)

View File

@ -1,21 +0,0 @@
#ifndef BATTLE_ITEM_LIFE_SHROOM
#define BATTLE_ITEM_LIFE_SHROOM
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_life_shroom
API_CALLABLE(N(func_802A123C_72E76C));
API_CALLABLE(N(func_802A12EC_72E81C));
API_CALLABLE(N(func_802A1484_72E9B4));
API_CALLABLE(N(func_802A1438_72E968));
API_CALLABLE(N(func_802A1378_72E8A8));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
extern EvtScript N(UseItem);
extern EvtScript N(EatItem);
#endif

View File

@ -1,10 +1,13 @@
#include "mushroom.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "entity.h"
#define NAMESPACE battle_item_mushroom
extern EntityModelScript D_80283EE8;
#include "ItemRefund.inc.c"
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_715A8C)) {
Bytecode* args = script->ptrReadPos;
@ -44,7 +47,7 @@ API_CALLABLE(N(func_802A12EC_715B3C)) {
return ApiStatus_DONE2;
}
API_CALLABLE(N(func_802A1378_715BC8)) {
API_CALLABLE(N(ShowHeartRecoveryFX)) {
Bytecode* args = script->ptrReadPos;
s32 a = evt_get_variable(script, *args++);
s32 b = evt_get_variable(script, *args++);
@ -56,7 +59,7 @@ API_CALLABLE(N(func_802A1378_715BC8)) {
return ApiStatus_DONE2;
}
API_CALLABLE(N(func_802A1438_715C88)) {
API_CALLABLE(N(ShowFlowerRecoveryFX)) {
Bytecode* args = script->ptrReadPos;
s32 a = evt_get_variable(script, *args++);
s32 b = evt_get_variable(script, *args++);
@ -84,7 +87,7 @@ API_CALLABLE(N(func_802A15A0_715DF0)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(script6) = {
EVT_CALL(SetActorYaw, ACTOR_PLAYER, 30)
@ -164,7 +167,7 @@ EvtScript N(script6) = {
EVT_END
};
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET(LVarE, LVar1)
EVT_CALL(GetMenuSelection, LVar0, LVar1, LVar2)
EVT_SET(LVarA, LVar1)
@ -185,13 +188,13 @@ EvtScript N(main) = {
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar0, 0)
EVT_ADD(LVar1, 35)
EVT_CALL(N(func_802A1378_715BC8), LVar0, LVar1, LVar2, LVarB)
EVT_CALL(N(ShowHeartRecoveryFX), LVar0, LVar1, LVar2, LVarB)
EVT_END_IF
EVT_IF_GT(LVarC, 0)
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar0, 20)
EVT_ADD(LVar1, 25)
EVT_CALL(N(func_802A1438_715C88), LVar0, LVar1, LVar2, LVarC)
EVT_CALL(N(ShowFlowerRecoveryFX), LVar0, LVar1, LVar2, LVarC)
EVT_END_IF
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar1, 25)

View File

@ -1,23 +0,0 @@
#ifndef BATTLE_ITEM_MUSHROOM
#define BATTLE_ITEM_MUSHROOM
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_mushroom
API_CALLABLE(N(func_802A123C_715A8C));
API_CALLABLE(N(func_802A12EC_715B3C));
API_CALLABLE(N(func_802A15A0_715DF0));
API_CALLABLE(N(func_802A1378_715BC8));
API_CALLABLE(N(func_802A1438_715C88));
API_CALLABLE(N(AddHP));
API_CALLABLE(N(AddFP));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
extern EvtScript N(UseItem);
extern EvtScript N(EatItem);
#endif

View File

@ -1,10 +1,73 @@
#include "mystery.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "entity.h"
#include "ld_addrs.h"
#include "battle/move/item/mystery.png.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_mystery
#include "battle/common/move/ItemRefund.inc.c"
#include "battle/common/move/UseItem.inc.c"
static s32 _pad = 0;
#include "battle/move/item/mystery.png.h"
#include "battle/move/item/mystery.png.inc.c"
#include "battle/move/item/mystery.pal.inc.c"
Vtx N(model)[] = {
{ .v = {{ -16, -16, 0 }, FALSE, { 0, 0 }, { 0, 0, 0, 255 }}},
{ .v = {{ 15, -16, 0 }, FALSE, { 1024, 0 }, { 0, 0, 0, 255 }}},
{ .v = {{ 15, 15, 0 }, FALSE, { 1024, 1024 }, { 0, 0, 0, 255 }}},
{ .v = {{ -16, 15, 0 }, FALSE, { 0, 1024 }, { 0, 0, 0, 255 }}},
};
Gfx N(displayList)[] = {
gsDPPipeSync(),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
gsDPSetTexturePersp(G_TP_PERSP),
gsDPSetTextureDetail(G_TD_CLAMP),
gsDPSetTextureLOD(G_TL_TILE),
gsDPSetTextureLUT(G_TT_NONE),
gsDPSetTextureFilter(G_TF_AVERAGE),
gsDPSetTextureConvert(G_TC_FILT),
gsDPSetTextureLUT(G_TT_RGBA16),
gsDPLoadTLUT_pal16(0, battle_item_mystery_pal),
gsDPLoadTextureTile_4b(battle_item_mystery_png, G_IM_FMT_CI, battle_item_mystery_png_width, battle_item_mystery_png_height, 0, 0, battle_item_mystery_png_width - 1, battle_item_mystery_png_height - 1, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD),
gsSPClearGeometryMode(G_LIGHTING),
gsSPClearGeometryMode(G_SHADING_SMOOTH),
gsSPVertex(N(model), ARRAY_COUNT(N(model)), 0),
gsSP1Triangle(0, 1, 2, 0),
gsSP1Triangle(0, 2, 3, 0),
gsDPPipeSync(),
gsSPEndDisplayList(),
};
EntityModelScript N(modelCommandList) = STANDARD_ENTITY_MODEL_SCRIPT(N(displayList), RENDER_MODE_ALPHATEST);
s32 N(D_802A227C_72D82C)[8] = {
ITEM_MUSHROOM,
ITEM_SUPER_SHROOM,
ITEM_FIRE_FLOWER,
ITEM_STONE_CAP,
ITEM_DIZZY_DIAL,
ITEM_THUNDER_RAGE,
ITEM_PEBBLE,
ITEM_MUSHROOM
};
s32 N(D_802A229C_72D84C)[8] = {
ITEM_MUSHROOM,
ITEM_SUPER_SHROOM,
ITEM_PEBBLE,
ITEM_STONE_CAP,
ITEM_MUSHROOM,
ITEM_SUPER_SHROOM,
ITEM_PEBBLE,
ITEM_MUSHROOM
};
extern IconHudScriptPair gItemHudScripts[];
@ -171,67 +234,7 @@ API_CALLABLE(N(func_802A188C_72CE3C)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
static s32 _pad = 0;
#include "battle/move/item/mystery.png.inc.c"
#include "battle/move/item/mystery.pal.inc.c"
Vtx N(model)[] = {
{ .v = {{ -16, -16, 0 }, FALSE, { 0, 0 }, { 0, 0, 0, 255 }}},
{ .v = {{ 15, -16, 0 }, FALSE, { 1024, 0 }, { 0, 0, 0, 255 }}},
{ .v = {{ 15, 15, 0 }, FALSE, { 1024, 1024 }, { 0, 0, 0, 255 }}},
{ .v = {{ -16, 15, 0 }, FALSE, { 0, 1024 }, { 0, 0, 0, 255 }}},
};
Gfx N(displayList)[] = {
gsDPPipeSync(),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
gsDPSetTexturePersp(G_TP_PERSP),
gsDPSetTextureDetail(G_TD_CLAMP),
gsDPSetTextureLOD(G_TL_TILE),
gsDPSetTextureLUT(G_TT_NONE),
gsDPSetTextureFilter(G_TF_AVERAGE),
gsDPSetTextureConvert(G_TC_FILT),
gsDPSetTextureLUT(G_TT_RGBA16),
gsDPLoadTLUT_pal16(0, battle_item_mystery_pal),
gsDPLoadTextureTile_4b(battle_item_mystery_png, G_IM_FMT_CI, battle_item_mystery_png_width, battle_item_mystery_png_height, 0, 0, battle_item_mystery_png_width - 1, battle_item_mystery_png_height - 1, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD),
gsSPClearGeometryMode(G_LIGHTING),
gsSPClearGeometryMode(G_SHADING_SMOOTH),
gsSPVertex(N(model), ARRAY_COUNT(N(model)), 0),
gsSP1Triangle(0, 1, 2, 0),
gsSP1Triangle(0, 2, 3, 0),
gsDPPipeSync(),
gsSPEndDisplayList(),
};
EntityModelScript N(modelCommandList) = STANDARD_ENTITY_MODEL_SCRIPT(N(displayList), RENDER_MODE_ALPHATEST);
s32 N(D_802A227C_72D82C)[8] = {
ITEM_MUSHROOM,
ITEM_SUPER_SHROOM,
ITEM_FIRE_FLOWER,
ITEM_STONE_CAP,
ITEM_DIZZY_DIAL,
ITEM_THUNDER_RAGE,
ITEM_PEBBLE,
ITEM_MUSHROOM
};
s32 N(D_802A229C_72D84C)[8] = {
ITEM_MUSHROOM,
ITEM_SUPER_SHROOM,
ITEM_PEBBLE,
ITEM_STONE_CAP,
ITEM_MUSHROOM,
ITEM_SUPER_SHROOM,
ITEM_PEBBLE,
ITEM_MUSHROOM
};
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_MYSTERY)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_THREAD

View File

@ -1,22 +0,0 @@
#ifndef BATTLE_ITEM_MYSTERY
#define BATTLE_ITEM_MYSTERY
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_mystery
API_CALLABLE(N(func_802A13E4_72C994));
API_CALLABLE(N(func_802A188C_72CE3C));
typedef struct N(tempStc) {
s32 iconId;
s32 unk_04;
} N(tempStc);
extern s32 N(D_802A227C_72D82C)[8];
extern s32 N(D_802A229C_72D84C)[8];
extern EvtScript N(UseItemWithEffect);
#endif

View File

@ -1,13 +1,16 @@
#include "pebble.h"
#include "common.h"
#include "script_api/battle.h"
#include "ld_addrs.h"
#include "battle/move/item/pebble.png.h"
#include "entity.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_pebble
#include "UseItem.inc.c"
#include "battle/common/move/ItemRefund.inc.c"
#include "battle/common/move/UseItem.inc.c"
static s32 _pad = 0;
#include "battle/move/item/pebble.png.h"
#include "battle/move/item/pebble.png.inc.c"
#include "battle/move/item/pebble.pal.inc.c"
@ -40,11 +43,9 @@ Gfx N(displayList)[] = {
gsSPEndDisplayList(),
};
s32 N(modelCommandList)[] = {
0x00000004, 0x0000000D, 0x00000001, sizeof(N(displayList)) / sizeof(s32), (s32) &N(displayList), 0x00000002, 0x00000000,
};
EntityModelScript N(modelCommandList) = STANDARD_ENTITY_MODEL_SCRIPT(N(displayList), RENDER_MODE_ALPHATEST);
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_PEBBLE)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_D)

View File

@ -1,13 +0,0 @@
#ifndef BATTLE_ITEM_PEBBLE
#define BATTLE_ITEM_PEBBLE
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_pebble
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
#endif

View File

@ -1,10 +1,12 @@
#include "please_come_back.h"
#include "common.h"
#include "script_api/battle.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_please_come_back
#include "UseItem.inc.c"
#include "battle/common/move/ItemRefund.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_DIZZY_DIAL) //@bug should be ITEM_PLEASE_COME_BACK
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(SetGoalToHome, ACTOR_PLAYER)
@ -18,4 +20,3 @@ EvtScript N(main) = {
EVT_RETURN
EVT_END
};

View File

@ -1,12 +0,0 @@
#ifndef BATTLE_ITEM_PLEASE_COME_BACK
#define BATTLE_ITEM_PLEASE_COME_BACK
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_please_come_back
extern EvtScript N(UseItemWithEffect);
#endif

View File

@ -1,6 +1,10 @@
#include "pow_block.h"
#include "common.h"
#include "script_api/battle.h"
#include "entity.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_pow_block
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_718A8C)) {
BattleStatus* battleStatus = &gBattleStatus;
@ -45,9 +49,9 @@ API_CALLABLE(N(func_802A1318_718B68)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_POW_BLOCK)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_WAIT(10)

View File

@ -1,18 +0,0 @@
#ifndef BATTLE_ITEM_POW_BLOCK
#define BATTLE_ITEM_POW_BLOCK
#include "common.h"
#include "script_api/battle.h"
#include "entity.h"
#undef NAMESPACE
#define NAMESPACE battle_item_pow_block
API_CALLABLE(N(func_802A1318_718B68));
API_CALLABLE(N(func_802A123C_718A8C));
API_CALLABLE(N(func_802A12E4_718B34));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
#endif

View File

@ -1,6 +1,9 @@
#include "repel_gel.h"
#include "common.h"
#include "script_api/battle.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_repel_gel
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_72DDAC)) {
BattleStatus* battleStatus = &gBattleStatus;
@ -14,9 +17,9 @@ API_CALLABLE(N(func_802A123C_72DDAC)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_REPEL_GEL)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(PlaySoundAtActor, ACTOR_PLAYER, SOUND_375)

View File

@ -1,15 +0,0 @@
#ifndef BATTLE_ITEM_REPEL_GEL
#define BATTLE_ITEM_REPEL_GEL
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_repel_gel
API_CALLABLE(N(func_802A123C_72DDAC));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
#endif

View File

@ -1,10 +1,14 @@
#include "shooting_star.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "model.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_shooting_star
API_CALLABLE(battle_item_shooting_star_func_802A123C_71D9AC) {
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_71D9AC)) {
s32 t1 = 200;
s32 r1 = rand_int(t1) + 100; // 100-299
s32 r2 = rand_int(40); // 0-39
@ -62,9 +66,9 @@ API_CALLABLE(N(func_802A14D4_71DC44)) {
return ApiStatus_BLOCK;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_SHOOTING_STAR)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_THREAD

View File

@ -1,18 +0,0 @@
#ifndef BATTLE_ITEM_SHOOTING_STAR
#define BATTLE_ITEM_SHOOTING_STAR
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_shooting_star
API_CALLABLE(N(func_802A1444_71DBB4));
API_CALLABLE(N(func_802A123C_71D9AC));
API_CALLABLE(N(func_802A1388_71DAF8));
API_CALLABLE(N(func_802A14D4_71DC44));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
#endif

View File

@ -1,12 +1,12 @@
#include "sleepy_sheep.h"
#include "common.h"
#include "script_api/battle.h"
#include "entity.h"
#include "ld_addrs.h"
#include "effects.h"
#include "battle/move/item/sleepy_sheep1.png.h"
#include "battle/move/item/sleepy_sheep2.png.h"
#include "battle/move/item/sleepy_sheep3.png.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_sleepy_sheep
#include "battle/common/move/ItemRefund.inc.c"
s32 virtual_entity_create(EntityModelScript*);
void virtual_entity_set_pos(s32, s32, s32, s32);
@ -166,14 +166,19 @@ API_CALLABLE(N(func_802A1848_71EE98)) {
return ApiStatus_BLOCK;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
static s32 _pad = 0;
#include "battle/move/item/sleepy_sheep1.png.h"
#include "battle/move/item/sleepy_sheep1.png.inc.c"
#include "battle/move/item/sleepy_sheep1.pal.inc.c"
#include "battle/move/item/sleepy_sheep2.png.h"
#include "battle/move/item/sleepy_sheep2.png.inc.c"
#include "battle/move/item/sleepy_sheep2.pal.inc.c"
#include "battle/move/item/sleepy_sheep3.png.h"
#include "battle/move/item/sleepy_sheep3.png.inc.c"
#include "battle/move/item/sleepy_sheep3.pal.inc.c"
@ -280,7 +285,7 @@ EntityModelScript N(modelCommandList3) = {
ems_End
};
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_SLEEPY_SHEEP)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(UseBattleCamPreset, BTL_CAM_PRESET_19)

View File

@ -1,23 +0,0 @@
#ifndef BATTLE_ITEM_SLEEPY_SHEEP
#define BATTLE_ITEM_SLEEPY_SHEEP
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_sleepy_sheep
API_CALLABLE(SetVirtualEntityMoveSpeed);
API_CALLABLE(VirtualEntityMoveTo);
API_CALLABLE(ItemAfflictEnemy);
API_CALLABLE(N(func_802A123C_71E88C));
API_CALLABLE(N(func_802A1740_71ED90));
API_CALLABLE(N(func_802A1848_71EE98));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
#endif

View File

@ -1,8 +1,11 @@
#include "snowman_doll.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "model.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_snowman_doll
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_71C06C)) {
Bytecode* args = script->ptrReadPos;
@ -34,10 +37,10 @@ API_CALLABLE(N(func_802A13B8_71C1E8)) {
return ApiStatus_BLOCK;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x00000081)
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_SNOWMAN_DOLL)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(N(FadeBackgroundToBlack))
EVT_CALL(PlaySoundAtActor, ACTOR_PLAYER, SOUND_363)

View File

@ -1,19 +0,0 @@
#ifndef BATTLE_ITEM_SNOWMAN_DOLL
#define BATTLE_ITEM_SNOWMAN_DOLL
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_snowman_doll
API_CALLABLE(N(FadeBackgroundToBlack));
API_CALLABLE(N(func_802A123C_71C06C));
API_CALLABLE(N(func_802A13B8_71C1E8));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
#endif

View File

@ -1,7 +1,10 @@
#include "stone_cap.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_stone_cap
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_7217DC)) {
BattleStatus* battleStatus = &gBattleStatus;
@ -45,10 +48,10 @@ API_CALLABLE(N(func_802A123C_7217DC)) {
return ApiStatus_BLOCK;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x00000088)
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_STONE_CAP)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(PlaySound, SOUND_361)
EVT_CALL(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario_30009)

View File

@ -1,17 +0,0 @@
#ifndef BATTLE_ITEM_STONE_CAP
#define BATTLE_ITEM_STONE_CAP
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_stone_cap
API_CALLABLE(N(func_802A123C_7217DC));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
#endif

View File

@ -1,8 +1,10 @@
#include "stop_watch.h"
#include "common.h"
#include "script_api/battle.h"
#include "model.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_stop_watch
#include "battle/common/move/ItemRefund.inc.c"
#include "common/FadeBackgroundToBlack.inc.c"
API_CALLABLE(N(func_802A12D4_7270A4)) {
@ -21,10 +23,10 @@ API_CALLABLE(N(func_802A12D4_7270A4)) {
return ApiStatus_BLOCK;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x00000092)
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_STOP_WATCH)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_THREAD
EVT_WAIT(5)

View File

@ -1,20 +0,0 @@
#ifndef BATTLE_ITEM_STOP_WATCH
#define BATTLE_ITEM_STOP_WATCH
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_stop_watch
API_CALLABLE(ItemAfflictEnemy);
API_CALLABLE(N(FadeBackgroundToBlack));
API_CALLABLE(N(func_802A12D4_7270A4));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
#endif

View File

@ -1,14 +1,39 @@
#include "strange_cake.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "hud_element.h"
#define NAMESPACE battle_item_strange_cake
#include "battle/common/move/ItemRefund.inc.c"
#include "battle/common/move/UseItem.inc.c"
static s32 _pad = 0; // XXX
#include "battle/move/item/strange_cake1.png.h"
#include "battle/move/item/strange_cake1.png.inc.c"
#include "battle/move/item/strange_cake1.pal.inc.c"
#include "battle/move/item/strange_cake2.png.h"
#include "battle/move/item/strange_cake2.png.inc.c"
#include "battle/move/item/strange_cake2.pal.inc.c"
#include "battle/move/item/strange_cake3.png.h"
#include "battle/move/item/strange_cake3.png.inc.c"
#include "battle/move/item/strange_cake3.pal.inc.c"
#include "ItemRefund.inc.c"
HudScript N(D_802A27D0) = HES_TEMPLATE_CI_ENUM_SIZE(battle_item_strange_cake1, 32, 32);
HudScript N(D_802A27F8) = HES_TEMPLATE_CI_ENUM_SIZE(battle_item_strange_cake2, 32, 32);
HudScript N(D_802A2820) = HES_TEMPLATE_CI_ENUM_SIZE(battle_item_strange_cake3, 32, 32);
extern HudScript* N(D_802A2848_732B48)[];
extern s32 N(D_802A2858_732B58)[];
HudScript* N(D_802A2848_732B48)[] = {
&N(D_802A27F8), &N(D_802A2820), &N(D_802A27D0), &N(D_802A27F8)
};
// indexes into D_802A2848_732B48
s32 N(D_802A2858_732B58)[] = {
0, 1, 2, 0, 1, 0
};
BSS s32 D_802A2DD4; // unused?
BSS s32 D_802A2DD8[5];
@ -151,7 +176,7 @@ s32 N(func_802A13E4_7316E4)(Evt* script, s32 isInitialCall) {
return ApiStatus_BLOCK;
}
API_CALLABLE(N(func_802A1818_731B18)) {
API_CALLABLE(N(ShowHeartRecoveryFX)) {
Bytecode* args = script->ptrReadPos;
s32 a = evt_get_variable(script, *args++);
s32 b = evt_get_variable(script, *args++);
@ -162,7 +187,7 @@ API_CALLABLE(N(func_802A1818_731B18)) {
return ApiStatus_DONE2;
}
API_CALLABLE(N(func_802A18D8_731BD8)) {
API_CALLABLE(N(ShowFlowerRecoveryFX)) {
Bytecode* args = script->ptrReadPos;
s32 a = evt_get_variable(script, *args++);
s32 b = evt_get_variable(script, *args++);
@ -174,7 +199,6 @@ API_CALLABLE(N(func_802A18D8_731BD8)) {
}
#include "common/AddHP.inc.c"
#include "common/AddFP.inc.c"
API_CALLABLE(N(func_802A1A40_731D40)) {
@ -237,31 +261,11 @@ API_CALLABLE(N(func_802A1B68_731E68)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
extern EvtScript N(script7);
extern EvtScript N(script8);
extern EvtScript N(script9);
static s32 _pad = 0; // XXX
#include "battle/move/item/strange_cake1.png.inc.c"
#include "battle/move/item/strange_cake1.pal.inc.c"
#include "battle/move/item/strange_cake2.png.inc.c"
#include "battle/move/item/strange_cake2.pal.inc.c"
#include "battle/move/item/strange_cake3.png.inc.c"
#include "battle/move/item/strange_cake3.pal.inc.c"
HudScript N(D_802A27D0) = HES_TEMPLATE_CI_ENUM_SIZE(battle_item_strange_cake1, 32, 32);
HudScript N(D_802A27F8) = HES_TEMPLATE_CI_ENUM_SIZE(battle_item_strange_cake2, 32, 32);
HudScript N(D_802A2820) = HES_TEMPLATE_CI_ENUM_SIZE(battle_item_strange_cake3, 32, 32);
HudScript* N(D_802A2848_732B48)[] = {
&N(D_802A27F8), &N(D_802A2820), &N(D_802A27D0), &N(D_802A27F8)
};
// indexes into D_802A2848_732B48
s32 N(D_802A2858_732B58)[] = {
0, 1, 2, 0, 1, 0
};
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_CALL(GetMenuSelection, LVar0, LVar1, LVar2)
EVT_IF_EQ(LVar1, ITEM_KOOKY_COOKIE)
EVT_SET_CONST(LVarA, ITEM_KOOKY_COOKIE)
@ -272,7 +276,7 @@ EvtScript N(main) = {
EVT_CALL(GetActorPos, 0, LVar0, LVar1, LVar2)
EVT_ADD(LVar0, 20)
EVT_ADD(LVar1, 25)
EVT_CALL(N(func_802A18D8_731BD8), LVar0, LVar1, LVar2, LVar3)
EVT_CALL(N(ShowFlowerRecoveryFX), LVar0, LVar1, LVar2, LVar3)
EVT_CALL(GetActorPos, 0, LVar0, LVar1, LVar2)
EVT_ADD(LVar1, 25)
EVT_CALL(ShowStartRecoveryShimmer, LVar0, LVar1, LVar2, LVar3)
@ -317,7 +321,7 @@ EvtScript N(script7) = {
EVT_CALL(SetAnimation, 0, 0, ANIM_Mario_10002)
EVT_CALL(GetActorPos, 0, LVar0, LVar1, LVar2)
EVT_ADD(LVar1, 20)
EVT_CALL(PlayEffect, 87, 0, LVar0, LVar1, LVar2, EVT_FLOAT(1.0), 30, 0, 0, 0, 0, 0, 0, 0)
EVT_CALL(PlayEffect, EFFECT_SNAKING_STATIC, 0, LVar0, LVar1, LVar2, EVT_FLOAT(1.0), 30, 0, 0, 0, 0, 0, 0, 0)
EVT_CALL(N(func_802A1AD8_731DD8))
EVT_WAIT(20)
EVT_CALL(ShowMessageBox, 16, 60)
@ -330,7 +334,7 @@ EvtScript N(script8) = {
EVT_CALL(SetAnimation, 0, 0, ANIM_Mario_10002)
EVT_CALL(GetActorPos, 0, LVar0, LVar1, LVar2)
EVT_ADD(LVar1, 20)
EVT_CALL(PlayEffect, 51, 6, LVar0, LVar1, LVar2, EVT_FLOAT(1.0), 30, 0, 0, 0, 0, 0, 0, 0)
EVT_CALL(PlayEffect, EFFECT_RADIAL_SHIMMER, 6, LVar0, LVar1, LVar2, EVT_FLOAT(1.0), 30, 0, 0, 0, 0, 0, 0, 0)
EVT_CALL(N(func_802A1B14_731E14))
EVT_WAIT(20)
EVT_CALL(ShowMessageBox, 17, 60)

View File

@ -1,27 +0,0 @@
#ifndef BATTLE_ITEM_STRANGE_CAKE
#define BATTLE_ITEM_STRANGE_CAKE
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_strange_cake
API_CALLABLE(N(func_802A1A8C_731D8C));
API_CALLABLE(N(func_802A18D8_731BD8));
API_CALLABLE(N(AddFP));
API_CALLABLE(N(func_802A13E4_7316E4));
API_CALLABLE(N(func_802A1AD8_731DD8));
API_CALLABLE(N(func_802A1B14_731E14));
API_CALLABLE(N(func_802A1B68_731E68));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
extern EvtScript N(EatItem);
extern EvtScript N(script7);
extern EvtScript N(script8);
extern EvtScript N(script9);
#endif

View File

@ -1,10 +1,13 @@
#include "super_soda.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "entity.h"
#define NAMESPACE battle_item_super_soda
extern EntityModelScript D_80283EE8;
#include "ItemRefund.inc.c"
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_724F1C)) {
Bytecode* args = script->ptrReadPos;
@ -75,7 +78,7 @@ API_CALLABLE(N(func_802A1378_725058)) {
return ApiStatus_DONE2;
}
API_CALLABLE(N(func_802A1418_7250F8)) {
API_CALLABLE(N(ShowFlowerRecoveryFX)) {
Bytecode* args = script->ptrReadPos;
s32 a = evt_get_variable(script, *args++);
s32 b = evt_get_variable(script, *args++);
@ -88,7 +91,7 @@ API_CALLABLE(N(func_802A1418_7250F8)) {
#include "common/AddFP.inc.c"
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(script6) = {
EVT_CALL(SetActorYaw, ACTOR_PLAYER, 30)
@ -168,8 +171,8 @@ EvtScript N(script6) = {
EVT_END
};
EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x0000009B)
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_SUPER_SODA)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(InitTargetIterator)
EVT_CALL(GetOwnerTarget, LVar0, LVar1)
@ -180,7 +183,7 @@ EvtScript N(main) = {
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar0, 0)
EVT_ADD(LVar1, 35)
EVT_CALL(N(func_802A1418_7250F8), LVar0, LVar1, LVar2, 5)
EVT_CALL(N(ShowFlowerRecoveryFX), LVar0, LVar1, LVar2, 5)
EVT_CALL(N(AddFP), 5)
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar1, 25)

View File

@ -1,20 +0,0 @@
#ifndef BATTLE_ITEM_SUPER_SODA
#define BATTLE_ITEM_SUPER_SODA
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_super_soda
API_CALLABLE(N(func_802A123C_724F1C));
API_CALLABLE(N(func_802A12EC_724FCC));
API_CALLABLE(N(func_802A1418_7250F8));
API_CALLABLE(N(AddFP));
API_CALLABLE(N(func_802A1378_725058));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
extern EvtScript N(UseItem);
#endif

View File

@ -1,7 +1,10 @@
#include "tasty_tonic.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_tasty_tonic
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_72223C)) {
s32 actorId = evt_get_variable(script, *script->ptrReadPos);
@ -30,10 +33,10 @@ API_CALLABLE(N(func_802A123C_72223C)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x89)
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_TASTY_TONIC)
EVT_EXEC_WAIT(battle_item_tasty_tonic_UseItemWithEffect)
EVT_CALL(InitTargetIterator)
EVT_CALL(GetOwnerTarget, LVar0, LVar1)

View File

@ -1,16 +0,0 @@
#ifndef BATTLE_ITEM_TASTY_TONIC
#define BATTLE_ITEM_TASTY_TONIC
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_tasty_tonic
API_CALLABLE(N(func_802A123C_72223C));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
extern EvtScript N(DrinkItem);
#endif

View File

@ -1,8 +1,11 @@
#include "thunder_bolt.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "model.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_thunder_bolt
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_722D7C)) {
Actor* enemyTarget = get_actor(script->owner1.enemyID);
@ -50,10 +53,10 @@ API_CALLABLE(N(func_802A1420_722F60)) {
return ApiStatus_BLOCK;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x84)
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_THUNDER_BOLT)
EVT_EXEC_WAIT(battle_item_thunder_bolt_UseItemWithEffect)
EVT_THREAD
EVT_WAIT(5)

View File

@ -1,17 +0,0 @@
#ifndef BATTLE_ITEM_THUNDER_BOLT
#define BATTLE_ITEM_THUNDER_BOLT
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_thunder_bolt
API_CALLABLE(N(FadeBackgroundToBlack));
API_CALLABLE(N(func_802A123C_722D7C));
API_CALLABLE(N(func_802A1420_722F60));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
#endif

View File

@ -1,9 +1,11 @@
#include "thunder_rage.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "model.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_thunder_rage
#include "battle/common/move/ItemRefund.inc.c"
#include "common/FadeBackgroundToBlack.inc.c"
API_CALLABLE(N(func_802A12D4_71B474)) {
@ -50,9 +52,9 @@ API_CALLABLE(N(func_802A1354_71B4F4)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_THUNDER_RAGE)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CHILD_THREAD

View File

@ -1,17 +0,0 @@
#ifndef BATTLE_ITEM_THUNDER_RAGE
#define BATTLE_ITEM_THUNDER_RAGE
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_thunder_rage
API_CALLABLE(N(FadeBackgroundToBlack));
API_CALLABLE(N(func_802A1354_71B4F4));
API_CALLABLE(N(func_802A12D4_71B474));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
#endif

View File

@ -1,9 +1,12 @@
#include "ultra_shroom.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_ultra_shroom
API_CALLABLE(N(func_802A123C_7239BC)) {
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(ShowHeartRecoveryFX)) {
Bytecode* args = script->ptrReadPos;
s32 a = evt_get_variable(script, *args++);
s32 b = evt_get_variable(script, *args++);
@ -14,7 +17,7 @@ API_CALLABLE(N(func_802A123C_7239BC)) {
return ApiStatus_DONE2;
}
API_CALLABLE(N(func_802A12FC_723A7C)) {
API_CALLABLE(N(HealPlayer10)) {
PlayerData* playerData = &gPlayerData;
playerData->curHP += 10;
@ -24,10 +27,10 @@ API_CALLABLE(N(func_802A12FC_723A7C)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x0000008C)
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_SUPER_SHROOM)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_CALL(AddBattleCamZoom, 50)
EVT_CALL(MoveBattleCamOver, 20)
@ -35,12 +38,12 @@ EvtScript N(main) = {
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar0, 0)
EVT_ADD(LVar1, 35)
EVT_CALL(N(func_802A123C_7239BC), LVar0, LVar1, LVar2, 10)
EVT_CALL(N(ShowHeartRecoveryFX), LVar0, LVar1, LVar2, 10)
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar1, 25)
EVT_ADD(LVar2, 5)
EVT_CALL(ShowStartRecoveryShimmer, LVar0, LVar1, LVar2, 10)
EVT_CALL(N(func_802A12FC_723A7C))
EVT_CALL(N(HealPlayer10))
EVT_WAIT(10)
EVT_CALL(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario_ThumbsUp)
EVT_WAIT(30)

View File

@ -1,17 +0,0 @@
#ifndef BATTLE_ITEM_ULTRA_SHROOM
#define BATTLE_ITEM_ULTRA_SHROOM
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_ultra_shroom
API_CALLABLE(N(func_802A123C_7239BC));
API_CALLABLE(N(func_802A12FC_723A7C));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
extern EvtScript N(EatItem);
#endif

View File

@ -1,9 +1,12 @@
#include "unknown_item.h"
#include "common.h"
#include "script_api/battle.h"
#include "effects.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_unknown_item
API_CALLABLE(N(func_802A123C_72447C)) {
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(ShowHeartRecoveryFX)) {
Bytecode* args = script->ptrReadPos;
s32 a = evt_get_variable(script, *args++);
s32 b = evt_get_variable(script, *args++);
@ -14,7 +17,7 @@ API_CALLABLE(N(func_802A123C_72447C)) {
return ApiStatus_DONE2;
}
API_CALLABLE(N(func_802A12FC_72453C)) {
API_CALLABLE(N(HealPlayer20)) {
PlayerData* playerData = &gPlayerData;
playerData->curHP += 20;
@ -24,21 +27,21 @@ API_CALLABLE(N(func_802A12FC_72453C)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x0000008E)
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_ULTRA_SHROOM)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_EXEC_WAIT(N(EatItem))
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar0, 0)
EVT_ADD(LVar1, 35)
EVT_CALL(N(func_802A123C_72447C), LVar0, LVar1, LVar2, 20)
EVT_CALL(N(ShowHeartRecoveryFX), LVar0, LVar1, LVar2, 20)
EVT_CALL(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
EVT_ADD(LVar1, 25)
EVT_ADD(LVar2, 5)
EVT_CALL(ShowStartRecoveryShimmer, LVar0, LVar1, LVar2, 20)
EVT_CALL(N(func_802A12FC_72453C))
EVT_CALL(N(HealPlayer20))
EVT_WAIT(10)
EVT_CALL(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario_ThumbsUp)
EVT_WAIT(30)

View File

@ -1,17 +0,0 @@
#ifndef BATTLE_ITEM_UNKNOWN_ITEM
#define BATTLE_ITEM_UNKNOWN_ITEM
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_unknown_item
API_CALLABLE(N(func_802A123C_72447C));
API_CALLABLE(N(func_802A12FC_72453C));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
extern EvtScript N(EatItem);
#endif

View File

@ -1,6 +1,9 @@
#include "volt_shroom.h"
#include "common.h"
#include "script_api/battle.h"
#include "ItemRefund.inc.c"
#define NAMESPACE battle_item_volt_shroom
#include "battle/common/move/ItemRefund.inc.c"
API_CALLABLE(N(func_802A123C_71AA2C)) {
BattleStatus* battleStatus = &gBattleStatus;
@ -11,10 +14,10 @@ API_CALLABLE(N(func_802A123C_71AA2C)) {
return ApiStatus_DONE2;
}
#include "UseItem.inc.c"
#include "battle/common/move/UseItem.inc.c"
EvtScript N(main) = {
EVT_SET_CONST(LVarA, 0x0000008B)
EvtScript N(EVS_UseItem) = {
EVT_SET_CONST(LVarA, ITEM_VOLT_SHROOM)
EVT_EXEC_WAIT(N(UseItemWithEffect))
EVT_EXEC_WAIT(N(EatItem))
EVT_CALL(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario_10002)

View File

@ -1,16 +0,0 @@
#ifndef BATTLE_ITEM_VOLT_SHROOM
#define BATTLE_ITEM_VOLT_SHROOM
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_volt_shroom
API_CALLABLE(N(func_802A123C_71AA2C));
extern EvtScript N(UseItemWithEffect);
extern EvtScript N(PlayerGoHome);
extern EvtScript N(EatItem);
#endif

View File

@ -217,7 +217,7 @@ EvtScript N(802A2020) = {
EVT_CALL(PlaySound, 0x2041)
EVT_CALL(CreateNpc, 100, LVar0)
EVT_CALL(N(SetNpcCollision32))
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_40000)), TRUE)
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_IGNORE_CAMERA_FOR_YAW)), TRUE)
EVT_CALL(SetNpcPos, 100, -75, 150, 0)
EVT_CALL(SetNpcDecoration, 100, 0, 5)
EVT_CALL(N(UnkStarFunc3), -75, 167, 0)

View File

@ -166,7 +166,7 @@ EvtScript N(802A1D60) = {
EVT_CALL(PlaySound, 0x2041)
EVT_CALL(CreateNpc, 100, LVar0)
EVT_CALL(N(SetNpcCollision32))
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_40000)), TRUE)
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_IGNORE_CAMERA_FOR_YAW)), TRUE)
EVT_CALL(SetNpcPos, 100, -75, 150, 0)
EVT_CALL(SetNpcDecoration, 100, 0, 5)
EVT_CALL(N(UnkStarFunc3), -75, 167, 0)

View File

@ -152,7 +152,7 @@ EvtScript N(802A1D50) = {
EVT_CALL(PlaySound, 0x2041)
EVT_CALL(CreateNpc, 100, LVar0)
EVT_CALL(N(SetNpcCollision32))
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_40000)), TRUE)
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_IGNORE_CAMERA_FOR_YAW)), TRUE)
EVT_CALL(SetNpcPos, 100, -75, 150, 0)
EVT_CALL(SetNpcDecoration, 100, 0, 5)
EVT_CALL(N(UnkStarFunc3), -75, 167, 0)

View File

@ -130,7 +130,7 @@ EvtScript N(802A1C60) = {
EVT_CALL(PlaySound, 0x2041)
EVT_CALL(CreateNpc, 100, LVar0)
EVT_CALL(N(SetNpcCollision32))
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_40000)), TRUE)
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_IGNORE_CAMERA_FOR_YAW)), TRUE)
EVT_CALL(SetNpcPos, 100, -75, 150, 0)
EVT_CALL(SetNpcDecoration, 100, 0, 5)
EVT_CALL(N(UnkStarFunc3), -75, 167, 0)

View File

@ -239,7 +239,7 @@ EvtScript N(802A21A0) = {
EVT_CALL(PlaySound, 0x2041)
EVT_CALL(CreateNpc, 100, LVar0)
EVT_CALL(N(SetNpcCollision32))
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_40000)), TRUE)
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_IGNORE_CAMERA_FOR_YAW)), TRUE)
EVT_CALL(SetNpcPos, 100, -75, 150, 0)
EVT_CALL(SetNpcDecoration, 100, 0, 5)
EVT_CALL(N(UnkStarFunc3), -75, 167, 0)

View File

@ -138,7 +138,7 @@ EvtScript N(802A1D60) = {
EVT_CALL(PlaySound, 0x2041)
EVT_CALL(CreateNpc, 100, LVar0)
EVT_CALL(N(SetNpcCollision32))
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_40000)), TRUE)
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_IGNORE_CAMERA_FOR_YAW)), TRUE)
EVT_CALL(SetNpcPos, 100, -75, 150, 0)
EVT_CALL(SetNpcDecoration, 100, 0, 5)
EVT_CALL(N(UnkStarFunc3), -75, 167, 0)

View File

@ -152,7 +152,7 @@ EvtScript N(802A1E20) = {
EVT_CALL(PlaySound, 0x2041)
EVT_CALL(CreateNpc, 100, LVar0)
EVT_CALL(N(SetNpcCollision32))
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_40000)), TRUE)
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_IGNORE_CAMERA_FOR_YAW)), TRUE)
EVT_CALL(SetNpcPos, 100, -75, 150, 0)
EVT_CALL(SetNpcDecoration, 100, 0, 5)
EVT_CALL(N(UnkStarFunc3), -75, 167, 0)

View File

@ -124,7 +124,7 @@ EvtScript N(802A1C50) = {
EVT_CALL(PlaySound, 0x2041)
EVT_CALL(CreateNpc, 100, LVar0)
EVT_CALL(N(SetNpcCollision32))
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_40000)), TRUE)
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_IGNORE_CAMERA_FOR_YAW)), TRUE)
EVT_CALL(SetNpcPos, 100, -75, 150, 0)
EVT_CALL(SetNpcDecoration, 100, 0, 5)
EVT_CALL(N(UnkStarFunc3), -75, 167, 0)

View File

@ -143,7 +143,7 @@ EvtScript N(802A1CE0) = {
EVT_CALL(PlaySound, 0x2041)
EVT_CALL(CreateNpc, 100, LVar0)
EVT_CALL(N(SetNpcCollision32))
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_40000)), TRUE)
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_IGNORE_CAMERA_FOR_YAW)), TRUE)
EVT_CALL(SetNpcPos, 100, -75, 150, 0)
EVT_CALL(SetNpcDecoration, 100, 0, 5)
EVT_CALL(N(UnkStarFunc3), -75, 167, 0)

View File

@ -185,7 +185,7 @@ EvtScript N(802A1E00) = {
EVT_CALL(PlaySound, 0x2041)
EVT_CALL(CreateNpc, 100, LVar0)
EVT_CALL(N(SetNpcCollision32))
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_40000)), TRUE)
EVT_CALL(SetNpcFlagBits, 100, ((NPC_FLAG_IGNORE_CAMERA_FOR_YAW)), TRUE)
EVT_CALL(SetNpcPos, 100, -75, 150, 0)
EVT_CALL(SetNpcDecoration, 100, 0, 5)
EVT_CALL(N(UnkStarFunc3), -75, 167, 0)

View File

@ -2,8 +2,40 @@
#include "ld_addrs.h"
#include "battle.h"
s32 D_80293B80[] = {
-1,
extern EvtScript battle_item_food_EVS_UseItem;
extern EvtScript battle_item_mushroom_EVS_UseItem;
extern EvtScript battle_item_fire_flower_EVS_UseItem;
extern EvtScript battle_item_dusty_hammer_EVS_UseItem;
extern EvtScript battle_item_pow_block_EVS_UseItem;
extern EvtScript battle_item_pebble_EVS_UseItem;
extern EvtScript battle_item_volt_shroom_EVS_UseItem;
extern EvtScript battle_item_thunder_rage_EVS_UseItem;
extern EvtScript battle_item_snowman_doll_EVS_UseItem;
extern EvtScript battle_item_shooting_star_EVS_UseItem;
extern EvtScript battle_item_sleepy_sheep_EVS_UseItem;
extern EvtScript battle_item_stone_cap_EVS_UseItem;
extern EvtScript battle_item_tasty_tonic_EVS_UseItem;
extern EvtScript battle_item_thunder_bolt_EVS_UseItem;
extern EvtScript battle_item_super_soda_EVS_UseItem;
extern EvtScript battle_item_hustle_drink_EVS_UseItem;
extern EvtScript battle_item_stop_watch_EVS_UseItem;
extern EvtScript battle_item_dizzy_dial_EVS_UseItem;
extern EvtScript battle_item_please_come_back_EVS_UseItem;
extern EvtScript battle_item_egg_missile_EVS_UseItem;
extern EvtScript battle_item_insecticide_herb_EVS_UseItem;
extern EvtScript battle_item_fright_jar_EVS_UseItem;
extern EvtScript battle_item_mystery_EVS_UseItem;
extern EvtScript battle_item_repel_gel_EVS_UseItem;
extern EvtScript battle_item_life_shroom_EVS_UseItem;
extern EvtScript battle_item_coconut_EVS_UseItem;
extern EvtScript battle_item_electro_pop_EVS_UseItem;
extern EvtScript battle_item_strange_cake_EVS_UseItem;
#define GENERIC_FOOD_ITEM -1
// items in this list must correspond with BattleMoveEntry in gBattleItemTable
s32 ItemKeys[] = {
GENERIC_FOOD_ITEM,
ITEM_MUSHROOM,
ITEM_FIRE_FLOWER,
ITEM_DUSTY_HAMMER,
@ -38,35 +70,6 @@ s32 D_80293B80[] = {
ITEM_NONE
};
extern EvtScript battle_item_food_main;
extern EvtScript battle_item_mushroom_main;
extern EvtScript battle_item_fire_flower_main;
extern EvtScript battle_item_dusty_hammer_main;
extern EvtScript battle_item_pow_block_main;
extern EvtScript battle_item_pebble_main;
extern EvtScript battle_item_volt_shroom_main;
extern EvtScript battle_item_thunder_rage_main;
extern EvtScript battle_item_snowman_doll_main;
extern EvtScript battle_item_shooting_star_main;
extern EvtScript battle_item_sleepy_sheep_main;
extern EvtScript battle_item_stone_cap_main;
extern EvtScript battle_item_tasty_tonic_main;
extern EvtScript battle_item_thunder_bolt_main;
extern EvtScript battle_item_super_soda_main;
extern EvtScript battle_item_hustle_drink_main;
extern EvtScript battle_item_stop_watch_main;
extern EvtScript battle_item_dizzy_dial_main;
extern EvtScript battle_item_please_come_back_main;
extern EvtScript battle_item_egg_missile_main;
extern EvtScript battle_item_insecticide_herb_main;
extern EvtScript battle_item_fright_jar_main;
extern EvtScript battle_item_mystery_main;
extern EvtScript battle_item_repel_gel_main;
extern EvtScript battle_item_life_shroom_main;
extern EvtScript battle_item_coconut_main;
extern EvtScript battle_item_electro_pop_main;
extern EvtScript battle_item_strange_cake_main;
BattleMoveEntry gBattleItemTable[] = {
BTL_ITEM(food),
BTL_ITEM(mushroom),
@ -107,7 +110,7 @@ u16 D_80293E04[] = {
1, 31, 1, 5, 1, 2, 9, 3, 9, 3, 9, 1, 10, 6, 10, 6, 10, 4, 11, 8, 11, 8, 11, 4, 12, 3, 12, 3, 12, 1,
};
ApiStatus LoadItemScript(Evt* script, s32 isInitialCall) {
API_CALLABLE(LoadItemScript) {
PlayerData* playerData = &gPlayerData;
BattleStatus* battleStatus = &gBattleStatus;
s16 itemID = battleStatus->moveArgument;
@ -136,7 +139,7 @@ ApiStatus LoadItemScript(Evt* script, s32 isInitialCall) {
}
}
itemPtr = &D_80293B80[0];
itemPtr = &ItemKeys[0];
for (i = 0; *itemPtr != ITEM_NONE; i++, itemPtr++) {
if (*itemPtr == battleStatus->moveArgument) {
break;
@ -159,7 +162,7 @@ ApiStatus LoadItemScript(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
ApiStatus LoadFreeItemScript(Evt* script, s32 isInitialCall) {
API_CALLABLE(LoadMysteryItemScript) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* actor = battleStatus->playerActor;
ItemData* item = &gItemTable[battleStatus->moveArgument];
@ -176,7 +179,7 @@ ApiStatus LoadFreeItemScript(Evt* script, s32 isInitialCall) {
battleStatus->currentTargetID = target->actorID;
battleStatus->currentTargetPart = target->partID;
itemPtr = &D_80293B80[0];
itemPtr = &ItemKeys[0];
for (i = 0; *itemPtr != ITEM_NONE; i++, itemPtr++) {
if (*itemPtr == battleStatus->moveArgument){
break;
@ -199,7 +202,7 @@ ApiStatus LoadFreeItemScript(Evt* script, s32 isInitialCall) {
EvtScript UseMystery = {
EVT_WAIT(2)
EVT_CALL(LoadFreeItemScript)
EVT_CALL(LoadMysteryItemScript)
EVT_EXEC_WAIT(LVar0)
EVT_RETURN
EVT_END

View File

@ -32,7 +32,7 @@ EvtScript D_80077C44 = {
EVT_CALL(FadeBackgroundToBlack)
EVT_WAIT(10)
EVT_CALL(CreateNpc, NPC_BTL_MERLEE, ANIM_BattleMerlee_Gather)
EVT_CALL(SetNpcFlagBits, NPC_BTL_MERLEE, NPC_FLAG_100, TRUE)
EVT_CALL(SetNpcFlagBits, NPC_BTL_MERLEE, NPC_FLAG_IGNORE_PLAYER_COLLISION, TRUE)
EVT_CALL(SetNpcYaw, NPC_BTL_MERLEE, 0)
EVT_CALL(GetCamLookAtObjVector)
EVT_CALL(SetNpcPos, NPC_BTL_MERLEE, LVar0, LVar1, LVar2)
@ -417,9 +417,9 @@ ApiStatus OnDefeatEnemy(Evt* script, s32 isInitialCall) {
}
if (script->functionTemp[1] & 1) {
npc->flags &= ~NPC_FLAG_2;
npc->flags &= ~NPC_FLAG_INVISIBLE;
} else {
npc->flags |= NPC_FLAG_2;
npc->flags |= NPC_FLAG_INVISIBLE;
}
if (script->functionTemp[1] == 15) {
@ -437,7 +437,7 @@ ApiStatus OnDefeatEnemy(Evt* script, s32 isInitialCall) {
script->functionTemp[1]--;
if (script->functionTemp[1] == 0) {
npc->flags |= NPC_FLAG_2;
npc->flags |= NPC_FLAG_INVISIBLE;
return ApiStatus_DONE1;
}
@ -489,7 +489,7 @@ void update_encounters_neutral(void) {
f32 colRadius;
f32 hammerDir;
s32 cond;
s32 triggeredBattle;
s32 cond2;
s32 firstStrikeType;
s32 suspendTime;
@ -564,11 +564,11 @@ void update_encounters_neutral(void) {
}
if (suspendTime & 1) {
npc->flags |= NPC_FLAG_80000000;
enemy->flags |= ENEMY_FLAG_80000000;
npc->flags |= NPC_FLAG_SUSPENDED;
enemy->flags |= ENEMY_FLAG_SUSPENDED;
} else {
npc->flags &= ~NPC_FLAG_80000000;
enemy->flags &= ~ENEMY_FLAG_80000000;
npc->flags &= ~NPC_FLAG_SUSPENDED;
enemy->flags &= ~ENEMY_FLAG_SUSPENDED;
}
script = get_script_by_id(enemy->auxScriptID);
if (script != NULL) {
@ -588,11 +588,11 @@ void update_encounters_neutral(void) {
clear_script_flags(script, EVT_FLAG_SUSPENDED);
}
}
} else if (!(enemy->flags & ENEMY_FLAG_200000)) {
} else if (!(enemy->flags & ENEMY_FLAG_ACTIVE_WHILE_OFFSCREEN)) {
get_screen_coords(gCurrentCameraID, npc->pos.x, npc->pos.y, npc->pos.z, &screenX, &screenY, &screenZ);
if ((screenX < -160 || screenX > 480 || screenY < -120 || screenY > 360 || screenZ < 0) && !(enemy->flags & ENEMY_FLAG_PASSIVE)) {
npc->flags |= NPC_FLAG_80000000;
enemy->flags |= ENEMY_FLAG_80000000;
npc->flags |= NPC_FLAG_SUSPENDED;
enemy->flags |= ENEMY_FLAG_SUSPENDED;
script = get_script_by_id(enemy->auxScriptID);
if (script != NULL) {
set_script_flags(script, EVT_FLAG_SUSPENDED);
@ -602,8 +602,8 @@ void update_encounters_neutral(void) {
set_script_flags(script, EVT_FLAG_SUSPENDED);
}
} else {
npc->flags &= ~NPC_FLAG_80000000;
enemy->flags &= ~ENEMY_FLAG_80000000;
npc->flags &= ~NPC_FLAG_SUSPENDED;
enemy->flags &= ~ENEMY_FLAG_SUSPENDED;
script = get_script_by_id(enemy->auxScriptID);
if (script != NULL) {
clear_script_flags(script, EVT_FLAG_SUSPENDED);
@ -614,8 +614,8 @@ void update_encounters_neutral(void) {
}
}
} else {
npc->flags &= ~NPC_FLAG_80000000;
enemy->flags &= ~ENEMY_FLAG_80000000;
npc->flags &= ~NPC_FLAG_SUSPENDED;
enemy->flags &= ~ENEMY_FLAG_SUSPENDED;
script = get_script_by_id(enemy->auxScriptID);
if (script != NULL) {
clear_script_flags(script, EVT_FLAG_SUSPENDED);
@ -626,22 +626,22 @@ void update_encounters_neutral(void) {
}
}
if (enemy->flags & ENEMY_FLAG_80000000) {
if (enemy->flags & ENEMY_FLAG_SUSPENDED) {
continue;
}
if (enemy->flags & ENEMY_FLAG_PASSIVE) {
if (!(enemy->flags & ENEMY_FLAG_400000)) {
if (npc == playerStatus->encounteredNPC) {
enemy->unk_E0 = npc->yaw;
enemy->savedNpcYaw = npc->yaw;
npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z);
script = get_script_by_id(enemy->aiScriptID);
if (script != NULL) {
set_script_flags(script, EVT_FLAG_SUSPENDED);
}
} else {
if (enemy->unk_E0 != 12345) {
npc->yaw = enemy->unk_E0;
enemy->unk_E0 = 12345;
if (enemy->savedNpcYaw != 12345) {
npc->yaw = enemy->savedNpcYaw;
enemy->savedNpcYaw = 12345;
}
script = get_script_by_id(enemy->aiScriptID);
if (script != NULL) {
@ -667,7 +667,7 @@ void update_encounters_neutral(void) {
continue;
}
do {
if (!(enemy->flags & ENEMY_FLAG_10000000) && partner_test_enemy_collision(npc) != 0) {
if (!(enemy->flags & ENEMY_FLAG_IGNORE_PARTNER) && partner_test_enemy_collision(npc)) {
currentEncounter->hitType = ENCOUNTER_TRIGGER_PARTNER;
enemy->encountered = ENCOUNTER_TRIGGER_PARTNER;
currentEncounter->currentEncounter = encounter;
@ -741,7 +741,7 @@ void update_encounters_neutral(void) {
break;
}
}
if (enemy->unk_07 != 0) {
if (enemy->hitboxIsActive) {
npcX = enemy->unk_10.x;
npcY = enemy->unk_10.y;
npcZ = enemy->unk_10.z;
@ -749,20 +749,20 @@ void update_encounters_neutral(void) {
angle1 = fabsf(get_clamped_angle_diff(atan2(playerX, playerZ, npcX, npcZ), playerYaw));
angle2 = fabsf(get_clamped_angle_diff(atan2(npcX, npcZ, playerX, playerZ), npcYaw));
cond = FALSE;
triggeredBattle = FALSE;
if (angle1 >= 90.0f && angle2 >= 90.0f) {
cond = FALSE;
triggeredBattle = FALSE;
}
if (angle1 < 90.0f && angle2 >= 90.0f) {
cond = TRUE;
triggeredBattle = TRUE;
}
if (angle1 >= 90.0f && angle2 < 90.0f) {
cond = FALSE;
triggeredBattle = FALSE;
}
if (angle1 < 90.0f && angle2 < 90.0f) {
cond = TRUE;
triggeredBattle = TRUE;
}
if (cond) {
if (triggeredBattle) {
sfx_play_sound_at_position(SOUND_HIT_PLAYER_NORMAL, SOUND_SPACE_MODE_0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z);
currentEncounter->hitType = ENCOUNTER_TRIGGER_HAMMER;
currentEncounter->hitTier = gPlayerData.hammerLevel;
@ -804,7 +804,7 @@ void update_encounters_neutral(void) {
break;
}
}
cond = FALSE;
triggeredBattle = FALSE;
if (npcY + colHeight < playerY + playerJumpColHeight * 0.5f) {
if (playerStatus->actionState == ACTION_STATE_FALLING ||
playerStatus->actionState == ACTION_STATE_STEP_DOWN ||
@ -814,13 +814,13 @@ void update_encounters_neutral(void) {
playerStatus->actionState == ACTION_STATE_SPIN_POUND ||
playerStatus->actionState == ACTION_STATE_TORNADO_JUMP ||
playerStatus->actionState == ACTION_STATE_TORNADO_POUND) {
cond = TRUE;
triggeredBattle = TRUE;
}
}
if (playerY + playerJumpColHeight < npcY + colHeight * 0.5f) {
cond = FALSE;
triggeredBattle = FALSE;
}
if (cond) {
if (triggeredBattle) {
if (gPlayerData.bootsLevel < 0) {
currentEncounter->hitType = ENCOUNTER_TRIGGER_NONE;
enemy->encountered = ENCOUNTER_TRIGGER_NONE;
@ -889,14 +889,14 @@ void update_encounters_neutral(void) {
continue;
}
}
cond = FALSE;
triggeredBattle = FALSE;
if (is_ability_active(ABILITY_SPIN_ATTACK) && gPlayerData.level >= enemy->npcSettings->level) {
cond = !currentEncounter->scriptedBattle;
triggeredBattle = !currentEncounter->scriptedBattle;
}
if (is_ability_active(ABILITY_DIZZY_ATTACK)) {
cond = TRUE;
triggeredBattle = TRUE;
}
if ((playerStatus->animFlags & PA_FLAG_SPINNING) && !(enemy->flags & ENEMY_FLAG_20000000) && cond) {
if ((playerStatus->animFlags & PA_FLAG_SPINNING) && !(enemy->flags & ENEMY_FLAG_IGNORE_SPIN) && triggeredBattle) {
sfx_play_sound_at_position(SOUND_HIT_PLAYER_NORMAL, SOUND_SPACE_MODE_0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z);
testX = playerStatus->position.x + ((npc->pos.x - playerStatus->position.x) * 0.5f);
testY = playerStatus->position.y + (((npc->pos.y + npc->collisionHeight) - (playerStatus->position.y + playerStatus->colliderHeight)) * 0.5f);
@ -918,22 +918,24 @@ void update_encounters_neutral(void) {
testY = playerStatus->position.y + (((npc->pos.y + npc->collisionHeight) - (playerStatus->position.y + playerStatus->colliderHeight)) * 0.5f);
testZ = playerStatus->position.z + ((npc->pos.z - playerStatus->position.z) * 0.5f);
fx_damage_stars(3, testX, testY, testZ, 0.0f, -1.0f, 0.0f, 3);
// if the hitbox is active, trigger a first strike
firstStrikeType = FIRST_STRIKE_NONE;
if (enemy->unk_07 != 0) {
if (enemy->hitboxIsActive) {
if (is_ability_active(ABILITY_CHILL_OUT)) {
firstStrikeType = FIRST_STRIKE_NONE;
} else {
firstStrikeType = FIRST_STRIKE_ENEMY;
}
}
if (!is_ability_active(ABILITY_BUMP_ATTACK) || gPlayerData.level < enemy->npcSettings->level || (enemy->flags & ENEMY_FLAG_40)) {
currentEncounter->firstStrikeType = firstStrikeType;
} else {
if (!currentEncounter->scriptedBattle) {
firstStrikeType = FIRST_STRIKE_NONE;
}
currentEncounter->firstStrikeType = firstStrikeType;
// cancel the first strike if bump attack is applicable
if ((is_ability_active(ABILITY_BUMP_ATTACK)
&& (gPlayerData.level >= enemy->npcSettings->level)
&& !(enemy->flags & ENEMY_FLAG_PROJECTILE))
&& !currentEncounter->scriptedBattle
) {
firstStrikeType = FIRST_STRIKE_NONE;
}
currentEncounter->firstStrikeType = firstStrikeType;
}
goto START_BATTLE;
}
@ -963,7 +965,7 @@ START_BATTLE:
if (enemy->flags & ENEMY_FLAG_DISABLE_AI) {
continue;
}
if ((currentEnemy->flags & ENEMY_FLAG_40) && enemy != currentEncounter->currentEnemy) {
if ((currentEnemy->flags & ENEMY_FLAG_PROJECTILE) && enemy != currentEncounter->currentEnemy) {
continue;
}
@ -1017,7 +1019,7 @@ START_BATTLE:
if (enemy->flags & ENEMY_FLAG_DISABLE_AI) {
continue;
}
if ((currentEnemy->flags & ENEMY_FLAG_40) && enemy != currentEncounter->currentEnemy) {
if ((currentEnemy->flags & ENEMY_FLAG_PROJECTILE) && enemy != currentEncounter->currentEnemy) {
continue;
}
@ -1064,7 +1066,7 @@ START_BATTLE:
if (enemy->flags & ENEMY_FLAG_DISABLE_AI) {
continue;
}
if ((currentEnemy->flags & ENEMY_FLAG_40) && enemy != currentEncounter->currentEnemy) {
if ((currentEnemy->flags & ENEMY_FLAG_PROJECTILE) && enemy != currentEncounter->currentEnemy) {
continue;
}
if (enemy->hitBytecode != NULL) {
@ -1124,7 +1126,7 @@ START_BATTLE:
if (enemy->flags & ENEMY_FLAG_DISABLE_AI) {
continue;
}
if ((currentEnemy->flags & ENEMY_FLAG_40) && enemy != currentEncounter->currentEnemy) {
if ((currentEnemy->flags & ENEMY_FLAG_PROJECTILE) && enemy != currentEncounter->currentEnemy) {
continue;
}
if (enemy->hitBytecode != NULL) {
@ -1206,7 +1208,7 @@ START_BATTLE:
if (enemy->flags & ENEMY_FLAG_DISABLE_AI) {
continue;
}
if ((currentEnemy->flags & ENEMY_FLAG_40) && enemy != currentEncounter->currentEnemy) {
if ((currentEnemy->flags & ENEMY_FLAG_PROJECTILE) && enemy != currentEncounter->currentEnemy) {
continue;
}
if (enemy->hitBytecode != NULL) {
@ -1301,15 +1303,15 @@ void update_encounters_pre_battle(void) {
}
enemy = currentEncounter->currentEnemy;
if (currentEncounter->hitType != ENCOUNTER_TRIGGER_NONE &&
currentEncounter->hitType != ENCOUNTER_TRIGGER_SPIN &&
is_ability_active(ABILITY_FIRST_ATTACK) &&
(playerData->level >= enemy->npcSettings->level) &&
!(enemy->flags & ENEMY_FLAG_40) &&
!currentEncounter->scriptedBattle)
{
if (currentEncounter->hitType != ENCOUNTER_TRIGGER_NONE
&& currentEncounter->hitType != ENCOUNTER_TRIGGER_SPIN
&& is_ability_active(ABILITY_FIRST_ATTACK)
&& (playerData->level >= enemy->npcSettings->level)
&& !(enemy->flags & ENEMY_FLAG_PROJECTILE)
&& !currentEncounter->scriptedBattle
) {
currentEncounter->unk_94 = 0;
currentEncounter->battleStartCountdown = 0xA;
currentEncounter->battleStartCountdown = 10;
D_80077C40 = 1;
gEncounterSubState = ENCOUNTER_SUBSTATE_PRE_BATTLE_AUTO_WIN;
return;
@ -1319,14 +1321,14 @@ void update_encounters_pre_battle(void) {
if ((
(is_ability_active(ABILITY_BUMP_ATTACK)) &&
(playerData->level >= enemy->npcSettings->level) &&
(!(enemy->flags & ENEMY_FLAG_40) &&
(!(enemy->flags & ENEMY_FLAG_PROJECTILE) &&
!(currentEncounter->scriptedBattle))
) || (
(enemy = currentEncounter->currentEnemy,
(currentEncounter->hitType == ENCOUNTER_TRIGGER_SPIN)) &&
(is_ability_active(ABILITY_SPIN_ATTACK)) &&
playerData->level >= enemy->npcSettings->level &&
!(enemy->flags & ENEMY_FLAG_40) &&
!(enemy->flags & ENEMY_FLAG_PROJECTILE) &&
!currentEncounter->scriptedBattle
))
{
@ -1572,7 +1574,7 @@ void update_encounters_post_battle(void) {
Evt* script;
Enemy* enemy;
s32 i, j;
s32 cond;
s32 hasDefeatScript;
Npc* npc;
switch (gEncounterSubState) {
@ -1704,7 +1706,7 @@ void update_encounters_post_battle(void) {
}
break;
case ENCOUNTER_SUBSTATE_POST_BATTLE_WON_KILL:
cond = FALSE;
hasDefeatScript = FALSE;
encounter = currentEncounter->currentEncounter;
for (i = 0; i < encounter->count; i++) {
enemy = encounter->enemy[i];
@ -1718,12 +1720,12 @@ void update_encounters_post_battle(void) {
continue;
}
if (does_script_exist(enemy->defeatScriptID)) {
cond = TRUE;
hasDefeatScript = TRUE;
} else {
enemy->defeatScript = NULL;
}
}
if (!cond) {
if (!hasDefeatScript) {
if (!(currentEncounter->flags & ENCOUNTER_STATUS_FLAG_1) && !D_8009A63C && currentEncounter->battleStartCountdown == 1) {
suggest_player_anim_clearUnkFlag(ANIM_Mario_ThumbsUp);
}
@ -1835,7 +1837,7 @@ void update_encounters_post_battle(void) {
break;
case ENCOUNTER_SUBSTATE_POST_BATTLE_102:
encounter = currentEncounter->currentEncounter;
cond = FALSE;
hasDefeatScript = FALSE;
for (i = 0; i < encounter->count; i++) {
enemy = encounter->enemy[i];
if (enemy == NULL) {
@ -1843,13 +1845,13 @@ void update_encounters_post_battle(void) {
}
if (!(enemy->flags & ENEMY_FLAG_DISABLE_AI)) {
if (does_script_exist(enemy->defeatScriptID)) {
cond = TRUE;
hasDefeatScript = TRUE;
} else {
enemy->defeatScript = NULL;
}
}
}
if (!cond) {
if (!hasDefeatScript) {
for (i = 0; i < currentEncounter->numEncounters; i++) {
encounter = currentEncounter->encounterList[i];
if (encounter == NULL) {
@ -1967,7 +1969,7 @@ void update_encounters_post_battle(void) {
}
break;
case ENCOUNTER_SUBSTATE_POST_BATTLE_202:
cond = FALSE;
hasDefeatScript = FALSE;
encounter = currentEncounter->currentEncounter;
for (i = 0; i < encounter->count; i++) {
enemy = encounter->enemy[i];
@ -1976,13 +1978,13 @@ void update_encounters_post_battle(void) {
}
if (!(enemy->flags & ENEMY_FLAG_DISABLE_AI)) {
if (does_script_exist(enemy->defeatScriptID)) {
cond = TRUE;
hasDefeatScript = TRUE;
} else {
enemy->defeatScript = NULL;
}
}
}
if (!cond) {
if (!hasDefeatScript) {
for (i = 0; i < currentEncounter->numEncounters; i++) {
encounter = currentEncounter->encounterList[i];
if (encounter == NULL) {
@ -2085,7 +2087,7 @@ void update_encounters_post_battle(void) {
}
break;
case ENCOUNTER_SUBSTATE_POST_BATTLE_ENEMY_FLED_TO_NEUTRAL:
cond = FALSE;
hasDefeatScript = FALSE;
encounter = currentEncounter->currentEncounter;
for (i = 0; i < encounter->count; i++) {
enemy = encounter->enemy[i];
@ -2094,13 +2096,13 @@ void update_encounters_post_battle(void) {
}
if (!(enemy->flags & ENEMY_FLAG_DISABLE_AI)) {
if (does_script_exist(enemy->defeatScriptID)) {
cond = TRUE;
hasDefeatScript = TRUE;
} else {
enemy->defeatScript = NULL;
}
}
}
if (!cond) {
if (!hasDefeatScript) {
for (i = 0; i < currentEncounter->numEncounters; i++) {
encounter = currentEncounter->encounterList[i];
if (encounter == NULL) {
@ -2167,11 +2169,11 @@ void update_encounters_post_battle(void) {
npc = get_npc_unsafe(enemy->npcID);
if (enemy->aiSuspendTime != 0) {
if (enemy->aiSuspendTime & 1) {
npc->flags |= NPC_FLAG_80000000;
enemy->flags |= ENEMY_FLAG_80000000;
npc->flags |= NPC_FLAG_SUSPENDED;
enemy->flags |= ENEMY_FLAG_SUSPENDED;
} else {
npc->flags &= ~NPC_FLAG_80000000;
enemy->flags &= ~ENEMY_FLAG_80000000;
npc->flags &= ~NPC_FLAG_SUSPENDED;
enemy->flags &= ~ENEMY_FLAG_SUSPENDED;
}
}
}
@ -2301,7 +2303,7 @@ s32 check_conversation_trigger(void) {
continue;
}
if (encounterEnemy->flags & (ENEMY_FLAG_80000000 | ENEMY_FLAG_DISABLE_AI)) {
if (encounterEnemy->flags & (ENEMY_FLAG_SUSPENDED | ENEMY_FLAG_DISABLE_AI)) {
continue;
}
@ -2309,7 +2311,7 @@ s32 check_conversation_trigger(void) {
continue;
}
if ((encounterEnemy->flags & ENEMY_FLAG_8000000) || encounterEnemy->interactBytecode == NULL) {
if ((encounterEnemy->flags & ENEMY_FLAG_CANT_INTERACT) || encounterEnemy->interactBytecode == NULL) {
continue;
}
@ -2354,7 +2356,7 @@ s32 check_conversation_trigger(void) {
if (npc_test_move_taller_with_slipping(0, &xTemp, &yTemp, &zTemp, length,
atan2(npcX, npcZ, playerX, playerZ),
npcCollisionHeight,
2.0f * npcCollisionRadius) != 0) {
2.0f * npcCollisionRadius)) {
continue;
}
}
@ -2492,7 +2494,7 @@ void create_encounters(void) {
enemy->hitScriptID = 0;
enemy->auxScriptID = 0;
enemy->defeatScriptID = 0;
enemy->unk_07 = 0;
enemy->hitboxIsActive = FALSE;
enemy->instigatorValue = 0;
enemy->aiDetectFlags = npcData->aiDetectFlags;
@ -2551,20 +2553,20 @@ void create_encounters(void) {
newNpc->homePos.y = newNpc->pos.y;
newNpc->homePos.z = newNpc->pos.z;
set_npc_yaw(newNpc, npcData->yaw);
enemy->unk_E0 = 12345;
enemy->savedNpcYaw = 12345;
if (newNpc->collisionRadius >= 24.0) {
newNpc->shadowScale = newNpc->collisionRadius / 24.0;
} else {
newNpc->shadowScale = 1.0f;
}
if (enemy->flags & ENEMY_FLAG_100) {
if (enemy->flags & ENEMY_FLAG_IGNORE_WORLD_COLLISION) {
newNpc->flags |= NPC_FLAG_IGNORE_WORLD_COLLISION;
}
if (enemy->flags & ENEMY_FLAG_200) {
newNpc->flags |= NPC_FLAG_100;
if (enemy->flags & ENEMY_FLAG_IGNORE_PLAYER_COLLISION) {
newNpc->flags |= NPC_FLAG_IGNORE_PLAYER_COLLISION;
}
if (enemy->flags & ENEMY_FLAG_400) {
newNpc->flags |= NPC_FLAG_8000;
if (enemy->flags & ENEMY_FLAG_IGNORE_ENTITY_COLLISION) {
newNpc->flags |= NPC_FLAG_IGNORE_ENTITY_COLLISION;
}
if (enemy->flags & ENEMY_FLAG_800) {
newNpc->flags |= NPC_FLAG_8;
@ -2573,13 +2575,13 @@ void create_encounters(void) {
newNpc->flags |= NPC_FLAG_GRAVITY;
}
if (!(enemy->flags & ENEMY_FLAG_PASSIVE)) {
newNpc->flags |= NPC_FLAG_100;
newNpc->flags |= NPC_FLAG_IGNORE_PLAYER_COLLISION;
}
if (enemy->flags & ENEMY_FLAG_4000) {
newNpc->flags |= NPC_FLAG_1000000;
if (enemy->flags & ENEMY_FLAG_HAS_NO_SPRITE) {
newNpc->flags |= NPC_FLAG_HAS_NO_SPRITE;
}
if (enemy->flags & ENEMY_FLAG_2000) {
newNpc->flags |= NPC_FLAG_20;
if (enemy->flags & ENEMY_FLAG_NO_SHADOW_RAYCAST) {
newNpc->flags |= NPC_FLAG_NO_SHADOW_RAYCAST;
}
if (enemy->flags & ENEMY_FLAG_8000) {
newNpc->flags |= NPC_FLAG_10000000;
@ -2587,12 +2589,12 @@ void create_encounters(void) {
if (enemy->flags & ENEMY_FLAG_10000) {
newNpc->flags |= NPC_FLAG_20000000;
}
if (enemy->flags & ENEMY_FLAG_80) {
newNpc->flags |= NPC_FLAG_LOCK_ANIMS;
if (enemy->flags & ENEMY_FLAG_DONT_UPDATE_SHADOW_Y) {
newNpc->flags |= NPC_FLAG_DONT_UPDATE_SHADOW_Y;
}
enemy->scriptGroup = EVT_GROUP_08 | EVT_GROUP_02 | EVT_GROUP_01;
enemy->scriptGroup = EVT_GROUP_0B;
if (enemy->flags & ENEMY_FLAG_PASSIVE) {
enemy->scriptGroup = EVT_GROUP_08 | EVT_GROUP_02;
enemy->scriptGroup = EVT_GROUP_0A;
}
if (npcSettings->otherAI != NULL) {
script = start_script(npcSettings->otherAI, EVT_PRIORITY_A, 0);

View File

@ -211,21 +211,21 @@ void start_battle(Evt* script, s32 songID) {
encounter = currentEncounter->currentEncounter;
for (i = 0; i < encounter->count; i++) {
enemy = encounter->enemy[i];
if ((enemy != NULL && (
!(enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) || enemy == currentEncounter->currentEnemy)
) && enemy->hitBytecode != NULL) {
Evt* hitEvtInstance;
enemy->encountered = TRUE;
if (enemy != NULL && (!(enemy->flags & ENEMY_FLAG_ENABLE_HIT_SCRIPT) || enemy == currentEncounter->currentEnemy)) {
if (enemy->hitBytecode != NULL) {
Evt* hitEvtInstance;
enemy->encountered = TRUE;
hitEvtInstance = start_script(enemy->hitBytecode, EVT_PRIORITY_A, 0);
hitEvtInstance = start_script(enemy->hitBytecode, EVT_PRIORITY_A, 0);
enemy->hitScript = hitEvtInstance;
enemy->hitScriptID = hitEvtInstance->id;
enemy->hitScript = hitEvtInstance;
enemy->hitScriptID = hitEvtInstance->id;
hitEvtInstance = enemy->hitScript;
hitEvtInstance->owner1.enemy = enemy;
hitEvtInstance->owner2.npcID = enemy->npcID;
hitEvtInstance->groupFlags = enemy->scriptGroup;
hitEvtInstance = enemy->hitScript;
hitEvtInstance->owner1.enemy = enemy;
hitEvtInstance->owner2.npcID = enemy->npcID;
hitEvtInstance->groupFlags = enemy->scriptGroup;
}
}
}
@ -712,7 +712,7 @@ ApiStatus SelfEnemyOverrideSyncPos(Evt* script, s32 isInitialCall) {
Enemy* owner = script->owner1.enemy;
Npc* npc = get_npc_unsafe(script->owner2.npcID);
owner->unk_07 = evt_get_variable(script, *args++);
owner->hitboxIsActive = evt_get_variable(script, *args++);
owner->unk_10.x = npc->pos.x;
owner->unk_10.y = npc->pos.y;
owner->unk_10.z = npc->pos.z;

View File

@ -75,8 +75,8 @@ void entity_StarBoxLauncher_check_launch(Entity* entity) {
add_vec2D_polar(&x, &z, 10.0f, func_800E5348());
if (npc_raycast_down_sides(COLLISION_CHANNEL_10000, &x, &y, &z, &hitDepth) != 0) {
if (D_8010C978 & COLLISION_WITH_ENTITY_BIT) {
result = get_entity_type(D_8010C978) == ENTITY_TYPE_STAR_BOX_LAUCHER;
if (NpcHitQueryColliderID & COLLISION_WITH_ENTITY_BIT) {
result = get_entity_type(NpcHitQueryColliderID) == ENTITY_TYPE_STAR_BOX_LAUCHER;
}
}
} else if ((entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) && (actionState == ACTION_STATE_SPIN_POUND || actionState == ACTION_STATE_TORNADO_POUND)) {

View File

@ -268,7 +268,7 @@ void entity_Tweester_idle(Entity* entity) {
if (partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE || partnerActionStatus->actingPartner != PARTNER_BOW) {
if (playerStatus->actionState == ACTION_STATE_USE_TWEESTER) {
Npc* npc = npc_find_closest_simple(entity->position.x, entity->position.y, entity->position.z, 50.0f);
if (npc != NULL && (npc->flags & NPC_FLAG_PARTICLE)) {
if (npc != NULL && (npc->flags & NPC_FLAG_PARTNER)) {
TweesterTouchingPartner = entity;
}
}

Some files were not shown because too many files have changed in this diff Show More