Battle items (#222)

* a

* Dizzy Dial

* Dried shroom

* Dusty Hammer

* Egg Missile

* Electro Pop

* Fire Flower

* Food

* Fright Jar

* Hustle Drink

* Insecticide Herb

* Life Shroom

* Mushroom

* Mystery (partial)

* Pebble

* Please Come Back

* POW Block

* Repel Gel

* Shooting Star

* Sleepy Sheep

* Snowman Doll

* Stone Cap

* Stop Watch

* Strange Cake

* Strange Cake fixed

* Stone Cap broked

* git subrepo pull --force tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "db0b6f0cba"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "db0b6f0cba"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* Static all the things

* Tasty Tonic

* Thunder Bolt

* Thunder Rage

* Ultra Shroom

* Unknown Item

* Volt Shroom

Format & coverage

* Item Ids

Co-authored-by: Lavos1 <saintlouisxx@gmail.com>
This commit is contained in:
Maide 2021-03-24 08:39:43 +00:00 committed by GitHub
parent 1b2e728e4d
commit f03f08a38f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
446 changed files with 10090 additions and 8742 deletions

View File

@ -270,30 +270,30 @@ typedef UNK_TYPE SoundID;
#define SoundId_SMOKE_BURST 0x000002CD
#define SoundId_DAYZEE_SONG 0x000002D7
#define SoundId_POWER_UP 0x000002D8
#define SoundId_CLOSE_SHELL 0x000002FF
#define SoundId_SHY_GUY_SCREAMS1 0x0000030C
#define SoundId_SHY_GUY_SCREAMS2 0x0000030D
#define SoundId_SHY_GUY_SCREAMS3 0x0000030E
#define SoundId_TOY_TANK_MOVE1 0x0000030F
#define SoundId_TOY_TANK_MOVE2 0x00000310
#define SoundId_GENERAL_WHISTLE 0x00000395
#define SoundId_MOLE_SURFACE 0x00000321
#define SoundId_MOLE_DIG 0x00000322
#define SoundId_MOLE_POP 0x00000323
#define SoundId_GENERAL_WHISTLE 0x00000395
#define SoundId_OPEN_SHELL 0x000003D4
#define SoundId_JUMP 0x000003E2
#define SoundId_MISS_JUMP 0x000003E3
#define SoundId_DEATH 0x000003E5
#define SoundId_BIG_POWER_UP 0x000003E6
#define SoundId_MOLE_THROW 0x000003E8
#define SoundId_CLOSE_SHELL 0x000002FF
#define SoundId_OPEN_SHELL 0x000003D4
#define SoundId_THROW 0x000003FA
#define SoundId_BOW_VANISH 0x0000200E
#define SoundId_BOW_APPEAR 0x0000200F
#define SoundId_CANNON1 0x00002016
#define SoundId_CANNON2 0x00002017
#define SoundId_CANNON3 0x00002018
#define SoundId_JUMP2 0x00002081
#define SoundId_BOMB_BLAST 0x00002076
#define SoundId_JUMP2 0x00002081
#define SoundId_SPELL_CAST1 0x000020D4
#define SoundId_SPELL_CAST2 0x000020D5
#define SoundId_SPELL_CAST3 0x000020D6
@ -306,7 +306,6 @@ typedef UNK_TYPE Cam;
#define Cam_TATTLE 0x00000002
#define Cam_CAM3 0x00000003
#define LOOKUP_ITEM(itemID) gItemTable[itemID & ~0xF0000]
typedef s16 ItemId;
@ -678,6 +677,7 @@ typedef UNK_TYPE PlayerAnim;
#define PlayerAnim_BEFORE_JUMP 0x00010006
#define PlayerAnim_MIDAIR_STILL 0x00010007
#define PlayerAnim_MIDAIR 0x00010008
#define PlayerAnim_9 0x00010009 // TODO
#define PlayerAnim_STUNNED_STILL 0x0001000E
#define PlayerAnim_DEAD_STILL 0x0001000F
#define PlayerAnim_SPINNING 0x00010011
@ -704,11 +704,16 @@ typedef UNK_TYPE PlayerAnim;
#define PlayerAnim_RUN_THINKING 0x00010027
#define PlayerAnim_QUESTION 0x00010028
#define PlayerAnim_NOD_YES 0x00010029
#define PlayerAnim_1002B 0x0001002B // TODO
#define PlayerAnim_PRAY 0x0001002C
#define PlayerAnim_CHARRED 0x0001002F
#define PlayerAnim_GET_UP 0x00010030
#define PlayerAnim_DUST_OFF 0x00010031
#define PlayerAnim_THUMBS_UP 0x00010032
#define PlayerAnim_30004 0x00030004 // TODO
#define PlayerAnim_30008 0x00030008 // TODO
#define PlayerAnim_30009 0x00030009 // TODO
#define PlayerAnim_8000B 0x0008000B // TODO
typedef UNK_TYPE AmbientSounds;
#define AmbientSounds_SPOOKY 0x00000000
@ -751,13 +756,12 @@ typedef UNK_TYPE HitResult;
#define HitResult_MISS 0x00000006
#define HitResult_HIT_STATIC 0x00000007
#define HitResult_IMMUNE 0x00000008
#define HitResult_ED_EXPLODE -1
typedef UNK_TYPE Iter;
#define Iter_FIRST 0xFFFFFFFF
#define Iter_LAST 0x0000000A
#define Iter_NEXT 0x00000000
#define Iter_PREV 0x00000001
#define Iter_LAST 0x0000000A
typedef UNK_TYPE ActorSound;
#define ActorSound_WALK 0x00000000
@ -772,13 +776,13 @@ typedef UNK_TYPE Phase;
#define Phase_FIRST_STRIKE 0x00000001
#define Phase_RUN_AWAY_START 0x00000003
#define Phase_RUN_AWAY_RESET 0x00000004
#define Phase_RUN_AWAY_FAIL 0x00000007
#define Phase_USE_DEFEND 0x00000006
#define Phase_RUN_AWAY_FAIL 0x00000007
#define Phase_USE_LIFE_SHROOM 0x00000008
#define Phase_PLAYER_BEGIN 0x0000000A
#define Phase_PLAYER_END 0x0000000D
#define Phase_ENEMY_BEGIN 0x0000000C
#define Phase_ENEMY_END 0x0000000B
#define Phase_ENEMY_BEGIN 0x0000000C
#define Phase_PLAYER_END 0x0000000D
#define Phase_MERLEE_ATTACK_BONUS 0x00000014
#define Phase_MERLEE_DEFENSE_BONUS 0x00000015
#define Phase_MERLEE_EXP_BONUS 0x00000016
@ -814,6 +818,7 @@ typedef s32 ActorID;
#define ActorID_ENEMY23 0x00000217
typedef UNK_TYPE Element;
#define Element_END 0x00000000
#define Element_NORMAL 0x00000001
#define Element_FIRE 0x00000002
#define Element_WATER 0x00000003
@ -827,45 +832,44 @@ typedef UNK_TYPE Element;
#define Element_SHOCK 0x0000000C
#define Element_QUAKE 0x0000000D
#define Element_THROW 0x0000000F
#define Element_END 0x00000000
typedef UNK_TYPE Event;
#define Event_IMMUNE 0x00000019
#define Event_HIT_COMBO 0x00000009
#define Event_HIT 0x0000000A
#define Event_DEATH 0x00000020
#define Event_FALL_TriggerFlags 0x0000000C
#define Event_FLIP_TriggerFlags 0x0000000D
#define Event_EXPLODE_TriggerFlags 0x00000022
#define Event_SPIN_SMASH_HIT 0x0000000B
#define Event_SPIN_SMASH_DEATH 0x00000021
#define Event_FALL_TriggerFlags 0x0000000C
#define Event_FLIP_TriggerFlags 0x0000000D
#define Event_BURN_HIT 0x0000000E
#define Event_SPIN_SMASH_LAUNCH_HIT 0x00000011
#define Event_STAR_BEAM 0x00000013
#define Event_SPIN_SMASH_LAUNCH_DEATH 0x00000015
#define Event_POWER_BOUNCE_HIT 0x00000015
#define Event_POWER_BOUNCE_DEATH 0x00000028
#define Event_BURN_HIT 0x0000000E
#define Event_BURN_DEATH 0x00000024
#define Event_SHOCK_HIT 0x0000002F
#define Event_SHOCK_DEATH 0x00000026
#define Event_BEGIN_AIR_LIFT 0x0000003A
#define Event_AIR_LIFT_FAILED 0x0000001F
#define Event_BLOW_AWAY 0x00000016
#define Event_SCARE_AWAY 0x00000039
#define Event_UP_AND_AWAY 0x0000003D
#define Event_STAR_BEAM 0x00000013
#define Event_RECOVER_STATUS 0x00000031
#define Event_SWAP_PARTNER 0x0000003F
#define Event_IMMUNE 0x00000019
#define Event_BLOCK 0x0000001A
#define Event_SPIKE_CONTACT 0x0000002A
#define Event_SPIKE_DEATH 0x00000027
#define Event_SPIKE_TAUNT 0x0000001B
#define Event_BURN_CONTACT 0x0000002C
#define Event_BURN_TAUNT 0x0000001C
#define Event_BEGIN_FIRST_STRIKE 0x00000038
#define Event_AIR_LIFT_FAILED 0x0000001F
#define Event_DEATH 0x00000020
#define Event_SPIN_SMASH_DEATH 0x00000021
#define Event_EXPLODE_TriggerFlags 0x00000022
#define Event_BURN_DEATH 0x00000024
#define Event_SHOCK_DEATH 0x00000026
#define Event_SPIKE_DEATH 0x00000027
#define Event_POWER_BOUNCE_DEATH 0x00000028
#define Event_SPIKE_CONTACT 0x0000002A
#define Event_BURN_CONTACT 0x0000002C
#define Event_SHOCK_HIT 0x0000002F
#define Event_RECOVER_STATUS 0x00000031
#define Event_END_FIRST_STRIKE 0x00000035
#define Event_LUCKY 0x00000037
#define Event_BEGIN_FIRST_STRIKE 0x00000038
#define Event_SCARE_AWAY 0x00000039
#define Event_BEGIN_AIR_LIFT 0x0000003A
#define Event_UP_AND_AWAY 0x0000003D
#define Event_SWAP_PARTNER 0x0000003F
#define Event_LIFE_SHROOM_PROC 0x00000040
#define Event_REVIVE 0x00000041
#define Event_LUCKY 0x00000037
typedef UNK_TYPE HitSound;
#define HitSound_MISS 0x00000000
@ -876,40 +880,40 @@ typedef UNK_TYPE HitSound;
#define HitSound_SHOCK 0x00000005
typedef s8 Debuff;
#define Debuff_END 0x00000000
#define Debuff_NORMAL 0x00000001
#define Debuff_DEFAULT 0x00000002
#define Debuff_DEFAULT_TURN_MOD 0x0000001F
#define Debuff_SLEEP 0x00000006
#define Debuff_SLEEP_TURN_MOD 0x00000020
#define Debuff_POISON 0x00000009
#define Debuff_POISON_TURN_MOD 0x00000025
#define Debuff_FROZEN 0x00000007
#define Debuff_FROZEN_TURN_MOD 0x00000022
#define Debuff_DIZZY 0x00000004
#define Debuff_DIZZY_TURN_MOD 0x00000024
#define Debuff_FEAR 0x00000003
#define Debuff_FEAR_TURN_MOD 0x00000023
#define Debuff_STATIC 0x0000000B
#define Debuff_STATIC_TURN_MOD 0x00000021
#define Debuff_DIZZY 0x00000004
#define Debuff_PARALYZE 0x00000005
#define Debuff_PARALYZE_TURN_MOD 0x00000026
#define Debuff_SHRINK 0x0000000A
#define Debuff_SHRINK_TURN_MOD 0x00000027
#define Debuff_SLEEP 0x00000006
#define Debuff_FROZEN 0x00000007
#define Debuff_STOP 0x00000008
#define Debuff_STOP_TURN_MOD 0x00000029
#define Debuff_POISON 0x00000009
#define Debuff_SHRINK 0x0000000A
#define Debuff_STATIC 0x0000000B
#define Debuff_STONE 0x0000000C
#define Debuff_DAZE 0x0000000D
#define Debuff_END 0x00000000
#define Debuff_0xE 0x0000000E // TODO
#define Debuff_BERSERK 0x00000010
#define Debuff_TURN_DONE 0x00000012
#define Debuff_HUSTLE 0x00000019
#define Debuff_DANGER 0x0000001A
#define Debuff_THINKING 0x0000001C
#define Debuff_WEARY 0x0000001D
#define Debuff_DEFAULT_TURN_MOD 0x0000001F
#define Debuff_SLEEP_TURN_MOD 0x00000020
#define Debuff_STATIC_TURN_MOD 0x00000021
#define Debuff_FROZEN_TURN_MOD 0x00000022
#define Debuff_FEAR_TURN_MOD 0x00000023
#define Debuff_DIZZY_TURN_MOD 0x00000024
#define Debuff_POISON_TURN_MOD 0x00000025
#define Debuff_PARALYZE_TURN_MOD 0x00000026
#define Debuff_SHRINK_TURN_MOD 0x00000027
#define Debuff_STOP_TURN_MOD 0x00000029
typedef UNK_TYPE DoorSwing;
#define DoorSwing_IN 0x00000001
#define DoorSwing_OUT -1
typedef UNK_TYPE ItemSpawnMode;
#define ItemSpawnMode_DECORATION 0x00000001
@ -936,41 +940,41 @@ typedef UNK_TYPE ItemSpawnMode;
#define ItemSpawnMode_TOSS__SPAWN_ALWAYS__SMALL 0x0000001A
typedef UNK_TYPE Location;
#define Location_NONE 0x00000018
#define Location_TESTING 0x00000017
#define Location_TOAD_TOWN 0x00000001
#define Location_PEACH_CASTLE_GROUNDS 0x00000019
#define Location_SHOOTING_STAR_SUMMIT 0x0000001B
#define Location_TOAD_TOWN_TUNNELS 0x00000002
#define Location_KOOPA_BROS_FORTRESS 0x00000007
#define Location_MT_RUGGED 0x00000008
#define Location_DRY_DRY_OUTPOST 0x00000009
#define Location_DRY_DRY_DESERT 0x0000000A
#define Location_DRY_DRY_RUINS 0x0000000B
#define Location_FOREVER_FOREST 0x0000000C
#define Location_BOOS_MANSION 0x0000000D
#define Location_TUBBAS_MANOR 0x0000000F
#define Location_SHY_GUYS_TOYBOX 0x00000010
#define Location_MT_LAVALAVA 0x00000012
#define Location_CRYSTAL_PALACE 0x00000015
#define Location_BOWSERS_CASTLE 0x00000016
#define Location_TESTING 0x00000017
#define Location_NONE 0x00000018
#define Location_PEACH_CASTLE_GROUNDS 0x00000019
#define Location_PEACHS_CASTLE 0x0000001A
#define Location_SHOOTING_STAR_SUMMIT 0x0000001B
#define Location_STAR_WAY 0x0000001C
#define Location_STAR_HAVEN 0x0000001D
#define Location_GOOMBA_VILLAGE 0x0000001E
#define Location_GOOMBA_ROAD 0x0000001F
#define Location_PLEASANT_PATH 0x00000020
#define Location_KOOPA_VILLAGE 0x00000021
#define Location_KOOPA_BROS_FORTRESS 0x00000007
#define Location_MT_RUGGED 0x00000008
#define Location_DRY_DRY_DESERT 0x0000000A
#define Location_DRY_DRY_OUTPOST 0x00000009
#define Location_DRY_DRY_RUINS 0x0000000B
#define Location_FOREVER_FOREST 0x0000000C
#define Location_BOOS_MANSION 0x0000000D
#define Location_GUSTY_GULCH 0x00000022
#define Location_TUBBAS_MANOR 0x0000000F
#define Location_WINDY_MILL 0x00000023
#define Location_SHY_GUYS_TOYBOX 0x00000010
#define Location_JADE_JUNGLE 0x00000024
#define Location_YOSHIS_VILLAGE 0x00000025
#define Location_MT_LAVALAVA 0x00000012
#define Location_FLOWER_FIELDS 0x00000026
#define Location_CLOUDY_CLIMB 0x00000027
#define Location_SHIVER_CITY 0x00000028
#define Location_SHIVER_SNOWFIELD 0x00000029
#define Location_STARBORN_VALLEY 0x0000002A
#define Location_SHIVER_MOUNTAIN 0x0000002B
#define Location_CRYSTAL_PALACE 0x00000015
#define Location_STAR_WAY 0x0000001C
#define Location_STAR_HAVEN 0x0000001D
#define Location_BOWSERS_CASTLE 0x00000016
#define Location_PEACHS_CASTLE 0x0000001A
#define Location_MARIOS_HOUSE 0x0000002C
typedef UNK_TYPE DoorSounds;
@ -1017,37 +1021,36 @@ typedef s32 NpcId;
#define NpcId_PARTNER -4
typedef UNK_TYPE TriggerFlag;
#define TriggerFlag_WALL_PUSH 0x00000040
#define TriggerFlag_FLOOR_TOUCH 0x00000080
#define TriggerFlag_FLOOR_ABOVE 0x00080000
#define TriggerFlag_FLOOR_INTERACT 0x00000800
#define TriggerFlag_WALL_INTERACT 0x00000100
#define TriggerFlag_FLOOR_JUMP 0x00000200
#define TriggerFlag_WALL_TOUCH 0x00000400
#define TriggerFlag_WALL_PUSH 0x00000040
#define TriggerFlag_WALL_INTERACT 0x00000100
#define TriggerFlag_FLOOR_INTERACT 0x00000800
#define TriggerFlag_WALL_HAMMER 0x00001000
#define TriggerFlag_CEILING_TOUCH 0x00040000
#define TriggerFlag_BOMB 0x00100000
#define TriggerFlag_SAVE_FLAG_SET 0x00010000
#define TriggerFlag_AREA_FLAG_SET 0x00020000
#define TriggerFlag_CEILING_TOUCH 0x00040000
#define TriggerFlag_FLOOR_ABOVE 0x00080000
#define TriggerFlag_BOMB 0x00100000
typedef UNK_TYPE Button;
#define Button_A 0x00008000
#define Button_B 0x00004000
#define Button_Z 0x00002000
#define Button_START 0x00001000
#define Button_D_UP 0x00000800
#define Button_D_DOWN 0x00000400
#define Button_D_LEFT 0x00000200
#define Button_D_RIGHT 0x00000100
#define Button_L 0x00000020
#define Button_R 0x00000010
#define Button_C_UP 0x00000008
#define Button_C_DOWN 0x00000004
#define Button_C_LEFT 0x00000002
#define Button_C_RIGHT 0x00000001
#define Button_C_LEFT 0x00000002
#define Button_C_DOWN 0x00000004
#define Button_C_UP 0x00000008
#define Button_R 0x00000010
#define Button_L 0x00000020
#define Button_D_RIGHT 0x00000100
#define Button_D_LEFT 0x00000200
#define Button_D_DOWN 0x00000400
#define Button_D_UP 0x00000800
#define Button_START 0x00001000
#define Button_Z 0x00002000
#define Button_B 0x00004000
#define Button_A 0x00008000
typedef UNK_TYPE PlayerBuff;
#define PlayerBuff_ALL 0x0FFFFFFF
#define PlayerBuff_JUMP_CHARGE 0x00000001
#define PlayerBuff_HAMMER_CHARGE 0x00000002
#define PlayerBuff_STONE 0x00000008
@ -1058,6 +1061,7 @@ typedef UNK_TYPE PlayerBuff;
#define PlayerBuff_TURBO_CHARGE 0x00000100
#define PlayerBuff_WATER_BLOCK 0x00000200
#define PlayerBuff_PARTNER_GLOWING 0x00010000
#define PlayerBuff_ALL 0x0FFFFFFF
typedef UNK_TYPE StatusFlags;
#define StatusFlags_SLEEP 0x00001000
@ -1079,22 +1083,22 @@ typedef UNK_TYPE StatusFlags;
#define StatusFlags_RIGHT_ON 0x40000000
typedef UNK_TYPE DamageType;
#define DamageType_IGNORE_DEFENSE 0x08000000
#define DamageType_NO_CONTACT 0x10000000
#define DamageType_UNBLOCKABLE 0x20000000
#define DamageType_TriggerFlags_LUCKY 0x80000000
#define DamageType_FIRE 0x00000002
#define DamageType_WATER 0x00000004
#define DamageType_ICE 0x00000008
#define DamageType_MAGIC 0x00000010
#define DamageType_ELECTRIC 0x00000020
#define DamageType_SMASH 0x00000040
#define DamageType_JUMP 0x00000080
#define DamageType_COSMIC 0x00000100
#define DamageType_BLAST 0x00000200
#define DamageType_POW 0x00000400
#define DamageType_QUAKE 0x00000800
#define DamageType_THROW 0x00040000
#define DamageType_TriggerFlags_LUCKY 0x80000000
#define DamageType_FIRE 0x00000002
#define DamageType_WATER 0x00000004
#define DamageType_ICE 0x00000008
#define DamageType_MAGIC 0x00000010
#define DamageType_ELECTRIC 0x00000020
#define DamageType_SMASH 0x00000040
#define DamageType_JUMP 0x00000080
#define DamageType_COSMIC 0x00000100
#define DamageType_BLAST 0x00000200
#define DamageType_POW 0x00000400
#define DamageType_QUAKE 0x00000800
#define DamageType_THROW 0x00040000
#define DamageType_IGNORE_DEFENSE 0x08000000
#define DamageType_NO_CONTACT 0x10000000
#define DamageType_UNBLOCKABLE 0x20000000
typedef s8 PartnerID;
#define PartnerID_NONE 0

View File

@ -140,8 +140,8 @@ s32 osGetId();
void mem_clear(s8* data, s32 numBytes);
s32* create_icon(s32 iconIndex);
void set_icon_render_pos(s32 iconIndex, s32 posX, s32 posY);
MenuIcon* create_icon(s32* iconIndex);
void set_icon_render_pos(MenuIcon* iconIndex, s32 posX, s32 posY);
void set_curtain_scale_goal(f32 scale);
void set_curtain_fade(f32 scale);
@ -207,7 +207,7 @@ ItemEntity* get_item_entity(s32 itemEntityIndex);
s32 make_item_entity_nodelay(s32 itemID, f32 x, f32 y, f32 z, ItemSpawnMode itemSpawnMode, s32 pickupVar);
void set_item_entity_flags(s32 itemEntityIndex, s32 flag);
s32 bind_dynamic_entity_7(s32* updateFunc, s32* drawFunc);
s32 bind_dynamic_entity_7(s32* updateFunc, void (*drawFunc)(void));
s32 get_dynamic_entity(s32 arg0);
void set_cam_viewport(s16 id, s16 x, s16 y, s16 width, s16 height);
@ -275,6 +275,10 @@ void func_800701F0(s32 arg0, f32 arg1, f32 arg2, f32 arg3);
void add_xz_vec3f(Vec3f* vector, f32 speed, f32 angleDeg);
void play_movement_dust_effects(s32 var0, f32 xPos, f32 yPos, f32 zPos, f32 angleDeg);
void func_80138D88(s32, s32, s32, s32, f32);
s32 func_80071030(s32 a0, f32 a1, f32 a2, f32 a3, s32 a4);
void func_80070CD0(s32, f32, f32, f32, f32, f32);
// Dead functions:
f32 func_8002AF70(f32 startX, f32 startZ, f32 endX, f32 endZ); // atan2
Npc* func_8003E4BC(NpcId npcId); // get_npc_safe

View File

@ -10,9 +10,9 @@
TYPE NAME(ARGS); \
TYPE __attribute__((naked)) NAME(ARGS) { __asm__( ".include \"ver/"STRINGIFY(VERSION)"/asm/nonmatchings/"FOLDER"/"#NAME".s\"\n.set reorder\n.set at"); }
#endif
__asm__( ".include \"include/macro.inc\"\n");
__asm__(".include \"include/macro.inc\"\n");
#ifdef MOVE_ADDU
__asm__( ".include \"include/move_addu.inc\"\n");
__asm__(".include \"include/move_addu.inc\"\n");
#endif
#else
#define INCLUDE_ASM(TYPE, FOLDER, NAME, ARGS...)

View File

@ -74,4 +74,8 @@
#define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0)))
#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x))
#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x))
#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x))
#endif

View File

@ -2,14 +2,14 @@
#include "battle/item/coconut/coconut.png.h"
/// 32x32 square.
Vtx N(coconutModel)[] = {
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(coconutDL)[] = {
Gfx N(displayList)[] = {
gsDPPipeSync(),
gsSPTexture(-1, -1, 0, G_TX_RENDERTILE, G_ON),
gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
@ -20,23 +20,23 @@ Gfx N(coconutDL)[] = {
gsDPSetTextureFilter(G_TF_AVERAGE),
gsDPSetTextureConvert(G_TC_FILT),
gsDPSetTextureLUT(G_TT_RGBA16),
gsDPLoadTLUT_pal16(0, &battle_item_coconut_coconut_pal_png),
gsDPLoadTextureTile_4b(&battle_item_coconut_coconut_png, G_IM_FMT_CI, battle_item_coconut_coconut_png_width, battle_item_coconut_coconut_png_height, 0, 0, battle_item_coconut_coconut_png_width - 1, battle_item_coconut_coconut_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),
gsDPLoadTLUT_pal16(0, &N(coconut_pal_png)),
gsDPLoadTextureTile_4b(&N(coconut_png), G_IM_FMT_CI, N(coconut_png_width), N(coconut_png_height), 0, 0, N(coconut_png_width) - 1, N(coconut_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(coconutModel), ARRAY_COUNT(N(coconutModel)), 0),
gsSPVertex(&N(model), ARRAY_COUNT(N(model)), 0),
gsSP1Triangle(0, 1, 2, 0),
gsSP1Triangle(0, 2, 3, 0),
gsDPPipeSync(),
gsSPEndDisplayList(),
};
s32 N(coconutItemModelCommandList)[] = {
0x00000004, 0x0000000D, 0x00000001, sizeof(N(coconutDL)) / sizeof(s32), &N(coconutDL), 0x00000002, 0x00000000,
s32 N(modelCommandList)[] = {
0x00000004, 0x0000000D, 0x00000001, sizeof(N(displayList)) / sizeof(s32), &N(displayList), 0x00000002, 0x00000000,
};
Script N(main) = SCRIPT({
SI_VAR(10) =c ItemId_COCONUT;
SI_VAR(10) = c ItemId_COCONUT;
await N(UseItemWithEffect);
@ -47,7 +47,7 @@ Script N(main) = SCRIPT({
PlaySound(SoundId_THROW);
sleep 3;
func_802D3474(SI_VAR(10), N(coconutItemModelCommandList));
func_802D3474(SI_VAR(10), N(modelCommandList));
$x = 1.0;
MultiplyByActorScale($x);

View File

@ -1,7 +1,7 @@
#include "coconut.h"
MenuIcon* D_802A1E80;
void* D_80108A64; // an image
static MenuIcon* D_802A1E80;
// Returns time to sleep for on $x.
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {

View File

@ -0,0 +1,51 @@
#include "dizzy_dial.h"
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_DIZZY_DIAL;
await N(UseItemWithEffect);
UseCamPreset(2);
MoveBattleCamOver(20);
sleep 10;
spawn {
sleep 5;
AddBattleCamZoom(0xFFFFFF06);
MoveBattleCamOver(80);
func_8024ECF8(0, 0, 1);
sleep 80;
AddBattleCamZoom(250);
MoveBattleCamOver(3);
func_8024ECF8(0, 0, 1);
}
N(func_802A1270_727B80)();
spawn {
StartRumble(8);
ShakeCam(1, 0, 2, 1.0);
ShakeCam(1, 0, 2, 4.0);
ShakeCam(1, 0, 2, 3.0);
ShakeCam(1, 0, 2, 2.0);
ShakeCam(1, 0, 2, 1.0);
ShakeCam(1, 0, 2, 0.5);
sleep 10;
UseCamPreset(3);
MoveBattleCamOver(10);
func_8024ECF8(0, 0, 0);
}
InitTargetIterator();
0:
SetGoalToTarget(ActorID_SELF);
ItemCheckHit(SI_VAR(0), 0x10000000, 0, SI_VAR(0), 0);
if (SI_VAR(0) == 6) {
goto 1;
}
GetItemPower(ItemId_DIZZY_DIAL, SI_VAR(0), SI_VAR(1));
MakeStatusField(SI_VAR(0), 0x40000, 100, SI_VAR(0));
func_80252B3C(SI_VAR(0), 0x50000000, SI_VAR(0), 0, 32);
1:
sleep 5;
ChooseNextTarget(0, SI_VAR(0));
if (SI_VAR(0) != -1) {
goto 0;
}
sleep 30;
await N(PlayerGoHome);
});

View File

@ -0,0 +1,17 @@
#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
ApiStatus func_8024ECF8(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_80252B3C(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A1270_727B80)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
#endif

View File

@ -0,0 +1,192 @@
#include "dizzy_dial.h"
extern s32 D_80108A64;
static s32* D_802A1CD0;
static MenuIcon* D_802A1CD4;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A1CD4 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A1CD4, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A1CD4);
}
return ApiStatus_DONE2;
}
void func_802A123C_727B4C(void) {
func_80138D88(0, 0, 0x140, 0xF0, 160.0f);
}
ApiStatus N(func_802A1270_727B80)(ScriptInstance* script, s32 isInitialCall) {
Camera* camera = &gCameras[1];
f32 a;
if (isInitialCall) {
script->functionTemp[0].s = 0;
}
switch (script->functionTemp[0].s) {
case 0:
script->functionTemp[1].s = 0;
script->functionTemp[2].s = 0;
play_sound(0x2033);
camera->unk_1C = 0;
D_802A1CD0 = bind_dynamic_entity_7(NULL, func_802A123C_727B4C);
script->functionTemp[0].s = 1;
case 1:
camera->flags |= 8;
a = script->functionTemp[1].s;
guRotateF(camera->viewMtxShaking, a, 0.0f, 0.0f, 1.0f);
script->functionTemp[1].s = 2.0 * ((1.0 - sin_rad(((script->functionTemp[2].s + 90) * 6.28318f) / 360.0f)) * 360.0);
script->functionTemp[2].s++;
if (script->functionTemp[2].s <= 90) {
return ApiStatus_BLOCK;
}
camera->unk_1C = 0;
camera->flags &= ~8;
func_801235C0(D_802A1CD0);
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(0);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -1,9 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/dizzy_dial_727910", func_802A1000_727910);
INCLUDE_ASM(s32, "battle/item/dizzy_dial_727910", func_802A11D4_727AE4);
INCLUDE_ASM(s32, "battle/item/dizzy_dial_727910", func_802A123C_727B4C);
INCLUDE_ASM(s32, "battle/item/dizzy_dial_727910", func_802A1270_727B80);

View File

@ -0,0 +1,24 @@
#include "dried_shroom.h"
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_DRIED_SHROOM;
await N(UseItemWithEffect);
await N(EatItem);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_STICK_OUT_TONGUE);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 0;
SI_VAR(1) += 35;
N(func_802A123C_71CF1C)(SI_VAR(0), SI_VAR(1), SI_VAR(2), 1);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 25;
SI_VAR(2) += 5;
func_802D7520(SI_VAR(0), SI_VAR(1), SI_VAR(2), 1);
N(func_802A12FC_71CFDC)();
sleep 30;
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(2) += 5;
func_802D75D8(SI_VAR(0), SI_VAR(1), SI_VAR(2), 1);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
sleep 20;
await N(PlayerGoHome);
});

View File

@ -0,0 +1,19 @@
#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
ApiStatus func_802D7520(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802D75D8(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A123C_71CF1C)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A12FC_71CFDC)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
Script N(EatItem);
#endif

View File

@ -0,0 +1,175 @@
#include "dried_shroom.h"
extern s32 D_80108A64;
static MenuIcon* D_802A1A90;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A1A90 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A1A90, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A1A90);
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A123C_71CF1C)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
s32 d = get_variable(script, *args++);
func_80071090(0, a, b, c, d);
return ApiStatus_DONE2;
}
ApiStatus N(func_802A12FC_71CFDC)(ScriptInstance* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;
playerData->curHP++;
if (playerData->curHP > playerData->curMaxHP) {
playerData->curHP = playerData->curMaxHP;
}
return ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(0);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -1,9 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/dried_shroom_71CCE0", func_802A1000_71CCE0);
INCLUDE_ASM(s32, "battle/item/dried_shroom_71CCE0", func_802A11D4_71CEB4);
INCLUDE_ASM(s32, "battle/item/dried_shroom_71CCE0", func_802A123C_71CF1C);
INCLUDE_ASM(s32, "battle/item/dried_shroom_71CCE0", func_802A12FC_71CFDC);

View File

@ -0,0 +1,80 @@
#include "dusty_hammer.h"
#include "battle/item/dusty_hammer/dusty_hammer.png.h"
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, &N(dusty_hammer_pal_png)),
gsDPLoadTextureTile_4b(&N(dusty_hammer_png), G_IM_FMT_CI, N(dusty_hammer_png_width), N(dusty_hammer_png_height), 0, 0, N(dusty_hammer_png_width) - 1, N(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),
gsSP1Triangle(0, 1, 2, 0),
gsSP1Triangle(0, 2, 3, 0),
gsDPPipeSync(),
gsSPEndDisplayList(),
};
s32 N(modelCommandList)[] = {
0x00000004, 0x0000000D, 0x00000001, sizeof(N(displayList)) / sizeof(s32), &N(displayList), 0x00000002, 0x00000000,
};
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_DUSTY_HAMMER;
await N(UseItemWithEffect);
UseCamPreset(3);
MoveBattleCamOver(15);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_THROW);
PlaySound(1018);
sleep 3;
func_802D3474(SI_VAR(10), N(modelCommandList));
SI_VAR(0) = 1.0;
MultiplyByActorScale(SI_VAR(0));
func_802D38EC(SI_VAR(10), SI_VAR(0), SI_VAR(0), SI_VAR(0));
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(3) = 20;
SI_VAR(4) = 42;
SI_VAR(5) = 5;
MultiplyVec3ByActorScale(SI_VAR(3), SI_VAR(4), SI_VAR(5));
SI_VAR(0) += SI_VAR(3);
SI_VAR(1) += SI_VAR(4);
SI_VAR(2) += SI_VAR(5);
func_802D36E0(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
InitTargetIterator();
SetGoalToTarget(ActorID_SELF);
GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
spawn {
SI_VAR(0) = 0;
loop 18 {
SI_VAR(0) += 0xFFFFFFC4;
func_802D3840(SI_VAR(10), 0, 0, SI_VAR(0));
sleep 1;
}
}
func_802D39FC(SI_VAR(10), 0.80078125);
SI_VAR(2) += 5;
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 18);
GetItemPower(ItemId_DUSTY_HAMMER, SI_VAR(3), SI_VAR(4));
ApplyShrinkFromOwner(SI_VAR(3));
ItemDamageEnemy(SI_VAR(9), 0x18000000, 0, SI_VAR(3), 32);
SI_VAR(0) += 40;
SI_VAR(1) += 10;
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 10);
func_802D3624(SI_VAR(10));
await N(PlayerGoHome);
});

View File

@ -0,0 +1,13 @@
#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
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
#endif

View File

@ -0,0 +1,147 @@
#include "dusty_hammer.h"
extern s32 D_80108A64;
static MenuIcon* D_802A1E80;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A1E80 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A1E80, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A1E80);
}
return ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -1,5 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/dusty_hammer_7179D0", func_802A1000_7179D0);
INCLUDE_ASM(s32, "battle/item/dusty_hammer_7179D0", func_802A11D4_717BA4);

