mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Begin porting field_effect
This commit is contained in:
parent
279276c539
commit
80062972ae
1941
asm/field_effect.s
1941
asm/field_effect.s
File diff suppressed because it is too large
Load Diff
@ -204,7 +204,7 @@ _0815405A:
|
|||||||
bl pal_patch_for_npc
|
bl pal_patch_for_npc
|
||||||
_0815406A:
|
_0815406A:
|
||||||
adds r0, r4, 0
|
adds r0, r4, 0
|
||||||
bl sub_80ABE18
|
bl UpdateSpritePaletteWithWeather
|
||||||
_08154070:
|
_08154070:
|
||||||
pop {r4}
|
pop {r4}
|
||||||
pop {r0}
|
pop {r0}
|
||||||
@ -227,7 +227,7 @@ npc_pal_op_A: @ 8154078
|
|||||||
adds r1, r4, 0
|
adds r1, r4, 0
|
||||||
bl pal_patch_for_npc
|
bl pal_patch_for_npc
|
||||||
adds r0, r4, 0
|
adds r0, r4, 0
|
||||||
bl sub_80ABE18
|
bl UpdateSpritePaletteWithWeather
|
||||||
_0815409C:
|
_0815409C:
|
||||||
pop {r4}
|
pop {r4}
|
||||||
pop {r0}
|
pop {r0}
|
||||||
|
@ -1779,9 +1779,9 @@ sub_80ABDFC: @ 80ABDFC
|
|||||||
.pool
|
.pool
|
||||||
thumb_func_end sub_80ABDFC
|
thumb_func_end sub_80ABDFC
|
||||||
|
|
||||||
thumb_func_start sub_80ABE18
|
thumb_func_start UpdateSpritePaletteWithWeather
|
||||||
@ void sub_80ABE18(u8 a1)
|
@ void UpdateSpritePaletteWithWeather(u8 a1)
|
||||||
sub_80ABE18: @ 80ABE18
|
UpdateSpritePaletteWithWeather: @ 80ABE18
|
||||||
push {r4-r6,lr}
|
push {r4-r6,lr}
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
lsrs r0, 8
|
lsrs r0, 8
|
||||||
@ -1882,7 +1882,7 @@ _080ABEF4:
|
|||||||
pop {r0}
|
pop {r0}
|
||||||
bx r0
|
bx r0
|
||||||
.pool
|
.pool
|
||||||
thumb_func_end sub_80ABE18
|
thumb_func_end UpdateSpritePaletteWithWeather
|
||||||
|
|
||||||
thumb_func_start ApplyWeatherGammaShiftToPal
|
thumb_func_start ApplyWeatherGammaShiftToPal
|
||||||
ApplyWeatherGammaShiftToPal: @ 80ABF00
|
ApplyWeatherGammaShiftToPal: @ 80ABF00
|
||||||
@ -1939,7 +1939,7 @@ sub_80ABF4C: @ 80ABF4C
|
|||||||
movs r2, 0x20
|
movs r2, 0x20
|
||||||
bl LoadPalette
|
bl LoadPalette
|
||||||
ldrb r0, [r4]
|
ldrb r0, [r4]
|
||||||
bl sub_80ABE18
|
bl UpdateSpritePaletteWithWeather
|
||||||
pop {r4}
|
pop {r4}
|
||||||
pop {r0}
|
pop {r0}
|
||||||
bx r0
|
bx r0
|
||||||
@ -2504,8 +2504,8 @@ sub_80AC3E4: @ 80AC3E4
|
|||||||
.pool
|
.pool
|
||||||
thumb_func_end sub_80AC3E4
|
thumb_func_end sub_80AC3E4
|
||||||
|
|
||||||
thumb_func_start sub_80AC3F8
|
thumb_func_start PreservePaletteInWeather
|
||||||
sub_80AC3F8: @ 80AC3F8
|
PreservePaletteInWeather: @ 80AC3F8
|
||||||
push {r4,r5,lr}
|
push {r4,r5,lr}
|
||||||
adds r4, r0, 0
|
adds r4, r0, 0
|
||||||
lsls r4, 24
|
lsls r4, 24
|
||||||
@ -2524,16 +2524,16 @@ sub_80AC3F8: @ 80AC3F8
|
|||||||
pop {r0}
|
pop {r0}
|
||||||
bx r0
|
bx r0
|
||||||
.pool
|
.pool
|
||||||
thumb_func_end sub_80AC3F8
|
thumb_func_end PreservePaletteInWeather
|
||||||
|
|
||||||
thumb_func_start sub_80AC428
|
thumb_func_start ResetPreservedPalettesInWeather
|
||||||
sub_80AC428: @ 80AC428
|
ResetPreservedPalettesInWeather: @ 80AC428
|
||||||
ldr r1, =gUnknown_03000F50
|
ldr r1, =gUnknown_03000F50
|
||||||
ldr r0, =gUnknown_0854C250
|
ldr r0, =gUnknown_0854C250
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
bx lr
|
bx lr
|
||||||
.pool
|
.pool
|
||||||
thumb_func_end sub_80AC428
|
thumb_func_end ResetPreservedPalettesInWeather
|
||||||
|
|
||||||
thumb_func_start sub_80AC438
|
thumb_func_start sub_80AC438
|
||||||
sub_80AC438: @ 80AC438
|
sub_80AC438: @ 80AC438
|
||||||
|
@ -26676,7 +26676,7 @@ _081D4B3A:
|
|||||||
bl IndexOfSpritePaletteTag
|
bl IndexOfSpritePaletteTag
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
lsrs r0, 24
|
lsrs r0, 24
|
||||||
bl sub_80ABE18
|
bl UpdateSpritePaletteWithWeather
|
||||||
ldrh r1, [r5, 0x10]
|
ldrh r1, [r5, 0x10]
|
||||||
mov r0, sp
|
mov r0, sp
|
||||||
strh r1, [r0]
|
strh r1, [r0]
|
||||||
|
@ -1316,7 +1316,7 @@ _080E28CA:
|
|||||||
ldr r1, =gSprites
|
ldr r1, =gSprites
|
||||||
adds r0, r1
|
adds r0, r1
|
||||||
ldrb r1, [r4, 0xC]
|
ldrb r1, [r4, 0xC]
|
||||||
bl sub_80B6070
|
bl FreeResourcesAndDestroySprite
|
||||||
_080E28DE:
|
_080E28DE:
|
||||||
ldrh r0, [r4, 0x8]
|
ldrh r0, [r4, 0x8]
|
||||||
adds r0, 0x1
|
adds r0, 0x1
|
||||||
@ -1363,7 +1363,7 @@ ScriptMenu_ShowPokemonPic: @ 80E2900
|
|||||||
asrs r2, 16
|
asrs r2, 16
|
||||||
mov r0, r8
|
mov r0, r8
|
||||||
movs r3, 0
|
movs r3, 0
|
||||||
bl sub_80B5F84
|
bl CreateMonSprite_PicBox
|
||||||
adds r5, r0, 0
|
adds r5, r0, 0
|
||||||
lsls r5, 24
|
lsls r5, 24
|
||||||
lsrs r5, 24
|
lsrs r5, 24
|
||||||
|
@ -5583,7 +5583,7 @@ _0812D08E:
|
|||||||
lsrs r3, 24
|
lsrs r3, 24
|
||||||
adds r1, r3, 0
|
adds r1, r3, 0
|
||||||
adds r2, r3, 0
|
adds r2, r3, 0
|
||||||
bl sub_80B6128
|
bl MultiplyPaletteRGBComponents
|
||||||
_0812D0A6:
|
_0812D0A6:
|
||||||
pop {r4-r7}
|
pop {r4-r7}
|
||||||
pop {r0}
|
pop {r0}
|
||||||
|
@ -81,7 +81,7 @@ gUnknown_0855C170:: @ 855C170
|
|||||||
.incbin "graphics/unknown/unknown_55C170.4bpp"
|
.incbin "graphics/unknown/unknown_55C170.4bpp"
|
||||||
|
|
||||||
.align 2
|
.align 2
|
||||||
gUnknown_0855C1F0:: @ 855C1F0
|
gFieldEffectScriptFuncs:: @ 855C1F0
|
||||||
.4byte FieldEffectCmd_loadtiles
|
.4byte FieldEffectCmd_loadtiles
|
||||||
.4byte FieldEffectCmd_loadfadedpal
|
.4byte FieldEffectCmd_loadfadedpal
|
||||||
.4byte FieldEffectCmd_loadpal
|
.4byte FieldEffectCmd_loadpal
|
||||||
@ -196,45 +196,45 @@ gUnknown_0855C300:: @ 855C300
|
|||||||
.4byte gUnknown_0855C2CC
|
.4byte gUnknown_0855C2CC
|
||||||
|
|
||||||
.align 2
|
.align 2
|
||||||
gUnknown_0855C304:: @ 855C304
|
gSpriteTemplate_855C304:: @ 855C304
|
||||||
spr_template 0xffff, 0x1007, gOamData_855C218, gUnknown_0855C2F8, gUnknown_855C274, gDummySpriteAffineAnimTable, sub_80B6828
|
spr_template 0xffff, 0x1007, gOamData_855C218, gUnknown_0855C2F8, gUnknown_855C274, gDummySpriteAffineAnimTable, SpriteCB_PokeballGlow
|
||||||
|
|
||||||
.align 2
|
.align 2
|
||||||
gUnknown_0855C31C:: @ 855C31C
|
gSpriteTemplate_855C31C:: @ 855C31C
|
||||||
spr_template 0xffff, 0x1004, gOamData_855C220, gUnknown_0855C2F8, gUnknown_855C27C, gDummySpriteAffineAnimTable, sub_80B68AC
|
spr_template 0xffff, 0x1004, gOamData_855C220, gUnknown_0855C2F8, gUnknown_855C27C, gDummySpriteAffineAnimTable, SpriteCB_PokecenterMonitor
|
||||||
|
|
||||||
.align 2
|
.align 2
|
||||||
gUnknown_0855C334:: @ 855C334
|
gSpriteTemplate_855C334:: @ 855C334
|
||||||
spr_template 0xffff, 0x1010, gOamData_855C220, gUnknown_0855C300, gUnknown_855C28C, gDummySpriteAffineAnimTable, sub_80B6970
|
spr_template 0xffff, 0x1010, gOamData_855C220, gUnknown_0855C300, gUnknown_855C28C, gDummySpriteAffineAnimTable, SpriteCB_HallOfFameMonitor
|
||||||
|
|
||||||
.align 2
|
.align 2
|
||||||
gUnknown_0855C34C:: @ 855C34C
|
gSpriteTemplate_855C34C:: @ 855C34C
|
||||||
spr_template 0xffff, 0x1010, gOamData_855C26C, gUnknown_0855C300, gUnknown_855C294, gDummySpriteAffineAnimTable, sub_80B6970
|
spr_template 0xffff, 0x1010, gOamData_855C26C, gUnknown_0855C300, gUnknown_855C294, gDummySpriteAffineAnimTable, SpriteCB_HallOfFameMonitor
|
||||||
|
|
||||||
.align 2
|
.align 2
|
||||||
gUnknown_0855C364:: @ 855C364
|
gUnknown_0855C364:: @ 855C364
|
||||||
.4byte sub_80B6214
|
.4byte PokecenterHealEffect_0
|
||||||
.4byte sub_80B6250
|
.4byte PokecenterHealEffect_1
|
||||||
.4byte sub_80B628C
|
.4byte PokecenterHealEffect_2
|
||||||
.4byte sub_80B62B4
|
.4byte PokecenterHealEffect_3
|
||||||
|
|
||||||
.align 2
|
.align 2
|
||||||
gUnknown_0855C374:: @ 855C374
|
gUnknown_0855C374:: @ 855C374
|
||||||
.4byte sub_80B6360
|
.4byte HallOfFameRecordEffect_0
|
||||||
.4byte sub_80B63D4
|
.4byte HallOfFameRecordEffect_1
|
||||||
.4byte sub_80B6404
|
.4byte HallOfFameRecordEffect_2
|
||||||
.4byte sub_80B642C
|
.4byte HallOfFameRecordEffect_3
|
||||||
|
|
||||||
.align 2
|
.align 2
|
||||||
gUnknown_0855C384:: @ 855C384
|
gUnknown_0855C384:: @ 855C384
|
||||||
.4byte sub_80B64DC
|
.4byte PokeballGlowEffect_0
|
||||||
.4byte sub_80B6574
|
.4byte PokeballGlowEffect_1
|
||||||
.4byte sub_80B65A8
|
.4byte PokeballGlowEffect_2
|
||||||
.4byte sub_80B66E8
|
.4byte PokeballGlowEffect_3
|
||||||
.4byte sub_80B67DC
|
.4byte PokeballGlowEffect_4
|
||||||
.4byte sub_80B67F8
|
.4byte PokeballGlowEffect_5
|
||||||
.4byte sub_80B6800
|
.4byte PokeballGlowEffect_6
|
||||||
.4byte nullsub_97
|
.4byte PokeballGlowEffect_7
|
||||||
|
|
||||||
.align 1
|
.align 1
|
||||||
gUnknown_0855C3A4:: @ 855C3A4
|
gUnknown_0855C3A4:: @ 855C3A4
|
||||||
|
@ -175,7 +175,7 @@ gFieldEffectScript_DeepSandFootprints:: @ 82DBBAC
|
|||||||
|
|
||||||
gFieldEffectScript_Unknown25:: @ 82DBBB6
|
gFieldEffectScript_Unknown25:: @ 82DBBB6
|
||||||
field_eff_loadfadedpal gFieldEffectObjectPaletteInfo4
|
field_eff_loadfadedpal gFieldEffectObjectPaletteInfo4
|
||||||
field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, sub_80B61A0
|
field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_PokecenterHeal
|
||||||
field_eff_end
|
field_eff_end
|
||||||
|
|
||||||
gFieldEffectScript_Unknown26:: @ 82DBBC5
|
gFieldEffectScript_Unknown26:: @ 82DBBC5
|
||||||
@ -325,7 +325,7 @@ gFieldEffectScript_Unknown61:: @ 82DBCD8
|
|||||||
|
|
||||||
gFieldEffectScript_Unknown62:: @ 82DBCDE
|
gFieldEffectScript_Unknown62:: @ 82DBCDE
|
||||||
field_eff_loadfadedpal gFieldEffectObjectPaletteInfo4
|
field_eff_loadfadedpal gFieldEffectObjectPaletteInfo4
|
||||||
field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo5, sub_80B62F4
|
field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo5, FldEff_HallOfFameRecord
|
||||||
field_eff_end
|
field_eff_end
|
||||||
|
|
||||||
gFieldEffectScript_Unknown63:: @ 82DBCED
|
gFieldEffectScript_Unknown63:: @ 82DBCED
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
#ifndef GUARD_FIELD_EFFECTS_H
|
#ifndef GUARD_FIELD_EFFECTS_H
|
||||||
#define GUARD_FIELD_EFFECTS_H
|
#define GUARD_FIELD_EFFECTS_H
|
||||||
|
|
||||||
|
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[2];
|
||||||
|
extern const struct SpritePalette gNewGameBirchObjectPaletteInfo;
|
||||||
|
extern const struct CompressedSpriteSheet gTrainerFrontPicTable[2];
|
||||||
|
extern const struct SpriteTemplate gNewGameBirchObjectTemplate;
|
||||||
|
extern const struct OamData gNewGameBirchOamAttributes;
|
||||||
|
|
||||||
enum FieldEffectScriptIdx
|
enum FieldEffectScriptIdx
|
||||||
{
|
{
|
||||||
FLDEFF_EXCLAMATION_MARK_ICON_1,
|
FLDEFF_EXCLAMATION_MARK_ICON_1,
|
||||||
@ -70,6 +76,8 @@ enum FieldEffectScriptIdx
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern u32 gFieldEffectArguments[8];
|
extern u32 gFieldEffectArguments[8];
|
||||||
|
extern void (*gUnknown_0203CEEC)(void);
|
||||||
|
extern bool8 (*gUnknown_03005DB0)(void);
|
||||||
|
|
||||||
u32 FieldEffectStart(u8);
|
u32 FieldEffectStart(u8);
|
||||||
bool8 FieldEffectActiveListContains(u8 id);
|
bool8 FieldEffectActiveListContains(u8 id);
|
||||||
@ -80,7 +88,12 @@ u8 CreateTrainerSprite(u8 trainerSpriteID, s16 x, s16 y, u8 subpriority, u8 *buf
|
|||||||
void sub_80B7FC8(void);
|
void sub_80B7FC8(void);
|
||||||
void FieldEffectActiveListRemove(u8 id);
|
void FieldEffectActiveListRemove(u8 id);
|
||||||
void MultiplyInvertedPaletteRGBComponents(u16, u8, u8, u8);
|
void MultiplyInvertedPaletteRGBComponents(u16, u8, u8, u8);
|
||||||
extern void (*gUnknown_0203CEEC)(void);
|
void FieldEffectActiveListAdd(u8 id);
|
||||||
extern bool8 (*gUnknown_03005DB0)(void);
|
void FieldEffectScript_LoadTiles(u8 **script);
|
||||||
|
void FieldEffectScript_LoadFadedPalette(u8 **script);
|
||||||
|
void FieldEffectScript_LoadPalette(u8 **script);
|
||||||
|
void FieldEffectScript_CallNative(u8 **script, u32 *val);
|
||||||
|
void FieldEffectFreeTilesIfUnused(u16 tileStart);
|
||||||
|
void FieldEffectFreePaletteIfUnused(u8 paletteNum);
|
||||||
|
|
||||||
#endif //GUARD_FIELD_EFFECTS_H
|
#endif //GUARD_FIELD_EFFECTS_H
|
||||||
|
@ -12,5 +12,6 @@ void sub_80AF168(void);
|
|||||||
void UpdateWeatherPerDay(u16 days);
|
void UpdateWeatherPerDay(u16 days);
|
||||||
void sub_80AC3D0(void);
|
void sub_80AC3D0(void);
|
||||||
void sub_80AC3E4(void);
|
void sub_80AC3E4(void);
|
||||||
|
void PreservePaletteInWeather(u8);
|
||||||
|
|
||||||
#endif //GUARD_FIELD_SCREEN_H
|
#endif //GUARD_FIELD_SCREEN_H
|
||||||
|
@ -482,6 +482,7 @@ extern const u8 gUnknown_08329D2A[];
|
|||||||
extern const u8 gStatStageRatios[][2];
|
extern const u8 gStatStageRatios[][2];
|
||||||
extern const u16 gUnknown_08329D54[];
|
extern const u16 gUnknown_08329D54[];
|
||||||
extern const struct SpriteTemplate gUnknown_08329D98[];
|
extern const struct SpriteTemplate gUnknown_08329D98[];
|
||||||
|
extern const struct CompressedSpritePalette gMonPaletteTable[];
|
||||||
|
|
||||||
void ZeroBoxMonData(struct BoxPokemon *boxMon);
|
void ZeroBoxMonData(struct BoxPokemon *boxMon);
|
||||||
void ZeroMonData(struct Pokemon *mon);
|
void ZeroMonData(struct Pokemon *mon);
|
||||||
|
@ -121,6 +121,7 @@ SECTIONS {
|
|||||||
asm/cable_club.o(.text);
|
asm/cable_club.o(.text);
|
||||||
src/trainer_see.o(.text);
|
src/trainer_see.o(.text);
|
||||||
src/wild_encounter.o(.text);
|
src/wild_encounter.o(.text);
|
||||||
|
src/field_effect.o(.text);
|
||||||
asm/field_effect.o(.text);
|
asm/field_effect.o(.text);
|
||||||
src/scanline_effect.o(.text);
|
src/scanline_effect.o(.text);
|
||||||
src/option_menu.o(.text);
|
src/option_menu.o(.text);
|
||||||
|
@ -1,15 +1,922 @@
|
|||||||
|
|
||||||
// Includes
|
// Includes
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
#include "field_effect.h"
|
||||||
|
#include "battle_dome_cards.h"
|
||||||
|
#include "decompress.h"
|
||||||
|
#include "field_screen.h"
|
||||||
|
#include "field_weather.h"
|
||||||
|
#include "palette.h"
|
||||||
|
#include "pokemon.h"
|
||||||
|
#include "sound.h"
|
||||||
|
#include "sprite.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "constants/rgb.h"
|
||||||
|
#include "constants/songs.h"
|
||||||
|
|
||||||
// Static type declarations
|
// Static type declarations
|
||||||
|
|
||||||
// Static RAM declarations
|
// Static RAM declarations
|
||||||
|
|
||||||
IWRAM_DATA u8 gUnknown_03000F58[32];
|
IWRAM_DATA u8 sActiveList[32];
|
||||||
|
|
||||||
// Static ROM declarations
|
// Static ROM declarations
|
||||||
|
|
||||||
|
extern u8 *gFieldEffectScriptPointers[];
|
||||||
|
|
||||||
// .rodata
|
// .rodata
|
||||||
|
|
||||||
|
extern const struct SubspriteTable gUnknown_0855C2AC;// = subsprite_table(Unknown_39F180);
|
||||||
|
|
||||||
|
extern const struct SubspriteTable gUnknown_0855C2C4;// = subsprite_table(Unknown_39F1A8);
|
||||||
|
|
||||||
|
extern const struct SpriteTemplate gSpriteTemplate_855C304/* = {
|
||||||
|
.tileTag = 0xffff,
|
||||||
|
.paletteTag = 4103,
|
||||||
|
.oam = &gOamData_839F0FC,
|
||||||
|
.anims = gSpriteAnimTable_839F1FC,
|
||||||
|
.images = gSpriteImageTable_839F158,
|
||||||
|
.affineAnims = gDummySpriteAffineAnimTable,
|
||||||
|
.callback = SpriteCB_PokeballGlow
|
||||||
|
}*/;
|
||||||
|
|
||||||
|
extern const struct SpriteTemplate gSpriteTemplate_855C31C/* = {
|
||||||
|
.tileTag = 0xffff,
|
||||||
|
.paletteTag = 4100,
|
||||||
|
.oam = &gOamData_839F104,
|
||||||
|
.anims = gSpriteAnimTable_839F1FC,
|
||||||
|
.images = gSpriteImageTable_839F160,
|
||||||
|
.affineAnims = gDummySpriteAffineAnimTable,
|
||||||
|
.callback = SpriteCB_PokecenterMonitor
|
||||||
|
}*/;
|
||||||
|
|
||||||
|
extern const struct SpriteTemplate gSpriteTemplate_855C334/* = {
|
||||||
|
.tileTag = 0xffff,
|
||||||
|
.paletteTag = 4112,
|
||||||
|
.oam = &gOamData_839F104,
|
||||||
|
.anims = gSpriteAnimTable_839F204,
|
||||||
|
.images = gSpriteImageTable_839F170,
|
||||||
|
.affineAnims = gDummySpriteAffineAnimTable,
|
||||||
|
.callback = SpriteCB_HallOfFameMonitor
|
||||||
|
}*/;
|
||||||
|
|
||||||
|
extern const struct SpriteTemplate gSpriteTemplate_855C34C/* = {
|
||||||
|
.tileTag = 0xffff,
|
||||||
|
.paletteTag = 4112,
|
||||||
|
.oam = &gOamData_839F150,
|
||||||
|
.anims = gSpriteAnimTable_839F204,
|
||||||
|
.images = gSpriteImageTable_839F178,
|
||||||
|
.affineAnims = gDummySpriteAffineAnimTable,
|
||||||
|
.callback = SpriteCB_HallOfFameMonitor
|
||||||
|
}*/;
|
||||||
|
|
||||||
|
extern bool8 (*const gFieldEffectScriptFuncs[])(u8 **, u32 *)/* = {
|
||||||
|
FieldEffectCmd_loadtiles,
|
||||||
|
FieldEffectCmd_loadfadedpal,
|
||||||
|
FieldEffectCmd_loadpal,
|
||||||
|
FieldEffectCmd_callnative,
|
||||||
|
FieldEffectCmd_end,
|
||||||
|
FieldEffectCmd_loadgfx_callnative,
|
||||||
|
FieldEffectCmd_loadtiles_callnative,
|
||||||
|
FieldEffectCmd_loadfadedpal_callnative,
|
||||||
|
}*/;
|
||||||
|
|
||||||
|
extern void (*const gUnknown_0855C364[])(struct Task *)/* = {
|
||||||
|
PokecenterHealEffect_0,
|
||||||
|
PokecenterHealEffect_1,
|
||||||
|
PokecenterHealEffect_2,
|
||||||
|
PokecenterHealEffect_3
|
||||||
|
}*/;
|
||||||
|
|
||||||
|
extern void (*const gUnknown_0855C374[])(struct Task *)/* = {
|
||||||
|
HallOfFameRecordEffect_0,
|
||||||
|
HallOfFameRecordEffect_1,
|
||||||
|
HallOfFameRecordEffect_2,
|
||||||
|
HallOfFameRecordEffect_3
|
||||||
|
}*/;
|
||||||
|
|
||||||
|
extern void (*const gUnknown_0855C384[])(struct Sprite *)/* = {
|
||||||
|
PokeballGlowEffect_0,
|
||||||
|
PokeballGlowEffect_1,
|
||||||
|
PokeballGlowEffect_2,
|
||||||
|
PokeballGlowEffect_3,
|
||||||
|
PokeballGlowEffect_4,
|
||||||
|
PokeballGlowEffect_5,
|
||||||
|
PokeballGlowEffect_6,
|
||||||
|
PokeballGlowEffect_7
|
||||||
|
}*/;
|
||||||
|
|
||||||
|
extern const struct Coords16 gUnknown_0855C3A4[]/* = {
|
||||||
|
{.x = 0, .y = 0},
|
||||||
|
{.x = 6, .y = 0},
|
||||||
|
{.x = 0, .y = 4},
|
||||||
|
{.x = 6, .y = 4},
|
||||||
|
{.x = 0, .y = 8},
|
||||||
|
{.x = 6, .y = 8}
|
||||||
|
}*/;
|
||||||
|
|
||||||
|
extern const u8 gUnknown_0855C3BC[];// = {16, 12, 8, 0};
|
||||||
|
extern const u8 gUnknown_0855C3C0[];// = {16, 12, 8, 0};
|
||||||
|
extern const u8 gUnknown_0855C3C4[];// = { 0, 0, 0, 0};
|
||||||
|
|
||||||
// .text
|
// .text
|
||||||
|
|
||||||
|
u32 FieldEffectStart(u8 id)
|
||||||
|
{
|
||||||
|
u8 *script;
|
||||||
|
u32 val;
|
||||||
|
|
||||||
|
FieldEffectActiveListAdd(id);
|
||||||
|
|
||||||
|
script = gFieldEffectScriptPointers[id];
|
||||||
|
|
||||||
|
while (gFieldEffectScriptFuncs[*script](&script, &val))
|
||||||
|
;
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 FieldEffectCmd_loadtiles(u8 **script, u32 *val)
|
||||||
|
{
|
||||||
|
(*script)++;
|
||||||
|
FieldEffectScript_LoadTiles(script);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 FieldEffectCmd_loadfadedpal(u8 **script, u32 *val)
|
||||||
|
{
|
||||||
|
(*script)++;
|
||||||
|
FieldEffectScript_LoadFadedPalette(script);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 FieldEffectCmd_loadpal(u8 **script, u32 *val)
|
||||||
|
{
|
||||||
|
(*script)++;
|
||||||
|
FieldEffectScript_LoadPalette(script);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 FieldEffectCmd_callnative(u8 **script, u32 *val)
|
||||||
|
{
|
||||||
|
(*script)++;
|
||||||
|
FieldEffectScript_CallNative(script, val);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 FieldEffectCmd_end(u8 **script, u32 *val)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 FieldEffectCmd_loadgfx_callnative(u8 **script, u32 *val)
|
||||||
|
{
|
||||||
|
(*script)++;
|
||||||
|
FieldEffectScript_LoadTiles(script);
|
||||||
|
FieldEffectScript_LoadFadedPalette(script);
|
||||||
|
FieldEffectScript_CallNative(script, val);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 FieldEffectCmd_loadtiles_callnative(u8 **script, u32 *val)
|
||||||
|
{
|
||||||
|
(*script)++;
|
||||||
|
FieldEffectScript_LoadTiles(script);
|
||||||
|
FieldEffectScript_CallNative(script, val);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 FieldEffectCmd_loadfadedpal_callnative(u8 **script, u32 *val)
|
||||||
|
{
|
||||||
|
(*script)++;
|
||||||
|
FieldEffectScript_LoadFadedPalette(script);
|
||||||
|
FieldEffectScript_CallNative(script, val);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 FieldEffectScript_ReadWord(u8 **script)
|
||||||
|
{
|
||||||
|
return (*script)[0]
|
||||||
|
+ ((*script)[1] << 8)
|
||||||
|
+ ((*script)[2] << 16)
|
||||||
|
+ ((*script)[3] << 24);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FieldEffectScript_LoadTiles(u8 **script)
|
||||||
|
{
|
||||||
|
struct SpriteSheet *sheet = (struct SpriteSheet *)FieldEffectScript_ReadWord(script);
|
||||||
|
if (GetSpriteTileStartByTag(sheet->tag) == 0xFFFF)
|
||||||
|
LoadSpriteSheet(sheet);
|
||||||
|
(*script) += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FieldEffectScript_LoadFadedPalette(u8 **script)
|
||||||
|
{
|
||||||
|
struct SpritePalette *palette = (struct SpritePalette *)FieldEffectScript_ReadWord(script);
|
||||||
|
LoadSpritePalette(palette);
|
||||||
|
UpdateSpritePaletteWithWeather(IndexOfSpritePaletteTag(palette->tag));
|
||||||
|
(*script) += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FieldEffectScript_LoadPalette(u8 **script)
|
||||||
|
{
|
||||||
|
struct SpritePalette *palette = (struct SpritePalette *)FieldEffectScript_ReadWord(script);
|
||||||
|
LoadSpritePalette(palette);
|
||||||
|
(*script) += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FieldEffectScript_CallNative(u8 **script, u32 *val)
|
||||||
|
{
|
||||||
|
u32 (*func)(void) = (u32 (*)(void))FieldEffectScript_ReadWord(script);
|
||||||
|
*val = func();
|
||||||
|
(*script) += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FieldEffectFreeGraphicsResources(struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
u16 sheetTileStart = sprite->sheetTileStart;
|
||||||
|
u32 paletteNum = sprite->oam.paletteNum;
|
||||||
|
DestroySprite(sprite);
|
||||||
|
FieldEffectFreeTilesIfUnused(sheetTileStart);
|
||||||
|
FieldEffectFreePaletteIfUnused(paletteNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FieldEffectStop(struct Sprite *sprite, u8 id)
|
||||||
|
{
|
||||||
|
FieldEffectFreeGraphicsResources(sprite);
|
||||||
|
FieldEffectActiveListRemove(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FieldEffectFreeTilesIfUnused(u16 tileStart)
|
||||||
|
{
|
||||||
|
u8 i;
|
||||||
|
u16 tag = GetSpriteTileTagByTileStart(tileStart);
|
||||||
|
|
||||||
|
if (tag != 0xFFFF)
|
||||||
|
{
|
||||||
|
for (i = 0; i < MAX_SPRITES; i++)
|
||||||
|
if (gSprites[i].inUse && gSprites[i].usingSheet && tileStart == gSprites[i].sheetTileStart)
|
||||||
|
return;
|
||||||
|
FreeSpriteTilesByTag(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FieldEffectFreePaletteIfUnused(u8 paletteNum)
|
||||||
|
{
|
||||||
|
u8 i;
|
||||||
|
u16 tag = GetSpritePaletteTagByPaletteNum(paletteNum);
|
||||||
|
|
||||||
|
if (tag != 0xFFFF)
|
||||||
|
{
|
||||||
|
for (i = 0; i < MAX_SPRITES; i++)
|
||||||
|
if (gSprites[i].inUse && gSprites[i].oam.paletteNum == paletteNum)
|
||||||
|
return;
|
||||||
|
FreeSpritePaletteByTag(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FieldEffectActiveListClear(void)
|
||||||
|
{
|
||||||
|
u8 i;
|
||||||
|
for (i = 0; i < ARRAY_COUNT(sActiveList); i++)
|
||||||
|
sActiveList[i] = 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FieldEffectActiveListAdd(u8 id)
|
||||||
|
{
|
||||||
|
u8 i;
|
||||||
|
for (i = 0; i < ARRAY_COUNT(sActiveList); i++)
|
||||||
|
{
|
||||||
|
if (sActiveList[i] == 0xFF)
|
||||||
|
{
|
||||||
|
sActiveList[i] = id;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FieldEffectActiveListRemove(u8 id)
|
||||||
|
{
|
||||||
|
u8 i;
|
||||||
|
for (i = 0; i < ARRAY_COUNT(sActiveList); i++)
|
||||||
|
{
|
||||||
|
if (sActiveList[i] == id)
|
||||||
|
{
|
||||||
|
sActiveList[i] = 0xFF;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 FieldEffectActiveListContains(u8 id)
|
||||||
|
{
|
||||||
|
u8 i;
|
||||||
|
for (i = 0; i < ARRAY_COUNT(sActiveList); i++)
|
||||||
|
if (sActiveList[i] == id)
|
||||||
|
return TRUE;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 CreateTrainerSprite(u8 trainerSpriteID, s16 x, s16 y, u8 subpriority, u8 *buffer)
|
||||||
|
{
|
||||||
|
struct SpriteTemplate spriteTemplate;
|
||||||
|
LoadCompressedObjectPaletteOverrideBuffer(&gTrainerFrontPicPaletteTable[trainerSpriteID], buffer);
|
||||||
|
LoadCompressedObjectPicOverrideBuffer(&gTrainerFrontPicTable[trainerSpriteID], buffer);
|
||||||
|
spriteTemplate.tileTag = gTrainerFrontPicTable[trainerSpriteID].tag;
|
||||||
|
spriteTemplate.paletteTag = gTrainerFrontPicPaletteTable[trainerSpriteID].tag;
|
||||||
|
spriteTemplate.oam = &gNewGameBirchOamAttributes;
|
||||||
|
spriteTemplate.anims = gDummySpriteAnimTable;
|
||||||
|
spriteTemplate.images = NULL;
|
||||||
|
spriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
|
||||||
|
spriteTemplate.callback = SpriteCallbackDummy;
|
||||||
|
return CreateSprite(&spriteTemplate, x, y, subpriority);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoadTrainerGfx_TrainerCard(u8 gender, u16 palOffset, u8 *dest)
|
||||||
|
{
|
||||||
|
LZDecompressVram(gTrainerFrontPicTable[gender].data, dest);
|
||||||
|
LoadCompressedPalette(gTrainerFrontPicPaletteTable[gender].data, palOffset, 0x20);
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 AddNewGameBirchObject(s16 x, s16 y, u8 subpriority)
|
||||||
|
{
|
||||||
|
LoadSpritePalette(&gNewGameBirchObjectPaletteInfo);
|
||||||
|
return CreateSprite(&gNewGameBirchObjectTemplate, x, y, subpriority);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef NONMATCHING
|
||||||
|
u8 CreateMonSprite_PicBox(u16 species, s16 x, s16 y)
|
||||||
|
{
|
||||||
|
u16 spriteId = sub_818D7D8(species, 0, 0x8000, 1, x, y, 0, gMonPaletteTable[species].tag);
|
||||||
|
PreservePaletteInWeather(IndexOfSpritePaletteTag(gMonPaletteTable[species].tag) + 0x10);
|
||||||
|
if (spriteId == 0xFFFF)
|
||||||
|
return 0x40;
|
||||||
|
|
||||||
|
return spriteId;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
ASM_DIRECT
|
||||||
|
u8 CreateMonSprite_PicBox(u16 species, s16 x, s16 y)
|
||||||
|
{
|
||||||
|
asm_unified("push {r4,r5,lr}\n\
|
||||||
|
sub sp, 0x10\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r0, 16\n\
|
||||||
|
movs r3, 0x80\n\
|
||||||
|
lsls r3, 8\n\
|
||||||
|
lsls r1, 16\n\
|
||||||
|
asrs r1, 16\n\
|
||||||
|
str r1, [sp]\n\
|
||||||
|
lsls r2, 16\n\
|
||||||
|
asrs r2, 16\n\
|
||||||
|
str r2, [sp, 0x4]\n\
|
||||||
|
movs r1, 0\n\
|
||||||
|
str r1, [sp, 0x8]\n\
|
||||||
|
ldr r1, =gMonPaletteTable\n\
|
||||||
|
lsls r4, r0, 3\n\
|
||||||
|
adds r4, r1\n\
|
||||||
|
ldrh r1, [r4, 0x4]\n\
|
||||||
|
str r1, [sp, 0xC]\n\
|
||||||
|
movs r1, 0\n\
|
||||||
|
adds r2, r3, 0\n\
|
||||||
|
movs r3, 0x1\n\
|
||||||
|
bl sub_818D7D8\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r5, r0, 16\n\
|
||||||
|
ldrh r0, [r4, 0x4]\n\
|
||||||
|
bl IndexOfSpritePaletteTag\n\
|
||||||
|
adds r0, 0x10\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r0, 24\n\
|
||||||
|
bl PreservePaletteInWeather\n\
|
||||||
|
ldr r0, =0x0000ffff\n\
|
||||||
|
cmp r5, r0\n\
|
||||||
|
beq _080B5FDC\n\
|
||||||
|
lsls r0, r5, 24\n\
|
||||||
|
lsrs r0, 24\n\
|
||||||
|
b _080B5FDE\n\
|
||||||
|
.pool\n\
|
||||||
|
_080B5FDC:\n\
|
||||||
|
movs r0, 0x40\n\
|
||||||
|
_080B5FDE:\n\
|
||||||
|
add sp, 0x10\n\
|
||||||
|
pop {r4,r5}\n\
|
||||||
|
pop {r1}\n\
|
||||||
|
bx r1");
|
||||||
|
}
|
||||||
|
#endif //NONMATCHING
|
||||||
|
|
||||||
|
u8 CreateMonSprite_FieldMove(u16 species, u32 d, u32 g, s16 x, s16 y)
|
||||||
|
{
|
||||||
|
const struct CompressedSpritePalette *spritePalette = GetMonSpritePalStructFromOtIdPersonality(species, d, g);
|
||||||
|
u16 spriteId = sub_818D7D8(species, d, g, 1, x, y, 0, spritePalette->tag);
|
||||||
|
PreservePaletteInWeather(IndexOfSpritePaletteTag(spritePalette->tag) + 0x10);
|
||||||
|
if (spriteId == 0xFFFF)
|
||||||
|
return 0x40;
|
||||||
|
|
||||||
|
return spriteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeResourcesAndDestroySprite(struct Sprite *sprite, u8 spriteId)
|
||||||
|
{
|
||||||
|
ResetPreservedPalettesInWeather();
|
||||||
|
if (sprite->oam.affineMode != 0)
|
||||||
|
{
|
||||||
|
FreeOamMatrix(sprite->oam.matrixNum);
|
||||||
|
}
|
||||||
|
sub_818D820(spriteId);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef NONMATCHING
|
||||||
|
void MultiplyInvertedPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b)
|
||||||
|
{
|
||||||
|
int curRed;
|
||||||
|
int curGreen;
|
||||||
|
int curBlue;
|
||||||
|
|
||||||
|
curRed = gPlttBufferUnfaded[i] & 0x1f;
|
||||||
|
curGreen = (gPlttBufferUnfaded[i] & (0x1f << 5)) >> 5;
|
||||||
|
curBlue = (gPlttBufferUnfaded[i] & (0x1f << 10)) >> 10;
|
||||||
|
curRed += (((0x1f - curRed) * r) >> 4);
|
||||||
|
curGreen += (((0x1f - curGreen) * g) >> 4);
|
||||||
|
curBlue += (((0x1f - curBlue) * b) >> 4);
|
||||||
|
gPlttBufferFaded[i] = RGB(curRed, curGreen, curBlue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MultiplyPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b)
|
||||||
|
{
|
||||||
|
int curRed;
|
||||||
|
int curGreen;
|
||||||
|
int curBlue;
|
||||||
|
|
||||||
|
curRed = gPlttBufferUnfaded[i] & 0x1f;
|
||||||
|
curGreen = (gPlttBufferUnfaded[i] & (0x1f << 5)) >> 5;
|
||||||
|
curBlue = (gPlttBufferUnfaded[i] & (0x1f << 10)) >> 10;
|
||||||
|
curRed -= ((curRed * r) >> 4);
|
||||||
|
curGreen -= ((curGreen * g) >> 4);
|
||||||
|
curBlue -= ((curBlue * b) >> 4);
|
||||||
|
gPlttBufferFaded[i] = RGB(curRed, curGreen, curBlue);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
ASM_DIRECT
|
||||||
|
void MultiplyInvertedPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b)
|
||||||
|
{
|
||||||
|
asm(".syntax unified\n"
|
||||||
|
"\tpush {r4-r7,lr}\n"
|
||||||
|
"\tmov r7, r9\n"
|
||||||
|
"\tmov r6, r8\n"
|
||||||
|
"\tpush {r6,r7}\n"
|
||||||
|
"\tlsls r0, 16\n"
|
||||||
|
"\tlsls r1, 24\n"
|
||||||
|
"\tlsrs r1, 24\n"
|
||||||
|
"\tlsls r2, 24\n"
|
||||||
|
"\tlsrs r2, 24\n"
|
||||||
|
"\tlsls r3, 24\n"
|
||||||
|
"\tlsrs r3, 24\n"
|
||||||
|
"\tldr r4, _08085D00 @ =gPlttBufferUnfaded\n"
|
||||||
|
"\tlsrs r0, 15\n"
|
||||||
|
"\tadds r4, r0, r4\n"
|
||||||
|
"\tldrh r4, [r4]\n"
|
||||||
|
"\tmovs r5, 0x1F\n"
|
||||||
|
"\tmov r9, r5\n"
|
||||||
|
"\tmov r8, r4\n"
|
||||||
|
"\tmov r6, r8\n"
|
||||||
|
"\tands r6, r5\n"
|
||||||
|
"\tmov r8, r6\n"
|
||||||
|
"\tmovs r6, 0xF8\n"
|
||||||
|
"\tlsls r6, 2\n"
|
||||||
|
"\tands r6, r4\n"
|
||||||
|
"\tlsrs r6, 5\n"
|
||||||
|
"\tmovs r5, 0xF8\n"
|
||||||
|
"\tlsls r5, 7\n"
|
||||||
|
"\tands r4, r5\n"
|
||||||
|
"\tlsrs r4, 10\n"
|
||||||
|
"\tmov r7, r9\n"
|
||||||
|
"\tmov r5, r8\n"
|
||||||
|
"\tsubs r7, r5\n"
|
||||||
|
"\tmov r12, r7\n"
|
||||||
|
"\tmov r7, r12\n"
|
||||||
|
"\tmuls r7, r1\n"
|
||||||
|
"\tadds r1, r7, 0\n"
|
||||||
|
"\tasrs r1, 4\n"
|
||||||
|
"\tadd r8, r1\n"
|
||||||
|
"\tmov r5, r9\n"
|
||||||
|
"\tsubs r1, r5, r6\n"
|
||||||
|
"\tmuls r1, r2\n"
|
||||||
|
"\tasrs r1, 4\n"
|
||||||
|
"\tadds r6, r1\n"
|
||||||
|
"\tsubs r5, r4\n"
|
||||||
|
"\tmov r9, r5\n"
|
||||||
|
"\tmov r1, r9\n"
|
||||||
|
"\tmuls r1, r3\n"
|
||||||
|
"\tasrs r1, 4\n"
|
||||||
|
"\tadds r4, r1\n"
|
||||||
|
"\tmov r7, r8\n"
|
||||||
|
"\tlsls r7, 16\n"
|
||||||
|
"\tlsls r6, 21\n"
|
||||||
|
"\torrs r6, r7\n"
|
||||||
|
"\tlsls r4, 26\n"
|
||||||
|
"\torrs r4, r6\n"
|
||||||
|
"\tlsrs r4, 16\n"
|
||||||
|
"\tldr r1, _08085D04 @ =gPlttBufferFaded\n"
|
||||||
|
"\tadds r0, r1\n"
|
||||||
|
"\tstrh r4, [r0]\n"
|
||||||
|
"\tpop {r3,r4}\n"
|
||||||
|
"\tmov r8, r3\n"
|
||||||
|
"\tmov r9, r4\n"
|
||||||
|
"\tpop {r4-r7}\n"
|
||||||
|
"\tpop {r0}\n"
|
||||||
|
"\tbx r0\n"
|
||||||
|
"\t.align 2, 0\n"
|
||||||
|
"_08085D00: .4byte gPlttBufferUnfaded\n"
|
||||||
|
"_08085D04: .4byte gPlttBufferFaded\n"
|
||||||
|
".syntax divided");
|
||||||
|
}
|
||||||
|
|
||||||
|
ASM_DIRECT
|
||||||
|
void MultiplyPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b)
|
||||||
|
{
|
||||||
|
asm(".syntax unified\n"
|
||||||
|
"\tpush {r4-r6,lr}\n"
|
||||||
|
"\tmov r6, r8\n"
|
||||||
|
"\tpush {r6}\n"
|
||||||
|
"\tlsls r0, 16\n"
|
||||||
|
"\tlsls r1, 24\n"
|
||||||
|
"\tlsrs r1, 24\n"
|
||||||
|
"\tlsls r2, 24\n"
|
||||||
|
"\tlsrs r2, 24\n"
|
||||||
|
"\tlsls r3, 24\n"
|
||||||
|
"\tlsrs r3, 24\n"
|
||||||
|
"\tldr r4, _08085D78 @ =gPlttBufferUnfaded\n"
|
||||||
|
"\tlsrs r0, 15\n"
|
||||||
|
"\tadds r4, r0, r4\n"
|
||||||
|
"\tldrh r4, [r4]\n"
|
||||||
|
"\tmovs r5, 0x1F\n"
|
||||||
|
"\tmov r8, r5\n"
|
||||||
|
"\tmov r6, r8\n"
|
||||||
|
"\tands r6, r4\n"
|
||||||
|
"\tmov r8, r6\n"
|
||||||
|
"\tmovs r5, 0xF8\n"
|
||||||
|
"\tlsls r5, 2\n"
|
||||||
|
"\tands r5, r4\n"
|
||||||
|
"\tlsrs r5, 5\n"
|
||||||
|
"\tmovs r6, 0xF8\n"
|
||||||
|
"\tlsls r6, 7\n"
|
||||||
|
"\tands r4, r6\n"
|
||||||
|
"\tlsrs r4, 10\n"
|
||||||
|
"\tmov r6, r8\n"
|
||||||
|
"\tmuls r6, r1\n"
|
||||||
|
"\tadds r1, r6, 0\n"
|
||||||
|
"\tasrs r1, 4\n"
|
||||||
|
"\tmov r6, r8\n"
|
||||||
|
"\tsubs r6, r1\n"
|
||||||
|
"\tadds r1, r5, 0\n"
|
||||||
|
"\tmuls r1, r2\n"
|
||||||
|
"\tasrs r1, 4\n"
|
||||||
|
"\tsubs r5, r1\n"
|
||||||
|
"\tadds r1, r4, 0\n"
|
||||||
|
"\tmuls r1, r3\n"
|
||||||
|
"\tasrs r1, 4\n"
|
||||||
|
"\tsubs r4, r1\n"
|
||||||
|
"\tlsls r6, 16\n"
|
||||||
|
"\tlsls r5, 21\n"
|
||||||
|
"\torrs r5, r6\n"
|
||||||
|
"\tlsls r4, 26\n"
|
||||||
|
"\torrs r4, r5\n"
|
||||||
|
"\tlsrs r4, 16\n"
|
||||||
|
"\tldr r1, _08085D7C @ =gPlttBufferFaded\n"
|
||||||
|
"\tadds r0, r1\n"
|
||||||
|
"\tstrh r4, [r0]\n"
|
||||||
|
"\tpop {r3}\n"
|
||||||
|
"\tmov r8, r3\n"
|
||||||
|
"\tpop {r4-r6}\n"
|
||||||
|
"\tpop {r0}\n"
|
||||||
|
"\tbx r0\n"
|
||||||
|
"\t.align 2, 0\n"
|
||||||
|
"_08085D78: .4byte gPlttBufferUnfaded\n"
|
||||||
|
"_08085D7C: .4byte gPlttBufferFaded\n"
|
||||||
|
".syntax divided");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void Task_PokecenterHeal(u8 taskId);
|
||||||
|
u8 CreatePokeballGlowSprite(s16, s16, s16, u16);
|
||||||
|
u8 PokecenterHealEffectHelper(s16, s16);
|
||||||
|
|
||||||
|
bool8 FldEff_PokecenterHeal(void)
|
||||||
|
{
|
||||||
|
u8 nPokemon;
|
||||||
|
struct Task *task;
|
||||||
|
|
||||||
|
nPokemon = CalculatePlayerPartyCount();
|
||||||
|
task = &gTasks[CreateTask(Task_PokecenterHeal, 0xff)];
|
||||||
|
task->data[1] = nPokemon;
|
||||||
|
task->data[2] = 0x5d;
|
||||||
|
task->data[3] = 0x24;
|
||||||
|
task->data[4] = 0x7c;
|
||||||
|
task->data[5] = 0x18;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Task_PokecenterHeal(u8 taskId)
|
||||||
|
{
|
||||||
|
struct Task *task;
|
||||||
|
task = &gTasks[taskId];
|
||||||
|
gUnknown_0855C364[task->data[0]](task);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PokecenterHealEffect_0(struct Task *task)
|
||||||
|
{
|
||||||
|
task->data[0]++;
|
||||||
|
task->data[6] = CreatePokeballGlowSprite(task->data[1], task->data[2], task->data[3], 1);
|
||||||
|
task->data[7] = PokecenterHealEffectHelper(task->data[4], task->data[5]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PokecenterHealEffect_1(struct Task *task)
|
||||||
|
{
|
||||||
|
if (gSprites[task->data[6]].data[0] > 1)
|
||||||
|
{
|
||||||
|
gSprites[task->data[7]].data[0]++;
|
||||||
|
task->data[0]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PokecenterHealEffect_2(struct Task *task)
|
||||||
|
{
|
||||||
|
if (gSprites[task->data[6]].data[0] > 4)
|
||||||
|
{
|
||||||
|
task->data[0]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PokecenterHealEffect_3(struct Task *task)
|
||||||
|
{
|
||||||
|
if (gSprites[task->data[6]].data[0] > 6)
|
||||||
|
{
|
||||||
|
DestroySprite(&gSprites[task->data[6]]);
|
||||||
|
FieldEffectActiveListRemove(FLDEFF_POKECENTER_HEAL);
|
||||||
|
DestroyTask(FindTaskIdByFunc(Task_PokecenterHeal));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Task_HallOfFameRecord(u8 taskId);
|
||||||
|
void HallOfFameRecordEffectHelper(s16, s16, s16, u8);
|
||||||
|
|
||||||
|
bool8 FldEff_HallOfFameRecord(void)
|
||||||
|
{
|
||||||
|
u8 nPokemon;
|
||||||
|
struct Task *task;
|
||||||
|
|
||||||
|
nPokemon = CalculatePlayerPartyCount();
|
||||||
|
task = &gTasks[CreateTask(Task_HallOfFameRecord, 0xff)];
|
||||||
|
task->data[1] = nPokemon;
|
||||||
|
task->data[2] = 0x75;
|
||||||
|
task->data[3] = 0x34;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Task_HallOfFameRecord(u8 taskId)
|
||||||
|
{
|
||||||
|
struct Task *task;
|
||||||
|
task = &gTasks[taskId];
|
||||||
|
gUnknown_0855C374[task->data[0]](task);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HallOfFameRecordEffect_0(struct Task *task)
|
||||||
|
{
|
||||||
|
u8 taskId;
|
||||||
|
task->data[0]++;
|
||||||
|
task->data[6] = CreatePokeballGlowSprite(task->data[1], task->data[2], task->data[3], 0);
|
||||||
|
taskId = FindTaskIdByFunc(Task_HallOfFameRecord);
|
||||||
|
HallOfFameRecordEffectHelper(taskId, 0x78, 0x18, 0);
|
||||||
|
HallOfFameRecordEffectHelper(taskId, 0x28, 0x08, 1);
|
||||||
|
HallOfFameRecordEffectHelper(taskId, 0x48, 0x08, 1);
|
||||||
|
HallOfFameRecordEffectHelper(taskId, 0xa8, 0x08, 1);
|
||||||
|
HallOfFameRecordEffectHelper(taskId, 0xc8, 0x08, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HallOfFameRecordEffect_1(struct Task *task)
|
||||||
|
{
|
||||||
|
if (gSprites[task->data[6]].data[0] > 1)
|
||||||
|
{
|
||||||
|
task->data[15]++; // was this ever initialized? is this ever used?
|
||||||
|
task->data[0]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HallOfFameRecordEffect_2(struct Task *task)
|
||||||
|
{
|
||||||
|
if (gSprites[task->data[6]].data[0] > 4)
|
||||||
|
{
|
||||||
|
task->data[0]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HallOfFameRecordEffect_3(struct Task *task)
|
||||||
|
{
|
||||||
|
if (gSprites[task->data[6]].data[0] > 6)
|
||||||
|
{
|
||||||
|
DestroySprite(&gSprites[task->data[6]]);
|
||||||
|
FieldEffectActiveListRemove(FLDEFF_HALL_OF_FAME_RECORD);
|
||||||
|
DestroyTask(FindTaskIdByFunc(Task_HallOfFameRecord));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpriteCB_PokeballGlowEffect(struct Sprite *);
|
||||||
|
|
||||||
|
u8 CreatePokeballGlowSprite(s16 data6, s16 x, s16 y, u16 data5)
|
||||||
|
{
|
||||||
|
u8 spriteId;
|
||||||
|
struct Sprite *sprite;
|
||||||
|
spriteId = CreateInvisibleSprite(SpriteCB_PokeballGlowEffect);
|
||||||
|
sprite = &gSprites[spriteId];
|
||||||
|
sprite->pos2.x = x;
|
||||||
|
sprite->pos2.y = y;
|
||||||
|
sprite->data[5] = data5;
|
||||||
|
sprite->data[6] = data6;
|
||||||
|
sprite->data[7] = spriteId;
|
||||||
|
return spriteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpriteCB_PokeballGlowEffect(struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
gUnknown_0855C384[sprite->data[0]](sprite);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PokeballGlowEffect_0(struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
u8 endSpriteId;
|
||||||
|
if (sprite->data[1] == 0 || (--sprite->data[1]) == 0)
|
||||||
|
{
|
||||||
|
sprite->data[1] = 25;
|
||||||
|
endSpriteId = CreateSpriteAtEnd(&gSpriteTemplate_855C304, gUnknown_0855C3A4[sprite->data[2]].x + sprite->pos2.x, gUnknown_0855C3A4[sprite->data[2]].y + sprite->pos2.y, 0);
|
||||||
|
gSprites[endSpriteId].oam.priority = 2;
|
||||||
|
gSprites[endSpriteId].data[0] = sprite->data[7];
|
||||||
|
sprite->data[2]++;
|
||||||
|
sprite->data[6]--;
|
||||||
|
PlaySE(SE_BOWA);
|
||||||
|
}
|
||||||
|
if (sprite->data[6] == 0)
|
||||||
|
{
|
||||||
|
sprite->data[1] = 32;
|
||||||
|
sprite->data[0]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PokeballGlowEffect_1(struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
if ((--sprite->data[1]) == 0)
|
||||||
|
{
|
||||||
|
sprite->data[0]++;
|
||||||
|
sprite->data[1] = 8;
|
||||||
|
sprite->data[2] = 0;
|
||||||
|
sprite->data[3] = 0;
|
||||||
|
if (sprite->data[5])
|
||||||
|
{
|
||||||
|
PlayFanfare(MUS_ME_ASA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PokeballGlowEffect_2(struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
u8 phase;
|
||||||
|
if ((--sprite->data[1]) == 0)
|
||||||
|
{
|
||||||
|
sprite->data[1] = 8;
|
||||||
|
sprite->data[2]++;
|
||||||
|
sprite->data[2] &= 3;
|
||||||
|
if (sprite->data[2] == 0)
|
||||||
|
{
|
||||||
|
sprite->data[3]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
phase = (sprite->data[2] + 3) & 3;
|
||||||
|
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x108, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]);
|
||||||
|
phase = (sprite->data[2] + 2) & 3;
|
||||||
|
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x106, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]);
|
||||||
|
phase = (sprite->data[2] + 1) & 3;
|
||||||
|
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x102, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]);
|
||||||
|
phase = sprite->data[2];
|
||||||
|
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x105, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]);
|
||||||
|
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x103, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]);
|
||||||
|
if (sprite->data[3] > 2)
|
||||||
|
{
|
||||||
|
sprite->data[0]++;
|
||||||
|
sprite->data[1] = 8;
|
||||||
|
sprite->data[2] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PokeballGlowEffect_3(struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
u8 phase;
|
||||||
|
if ((--sprite->data[1]) == 0)
|
||||||
|
{
|
||||||
|
sprite->data[1] = 8;
|
||||||
|
sprite->data[2]++;
|
||||||
|
sprite->data[2] &= 3;
|
||||||
|
if (sprite->data[2] == 3)
|
||||||
|
{
|
||||||
|
sprite->data[0]++;
|
||||||
|
sprite->data[1] = 30;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
phase = sprite->data[2];
|
||||||
|
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x108, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]);
|
||||||
|
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x106, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]);
|
||||||
|
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x102, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]);
|
||||||
|
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x105, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]);
|
||||||
|
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x103, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PokeballGlowEffect_4(struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
if ((--sprite->data[1]) == 0)
|
||||||
|
{
|
||||||
|
sprite->data[0]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PokeballGlowEffect_5(struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
sprite->data[0]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PokeballGlowEffect_6(struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
if (sprite->data[5] == 0 || IsFanfareTaskInactive())
|
||||||
|
{
|
||||||
|
sprite->data[0]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PokeballGlowEffect_7(struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpriteCB_PokeballGlow(struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
if (gSprites[sprite->data[0]].data[0] > 4)
|
||||||
|
{
|
||||||
|
FieldEffectFreeGraphicsResources(sprite);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 PokecenterHealEffectHelper(s16 x, s16 y)
|
||||||
|
{
|
||||||
|
u8 spriteIdAtEnd;
|
||||||
|
struct Sprite *sprite;
|
||||||
|
spriteIdAtEnd = CreateSpriteAtEnd(&gSpriteTemplate_855C31C, x, y, 0);
|
||||||
|
sprite = &gSprites[spriteIdAtEnd];
|
||||||
|
sprite->oam.priority = 2;
|
||||||
|
sprite->invisible = 1;
|
||||||
|
SetSubspriteTables(sprite, &gUnknown_0855C2AC);
|
||||||
|
return spriteIdAtEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpriteCB_PokecenterMonitor(struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
if (sprite->data[0] != 0)
|
||||||
|
{
|
||||||
|
sprite->data[0] = 0;
|
||||||
|
sprite->invisible = 0;
|
||||||
|
StartSpriteAnim(sprite, 1);
|
||||||
|
}
|
||||||
|
if (sprite->animEnded)
|
||||||
|
{
|
||||||
|
FieldEffectFreeGraphicsResources(sprite);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HallOfFameRecordEffectHelper(s16 a0, s16 a1, s16 a2, u8 a3)
|
||||||
|
{
|
||||||
|
u8 spriteIdAtEnd;
|
||||||
|
if (!a3)
|
||||||
|
{
|
||||||
|
spriteIdAtEnd = CreateSpriteAtEnd(&gSpriteTemplate_855C334, a1, a2, 0);
|
||||||
|
SetSubspriteTables(&gSprites[spriteIdAtEnd], &gUnknown_0855C2C4);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
spriteIdAtEnd = CreateSpriteAtEnd(&gSpriteTemplate_855C34C, a1, a2, 0);
|
||||||
|
}
|
||||||
|
gSprites[spriteIdAtEnd].invisible = 1;
|
||||||
|
gSprites[spriteIdAtEnd].data[0] = a0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpriteCB_HallOfFameMonitor(struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
if (gTasks[sprite->data[0]].data[15])
|
||||||
|
{
|
||||||
|
if (sprite->data[1] == 0 || (--sprite->data[1]) == 0)
|
||||||
|
{
|
||||||
|
sprite->data[1] = 16;
|
||||||
|
sprite->invisible ^= 1;
|
||||||
|
}
|
||||||
|
sprite->data[2]++;
|
||||||
|
}
|
||||||
|
if (sprite->data[2] > 127)
|
||||||
|
{
|
||||||
|
FieldEffectFreeGraphicsResources(sprite);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user