mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 19:54:21 +01:00
start fldeffect cut
This commit is contained in:
parent
0c8cfc2297
commit
7ea5dd7923
@ -467,7 +467,7 @@ _080F9F54:
|
|||||||
thumb_func_start sub_80F9F5C
|
thumb_func_start sub_80F9F5C
|
||||||
sub_80F9F5C: @ 80F9F5C
|
sub_80F9F5C: @ 80F9F5C
|
||||||
push {lr}
|
push {lr}
|
||||||
ldr r0, =gUnknown_0203AB40
|
ldr r0, =gPlayerFacingPosition
|
||||||
ldr r1, =gMapHeader
|
ldr r1, =gMapHeader
|
||||||
ldr r1, [r1, 0x4]
|
ldr r1, [r1, 0x4]
|
||||||
bl sub_80E9608
|
bl sub_80E9608
|
||||||
@ -572,7 +572,7 @@ sub_80FA004: @ 80FA004
|
|||||||
lsrs r0, 24
|
lsrs r0, 24
|
||||||
cmp r0, 0x2
|
cmp r0, 0x2
|
||||||
bne _080FA0AE
|
bne _080FA0AE
|
||||||
ldr r4, =gUnknown_0203AB40
|
ldr r4, =gPlayerFacingPosition
|
||||||
adds r1, r4, 0x2
|
adds r1, r4, 0x2
|
||||||
adds r0, r4, 0
|
adds r0, r4, 0
|
||||||
bl GetXYCoordsOneStepInFrontOfPlayer
|
bl GetXYCoordsOneStepInFrontOfPlayer
|
||||||
@ -590,10 +590,10 @@ sub_80FA004: @ 80FA004
|
|||||||
cmp r0, 0x1
|
cmp r0, 0x1
|
||||||
bne _080FA070
|
bne _080FA070
|
||||||
bl sub_80F9F5C
|
bl sub_80F9F5C
|
||||||
ldr r1, =gUnknown_03005DB0
|
ldr r1, =gFieldCallback2
|
||||||
ldr r0, =FieldCallback_Teleport
|
ldr r0, =FieldCallback_PrepareFadeInFromMenu
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
ldr r1, =gUnknown_0203CEEC
|
ldr r1, =gPostMenuFieldCallback
|
||||||
ldr r0, =sub_80FA0DC
|
ldr r0, =sub_80FA0DC
|
||||||
b _080FA0C0
|
b _080FA0C0
|
||||||
.pool
|
.pool
|
||||||
@ -605,10 +605,10 @@ _080FA070:
|
|||||||
cmp r0, 0x1
|
cmp r0, 0x1
|
||||||
bne _080FA0A0
|
bne _080FA0A0
|
||||||
bl sub_80F9F5C
|
bl sub_80F9F5C
|
||||||
ldr r1, =gUnknown_03005DB0
|
ldr r1, =gFieldCallback2
|
||||||
ldr r0, =FieldCallback_Teleport
|
ldr r0, =FieldCallback_PrepareFadeInFromMenu
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
ldr r1, =gUnknown_0203CEEC
|
ldr r1, =gPostMenuFieldCallback
|
||||||
ldr r0, =sub_80FA1E8
|
ldr r0, =sub_80FA1E8
|
||||||
b _080FA0C0
|
b _080FA0C0
|
||||||
.pool
|
.pool
|
||||||
@ -624,10 +624,10 @@ _080FA0AE:
|
|||||||
b _080FA0C4
|
b _080FA0C4
|
||||||
_080FA0B2:
|
_080FA0B2:
|
||||||
bl sub_80F9F5C
|
bl sub_80F9F5C
|
||||||
ldr r1, =gUnknown_03005DB0
|
ldr r1, =gFieldCallback2
|
||||||
ldr r0, =FieldCallback_Teleport
|
ldr r0, =FieldCallback_PrepareFadeInFromMenu
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
ldr r1, =gUnknown_0203CEEC
|
ldr r1, =gPostMenuFieldCallback
|
||||||
ldr r0, =sub_80FA34C
|
ldr r0, =sub_80FA34C
|
||||||
_080FA0C0:
|
_080FA0C0:
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
@ -824,7 +824,7 @@ sub_80FA234: @ 80FA234
|
|||||||
thumb_func_start sub_80FA248
|
thumb_func_start sub_80FA248
|
||||||
sub_80FA248: @ 80FA248
|
sub_80FA248: @ 80FA248
|
||||||
push {r4,lr}
|
push {r4,lr}
|
||||||
ldr r1, =gUnknown_0203AB40
|
ldr r1, =gPlayerFacingPosition
|
||||||
movs r2, 0
|
movs r2, 0
|
||||||
ldrsh r0, [r1, r2]
|
ldrsh r0, [r1, r2]
|
||||||
movs r2, 0x2
|
movs r2, 0x2
|
||||||
|
1294
asm/fldeff_cut.s
1294
asm/fldeff_cut.s
File diff suppressed because it is too large
Load Diff
@ -10199,10 +10199,10 @@ _081B5714:
|
|||||||
movs r0, 0x5
|
movs r0, 0x5
|
||||||
bl PlaySE
|
bl PlaySE
|
||||||
_081B571A:
|
_081B571A:
|
||||||
ldr r0, =gUnknown_03005DB0
|
ldr r0, =gFieldCallback2
|
||||||
movs r1, 0
|
movs r1, 0
|
||||||
str r1, [r0]
|
str r1, [r0]
|
||||||
ldr r0, =gUnknown_0203CEEC
|
ldr r0, =gPostMenuFieldCallback
|
||||||
str r1, [r0]
|
str r1, [r0]
|
||||||
adds r0, r4, 0
|
adds r0, r4, 0
|
||||||
bl sub_81B1C1C
|
bl sub_81B1C1C
|
||||||
@ -10213,8 +10213,8 @@ _081B572A:
|
|||||||
.pool
|
.pool
|
||||||
thumb_func_end sub_81B56D8
|
thumb_func_end sub_81B56D8
|
||||||
|
|
||||||
thumb_func_start FieldCallback_Teleport
|
thumb_func_start FieldCallback_PrepareFadeInFromMenu
|
||||||
FieldCallback_Teleport: @ 81B5738
|
FieldCallback_PrepareFadeInFromMenu: @ 81B5738
|
||||||
push {lr}
|
push {lr}
|
||||||
bl pal_fill_black
|
bl pal_fill_black
|
||||||
ldr r0, =task_launch_hm_phase_2
|
ldr r0, =task_launch_hm_phase_2
|
||||||
@ -10224,7 +10224,7 @@ FieldCallback_Teleport: @ 81B5738
|
|||||||
pop {r1}
|
pop {r1}
|
||||||
bx r1
|
bx r1
|
||||||
.pool
|
.pool
|
||||||
thumb_func_end FieldCallback_Teleport
|
thumb_func_end FieldCallback_PrepareFadeInFromMenu
|
||||||
|
|
||||||
thumb_func_start task_launch_hm_phase_2
|
thumb_func_start task_launch_hm_phase_2
|
||||||
task_launch_hm_phase_2: @ 81B5750
|
task_launch_hm_phase_2: @ 81B5750
|
||||||
@ -10241,7 +10241,7 @@ task_launch_hm_phase_2: @ 81B5750
|
|||||||
lsls r0, 16
|
lsls r0, 16
|
||||||
lsrs r0, 16
|
lsrs r0, 16
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
ldr r0, =gUnknown_0203CEEC
|
ldr r0, =gPostMenuFieldCallback
|
||||||
ldr r0, [r0]
|
ldr r0, [r0]
|
||||||
bl _call_via_r0
|
bl _call_via_r0
|
||||||
adds r0, r4, 0
|
adds r0, r4, 0
|
||||||
@ -10345,10 +10345,10 @@ sub_81B5820: @ 81B5820
|
|||||||
lsrs r0, 24
|
lsrs r0, 24
|
||||||
cmp r0, 0x1
|
cmp r0, 0x1
|
||||||
bne _081B585C
|
bne _081B585C
|
||||||
ldr r1, =gUnknown_03005DB0
|
ldr r1, =gFieldCallback2
|
||||||
ldr r0, =FieldCallback_Teleport
|
ldr r0, =FieldCallback_PrepareFadeInFromMenu
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
ldr r1, =gUnknown_0203CEEC
|
ldr r1, =gPostMenuFieldCallback
|
||||||
ldr r0, =hm_surf_run_dp02scr
|
ldr r0, =hm_surf_run_dp02scr
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
movs r0, 0x1
|
movs r0, 0x1
|
||||||
@ -10463,10 +10463,10 @@ hm_prepare_waterfall: @ 81B58F0
|
|||||||
lsrs r0, 24
|
lsrs r0, 24
|
||||||
cmp r0, 0x1
|
cmp r0, 0x1
|
||||||
bne _081B594C
|
bne _081B594C
|
||||||
ldr r1, =gUnknown_03005DB0
|
ldr r1, =gFieldCallback2
|
||||||
ldr r0, =FieldCallback_Teleport
|
ldr r0, =FieldCallback_PrepareFadeInFromMenu
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
ldr r1, =gUnknown_0203CEEC
|
ldr r1, =gPostMenuFieldCallback
|
||||||
ldr r0, =hm2_waterfall
|
ldr r0, =hm2_waterfall
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
movs r0, 0x1
|
movs r0, 0x1
|
||||||
@ -10510,10 +10510,10 @@ sub_81B5974: @ 81B5974
|
|||||||
b _081B599E
|
b _081B599E
|
||||||
.pool
|
.pool
|
||||||
_081B5990:
|
_081B5990:
|
||||||
ldr r1, =gUnknown_03005DB0
|
ldr r1, =gFieldCallback2
|
||||||
ldr r0, =FieldCallback_Teleport
|
ldr r0, =FieldCallback_PrepareFadeInFromMenu
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
ldr r1, =gUnknown_0203CEEC
|
ldr r1, =gPostMenuFieldCallback
|
||||||
ldr r0, =sub_81B5958
|
ldr r0, =sub_81B5958
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
movs r0, 0x1
|
movs r0, 0x1
|
||||||
@ -17276,7 +17276,7 @@ sub_81B9354: @ 81B9354
|
|||||||
sub sp, 0xC
|
sub sp, 0xC
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
lsrs r0, 24
|
lsrs r0, 24
|
||||||
ldr r2, =gUnknown_03005DB0
|
ldr r2, =gFieldCallback2
|
||||||
ldr r1, =hm_add_c3_without_phase_2
|
ldr r1, =hm_add_c3_without_phase_2
|
||||||
str r1, [r2]
|
str r1, [r2]
|
||||||
movs r1, 0
|
movs r1, 0
|
||||||
@ -17308,7 +17308,7 @@ sub_81B9390: @ 81B9390
|
|||||||
movs r0, 0xFF
|
movs r0, 0xFF
|
||||||
strh r0, [r4]
|
strh r0, [r4]
|
||||||
_081B93A6:
|
_081B93A6:
|
||||||
ldr r0, =gUnknown_03005DB0
|
ldr r0, =gFieldCallback2
|
||||||
ldr r1, =hm_add_c3_without_phase_2
|
ldr r1, =hm_add_c3_without_phase_2
|
||||||
str r1, [r0]
|
str r1, [r0]
|
||||||
ldr r0, =CB2_ReturnToField
|
ldr r0, =CB2_ReturnToField
|
||||||
@ -17417,7 +17417,7 @@ _081B9486:
|
|||||||
ldr r1, =gSpecialVar_0x8004
|
ldr r1, =gSpecialVar_0x8004
|
||||||
ldrb r0, [r2]
|
ldrb r0, [r2]
|
||||||
strh r0, [r1]
|
strh r0, [r1]
|
||||||
ldr r1, =gUnknown_03005DB0
|
ldr r1, =gFieldCallback2
|
||||||
ldr r0, =hm_add_c3_without_phase_2
|
ldr r0, =hm_add_c3_without_phase_2
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
ldr r0, =CB2_ReturnToField
|
ldr r0, =CB2_ReturnToField
|
||||||
@ -17553,7 +17553,7 @@ _081B95A4:
|
|||||||
lsrs r0, 24
|
lsrs r0, 24
|
||||||
strh r0, [r4]
|
strh r0, [r4]
|
||||||
_081B95BA:
|
_081B95BA:
|
||||||
ldr r0, =gUnknown_03005DB0
|
ldr r0, =gFieldCallback2
|
||||||
ldr r1, =hm_add_c3_without_phase_2
|
ldr r1, =hm_add_c3_without_phase_2
|
||||||
str r1, [r0]
|
str r1, [r0]
|
||||||
ldr r0, =CB2_ReturnToField
|
ldr r0, =CB2_ReturnToField
|
||||||
|
@ -2070,7 +2070,7 @@ sub_81C4F44: @ 81C4F44
|
|||||||
cmp r0, 0
|
cmp r0, 0
|
||||||
bne _081C4F6E
|
bne _081C4F6E
|
||||||
bl overworld_free_bg_tilemaps
|
bl overworld_free_bg_tilemaps
|
||||||
ldr r0, =gUnknown_03005DB0
|
ldr r0, =gFieldCallback2
|
||||||
ldr r1, =hm_add_c3_without_phase_2
|
ldr r1, =hm_add_c3_without_phase_2
|
||||||
str r1, [r0]
|
str r1, [r0]
|
||||||
ldr r1, =CB2_ReturnToField
|
ldr r1, =CB2_ReturnToField
|
||||||
|
@ -1376,7 +1376,9 @@ const u32 gFieldEffectObjectPic_ShadowSmall[] = INCBIN_U32("graphics/event_objec
|
|||||||
const u32 gFieldEffectObjectPic_ShadowMedium[] = INCBIN_U32("graphics/event_objects/pics/effects/shadow_medium.4bpp");
|
const u32 gFieldEffectObjectPic_ShadowMedium[] = INCBIN_U32("graphics/event_objects/pics/effects/shadow_medium.4bpp");
|
||||||
const u32 gFieldEffectObjectPic_ShadowLarge[] = INCBIN_U32("graphics/event_objects/pics/effects/shadow_large.4bpp");
|
const u32 gFieldEffectObjectPic_ShadowLarge[] = INCBIN_U32("graphics/event_objects/pics/effects/shadow_large.4bpp");
|
||||||
const u32 gFieldEffectObjectPic_ShadowExtraLarge[] = INCBIN_U32("graphics/event_objects/pics/effects/shadow_extra_large.4bpp");
|
const u32 gFieldEffectObjectPic_ShadowExtraLarge[] = INCBIN_U32("graphics/event_objects/pics/effects/shadow_extra_large.4bpp");
|
||||||
const u32 gUnknown_084F6D38[] = INCBIN_U32("graphics/event_objects/pics/effects/unknown_4F6D38/0.4bpp");
|
const u32 filler_8368A08[0x48] = {};
|
||||||
|
const u8 gFieldEffectPic_CutGrass[] = INCBIN_U8("graphics/event_objects/pics/effects/cut_grass.4bpp");
|
||||||
|
const u32 gFieldEffectPic_CutGrass_Copy[] = INCBIN_U32("graphics/event_objects/pics/effects/cut_grass.4bpp");
|
||||||
const u16 gFieldEffectObjectPalette6[] = INCBIN_U16("graphics/event_objects/palettes/field_effect_object_palette_06.gbapal");
|
const u16 gFieldEffectObjectPalette6[] = INCBIN_U16("graphics/event_objects/palettes/field_effect_object_palette_06.gbapal");
|
||||||
const u32 gFieldEffectObjectPic_Ripple_0[] = INCBIN_U32("graphics/event_objects/pics/effects/ripple/0.4bpp");
|
const u32 gFieldEffectObjectPic_Ripple_0[] = INCBIN_U32("graphics/event_objects/pics/effects/ripple/0.4bpp");
|
||||||
const u32 gFieldEffectObjectPic_Ripple_1[] = INCBIN_U32("graphics/event_objects/pics/effects/ripple/1.4bpp");
|
const u32 gFieldEffectObjectPic_Ripple_1[] = INCBIN_U32("graphics/event_objects/pics/effects/ripple/1.4bpp");
|
||||||
|
@ -623,7 +623,7 @@ static void PerStepCallback_8069F64(u8 taskId)
|
|||||||
{
|
{
|
||||||
data[1] = x;
|
data[1] = x;
|
||||||
data[2] = y;
|
data[2] = y;
|
||||||
if (MetatileBehavior_IsAsh(MapGridGetMetatileBehaviorAt(x, y)))
|
if (MetatileBehavior_IsAshGrass(MapGridGetMetatileBehaviorAt(x, y)))
|
||||||
{
|
{
|
||||||
if (MapGridGetMetatileIdAt(x, y) == 0x20a)
|
if (MapGridGetMetatileIdAt(x, y) == 0x20a)
|
||||||
{
|
{
|
||||||
|
610
src/fldeff_cut.c
610
src/fldeff_cut.c
@ -1,19 +1,613 @@
|
|||||||
|
|
||||||
// Includes
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
#include "field_camera.h"
|
||||||
|
#include "field_effect.h"
|
||||||
|
#include "event_object_movement.h"
|
||||||
|
#include "field_player_avatar.h"
|
||||||
|
#include "fieldmap.h"
|
||||||
|
#include "event_obj_lock.h"
|
||||||
|
#include "metatile_behavior.h"
|
||||||
|
#include "party_menu.h"
|
||||||
|
#include "overworld.h"
|
||||||
|
#include "script.h"
|
||||||
|
#include "sound.h"
|
||||||
|
#include "sprite.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "trig.h"
|
||||||
|
#include "malloc.h"
|
||||||
|
#include "constants/event_objects.h"
|
||||||
|
#include "constants/songs.h"
|
||||||
|
#include "constants/abilities.h"
|
||||||
|
|
||||||
// Static type declarations
|
// tileset 0 as first
|
||||||
|
#define METATILE_ID_GRASS 0x1
|
||||||
|
#define METATILE_ID_POKE_GRASS 0xD
|
||||||
|
|
||||||
// Static RAM declarations
|
#define METATILE_ID_POKE_GRASS_TREE_UP 0x25
|
||||||
|
#define METATILE_ID_GRASS_TREE_UP 0xE
|
||||||
|
|
||||||
|
#define METATILE_ID_POKE_GRASS_TREE_LEFT 0x1C6
|
||||||
|
#define METATILE_ID_POKE_GRASS_TREE_RIGHT 0x1C7
|
||||||
|
|
||||||
|
#define METATILE_ID_GRASS_TREE_LEFT 0x1CE
|
||||||
|
#define METATILE_ID_GRASS_TREE_RIGHT 0x1CF
|
||||||
|
|
||||||
|
#define METATILE_ID_POKE_TALL_GRASS 0x15
|
||||||
|
|
||||||
|
// tileset 6 as second
|
||||||
|
#define METATILE_ID_POKE_STEP_LAVA_GRASS 0x206
|
||||||
|
#define METATILE_ID_POKE_LAVA_GRASS 0x207
|
||||||
|
#define METATILE_ID_LAVA_FIELD 0x271
|
||||||
|
|
||||||
|
// tileset 7 as second
|
||||||
|
#define METATILE_ID_POKE_ASH_GRASS 0x20A
|
||||||
|
#define METATILE_ID_POKE_STEP_ASH_GRASS 0x212
|
||||||
|
#define METATILE_ID_ASH 0x218
|
||||||
|
|
||||||
|
// tileset 8 as second
|
||||||
|
#define METATILE_ID_POKE_TALL_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_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 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_03001100;
|
||||||
IWRAM_DATA u8 gUnknown_03001101;
|
IWRAM_DATA u8 gUnknown_03001101;
|
||||||
IWRAM_DATA u8 gUnknown_03001102;
|
IWRAM_DATA u8 gUnknown_03001102;
|
||||||
IWRAM_DATA u32 fldeff_cut_unused_03001104;
|
IWRAM_DATA u32 fldeff_cut_unused_03001104;
|
||||||
IWRAM_DATA u8 gUnknown_03001108[25];
|
IWRAM_DATA bool8 gUnknown_03001108[CUT_HYPER_AREA];
|
||||||
|
|
||||||
// Static ROM declarations
|
struct HyperCutterUnk
|
||||||
|
{
|
||||||
|
s8 x;
|
||||||
|
s8 y;
|
||||||
|
u8 unk2[2];
|
||||||
|
};
|
||||||
|
|
||||||
// .rodata
|
const struct HyperCutterUnk gUnknown_0857C608[] =
|
||||||
|
{
|
||||||
|
{-2, -2, {1}},
|
||||||
|
{-1, -2, {1}},
|
||||||
|
{0, -2, {2}},
|
||||||
|
{1, -2, {3}},
|
||||||
|
{2, -2, {3}},
|
||||||
|
{-2, -1, {1}},
|
||||||
|
{2, -1, {3}},
|
||||||
|
{-2, 0, {4}},
|
||||||
|
{2, 0, {6}},
|
||||||
|
{-2, 1, {7}},
|
||||||
|
{2, 1, {9}},
|
||||||
|
{-2, 2, {7}},
|
||||||
|
{-1, 2, {7}},
|
||||||
|
{0, 2, {8}},
|
||||||
|
{1, 2, {9}},
|
||||||
|
{2, 2, {9}},
|
||||||
|
};
|
||||||
|
|
||||||
// .text
|
const struct OamData gOamData_CutGrass =
|
||||||
|
{
|
||||||
|
.y = 0,
|
||||||
|
.affineMode = 0,
|
||||||
|
.objMode = 0,
|
||||||
|
.mosaic = 0,
|
||||||
|
.bpp = 0,
|
||||||
|
.shape = 0,
|
||||||
|
.x = 0,
|
||||||
|
.matrixNum = 0,
|
||||||
|
.size = 0,
|
||||||
|
.tileNum = 1,
|
||||||
|
.priority = 1,
|
||||||
|
.paletteNum = 1,
|
||||||
|
.affineParam = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
const union AnimCmd gSpriteAnim_CutGrass[] =
|
||||||
|
{
|
||||||
|
ANIMCMD_FRAME(0, 30),
|
||||||
|
ANIMCMD_JUMP(0),
|
||||||
|
};
|
||||||
|
|
||||||
|
const union AnimCmd *const gSpriteAnimTable_CutGrass[] =
|
||||||
|
{
|
||||||
|
gSpriteAnim_CutGrass,
|
||||||
|
};
|
||||||
|
|
||||||
|
const struct SpriteFrameImage gSpriteImageTable_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 =
|
||||||
|
{
|
||||||
|
.tileTag = 0xFFFF,
|
||||||
|
.paletteTag = 0x1000,
|
||||||
|
.oam = &gOamData_CutGrass,
|
||||||
|
.anims = gSpriteAnimTable_CutGrass,
|
||||||
|
.images = gSpriteImageTable_CutGrass,
|
||||||
|
.affineAnims = gDummySpriteAffineAnimTable,
|
||||||
|
.callback = CutGrassSpriteCallback1,
|
||||||
|
};
|
||||||
|
|
||||||
|
bool8 SetUpFieldMove_Cut(void)
|
||||||
|
{
|
||||||
|
s16 x, y;
|
||||||
|
u8 i, j;
|
||||||
|
u8 tileBehavior;
|
||||||
|
u8 userAbility;
|
||||||
|
bool8 array[CUT_NORMAL_AREA];
|
||||||
|
bool8 ret;
|
||||||
|
|
||||||
|
if (SetLastTalkedObjectInFrontOfPlayer(EVENT_OBJ_GFX_CUTTABLE_TREE) == TRUE)
|
||||||
|
{
|
||||||
|
// Standing in front of cuttable tree.
|
||||||
|
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
|
||||||
|
gPostMenuFieldCallback = FieldCallback_CutTree;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PlayerGetDestCoords(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y);
|
||||||
|
userAbility = GetMonAbility(&gPlayerParty[GetCursorSelectionMonId()]);
|
||||||
|
if (userAbility == ABILITY_HYPER_CUTTER)
|
||||||
|
{
|
||||||
|
gUnknown_03001100 = 5;
|
||||||
|
gUnknown_03001101 = 2;
|
||||||
|
gUnknown_03001102 = 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gUnknown_03001100 = 3;
|
||||||
|
gUnknown_03001101 = 1;
|
||||||
|
gUnknown_03001102 = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < CUT_NORMAL_AREA; i++)
|
||||||
|
array[i] = FALSE;
|
||||||
|
for (i = 0; i < CUT_HYPER_AREA; i++)
|
||||||
|
gUnknown_03001108[i] = FALSE;
|
||||||
|
|
||||||
|
ret = FALSE;
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
y = i - 1 + gPlayerFacingPosition.y;
|
||||||
|
for (j = 0; j < 3; j++)
|
||||||
|
{
|
||||||
|
x = j - 1 + gPlayerFacingPosition.x;
|
||||||
|
if (MapGridGetZCoordAt(x, y) == gPlayerFacingPosition.height)
|
||||||
|
{
|
||||||
|
tileBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||||
|
if (MetatileBehavior_IsPokeGrass(tileBehavior) == TRUE
|
||||||
|
|| MetatileBehavior_IsAshGrass(tileBehavior) == TRUE)
|
||||||
|
{
|
||||||
|
// Standing in front of grass.
|
||||||
|
gUnknown_03001108[6 + (i * 5) + j] = TRUE;
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
if (MapGridIsImpassableAt(x, y) == TRUE)
|
||||||
|
{
|
||||||
|
array[i * 3 + j] = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
array[i * 3 + j] = TRUE;
|
||||||
|
if (MetatileBehavior_IsCuttableGrass(tileBehavior) == TRUE)
|
||||||
|
gUnknown_03001108[6 + (i * 5) + j] = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
array[i * 3 + j] = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userAbility != ABILITY_HYPER_CUTTER)
|
||||||
|
{
|
||||||
|
if (ret == TRUE)
|
||||||
|
{
|
||||||
|
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
|
||||||
|
gPostMenuFieldCallback = FieldCallback_CutGrass;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool8 r7;
|
||||||
|
for (i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
x = gPlayerFacingPosition.x + gUnknown_0857C608[i].x;
|
||||||
|
y = gPlayerFacingPosition.y + gUnknown_0857C608[i].y;
|
||||||
|
r7 = TRUE;
|
||||||
|
|
||||||
|
j = 0;
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if (gUnknown_0857C608[i].unk2[j] == 0)
|
||||||
|
break;
|
||||||
|
if (array[(u8)(gUnknown_0857C608[i].unk2[j] - 1)] == FALSE)
|
||||||
|
{
|
||||||
|
r7 = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (++j >= 2)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r7 == TRUE)
|
||||||
|
{
|
||||||
|
if (MapGridGetZCoordAt(x, y) == gPlayerFacingPosition.height)
|
||||||
|
{
|
||||||
|
u8 r6 = ((gUnknown_0857C608[i].y * 5) + 12) + (gUnknown_0857C608[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;
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (MetatileBehavior_IsCuttableGrass(tileBehavior) == TRUE)
|
||||||
|
gUnknown_03001108[r6] = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == TRUE)
|
||||||
|
{
|
||||||
|
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
|
||||||
|
gPostMenuFieldCallback = FieldCallback_CutGrass;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FieldCallback_CutGrass(void)
|
||||||
|
{
|
||||||
|
FieldEffectStart(FLDEFF_USE_CUT_ON_GRASS);
|
||||||
|
gFieldEffectArguments[0] = GetCursorSelectionMonId();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 FldEff_UseCutOnGrass(void)
|
||||||
|
{
|
||||||
|
u8 taskId = oei_task_add();
|
||||||
|
|
||||||
|
gTasks[taskId].data[8] = (u32)StartCutGrassFieldEffect >> 16;
|
||||||
|
gTasks[taskId].data[9] = (u32)StartCutGrassFieldEffect;
|
||||||
|
IncrementGameStat(GAME_STAT_USED_CUT);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FieldCallback_CutTree(void)
|
||||||
|
{
|
||||||
|
gFieldEffectArguments[0] = GetCursorSelectionMonId();
|
||||||
|
ScriptContext1_SetupScript(Route103_EventScript_290705);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 FldEff_UseCutOnTree(void)
|
||||||
|
{
|
||||||
|
u8 taskId = oei_task_add();
|
||||||
|
|
||||||
|
gTasks[taskId].data[8] = (u32)StartCutTreeFieldEffect >> 16;
|
||||||
|
gTasks[taskId].data[9] = (u32)StartCutTreeFieldEffect;
|
||||||
|
IncrementGameStat(GAME_STAT_USED_CUT);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartCutGrassFieldEffect(void)
|
||||||
|
{
|
||||||
|
FieldEffectActiveListRemove(FLDEFF_USE_CUT_ON_GRASS);
|
||||||
|
FieldEffectStart(FLDEFF_CUT_GRASS);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 FldEff_CutGrass(void)
|
||||||
|
{
|
||||||
|
s16 x, y;
|
||||||
|
u8 tileBehavior;
|
||||||
|
u8 i;
|
||||||
|
|
||||||
|
for (i = 0, PlaySE(SE_W015), PlayerGetDestCoords(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y); i < 25; i++)
|
||||||
|
{
|
||||||
|
if (gUnknown_03001108[i] == TRUE)
|
||||||
|
{
|
||||||
|
s8 xAdd = (i % 5) - 2;
|
||||||
|
s8 yAdd = (i / 5) - 2;
|
||||||
|
|
||||||
|
x = xAdd + gPlayerFacingPosition.x;
|
||||||
|
y = yAdd + gPlayerFacingPosition.y;
|
||||||
|
|
||||||
|
SetCutGrassMetatile(x, y);
|
||||||
|
sub_808E75C(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SetCutGrassMetatiles(gPlayerFacingPosition.x - gUnknown_03001101, gPlayerFacingPosition.y + (~gUnknown_03001102));
|
||||||
|
DrawWholeMapView();
|
||||||
|
gCutGrassSpriteArrayPtr = AllocZeroed(8);
|
||||||
|
|
||||||
|
// populate sprite ID array
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
gCutGrassSpriteArrayPtr[i] = CreateSprite(&gSpriteTemplate_CutGrass,
|
||||||
|
gSprites[gPlayerAvatar.spriteId].oam.x + 8, gSprites[gPlayerAvatar.spriteId].oam.y + 20, 0);
|
||||||
|
gSprites[gCutGrassSpriteArrayPtr[i]].data[2] = 32 * i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set map grid metatile depending on x, y
|
||||||
|
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_GRASS:
|
||||||
|
MapGridSetMetatileIdAt(x, y, METATILE_ID_GRASS);
|
||||||
|
break;
|
||||||
|
case METATILE_ID_POKE_GRASS_TREE_LEFT:
|
||||||
|
MapGridSetMetatileIdAt(x, y, METATILE_ID_GRASS_TREE_LEFT);
|
||||||
|
break;
|
||||||
|
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);
|
||||||
|
break;
|
||||||
|
case METATILE_ID_SECRET_BASE_CENTER_POKE_TALL_GRASS:
|
||||||
|
MapGridSetMetatileIdAt(x, y, METATILE_ID_SECRET_BASE_CENTER_TALL_GRASS);
|
||||||
|
break;
|
||||||
|
case METATILE_ID_SECRET_BASE_RIGHT_POKE_TALL_GRASS:
|
||||||
|
MapGridSetMetatileIdAt(x, y, METATILE_ID_SECRET_BASE_RIGHT_TALL_GRASS);
|
||||||
|
break;
|
||||||
|
case METATILE_ID_POKE_STEP_LAVA_GRASS:
|
||||||
|
case METATILE_ID_POKE_LAVA_GRASS:
|
||||||
|
MapGridSetMetatileIdAt(x, y, METATILE_ID_LAVA_FIELD);
|
||||||
|
break;
|
||||||
|
case METATILE_ID_POKE_STEP_ASH_GRASS:
|
||||||
|
case METATILE_ID_POKE_ASH_GRASS:
|
||||||
|
MapGridSetMetatileIdAt(x, y, METATILE_ID_ASH);
|
||||||
|
break;
|
||||||
|
case METATILE_ID_POKE_GRASS_TREE_UP:
|
||||||
|
MapGridSetMetatileIdAt(x, y, METATILE_ID_GRASS_TREE_UP);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
TALL_GRASS_NONE,
|
||||||
|
TALL_GRASS_FIELD,
|
||||||
|
TALL_GRASS_BASE_LEFT,
|
||||||
|
TALL_GRASS_BASE_CENTER,
|
||||||
|
TALL_GRASS_BASE_RIGHT
|
||||||
|
};
|
||||||
|
|
||||||
|
u8 GetTallGrassCaseAt(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;
|
||||||
|
else
|
||||||
|
return TALL_GRASS_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCutGrassMetatiles(s16 x, s16 y)
|
||||||
|
{
|
||||||
|
s16 i;
|
||||||
|
s16 lowerY = y + gUnknown_03001100;
|
||||||
|
|
||||||
|
for (i = 0; i < gUnknown_03001100; i++)
|
||||||
|
{
|
||||||
|
s16 currentX = x + i;
|
||||||
|
if (MapGridGetMetatileIdAt(currentX, y) == METATILE_ID_POKE_TALL_GRASS)
|
||||||
|
{
|
||||||
|
switch (GetTallGrassCaseAt(currentX, y + 1))
|
||||||
|
{
|
||||||
|
case TALL_GRASS_FIELD:
|
||||||
|
MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID_POKE_TALL_GRASS_START);
|
||||||
|
break;
|
||||||
|
case TALL_GRASS_BASE_LEFT:
|
||||||
|
MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID_SECRET_BASE_LEFT_POKE_TALL_GRASS);
|
||||||
|
break;
|
||||||
|
case TALL_GRASS_BASE_CENTER:
|
||||||
|
MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID_SECRET_BASE_CENTER_POKE_TALL_GRASS);
|
||||||
|
break;
|
||||||
|
case TALL_GRASS_BASE_RIGHT:
|
||||||
|
MapGridSetMetatileIdAt(currentX, y + 1, METATILE_ID_SECRET_BASE_RIGHT_POKE_TALL_GRASS);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (MapGridGetMetatileIdAt(currentX, lowerY) == METATILE_ID_GRASS)
|
||||||
|
{
|
||||||
|
if (MapGridGetMetatileIdAt(currentX, lowerY + 1) == METATILE_ID_POKE_TALL_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 (gUnknown_03001100 == CUT_HYPER_SIDE)
|
||||||
|
{
|
||||||
|
HandleTallGrassOnHyper(0, x, y);
|
||||||
|
HandleTallGrassOnHyper(1, x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleTallGrassOnHyper(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];
|
||||||
|
newX = x;
|
||||||
|
}
|
||||||
|
else if (caseId == 1)
|
||||||
|
{
|
||||||
|
arr[0] = gUnknown_03001108[9];
|
||||||
|
arr[1] = gUnknown_03001108[14];
|
||||||
|
arr[2] = gUnknown_03001108[19];
|
||||||
|
newX = x + 4;
|
||||||
|
}
|
||||||
|
else // invalid case
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arr[0] == TRUE)
|
||||||
|
{
|
||||||
|
if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID_POKE_TALL_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 (arr[1] == TRUE)
|
||||||
|
{
|
||||||
|
if (MapGridGetMetatileIdAt(newX, y + 2) == METATILE_ID_POKE_TALL_GRASS)
|
||||||
|
{
|
||||||
|
switch (GetTallGrassCaseAt(newX, y + 3))
|
||||||
|
{
|
||||||
|
case TALL_GRASS_FIELD:
|
||||||
|
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_POKE_TALL_GRASS_START);
|
||||||
|
break;
|
||||||
|
case TALL_GRASS_BASE_LEFT:
|
||||||
|
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_SECRET_BASE_LEFT_POKE_TALL_GRASS);
|
||||||
|
break;
|
||||||
|
case TALL_GRASS_BASE_CENTER:
|
||||||
|
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_SECRET_BASE_CENTER_POKE_TALL_GRASS);
|
||||||
|
break;
|
||||||
|
case TALL_GRASS_BASE_RIGHT:
|
||||||
|
MapGridSetMetatileIdAt(newX, y + 3, METATILE_ID_SECRET_BASE_RIGHT_POKE_TALL_GRASS);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MapGridGetMetatileIdAt(newX, y + 4) == METATILE_ID_POKE_TALL_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 (arr[2] == TRUE)
|
||||||
|
{
|
||||||
|
if (MapGridGetMetatileIdAt(newX, y + 3) == METATILE_ID_POKE_TALL_GRASS)
|
||||||
|
{
|
||||||
|
switch (GetTallGrassCaseAt(newX, y + 4))
|
||||||
|
{
|
||||||
|
case TALL_GRASS_FIELD:
|
||||||
|
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_POKE_TALL_GRASS_START);
|
||||||
|
break;
|
||||||
|
case TALL_GRASS_BASE_LEFT:
|
||||||
|
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_SECRET_BASE_LEFT_POKE_TALL_GRASS);
|
||||||
|
break;
|
||||||
|
case TALL_GRASS_BASE_CENTER:
|
||||||
|
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_SECRET_BASE_CENTER_POKE_TALL_GRASS);
|
||||||
|
break;
|
||||||
|
case TALL_GRASS_BASE_RIGHT:
|
||||||
|
MapGridSetMetatileIdAt(newX, y + 4, METATILE_ID_SECRET_BASE_RIGHT_POKE_TALL_GRASS);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CutGrassSpriteCallback1(struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
sprite->data[0] = 8;
|
||||||
|
sprite->data[1] = 0;
|
||||||
|
sprite->data[3] = 0;
|
||||||
|
sprite->callback = CutGrassSpriteCallback2;
|
||||||
|
}
|
||||||
|
|
||||||
|
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]);
|
||||||
|
|
||||||
|
sprite->data[2] = (sprite->data[2] + 8) & 0xFF;
|
||||||
|
sprite->data[0] += 1 + (sprite->data[3] >> 2); // right shift by 2 is dividing by 4
|
||||||
|
sprite->data[3]++;
|
||||||
|
|
||||||
|
if (sprite->data[1] != 28)
|
||||||
|
sprite->data[1]++;
|
||||||
|
else
|
||||||
|
sprite->callback = CutGrassSpriteCallbackEnd; // done rotating the grass, execute clean up function
|
||||||
|
}
|
||||||
|
@ -78,14 +78,14 @@ bool8 SetUpFieldMove_Flash(void)
|
|||||||
if (ShouldDoBrailleFlyEffect())
|
if (ShouldDoBrailleFlyEffect())
|
||||||
{
|
{
|
||||||
gSpecialVar_Result = GetCursorSelectionMonId();
|
gSpecialVar_Result = GetCursorSelectionMonId();
|
||||||
gUnknown_03005DB0 = FieldCallback_Teleport;
|
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
|
||||||
gUnknown_0203CEEC = sub_8179918;
|
gPostMenuFieldCallback = sub_8179918;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (gMapHeader.cave == TRUE && !FlagGet(FLAG_SYS_USE_FLASH))
|
else if (gMapHeader.cave == TRUE && !FlagGet(FLAG_SYS_USE_FLASH))
|
||||||
{
|
{
|
||||||
gUnknown_03005DB0 = FieldCallback_Teleport;
|
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
|
||||||
gUnknown_0203CEEC = hm2_flash;
|
gPostMenuFieldCallback = hm2_flash;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,11 +14,11 @@ static void sub_8145E74(void);
|
|||||||
// text
|
// text
|
||||||
bool8 SetUpFieldMove_Strength(void)
|
bool8 SetUpFieldMove_Strength(void)
|
||||||
{
|
{
|
||||||
if (npc_before_player_of_type(87) == TRUE)
|
if (SetLastTalkedObjectInFrontOfPlayer(87) == TRUE)
|
||||||
{
|
{
|
||||||
gSpecialVar_Result = GetCursorSelectionMonId();
|
gSpecialVar_Result = GetCursorSelectionMonId();
|
||||||
gUnknown_03005DB0 = FieldCallback_Teleport;
|
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
|
||||||
gUnknown_0203CEEC = FldEff_UseStrength;
|
gPostMenuFieldCallback = FldEff_UseStrength;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -24,8 +24,8 @@ void sub_81BE72C(void);
|
|||||||
|
|
||||||
bool8 SetUpFieldMove_SweetScent(void)
|
bool8 SetUpFieldMove_SweetScent(void)
|
||||||
{
|
{
|
||||||
gUnknown_03005DB0 = FieldCallback_Teleport;
|
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
|
||||||
gUnknown_0203CEEC = hm2_sweet_scent;
|
gPostMenuFieldCallback = hm2_sweet_scent;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ bool8 SetUpFieldMove_Teleport(void)
|
|||||||
{
|
{
|
||||||
if (Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType) == TRUE)
|
if (Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType) == TRUE)
|
||||||
{
|
{
|
||||||
gUnknown_03005DB0 = FieldCallback_Teleport;
|
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
|
||||||
gUnknown_0203CEEC = hm_teleport_run_dp02scr;
|
gPostMenuFieldCallback = hm_teleport_run_dp02scr;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -846,7 +846,7 @@ bool8 MetatileBehavior_IsBerryTreeSoil(u8 var)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 MetatileBehavior_IsAsh(u8 var)
|
bool8 MetatileBehavior_IsAshGrass(u8 var)
|
||||||
{
|
{
|
||||||
if (var == MB_ASHGRASS)
|
if (var == MB_ASHGRASS)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -88,7 +88,7 @@ extern const u16 gUnknown_82EC7C4[];
|
|||||||
|
|
||||||
u16 gUnknown_03005DA8;
|
u16 gUnknown_03005DA8;
|
||||||
MainCallback gFieldCallback;
|
MainCallback gFieldCallback;
|
||||||
bool8 (*gUnknown_03005DB0)(void);
|
bool8 (*gFieldCallback2)(void);
|
||||||
u8 gUnknown_03005DB4;
|
u8 gUnknown_03005DB4;
|
||||||
u8 gFieldLinkPlayerCount;
|
u8 gFieldLinkPlayerCount;
|
||||||
|
|
||||||
@ -1518,15 +1518,15 @@ void sub_8085E94(void *a0)
|
|||||||
|
|
||||||
static bool8 map_post_load_hook_exec(void)
|
static bool8 map_post_load_hook_exec(void)
|
||||||
{
|
{
|
||||||
if (gUnknown_03005DB0 != NULL)
|
if (gFieldCallback2 != NULL)
|
||||||
{
|
{
|
||||||
if (!gUnknown_03005DB0())
|
if (!gFieldCallback2())
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gUnknown_03005DB0 = NULL;
|
gFieldCallback2 = NULL;
|
||||||
gFieldCallback = NULL;
|
gFieldCallback = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1554,7 +1554,7 @@ void CB2_NewGame(void)
|
|||||||
ScriptContext1_Init();
|
ScriptContext1_Init();
|
||||||
ScriptContext2_Disable();
|
ScriptContext2_Disable();
|
||||||
gFieldCallback = ExecuteTruckSequence;
|
gFieldCallback = ExecuteTruckSequence;
|
||||||
gUnknown_03005DB0 = NULL;
|
gFieldCallback2 = NULL;
|
||||||
do_load_map_stuff_loop(&gMain.state);
|
do_load_map_stuff_loop(&gMain.state);
|
||||||
SetFieldVBlankCallback();
|
SetFieldVBlankCallback();
|
||||||
SetMainCallback1(CB1_Overworld);
|
SetMainCallback1(CB1_Overworld);
|
||||||
@ -1684,7 +1684,7 @@ void c2_8056854(void)
|
|||||||
void CB2_ReturnToFieldWithOpenMenu(void)
|
void CB2_ReturnToFieldWithOpenMenu(void)
|
||||||
{
|
{
|
||||||
FieldClearVBlankHBlankCallbacks();
|
FieldClearVBlankHBlankCallbacks();
|
||||||
gUnknown_03005DB0 = sub_80AF6A4;
|
gFieldCallback2 = sub_80AF6A4;
|
||||||
CB2_ReturnToField();
|
CB2_ReturnToField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
26
src/rom6.c
26
src/rom6.c
@ -27,16 +27,16 @@ static void hm2_dig(void);
|
|||||||
static void sub_8135780(void);
|
static void sub_8135780(void);
|
||||||
|
|
||||||
// extern RAM loc
|
// extern RAM loc
|
||||||
extern struct MapPosition gUnknown_0203AB40;
|
extern struct MapPosition gPlayerFacingPosition;
|
||||||
|
|
||||||
// text
|
// text
|
||||||
bool8 npc_before_player_of_type(u8 a)
|
bool8 SetLastTalkedObjectInFrontOfPlayer(u8 a)
|
||||||
{
|
{
|
||||||
u8 eventObjId;
|
u8 eventObjId;
|
||||||
|
|
||||||
GetXYCoordsOneStepInFrontOfPlayer(&gUnknown_0203AB40.x, &gUnknown_0203AB40.y);
|
GetXYCoordsOneStepInFrontOfPlayer(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y);
|
||||||
gUnknown_0203AB40.height = PlayerGetZCoord();
|
gPlayerFacingPosition.height = PlayerGetZCoord();
|
||||||
eventObjId = GetEventObjectIdByXYZ(gUnknown_0203AB40.x, gUnknown_0203AB40.y, gUnknown_0203AB40.height);
|
eventObjId = GetEventObjectIdByXYZ(gPlayerFacingPosition.x, gPlayerFacingPosition.y, gPlayerFacingPosition.height);
|
||||||
if (gEventObjects[eventObjId].graphicsId != a)
|
if (gEventObjects[eventObjId].graphicsId != a)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -50,7 +50,7 @@ bool8 npc_before_player_of_type(u8 a)
|
|||||||
|
|
||||||
u8 oei_task_add(void)
|
u8 oei_task_add(void)
|
||||||
{
|
{
|
||||||
GetXYCoordsOneStepInFrontOfPlayer(&gUnknown_0203AB40.x, &gUnknown_0203AB40.y);
|
GetXYCoordsOneStepInFrontOfPlayer(&gPlayerFacingPosition.x, &gPlayerFacingPosition.y);
|
||||||
return CreateTask(task08_080C9820, 8);
|
return CreateTask(task08_080C9820, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,14 +121,14 @@ bool8 SetUpFieldMove_RockSmash(void)
|
|||||||
if(ShouldDoBrailleStrengthEffect())
|
if(ShouldDoBrailleStrengthEffect())
|
||||||
{
|
{
|
||||||
gSpecialVar_Result = GetCursorSelectionMonId();
|
gSpecialVar_Result = GetCursorSelectionMonId();
|
||||||
gUnknown_03005DB0 = FieldCallback_Teleport;
|
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
|
||||||
gUnknown_0203CEEC = sub_8179834;
|
gPostMenuFieldCallback = sub_8179834;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (npc_before_player_of_type(0x56) == TRUE)
|
else if (SetLastTalkedObjectInFrontOfPlayer(0x56) == TRUE)
|
||||||
{
|
{
|
||||||
gUnknown_03005DB0 = FieldCallback_Teleport;
|
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
|
||||||
gUnknown_0203CEEC = sub_81356C4;
|
gPostMenuFieldCallback = sub_81356C4;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -164,8 +164,8 @@ bool8 SetUpFieldMove_Dig(void)
|
|||||||
{
|
{
|
||||||
if (CanUseEscapeRopeOnCurrMap() == TRUE)
|
if (CanUseEscapeRopeOnCurrMap() == TRUE)
|
||||||
{
|
{
|
||||||
gUnknown_03005DB0 = FieldCallback_Teleport;
|
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
|
||||||
gUnknown_0203CEEC = hm2_dig;
|
gPostMenuFieldCallback = hm2_dig;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -530,7 +530,7 @@ void sub_809FA18(void) // Called from field_screen.s
|
|||||||
{
|
{
|
||||||
sUnknown_02037619[0] = 0;
|
sUnknown_02037619[0] = 0;
|
||||||
sUnknown_02037619[1] = 0;
|
sUnknown_02037619[1] = 0;
|
||||||
gUnknown_03005DB0 = sub_809FA00;
|
gFieldCallback2 = sub_809FA00;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_809FA34(u8 taskId) // Referenced in field_screen.s and rom_8011DC0.s
|
void sub_809FA34(u8 taskId) // Referenced in field_screen.s and rom_8011DC0.s
|
||||||
|
Loading…
Reference in New Issue
Block a user