View File

@ -0,0 +1,154 @@
#include "egg_missile.h"
#include "battle/item/egg_missile/egg_missile1.png.h"
#include "battle/item/egg_missile/egg_missile2.png.h"
#include "battle/item/egg_missile/egg_missile3.png.h"
#include "battle/item/egg_missile/egg_missile4.png.h"
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(frame1_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, &N(egg_missile1_pal_png)),
gsDPLoadTextureTile_4b(&N(egg_missile1_png), G_IM_FMT_CI, N(egg_missile1_png_width), N(egg_missile1_png_height), 0, 0, N(egg_missile1_png_width) - 1, N(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),
gsSP1Triangle(0, 1, 2, 0),
gsSP1Triangle(0, 2, 3, 0),
gsDPPipeSync(),
gsSPEndDisplayList(),
};
Gfx N(frame2_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, &N(egg_missile2_pal_png)),
gsDPLoadTextureTile_4b(&N(egg_missile2_png), G_IM_FMT_CI, N(egg_missile2_png_width), 0, 0, 0, N(egg_missile2_png_width) - 1, N(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),
gsSP1Triangle(0, 1, 2, 0),
gsSP1Triangle(0, 2, 3, 0),
gsDPPipeSync(),
gsSPEndDisplayList(),
};
Gfx N(frame3_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, &N(egg_missile3_pal_png)),
gsDPLoadTextureTile_4b(&N(egg_missile3_png), G_IM_FMT_CI, N(egg_missile3_png_width), 0, 0, 0, N(egg_missile3_png_width) - 1, N(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),
gsSP1Triangle(0, 1, 2, 0),
gsSP1Triangle(0, 2, 3, 0),
gsDPPipeSync(),
gsSPEndDisplayList(),
};
Gfx N(frame4_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, &N(egg_missile4_pal_png)),
gsDPLoadTextureTile_4b(&N(egg_missile4_png), G_IM_FMT_CI, N(egg_missile4_png_width), 0, 0, 0, N(egg_missile4_png_width) - 1, N(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),
gsSP1Triangle(0, 1, 2, 0),
gsSP1Triangle(0, 2, 3, 0),
gsDPPipeSync(),
gsSPEndDisplayList(),
};
s32 N(modelCommandList)[] = {
0x00000004, 0x0000000D,
0x00000001, 0x00000002, &N(frame1_displayList),
0x00000001, 0x00000002, &N(frame2_displayList),
0x00000001, 0x00000002, &N(frame3_displayList),
0x00000002, 0x00000000,
0x00000004, 0x0000000D,
0x00000001, sizeof(N(frame4_displayList)) / sizeof(s32), &N(frame4_displayList),
0x00000002, 0x00000000,
};
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_EGG_MISSILE;
await N(UseItemWithEffect);
UseCamPreset(3);
MoveBattleCamOver(15);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_THROW);
PlaySound(1018);
sleep 3;
func_802D3474(SI_VAR(10), N(modelCommandList));
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 20;
SI_VAR(1) += 42;
SI_VAR(2) += 5;
func_802D36E0(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
InitTargetIterator();
SetGoalToTarget(ActorID_SELF);
GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
spawn {
SI_VAR(0) = 0;
loop 18 {
SI_VAR(0) += 60;
func_802D3840(SI_VAR(10), 0, 0, SI_VAR(0));
sleep 1;
}
}
func_802D39FC(SI_VAR(10), 1.0);
SI_VAR(2) += 5;
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 18);
func_802D3624(SI_VAR(10));
PlaySound(8208);
N(func_802A123C_71CF1C)(SI_VAR(0), SI_VAR(1), SI_VAR(2));
spawn {
StartRumble(5);
ShakeCam(1, 0, 2, 0.75);
ShakeCam(1, 0, 5, 1.5);
ShakeCam(1, 0, 4, 1.2001953125);
ShakeCam(1, 0, 2, 0.4501953125);
}
GetItemPower(ItemId_EGG_MISSILE, SI_VAR(0), SI_VAR(1));
ItemDamageEnemy(SI_VAR(0), 0x18000202, 0, SI_VAR(0), 32);
await N(PlayerGoHome);
});

