mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 19:24:16 +01:00
cut field effect is decompiled and documented
This commit is contained in:
parent
7ea5dd7923
commit
3bcd30969a
@ -8656,7 +8656,7 @@ task_mpl_807E3C8: @ 80AF6B0
|
||||
bl ScriptContext2_Disable
|
||||
adds r0, r4, 0
|
||||
bl DestroyTask
|
||||
bl sub_80984F4
|
||||
bl ScriptUnfreezeEventObjects
|
||||
_080AF6CC:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
|
208
asm/fldeff_cut.s
208
asm/fldeff_cut.s
@ -1,208 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
|
||||
thumb_func_start CutGrassSpriteCallbackEnd
|
||||
CutGrassSpriteCallbackEnd: @ 80D41D0
|
||||
push {r4-r6,lr}
|
||||
movs r4, 0x1
|
||||
_080D41D4:
|
||||
ldr r6, =gCutGrassSpriteArrayPtr
|
||||
ldr r0, [r6]
|
||||
adds r0, r4
|
||||
ldrb r1, [r0]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
ldr r5, =gSprites
|
||||
adds r0, r5
|
||||
bl DestroySprite
|
||||
adds r0, r4, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
cmp r4, 0x7
|
||||
bls _080D41D4
|
||||
ldr r0, [r6]
|
||||
ldrb r1, [r0]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r5
|
||||
movs r1, 0x3A
|
||||
bl FieldEffectStop
|
||||
ldr r0, [r6]
|
||||
bl Free
|
||||
movs r0, 0
|
||||
str r0, [r6]
|
||||
bl sub_80984F4
|
||||
bl ScriptContext2_Disable
|
||||
bl unown_chamber_related
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bne _080D422A
|
||||
ldr r0, =FarawayIsland_Interior_EventScript_267EDB
|
||||
bl ScriptContext1_SetupScript
|
||||
_080D422A:
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end CutGrassSpriteCallbackEnd
|
||||
|
||||
thumb_func_start sub_80D423C
|
||||
sub_80D423C: @ 80D423C
|
||||
push {r4,r5,lr}
|
||||
lsls r0, 16
|
||||
asrs r5, r0, 16
|
||||
lsls r1, 16
|
||||
asrs r4, r1, 16
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl MapGridGetMetatileBehaviorAt
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
bl MetatileBehavior_IsLongGrass_Duplicate
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080D42AE
|
||||
adds r4, 0x1
|
||||
lsls r1, r4, 16
|
||||
asrs r1, 16
|
||||
adds r0, r5, 0
|
||||
bl GetTallGrassCaseAt
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x2
|
||||
beq _080D428A
|
||||
cmp r0, 0x2
|
||||
bgt _080D427A
|
||||
cmp r0, 0x1
|
||||
beq _080D4284
|
||||
b _080D42AE
|
||||
_080D427A:
|
||||
cmp r0, 0x3
|
||||
beq _080D4294
|
||||
cmp r0, 0x4
|
||||
beq _080D42A4
|
||||
b _080D42AE
|
||||
_080D4284:
|
||||
movs r2, 0x82
|
||||
lsls r2, 2
|
||||
b _080D4296
|
||||
_080D428A:
|
||||
ldr r2, =0x00000281
|
||||
b _080D4296
|
||||
.pool
|
||||
_080D4294:
|
||||
ldr r2, =0x00000282
|
||||
_080D4296:
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl MapGridSetMetatileIdAt
|
||||
b _080D42AE
|
||||
.pool
|
||||
_080D42A4:
|
||||
ldr r2, =0x00000283
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl MapGridSetMetatileIdAt
|
||||
_080D42AE:
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80D423C
|
||||
|
||||
thumb_func_start sub_80D42B8
|
||||
sub_80D42B8: @ 80D42B8
|
||||
push {r4,r5,lr}
|
||||
lsls r0, 16
|
||||
asrs r4, r0, 16
|
||||
lsls r1, 16
|
||||
asrs r5, r1, 16
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl MapGridGetMetatileIdAt
|
||||
cmp r0, 0x1
|
||||
bne _080D434A
|
||||
adds r5, 0x1
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl MapGridGetMetatileBehaviorAt
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
bl MetatileBehavior_IsLongGrassSouthEdge
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080D434A
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl MapGridGetMetatileIdAt
|
||||
adds r1, r0, 0
|
||||
ldr r0, =0x00000281
|
||||
cmp r1, r0
|
||||
beq _080D4328
|
||||
cmp r1, r0
|
||||
bgt _080D4308
|
||||
subs r0, 0x79
|
||||
cmp r1, r0
|
||||
beq _080D431C
|
||||
b _080D434A
|
||||
.pool
|
||||
_080D4308:
|
||||
ldr r0, =0x00000282
|
||||
cmp r1, r0
|
||||
beq _080D4330
|
||||
adds r0, 0x1
|
||||
cmp r1, r0
|
||||
beq _080D4340
|
||||
b _080D434A
|
||||
.pool
|
||||
_080D431C:
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
movs r2, 0x1
|
||||
bl MapGridSetMetatileIdAt
|
||||
b _080D434A
|
||||
_080D4328:
|
||||
ldr r2, =0x00000279
|
||||
b _080D4332
|
||||
.pool
|
||||
_080D4330:
|
||||
ldr r2, =0x0000027a
|
||||
_080D4332:
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl MapGridSetMetatileIdAt
|
||||
b _080D434A
|
||||
.pool
|
||||
_080D4340:
|
||||
ldr r2, =0x0000027b
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl MapGridSetMetatileIdAt
|
||||
_080D434A:
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80D42B8
|
||||
|
||||
thumb_func_start StartCutTreeFieldEffect
|
||||
StartCutTreeFieldEffect: @ 80D4354
|
||||
push {lr}
|
||||
movs r0, 0x80
|
||||
bl PlaySE
|
||||
movs r0, 0x2
|
||||
bl FieldEffectActiveListRemove
|
||||
bl EnableBothScriptContexts
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end StartCutTreeFieldEffect
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
@ -26527,8 +26527,8 @@ _081D4A0E:
|
||||
bx r1
|
||||
thumb_func_end EventObjectIsFarawayIslandMew
|
||||
|
||||
thumb_func_start unown_chamber_related
|
||||
unown_chamber_related: @ 81D4A14
|
||||
thumb_func_start IsMewPlayingHideAndSeek
|
||||
IsMewPlayingHideAndSeek: @ 81D4A14
|
||||
push {lr}
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
@ -26557,7 +26557,7 @@ _081D4A50:
|
||||
_081D4A52:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end unown_chamber_related
|
||||
thumb_func_end IsMewPlayingHideAndSeek
|
||||
|
||||
thumb_func_start sub_81D4A58
|
||||
sub_81D4A58: @ 81D4A58
|
||||
|
@ -1,5 +1,5 @@
|
||||
gUnknown_03005DA8
|
||||
gFieldCallback
|
||||
gUnknown_03005DB0
|
||||
gFieldCallback2
|
||||
gUnknown_03005DB4
|
||||
gFieldLinkPlayerCount
|
||||
|
@ -78,11 +78,11 @@ gFieldEffectScript_ExclamationMarkIcon1:: @ 82DBAE0
|
||||
field_eff_end
|
||||
|
||||
gFieldEffectScript_UseCutOnTallGrass:: @ 82DBAE6
|
||||
field_eff_callnative sub_80D3A6C
|
||||
field_eff_callnative FldEff_UseCutOnGrass
|
||||
field_eff_end
|
||||
|
||||
gFieldEffectScript_UseCutOnTree:: @ 82DBAEC
|
||||
field_eff_callnative sub_80D3ABC
|
||||
field_eff_callnative FldEff_UseCutOnTree
|
||||
field_eff_end
|
||||
|
||||
gFieldEffectScript_Shadow:: @ 82DBAF2
|
||||
@ -308,7 +308,7 @@ gFieldEffectScript_Unknown57:: @ 82DBCB8
|
||||
field_eff_end
|
||||
|
||||
gFieldEffectScript_Unknown58:: @ 82DBCC2
|
||||
field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo6, sub_80D3B00
|
||||
field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo6, FldEff_CutGrass
|
||||
field_eff_end
|
||||
|
||||
gFieldEffectScript_FieldMoveShowMonInit:: @ 82DBCCC
|
||||
|
@ -1,32 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.section .rodata
|
||||
.align 2, 0
|
||||
|
||||
gUnknown_0857C608:: @ 857C608
|
||||
.byte 0xfe, 0xfe, 0x01, 0x00, 0xff, 0xfe, 0x01, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x01, 0xfe, 0x03, 0x00, 0x02, 0xfe, 0x03, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x02, 0xff, 0x03, 0x00, 0xfe, 0x00, 0x04, 0x00, 0x02, 0x00
|
||||
.byte 0x06, 0x00, 0xfe, 0x01, 0x07, 0x00, 0x02, 0x01, 0x09, 0x00, 0xfe, 0x02, 0x07, 0x00, 0xff, 0x02, 0x07, 0x00, 0x00, 0x02, 0x08, 0x00, 0x01, 0x02, 0x09, 0x00, 0x02, 0x02, 0x09, 0x00
|
||||
|
||||
gUnknown_0857C648:: @ 857C648
|
||||
.2byte 0
|
||||
.2byte 0
|
||||
.2byte 0x1401
|
||||
.2byte 0
|
||||
|
||||
gUnknown_0857C650:: @ 857C650
|
||||
obj_image_anim_frame 0, 0x1E
|
||||
obj_image_anim_jump 0
|
||||
|
||||
gUnknown_0857C658:: @ 857C658
|
||||
.4byte gUnknown_0857C650
|
||||
|
||||
gUnknown_0857C65C:: @ 857C65C
|
||||
obj_frame_tiles gFieldEffectObjectPic_ShadowExtraLarge + 0x520, 32
|
||||
|
||||
.align 2
|
||||
gFieldEffectObjectPaletteInfo6:: @ 857C664
|
||||
obj_pal gFieldEffectObjectPalette6, 0x1000
|
||||
|
||||
gUnknown_0857C66C:: @ 857C66C
|
||||
spr_template -1, 0x1000, gUnknown_0857C648, gUnknown_0857C658, gUnknown_0857C65C, gDummySpriteAffineAnimTable, objc_8097BA8
|
@ -431,7 +431,7 @@ gUnknown_08615D7E:: @ 8615D7E
|
||||
|
||||
.align 2
|
||||
gUnknown_08615D9C:: @ 8615D9C
|
||||
.4byte sub_80D3718, 0x00000007
|
||||
.4byte SetUpFieldMove_Cut, 0x00000007
|
||||
.4byte SetUpFieldMove_Flash, 0x0000000d
|
||||
.4byte SetUpFieldMove_RockSmash, 0x0000000d
|
||||
.4byte SetUpFieldMove_Strength, 0x0000000d
|
||||
|
BIN
graphics/event_objects/pics/effects/cut_grass.png
Normal file
BIN
graphics/event_objects/pics/effects/cut_grass.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 160 B |
Binary file not shown.
Before Width: | Height: | Size: 130 B |
@ -78,8 +78,8 @@ enum FieldEffectScriptIdx
|
||||
};
|
||||
|
||||
extern s32 gFieldEffectArguments[8];
|
||||
extern void (*gUnknown_0203CEEC)(void);
|
||||
extern bool8 (*gUnknown_03005DB0)(void);
|
||||
extern void (*gPostMenuFieldCallback)(void);
|
||||
extern bool8 (*gFieldCallback2)(void);
|
||||
|
||||
u32 FieldEffectStart(u8);
|
||||
bool8 FieldEffectActiveListContains(u8 id);
|
||||
|
@ -1,7 +1,13 @@
|
||||
#ifndef GUARD_FLDEFF_CUT_H
|
||||
#define GUARD_FLDEFF_CUT_H
|
||||
|
||||
void sub_80D423C(s16, s16);
|
||||
void sub_80D42B8(s16, s16);
|
||||
extern const struct SpritePalette gFieldEffectObjectPaletteInfo6;
|
||||
|
||||
bool8 SetUpFieldMove_Cut(void);
|
||||
bool8 FldEff_UseCutOnGrass(void);
|
||||
bool8 FldEff_UseCutOnTree(void);
|
||||
bool8 FldEff_CutGrass(void);
|
||||
void sub_80D423C(s16 x, s16 y);
|
||||
void sub_80D42B8(s16 x, s16 y);
|
||||
|
||||
#endif // GUARD_FLDEFF_CUT_H
|
||||
|
@ -859,7 +859,7 @@ struct MapPosition
|
||||
{
|
||||
s16 x;
|
||||
s16 y;
|
||||
u8 height;
|
||||
s8 height;
|
||||
};
|
||||
|
||||
struct UnkStruct_8054FF8
|
||||
|
@ -74,7 +74,7 @@ bool8 MetatileBehavior_IsPuddle(u8);
|
||||
bool8 MetatileBehavior_IsTallGrass(u8);
|
||||
bool8 MetatileBehavior_IsLongGrass(u8);
|
||||
bool8 MetatileBehavior_IsBerryTreeSoil(u8);
|
||||
bool8 MetatileBehavior_IsAsh(u8);
|
||||
bool8 MetatileBehavior_IsAshGrass(u8);
|
||||
bool8 MetatileBehavior_IsUnusedFootprintMetatile(u8);
|
||||
bool8 MetatileBehavior_IsBridge(u8);
|
||||
u8 MetatileBehavior_GetBridgeSth(u8);
|
||||
|
@ -28,7 +28,7 @@ void DoWallyTutorialBagMenu(void);
|
||||
u8 pokemon_ailments_get_primary(u32 status);
|
||||
u8 *GetMonNickname(struct Pokemon *mon, u8 *dst);
|
||||
u8 GetCursorSelectionMonId(void);
|
||||
bool8 FieldCallback_Teleport(void);
|
||||
bool8 FieldCallback_PrepareFadeInFromMenu(void);
|
||||
void sub_81B7F60(void);
|
||||
|
||||
void sub_81B0FCC(u8 partyIdx, u8 a);
|
||||
|
@ -12,7 +12,7 @@ void UpdateFrontierManiac(u16 days);
|
||||
void UpdateFrontierGambler(u16 days);
|
||||
void SetShoalItemFlag(u16 days);
|
||||
|
||||
bool8 npc_before_player_of_type(u8);
|
||||
bool8 SetLastTalkedObjectInFrontOfPlayer(u8);
|
||||
u8 oei_task_add(void);
|
||||
|
||||
#endif //GUARD_ROM6_H
|
||||
|
@ -128,7 +128,7 @@ SECTIONS {
|
||||
asm/pokemon_storage_system.o(.text);
|
||||
src/pokemon_icon.o(.text);
|
||||
src/script_movement.o(.text);
|
||||
asm/fldeff_cut.o(.text);
|
||||
src/fldeff_cut.o(.text);
|
||||
src/mail_data.o(.text);
|
||||
src/map_name_popup.o(.text);
|
||||
src/item_menu_icons.o(.text);
|
||||
@ -424,7 +424,7 @@ SECTIONS {
|
||||
src/pokemon_storage_system.o(.rodata);
|
||||
data/pokemon_storage_system.o(.rodata);
|
||||
src/pokemon_icon.o(.rodata);
|
||||
data/fldeff_cut.o(.rodata);
|
||||
src/fldeff_cut.o(.rodata);
|
||||
src/map_name_popup.o(.rodata);
|
||||
src/item_menu_icons.o(.rodata);
|
||||
data/contest.o(.rodata);
|
||||
|
@ -87,7 +87,7 @@ void LockSelectedEventObject(void)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80984F4(void)
|
||||
void ScriptUnfreezeEventObjects(void)
|
||||
{
|
||||
u8 objectId = GetEventObjectIdByLocalIdAndMap(0xFF, 0, 0);
|
||||
EventObjectClearHeldMovementIfFinished(&gEventObjects[objectId]);
|
||||
|
443
src/fldeff_cut.c
443
src/fldeff_cut.c
@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "fldeff_cut.h"
|
||||
#include "field_camera.h"
|
||||
#include "field_effect.h"
|
||||
#include "event_object_movement.h"
|
||||
@ -18,6 +19,19 @@
|
||||
#include "constants/songs.h"
|
||||
#include "constants/abilities.h"
|
||||
|
||||
extern bool8 SetLastTalkedObjectInFrontOfPlayer(u8);
|
||||
extern u8 oei_task_add(void);
|
||||
extern void ScriptUnfreezeEventObjects(void);
|
||||
extern bool8 IsMewPlayingHideAndSeek(void);
|
||||
|
||||
extern struct MapPosition gPlayerFacingPosition;
|
||||
|
||||
extern const u8 Route103_EventScript_290705[];
|
||||
extern const u8 FarawayIsland_Interior_EventScript_267EDB[];
|
||||
|
||||
extern const u8 gFieldEffectPic_CutGrass[];
|
||||
extern const u16 gFieldEffectObjectPalette6[];
|
||||
|
||||
// tileset 0 as first
|
||||
#define METATILE_ID_GRASS 0x1
|
||||
#define METATILE_ID_POKE_GRASS 0xD
|
||||
@ -31,7 +45,7 @@
|
||||
#define METATILE_ID_GRASS_TREE_LEFT 0x1CE
|
||||
#define METATILE_ID_GRASS_TREE_RIGHT 0x1CF
|
||||
|
||||
#define METATILE_ID_POKE_TALL_GRASS 0x15
|
||||
#define METATILE_ID_POKE_LONG_GRASS 0x15
|
||||
|
||||
// tileset 6 as second
|
||||
#define METATILE_ID_POKE_STEP_LAVA_GRASS 0x206
|
||||
@ -44,53 +58,24 @@
|
||||
#define METATILE_ID_ASH 0x218
|
||||
|
||||
// tileset 8 as second
|
||||
#define METATILE_ID_POKE_TALL_GRASS_START 0x208
|
||||
#define METATILE_ID_POKE_LONG_GRASS_START 0x208
|
||||
|
||||
#define METATILE_ID_SECRET_BASE_LEFT_TALL_GRASS 0x279
|
||||
#define METATILE_ID_SECRET_BASE_CENTER_TALL_GRASS 0x27A
|
||||
#define METATILE_ID_SECRET_BASE_RIGHT_TALL_GRASS 0x27B
|
||||
#define METATILE_ID_SECRET_BASE_LEFT_LONG_GRASS 0x279
|
||||
#define METATILE_ID_SECRET_BASE_CENTER_LONG_GRASS 0x27A
|
||||
#define METATILE_ID_SECRET_BASE_RIGHT_LONG_GRASS 0x27B
|
||||
|
||||
#define METATILE_ID_SECRET_BASE_LEFT_POKE_TALL_GRASS 0x281
|
||||
#define METATILE_ID_SECRET_BASE_CENTER_POKE_TALL_GRASS 0x282
|
||||
#define METATILE_ID_SECRET_BASE_RIGHT_POKE_TALL_GRASS 0x283
|
||||
|
||||
extern bool8 SetLastTalkedObjectInFrontOfPlayer(u8);
|
||||
extern u8 oei_task_add(void);
|
||||
|
||||
extern struct MapPosition gPlayerFacingPosition;
|
||||
extern u8 *gCutGrassSpriteArrayPtr;
|
||||
|
||||
extern const u8 Route103_EventScript_290705[];
|
||||
extern const u8 gFieldEffectPic_CutGrass[];
|
||||
extern const u16 gFieldEffectObjectPalette6[];
|
||||
#define METATILE_ID_SECRET_BASE_LEFT_POKE_LONG_GRASS 0x281
|
||||
#define METATILE_ID_SECRET_BASE_CENTER_POKE_LONG_GRASS 0x282
|
||||
#define METATILE_ID_SECRET_BASE_RIGHT_POKE_LONG_GRASS 0x283
|
||||
|
||||
// cut 'square' defines
|
||||
#define CUT_NORMAL_SIDE 3
|
||||
#define CUT_NORMAL_AREA CUT_NORMAL_SIDE * CUT_NORMAL_SIDE
|
||||
/* P - player
|
||||
X - cut area
|
||||
|
||||
XXX
|
||||
XPX
|
||||
XXX
|
||||
*/
|
||||
|
||||
#define CUT_HYPER_SIDE 5
|
||||
#define CUT_HYPER_AREA CUT_HYPER_SIDE * CUT_HYPER_SIDE
|
||||
/* P - player
|
||||
X - cut area
|
||||
|
||||
XXXXX
|
||||
XXXXX
|
||||
XXPXX
|
||||
XXXXX
|
||||
XXXXX
|
||||
*/
|
||||
|
||||
IWRAM_DATA u8 gUnknown_03001100;
|
||||
IWRAM_DATA u8 gUnknown_03001101;
|
||||
IWRAM_DATA u8 gUnknown_03001102;
|
||||
IWRAM_DATA u32 fldeff_cut_unused_03001104;
|
||||
IWRAM_DATA bool8 gUnknown_03001108[CUT_HYPER_AREA];
|
||||
#define CUT_SPRITE_ARRAY_COUNT 8
|
||||
|
||||
struct HyperCutterUnk
|
||||
{
|
||||
@ -99,7 +84,30 @@ struct HyperCutterUnk
|
||||
u8 unk2[2];
|
||||
};
|
||||
|
||||
const struct HyperCutterUnk gUnknown_0857C608[] =
|
||||
// this file's functions
|
||||
static void FieldCallback_CutTree(void);
|
||||
static void FieldCallback_CutGrass(void);
|
||||
static void StartCutTreeFieldEffect(void);
|
||||
static void StartCutGrassFieldEffect(void);
|
||||
static void SetCutGrassMetatile(s16, s16);
|
||||
static void SetCutGrassMetatiles(s16, s16);
|
||||
static void CutGrassSpriteCallback1(struct Sprite *);
|
||||
static void CutGrassSpriteCallback2(struct Sprite *);
|
||||
static void CutGrassSpriteCallbackEnd(struct Sprite *);
|
||||
static void HandleLongGrassOnHyper(u8, s16, s16);
|
||||
|
||||
// IWRAM variables
|
||||
static IWRAM_DATA u8 sCutSquareSide;
|
||||
static IWRAM_DATA u8 sTileCountFromPlayer_X;
|
||||
static IWRAM_DATA u8 sTileCountFromPlayer_Y;
|
||||
static IWRAM_DATA u32 sUnused;
|
||||
static IWRAM_DATA bool8 sHyperCutTiles[CUT_HYPER_AREA];
|
||||
|
||||
// EWRAM variables
|
||||
static EWRAM_DATA u8 *sCutGrassSpriteArrayPtr = NULL;
|
||||
|
||||
// const rom data
|
||||
static const struct HyperCutterUnk sHyperCutStruct[] =
|
||||
{
|
||||
{-2, -2, {1}},
|
||||
{-1, -2, {1}},
|
||||
@ -119,7 +127,7 @@ const struct HyperCutterUnk gUnknown_0857C608[] =
|
||||
{2, 2, {9}},
|
||||
};
|
||||
|
||||
const struct OamData gOamData_CutGrass =
|
||||
static const struct OamData sOamData_CutGrass =
|
||||
{
|
||||
.y = 0,
|
||||
.affineMode = 0,
|
||||
@ -136,53 +144,43 @@ const struct OamData gOamData_CutGrass =
|
||||
.affineParam = 0,
|
||||
};
|
||||
|
||||
const union AnimCmd gSpriteAnim_CutGrass[] =
|
||||
static const union AnimCmd sSpriteAnim_CutGrass[] =
|
||||
{
|
||||
ANIMCMD_FRAME(0, 30),
|
||||
ANIMCMD_JUMP(0),
|
||||
};
|
||||
|
||||
const union AnimCmd *const gSpriteAnimTable_CutGrass[] =
|
||||
static const union AnimCmd *const sSpriteAnimTable_CutGrass[] =
|
||||
{
|
||||
gSpriteAnim_CutGrass,
|
||||
sSpriteAnim_CutGrass,
|
||||
};
|
||||
|
||||
const struct SpriteFrameImage gSpriteImageTable_CutGrass[] =
|
||||
static const struct SpriteFrameImage sSpriteImageTable_CutGrass[] =
|
||||
{
|
||||
{gFieldEffectPic_CutGrass, 0x20},
|
||||
};
|
||||
|
||||
const struct SpritePalette gFieldEffectObjectPaletteInfo6 = {gFieldEffectObjectPalette6, 0x1000};
|
||||
|
||||
void FieldCallback_CutTree(void);
|
||||
void FieldCallback_CutGrass(void);
|
||||
void StartCutTreeFieldEffect(void);
|
||||
void StartCutGrassFieldEffect(void);
|
||||
void SetCutGrassMetatile(s16, s16);
|
||||
void SetCutGrassMetatiles(s16, s16);
|
||||
void CutGrassSpriteCallback1(struct Sprite *);
|
||||
void CutGrassSpriteCallback2(struct Sprite *);
|
||||
void CutGrassSpriteCallbackEnd(struct Sprite *);
|
||||
void HandleTallGrassOnHyper(u8, s16, s16);
|
||||
|
||||
const struct SpriteTemplate gSpriteTemplate_CutGrass =
|
||||
static const struct SpriteTemplate sSpriteTemplate_CutGrass =
|
||||
{
|
||||
.tileTag = 0xFFFF,
|
||||
.paletteTag = 0x1000,
|
||||
.oam = &gOamData_CutGrass,
|
||||
.anims = gSpriteAnimTable_CutGrass,
|
||||
.images = gSpriteImageTable_CutGrass,
|
||||
.oam = &sOamData_CutGrass,
|
||||
.anims = sSpriteAnimTable_CutGrass,
|
||||
.images = sSpriteImageTable_CutGrass,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = CutGrassSpriteCallback1,
|
||||
};
|
||||
|
||||
// code
|
||||
bool8 SetUpFieldMove_Cut(void)
|
||||
{
|
||||
s16 x, y;
|
||||
u8 i, j;
|
||||
u8 tileBehavior;
|
||||
u8 userAbility;
|
||||
bool8 array[CUT_NORMAL_AREA];
|
||||
bool8 cutTiles[CUT_NORMAL_AREA];
|
||||
bool8 ret;
|
||||
|
||||
if (SetLastTalkedObjectInFrontOfPlayer(EVENT_OBJ_GFX_CUTTABLE_TREE) == TRUE)
|
||||
@ -198,28 +196,28 @@ bool8 SetUpFieldMove_Cut(void)
|
||||
userAbility = GetMonAbility(&gPlayerParty[GetCursorSelectionMonId()]);
|
||||
if (userAbility == ABILITY_HYPER_CUTTER)
|
||||
{
|
||||
gUnknown_03001100 = 5;
|
||||
gUnknown_03001101 = 2;
|
||||
gUnknown_03001102 = 2;
|
||||
sCutSquareSide = CUT_HYPER_SIDE;
|
||||
sTileCountFromPlayer_X = 2;
|
||||
sTileCountFromPlayer_Y = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_03001100 = 3;
|
||||
gUnknown_03001101 = 1;
|
||||
gUnknown_03001102 = 1;
|
||||
sCutSquareSide = CUT_NORMAL_SIDE;
|
||||
sTileCountFromPlayer_X = 1;
|
||||
sTileCountFromPlayer_Y = 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < CUT_NORMAL_AREA; i++)
|
||||
array[i] = FALSE;
|
||||
cutTiles[i] = FALSE;
|
||||
for (i = 0; i < CUT_HYPER_AREA; i++)
|
||||
gUnknown_03001108[i] = FALSE;
|
||||
sHyperCutTiles[i] = FALSE;
|
||||
|
||||
ret = FALSE;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < CUT_NORMAL_SIDE; i++)
|
||||
{
|
||||
y = i - 1 + gPlayerFacingPosition.y;
|
||||
for (j = 0; j < 3; j++)
|
||||
for (j = 0; j < CUT_NORMAL_SIDE; j++)
|
||||
{
|
||||
x = j - 1 + gPlayerFacingPosition.x;
|
||||
if (MapGridGetZCoordAt(x, y) == gPlayerFacingPosition.height)
|
||||
@ -229,23 +227,23 @@ bool8 SetUpFieldMove_Cut(void)
|
||||
|| MetatileBehavior_IsAshGrass(tileBehavior) == TRUE)
|
||||
{
|
||||
// Standing in front of grass.
|
||||
gUnknown_03001108[6 + (i * 5) + j] = TRUE;
|
||||
sHyperCutTiles[6 + (i * 5) + j] = TRUE;
|
||||
ret = TRUE;
|
||||
}
|
||||
if (MapGridIsImpassableAt(x, y) == TRUE)
|
||||
{
|
||||
array[i * 3 + j] = FALSE;
|
||||
cutTiles[i * 3 + j] = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
array[i * 3 + j] = TRUE;
|
||||
cutTiles[i * 3 + j] = TRUE;
|
||||
if (MetatileBehavior_IsCuttableGrass(tileBehavior) == TRUE)
|
||||
gUnknown_03001108[6 + (i * 5) + j] = TRUE;
|
||||
sHyperCutTiles[6 + (i * 5) + j] = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
array[i * 3 + j] = FALSE;
|
||||
cutTiles[i * 3 + j] = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -260,45 +258,45 @@ bool8 SetUpFieldMove_Cut(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
bool8 r7;
|
||||
bool8 tileCuttable;
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
x = gPlayerFacingPosition.x + gUnknown_0857C608[i].x;
|
||||
y = gPlayerFacingPosition.y + gUnknown_0857C608[i].y;
|
||||
r7 = TRUE;
|
||||
x = gPlayerFacingPosition.x + sHyperCutStruct[i].x;
|
||||
y = gPlayerFacingPosition.y + sHyperCutStruct[i].y;
|
||||
tileCuttable = TRUE;
|
||||
|
||||
j = 0;
|
||||
while (1)
|
||||
{
|
||||
if (gUnknown_0857C608[i].unk2[j] == 0)
|
||||
if (sHyperCutStruct[i].unk2[j] == 0)
|
||||
break;
|
||||
if (array[(u8)(gUnknown_0857C608[i].unk2[j] - 1)] == FALSE)
|
||||
if (cutTiles[(u8)(sHyperCutStruct[i].unk2[j] - 1)] == FALSE)
|
||||
{
|
||||
r7 = FALSE;
|
||||
tileCuttable = FALSE;
|
||||
break;
|
||||
}
|
||||
if (++j >= 2)
|
||||
break;
|
||||
}
|
||||
|
||||
if (r7 == TRUE)
|
||||
if (tileCuttable == TRUE)
|
||||
{
|
||||
if (MapGridGetZCoordAt(x, y) == gPlayerFacingPosition.height)
|
||||
{
|
||||
u8 r6 = ((gUnknown_0857C608[i].y * 5) + 12) + (gUnknown_0857C608[i].x);
|
||||
u8 tileArrayId = ((sHyperCutStruct[i].y * 5) + 12) + (sHyperCutStruct[i].x);
|
||||
tileBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||
if (MetatileBehavior_IsPokeGrass(tileBehavior) == TRUE
|
||||
|| MetatileBehavior_IsAshGrass(tileBehavior) == TRUE)
|
||||
{
|
||||
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
|
||||
gPostMenuFieldCallback = FieldCallback_CutGrass;
|
||||
gUnknown_03001108[r6] = r7;
|
||||
sHyperCutTiles[tileArrayId] = TRUE;
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MetatileBehavior_IsCuttableGrass(tileBehavior) == TRUE)
|
||||
gUnknown_03001108[r6] = TRUE;
|
||||
sHyperCutTiles[tileArrayId] = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -315,7 +313,7 @@ bool8 SetUpFieldMove_Cut(void)
|
||||
}
|
||||
}
|
||||
|
||||
void FieldCallback_CutGrass(void)
|
||||
static void FieldCallback_CutGrass(void)
|
||||
{
|
||||
FieldEffectStart(FLDEFF_USE_CUT_ON_GRASS);
|
||||
gFieldEffectArguments[0] = GetCursorSelectionMonId();
|
||||
@ -331,7 +329,7 @@ bool8 FldEff_UseCutOnGrass(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void FieldCallback_CutTree(void)
|
||||
static void FieldCallback_CutTree(void)
|
||||
{
|
||||
gFieldEffectArguments[0] = GetCursorSelectionMonId();
|
||||
ScriptContext1_SetupScript(Route103_EventScript_290705);
|
||||
@ -347,7 +345,7 @@ bool8 FldEff_UseCutOnTree(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void StartCutGrassFieldEffect(void)
|
||||
static void StartCutGrassFieldEffect(void)
|
||||
{
|
||||
FieldEffectActiveListRemove(FLDEFF_USE_CUT_ON_GRASS);
|
||||
FieldEffectStart(FLDEFF_CUT_GRASS);
|
||||
@ -359,9 +357,9 @@ bool8 FldEff_CutGrass(void)
|
||||
u8 tileBehavior;
|
||||
u8 i;
|
||||
|
||||
for (i = 0, PlaySE(SE_W015), PlayerGetDestCoords(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y); i < 25; i++)
|
||||
for (i = 0, PlaySE(SE_W015), PlayerGetDestCoords(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y); i < CUT_HYPER_AREA; i++)
|
||||
{
|
||||
if (gUnknown_03001108[i] == TRUE)
|
||||
if (sHyperCutTiles[i] == TRUE)
|
||||
{
|
||||
s8 xAdd = (i % 5) - 2;
|
||||
s8 yAdd = (i / 5) - 2;
|
||||
@ -374,30 +372,30 @@ bool8 FldEff_CutGrass(void)
|
||||
}
|
||||
}
|
||||
|
||||
SetCutGrassMetatiles(gPlayerFacingPosition.x - gUnknown_03001101, gPlayerFacingPosition.y + (~gUnknown_03001102));
|
||||
SetCutGrassMetatiles(gPlayerFacingPosition.x - sTileCountFromPlayer_X, gPlayerFacingPosition.y - (1 + sTileCountFromPlayer_Y));
|
||||
DrawWholeMapView();
|
||||
gCutGrassSpriteArrayPtr = AllocZeroed(8);
|
||||
sCutGrassSpriteArrayPtr = AllocZeroed(CUT_SPRITE_ARRAY_COUNT);
|
||||
|
||||
// populate sprite ID array
|
||||
for (i = 0; i < 8; i++)
|
||||
for (i = 0; i < CUT_SPRITE_ARRAY_COUNT; i++)
|
||||
{
|
||||
gCutGrassSpriteArrayPtr[i] = CreateSprite(&gSpriteTemplate_CutGrass,
|
||||
sCutGrassSpriteArrayPtr[i] = CreateSprite(&sSpriteTemplate_CutGrass,
|
||||
gSprites[gPlayerAvatar.spriteId].oam.x + 8, gSprites[gPlayerAvatar.spriteId].oam.y + 20, 0);
|
||||
gSprites[gCutGrassSpriteArrayPtr[i]].data[2] = 32 * i;
|
||||
gSprites[sCutGrassSpriteArrayPtr[i]].data[2] = 32 * i;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// set map grid metatile depending on x, y
|
||||
void SetCutGrassMetatile(s16 x, s16 y)
|
||||
static void SetCutGrassMetatile(s16 x, s16 y)
|
||||
{
|
||||
s32 metatileId = MapGridGetMetatileIdAt(x, y);
|
||||
|
||||
switch (metatileId)
|
||||
{
|
||||
case METATILE_ID_POKE_TALL_GRASS_START:
|
||||
case METATILE_ID_POKE_TALL_GRASS:
|
||||
case METATILE_ID_POKE_LONG_GRASS_START:
|
||||
case METATILE_ID_POKE_LONG_GRASS:
|
||||
case METATILE_ID_POKE_GRASS:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_ID_GRASS);
|
||||
break;
|
||||
@ -407,14 +405,14 @@ void SetCutGrassMetatile(s16 x, s16 y)
|
||||
case METATILE_ID_POKE_GRASS_TREE_RIGHT:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_ID_GRASS_TREE_RIGHT);
|
||||
break;
|
||||
case METATILE_ID_SECRET_BASE_LEFT_POKE_TALL_GRASS:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_ID_SECRET_BASE_LEFT_TALL_GRASS);
|
||||
case METATILE_ID_SECRET_BASE_LEFT_POKE_LONG_GRASS:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_ID_SECRET_BASE_LEFT_LONG_GRASS);
|
||||
break;
|
||||
case METATILE_ID_SECRET_BASE_CENTER_POKE_TALL_GRASS:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_ID_SECRET_BASE_CENTER_TALL_GRASS);
|
||||
case METATILE_ID_SECRET_BASE_CENTER_POKE_LONG_GRASS:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_ID_SECRET_BASE_CENTER_LONG_GRASS);
|
||||
break;
|
||||
case METATILE_ID_SECRET_BASE_RIGHT_POKE_TALL_GRASS:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_ID_SECRET_BASE_RIGHT_TALL_GRASS);
|
||||
case METATILE_ID_SECRET_BASE_RIGHT_POKE_LONG_GRASS:
|
||||
MapGridSetMetatileIdAt(x, y, METATILE_ID_SECRET_BASE_RIGHT_LONG_GRASS);
|
||||
break;
|
||||
case METATILE_ID_POKE_STEP_LAVA_GRASS:
|
||||
case METATILE_ID_POKE_LAVA_GRASS:
|
||||
@ -432,92 +430,92 @@ void SetCutGrassMetatile(s16 x, s16 y)
|
||||
|
||||
enum
|
||||
{
|
||||
TALL_GRASS_NONE,
|
||||
TALL_GRASS_FIELD,
|
||||
TALL_GRASS_BASE_LEFT,
|
||||
TALL_GRASS_BASE_CENTER,
|
||||
TALL_GRASS_BASE_RIGHT
|
||||
LONG_GRASS_NONE,
|
||||
LONG_GRASS_FIELD,
|
||||
LONG_GRASS_BASE_LEFT,
|
||||
LONG_GRASS_BASE_CENTER,
|
||||
LONG_GRASS_BASE_RIGHT
|
||||
};
|
||||
|
||||
u8 GetTallGrassCaseAt(s16 x, s16 y)
|
||||
static u8 GetLongGrassCaseAt(s16 x, s16 y)
|
||||
{
|
||||
u16 metatileId = MapGridGetMetatileIdAt(x, y);
|
||||
|
||||
if (metatileId == METATILE_ID_GRASS)
|
||||
return TALL_GRASS_FIELD;
|
||||
else if (metatileId == METATILE_ID_SECRET_BASE_LEFT_TALL_GRASS)
|
||||
return TALL_GRASS_BASE_LEFT;
|
||||
else if (metatileId == METATILE_ID_SECRET_BASE_CENTER_TALL_GRASS)
|
||||
return TALL_GRASS_BASE_CENTER;
|
||||
else if (metatileId == METATILE_ID_SECRET_BASE_RIGHT_TALL_GRASS)
|
||||
return TALL_GRASS_BASE_RIGHT;
|
||||
return LONG_GRASS_FIELD;
|
||||
else if (metatileId == METATILE_ID_SECRET_BASE_LEFT_LONG_GRASS)
|
||||
return LONG_GRASS_BASE_LEFT;
|
||||
else if (metatileId == METATILE_ID_SECRET_BASE_CENTER_LONG_GRASS)
|
||||
return LONG_GRASS_BASE_CENTER;
|
||||
else if (metatileId == METATILE_ID_SECRET_BASE_RIGHT_LONG_GRASS)
|
||||
return LONG_GRASS_BASE_RIGHT;
|
||||
else
|
||||
return TALL_GRASS_NONE;
|
||||
return LONG_GRASS_NONE;
|
||||
}
|
||||
|
||||
void SetCutGrassMetatiles(s16 x, s16 y)
|
||||
static void SetCutGrassMetatiles(s16 x, s16 y)
|
||||
{
|
||||
s16 i;
|
||||
s16 lowerY = y + gUnknown_03001100;
|
||||
s16 lowerY = y + sCutSquareSide;
|
||||
|
||||
for (i = 0; i < gUnknown_03001100; i++)
|
||||
for (i = 0; i < sCutSquareSide; i++)
|
||||
{
|
||||
s16 currentX = x + i;
|
||||
if (MapGridGetMetatileIdAt(currentX, y) == METATILE_ID_POKE_TALL_GRASS)
|
||||
if (MapGridGetMetatileIdAt(currentX, y) == METATILE_ID_POKE_LONG_GRASS)
|
||||
{
|
||||
switch (GetTallGrassCaseAt(currentX, y + 1))
|
||||
switch (GetLongGrassCaseAt(currentX, y + 1))
|
||||
{
|
||||
case TALL_GRASS_FIELD:
|
||||
MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID_POKE_TALL_GRASS_START);
|
||||
case LONG_GRASS_FIELD:
|
||||
MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID_POKE_LONG_GRASS_START);
|
||||
break;
|
||||
case TALL_GRASS_BASE_LEFT:
|
||||
MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID_SECRET_BASE_LEFT_POKE_TALL_GRASS);
|
||||
case LONG_GRASS_BASE_LEFT:
|
||||
MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID_SECRET_BASE_LEFT_POKE_LONG_GRASS);
|
||||
break;
|
||||
case TALL_GRASS_BASE_CENTER:
|
||||
MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID_SECRET_BASE_CENTER_POKE_TALL_GRASS);
|
||||
case LONG_GRASS_BASE_CENTER:
|
||||
MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID_SECRET_BASE_CENTER_POKE_LONG_GRASS);
|
||||
break;
|
||||
case TALL_GRASS_BASE_RIGHT:
|
||||
MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID_SECRET_BASE_RIGHT_POKE_TALL_GRASS);
|
||||
case LONG_GRASS_BASE_RIGHT:
|
||||
MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID_SECRET_BASE_RIGHT_POKE_LONG_GRASS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (MapGridGetMetatileIdAt(currentX, lowerY) == METATILE_ID_GRASS)
|
||||
{
|
||||
if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_ID_POKE_TALL_GRASS_START)
|
||||
if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_ID_POKE_LONG_GRASS_START)
|
||||
MapGridSetMetatileIdAt(currentX, lowerY + 1, METATILE_ID_GRASS);
|
||||
if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_ID_SECRET_BASE_LEFT_POKE_TALL_GRASS)
|
||||
MapGridSetMetatileIdAt(currentX, lowerY + 1, METATILE_ID_SECRET_BASE_LEFT_TALL_GRASS);
|
||||
if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_ID_SECRET_BASE_CENTER_POKE_TALL_GRASS)
|
||||
MapGridSetMetatileIdAt(currentX, lowerY + 1, METATILE_ID_SECRET_BASE_CENTER_TALL_GRASS);
|
||||
if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_ID_SECRET_BASE_RIGHT_POKE_TALL_GRASS)
|
||||
MapGridSetMetatileIdAt(currentX, lowerY + 1, METATILE_ID_SECRET_BASE_RIGHT_TALL_GRASS);
|
||||
if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_ID_SECRET_BASE_LEFT_POKE_LONG_GRASS)
|
||||
MapGridSetMetatileIdAt(currentX, lowerY + 1, METATILE_ID_SECRET_BASE_LEFT_LONG_GRASS);
|
||||
if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_ID_SECRET_BASE_CENTER_POKE_LONG_GRASS)
|
||||
MapGridSetMetatileIdAt(currentX, lowerY + 1, METATILE_ID_SECRET_BASE_CENTER_LONG_GRASS);
|
||||
if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_ID_SECRET_BASE_RIGHT_POKE_LONG_GRASS)
|
||||
MapGridSetMetatileIdAt(currentX, lowerY + 1, METATILE_ID_SECRET_BASE_RIGHT_LONG_GRASS);
|
||||
}
|
||||
}
|
||||
|
||||
if (gUnknown_03001100 == CUT_HYPER_SIDE)
|
||||
if (sCutSquareSide == CUT_HYPER_SIDE)
|
||||
{
|
||||
HandleTallGrassOnHyper(0, x, y);
|
||||
HandleTallGrassOnHyper(1, x, y);
|
||||
HandleLongGrassOnHyper(0, x, y);
|
||||
HandleLongGrassOnHyper(1, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void HandleTallGrassOnHyper(u8 caseId, s16 x, s16 y)
|
||||
static void HandleLongGrassOnHyper(u8 caseId, s16 x, s16 y)
|
||||
{
|
||||
s16 newX;
|
||||
bool8 arr[3];
|
||||
|
||||
if (caseId == 0)
|
||||
{
|
||||
arr[0] = gUnknown_03001108[5];
|
||||
arr[1] = gUnknown_03001108[10];
|
||||
arr[2] = gUnknown_03001108[15];
|
||||
arr[0] = sHyperCutTiles[5];
|
||||
arr[1] = sHyperCutTiles[10];
|
||||
arr[2] = sHyperCutTiles[15];
|
||||
newX = x;
|
||||
}
|
||||
else if (caseId == 1)
|
||||
{
|
||||
arr[0] = gUnknown_03001108[9];
|
||||
arr[1] = gUnknown_03001108[14];
|
||||
arr[2] = gUnknown_03001108[19];
|
||||
arr[0] = sHyperCutTiles[9];
|
||||
arr[1] = sHyperCutTiles[14];
|
||||
arr[2] = sHyperCutTiles[19];
|
||||
newX = x + 4;
|
||||
}
|
||||
else // invalid case
|
||||
@ -527,69 +525,69 @@ void HandleTallGrassOnHyper(u8 caseId, s16 x, s16 y)
|
||||
|
||||
if (arr[0] == TRUE)
|
||||
{
|
||||
if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID_POKE_TALL_GRASS_START)
|
||||
if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID_POKE_LONG_GRASS_START)
|
||||
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_GRASS);
|
||||
if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID_SECRET_BASE_LEFT_POKE_TALL_GRASS)
|
||||
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_SECRET_BASE_LEFT_TALL_GRASS);
|
||||
if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID_SECRET_BASE_CENTER_POKE_TALL_GRASS)
|
||||
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_SECRET_BASE_CENTER_TALL_GRASS);
|
||||
if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID_SECRET_BASE_RIGHT_POKE_TALL_GRASS)
|
||||
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_SECRET_BASE_RIGHT_TALL_GRASS);
|
||||
if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID_SECRET_BASE_LEFT_POKE_LONG_GRASS)
|
||||
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_SECRET_BASE_LEFT_LONG_GRASS);
|
||||
if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID_SECRET_BASE_CENTER_POKE_LONG_GRASS)
|
||||
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_SECRET_BASE_CENTER_LONG_GRASS);
|
||||
if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID_SECRET_BASE_RIGHT_POKE_LONG_GRASS)
|
||||
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_SECRET_BASE_RIGHT_LONG_GRASS);
|
||||
}
|
||||
if (arr[1] == TRUE)
|
||||
{
|
||||
if (MapGridGetMetatileIdAt(newX, y + 2) == METATILE_ID_POKE_TALL_GRASS)
|
||||
if (MapGridGetMetatileIdAt(newX, y + 2) == METATILE_ID_POKE_LONG_GRASS)
|
||||
{
|
||||
switch (GetTallGrassCaseAt(newX, y + 3))
|
||||
switch (GetLongGrassCaseAt(newX, y + 3))
|
||||
{
|
||||
case TALL_GRASS_FIELD:
|
||||
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_POKE_TALL_GRASS_START);
|
||||
case LONG_GRASS_FIELD:
|
||||
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_POKE_LONG_GRASS_START);
|
||||
break;
|
||||
case TALL_GRASS_BASE_LEFT:
|
||||
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_SECRET_BASE_LEFT_POKE_TALL_GRASS);
|
||||
case LONG_GRASS_BASE_LEFT:
|
||||
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_SECRET_BASE_LEFT_POKE_LONG_GRASS);
|
||||
break;
|
||||
case TALL_GRASS_BASE_CENTER:
|
||||
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_SECRET_BASE_CENTER_POKE_TALL_GRASS);
|
||||
case LONG_GRASS_BASE_CENTER:
|
||||
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_SECRET_BASE_CENTER_POKE_LONG_GRASS);
|
||||
break;
|
||||
case TALL_GRASS_BASE_RIGHT:
|
||||
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_SECRET_BASE_RIGHT_POKE_TALL_GRASS);
|
||||
case LONG_GRASS_BASE_RIGHT:
|
||||
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_SECRET_BASE_RIGHT_POKE_LONG_GRASS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_ID_POKE_TALL_GRASS_START)
|
||||
if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_ID_POKE_LONG_GRASS_START)
|
||||
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_GRASS);
|
||||
if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_ID_SECRET_BASE_LEFT_POKE_TALL_GRASS)
|
||||
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_SECRET_BASE_LEFT_TALL_GRASS);
|
||||
if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_ID_SECRET_BASE_CENTER_POKE_TALL_GRASS)
|
||||
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_SECRET_BASE_CENTER_TALL_GRASS);
|
||||
if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_ID_SECRET_BASE_RIGHT_POKE_TALL_GRASS)
|
||||
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_SECRET_BASE_RIGHT_TALL_GRASS);
|
||||
if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_ID_SECRET_BASE_LEFT_POKE_LONG_GRASS)
|
||||
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_SECRET_BASE_LEFT_LONG_GRASS);
|
||||
if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_ID_SECRET_BASE_CENTER_POKE_LONG_GRASS)
|
||||
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_SECRET_BASE_CENTER_LONG_GRASS);
|
||||
if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_ID_SECRET_BASE_RIGHT_POKE_LONG_GRASS)
|
||||
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_SECRET_BASE_RIGHT_LONG_GRASS);
|
||||
}
|
||||
if (arr[2] == TRUE)
|
||||
{
|
||||
if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID_POKE_TALL_GRASS)
|
||||
if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID_POKE_LONG_GRASS)
|
||||
{
|
||||
switch (GetTallGrassCaseAt(newX, y + 4))
|
||||
switch (GetLongGrassCaseAt(newX, y + 4))
|
||||
{
|
||||
case TALL_GRASS_FIELD:
|
||||
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_POKE_TALL_GRASS_START);
|
||||
case LONG_GRASS_FIELD:
|
||||
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_POKE_LONG_GRASS_START);
|
||||
break;
|
||||
case TALL_GRASS_BASE_LEFT:
|
||||
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_SECRET_BASE_LEFT_POKE_TALL_GRASS);
|
||||
case LONG_GRASS_BASE_LEFT:
|
||||
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_SECRET_BASE_LEFT_POKE_LONG_GRASS);
|
||||
break;
|
||||
case TALL_GRASS_BASE_CENTER:
|
||||
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_SECRET_BASE_CENTER_POKE_TALL_GRASS);
|
||||
case LONG_GRASS_BASE_CENTER:
|
||||
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_SECRET_BASE_CENTER_POKE_LONG_GRASS);
|
||||
break;
|
||||
case TALL_GRASS_BASE_RIGHT:
|
||||
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_SECRET_BASE_RIGHT_POKE_TALL_GRASS);
|
||||
case LONG_GRASS_BASE_RIGHT:
|
||||
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_SECRET_BASE_RIGHT_POKE_LONG_GRASS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CutGrassSpriteCallback1(struct Sprite *sprite)
|
||||
static void CutGrassSpriteCallback1(struct Sprite *sprite)
|
||||
{
|
||||
sprite->data[0] = 8;
|
||||
sprite->data[1] = 0;
|
||||
@ -597,7 +595,7 @@ void CutGrassSpriteCallback1(struct Sprite *sprite)
|
||||
sprite->callback = CutGrassSpriteCallback2;
|
||||
}
|
||||
|
||||
void CutGrassSpriteCallback2(struct Sprite *sprite)
|
||||
static void CutGrassSpriteCallback2(struct Sprite *sprite)
|
||||
{
|
||||
sprite->pos2.x = Sin(sprite->data[2], sprite->data[0]);
|
||||
sprite->pos2.y = Cos(sprite->data[2], sprite->data[0]);
|
||||
@ -611,3 +609,76 @@ void CutGrassSpriteCallback2(struct Sprite *sprite)
|
||||
else
|
||||
sprite->callback = CutGrassSpriteCallbackEnd; // done rotating the grass, execute clean up function
|
||||
}
|
||||
|
||||
static void CutGrassSpriteCallbackEnd(struct Sprite *sprite)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
for (i = 1; i < CUT_SPRITE_ARRAY_COUNT; i++)
|
||||
DestroySprite(&gSprites[sCutGrassSpriteArrayPtr[i]]);
|
||||
|
||||
FieldEffectStop(&gSprites[sCutGrassSpriteArrayPtr[0]], FLDEFF_CUT_GRASS);
|
||||
FREE_AND_SET_NULL(sCutGrassSpriteArrayPtr);
|
||||
ScriptUnfreezeEventObjects();
|
||||
ScriptContext2_Disable();
|
||||
|
||||
if (IsMewPlayingHideAndSeek() == TRUE)
|
||||
ScriptContext1_SetupScript(FarawayIsland_Interior_EventScript_267EDB);
|
||||
}
|
||||
|
||||
void sub_80D423C(s16 x, s16 y)
|
||||
{
|
||||
u8 metatileBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||
if (MetatileBehavior_IsLongGrass_Duplicate(metatileBehavior))
|
||||
{
|
||||
switch (GetLongGrassCaseAt(x, y + 1))
|
||||
{
|
||||
case LONG_GRASS_FIELD:
|
||||
MapGridSetMetatileIdAt(x, y + 1, METATILE_ID_POKE_LONG_GRASS_START);
|
||||
break;
|
||||
case LONG_GRASS_BASE_LEFT:
|
||||
MapGridSetMetatileIdAt(x, y + 1, METATILE_ID_SECRET_BASE_LEFT_POKE_LONG_GRASS);
|
||||
break;
|
||||
case LONG_GRASS_BASE_CENTER:
|
||||
MapGridSetMetatileIdAt(x, y + 1, METATILE_ID_SECRET_BASE_CENTER_POKE_LONG_GRASS);
|
||||
break;
|
||||
case LONG_GRASS_BASE_RIGHT:
|
||||
MapGridSetMetatileIdAt(x, y + 1, METATILE_ID_SECRET_BASE_RIGHT_POKE_LONG_GRASS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80D42B8(s16 x, s16 y)
|
||||
{
|
||||
if (MapGridGetMetatileIdAt(x, y) == METATILE_ID_GRASS)
|
||||
{
|
||||
u8 metatileBehavior = MapGridGetMetatileBehaviorAt(x, y + 1);
|
||||
if (MetatileBehavior_IsLongGrassSouthEdge(metatileBehavior))
|
||||
{
|
||||
s32 metatileId = MapGridGetMetatileIdAt(x, y + 1);
|
||||
switch (metatileId)
|
||||
{
|
||||
case METATILE_ID_POKE_LONG_GRASS_START:
|
||||
MapGridSetMetatileIdAt(x, y + 1, METATILE_ID_GRASS);
|
||||
break;
|
||||
case METATILE_ID_SECRET_BASE_LEFT_POKE_LONG_GRASS:
|
||||
MapGridSetMetatileIdAt(x, y + 1, METATILE_ID_SECRET_BASE_LEFT_LONG_GRASS);
|
||||
break;
|
||||
case METATILE_ID_SECRET_BASE_CENTER_POKE_LONG_GRASS:
|
||||
MapGridSetMetatileIdAt(x, y + 1, METATILE_ID_SECRET_BASE_CENTER_LONG_GRASS);
|
||||
break;
|
||||
case METATILE_ID_SECRET_BASE_RIGHT_POKE_LONG_GRASS:
|
||||
MapGridSetMetatileIdAt(x, y + 1, METATILE_ID_SECRET_BASE_RIGHT_LONG_GRASS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StartCutTreeFieldEffect(void)
|
||||
{
|
||||
PlaySE(SE_W015);
|
||||
FieldEffectActiveListRemove(FLDEFF_USE_CUT_ON_TREE);
|
||||
EnableBothScriptContexts();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ extern void sub_81C5B14(u8 taskId);
|
||||
extern u8 gText_DadsAdvice[];
|
||||
extern u8 gText_CantDismountBike[];
|
||||
extern void sub_8197434(u8 a, u8 b);
|
||||
extern void sub_80984F4(void);
|
||||
extern void ScriptUnfreezeEventObjects(void);
|
||||
extern void ItemUseOutOfBattle_TMHM(u8 a);
|
||||
extern void ItemUseOutOfBattle_EvolutionStone(u8 b);
|
||||
extern void bag_menu_mail_related(void);
|
||||
@ -197,7 +197,7 @@ void CleanUpAfterFailingToUseRegisteredKeyItemOnField(u8 taskId)
|
||||
{
|
||||
sub_8197434(0, 1);
|
||||
DestroyTask(taskId);
|
||||
sub_80984F4();
|
||||
ScriptUnfreezeEventObjects();
|
||||
ScriptContext2_Disable();
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ void ItemUseOnFieldCB_Bike(u8 taskId)
|
||||
GetOnOffBike(2);
|
||||
else
|
||||
GetOnOffBike(4);
|
||||
sub_80984F4();
|
||||
ScriptUnfreezeEventObjects();
|
||||
ScriptContext2_Disable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
@ -358,7 +358,7 @@ void sub_80FD504(u8 taskId)
|
||||
void sub_80FD5CC(u8 taskId)
|
||||
{
|
||||
sub_8197434(0, 1);
|
||||
sub_80984F4();
|
||||
ScriptUnfreezeEventObjects();
|
||||
ScriptContext2_Disable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ extern void sub_80C4DDC(void (*)(void));
|
||||
extern void sub_80C51C4(void (*)(void));
|
||||
extern void sub_80C4E74(u8, void (*)(void));
|
||||
extern void sub_81C4EFC(void);
|
||||
extern void sub_80984F4(void);
|
||||
extern void ScriptUnfreezeEventObjects(void);
|
||||
extern void sub_81A9EC8(void);
|
||||
extern void save_serialize_map(void);
|
||||
extern void sub_81A9E90(void);
|
||||
@ -773,7 +773,7 @@ static bool8 StartMenuBattlePyramidRetireCallback(void)
|
||||
void sub_809FDD4(void) // Called from battle_frontier_2.s
|
||||
{
|
||||
sub_8197DF8(0, FALSE);
|
||||
sub_80984F4();
|
||||
ScriptUnfreezeEventObjects();
|
||||
CreateStartMenuTask(sub_809FA34);
|
||||
ScriptContext2_Enable();
|
||||
}
|
||||
@ -815,7 +815,7 @@ static bool8 SaveCallback(void)
|
||||
case SAVE_SUCCESS:
|
||||
case SAVE_ERROR: // Close start menu
|
||||
sub_8197DF8(0, TRUE);
|
||||
sub_80984F4();
|
||||
ScriptUnfreezeEventObjects();
|
||||
ScriptContext2_Disable();
|
||||
sub_81A9EC8();
|
||||
return TRUE;
|
||||
@ -852,7 +852,7 @@ static bool8 BattlePyramidRetireCallback(void)
|
||||
return FALSE;
|
||||
case SAVE_CANCELED: // Yes (Retire from battle pyramid)
|
||||
sub_8197DF8(0, TRUE);
|
||||
sub_80984F4();
|
||||
ScriptUnfreezeEventObjects();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext1_SetupScript(BattleFrontier_BattlePyramidEmptySquare_EventScript_252C88);
|
||||
return TRUE;
|
||||
@ -1409,7 +1409,7 @@ static void HideStartMenuWindow(void)
|
||||
{
|
||||
sub_819746C(GetStartMenuWindowId(), TRUE);
|
||||
RemoveStartMenuWindow();
|
||||
sub_80984F4();
|
||||
ScriptUnfreezeEventObjects();
|
||||
ScriptContext2_Disable();
|
||||
}
|
||||
|
||||
|
@ -384,10 +384,7 @@ gUnknown_02039D8C: @ 2039D8C
|
||||
.space 0x4
|
||||
|
||||
.include "src/script_movement.o"
|
||||
|
||||
gUnknown_02039DD0: @ 2039DD0
|
||||
.space 0x4
|
||||
|
||||
.include "src/fldeff_cut.o"
|
||||
.include "src/map_name_popup.o"
|
||||
.include "src/item.o"
|
||||
|
||||
@ -607,7 +604,7 @@ gUnknown_0203AB34: @ 203AB34
|
||||
.include "src/battle_ai_script_commands.o"
|
||||
|
||||
.align 2
|
||||
gUnknown_0203AB40: @ 203AB40
|
||||
gPlayerFacingPosition: @ 203AB40
|
||||
.space 0x8
|
||||
|
||||
.include "src/pokeblock.o"
|
||||
@ -844,7 +841,7 @@ gUnknown_0203CEE8: @ 203CEE8
|
||||
gUnknown_0203CEE9: @ 203CEE9
|
||||
.space 0x3
|
||||
|
||||
gUnknown_0203CEEC: @ 203CEEC
|
||||
gPostMenuFieldCallback: @ 203CEEC
|
||||
.space 0x4
|
||||
|
||||
gUnknown_0203CEF0: @ 203CEF0
|
||||
|
Loading…
Reference in New Issue
Block a user