mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Decompile fldeff_sweetsecent.c
This commit is contained in:
parent
c959dc1174
commit
deeaac2bf1
@ -1,220 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start SetUpFieldMove_SweetScent
|
||||
SetUpFieldMove_SweetScent: @ 8159EF0
|
||||
ldr r1, =gUnknown_03005DB0
|
||||
ldr r0, =FieldCallback_Teleport
|
||||
str r0, [r1]
|
||||
ldr r1, =gUnknown_0203CEEC
|
||||
ldr r0, =hm2_sweet_scent
|
||||
str r0, [r1]
|
||||
movs r0, 0x1
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end SetUpFieldMove_SweetScent
|
||||
|
||||
thumb_func_start hm2_sweet_scent
|
||||
hm2_sweet_scent: @ 8159F10
|
||||
push {lr}
|
||||
movs r0, 0x33
|
||||
bl FieldEffectStart
|
||||
bl GetCursorSelectionMonId
|
||||
ldr r1, =gFieldEffectArguments
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
str r0, [r1]
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end hm2_sweet_scent
|
||||
|
||||
thumb_func_start FldEff_SweetScent
|
||||
FldEff_SweetScent: @ 8159F2C
|
||||
push {lr}
|
||||
bl sub_80AC3D0
|
||||
bl oei_task_add
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
ldr r2, =gTasks
|
||||
lsls r1, r0, 2
|
||||
adds r1, r0
|
||||
lsls r1, 3
|
||||
adds r1, r2
|
||||
ldr r2, =sub_8159F5C
|
||||
lsrs r0, r2, 16
|
||||
strh r0, [r1, 0x18]
|
||||
strh r2, [r1, 0x1A]
|
||||
movs r0, 0
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end FldEff_SweetScent
|
||||
|
||||
thumb_func_start sub_8159F5C
|
||||
sub_8159F5C: @ 8159F5C
|
||||
push {r4,r5,lr}
|
||||
sub sp, 0x4
|
||||
movs r0, 0xEC
|
||||
bl PlaySE
|
||||
ldr r5, =gPlttBufferUnfaded
|
||||
ldr r1, =gPaletteDecompressionBuffer
|
||||
movs r4, 0x80
|
||||
lsls r4, 1
|
||||
adds r0, r5, 0
|
||||
adds r2, r4, 0
|
||||
bl CpuFastSet
|
||||
ldr r0, =gPlttBufferFaded
|
||||
adds r1, r5, 0
|
||||
adds r2, r4, 0
|
||||
bl CpuFastSet
|
||||
bl GetPlayerAvatarObjectId
|
||||
ldr r2, =gSprites
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r1, r0, 4
|
||||
adds r1, r0
|
||||
lsls r1, 2
|
||||
adds r1, r2
|
||||
ldrb r1, [r1, 0x5]
|
||||
lsrs r1, 4
|
||||
adds r1, 0x10
|
||||
movs r0, 0x1
|
||||
lsls r0, r1
|
||||
mvns r0, r0
|
||||
movs r1, 0x1F
|
||||
str r1, [sp]
|
||||
movs r1, 0x4
|
||||
movs r2, 0
|
||||
movs r3, 0x8
|
||||
bl BeginNormalPaletteFade
|
||||
ldr r0, =sub_8159FEC
|
||||
movs r1, 0
|
||||
bl CreateTask
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
ldr r2, =gTasks
|
||||
lsls r1, r0, 2
|
||||
adds r1, r0
|
||||
lsls r1, 3
|
||||
adds r1, r2
|
||||
movs r0, 0
|
||||
strh r0, [r1, 0x8]
|
||||
movs r0, 0x33
|
||||
bl FieldEffectActiveListRemove
|
||||
add sp, 0x4
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8159F5C
|
||||
|
||||
thumb_func_start sub_8159FEC
|
||||
sub_8159FEC: @ 8159FEC
|
||||
push {r4-r6,lr}
|
||||
sub sp, 0x4
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
ldr r0, =gPaletteFade
|
||||
ldrb r1, [r0, 0x7]
|
||||
movs r0, 0x80
|
||||
ands r0, r1
|
||||
lsls r0, 24
|
||||
lsrs r6, r0, 24
|
||||
cmp r6, 0
|
||||
bne _0815A088
|
||||
bl sub_81BE72C
|
||||
movs r0, 0x40
|
||||
movs r1, 0x8
|
||||
movs r2, 0x1F
|
||||
bl BlendPalettes
|
||||
ldr r0, =gTasks
|
||||
lsls r1, r5, 2
|
||||
adds r1, r5
|
||||
lsls r1, 3
|
||||
adds r4, r1, r0
|
||||
ldrh r1, [r4, 0x8]
|
||||
movs r2, 0x8
|
||||
ldrsh r0, [r4, r2]
|
||||
cmp r0, 0x40
|
||||
bne _0815A084
|
||||
strh r6, [r4, 0x8]
|
||||
bl SweetScentWildEncounter
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bne _0815A044
|
||||
adds r0, r5, 0
|
||||
bl DestroyTask
|
||||
b _0815A088
|
||||
.pool
|
||||
_0815A044:
|
||||
ldr r0, =sub_815A090
|
||||
str r0, [r4]
|
||||
bl GetPlayerAvatarObjectId
|
||||
ldr r2, =gSprites
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r1, r0, 4
|
||||
adds r1, r0
|
||||
lsls r1, 2
|
||||
adds r1, r2
|
||||
ldrb r1, [r1, 0x5]
|
||||
lsrs r1, 4
|
||||
adds r1, 0x10
|
||||
movs r0, 0x1
|
||||
lsls r0, r1
|
||||
mvns r0, r0
|
||||
movs r1, 0x1F
|
||||
str r1, [sp]
|
||||
movs r1, 0x4
|
||||
movs r2, 0x8
|
||||
movs r3, 0
|
||||
bl BeginNormalPaletteFade
|
||||
bl sub_81BE6B8
|
||||
b _0815A088
|
||||
.pool
|
||||
_0815A084:
|
||||
adds r0, r1, 0x1
|
||||
strh r0, [r4, 0x8]
|
||||
_0815A088:
|
||||
add sp, 0x4
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_8159FEC
|
||||
|
||||
thumb_func_start sub_815A090
|
||||
sub_815A090: @ 815A090
|
||||
push {r4,lr}
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldr r0, =gPaletteFade
|
||||
ldrb r1, [r0, 0x7]
|
||||
movs r0, 0x80
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0815A0BE
|
||||
ldr r0, =gPaletteDecompressionBuffer
|
||||
ldr r1, =gPlttBufferUnfaded
|
||||
movs r2, 0x80
|
||||
lsls r2, 1
|
||||
bl CpuFastSet
|
||||
bl sub_80AC3E4
|
||||
ldr r0, =EventScript_290CAE
|
||||
bl ScriptContext1_SetupScript
|
||||
adds r0, r4, 0
|
||||
bl DestroyTask
|
||||
_0815A0BE:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_815A090
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
||||
|
@ -382,4 +382,5 @@ extern const u8 SecretBase_RedCave1_Text_2754F6[];
|
||||
extern const u8 SecretBase_RedCave1_Text_2758CC[];
|
||||
|
||||
extern const u8 FieryPath_EventScript_2908FD[];
|
||||
extern const u8 EventScript_290CAE[];
|
||||
#endif //GUARD_EVENT_SCRIPTS_H
|
||||
|
@ -5,6 +5,7 @@ void ClearPlayerAvatarInfo(void);
|
||||
void SetPlayerAvatarExtraStateTransition(u8, u8);
|
||||
u8 GetPlayerAvatarGenderByGraphicsId(u8);
|
||||
bool8 TestPlayerAvatarFlags(u8);
|
||||
u8 GetPlayerAvatarObjectId(void);
|
||||
void PlayerGetDestCoords(s16 *, s16 *);
|
||||
u8 player_get_direction_lower_nybble(void);
|
||||
u8 player_get_direction_upper_nybble(void);
|
||||
|
@ -207,7 +207,7 @@ SECTIONS {
|
||||
asm/contest_ai.o(.text);
|
||||
asm/battle_anim_sound_tasks.o(.text);
|
||||
src/battle_controller_safari.o(.text);
|
||||
asm/fldeff_sweetscent.o(.text);
|
||||
src/fldeff_sweetscent.o(.text);
|
||||
asm/battle_anim_815A0D4.o(.text);
|
||||
asm/learn_move.o(.text);
|
||||
asm/fldeff_softboiled.o(.text);
|
||||
|
98
src/fldeff_sweetscent.c
Normal file
98
src/fldeff_sweetscent.c
Normal file
@ -0,0 +1,98 @@
|
||||
#include "global.h"
|
||||
#include "event_data.h"
|
||||
#include "event_scripts.h"
|
||||
#include "field_effect.h"
|
||||
#include "field_player_avatar.h"
|
||||
#include "palette.h"
|
||||
#include "party_menu.h"
|
||||
#include "rom6.h"
|
||||
#include "script.h"
|
||||
#include "sound.h"
|
||||
#include "sprite.h"
|
||||
#include "task.h"
|
||||
#include "wild_encounter.h"
|
||||
|
||||
extern void sub_81BE72C(void);
|
||||
extern void sub_81BE6B8(void);
|
||||
extern void sub_80AC3D0(void);
|
||||
extern void sub_80AC3E4(void);
|
||||
|
||||
void hm2_sweet_scent(void);
|
||||
void sub_8159F5C(void);
|
||||
void sub_8159FEC(u8 taskId);
|
||||
void sub_815A090(u8 taskId);
|
||||
|
||||
bool8 SetUpFieldMove_SweetScent(void)
|
||||
{
|
||||
gUnknown_03005DB0 = FieldCallback_Teleport;
|
||||
gUnknown_0203CEEC = hm2_sweet_scent;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void hm2_sweet_scent(void)
|
||||
{
|
||||
FieldEffectStart(FLDEFF_SWEET_SCENT);
|
||||
gFieldEffectArguments[0] = GetCursorSelectionMonId();
|
||||
}
|
||||
|
||||
bool8 FldEff_SweetScent()
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
sub_80AC3D0();
|
||||
taskId = oei_task_add();
|
||||
gTasks[taskId].data[8] = (u32)sub_8159F5C >> 16;
|
||||
gTasks[taskId].data[9] = (u32)sub_8159F5C;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_8159F5C(void)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
PlaySE(0xEC);
|
||||
CpuFastSet(gPlttBufferUnfaded, gPaletteDecompressionBuffer, 0x100);
|
||||
CpuFastSet(gPlttBufferFaded, gPlttBufferUnfaded, 0x100);
|
||||
BeginNormalPaletteFade(~(1 << (gSprites[GetPlayerAvatarObjectId()].oam.paletteNum + 16)), 4, 0, 8, 0x1F);
|
||||
taskId = CreateTask(sub_8159FEC, 0);
|
||||
gTasks[taskId].data[0] = 0;
|
||||
FieldEffectActiveListRemove(FLDEFF_SWEET_SCENT);
|
||||
}
|
||||
|
||||
void sub_8159FEC(u8 taskId)
|
||||
{
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
sub_81BE72C();
|
||||
BlendPalettes(64, 8, 0x1F);
|
||||
if (gTasks[taskId].data[0] == 64)
|
||||
{
|
||||
gTasks[taskId].data[0] = 0;
|
||||
if (SweetScentWildEncounter() == TRUE)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
else
|
||||
{
|
||||
gTasks[taskId].func = sub_815A090;
|
||||
BeginNormalPaletteFade(~(1 << (gSprites[GetPlayerAvatarObjectId()].oam.paletteNum + 16)), 4, 8, 0, 0x1F);
|
||||
sub_81BE6B8();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gTasks[taskId].data[0]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_815A090(u8 taskId)
|
||||
{
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
CpuFastSet(gPaletteDecompressionBuffer, gPlttBufferUnfaded, 0x100);
|
||||
sub_80AC3E4();
|
||||
ScriptContext1_SetupScript(EventScript_290CAE);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user