View File

@ -0,0 +1,15 @@
#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
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
ApiStatus N(func_802A123C_71CF1C)(ScriptInstance* script, s32 isInitialCall);
#endif

View File

@ -0,0 +1,158 @@
#include "egg_missile.h"
extern s32 D_80108A64;
static MenuIcon* D_802A2890;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A2890 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A2890, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A2890);
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A123C_71CF1C)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
func_80070130(0, a, b, c);
func_800701F0(0, a, b + 20, c);
return ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -1,7 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/egg_missile_728EC0", func_802A1000_728EC0);
INCLUDE_ASM(s32, "battle/item/egg_missile_728EC0", func_802A11D4_729094);
INCLUDE_ASM(s32, "battle/item/egg_missile_728EC0", func_802A123C_7290FC);

View File

@ -0,0 +1,33 @@
#include "electro_pop.h"
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_ELECTRO_POP;
await N(UseItemWithEffect);
await N(EatItem);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 20;
PlayEffect(87, 0, SI_VAR(0), SI_VAR(1), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
PlaySound(889);
GetItemPower(ItemId_VOLT_SHROOM, SI_VAR(0), SI_VAR(1));
N(func_802A123C_7307DC)();
sleep 40;
N(func_802A14F0_730A90)();
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 20;
SI_VAR(1) += 25;
N(func_802A133C_7308DC)(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(3));
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 25;
func_802D7520(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(3));
N(AddFP)(SI_VAR(3));
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_THUMBS_UP);
sleep 30;
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_802D75D8(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(3));
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
sleep 20;
ShowMessageBox(16, 60);
WaitForMessageBoxDone();
await N(PlayerGoHome);
});

View File

@ -0,0 +1,22 @@
#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
ApiStatus func_802D7520(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802D75D8(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A123C_7307DC)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A14F0_730A90)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A133C_7308DC)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(AddFP)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
Script N(EatItem);
#endif

View File

@ -0,0 +1,225 @@
#include "electro_pop.h"
extern s32 D_80108A64;
static MenuIcon* D_802A1D60;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A1D60 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A1D60, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A1D60);
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A123C_7307DC)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
inflict_status(player, Debuff_STATIC, script->varTable[0]);
player->status = 0;
return ApiStatus_DONE2;
}
ApiStatus N(func_802A127C_73081C)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
s32 d = get_variable(script, *args++);
func_80071090(0, a, b, c, d);
return ApiStatus_DONE2;
}
ApiStatus N(func_802A133C_7308DC)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
s32 d = get_variable(script, *args++);
func_80071090(1, a, b, c, d);
return ApiStatus_DONE2;
}
#include "common/AddHP.inc.c"
ApiStatus N(func_802A1450_7309F0)(ScriptInstance* script, s32 isInitialCall) {
StaticItem* item = &gItemTable[ItemId_ELECTRO_POP];
PlayerData* playerData = &gPlayerData;
playerData->curHP += item->potencyA;
if (playerData->curHP > playerData->curMaxHP) {
playerData->curHP = playerData->curMaxHP;
}
script->varTable[3] = item->potencyA;
return ApiStatus_DONE2;
}
ApiStatus N(AddFP)(ScriptInstance* script, s32 isInitialCall) {
PlayerData* playerData = &gPlayerData;
PlayerData* playerData2 = &gPlayerData;
s32 amt = get_variable(script, *script->ptrReadPos);
// @bug Should be playerData->curFP
s32 newFP = playerData->curHP + amt;
if (newFP > playerData->curMaxFP) {
newFP = playerData->curMaxFP;
}
playerData2->curFP = newFP;
return ApiStatus_DONE2;
}
ApiStatus N(func_802A14F0_730A90)(ScriptInstance* script, s32 isInitialCall) {
StaticItem* item = &gItemTable[ItemId_ELECTRO_POP];
PlayerData* playerData = &gPlayerData;
playerData->curFP += item->potencyA;
if (playerData->curFP > playerData->curMaxFP) {
playerData->curFP = playerData->curMaxFP;
}
script->varTable[3] = item->potencyB;
return ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -1,21 +0,0 @@
#include "common.h"
#define NAMESPACE battle_item_electro_pop
INCLUDE_ASM(s32, "battle/item/electro_pop_7305A0", func_802A1000_7305A0);
INCLUDE_ASM(s32, "battle/item/electro_pop_7305A0", func_802A11D4_730774);
INCLUDE_ASM(s32, "battle/item/electro_pop_7305A0", func_802A123C_7307DC);
INCLUDE_ASM(s32, "battle/item/electro_pop_7305A0", func_802A127C_73081C);
INCLUDE_ASM(s32, "battle/item/electro_pop_7305A0", func_802A133C_7308DC);
#include "common/AddHP.inc.c"
INCLUDE_ASM(s32, "battle/item/electro_pop_7305A0", func_802A1450_7309F0);
INCLUDE_ASM(s32, "battle/item/electro_pop_7305A0", func_802A149C_730A3C);
INCLUDE_ASM(s32, "battle/item/electro_pop_7305A0", func_802A14F0_730A90);

View File

@ -0,0 +1,63 @@
#include "fire_flower.h"
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_FIRE_FLOWER;
await N(UseItemWithEffect);
N(FadeBackgroundToBlack)();
PlaySound(887);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_PLANT);
spawn {
sleep 50;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
}
sleep 35;
UseCamPreset(2);
MoveBattleCamOver(20);
sleep 10;
GetActorPos(ActorID_PLAYER, SI_VAR(3), SI_VAR(4), SI_VAR(5));
SI_VAR(0) = 40;
MultiplyByActorScale(SI_VAR(0));
SI_VAR(3) += SI_VAR(0);
spawn {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) -= 10;
SetActorSpeed(ActorID_PLAYER, 2.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
}
spawn {
N(func_802A123C_716E9C)(SI_VAR(3), SI_VAR(4), SI_VAR(5));
sleep 25;
loop 12 {
sleep 1;
PlaySound(8236);
sleep 2;
PlaySound(8237);
sleep 1;
}
}
sleep 80;
UseCamPreset(3);
MoveBattleCamOver(20);
InitTargetIterator();
0:
SetGoalToTarget(ActorID_SELF);
ItemCheckHit(SI_VAR(0), 0x10000000, 0, SI_VAR(0), 0);
if (SI_VAR(0) == 6) {
goto 1;
}
GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
GetItemPower(ItemId_FIRE_FLOWER, SI_VAR(0), SI_VAR(1));
ItemDamageEnemy(SI_VAR(0), 0x38000002, 0, SI_VAR(0), 32);
1:
sleep 5;
ChooseNextTarget(0, SI_VAR(0));
if (SI_VAR(0) != -1) {
goto 0;
}
N(func_802A1378_716FD8)();
sleep 30;
await N(PlayerGoHome);
});

View File

@ -0,0 +1,17 @@
#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
ApiStatus N(FadeBackgroundToBlack)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A123C_716E9C)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A1378_716FD8)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
#endif

View File

@ -0,0 +1,175 @@
#include "fire_flower.h"
extern s32 D_80108A64;
static MenuIcon* D_802A1D70;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A1D70 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A1D70, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A1D70);
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A123C_716E9C)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
func_80071030(0, a, b, c, 0);
return ApiStatus_DONE2;
}
#include "common/FadeBackgroundToBlack.inc.c"
ApiStatus N(func_802A1378_716FD8)(ScriptInstance* script, s32 isInitialCall) {
if (isInitialCall) {
script->functionTemp[0].s = 20;
}
set_background_color_blend(0, 0, 0, (script->functionTemp[0].s * 10) & 254);
script->functionTemp[0].s--;
if (script->functionTemp[0].s == 0) {
set_background_color_blend(0, 0, 0, 0);
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -1,22 +0,0 @@
#include "common.h"
extern s32 D_802A1D70;
INCLUDE_ASM(s32, "battle/item/fire_flower_716C60", func_802A1000_716C60);
ApiStatus func_802A11D4_716E34(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battlestatus = &gBattleStatus;
s32 sellValue = gItemTable[battlestatus->selectedItemID].sellValue;
if (heroes_is_ability_active(battlestatus->playerActor, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A1D70);
}
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "battle/item/fire_flower_716C60", func_802A123C_716E9C);
#define NAMESPACE battle_item_fire_flower
#include "common/FadeBackgroundToBlack.inc.c"
INCLUDE_ASM(s32, "battle/item/fire_flower_716C60", func_802A1378_716FD8);

139
src/battle/item/food/food.c Normal file
View File

@ -0,0 +1,139 @@
#include "food.h"
Script N(script6) = SCRIPT({
SetActorYaw(ActorID_PLAYER, 30);
sleep 1;
SetActorYaw(ActorID_PLAYER, 60);
sleep 1;
SetActorYaw(ActorID_PLAYER, 90);
sleep 1;
SetActorYaw(ActorID_PLAYER, 120);
sleep 1;
SetActorYaw(ActorID_PLAYER, 150);
sleep 1;
SetActorYaw(ActorID_PLAYER, 180);
sleep 10;
SI_VAR(1) = SI_VAR(15);
await N(UseItem);
SI_VAR(14) = SI_VAR(10);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_THROW);
spawn {
sleep 20;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
}
func_802D3474(SI_VAR(10), 0x80283EE8);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 0;
SI_VAR(1) += 30;
SI_VAR(2) += 5;
func_802D36E0(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_802D3F74(SI_VAR(10), 32);
spawn {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(14), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
loop 25 {
func_802D378C(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
N(func_802A123C_73330C)(SI_VAR(0), SI_VAR(1), SI_VAR(2));
sleep 1;
}
RemoveItemEntity(SI_VAR(14));
}
InitTargetIterator();
SetGoalToTarget(ActorID_SELF);
GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetBattleCamTarget(0xFFFFFF83, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(25);
func_802D39FC(SI_VAR(10), 0.400390625);
SI_VAR(2) += 5;
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 25);
AddBattleCamZoom(100);
MoveBattleCamOver(30);
GetActorPos(ActorID_PARTNER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 25;
func_802D7520(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(11));
if (SI_VAR(11) > 0) {
N(func_802A12EC_7333BC)(SI_VAR(11));
}
sleep 30;
GetActorPos(ActorID_PARTNER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_802D75D8(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(11));
sleep 20;
SetActorYaw(ActorID_PLAYER, 150);
sleep 1;
SetActorYaw(ActorID_PLAYER, 120);
sleep 1;
SetActorYaw(ActorID_PLAYER, 90);
sleep 1;
SetActorYaw(ActorID_PLAYER, 60);
sleep 1;
SetActorYaw(ActorID_PLAYER, 30);
sleep 1;
SetActorYaw(ActorID_PLAYER, 0);
sleep 10;
});
Script N(main) = SCRIPT({
SI_VAR(14) = SI_VAR(1);
GetMenuSelection(SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(10) = SI_VAR(1);
N(func_802A15A0_733670)(SI_VAR(10));
InitTargetIterator();
GetOwnerTarget(SI_VAR(0), SI_VAR(1));
if (SI_VAR(0) == ActorID_PARTNER) {
await N(script6);
return;
}
SI_VAR(1) = SI_VAR(14);
await N(UseItemWithEffect);
if (SI_VAR(13) == 0) {
await N(EatItem);
} else {
await N(DrinkItem);
}
if (SI_VAR(15) == 1) {
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_STICK_OUT_TONGUE);
}
if (SI_VAR(11) > 0) {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 0;
SI_VAR(1) += 35;
N(func_802A1378_733448)(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(11));
}
if (SI_VAR(11) < 0) {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 0;
SI_VAR(1) += 35;
N(func_802A1378_733448)(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(11));
}
if (SI_VAR(12) > 0) {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 20;
SI_VAR(1) += 25;
N(func_802A1438_733508)(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(12));
}
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 25;
func_802D7520(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(11));
if (SI_VAR(11) != 0) {
N(AddHP)(SI_VAR(11));
}
if (SI_VAR(12) != 0) {
N(AddFP)(SI_VAR(12));
}
if (SI_VAR(15) == 0) {
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_THUMBS_UP);
sleep 30;
} else {
sleep 30;
}
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_802D75D8(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(11));
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
sleep 20;
await N(PlayerGoHome);
});

View File

@ -0,0 +1,29 @@
#ifndef BATTLE_ITEM_FOOD
#define BATTLE_ITEM_FOOD
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_food
ApiStatus func_802D3F74(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802D378C(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802D7520(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802D75D8(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A123C_73330C)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A12EC_7333BC)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A15A0_733670)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A1378_733448)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A1438_733508)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(AddHP)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(AddFP)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
Script N(UseItem);
Script N(EatItem);
Script N(DrinkItem);
#endif

232
src/battle/item/food/lib.c Normal file
View File

@ -0,0 +1,232 @@
#include "food.h"
extern s32 D_80108A64;
static MenuIcon* D_802A24D0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A24D0 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A24D0, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A24D0);
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A123C_73330C)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
ItemEntity* item = get_item_entity(script->varTable[14]);
item->position.x = a;
item->position.y = b;
item->position.z = c;
return ApiStatus_DONE2;
}
ApiStatus N(func_802A12EC_7333BC)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* partner = battleStatus->partnerActor;
Bytecode* args = script->ptrReadPos;
if (partner->koDuration == 0) {
return ApiStatus_DONE2;
}
partner->koDuration -= get_variable(script, *args++);
if (partner->koDuration < 0) {
partner->koDuration = 0;
}
if (partner->koDuration > 0) {
partner->ptrDefuffIcon->ptrPropertyList[0xF] = partner->koDuration;
} else {
partner->koStatus = 0;
dispatch_event_partner(0x34);
partner->ptrDefuffIcon->ptrPropertyList[0xF] = 0;
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1378_733448)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
s32 d = get_variable(script, *args++);
func_80071090(0, a, b, c, d);
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1438_733508)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
s32 d = get_variable(script, *args++);
func_80071090(1, a, b, c, d);
return ApiStatus_DONE2;
}
#include "common/AddHP.inc.c"
#include "common/AddFP.inc.c"
ApiStatus N(func_802A15A0_733670)(ScriptInstance* script, s32 isInitialCall) {
StaticItem* itemTable = gItemTable;
Bytecode* args = script->ptrReadPos;
s32 itemIdx = get_variable(script, *args++);
StaticItem* item = &itemTable[itemIdx];
script->varTable[11] = item->potencyA;
script->varTable[12] = item->potencyB;
script->varTable[13] = 0;
if (item->typeFlags & 0x100) {
script->varTable[13] = 1;
}
script->varTable[15] = script->varTable[11] < 0 ||
(script->varTable[11] <= 0 && script->varTable[12] < 0);
return ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -1,21 +0,0 @@
#include "common.h"
#define NAMESPACE battle_item_food
INCLUDE_ASM(s32, "battle/item/food_7330D0", func_802A1000_7330D0);
INCLUDE_ASM(s32, "battle/item/food_7330D0", func_802A11D4_7332A4);
INCLUDE_ASM(s32, "battle/item/food_7330D0", func_802A123C_73330C);
INCLUDE_ASM(s32, "battle/item/food_7330D0", func_802A12EC_7333BC);
INCLUDE_ASM(s32, "battle/item/food_7330D0", func_802A1378_733448);
INCLUDE_ASM(s32, "battle/item/food_7330D0", func_802A1438_733508);
#include "common/AddHP.inc.c"
#include "common/AddFP.inc.c"
INCLUDE_ASM(s32, "battle/item/food_7330D0", func_802A15A0_733670);

View File

@ -0,0 +1,55 @@
#include "fright_jar.h"
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_FRIGHT_JAR;
await N(UseItemWithEffect);
N(FadeBackgroundToBlack)();
spawn {
sleep 5;
UseCamPreset(2);
MoveBattleCamOver(50);
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_CROUCH);
PlaySoundAtActor(ActorID_PLAYER, 871);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 0xFFFFFFD8;
SI_VAR(1) += 5;
SI_VAR(3) = 0.7001953125;
loop 5 {
PlayEffect(97, 0, SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(3), 25, 0, 0, 0, 0, 0, 0, 0);
SI_VAR(0) += 5;
SI_VAR(3) += 0.150390625;
sleep 7;
}
PlayEffect(97, 0, SI_VAR(0), SI_VAR(1), SI_VAR(2), 1.5, 60, 0, 0, 0, 0, 0, 0, 0);
sleep 20;
loop 4 {
AddBattleCamZoom(0xFFFFFF9C);
MoveBattleCamOver(2);
sleep 2;
AddBattleCamZoom(100);
MoveBattleCamOver(2);
sleep 2;
}
UseCamPreset(3);
MoveBattleCamOver(20);
InitTargetIterator();
0:
SetGoalToTarget(ActorID_SELF);
ItemCheckHit(SI_VAR(0), 0x10000000, 0, SI_VAR(0), 0);
if (SI_VAR(0) == 6) {
goto 1;
}
func_80269EAC(21);
ItemAfflictEnemy(SI_VAR(0), 0x70001000, 0, 100, 0, 32);
1:
ChooseNextTarget(0, SI_VAR(0));
if (SI_VAR(0) != -1) {
goto 0;
}
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_WALKING);
N(func_802A12D4_72BBE4)();
sleep 20;
await N(PlayerGoHome);
});

View File

@ -0,0 +1,17 @@
#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
ApiStatus func_80269EAC(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(FadeBackgroundToBlack)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A12D4_72BBE4)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
#endif

View File

@ -0,0 +1,164 @@
#include "fright_jar.h"
extern s32 D_80108A64;
static MenuIcon* D_802A1CA0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A1CA0 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A1CA0, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A1CA0);
}
return ApiStatus_DONE2;
}
#include "common/FadeBackgroundToBlack.inc.c"
ApiStatus N(func_802A12D4_72BBE4)(ScriptInstance* script, s32 isInitialCall) {
if (isInitialCall) {
script->functionTemp[0].s = 20;
}
set_background_color_blend(0, 0, 0, (script->functionTemp[0].s * 10) & 254);
script->functionTemp[0].s--;
if (script->functionTemp[0].s == 0) {
set_background_color_blend(0, 0, 0, 0);
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -1,10 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/fright_jar_72B910", func_802A1000_72B910);
INCLUDE_ASM(s32, "battle/item/fright_jar_72B910", func_802A11D4_72BAE4);
#define NAMESPACE battle_item_fright_jar
#include "common/FadeBackgroundToBlack.inc.c"
INCLUDE_ASM(s32, "battle/item/fright_jar_72B910", func_802A12D4_72BBE4);

View File

@ -0,0 +1,79 @@
#include "hustle_drink.h"
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_HUSTLE_DRINK;
await N(UseItemWithEffect);
await N(DrinkItem);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_SQUISH);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 25;
func_802D7520(SI_VAR(0), SI_VAR(1), SI_VAR(2), 5);
N(func_802A12C4_726224)();
N(func_802A123C_72619C)();
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 20;
UseCamPreset(13);
BattleCamTargetActor(ActorID_SELF);
MoveBattleCamOver(20);
PlaySoundAtActor(ActorID_PLAYER, 873);
spawn {
loop 2 {
SetActorScale(ActorID_SELF, 1.0, 1.0, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.1005859375, 1.0, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.2001953125, 0.9501953125, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.30078125, 0.900390625, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.3505859375, 0.8505859375, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.380859375, 0.80078125, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.400390625, 0.80078125, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.30078125, 0.8505859375, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.2001953125, 0.900390625, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.1005859375, 0.9501953125, 1.0);
sleep 1;
}
SetActorScale(ActorID_SELF, 1.0, 1.0, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.1005859375, 1.0, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.2001953125, 0.9501953125, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.30078125, 0.900390625, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.3505859375, 0.8505859375, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.380859375, 0.80078125, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.400390625, 0.80078125, 1.0);
sleep 1;
PlaySoundAtActor(ActorID_PLAYER, 8334);
SetActorScale(ActorID_SELF, 0.900390625, 1.30078125, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 0.900390625, 1.2001953125, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 0.9501953125, 1.1005859375, 1.0);
sleep 1;
SetActorScale(ActorID_SELF, 1.0, 1.0, 1.0);
sleep 1;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
}
loop 10 {
PlaySoundAtActor(ActorID_PLAYER, 873);
PlayEffect(6, 0, SI_VAR(0), SI_VAR(1), SI_VAR(2), 0, 0, 0, 0, 0, 0, 0, 0, 0);
PlayEffect(6, 1, SI_VAR(0), SI_VAR(1), SI_VAR(2), 0, 0, 0, 0, 0, 0, 0, 0, 0);
sleep 4;
}
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
UseCamPreset(2);
MoveBattleCamOver(20);
sleep 20;
await N(PlayerGoHome);
});

View File

@ -0,0 +1,18 @@
#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
ApiStatus func_802D7520(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A12C4_726224)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A123C_72619C)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
Script N(DrinkItem);
#endif

View File

@ -0,0 +1,178 @@
#include "hustle_drink.h"
extern s32 D_80108A64;
static MenuIcon* D_802A1E70;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A1E70 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A1E70, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A1E70);
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A123C_72619C)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
if (player->debuff != 0) {
player->debuffDuration = 0;
player->debuff = 0;
func_80047898(player->unk_436);
}
if (player->staticStatus != 0) {
player->staticDuration = 0;
player->staticStatus = 0;
func_800479A0(player->unk_436);
}
if (player->stoneStatus != 0) {
player->stoneDuration = 0;
player->stoneStatus = 0;
}
if (player->transStatus != 0) {
player->transDuration = 0;
player->transStatus = 0;
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A12C4_726224)(ScriptInstance* script, s32 isInitialCall) {
gBattleStatus.hustleTurns = 2;
return ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -1,9 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/hustle_drink_725F60", func_802A1000_725F60);
INCLUDE_ASM(s32, "battle/item/hustle_drink_725F60", func_802A11D4_726134);
INCLUDE_ASM(s32, "battle/item/hustle_drink_725F60", func_802A123C_72619C);
INCLUDE_ASM(s32, "battle/item/hustle_drink_725F60", func_802A12C4_726224);

View File

@ -0,0 +1,96 @@
#include "insecticide_herb.h"
#include "battle/item/insecticide_herb/insecticide_herb.png.h"
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, &N(insecticide_herb_pal_png)),
gsDPLoadTextureTile_4b(&N(insecticide_herb_png), G_IM_FMT_CI, N(insecticide_herb_png_width), N(insecticide_herb_png_height), 0, 0, N(insecticide_herb_png_width) - 1, N(insecticide_herb_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(),
};
s32 N(modelCommandList)[] = {
0x00000004, 0x0000000D, 0x00000001, sizeof(N(displayList)) / sizeof(s32), &N(displayList), 0x00000002, 0x00000000,
};
Script script = SCRIPT({
SI_VAR(10) = c ItemId_INSECTICIDE_HERB;
await N(UseItemWithEffect);
UseCamPreset(3);
MoveBattleCamOver(15);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_THROW);
PlaySound(1018);
sleep 3;
func_802D3474(SI_VAR(10), N(modelCommandList));
SI_VAR(0) = 1.0;
MultiplyByActorScale(SI_VAR(0));
func_802D38EC(SI_VAR(10), SI_VAR(0), SI_VAR(0), SI_VAR(0));
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(3) = 20;
SI_VAR(4) = 42;
SI_VAR(5) = 5;
MultiplyVec3ByActorScale(SI_VAR(3), SI_VAR(4), SI_VAR(5));
SI_VAR(0) += SI_VAR(3);
SI_VAR(1) += SI_VAR(4);
SI_VAR(2) += SI_VAR(5);
func_802D36E0(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
InitTargetIterator();
SetGoalToTarget(ActorID_SELF);
GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
spawn {
SI_VAR(0) = 0;
loop 18 {
SI_VAR(0) += 0xFFFFFFC4;
func_802D3840(SI_VAR(10), 0, 0, SI_VAR(0));
sleep 1;
}
}
func_802D39FC(SI_VAR(10), 0.80078125);
SI_VAR(2) += 5;
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 18);
PlayEffect(7, 3, SI_VAR(0), SI_VAR(1), SI_VAR(2), 0, 0, 0, 0, 0, 0, 0, 0, 0);
SI_VAR(0) -= 10;
PlayEffect(7, 3, SI_VAR(0), SI_VAR(1), SI_VAR(2), 0, 0, 0, 0, 0, 0, 0, 0, 0);
SI_VAR(0) += 20;
PlayEffect(7, 3, SI_VAR(0), SI_VAR(1), SI_VAR(2), 0, 0, 0, 0, 0, 0, 0, 0, 0);
spawn {
N(func_802A12E0_72AA30)(SI_VAR(0), SI_VAR(1), SI_VAR(2));
sleep 3;
N(func_802A12E0_72AA30)(SI_VAR(0), SI_VAR(1), SI_VAR(2));
sleep 3;
N(func_802A12E0_72AA30)(SI_VAR(0), SI_VAR(1), SI_VAR(2));
}
InitTargetIterator();
SetGoalToTarget(ActorID_SELF);
N(func_802A123C_72A98C)();
func_802D3624(SI_VAR(10));
if (SI_VAR(9) == 0) {
ItemDamageEnemy(SI_VAR(0), 0, 0, 0, 32);
} else {
InitTargetIterator();
SetGoalToTarget(ActorID_SELF);
N(func_802A1280_72A9D0)();
}
await N(PlayerGoHome);
});

View File

@ -0,0 +1,16 @@
#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
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
ApiStatus N(func_802A12E0_72AA30)(ScriptInstance *script, s32 isInitialCall);
ApiStatus N(func_802A123C_72A98C)(ScriptInstance *script, s32 isInitialCall);
ApiStatus N(func_802A1280_72A9D0)(ScriptInstance *script, s32 isInitialCall);
#endif

View File

@ -0,0 +1,210 @@
#include "insecticide_herb.h"
extern s32 D_80108A64;
static MenuIcon* D_802A21C0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A21C0 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A21C0, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A21C0);
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A123C_72A98C)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* enemy = get_actor(script->owner1.enemyID);
Actor* target = get_actor(enemy->targetActorID);
script->varTable[9] = target->actorType == 49;
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1280_72A9D0)(ScriptInstance* script, s32 isInitialCall) {
Actor* enemy = get_actor(script->owner1.enemyID);
Actor* target;
play_sound_at_position(0x231, 0, enemy->walk.goalPos.x, enemy->walk.goalPos.y, enemy->walk.goalPos.z);
target = get_actor(enemy->targetActorID);
dispatch_event_actor(target, 0x39);
return ApiStatus_DONE2;
}
// TODO figure out what this actually is
// func_80072230 invokes gEffectTable[111]'s entryPoint function
// that function is currently typed to return void
// Assume it returns an Effect* and unk_0C is this EffectInstanceData
// s32 unk_0C; //? Maybe EffectInstanceData too ?
struct N(temp2) {
char unk_00[0x18];
s32 unk_18;
s32 unk_1C;
s32 unk_20;
char unk_24[0x4];
s32 unk_28;
s32 unk_2C;
s32 unk_30;
} N(temp2);
struct N(temp) {
char unk_00[0xC];
struct N(temp2)* unk_0C;
} N(temp);
ApiStatus N(func_802A12E0_72AA30)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
f32 a = get_variable(script, *args++);
f32 b = get_variable(script, *args++);
f32 c = get_variable(script, *args++);
struct N(temp)* effect;
a += rand_int(20) - 10;
b += rand_int(10) - 5;
effect = (struct N(temp)*)func_80072230(0, a, b, c, 1.0f, 30);
effect->unk_0C->unk_18 = 0xF4;
effect->unk_0C->unk_1C = 0xF4;
effect->unk_0C->unk_20 = 0xDC;
effect->unk_0C->unk_28 = 0xD2;
effect->unk_0C->unk_2C = 0xD2;
effect->unk_0C->unk_30 = 0xBE;
return ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -1,11 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/insecticide_herb_72A750", func_802A1000_72A750);
INCLUDE_ASM(s32, "battle/item/insecticide_herb_72A750", func_802A11D4_72A924);
INCLUDE_ASM(s32, "battle/item/insecticide_herb_72A750", func_802A123C_72A98C);
INCLUDE_ASM(s32, "battle/item/insecticide_herb_72A750", func_802A1280_72A9D0);
INCLUDE_ASM(s32, "battle/item/insecticide_herb_72A750", func_802A12E0_72AA30);

View File

@ -0,0 +1,225 @@
#include "life_shroom.h"
extern s32 D_80108A64;
static MenuIcon* D_802A21F0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A21F0 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A21F0, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A21F0);
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A123C_72E76C)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
ItemEntity* item = get_item_entity(script->varTable[14]);
item->position.x = a;
item->position.y = b;
item->position.z = c;
return ApiStatus_DONE2;
}
ApiStatus N(func_802A12EC_72E81C)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* partner = battleStatus->partnerActor;
Bytecode* args = script->ptrReadPos;
if (partner->koDuration == 0) {
return ApiStatus_DONE2;
}
partner->koDuration -= get_variable(script, *args++);
if (partner->koDuration < 0) {
partner->koDuration = 0;
}
if (partner->koDuration > 0) {
partner->ptrDefuffIcon->ptrPropertyList[0xF] = partner->koDuration;
} else {
partner->koStatus = 0;
dispatch_event_partner(0x34);
partner->ptrDefuffIcon->ptrPropertyList[0xF] = 0;
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1378_72E8A8)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
s32 d = get_variable(script, *args++);
func_80071090(0, a, b, c, d);
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1438_72E968)(ScriptInstance* script, s32 isInitialCall) {
StaticItem* item = &gItemTable[ItemId_LIFE_SHROOM];
PlayerData* playerData = &gPlayerData;
playerData->curHP += item->potencyA;
if (playerData->curHP > playerData->curMaxHP) {
playerData->curHP = playerData->curMaxHP;
}
script->varTable[3] = item->potencyA;
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1484_72E9B4)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 itemIdx = get_variable(script, *args++);
StaticItem* itemTable = gItemTable;
StaticItem* item = &itemTable[itemIdx];
script->varTable[11] = item->potencyA;
script->varTable[12] = item->potencyB;
itemIdx = script->varTable[11] < 0 || (script->varTable[11] <= 0 && script->varTable[12] < 0);
script->varTable[15] = itemIdx;
return ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -0,0 +1,110 @@
#include "life_shroom.h"
Script N(script6) = SCRIPT({
SetActorYaw(ActorID_PLAYER, 30);
sleep 1;
SetActorYaw(ActorID_PLAYER, 60);
sleep 1;
SetActorYaw(ActorID_PLAYER, 90);
sleep 1;
SetActorYaw(ActorID_PLAYER, 120);
sleep 1;
SetActorYaw(ActorID_PLAYER, 150);
sleep 1;
SetActorYaw(ActorID_PLAYER, 180);
sleep 10;
SI_VAR(1) = SI_VAR(15);
await N(UseItem);
SI_VAR(14) = SI_VAR(10);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_THROW);
spawn {
sleep 20;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
}
func_802D3474(SI_VAR(10), 0x80283EE8);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 0;
SI_VAR(1) += 30;
SI_VAR(2) += 5;
func_802D36E0(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_802D3F74(SI_VAR(10), 32);
spawn {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(14), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
loop 25 {
func_802D378C(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
N(func_802A123C_72E76C)(SI_VAR(0), SI_VAR(1), SI_VAR(2));
sleep 1;
}
RemoveItemEntity(SI_VAR(14));
}
InitTargetIterator();
SetGoalToTarget(ActorID_SELF);
GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetBattleCamTarget(0xFFFFFF83, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(25);
func_802D39FC(SI_VAR(10), 0.400390625);
SI_VAR(2) += 5;
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 25);
AddBattleCamZoom(100);
MoveBattleCamOver(30);
GetActorPos(ActorID_PARTNER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 25;
func_802D7520(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(11));
if (SI_VAR(11) > 0) {
N(func_802A12EC_72E81C)(SI_VAR(11));
}
sleep 30;
GetActorPos(ActorID_PARTNER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_802D75D8(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(11));
sleep 20;
SetActorYaw(ActorID_PLAYER, 150);
sleep 1;
SetActorYaw(ActorID_PLAYER, 120);
sleep 1;
SetActorYaw(ActorID_PLAYER, 90);
sleep 1;
SetActorYaw(ActorID_PLAYER, 60);
sleep 1;
SetActorYaw(ActorID_PLAYER, 30);
sleep 1;
SetActorYaw(ActorID_PLAYER, 0);
sleep 10;
});
Script N(main) = SCRIPT({
SI_VAR(15) = SI_VAR(1);
GetMenuSelection(SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(10) = SI_VAR(1);
N(func_802A1484_72E9B4)(SI_VAR(10));
InitTargetIterator();
GetOwnerTarget(SI_VAR(0), SI_VAR(1));
if (SI_VAR(0) == ActorID_PARTNER) {
await N(script6);
return;
}
SI_VAR(10) = c ItemId_LIFE_SHROOM;
SI_VAR(1) = SI_VAR(15);
await N(UseItemWithEffect);
await N(EatItem);
N(func_802A1438_72E968)();
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 0;
SI_VAR(1) += 35;
N(func_802A1378_72E8A8)(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(3));
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 25;
func_802D7520(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(3));
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_THUMBS_UP);
sleep 30;
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_802D75D8(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(3));
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
sleep 20;
await N(PlayerGoHome);
});

View File

@ -0,0 +1,26 @@
#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
ApiStatus func_802D3F74(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802D378C(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802D7520(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802D75D8(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A123C_72E76C)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A12EC_72E81C)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A1484_72E9B4)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A1438_72E968)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A1378_72E8A8)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
Script N(UseItem);
Script N(EatItem);
#endif

View File

@ -1,15 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/life_shroom_72E530", func_802A1000_72E530);
INCLUDE_ASM(s32, "battle/item/life_shroom_72E530", func_802A11D4_72E704);
INCLUDE_ASM(s32, "battle/item/life_shroom_72E530", func_802A123C_72E76C);
INCLUDE_ASM(s32, "battle/item/life_shroom_72E530", func_802A12EC_72E81C);
INCLUDE_ASM(s32, "battle/item/life_shroom_72E530", func_802A1378_72E8A8);
INCLUDE_ASM(s32, "battle/item/life_shroom_72E530", func_802A1438_72E968);
INCLUDE_ASM(s32, "battle/item/life_shroom_72E530", func_802A1484_72E9B4);

View File

@ -0,0 +1,224 @@
#include "mushroom.h"
extern s32 D_80108A64;
static MenuIcon* D_802A2410;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A2410 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A2410, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A2410);
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A123C_715A8C)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
ItemEntity* item = get_item_entity(script->varTable[14]);
item->position.x = a;
item->position.y = b;
item->position.z = c;
return ApiStatus_DONE2;
}
ApiStatus N(func_802A12EC_715B3C)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* partner = battleStatus->partnerActor;
Bytecode* args = script->ptrReadPos;
if (partner->koDuration == 0) {
return ApiStatus_DONE2;
}
partner->koDuration -= get_variable(script, *args++);
if (partner->koDuration < 0) {
partner->koDuration = 0;
}
if (partner->koDuration > 0) {
partner->ptrDefuffIcon->ptrPropertyList[0xF] = partner->koDuration;
} else {
partner->koStatus = 0;
dispatch_event_partner(0x34);
partner->ptrDefuffIcon->ptrPropertyList[0xF] = 0;
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1378_715BC8)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
s32 d = get_variable(script, *args++);
func_80071090(0, a, b, c, d);
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1438_715C88)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
s32 d = get_variable(script, *args++);
func_80071090(1, a, b, c, d);
return ApiStatus_DONE2;
}
#include "common/AddHP.inc.c"
#include "common/AddFP.inc.c"
ApiStatus N(func_802A15A0_715DF0)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
StaticItem* itemTable = gItemTable;
StaticItem* item = &itemTable[get_variable(script, *args++)];
script->varTable[11] = item->potencyA;
script->varTable[12] = item->potencyB;
script->varTable[15] = item->potencyA == 1;
return ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -0,0 +1,129 @@
#include "mushroom.h"
Script N(script6) = SCRIPT({
SetActorYaw(ActorID_PLAYER, 30);
sleep 1;
SetActorYaw(ActorID_PLAYER, 60);
sleep 1;
SetActorYaw(ActorID_PLAYER, 90);
sleep 1;
SetActorYaw(ActorID_PLAYER, 120);
sleep 1;
SetActorYaw(ActorID_PLAYER, 150);
sleep 1;
SetActorYaw(ActorID_PLAYER, 180);
sleep 10;
SI_VAR(1) = SI_VAR(15);
await N(UseItem);
SI_VAR(14) = SI_VAR(10);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_THROW);
spawn {
sleep 20;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
}
func_802D3474(SI_VAR(10), 0x80283EE8);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 0;
SI_VAR(1) += 30;
SI_VAR(2) += 5;
func_802D36E0(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_802D3F74(SI_VAR(10), 32);
spawn {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(14), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
loop 25 {
func_802D378C(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
N(func_802A123C_715A8C)(SI_VAR(0), SI_VAR(1), SI_VAR(2));
sleep 1;
}
RemoveItemEntity(SI_VAR(14));
}
InitTargetIterator();
SetGoalToTarget(ActorID_SELF);
GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetBattleCamTarget(0xFFFFFF83, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(25);
func_802D39FC(SI_VAR(10), 0.400390625);
SI_VAR(2) += 5;
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 25);
AddBattleCamZoom(100);
MoveBattleCamOver(30);
GetActorPos(ActorID_PARTNER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 25;
func_802D7520(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(11));
if (SI_VAR(11) > 0) {
N(func_802A12EC_715B3C)(SI_VAR(11));
}
sleep 30;
GetActorPos(ActorID_PARTNER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_802D75D8(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(11));
sleep 20;
SetActorYaw(ActorID_PLAYER, 150);
sleep 1;
SetActorYaw(ActorID_PLAYER, 120);
sleep 1;
SetActorYaw(ActorID_PLAYER, 90);
sleep 1;
SetActorYaw(ActorID_PLAYER, 60);
sleep 1;
SetActorYaw(ActorID_PLAYER, 30);
sleep 1;
SetActorYaw(ActorID_PLAYER, 0);
sleep 10;
});
Script N(main) = SCRIPT({
SI_VAR(14) = SI_VAR(1);
GetMenuSelection(SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(10) = SI_VAR(1);
N(func_802A15A0_715DF0)(SI_VAR(10));
InitTargetIterator();
GetOwnerTarget(SI_VAR(0), SI_VAR(1));
if (SI_VAR(0) == ActorID_PARTNER) {
await N(script6);
return;
}
SI_VAR(1) = SI_VAR(14);
await N(UseItemWithEffect);
await N(EatItem);
if (SI_VAR(15) == 1) {
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_STICK_OUT_TONGUE);
}
if (SI_VAR(11) > 0) {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 0;
SI_VAR(1) += 35;
N(func_802A1378_715BC8)(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(11));
}
if (SI_VAR(12) > 0) {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 20;
SI_VAR(1) += 25;
N(func_802A1438_715C88)(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(12));
}
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 25;
func_802D7520(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(11));
if (SI_VAR(11) != 0) {
N(AddHP)(SI_VAR(11));
}
if (SI_VAR(12) != 0) {
N(AddFP)(SI_VAR(12));
}
if (SI_VAR(15) == 0) {
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_THUMBS_UP);
sleep 30;
} else {
sleep 30;
}
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_802D75D8(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(11));
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
sleep 20;
await N(PlayerGoHome);
});

View File

@ -0,0 +1,28 @@
#ifndef BATTLE_ITEM_MUSHROOM
#define BATTLE_ITEM_MUSHROOM
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_mushroom
ApiStatus func_802D3F74(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802D378C(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802D7520(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802D75D8(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A123C_715A8C)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A12EC_715B3C)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A15A0_715DF0)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A1378_715BC8)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A1438_715C88)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(AddHP)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(AddFP)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
Script N(UseItem);
Script N(EatItem);
#endif

View File

@ -1,21 +0,0 @@
#include "common.h"
#define NAMESPACE battle_item_mushroom
INCLUDE_ASM(s32, "battle/item/mushroom_715850", func_802A1000_715850);
INCLUDE_ASM(s32, "battle/item/mushroom_715850", func_802A11D4_715A24);
INCLUDE_ASM(s32, "battle/item/mushroom_715850", func_802A123C_715A8C);
INCLUDE_ASM(s32, "battle/item/mushroom_715850", func_802A12EC_715B3C);
INCLUDE_ASM(s32, "battle/item/mushroom_715850", func_802A1378_715BC8);
INCLUDE_ASM(s32, "battle/item/mushroom_715850", func_802A1438_715C88);
#include "common/AddHP.inc.c"
#include "common/AddFP.inc.c"
INCLUDE_ASM(s32, "battle/item/mushroom_715850", func_802A15A0_715DF0);

View File

@ -0,0 +1,364 @@
#include "mystery.h"
extern s32 D_80108A64;
static MenuIcon* D_802A25C0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A25C0 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A25C0, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A25C0);
}
return ApiStatus_DONE2;
}
#ifdef NON_MATCHING
extern s32 D_802A25E4;
extern MenuIcon* D_802A25C8;
extern s32 D_802A25EC;
void N(func_802A123C_72C7EC)(void) {
s32 i;
MenuIcon** ptr;
s32 var;
s32* var2;
if (D_802A25E4 < 6) {
if (D_802A25E4 > 0) {
draw_box(0, 7, 0x6A, 0x56, 0, 0x24, 0x24, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x140, 0xF0, 0);
gDPSetScissor(gMasterGfxPos++, G_SC_NON_INTERLACE, 108, 90, 139, 118);
ptr = &D_802A25C8;
for (i = 0; i < 7; i++) {
var2 = *ptr;
var = (D_802A25EC / 100) - 0x68;
ptr++;
set_icon_render_pos(var2, 0x7C, (i * 0x1A) - var);
draw_icon_2(var2);
}
var2 = D_802A25C8;
var = (D_802A25EC / 100) - 0x68;
set_icon_render_pos(var2, 0x7C, (i * 0x1A) - var);
draw_icon_2(var2);
}
}
}
#else
INCLUDE_ASM(ApiStatus, "battle/item/mystery_72C5B0", battle_item_mystery_func_802A123C_72C7EC, ScriptInstance* script,
s32 isInitialCall);
#endif
#ifdef NON_MATCHING
extern s32 D_802A25E4;
extern s32 D_802A25E8;
extern s32 D_802A25EC;
extern s32 D_802A25F0;
extern s32 D_802A25F4;
extern s32 D_802A25F8;
extern s16** D_802A25FC;
extern MenuIcon** D_802A25C8;
extern struct N(tempStc) D_8008A680[100];
ApiStatus N(func_802A13E4_72C994)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
if (isInitialCall) {
D_802A25E4 = 0;
}
switch (D_802A25E4) {
case 0: {
s32* tablePtr;
s32 i;
f32 t0;
f32 t1;
MenuIcon* icon;
MenuIcon** iconPtr;
struct N(tempStc)* ic;
StaticItem* itemTable;
D_802A25F8 = bind_dynamic_entity_7(NULL, func_802A123C_72C7EC);
D_802A25EC = rand_int(18200);
D_802A25F0 = 1000;
tablePtr = &D_802A25FC;
*tablePtr = N(D_802A227C_72D82C);
if (battleStatus->unk_432 > 0) {
func_80137DC0(1, &t0, &t1);
if (t1 >= 215.0f) {
*tablePtr = N(D_802A229C_72D84C);
}
}
i = 0;
ic = &D_8008A680;
itemTable = gItemTable;
iconPtr = &D_802A25C8;
for (; i < 7; i++, iconPtr++) {
icon = create_icon(ic[itemTable[D_802A25FC[i]].iconID].iconId);
*iconPtr = icon;
set_icon_flags(icon, 0x80);
}
D_802A25E4 = 1;
}
break;
case 1: {
s32* ECptr = &D_802A25EC;
s32* F0ptr = &D_802A25F0;
*ECptr += *F0ptr;
if (*ECptr / 100 > 181) {
s32* test = ECptr;
*test -= 0x4718;
}
if (*F0ptr > 400) {
*F0ptr -= 10;
} else if (*F0ptr > 100) {
*F0ptr -= 5;
} else {
*F0ptr -= 1;
}
if (D_802A25F0 < 10) {
D_802A25E8 = D_802A25EC / 100;
if (D_802A25E8 % 26 < 13) {
if (rand_int(100) < 80) {
D_802A25E4 = 2;
} else {
D_802A25E4 = 3;
}
} else if (rand_int(100) < 60) {
D_802A25E4 = 3;
} else {
D_802A25E4 = 2;
}
}
}
break;
case 2: {
s32* E8ptr = &D_802A25E8;
s32 a, b, c, d;
d = *E8ptr % 26;
a = d;
c = a + 3;
if (c < 0) {
c = a + 6;
}
d = c >> 2;
*E8ptr -= d;
D_802A25EC = *E8ptr * 100;
if (d == 0) {
D_802A25E4 = 4;
}
}
break;
case 3: {
s32* E8ptr = &D_802A25E8;
s32 a, b, c, d;
d = *E8ptr % 26;
if (d == 0) {
D_802A25E4 = 4;
break;
}
a = d;
b = 26;
b -= a;
c = b + 3;
if (c < 0) {
c = b + 6;
}
c = c >> 2;
*E8ptr += c;
D_802A25EC = *E8ptr * 100;
}
break;
case 4: {
D_802A25F4 = 20;
D_802A25E4 = 5;
}
break;
case 5: {
s32* F4ptr = &D_802A25F4;
s32 i;
s16 g;
MenuIcon** iconPtr;
if (*F4ptr != 0) {
*F4ptr -= 1;
break;
}
iconPtr = &D_802A25C8;
i = D_802A25E8 / 26;
g = D_802A25FC[i];
battleStatus->selectedItemID = g;
script->varTable[0] = g;
func_801235C0(D_802A25F8);
for (i = 0; i < 7; i++) {
free_icon(*iconPtr++);
}
}
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
#else
INCLUDE_ASM(ApiStatus, "battle/item/mystery_72C5B0", battle_item_mystery_func_802A13E4_72C994, ScriptInstance* script,
s32 isInitialCall);
#endif
ApiStatus N(func_802A188C_72CE3C)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
func_80070190(2, a, b, c, 0, -1.0f, 0, 5);
return ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -0,0 +1,91 @@
#include "mystery.h"
#include "battle/item/mystery/mystery.png.h"
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, &N(mystery_pal_png)),
gsDPLoadTextureTile_4b(&N(mystery_png), G_IM_FMT_CI, N(mystery_png_width), N(mystery_png_height), 0, 0, N(mystery_png_width) - 1, N(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(),
};
s32 N(modelCommandList)[] = {
0x00000004, 0x0000000D, 0x00000001, sizeof(N(displayList)) / sizeof(s32), &N(displayList), 0x00000002, 0x00000000,
};
s32 N(D_802A227C_72D82C)[8] = {
0x0000008A, 0x0000008C, 0x00000080, 0x00000088,
0x0000009A, 0x00000082, 0x00000085, 0x0000008A
};
s32 N(D_802A229C_72D84C)[8] = {
0x0000008A, 0x0000008C, 0x00000085, 0x00000088,
0x0000008A, 0x0000008C, 0x00000085, 0x0000008A
};
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_MYSTERY;
await N(UseItemWithEffect);
spawn {
sleep 220;
PlaySoundAtActor(ActorID_PLAYER, 1011);
}
PlaySoundAtActor(ActorID_PLAYER, 872);
N(func_802A13E4_72C994)();
sleep 2;
if (SI_VAR(0) != ItemId_PEBBLE) {
jump UseMystery;
return;
}
func_802D3474(SI_VAR(10), N(modelCommandList));
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 150;
func_802D36E0(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetOwnerTarget(0, 0);
SetGoalToTarget(ActorID_SELF);
GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
spawn {
SI_VAR(0) = 0;
loop 18 {
SI_VAR(0) += 0xFFFFFFC4;
func_802D3840(SI_VAR(10), 0, 0, SI_VAR(0));
sleep 1;
}
}
func_802D39FC(SI_VAR(10), 0.6005859375);
SI_VAR(2) += 5;
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 12);
spawn {
SI_VAR(0) += 60;
SI_VAR(1) += 0;
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 16);
func_802D3624(SI_VAR(10));
}
SetTargetActor(ActorID_SELF, 0);
SetGoalToTarget(ActorID_SELF);
GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
N(func_802A188C_72CE3C)(SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetBattleFlagBits(32, 1);
DispatchDamagePlayerEvent(1, Event_HIT);
});

View File

@ -0,0 +1,23 @@
#ifndef BATTLE_ITEM_MYSTERY
#define BATTLE_ITEM_MYSTERY
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_mystery
struct N(tempStc) {
s32 iconId;
s32 unk_04;
} N(tempStc);
s32 N(D_802A227C_72D82C)[8];
s32 N(D_802A229C_72D84C)[8];
ApiStatus N(func_802A13E4_72C994)(ScriptInstance *script, s32 isInitialCall);
ApiStatus N(func_802A188C_72CE3C)(ScriptInstance *script, s32 isInitialCall);
Script N(UseItemWithEffect);
#endif

View File

@ -1,11 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/mystery_72C5B0", func_802A1000_72C5B0);
INCLUDE_ASM(s32, "battle/item/mystery_72C5B0", func_802A11D4_72C784);
INCLUDE_ASM(s32, "battle/item/mystery_72C5B0", func_802A123C_72C7EC);
INCLUDE_ASM(s32, "battle/item/mystery_72C5B0", func_802A13E4_72C994);
INCLUDE_ASM(s32, "battle/item/mystery_72C5B0", func_802A188C_72CE3C);

View File

@ -0,0 +1,147 @@
#include "pebble.h"
extern s32 D_80108A64;
static MenuIcon* D_802A1E80;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A1E80 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A1E80, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A1E80);
}
return ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -0,0 +1,80 @@
#include "pebble.h"
#include "battle/item/pebble/pebble.png.h"
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, &N(pebble_pal_png)),
gsDPLoadTextureTile_4b(&N(pebble_png), G_IM_FMT_CI, N(pebble_png_width), N(pebble_png_height), 0, 0, N(pebble_png_width) - 1, N(pebble_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(),
};
s32 N(modelCommandList)[] = {
0x00000004, 0x0000000D, 0x00000001, sizeof(N(displayList)) / sizeof(s32), &N(displayList), 0x00000002, 0x00000000,
};
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_PEBBLE;
await N(UseItemWithEffect);
UseCamPreset(3);
MoveBattleCamOver(15);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_THROW);
PlaySound(1018);
sleep 3;
func_802D3474(SI_VAR(10), N(modelCommandList));
SI_VAR(0) = 1.0;
MultiplyByActorScale(SI_VAR(0));
func_802D38EC(SI_VAR(10), SI_VAR(0), SI_VAR(0), SI_VAR(0));
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(3) = 20;
SI_VAR(4) = 42;
SI_VAR(5) = 5;
MultiplyVec3ByActorScale(SI_VAR(3), SI_VAR(4), SI_VAR(5));
SI_VAR(0) += SI_VAR(3);
SI_VAR(1) += SI_VAR(4);
SI_VAR(2) += SI_VAR(5);
func_802D36E0(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
InitTargetIterator();
SetGoalToTarget(ActorID_SELF);
GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
spawn {
SI_VAR(0) = 0;
loop 18 {
SI_VAR(0) += 0xFFFFFFC4;
func_802D3840(SI_VAR(10), 0, 0, SI_VAR(0));
sleep 1;
}
}
func_802D39FC(SI_VAR(10), 0.80078125);
SI_VAR(2) += 5;
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 18);
GetItemPower(ItemId_PEBBLE, SI_VAR(3), SI_VAR(4));
ApplyShrinkFromOwner(SI_VAR(3));
ItemDamageEnemy(SI_VAR(9), 0x18000000, 0, SI_VAR(3), 32);
SI_VAR(0) += 60;
SI_VAR(1) += 0;
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 16);
func_802D3624(SI_VAR(10));
await N(PlayerGoHome);
});

View File

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

View File

@ -1,5 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/pebble_719970", func_802A1000_719970);
INCLUDE_ASM(s32, "battle/item/pebble_719970", func_802A11D4_719B44);

View File

@ -0,0 +1,146 @@
#include "please_come_back.h"
extern s32 D_80108A64;
static MenuIcon* D_802A18E0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A18E0 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A18E0, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A18E0);
}
return ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -0,0 +1,15 @@
#include "please_come_back.h"
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_DIZZY_DIAL;
await N(UseItemWithEffect);
SetGoalToHome(0);
SetJumpAnimations(ActorID_PLAYER, 0, PlayerAnim_MIDAIR_STILL, PlayerAnim_MIDAIR, PlayerAnim_9);
SetActorSpeed(ActorID_PLAYER, 4.0);
SetActorJumpGravity(ActorID_PLAYER, 1.80078125);
func_80273444(4, 0, 0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_8000B);
sleep 8;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
});

View File

@ -0,0 +1,14 @@
#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
ApiStatus func_80273444(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
#endif

View File

@ -1,5 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/please_come_back_7285E0", func_802A1000_7285E0);
INCLUDE_ASM(s32, "battle/item/please_come_back_7285E0", func_802A11D4_7287B4);

View File

@ -0,0 +1,189 @@
#include "pow_block.h"
extern s32 D_80108A64;
static MenuIcon* D_802A2120;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A2120 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A2120, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A2120);
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A123C_718A8C)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
CollisionStatus* collisionStatus = &gCollisionStatus;
PlayerStatus* playerStatus = &gPlayerStatus;
if (player->scalingFactor == 1.0) {
s32 var = script->varTable[10];
get_entity_by_index(var);
collisionStatus->currentCeiling = var | 0x4000;
playerStatus->flags |= 2;
update_entities();
collisionStatus->currentCeiling = -1;
playerStatus->flags &= ~2;
return ApiStatus_DONE2;
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A12E4_718B34)(ScriptInstance* script, s32 isInitialCall) {
Entity* entity = get_entity_by_index(script->varTable[10]);
entity->flags |= 0x20000000;
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1318_718B68)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
Entity* entity = get_entity_by_index(script->varTable[10]);
entity->scale.x = player->scalingFactor;
entity->scale.y = player->scalingFactor;
entity->scale.z = player->scalingFactor;
if (player->scalingFactor != 1.0) {
entity->position.y -= 10.0f;
}
return ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -0,0 +1,76 @@
#include "pow_block.h"
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_P_O_W_BLOCK;
await N(UseItemWithEffect);
sleep 10;
MakeEntity(0x802EA2E0, 0xFFFFFFD8, 60, 0, 0, 0x80000000);
SI_VAR(10) = SI_VAR(0);
N(func_802A1318_718B68)();
PlayEffect(7, 2, 0xFFFFFFD8, 60, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0);
PlayEffect(7, 2, 0xFFFFFFE2, 65, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0);
PlayEffect(7, 2, 0xFFFFFFD8, 60, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0);
PlayEffect(7, 2, 0xFFFFFFD8, 55, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
sleep 20;
UseCamPreset(2);
MoveBattleCamOver(20);
spawn {
sleep 15;
PlaySoundAtActor(ActorID_PLAYER, 334);
N(func_802A123C_718A8C)();
PlayEffect(7, 2, 0xFFFFFFD8, 60, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0);
PlayEffect(7, 2, 0xFFFFFFE2, 65, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0);
PlayEffect(7, 2, 0xFFFFFFD8, 60, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0);
PlayEffect(7, 2, 0xFFFFFFD8, 55, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0);
StartRumble(4);
ShakeCam(1, 0, 2, 1.0);
ShakeCam(1, 0, 2, 3.0);
ShakeCam(1, 0, 2, 6.0);
ShakeCam(1, 0, 2, 5.0);
ShakeCam(1, 0, 2, 4.0);
PlaySoundAtActor(ActorID_PLAYER, 8240);
ShakeCam(1, 0, 2, 3.0);
ShakeCam(1, 0, 2, 2.0);
ShakeCam(1, 0, 2, 1.0);
ShakeCam(1, 0, 2, 0.5);
ShakeCam(1, 0, 2, 0.2001953125);
}
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 30;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetAnimation(ActorID_PLAYER, 0, 0x10005);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
sleep 5;
SetJumpAnimations(ActorID_PLAYER, 0, PlayerAnim_MIDAIR_STILL, PlayerAnim_MIDAIR, PlayerAnim_9);
SetActorJumpGravity(ActorID_PLAYER, 0.6005859375);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_80273444(20, 0, 0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseCamPreset(3);
MoveBattleCamOver(20);
InitTargetIterator();
0:
SetGoalToTarget(ActorID_SELF);
ItemCheckHit(SI_VAR(0), 0x10000000, 0, SI_VAR(0), 0);
if (SI_VAR(0) == 6) {
goto 1;
}
GetItemPower(ItemId_P_O_W_BLOCK, SI_VAR(3), SI_VAR(4));
ApplyShrinkFromOwner(SI_VAR(3));
func_80269EAC(22);
ItemDamageEnemy(SI_VAR(0), 0x38000400, 0, SI_VAR(3), 32);
1:
ChooseNextTarget(0, SI_VAR(0));
if (SI_VAR(0) != -1) {
goto 0;
}
PlayEffect(7, 2, 0xFFFFFFBA, 60, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0);
PlayEffect(7, 2, 0xFFFFFFC4, 65, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0);
PlayEffect(7, 2, 0xFFFFFFBA, 60, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0);
PlayEffect(7, 2, 0xFFFFFFBA, 55, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0);
N(func_802A12E4_718B34)();
sleep 30;
await N(PlayerGoHome);
});

View File

@ -0,0 +1,20 @@
#ifndef BATTLE_ITEM_POW_BLOCK
#define BATTLE_ITEM_POW_BLOCK
#include "common.h"
#include "script_api/battle.h"
#undef NAMESPACE
#define NAMESPACE battle_item_pow_block
ApiStatus func_80273444(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_80269EAC(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A1318_718B68)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A123C_718A8C)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A12E4_718B34)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
#endif

View File

@ -1,11 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/pow_block_718850", func_802A1000_718850);
INCLUDE_ASM(s32, "battle/item/pow_block_718850", func_802A11D4_718A24);
INCLUDE_ASM(s32, "battle/item/pow_block_718850", func_802A123C_718A8C);
INCLUDE_ASM(s32, "battle/item/pow_block_718850", func_802A12E4_718B34);
INCLUDE_ASM(s32, "battle/item/pow_block_718850", func_802A1318_718B68);

View File

@ -0,0 +1,158 @@
#include "repel_gel.h"
extern s32 D_80108A64;
static MenuIcon* D_802A19C0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A19C0 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A19C0, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A19C0);
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A123C_72DDAC)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
ActorPart* part = player->partsTable;
inflict_status(player, Debuff_0xE, script->varTable[0]);
player->status = 0;
part->flags |= 0x100;
return ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -0,0 +1,21 @@
#include "repel_gel.h"
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_REPEL_GEL;
await N(UseItemWithEffect);
PlaySoundAtActor(ActorID_PLAYER, 885);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_30008);
sleep 45;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 20;
PlayEffect(51, 3, SI_VAR(0), SI_VAR(1), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
PlaySoundAtActor(ActorID_PLAYER, 886);
GetItemPower(ItemId_REPEL_GEL, SI_VAR(0), SI_VAR(1));
N(func_802A123C_72DDAC)();
sleep 20;
ShowMessageBox(17, 60);
WaitForMessageBoxDone();
await N(PlayerGoHome);
});

View File

@ -0,0 +1,15 @@
#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
ApiStatus N(func_802A123C_72DDAC)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
#endif

View File

@ -1,7 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/repel_gel_72DB70", func_802A1000_72DB70);
INCLUDE_ASM(s32, "battle/item/repel_gel_72DB70", func_802A11D4_72DD44);
INCLUDE_ASM(s32, "battle/item/repel_gel_72DB70", func_802A123C_72DDAC);

View File

@ -0,0 +1,237 @@
#include "shooting_star.h"
extern s32 D_80108A64;
static MenuIcon* D_802A1EE0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A1EE0 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A1EE0, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A1EE0);
}
return ApiStatus_DONE2;
}
#ifdef NON_MATCHING
void func_8006FE30(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7);
ApiStatus N(func_802A123C_71D9AC)(ScriptInstance* script, s32 isInitialCall) {
s32 c8 = 200;
s32 temp_s1 = 100 + rand_int(c8);
s32 temp_s0 = rand_int(40);
s32 phi_a0;
s32 phi_v0;
s32 rand;
f32 temp_f20;
f32 temp_f22;
f32 test;
if (script->varTable[0] & 3) {
rand = rand_int(100);
rand += c8;
temp_f22 = temp_s1 - rand;
rand = rand_int(100);
rand -= 50;
temp_f20 = temp_s0 - rand;
phi_v0 = rand_int(10);
phi_a0 = 2;
} else {
rand = rand_int(100);
rand += 200;
temp_f22 = temp_s1 - rand;
rand = rand_int(100);
rand -= 50;
temp_f20 = temp_s0 - rand;
phi_v0 = rand_int(10);
phi_a0 = 3;
}
do {
func_8006FE30(phi_a0, temp_s1, c8, temp_s0, temp_f22, 0, temp_f20, phi_v0 + 7);
if (temp_f20) {
temp_f20 -= rand;
}
} while (0);
return ApiStatus_DONE2;
}
#else
INCLUDE_ASM(ApiStatus, "battle/item/shooting_star_71D770", battle_item_shooting_star_func_802A123C_71D9AC,
ScriptInstance* script, s32 isInitialCall);
#endif
ApiStatus N(func_802A1388_71DAF8)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
func_80070190(2, a, b, c, 0, -1.0f, 0, 5);
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1444_71DBB4)(ScriptInstance* script, s32 isInitialCall) {
s32 ret;
if (isInitialCall) {
func_8011D82C(1);
*D_801512F0 = 1;
set_background_color_blend(0, 0, 0, 0);
script->functionTemp[0].s = 10;
}
set_background_color_blend(0, 0, 0, ((10 - script->functionTemp[0].s) * 16) & 240);
script->functionTemp[0].s--;
do {} while (0);
return (script->functionTemp[0].s == 0) * ApiStatus_DONE2;
}
ApiStatus N(func_802A14D4_71DC44)(ScriptInstance* script, s32 isInitialCall) {
if (isInitialCall) {
script->functionTemp[0].s = 10;
}
set_background_color_blend(0, 0, 0, (script->functionTemp[0].s * 16) & 240);
script->functionTemp[0].s--;
if (script->functionTemp[0].s == 0) {
set_background_color_blend(0, 0, 0, 0);
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -0,0 +1,72 @@
#include "shooting_star.h"
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_SHOOTING_STAR;
await N(UseItemWithEffect);
spawn {
sleep 5;
UseCamPreset(2);
MoveBattleCamOver(20);
}
N(func_802A1444_71DBB4)();
spawn {
SI_VAR(0) = 0;
loop 10 {
PlaySoundAtActor(ActorID_PLAYER, 601);
N(func_802A123C_71D9AC)();
SI_VAR(0) += 1;
sleep 5;
PlaySoundAtActor(ActorID_PLAYER, 602);
N(func_802A123C_71D9AC)();
SI_VAR(0) += 1;
sleep 5;
}
}
spawn {
SI_VAR(0) = 0;
sleep 50;
loop 10 {
PlaySoundAtActor(ActorID_PLAYER, 604);
SI_VAR(0) += 1;
sleep 5;
PlaySoundAtActor(ActorID_PLAYER, 605);
SI_VAR(0) += 1;
sleep 5;
}
}
spawn {
loop 5 {
sleep 15;
StartRumble(8);
ShakeCam(1, 0, 5, 1.0);
}
}
sleep 90;
UseCamPreset(3);
MoveBattleCamOver(20);
InitTargetIterator();
0:
SetGoalToTarget(ActorID_SELF);
ItemCheckHit(SI_VAR(0), 0x10000000, 0, SI_VAR(0), 0);
if (SI_VAR(0) == 6) {
goto 1;
}
GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
N(func_802A1388_71DAF8)(SI_VAR(0), SI_VAR(1), SI_VAR(2));
GetItemPower(ItemId_SHOOTING_STAR, SI_VAR(0), SI_VAR(1));
ItemDamageEnemy(SI_VAR(0), 0x38000100, 0, SI_VAR(0), 32);
1:
sleep 10;
ChooseNextTarget(0, SI_VAR(0));
if (SI_VAR(0) != -1) {
goto 0;
}
sleep 20;
UseCamPreset(2);
MoveBattleCamOver(20);
await N(PlayerGoHome);
spawn {
N(func_802A14D4_71DC44)();
}
sleep 30;
});

View File

@ -0,0 +1,18 @@
#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
ApiStatus N(func_802A1444_71DBB4)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A123C_71D9AC)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A1388_71DAF8)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A14D4_71DC44)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
#endif

View File

@ -1,13 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/shooting_star_71D770", func_802A1000_71D770);
INCLUDE_ASM(s32, "battle/item/shooting_star_71D770", func_802A11D4_71D944);
INCLUDE_ASM(s32, "battle/item/shooting_star_71D770", func_802A123C_71D9AC);
INCLUDE_ASM(s32, "battle/item/shooting_star_71D770", func_802A1388_71DAF8);
INCLUDE_ASM(s32, "battle/item/shooting_star_71D770", func_802A1444_71DBB4);
INCLUDE_ASM(s32, "battle/item/shooting_star_71D770", func_802A14D4_71DC44);

View File

@ -0,0 +1,365 @@
#include "sleepy_sheep.h"
extern s32 D_80108A64;
static MenuIcon* D_802A3F50;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A3F50 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A3F50, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A3F50);
}
return ApiStatus_DONE2;
}
#ifdef NON_MATCHING
extern Vec3f D_802A3F88;
extern s32* D_802A3F58;
s32 N(D_802A3E88_7214D8)[] = {
0x00000000, 0x00000000, 0x00000000,
0xFFFFFFE2, 0x00000000, 0xFFFFFFCE,
0xFFFFFFE5, 0x00000000, 0x0000001E,
0xFFFFFFBA, 0x00000000, 0xFFFFFFFB,
0xFFFFFF97, 0x00000000, 0x0000001E,
0xFFFFFF92, 0x00000000, 0xFFFFFFCE,
0xFFFFFF6F, 0x00000000, 0xFFFFFFFB,
0xFFFFFF56, 0x00000000, 0xFFFFFFCE,
0xFFFFFF42, 0x00000000, 0xFFFFFFE2,
0xFFFFFF2E, 0x00000000, 0xFFFFFFF6
};
f32 N(D_802A3F00_721550)[] = {
0x3F800000, 0x3F800000, 0x3F400000, 0x3F800000,
0x3F800000, 0x3F800000, 0x3F800000, 0x3F800000,
0x3F400000, 0x3F400000
};
s32 N(D_802A3F28_721578)[] = {
0x802A3260, 0x802A32A0, 0x802A32E0, 0x802A3260,
0x802A32A0, 0x802A32E0, 0x802A3260, 0x802A32A0,
0x802A32E0, 0x802A3260
};
void fx_walk_large(s32, f32, f32, f32, s32);
void func_802D4364(s32, s32, s32, s32);
void func_802D43AC(s32, f32, f32, f32);
void func_802D43F4(s32);
ApiStatus func_802A123C_71E88C(ScriptInstance* script, s32 isInitialCall) {
s32 i;
Vec3f vecf;
s32 flag;
Vec3f* D_802A3F88_ptr = &D_802A3F88;
s32* D_802A3E88_7214D8_ptr1; // = &N(D_802A3E88_7214D8);
s32* D_802A3E88_7214D8_ptr2; // = &N(D_802A3E88_7214D8);
s32* D_802A3E88_7214D8_ptr3; // = &N(D_802A3E88_7214D8);
s32* D_802A3F58_ptr;
if (isInitialCall) {
script->functionTemp[0].s = 0;
}
switch (script->functionTemp[0].s) {
case 0: {
s32* D_802A3F28_721578_ptr = &N(D_802A3F28_721578);
s32 loop1, loop2, loop3;
D_802A3F58_ptr = &D_802A3F58;
D_802A3F88_ptr->x = -200.0f;
D_802A3F88_ptr->z = 10.0f;
D_802A3E88_7214D8_ptr1 = N(D_802A3E88_7214D8) + 0;
D_802A3E88_7214D8_ptr2 = N(D_802A3E88_7214D8) + 1;
D_802A3E88_7214D8_ptr3 = N(D_802A3E88_7214D8) + 2;
for (i = 0; i < 10; i++) {
D_802A3F58_ptr[i] = func_802D420C(D_802A3F28_721578_ptr[i]);
func_802D4364(D_802A3F58_ptr[i],
*D_802A3E88_7214D8_ptr1 + D_802A3F88_ptr->x,
*D_802A3E88_7214D8_ptr2,
*D_802A3E88_7214D8_ptr3 + D_802A3F88_ptr->z);
func_802D43AC(D_802A3F58_ptr[i], N(D_802A3F00_721550)[i], N(D_802A3F00_721550)[i], 1.0f);
D_802A3E88_7214D8_ptr1 += i * 3 + 0;
D_802A3E88_7214D8_ptr2 += i * 3 + 1;
D_802A3E88_7214D8_ptr3 += i * 3 + 2;
}
script->functionTemp[0].s = 1;
script->functionTemp[1].s = gGameStatusPtr->frameCounter % 10;
}
break;
case 1:
D_802A3F88.x += 6.0f;
if (gGameStatusPtr->frameCounter % 3 == 0) {
script->functionTemp[1].s++;
script->functionTemp[1].s %= 10;
}
flag = 0;
D_802A3F58_ptr = &D_802A3F58;
D_802A3E88_7214D8_ptr1 = N(D_802A3E88_7214D8);
D_802A3E88_7214D8_ptr2 = N(D_802A3E88_7214D8);
D_802A3E88_7214D8_ptr3 = N(D_802A3E88_7214D8);
for (i = 0; i < 10; i++) {
f32 x, y, z;
D_802A3E88_7214D8_ptr1 += i * 3 + 0;
D_802A3E88_7214D8_ptr2 += i * 3 + 1;
D_802A3E88_7214D8_ptr3 += i * 3 + 2;
x = *D_802A3E88_7214D8_ptr1 + D_802A3F88.x;
y = *D_802A3E88_7214D8_ptr2;
z = *D_802A3E88_7214D8_ptr3 + D_802A3F88.z;
func_802D4364(D_802A3F58_ptr[i], x, y, z);
if (flag == 0 && script->functionTemp[1].s == i) {
f32 x2, y2;
if (gGameStatusPtr->frameCounter % 5 == 0) {
y2 = y;
if (x > 0.0f) {
x2 = x;
if (x > 100.0f) {
x2 = x - 50.0f;
}
y2 = rand_int(x2);
}
x2 = x;
if (x > 40.0f) {
x2 = -(x - 40.0f);
}
fx_walk_large(3, x2, y2, z, 0);
flag = 1;
}
}
D_802A3E88_7214D8_ptr1 += 0xC;
D_802A3E88_7214D8_ptr2 += 0xC;
D_802A3E88_7214D8_ptr3 += 0xC;
}
if (gGameStatusPtr->frameCounter & 1) {
s32 randIdx = rand_int(9);
fx_walk_large(2, N(D_802A3E88_7214D8)[randIdx * 3 + 0] + D_802A3F88_ptr->x,
N(D_802A3E88_7214D8)[randIdx * 3 + 1],
N(D_802A3E88_7214D8)[randIdx * 3 + 2] + D_802A3F88_ptr->z, 0);
}
if (D_802A3F88_ptr->x >= 320.0f) {
script->functionTemp[0].s = 2;
break;
}
return ApiStatus_DONE2;
case 2:
for (i = 0; i < 10; i++) {
func_802D43F4(*(&D_802A3F58 + i));
}
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
#else
INCLUDE_ASM(ApiStatus, "battle/item/sleepy_sheep_71E650", battle_item_sleepy_sheep_func_802A123C_71E88C,
ScriptInstance* script, s32 isInitialCall);
#endif
ApiStatus N(func_802A1740_71ED90)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 i;
if (isInitialCall) {
script->functionTemp[0].s = 0;
script->functionTemp[1].s = 0x5A;
}
for (i = 0; i < player->targetListLength; i++) {
s8 targetIdx = player->targetIndexList[i];
SelectableTarget* target = &player->targetData[targetIdx];
Actor* targetActor = get_actor(target->actorID);
ActorPart* targetPart = get_actor_part(targetActor, target->partID);
if ((targetActor->transStatus == 0) && !(targetPart->eventFlags & 0x20)) {
targetActor->yaw += 33.0f;
targetActor->yaw = clamp_angle(targetActor->yaw);
}
}
if (script->functionTemp[1].s != 0) {
script->functionTemp[1].s--;
return ApiStatus_BLOCK;
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1848_71EE98)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 i;
s32 ret;
if (isInitialCall) {
script->functionTemp[0].s = 0;
}
ret = 0;
for (i = 0; i < player->targetListLength; i++) {
s8 targetIdx = player->targetIndexList[i];
SelectableTarget* target = &player->targetData[targetIdx];
Actor* targetActor = get_actor(target->actorID);
if (targetActor != NULL) {
ActorPart* targetPart = get_actor_part(targetActor, target->partID);
if ((targetActor->transStatus == 0) && !(targetPart->eventFlags & 0x20)) {
if (targetActor->yaw < 360.0f) {
targetActor->yaw += 33.0f;
if (targetActor->yaw >= 360.0f) {
targetActor->yaw = 360.0f;
}
ret = 1;
}
}
}
}
return (ret == 0) * ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -0,0 +1,248 @@
#include "sleepy_sheep.h"
#include "battle/item/sleepy_sheep/sleepy_sheep1.png.h"
#include "battle/item/sleepy_sheep/sleepy_sheep2.png.h"
#include "battle/item/sleepy_sheep/sleepy_sheep3.png.h"
Vtx N(model)[] = {
{ .v = { -28, 0, 0, FALSE, 0, 1536, 0, 0, 0, 255 } },
{ .v = { 27, 0, 0, FALSE, 1792, 1536, 0, 0, 0, 255 } },
{ .v = { 27, 47, 0, FALSE, 1792, 0, 0, 0, 0, 255 } },
{ .v = { -28, 47, 0, FALSE, 0, 0, 0, 0, 0, 255 } },
};
Gfx N(frame1_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, &N(sleepy_sheep1_pal_png)),
gsDPLoadTextureTile_4b(&N(sleepy_sheep1_png), G_IM_FMT_CI, N(sleepy_sheep1_png_width), N(sleepy_sheep1_png_height), 0, 0, N(sleepy_sheep1_png_width) - 1, N(sleepy_sheep1_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(),
};
Gfx N(frame2_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, &N(sleepy_sheep2_pal_png)),
gsDPLoadTextureTile_4b(&N(sleepy_sheep2_png), G_IM_FMT_CI, N(sleepy_sheep2_png_width), N(sleepy_sheep2_png_height), 0, 0, N(sleepy_sheep2_png_width) - 1, N(sleepy_sheep2_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(),
};
Gfx N(frame3_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, &N(sleepy_sheep3_pal_png)),
gsDPLoadTextureTile_4b(&N(sleepy_sheep3_png), G_IM_FMT_CI, N(sleepy_sheep3_png_width), N(sleepy_sheep3_png_height), 0, 0, N(sleepy_sheep3_png_width) - 1, N(sleepy_sheep3_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(),
};
s32 N(modelCommandList)[] = {
0x00000004, 0x0000000D,
0x00000001, 0x00000002, &N(frame1_displayList),
0x00000001, 0x00000003, &N(frame2_displayList),
0x00000001, 0x00000002, &N(frame1_displayList),
0x00000001, 0x00000002, &N(frame3_displayList),
0x00000002, 0x00000000,
0x00000004, 0x0000000D,
0x00000001, 0x00000003, &N(frame2_displayList),
0x00000001, 0x00000002, &N(frame1_displayList),
0x00000001, 0x00000002, &N(frame3_displayList),
0x00000001, 0x00000002, &N(frame1_displayList),
0x00000002, 0x00000000,
0x00000004, 0x0000000D,
0x00000001, 0x00000002, &N(frame1_displayList),
0x00000001, 0x00000002, &N(frame3_displayList),
0x00000001, 0x00000002, &N(frame1_displayList),
0x00000001, 0x00000003, &N(frame2_displayList),
0x00000002, 0x00000000,
};
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_SLEEPY_SHEEP;
await N(UseItemWithEffect);
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFBD, 0xFFFFFFF1, 0xFFFFFFFB);
SetBattleCamOffsetZ(45);
SetBattleCamZoom(169);
MoveBattleCamOver(50);
spawn {
PlaySoundAtActor(ActorID_PLAYER, 868);
loop 7 {
StartRumble(2);
ShakeCam(1, 0, 2, 0.5);
ShakeCam(1, 0, 2, 1.5);
ShakeCam(1, 0, 2, 0.5);
ShakeCam(1, 0, 2, 0.2001953125);
ShakeCam(1, 0, 2, 0.5);
ShakeCam(1, 0, 2, 2.0);
ShakeCam(1, 0, 2, 1.5);
ShakeCam(1, 0, 2, 1.0);
ShakeCam(1, 0, 2, 0.5);
ShakeCam(1, 0, 2, 0.25);
sleep 2;
ShakeCam(1, 0, 2, 0.5);
ShakeCam(1, 0, 2, 1.5);
ShakeCam(1, 0, 2, 0.5);
ShakeCam(1, 0, 2, 0.2001953125);
}
}
sleep 20;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 32;
ShowEmote(0, 2, 0xFFFFFFD3, 20, 2, SI_VAR(0), SI_VAR(1), SI_VAR(2), 10);
sleep 30;
SetActorYaw(ActorID_PLAYER, 30);
sleep 1;
SetActorYaw(ActorID_PLAYER, 60);
sleep 1;
SetActorYaw(ActorID_PLAYER, 90);
sleep 1;
SetActorYaw(ActorID_PLAYER, 120);
sleep 1;
SetActorYaw(ActorID_PLAYER, 150);
sleep 1;
SetActorYaw(ActorID_PLAYER, 180);
spawn {
N(func_802A123C_71E88C)();
}
InitTargetIterator();
spawn {
sleep 40;
N(func_802A1740_71ED90)();
N(func_802A1848_71EE98)();
}
UseCamPreset(2);
MoveBattleCamOver(20);
sleep 8;
SetJumpAnimations(ActorID_PLAYER, 0, PlayerAnim_1002B, PlayerAnim_1002B, PlayerAnim_MIDAIR);
SetActorJumpGravity(ActorID_PLAYER, 1.80078125);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetGoalPos(0, SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_80273444(15, 0, 0);
spawn {
sleep 5;
SetActorYaw(ActorID_PLAYER, 150);
sleep 1;
SetActorYaw(ActorID_PLAYER, 120);
sleep 1;
SetActorYaw(ActorID_PLAYER, 90);
sleep 1;
SetActorYaw(ActorID_PLAYER, 60);
sleep 1;
SetActorYaw(ActorID_PLAYER, 30);
sleep 1;
SetActorYaw(ActorID_PLAYER, 0);
}
sleep 40;
func_802D3474(SI_VAR(10), N(modelCommandList));
SI_VAR(7) = 0xFFFFFF38;
SI_VAR(8) = 0;
SI_VAR(9) = 0;
func_802D36E0(SI_VAR(10), SI_VAR(7), SI_VAR(8), SI_VAR(9));
func_802D38EC(SI_VAR(10), 0.7109375, 0.7109375, 0.7109375);
func_802D3998(SI_VAR(10), 7.0);
func_802D39FC(SI_VAR(10), 1.400390625);
SetOwnerTarget(0, 0);
SetGoalToTarget(ActorID_PLAYER);
GetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) -= 60;
func_802D3A60(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 0);
GetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 0);
PlaySoundAtActor(ActorID_PLAYER, 334);
spawn {
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_SHOCK_STILL);
SetActorScale(ActorID_PLAYER, 1.2001953125, 0.900390625, 1.0);
sleep 1;
SetActorScale(ActorID_PLAYER, 1.30078125, 0.80078125, 1.0);
sleep 3;
SetActorScale(ActorID_PLAYER, 1.2001953125, 0.900390625, 1.0);
sleep 1;
SetActorScale(ActorID_PLAYER, 1.0, 1.0, 1.0);
}
PlayEffect(6, 3, SI_VAR(0), SI_VAR(1), SI_VAR(2), 0, 0, 0, 0, 0, 0, 0, 0, 0);
sleep 2;
func_802D39FC(SI_VAR(10), 1.400390625);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 60;
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 0);
PlayEffect(6, 2, SI_VAR(0), SI_VAR(1), SI_VAR(2), 0, 0, 0, 0, 0, 0, 0, 0, 0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
SI_VAR(0) += 20;
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 0);
PlayEffect(6, 2, SI_VAR(0), SI_VAR(1), SI_VAR(2), 0, 0, 0, 0, 0, 0, 0, 0, 0);
SI_VAR(0) += 10;
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 0);
PlayEffect(6, 2, SI_VAR(0), SI_VAR(1), SI_VAR(2), 0, 0, 0, 0, 0, 0, 0, 0, 0);
sleep 5;
spawn {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 270;
func_802D3A60(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 0);
func_802D3624(SI_VAR(10));
}
sleep 30;
UseCamPreset(3);
MoveBattleCamOver(20);
InitTargetIterator();
0:
SetGoalToTarget(ActorID_SELF);
ItemCheckHit(SI_VAR(0), 0x10000000, 0, SI_VAR(0), 0);
if (SI_VAR(0) == 6) {
goto 1;
}
GetItemPower(ItemId_SLEEPY_SHEEP, SI_VAR(0), SI_VAR(1));
MakeStatusField(SI_VAR(0), 4096, 100, SI_VAR(0));
func_80252B3C(SI_VAR(0), 0x50000000, SI_VAR(0), 0, 32);
1:
sleep 5;
ChooseNextTarget(0, SI_VAR(0));
if (SI_VAR(0) != -1) {
goto 0;
}
sleep 30;
await N(PlayerGoHome);
});

View File

@ -0,0 +1,24 @@
#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
ApiStatus func_80273444(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802D3998(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_802D3A60(ScriptInstance* script, s32 isInitialCall);
ApiStatus func_80252B3C(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A123C_71E88C)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A1740_71ED90)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A1848_71EE98)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
#endif

View File

@ -1,11 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/sleepy_sheep_71E650", func_802A1000_71E650);
INCLUDE_ASM(s32, "battle/item/sleepy_sheep_71E650", func_802A11D4_71E824);
INCLUDE_ASM(s32, "battle/item/sleepy_sheep_71E650", func_802A123C_71E88C);
INCLUDE_ASM(s32, "battle/item/sleepy_sheep_71E650", func_802A1740_71ED90);
INCLUDE_ASM(s32, "battle/item/sleepy_sheep_71E650", func_802A1848_71EE98);

View File

@ -0,0 +1,176 @@
#include "snowman_doll.h"
extern s32 D_80108A64;
static MenuIcon* D_802A1EB0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A1EB0 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A1EB0, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A1EB0);
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A123C_71C06C)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
func_8006FEF0(2, a, b, c, 30.0f);
func_8006FEF0(2, a, b, c, 30.0f);
return ApiStatus_DONE2;
}
#include "common/FadeBackgroundToBlack.inc.c"
ApiStatus N(func_802A13B8_71C1E8)(ScriptInstance* script, s32 isInitialCall) {
if (isInitialCall) {
script->functionTemp[0].s = 20;
}
set_background_color_blend(0, 0, 0, (script->functionTemp[0].s * 10) & 254);
script->functionTemp[0].s--;
if (script->functionTemp[0].s == 0) {
set_background_color_blend(0, 0, 0, 0);
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -0,0 +1,69 @@
#include "snowman_doll.h"
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_SNOWMAN_DOLL;
await N(UseItemWithEffect);
N(FadeBackgroundToBlack)();
PlaySoundAtActor(ActorID_PLAYER, 867);
spawn {
loop 45 {
RandInt(300, SI_VAR(0));
SI_VAR(0) -= 150;
SI_VAR(1) = 170;
RandInt(50, SI_VAR(2));
SI_VAR(2) -= 25;
PlayEffect(14, SI_VAR(0), SI_VAR(1), SI_VAR(2), 60, 0, 0, 0, 0, 0, 0, 0, 0, 0);
sleep 2;
}
}
sleep 10;
UseCamPreset(3);
MoveBattleCamOver(50);
sleep 50;
PlayEffect(96, 0, 0, 0, 20, 1.0, 160, 0, 0, 0, 0, 0, 0, 0);
spawn {
sleep 17;
PlaySoundAtActor(ActorID_PLAYER, 8238);
StartRumble(9);
ShakeCam(1, 0, 5, 1.0);
sleep 46;
PlaySoundAtActor(ActorID_PLAYER, 8238);
StartRumble(9);
ShakeCam(1, 0, 5, 1.0);
sleep 25;
PlaySoundAtActor(ActorID_PLAYER, 8238);
StartRumble(9);
ShakeCam(1, 0, 5, 1.0);
sleep 25;
PlaySoundAtActor(ActorID_PLAYER, 8238);
StartRumble(9);
ShakeCam(1, 0, 5, 1.0);
}
sleep 15;
StartRumble(10);
ShakeCam(1, 0, 5, 1.0);
ShakeCam(1, 0, 10, 2.0);
ShakeCam(1, 0, 5, 1.0);
sleep 110;
InitTargetIterator();
0:
SetGoalToTarget(ActorID_SELF);
ItemCheckHit(SI_VAR(0), 0x10000000, 0, SI_VAR(0), 0);
if (SI_VAR(0) == 6) {
goto 1;
}
GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
N(func_802A123C_71C06C)(SI_VAR(0), SI_VAR(1), SI_VAR(2));
GetItemPower(ItemId_SNOWMAN_DOLL, SI_VAR(0), SI_VAR(1));
ItemDamageEnemy(SI_VAR(0), 0x38000008, 0, SI_VAR(0), 32);
sleep 5;
1:
ChooseNextTarget(0, SI_VAR(0));
if (SI_VAR(0) != -1) {
goto 0;
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
sleep 30;
N(func_802A13B8_71C1E8)();
await N(PlayerGoHome);
});

View File

@ -0,0 +1,19 @@
#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
ApiStatus N(FadeBackgroundToBlack)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A123C_71C06C)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A13B8_71C1E8)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
#endif

View File

@ -1,12 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/snowman_doll_71BE30", func_802A1000_71BE30);
INCLUDE_ASM(s32, "battle/item/snowman_doll_71BE30", func_802A11D4_71C004);
INCLUDE_ASM(s32, "battle/item/snowman_doll_71BE30", func_802A123C_71C06C);
#define NAMESPACE battle_item_snowman_doll
#include "common/FadeBackgroundToBlack.inc.c"
INCLUDE_ASM(s32, "battle/item/snowman_doll_71BE30", func_802A13B8_71C1E8);

View File

@ -0,0 +1,188 @@
#include "stone_cap.h"
extern s32 D_80108A64;
static MenuIcon* D_802A1A60;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A1A60 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A1A60, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A1A60);
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A123C_7217DC)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 i;
if (isInitialCall) {
script->functionTemp[0].s = 0;
}
switch (script->functionTemp[0].s) {
case 0:
inflict_status(player, Debuff_STONE, script->varTable[0]);
player->status = 0;
script->functionTemp[1].s = 3;
script->functionTemp[0].s = 1;
break;
case 1:
for (i = 0; i < 10; i++) {
f32 x = player->currentPos.x + ((rand_int(20) - 10) * player->scalingFactor);
f32 y = player->currentPos.y + ((rand_int(20) + 10) * player->scalingFactor);
f32 z = player->currentPos.z + 5.0f;
func_80071FF0(0, x, y, z, 1.0f, 25);
}
if (script->functionTemp[1].s == 0) {
BattleStatus* battleStatus2 = &gBattleStatus;
battleStatus2->flags1 &= ~0x04000000;
battleStatus->hustleTurns = 0;
battleStatus->itemUsesLeft = 0;
return ApiStatus_DONE2;
}
script->functionTemp[1].s--;
break;
}
return ApiStatus_BLOCK;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -0,0 +1,15 @@
#include "stone_cap.h"
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_STONE_CAP;
await N(UseItemWithEffect);
PlaySound(865);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_30009);
sleep 30;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_CROUCH);
GetItemPower(ItemId_STONE_CAP, SI_VAR(0), SI_VAR(1));
PlaySound(866);
N(func_802A123C_7217DC)();
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
sleep 20;
});

View File

@ -0,0 +1,17 @@
#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
ApiStatus N(func_802A123C_7217DC)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
#endif

View File

@ -1,7 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/stone_cap_7215A0", func_802A1000_7215A0);
INCLUDE_ASM(s32, "battle/item/stone_cap_7215A0", func_802A11D4_721774);
INCLUDE_ASM(s32, "battle/item/stone_cap_7215A0", func_802A123C_7217DC);

View File

@ -0,0 +1,164 @@
#include "stop_watch.h"
extern s32 D_80108A64;
static MenuIcon* D_802A1B40;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A1B40 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A1B40, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A1B40);
}
return ApiStatus_DONE2;
}
#include "common/FadeBackgroundToBlack.inc.c"
ApiStatus N(func_802A12D4_7270A4)(ScriptInstance* script, s32 isInitialCall) {
if (isInitialCall) {
script->functionTemp[0].s = 20;
}
set_background_color_blend(0, 0, 0, (script->functionTemp[0].s * 10) & 254);
script->functionTemp[0].s--;
if (script->functionTemp[0].s == 0) {
set_background_color_blend(0, 0, 0, 0);
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -0,0 +1,35 @@
#include "stop_watch.h"
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_STOP_WATCH;
await N(UseItemWithEffect);
spawn {
sleep 5;
UseCamPreset(2);
MoveBattleCamOver(20);
}
N(FadeBackgroundToBlack)();
PlayEffect(98, 0, 0, 0, 0, 1.0, 200, 0, 0, 0, 0, 0, 0, 0);
PlaySoundAtActor(ActorID_PLAYER, 582);
sleep 200;
UseCamPreset(3);
MoveBattleCamOver(20);
InitTargetIterator();
0:
SetGoalToTarget(ActorID_SELF);
ItemCheckHit(SI_VAR(0), 0x10000000, 0, SI_VAR(0), 0);
if (SI_VAR(0) == 6) {
goto 1;
}
GetItemPower(ItemId_STOP_WATCH, SI_VAR(0), SI_VAR(1));
MakeStatusField(SI_VAR(0), 0x200000, 100, SI_VAR(0));
func_80252B3C(SI_VAR(0), 0x50000000, SI_VAR(0), 0, 32);
1:
sleep 5;
ChooseNextTarget(0, SI_VAR(0));
if (SI_VAR(0) != -1) {
goto 0;
}
N(func_802A12D4_7270A4)();
await N(PlayerGoHome);
});

View File

@ -0,0 +1,20 @@
#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
ApiStatus func_80252B3C(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(FadeBackgroundToBlack)(ScriptInstance* script, s32 isInitialCall);
ApiStatus N(func_802A12D4_7270A4)(ScriptInstance* script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
#endif

View File

@ -1,10 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "battle/item/stop_watch_726DD0", func_802A1000_726DD0);
INCLUDE_ASM(s32, "battle/item/stop_watch_726DD0", func_802A11D4_726FA4);
#define NAMESPACE battle_item_stop_watch
#include "common/FadeBackgroundToBlack.inc.c"
INCLUDE_ASM(s32, "battle/item/stop_watch_726DD0", func_802A12D4_7270A4);

View File

@ -0,0 +1,431 @@
#include "strange_cake.h"
extern s32 D_80108A64;
static MenuIcon* D_802A2DD0;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A2DD0 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A2DD0, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A2DD0);
}
return ApiStatus_DONE2;
}
#ifdef NON_MATCHING
extern s32 D_802A25E4;
extern MenuIcon* D_802A2DF4;
extern s32 D_802A2DD8;
ApiStatus N(func_802A123C_73153C)(ScriptInstance* script, s32 isInitialCall) {
s32 i;
MenuIcon** ptr;
s32 var;
s32* var2;
if (D_802A25E4 < 6) {
if (D_802A25E4 > 0) {
draw_box(0, 7, 0x6A, 0x56, 0, 0x24, 0x24, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x140, 0xF0, 0);
gDPSetScissor(gMasterGfxPos++, G_SC_NON_INTERLACE, 108, 90, 139, 118);
ptr = &D_802A2DF4;
for (i = 0; i < 7; i++) {
var2 = *ptr;
var = (D_802A2DD8 / 100) - 0x68;
ptr++;
set_icon_render_pos(var2, 0x7C, (i * 0x1A) - var);
draw_icon_2(var2);
}
var2 = D_802A2DF4;
var = (D_802A2DD8 / 100) - 0x68;
set_icon_render_pos(var2, 0x7C, (i * 0x1A) - var);
draw_icon_2(var2);
}
}
}
#else
INCLUDE_ASM(ApiStatus, "battle/item/strange_cake_731300", battle_item_strange_cake_func_802A123C_73153C);
#endif
#ifdef NON_MATCHING
extern s32 D_802A2DEC;
extern s32 D_802A2DF0;
extern s32 D_802A2DF4;
extern s32 D_802A2DF8;
extern s32 D_802A2DFC;
extern s32 D_802A2E00;
extern s32* D_802A2DD8;
extern MenuIcon** D_802A25C8;
s32 N(D_802A2848_732B48)[] = {
0x802A27F8, 0x802A2820, 0x802A27D0, 0x802A27F8
};
s32 N(D_802A2858_732B58)[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x00000001
};
ApiStatus N(func_802A13E4_7316E4)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
if (isInitialCall) {
D_802A2DEC = 0;
}
switch (D_802A2DEC) {
case 0: {
s32 i;
MenuIcon** iconPtr;
D_802A2E00 = bind_dynamic_entity_7(NULL, func_802A123C_73153C);
i = rand_int(13000);
D_802A2DF4 = i;
D_802A2DF8 = 1000;
for (i = 0; i < 5; i++) {
s32* B48Ptr = &N(D_802A2848_732B48);
s32* B58Ptr = &N(D_802A2858_732B58);
MenuIcon* icon = create_icon(*(B48Ptr + * (B58Ptr + i)));
*(&D_802A2DD8 + i) = icon;
set_icon_flags(icon, 0x80);
}
D_802A2DEC = 1;
}
break;
case 1: {
s32* ECptr = &D_802A2DF4;
s32* F0ptr = &D_802A2DF8;
*ECptr += *F0ptr;
if (*ECptr / 100 >= 130) {
s32* test = ECptr;
*test -= 0x32C8;
}
if (*F0ptr > 400) {
*F0ptr -= 10;
} else if (*F0ptr > 100) {
*F0ptr -= 5;
} else {
*F0ptr -= 1;
}
if (D_802A2DF8 < 10) {
D_802A2DF0 = D_802A2DF4 / 100;
if (D_802A2DF0 % 26 < 13) {
if (rand_int(100) < 80) {
D_802A2DEC = 2;
} else {
D_802A2DEC = 3;
}
} else if (rand_int(100) < 60) {
D_802A2DEC = 3;
} else {
D_802A2DEC = 2;
}
}
}
break;
case 2: {
s32* E8ptr = &D_802A2DF0;
s32 a, b, c, d;
d = *E8ptr % 26;
a = d;
c = a + 3;
if (c < 0) {
c = a + 6;
}
d = c >> 2;
*E8ptr -= d;
D_802A2DF4 = *E8ptr * 100;
if (d == 0) {
D_802A2DEC = 4;
}
}
break;
case 3: {
s32* E8ptr = &D_802A2DF0;
s32 a, b, c, d;
d = *E8ptr % 26;
if (d == 0) {
D_802A2DEC = 4;
break;
}
a = d;
b = 26;
b -= a;
c = b + 3;
if (c < 0) {
c = b + 6;
}
c = c >> 2;
*E8ptr += c;
D_802A2DF4 = *E8ptr * 100;
}
break;
case 4: {
D_802A2DFC = 20;
D_802A2DEC = 5;
}
break;
case 5: {
s32* F4ptr = &D_802A2DFC;
s32 i;
s16 g;
MenuIcon** iconPtr;
if (*F4ptr != 0) {
*F4ptr -= 1;
break;
}
iconPtr = &D_802A25C8;
i = D_802A2DF0 / 26;
g = N(D_802A2858_732B58)[i];
battleStatus->selectedItemID = g;
script->varTable[0] = g;
func_801235C0(D_802A2E00);
for (i = 0; i < 5; i++) {
free_icon(*iconPtr++);
}
}
return ApiStatus_DONE2;
}
return ApiStatus_BLOCK;
}
#else
INCLUDE_ASM(ApiStatus, "battle/item/strange_cake_731300", battle_item_strange_cake_func_802A13E4_7316E4,
ScriptInstance* script, s32 isInitialCall);
#endif
ApiStatus N(func_802A1818_731B18)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
s32 d = get_variable(script, *args++);
func_80071090(0, a, b, c, d);
return ApiStatus_DONE2;
}
ApiStatus N(func_802A18D8_731BD8)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
s32 d = get_variable(script, *args++);
func_80071090(1, a, b, c, d);
return ApiStatus_DONE2;
}
#include "common/AddHP.inc.c"
#include "common/AddFP.inc.c"
ApiStatus N(func_802A1A40_731D40)(ScriptInstance* script, s32 isInitialCall) {
StaticItem* item = &gItemTable[ItemId_KOOKY_COOKIE];
PlayerData* playerData = &gPlayerData;
playerData->curHP += item->potencyA;
if (playerData->curHP > playerData->curMaxHP) {
playerData->curHP = playerData->curMaxHP;
}
script->varTable[3] = item->potencyA;
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1A8C_731D8C)(ScriptInstance* script, s32 isInitialCall) {
StaticItem* item = &gItemTable[ItemId_KOOKY_COOKIE];
PlayerData* playerData = &gPlayerData;
playerData->curFP += item->potencyB;
if (playerData->curFP > playerData->curMaxFP) {
playerData->curFP = playerData->curMaxFP;
}
script->varTable[3] = item->potencyB;
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1AD8_731DD8)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
inflict_status(player, Debuff_STATIC, 3);
player->status = 0;
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1B14_731E14)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
ActorPart* part = player->partsTable;
inflict_status(player, Debuff_0xE, 3);
player->status = 0;
part->flags |= 0x100;
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1B68_731E68)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
inflict_status(player, Debuff_SLEEP, 3);
player->status = 0;
return ApiStatus_DONE2;
}
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -0,0 +1,110 @@
#include "strange_cake.h"
#include "battle/item/strange_cake/strange_cake1.png.h"
#include "battle/item/strange_cake/strange_cake2.png.h"
#include "battle/item/strange_cake/strange_cake3.png.h"
s32 N(data)[] = {
0x00000008, 0x00000005, 0x00000003, 0x00000004,
0x00000002, 0x0000003C, 0x802A2170, 0x802A2370,
0x00000003, 0x00000000, 0x00000008, 0x00000005,
0x00000003, 0x00000004, 0x00000002, 0x0000003C,
0x802A2390, 0x802A2590, 0x00000003, 0x00000000,
0x00000008, 0x00000005, 0x00000003, 0x00000004,
0x00000002, 0x0000003C, 0x802A25B0, 0x802A27B0,
0x00000003, 0x00000000
};
s32 N(D_802A2848_732B48)[] = {
0x802A27F8, 0x802A2820, 0x802A27D0, 0x802A27F8
};
s32 N(D_802A2858_732B58)[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x00000001, 0x000000000
};
Script N(script6) = SCRIPT({
GetMenuSelection(SI_VAR(0), SI_VAR(1), SI_VAR(2));
if (SI_VAR(1) == 211) {
SI_VAR(10) = c ItemId_KOOKY_COOKIE;
SI_VAR(1) = 0;
await N(UseItemWithEffect);
await N(EatItem);
N(func_802A1A8C_731D8C)();
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 20;
SI_VAR(1) += 25;
N(func_802A18D8_731BD8)(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(3));
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 25;
func_802D7520(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(3));
N(AddFP)(SI_VAR(3));
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_THUMBS_UP);
sleep 30;
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_802D75D8(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(3));
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
sleep 20;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
} else {
SI_VAR(10) = c ItemId_STRANGE_CAKE;
SI_VAR(1) = 0;
await N(UseItemWithEffect);
await N(EatItem);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
}
sleep 10;
spawn {
sleep 220;
PlaySoundAtActor(ActorID_PLAYER, 1011);
}
PlaySoundAtActor(ActorID_PLAYER, 872);
N(func_802A13E4_7316E4)();
sleep 2;
match SI_VAR(0) {
== 0 {
await N(script7);
}
== 1 {
await N(script8);
}
== 2 {
await N(script9);
}
}
await N(PlayerGoHome);
});
Script N(script7) = SCRIPT({
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 20;
PlayEffect(87, 0, SI_VAR(0), SI_VAR(1), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
N(func_802A1AD8_731DD8)();
sleep 20;
ShowMessageBox(16, 60);
WaitForMessageBoxDone();
});
Script N(script8) = SCRIPT({
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 20;
PlayEffect(51, 6, SI_VAR(0), SI_VAR(1), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
N(func_802A1B14_731E14)();
sleep 20;
ShowMessageBox(17, 60);
WaitForMessageBoxDone();
});
Script N(script9) = SCRIPT({
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_30004);
SetGoalToTarget(ActorID_PLAYER);
GetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
spawn DoSleepHit;
N(func_802A1B68_731E68)();
sleep 20;
ShowMessageBox(11, 60);
WaitForMessageBoxDone();
});

View File

@ -0,0 +1,30 @@
#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
ApiStatus func_802D75D8(ScriptInstance *script, s32 isInitialCall);
ApiStatus func_802D7520(ScriptInstance *script, s32 isInitialCall);
ApiStatus N(func_802A1A8C_731D8C)(ScriptInstance *script, s32 isInitialCall);
ApiStatus N(func_802A18D8_731BD8)(ScriptInstance *script, s32 isInitialCall);
ApiStatus N(AddFP)(ScriptInstance *script, s32 isInitialCall);
ApiStatus N(func_802A13E4_7316E4)(ScriptInstance *script, s32 isInitialCall);
ApiStatus N(func_802A1AD8_731DD8)(ScriptInstance *script, s32 isInitialCall);
ApiStatus N(func_802A1B14_731E14)(ScriptInstance *script, s32 isInitialCall);
ApiStatus N(func_802A1B68_731E68)(ScriptInstance *script, s32 isInitialCall);
Script N(UseItemWithEffect);
Script N(PlayerGoHome);
Script N(EatItem);
Script N(script7);
Script N(script8);
Script N(script9);
#endif

View File

@ -1,29 +0,0 @@
#include "common.h"
#define NAMESPACE battle_item_strange_cake
INCLUDE_ASM(s32, "battle/item/strange_cake_731300", func_802A1000_731300);
INCLUDE_ASM(s32, "battle/item/strange_cake_731300", func_802A11D4_7314D4);
INCLUDE_ASM(s32, "battle/item/strange_cake_731300", func_802A123C_73153C);
INCLUDE_ASM(s32, "battle/item/strange_cake_731300", func_802A13E4_7316E4);
INCLUDE_ASM(s32, "battle/item/strange_cake_731300", func_802A1818_731B18);
INCLUDE_ASM(s32, "battle/item/strange_cake_731300", func_802A18D8_731BD8);
#include "common/AddHP.inc.c"
#include "common/AddFP.inc.c"
INCLUDE_ASM(s32, "battle/item/strange_cake_731300", func_802A1A40_731D40);
INCLUDE_ASM(s32, "battle/item/strange_cake_731300", func_802A1A8C_731D8C);
INCLUDE_ASM(s32, "battle/item/strange_cake_731300", func_802A1AD8_731DD8);
INCLUDE_ASM(s32, "battle/item/strange_cake_731300", func_802A1B14_731E14);
INCLUDE_ASM(s32, "battle/item/strange_cake_731300", func_802A1B68_731E68);

View File

@ -0,0 +1,224 @@
#include "super_soda.h"
extern s32 D_80108A64;
static MenuIcon* D_802A2280;
ApiStatus N(GiveRefund)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
f32 facingAngleSign = 0.0f;
s32 sleepTime = 0;
f32 posX, posY, posZ;
posY = player->currentPos.y + player->size.y;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
s32 i;
s32 iconPosX, iconPosY, iconPosZ;
sellValue = (sellValue * 75 + 99) / 100;
for (i = 0; i < sellValue; i++) {
posX = player->currentPos.x;
posZ = player->currentPos.z;
make_item_entity(ItemId_COIN, posX, posY, posZ, 0x17, (i * 3) + 1, facingAngleSign, 0);
add_coins(1);
facingAngleSign += 30.0f;
}
sleepTime = (i * 3) + 30;
posX = player->currentPos.x;
posY = player->currentPos.y;
posZ = player->currentPos.z;
get_screen_coords(gCurrentCameraID, posX, posY, posZ, &iconPosX, &iconPosY, &iconPosZ);
D_802A2280 = create_icon(&D_80108A64);
set_icon_render_pos(D_802A2280, iconPosX + 36, iconPosY - 63);
}
script->varTable[0] = sleepTime;
return ApiStatus_DONE2;
}
ApiStatus N(GiveRefundCleanup)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* player = battleStatus->playerActor;
s32 sellValue = gItemTable[battleStatus->selectedItemID].sellValue;
if (heroes_is_ability_active(player, Ability_REFUND) && sellValue > 0) {
free_icon(D_802A2280);
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A123C_724F1C)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
ItemEntity* item = get_item_entity(script->varTable[14]);
item->position.x = a;
item->position.y = b;
item->position.z = c;
return ApiStatus_DONE2;
}
ApiStatus N(func_802A12EC_724FCC)(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* partner = battleStatus->partnerActor;
Bytecode* args = script->ptrReadPos;
if (partner->koDuration == 0) {
return ApiStatus_DONE2;
}
partner->koDuration -= get_variable(script, *args++);
if (partner->koDuration < 0) {
partner->koDuration = 0;
}
if (partner->koDuration > 0) {
partner->ptrDefuffIcon->ptrPropertyList[0xF] = partner->koDuration;
} else {
partner->koStatus = 0;
dispatch_event_partner(0x34);
partner->ptrDefuffIcon->ptrPropertyList[0xF] = 0;
}
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1378_725058)(ScriptInstance* script, s32 isInitialCall) {
s32 arg = get_variable(script, *script->ptrReadPos);
Actor* actor = get_actor(arg);
s32 id = actor->actorID & 0x700;
if (actor->debuff != Debuff_END) {
actor->debuffDuration = 0;
actor->debuff = 0;
func_80047898(actor->unk_436);
}
if (actor->koStatus != 0) {
actor->koDuration = 0;
actor->koStatus = 0;
if (id != 0) {
if (id == 0x100) {
dispatch_event_partner(0x31);
}
}
actor->ptrDefuffIcon->ptrPropertyList[15] = 0;
}
func_8026777C();
return ApiStatus_DONE2;
}
ApiStatus N(func_802A1418_7250F8)(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 a = get_variable(script, *args++);
s32 b = get_variable(script, *args++);
s32 c = get_variable(script, *args++);
s32 d = get_variable(script, *args++);
func_80071090(1, a, b, c, d);
return ApiStatus_DONE2;
}
#include "common/AddFP.inc.c"
Script N(UseItemWithEffect) = SCRIPT({
if (SI_VAR(1) == 0) {
UseCamPreset(69);
sleep 10;
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 18;
SetActorSpeed(ActorID_PLAYER, 4.0);
SetGoalPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlayerRunToGoal(0);
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(10));
} else {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
PlaySoundAtActor(ActorID_PLAYER, 8333);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
sleep 4;
SI_VAR(1) += 45;
SI_VAR(3) = SI_VAR(1);
SI_VAR(3) += 10;
SI_VAR(3) += 2;
PlayEffect(51, 1, SI_VAR(0), SI_VAR(3), SI_VAR(2), 1.0, 30, 0, 0, 0, 0, 0, 0, 0);
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(10) = SI_VAR(0);
sleep 15;
RemoveItemEntity(SI_VAR(10));
}
});
Script N(UseItem) = SCRIPT({
UseCamPreset(19);
SetBattleCamTarget(0xFFFFFFAB, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(30);
sleep 10;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_GOT_ITEM);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
N(GiveRefund)();
sleep SI_VAR(0);
sleep 15;
N(GiveRefundCleanup)();
RemoveItemEntity(SI_VAR(14));
});
Script N(PlayerGoHome) = SCRIPT({
UseIdleAnimation(ActorID_PLAYER, 0);
SetGoalToHome(ActorID_PLAYER);
SetActorSpeed(ActorID_PLAYER, 8.0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_RUNNING);
PlayerRunToGoal(0);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
UseIdleAnimation(ActorID_PLAYER, 1);
});
Script N(EatItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_EAT);
sleep 45;
});
Script N(DrinkItem) = SCRIPT({
spawn {
loop 4 {
PlaySoundAtActor(ActorID_PLAYER, 8341);
sleep 10;
}
}
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
});

View File

@ -0,0 +1,114 @@
#include "super_soda.h"
Script N(script6) = SCRIPT({
SetActorYaw(ActorID_PLAYER, 30);
sleep 1;
SetActorYaw(ActorID_PLAYER, 60);
sleep 1;
SetActorYaw(ActorID_PLAYER, 90);
sleep 1;
SetActorYaw(ActorID_PLAYER, 120);
sleep 1;
SetActorYaw(ActorID_PLAYER, 150);
sleep 1;
SetActorYaw(ActorID_PLAYER, 180);
sleep 10;
SI_VAR(1) = SI_VAR(15);
await 0x802A1834;
SI_VAR(14) = SI_VAR(10);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_THROW);
spawn {
sleep 20;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
}
func_802D3474(SI_VAR(10), 0x80283EE8);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 0;
SI_VAR(1) += 30;
SI_VAR(2) += 5;
func_802D36E0(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_802D3F74(SI_VAR(10), 32);
spawn {
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 45;
MakeItemEntity(SI_VAR(14), SI_VAR(0), SI_VAR(1), SI_VAR(2), 1, 0);
SI_VAR(14) = SI_VAR(0);
loop 25 {
func_802D378C(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2));
N(func_802A123C_724F1C)(SI_VAR(0), SI_VAR(1), SI_VAR(2));
sleep 1;
}
RemoveItemEntity(SI_VAR(14));
}
InitTargetIterator();
SetGoalToTarget(ActorID_SELF);
GetGoalPos(ActorID_SELF, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SetBattleCamTarget(0xFFFFFF83, 1, 0);
SetBattleCamOffsetZ(41);
SetBattleCamZoom(248);
MoveBattleCamOver(25);
func_802D39FC(SI_VAR(10), 0.400390625);
SI_VAR(2) += 5;
func_802D3C58(SI_VAR(10), SI_VAR(0), SI_VAR(1), SI_VAR(2), 25);
AddBattleCamZoom(100);
MoveBattleCamOver(30);
GetActorPos(ActorID_PARTNER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 25;
func_802D7520(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(11));
if (SI_VAR(11) > 0) {
N(func_802A12EC_724FCC)(SI_VAR(11));
}
sleep 30;
GetActorPos(ActorID_PARTNER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_802D75D8(SI_VAR(0), SI_VAR(1), SI_VAR(2), SI_VAR(11));
sleep 20;
SetActorYaw(ActorID_PLAYER, 150);
sleep 1;
SetActorYaw(ActorID_PLAYER, 120);
sleep 1;
SetActorYaw(ActorID_PLAYER, 90);
sleep 1;
SetActorYaw(ActorID_PLAYER, 60);
sleep 1;
SetActorYaw(ActorID_PLAYER, 30);
sleep 1;
SetActorYaw(ActorID_PLAYER, 0);
sleep 10;
});
Script N(main) = SCRIPT({
SI_VAR(10) = c ItemId_SUPER_SODA;
await N(UseItemWithEffect);
InitTargetIterator();
GetOwnerTarget(SI_VAR(0), SI_VAR(1));
if (SI_VAR(0) == 0) {
PlaySoundAtActor(ActorID_PLAYER, 8341);
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_DRINK);
sleep 45;
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(0) += 0;
SI_VAR(1) += 35;
N(func_802A1418_7250F8)(SI_VAR(0), SI_VAR(1), SI_VAR(2), 5);
N(AddFP)(5);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 25;
func_802D7520(SI_VAR(0), SI_VAR(1), SI_VAR(2), 5);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
SI_VAR(1) += 20;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_THUMBS_UP);
sleep 30;
SetAnimation(ActorID_PLAYER, 0, PlayerAnim_2);
GetActorPos(ActorID_PLAYER, SI_VAR(0), SI_VAR(1), SI_VAR(2));
func_802D75D8(SI_VAR(0), SI_VAR(1), SI_VAR(2), 5);
InitTargetIterator();
GetOwnerTarget(SI_VAR(0), SI_VAR(1));
N(func_802A1378_725058)(0);
sleep 20;
} else {
SI_VAR(11) = 0;
SI_VAR(12) = 0;
SI_VAR(15) = 0;
await 0x802A1AEC;
}
await N(PlayerGoHome);
});

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