mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-02-25 21:55:29 +01:00
Merge branch 'master' into pokemon_expansion
This commit is contained in:
commit
0666da6145
2347
asm/pokenav_unk_4.s
2347
asm/pokenav_unk_4.s
File diff suppressed because it is too large
Load Diff
1396
asm/pokenav_unk_5.s
1396
asm/pokenav_unk_5.s
File diff suppressed because it is too large
Load Diff
79
include/constants/item_effects.h
Normal file
79
include/constants/item_effects.h
Normal file
@ -0,0 +1,79 @@
|
||||
#ifndef GUARD_CONSTANTS_ITEM_EFFECTS_H
|
||||
#define GUARD_CONSTANTS_ITEM_EFFECTS_H
|
||||
|
||||
// field 0 masks
|
||||
#define ITEM0_X_ATTACK 0x0F
|
||||
#define ITEM0_HIGH_CRIT 0x30 // For Dire Hit, works the same way as move Focus Energy.
|
||||
#define ITEM0_SACRED_ASH 0x40
|
||||
#define ITEM0_INFATUATION 0x80
|
||||
|
||||
// field 1 masks
|
||||
#define ITEM1_X_SPEED 0x0F
|
||||
#define ITEM1_X_DEFEND 0xF0
|
||||
|
||||
// field 2 masks
|
||||
#define ITEM2_X_SPATK 0x0F
|
||||
#define ITEM2_X_ACCURACY 0xF0
|
||||
|
||||
// field 3 masks
|
||||
#define ITEM3_CONFUSION 0x1
|
||||
#define ITEM3_PARALYSIS 0x2
|
||||
#define ITEM3_FREEZE 0x4
|
||||
#define ITEM3_BURN 0x8
|
||||
#define ITEM3_POISON 0x10
|
||||
#define ITEM3_SLEEP 0x20
|
||||
#define ITEM3_LEVEL_UP 0x40
|
||||
#define ITEM3_MIST 0x80 // For Guard Specs, works the same way as move Mist.
|
||||
|
||||
#define ITEM3_STATUS_ALL (ITEM3_CONFUSION | ITEM3_PARALYSIS | ITEM3_FREEZE | ITEM3_BURN | ITEM3_POISON | ITEM3_SLEEP)
|
||||
|
||||
// field 4 masks
|
||||
#define ITEM4_EV_HP 0x1
|
||||
#define ITEM4_EV_ATK 0x2
|
||||
#define ITEM4_HEAL_HP 0x4
|
||||
#define ITEM4_HEAL_PP_ALL 0x8
|
||||
#define ITEM4_HEAL_PP_ONE 0x10
|
||||
#define ITEM4_PP_UP 0x20
|
||||
#define ITEM4_REVIVE 0x40
|
||||
#define ITEM4_EVO_STONE 0x80
|
||||
|
||||
// field 5 masks
|
||||
#define ITEM5_EV_DEF 0x1
|
||||
#define ITEM5_EV_SPEED 0x2
|
||||
#define ITEM5_EV_SPDEF 0x4
|
||||
#define ITEM5_EV_SPATK 0x8
|
||||
#define ITEM5_PP_MAX 0x10
|
||||
#define ITEM5_FRIENDSHIP_LOW 0x20
|
||||
#define ITEM5_FRIENDSHIP_MID 0x40
|
||||
#define ITEM5_FRIENDSHIP_HIGH 0x80
|
||||
|
||||
#define ITEM5_FRIENDSHIP_ALL (ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID | ITEM5_FRIENDSHIP_HIGH)
|
||||
|
||||
// fields 6 and onwards are item-specific arguments
|
||||
|
||||
// Used for GetItemEffectType.
|
||||
#define ITEM_EFFECT_X_ITEM 0
|
||||
#define ITEM_EFFECT_RAISE_LEVEL 1
|
||||
#define ITEM_EFFECT_HEAL_HP 2
|
||||
#define ITEM_EFFECT_CURE_POISON 3
|
||||
#define ITEM_EFFECT_CURE_SLEEP 4
|
||||
#define ITEM_EFFECT_CURE_BURN 5
|
||||
#define ITEM_EFFECT_CURE_FREEZE 6
|
||||
#define ITEM_EFFECT_CURE_PARALYSIS 7
|
||||
#define ITEM_EFFECT_CURE_CONFUSION 8
|
||||
#define ITEM_EFFECT_CURE_INFATUATION 9
|
||||
#define ITEM_EFFECT_SACRED_ASH 10
|
||||
#define ITEM_EFFECT_CURE_ALL_STATUS 11
|
||||
#define ITEM_EFFECT_ATK_EV 12
|
||||
#define ITEM_EFFECT_HP_EV 13
|
||||
#define ITEM_EFFECT_SPATK_EV 14
|
||||
#define ITEM_EFFECT_SPDEF_EV 15
|
||||
#define ITEM_EFFECT_SPEED_EV 16
|
||||
#define ITEM_EFFECT_DEF_EV 17
|
||||
#define ITEM_EFFECT_EVO_STONE 18
|
||||
#define ITEM_EFFECT_PP_UP 19
|
||||
#define ITEM_EFFECT_PP_MAX 20
|
||||
#define ITEM_EFFECT_HEAL_PP 21
|
||||
#define ITEM_EFFECT_NONE 22
|
||||
|
||||
#endif // GUARD_CONSTANTS_ITEM_EFFECTS_H
|
@ -473,6 +473,6 @@
|
||||
#define NUM_HIDDEN_MACHINES 8
|
||||
|
||||
// Check if the item is one that can be used on a Pokemon.
|
||||
#define IS_POKEMON_ITEM(item) ((item) >= ITEM_POTION && (item) <= ITEM_0B2)
|
||||
#define ITEM_HAS_EFFECT(item) ((item) >= ITEM_POTION && (item) <= ITEM_0B2)
|
||||
|
||||
#endif // GUARD_CONSTANTS_ITEMS_H
|
||||
|
@ -17,5 +17,7 @@ bool32 IsMatchCallTaskActive(void);
|
||||
void StartMatchCallFromScript(u8 *message);
|
||||
void sub_8197080(u8 *destStr);
|
||||
bool32 SelectMatchCallMessage(int, u8 *);
|
||||
void sub_8197184(u32 windowId, u32 destOffset, u32 paletteId);
|
||||
void sub_81971C4(u32 windowId, u32 tileOffset, u32 paletteId);
|
||||
|
||||
#endif //GUARD_MATCH_CALL_H
|
||||
|
@ -1,6 +1,9 @@
|
||||
#ifndef GUARD_POKENAV_H
|
||||
#define GUARD_POKENAV_H
|
||||
|
||||
#include "bg.h"
|
||||
#include "main.h"
|
||||
|
||||
typedef u32 (*LoopedTask)(int state);
|
||||
|
||||
// Return values of LoopedTask functions.
|
||||
@ -53,9 +56,41 @@ bool32 IsLoopedTaskActive(u32 taskId);
|
||||
void SetPokenavMode(u16 mode);
|
||||
u32 GetPokenavMode(void);
|
||||
bool32 CanViewRibbonsMenu(void);
|
||||
void SetPokenavVBlankCallback(void);
|
||||
void SetVBlankCallback_(IntrCallback callback);
|
||||
|
||||
// pokenav_match_call_ui.c
|
||||
struct MatchCallListTemplate
|
||||
{
|
||||
u32 unk0;
|
||||
u16 unk4;
|
||||
u16 unk6;
|
||||
u8 unk8;
|
||||
u8 unk9;
|
||||
u8 unkA;
|
||||
u8 unkB;
|
||||
u8 unkC;
|
||||
u8 unkD;
|
||||
u8 unkE;
|
||||
void (*unk10)(u32, u8 *a1);
|
||||
void (*unk14)(u16 a0, u32 a1, u32 a2);
|
||||
};
|
||||
u32 GetSelectedMatchCall(void);
|
||||
bool32 sub_81C8224(void);
|
||||
int MatchCall_MoveCursorUp(void);
|
||||
int MatchCall_MoveCursorDown(void);
|
||||
int MatchCall_PageDown(void);
|
||||
int MatchCall_PageUp(void);
|
||||
bool32 sub_81C8630(void);
|
||||
void ToggleMatchCallVerticalArrows(bool32 shouldHide);
|
||||
void sub_81C8838(void);
|
||||
void sub_81C877C(void);
|
||||
bool32 sub_81C8820(void);
|
||||
void sub_81C87AC(s16 a0);
|
||||
u32 GetMatchCallListTopIndex(void);
|
||||
void sub_81C87F0(void);
|
||||
bool32 sub_81C81D4(const struct BgTemplate *arg0, struct MatchCallListTemplate *arg1, s32 arg2);
|
||||
void sub_81C8234(void);
|
||||
|
||||
// pokenav_match_call_data.c
|
||||
bool32 sub_81D17E8(u32 idx);
|
||||
@ -74,6 +109,22 @@ bool32 InitPokenavMainMenu(void);
|
||||
void CopyPaletteIntoBufferUnfaded(const u16 *palette, u32 bufferOffset, u32 size);
|
||||
void sub_81C7850(u32 a0);
|
||||
u32 sub_81C786C(void);
|
||||
void LoadLeftHeaderGfxForIndex(u32 arg0);
|
||||
void sub_81C7FA0(u32 arg0, bool32 arg1, bool32 arg2);
|
||||
void sub_81C7AC0(int a0);
|
||||
bool32 sub_81C8010(void);
|
||||
void InitBgTemplates(const struct BgTemplate *templates, int count);
|
||||
bool32 IsPaletteFadeActive(void);
|
||||
void sub_81C7BA4(u32 helpBarIndex);
|
||||
bool32 IsDma3ManagerBusyWithBgCopy_(void);
|
||||
void sub_81C78A0(void);
|
||||
bool32 MainMenuLoopedTaskIsBusy(void);
|
||||
void sub_81C7FDC(void);
|
||||
void sub_81C79BC(const u16 *a0, const u16 *a1, u32 a2, u32 a3, u32 a4, u16 *a5);
|
||||
void sub_81C7B40(void);
|
||||
struct Sprite *PauseSpinningPokenavSprite(void);
|
||||
void ResumeSpinningPokenavSprite(void);
|
||||
void sub_81C7E14(u32 arg0);
|
||||
|
||||
// pokenav_unk_1.c
|
||||
bool32 sub_81C9298(void);
|
||||
@ -87,7 +138,7 @@ int sub_81C9894(void);
|
||||
const u8 *sub_81CAF78(int index, u8 *arg1);
|
||||
|
||||
// pokenav_unk_2.c
|
||||
u32 sub_81C99D4(void);
|
||||
void sub_81C99D4(void);
|
||||
void sub_81CAADC(void);
|
||||
|
||||
// pokenav_unk_3.c
|
||||
@ -110,9 +161,26 @@ int sub_81CAF04(int index);
|
||||
const u8 *sub_81CAFD8(int index, int textType);
|
||||
u16 sub_81CB01C(void);
|
||||
u16 sub_81CB02C(int arg0);
|
||||
void sub_81CB050(struct Pokenav3Struct_Unk1C *arg0, u8 *str);
|
||||
void sub_81CB050(u32 arg0, u8 *str);
|
||||
int sub_81CB0C8(int rematchIndex);
|
||||
int sub_81CB0E4(int index);
|
||||
bool32 sub_81CAE08(int);
|
||||
int sub_81CB128(int index);
|
||||
|
||||
// pokenav_unk_4.c
|
||||
bool32 sub_81CB260(void);
|
||||
void sub_81CB29C(int index);
|
||||
u32 sub_81CB2CC(void);
|
||||
void sub_81CB2E0(void);
|
||||
void sub_81CBD48(u16 windowId, u32 a1);
|
||||
|
||||
// pokenav_unk_5.c
|
||||
u32 sub_81CC4D4(void);
|
||||
void sub_81CC524(void);
|
||||
u32 sub_81CC554(void);
|
||||
bool32 sub_81CC5F4(void);
|
||||
void sub_81CC62C(int);
|
||||
u32 sub_81CC65C(void);
|
||||
void sub_81CC670(void);
|
||||
|
||||
#endif //GUARD_POKENAV_H
|
||||
|
@ -90,7 +90,7 @@ struct RegionMapLocation
|
||||
// Exported RAM declarations
|
||||
|
||||
// Exported ROM declarations
|
||||
void sub_8122CF8(struct RegionMap *regionMap, struct BgTemplate *template, bool8 zoomed);
|
||||
void sub_8122CF8(struct RegionMap *regionMap, const struct BgTemplate *template, bool8 zoomed);
|
||||
bool8 sub_8122DB0(void);
|
||||
void UpdateRegionMapVideoRegs(void);
|
||||
void InitRegionMap(struct RegionMap *regionMap, u8 argument);
|
||||
@ -108,6 +108,10 @@ u16 CorrectSpecialMapSecId(u16 mapSecId);
|
||||
void sub_8122D88(struct RegionMap *regionMap);
|
||||
void PokedexAreaScreen_UpdateRegionMapVariablesAndVideoRegs(s16 x, s16 y);
|
||||
void MCB2_FlyMap(void);
|
||||
bool8 sub_8124658(void);
|
||||
void sub_812454C(void);
|
||||
void sub_8123030(u16 a0, u32 a1);
|
||||
void sub_8123418(void);
|
||||
|
||||
extern const struct RegionMapLocation gRegionMapEntries[];
|
||||
|
||||
|
@ -2710,5 +2710,9 @@ extern const u8 gText_Exit2[];
|
||||
|
||||
// Pokenav Match Call
|
||||
extern const u8 gText_CallCantBeMadeHere[];
|
||||
extern const u8 gText_NumberRegistered[];
|
||||
extern const u8 gText_NumberOfBattles[];
|
||||
extern const u8 gText_Unknown[];
|
||||
extern const u8 gText_TrainerCloseBy[];
|
||||
|
||||
#endif // GUARD_STRINGS_H
|
||||
|
@ -306,8 +306,8 @@ SECTIONS {
|
||||
src/pokenav_unk_1.o(.text);
|
||||
asm/pokenav_unk_2.o(.text);
|
||||
src/pokenav_unk_3.o(.text);
|
||||
asm/pokenav_unk_4.o(.text);
|
||||
asm/pokenav_unk_5.o(.text);
|
||||
src/pokenav_unk_4.o(.text);
|
||||
src/pokenav_unk_5.o(.text);
|
||||
asm/pokenav_unk_6.o(.text);
|
||||
asm/pokenav_unk_7.o(.text);
|
||||
asm/pokenav_unk_8.o(.text);
|
||||
|
183
src/apprentice.c
183
src/apprentice.c
@ -2013,28 +2013,27 @@ static void sub_81A1218(void)
|
||||
sub_81AAC28();
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
static void sub_81A1224(void)
|
||||
{
|
||||
u8 count;
|
||||
u8 i, j;
|
||||
u8 count;
|
||||
|
||||
if (PLAYER_APPRENTICE.field_B1_1 < 3)
|
||||
return;
|
||||
|
||||
count = 0;
|
||||
for (j = 0; j < 9 && PLAYER_APPRENTICE.field_B8[j].unk0_0; count++, j++)
|
||||
for (count = 0, j = 0; j < 9 && PLAYER_APPRENTICE.field_B8[j].unk0_0; count++, j++)
|
||||
;
|
||||
|
||||
for (i = 0; i < count && i < PLAYER_APPRENTICE.field_B1_1 - 3; i++)
|
||||
{
|
||||
do {} while(0);
|
||||
if (PLAYER_APPRENTICE.field_B8[i].unk0_0 == 1
|
||||
&& PLAYER_APPRENTICE.field_B8[i].unk0_3
|
||||
&& PLAYER_APPRENTICE.field_B8[i].unk2 == gSpecialVar_0x8005)
|
||||
{
|
||||
PLAYER_APPRENTICE.field_B8[PLAYER_APPRENTICE.field_B1_1 - 3].unk0_3 = 0;
|
||||
PLAYER_APPRENTICE.field_B8[PLAYER_APPRENTICE.field_B1_1 - 3].unk2 = gSpecialVar_0x8005;
|
||||
gSpecialVar_Result = i;
|
||||
gSpecialVar_Result = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -2043,180 +2042,6 @@ static void sub_81A1224(void)
|
||||
PLAYER_APPRENTICE.field_B8[PLAYER_APPRENTICE.field_B1_1 - 3].unk2 = gSpecialVar_0x8005;
|
||||
gSpecialVar_Result = 1;
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
static void sub_81A1224(void)
|
||||
{
|
||||
asm_unified("\n\
|
||||
push {r4-r7,lr}\n\
|
||||
mov r7, r9\n\
|
||||
mov r6, r8\n\
|
||||
push {r6,r7}\n\
|
||||
ldr r1, =gSaveBlock2Ptr\n\
|
||||
ldr r3, [r1]\n\
|
||||
adds r0, r3, 0\n\
|
||||
adds r0, 0xB1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 26\n\
|
||||
lsrs r0, 28\n\
|
||||
adds r7, r1, 0\n\
|
||||
cmp r0, 0x2\n\
|
||||
bhi _081A1242\n\
|
||||
b _081A1362\n\
|
||||
_081A1242:\n\
|
||||
movs r5, 0\n\
|
||||
movs r2, 0\n\
|
||||
adds r0, r3, 0\n\
|
||||
adds r0, 0xB8\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 30\n\
|
||||
ldr r1, =gSpecialVar_0x8005\n\
|
||||
mov r12, r1\n\
|
||||
ldr r1, =gSpecialVar_Result\n\
|
||||
mov r8, r1\n\
|
||||
cmp r0, 0\n\
|
||||
beq _081A127C\n\
|
||||
adds r3, r7, 0\n\
|
||||
_081A125C:\n\
|
||||
adds r0, r5, 0x1\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r5, r0, 24\n\
|
||||
adds r0, r2, 0x1\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r2, r0, 24\n\
|
||||
cmp r2, 0x8\n\
|
||||
bhi _081A127C\n\
|
||||
ldr r0, [r3]\n\
|
||||
lsls r1, r2, 2\n\
|
||||
adds r0, r1\n\
|
||||
adds r0, 0xB8\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 30\n\
|
||||
cmp r0, 0\n\
|
||||
bne _081A125C\n\
|
||||
_081A127C:\n\
|
||||
movs r4, 0\n\
|
||||
cmp r4, r5\n\
|
||||
bcs _081A1322\n\
|
||||
ldr r0, [r7]\n\
|
||||
adds r0, 0xB1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 26\n\
|
||||
lsrs r0, 28\n\
|
||||
subs r0, 0x3\n\
|
||||
cmp r4, r0\n\
|
||||
bge _081A1322\n\
|
||||
adds r6, r7, 0\n\
|
||||
mov r9, r4\n\
|
||||
_081A1296:\n\
|
||||
ldr r3, [r6]\n\
|
||||
lsls r0, r4, 2\n\
|
||||
adds r2, r3, r0\n\
|
||||
adds r0, r2, 0\n\
|
||||
adds r0, 0xB8\n\
|
||||
ldrb r1, [r0]\n\
|
||||
lsls r0, r1, 30\n\
|
||||
lsrs r0, 30\n\
|
||||
cmp r0, 0x1\n\
|
||||
bne _081A1308\n\
|
||||
lsrs r0, r1, 6\n\
|
||||
cmp r0, 0\n\
|
||||
beq _081A1308\n\
|
||||
adds r0, r2, 0\n\
|
||||
adds r0, 0xBA\n\
|
||||
ldrh r0, [r0]\n\
|
||||
mov r2, r12\n\
|
||||
ldrh r2, [r2]\n\
|
||||
cmp r0, r2\n\
|
||||
bne _081A1308\n\
|
||||
adds r0, r3, 0\n\
|
||||
adds r0, 0xB1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 26\n\
|
||||
lsrs r0, 28\n\
|
||||
subs r0, 0x3\n\
|
||||
lsls r0, 2\n\
|
||||
adds r0, r3, r0\n\
|
||||
adds r0, 0xB8\n\
|
||||
ldrb r2, [r0]\n\
|
||||
movs r1, 0x3F\n\
|
||||
ands r1, r2\n\
|
||||
strb r1, [r0]\n\
|
||||
ldr r1, [r6]\n\
|
||||
adds r0, r1, 0\n\
|
||||
adds r0, 0xB1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 26\n\
|
||||
lsrs r0, 28\n\
|
||||
subs r0, 0x3\n\
|
||||
lsls r0, 2\n\
|
||||
adds r1, r0\n\
|
||||
mov r2, r12\n\
|
||||
ldrh r0, [r2]\n\
|
||||
adds r1, 0xBA\n\
|
||||
strh r0, [r1]\n\
|
||||
mov r1, r9\n\
|
||||
mov r0, r8\n\
|
||||
strh r1, [r0]\n\
|
||||
b _081A1362\n\
|
||||
.pool\n\
|
||||
_081A1308:\n\
|
||||
adds r0, r4, 0x1\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r4, r0, 24\n\
|
||||
cmp r4, r5\n\
|
||||
bcs _081A1322\n\
|
||||
ldr r0, [r6]\n\
|
||||
adds r0, 0xB1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 26\n\
|
||||
lsrs r0, 28\n\
|
||||
subs r0, 0x3\n\
|
||||
cmp r4, r0\n\
|
||||
blt _081A1296\n\
|
||||
_081A1322:\n\
|
||||
ldr r2, [r7]\n\
|
||||
adds r0, r2, 0\n\
|
||||
adds r0, 0xB1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 26\n\
|
||||
lsrs r0, 28\n\
|
||||
subs r0, 0x3\n\
|
||||
lsls r0, 2\n\
|
||||
adds r2, r0\n\
|
||||
adds r2, 0xB8\n\
|
||||
ldrb r1, [r2]\n\
|
||||
movs r0, 0x3F\n\
|
||||
ands r0, r1\n\
|
||||
movs r1, 0x40\n\
|
||||
orrs r0, r1\n\
|
||||
strb r0, [r2]\n\
|
||||
ldr r1, [r7]\n\
|
||||
adds r0, r1, 0\n\
|
||||
adds r0, 0xB1\n\
|
||||
ldrb r0, [r0]\n\
|
||||
lsls r0, 26\n\
|
||||
lsrs r0, 28\n\
|
||||
subs r0, 0x3\n\
|
||||
lsls r0, 2\n\
|
||||
adds r1, r0\n\
|
||||
mov r2, r12\n\
|
||||
ldrh r0, [r2]\n\
|
||||
adds r1, 0xBA\n\
|
||||
strh r0, [r1]\n\
|
||||
movs r0, 0x1\n\
|
||||
mov r1, r8\n\
|
||||
strh r0, [r1]\n\
|
||||
_081A1362:\n\
|
||||
pop {r3,r4}\n\
|
||||
mov r8, r3\n\
|
||||
mov r9, r4\n\
|
||||
pop {r4-r7}\n\
|
||||
pop {r0}\n\
|
||||
bx r0\n\
|
||||
");
|
||||
}
|
||||
#endif // NONMATCHING
|
||||
|
||||
static void sub_81A1370(void)
|
||||
{
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "random.h"
|
||||
#include "util.h"
|
||||
#include "constants/abilities.h"
|
||||
#include "constants/item_effects.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/moves.h"
|
||||
#include "constants/species.h"
|
||||
@ -778,18 +779,17 @@ u8 GetMostSuitableMonToSwitchInto(void)
|
||||
return bestMonId;
|
||||
}
|
||||
|
||||
// TODO: use PokemonItemEffect struct instead of u8 once it's documented.
|
||||
static u8 GetAI_ItemType(u8 itemId, const u8 *itemEffect) // NOTE: should take u16 as item Id argument
|
||||
{
|
||||
if (itemId == ITEM_FULL_RESTORE)
|
||||
return AI_ITEM_FULL_RESTORE;
|
||||
else if (itemEffect[4] & 4)
|
||||
else if (itemEffect[4] & ITEM4_HEAL_HP)
|
||||
return AI_ITEM_HEAL_HP;
|
||||
else if (itemEffect[3] & 0x3F)
|
||||
else if (itemEffect[3] & ITEM3_STATUS_ALL)
|
||||
return AI_ITEM_CURE_CONDITION;
|
||||
else if (itemEffect[0] & 0x3F || itemEffect[1] != 0 || itemEffect[2] != 0)
|
||||
else if (itemEffect[0] & (ITEM0_HIGH_CRIT | ITEM0_X_ATTACK) || itemEffect[1] != 0 || itemEffect[2] != 0)
|
||||
return AI_ITEM_X_STAT;
|
||||
else if (itemEffect[3] & 0x80)
|
||||
else if (itemEffect[3] & ITEM3_MIST)
|
||||
return AI_ITEM_GUARD_SPECS;
|
||||
else
|
||||
return AI_ITEM_NOT_RECOGNIZABLE;
|
||||
@ -832,13 +832,13 @@ static bool8 ShouldUseItem(void)
|
||||
item = gBattleResources->battleHistory->trainerItems[i];
|
||||
if (item == ITEM_NONE)
|
||||
continue;
|
||||
if (gItemEffectTable[item - 13] == NULL)
|
||||
if (gItemEffectTable[item - ITEM_POTION] == NULL)
|
||||
continue;
|
||||
|
||||
if (item == ITEM_ENIGMA_BERRY)
|
||||
itemEffects = gSaveBlock1Ptr->enigmaBerry.itemEffect;
|
||||
else
|
||||
itemEffects = gItemEffectTable[item - 13];
|
||||
itemEffects = gItemEffectTable[item - ITEM_POTION];
|
||||
|
||||
*(gBattleStruct->AI_itemType + gActiveBattler / 2) = GetAI_ItemType(item, itemEffects);
|
||||
|
||||
@ -862,32 +862,32 @@ static bool8 ShouldUseItem(void)
|
||||
break;
|
||||
case AI_ITEM_CURE_CONDITION:
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) = 0;
|
||||
if (itemEffects[3] & 0x20 && gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP)
|
||||
if (itemEffects[3] & ITEM3_SLEEP && gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP)
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x20;
|
||||
shouldUse = TRUE;
|
||||
}
|
||||
if (itemEffects[3] & 0x10 && (gBattleMons[gActiveBattler].status1 & STATUS1_POISON || gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_POISON))
|
||||
if (itemEffects[3] & ITEM3_POISON && (gBattleMons[gActiveBattler].status1 & STATUS1_POISON || gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_POISON))
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x10;
|
||||
shouldUse = TRUE;
|
||||
}
|
||||
if (itemEffects[3] & 0x8 && gBattleMons[gActiveBattler].status1 & STATUS1_BURN)
|
||||
if (itemEffects[3] & ITEM3_BURN && gBattleMons[gActiveBattler].status1 & STATUS1_BURN)
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x8;
|
||||
shouldUse = TRUE;
|
||||
}
|
||||
if (itemEffects[3] & 0x4 && gBattleMons[gActiveBattler].status1 & STATUS1_FREEZE)
|
||||
if (itemEffects[3] & ITEM3_FREEZE && gBattleMons[gActiveBattler].status1 & STATUS1_FREEZE)
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x4;
|
||||
shouldUse = TRUE;
|
||||
}
|
||||
if (itemEffects[3] & 0x2 && gBattleMons[gActiveBattler].status1 & STATUS1_PARALYSIS)
|
||||
if (itemEffects[3] & ITEM3_PARALYSIS && gBattleMons[gActiveBattler].status1 & STATUS1_PARALYSIS)
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x2;
|
||||
shouldUse = TRUE;
|
||||
}
|
||||
if (itemEffects[3] & 0x1 && gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION)
|
||||
if (itemEffects[3] & ITEM3_CONFUSION && gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION)
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x1;
|
||||
shouldUse = TRUE;
|
||||
@ -897,17 +897,17 @@ static bool8 ShouldUseItem(void)
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) = 0;
|
||||
if (gDisableStructs[gActiveBattler].isFirstTurn == 0)
|
||||
break;
|
||||
if (itemEffects[0] & 0xF)
|
||||
if (itemEffects[0] & ITEM0_X_ATTACK)
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x1;
|
||||
if (itemEffects[1] & 0xF0)
|
||||
if (itemEffects[1] & ITEM1_X_DEFEND)
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x2;
|
||||
if (itemEffects[1] & 0xF)
|
||||
if (itemEffects[1] & ITEM1_X_SPEED)
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x4;
|
||||
if (itemEffects[2] & 0xF)
|
||||
if (itemEffects[2] & ITEM2_X_SPATK)
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x8;
|
||||
if (itemEffects[2] & 0xF0)
|
||||
if (itemEffects[2] & ITEM2_X_ACCURACY)
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x20;
|
||||
if (itemEffects[0] & 0x30)
|
||||
if (itemEffects[0] & ITEM0_HIGH_CRIT)
|
||||
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x80;
|
||||
shouldUse = TRUE;
|
||||
break;
|
||||
|
2684
src/data/items.h
2684
src/data/items.h
File diff suppressed because it is too large
Load Diff
@ -1,236 +1,476 @@
|
||||
const u8 gItemEffect_Potion[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 20};
|
||||
const u8 gItemEffect_Antidote[] = {0x00, 0x00, 0x00, 0x10, 0x00, 0x00};
|
||||
const u8 gItemEffect_BurnHeal[] = {0x00, 0x00, 0x00, 0x08, 0x00, 0x00};
|
||||
const u8 gItemEffect_IceHeal[] = {0x00, 0x00, 0x00, 0x04, 0x00, 0x00};
|
||||
const u8 gItemEffect_Awakening[] = {0x00, 0x00, 0x00, 0x20, 0x00, 0x00};
|
||||
const u8 gItemEffect_ParalyzeHeal[] = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00};
|
||||
const u8 gItemEffect_FullRestore[] = {0x00, 0x00, 0x00, 0x3f, 0x04, 0x00, 0xff};
|
||||
const u8 gItemEffect_MaxPotion[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0xff};
|
||||
const u8 gItemEffect_HyperPotion[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 200};
|
||||
const u8 gItemEffect_SuperPotion[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 50};
|
||||
const u8 gItemEffect_FullHeal[] = {0x00, 0x00, 0x00, 0x3f, 0x00, 0x00};
|
||||
const u8 gItemEffect_Revive[] = {0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0xfe};
|
||||
const u8 gItemEffect_MaxRevive[] = {0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0xff};
|
||||
const u8 gItemEffect_FreshWater[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 50};
|
||||
const u8 gItemEffect_SodaPop[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 60};
|
||||
const u8 gItemEffect_Lemonade[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 80};
|
||||
const u8 gItemEffect_MoomooMilk[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 100};
|
||||
const u8 gItemEffect_EnergyPowder[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0xe0, 50, 0xfb, 0xfb, 0xf6};
|
||||
const u8 gItemEffect_EnergyRoot[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0xe0, 200, 0xf6, 0xf6, 0xf1};
|
||||
const u8 gItemEffect_HealPowder[] = {0x00, 0x00, 0x00, 0x3f, 0x00, 0xe0, 0xfb, 0xfb, 0xf6};
|
||||
const u8 gItemEffect_RevivalHerb[] = {0x00, 0x00, 0x00, 0x00, 0x44, 0xe0, 0xff, 0xf1, 0xf1, 0xec};
|
||||
const u8 gItemEffect_Ether[] = {0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x0a};
|
||||
const u8 gItemEffect_MaxEther[] = {0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x7f};
|
||||
const u8 gItemEffect_Elixir[] = {0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0a};
|
||||
const u8 gItemEffect_MaxElixir[] = {0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x7f};
|
||||
const u8 gItemEffect_LavaCookie[] = {0x00, 0x00, 0x00, 0x3f, 0x00, 0x00};
|
||||
const u8 gItemEffect_BlueFlute[] = {0x00, 0x00, 0x00, 0x20, 0x00, 0x00};
|
||||
const u8 gItemEffect_YellowFlute[] = {0x00, 0x00, 0x00, 0x01, 0x00, 0x00};
|
||||
const u8 gItemEffect_RedFlute[] = {0x80, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
const u8 gItemEffect_BerryJuice[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 20};
|
||||
const u8 gItemEffect_SacredAsh[] = {0x40, 0x00, 0x00, 0x00, 0x44, 0x00, 0xff};
|
||||
const u8 gItemEffect_HPUp[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0xe0, 0x0a, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_Protein[] = {0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0x0a, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_Iron[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, 0x0a, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_Carbos[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x0a, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_Calcium[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x0a, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_RareCandy[] = {0x00, 0x00, 0x00, 0x40, 0x44, 0xe0, 253, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_PPUp[] = {0x00, 0x00, 0x00, 0x00, 0x20, 0xe0, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_Zinc[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0x0a, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_PPMax[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x05, 0x03, 0x02};
|
||||
const u8 gItemEffect_GuardSpec[] = {0x00, 0x00, 0x00, 0x80, 0x00, 0x60, 0x01, 0x01};
|
||||
const u8 gItemEffect_DireHit[] = {0x20, 0x00, 0x00, 0x00, 0x00, 0x60, 0x01, 0x01};
|
||||
const u8 gItemEffect_XAttack[] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x60, 0x01, 0x01};
|
||||
const u8 gItemEffect_XDefend[] = {0x00, 0x10, 0x00, 0x00, 0x00, 0x60, 0x01, 0x01};
|
||||
const u8 gItemEffect_XSpeed[] = {0x00, 0x01, 0x00, 0x00, 0x00, 0x60, 0x01, 0x01};
|
||||
const u8 gItemEffect_XAccuracy[] = {0x00, 0x00, 0x10, 0x00, 0x00, 0x60, 0x01, 0x01};
|
||||
const u8 gItemEffect_XSpecial[] = {0x00, 0x00, 0x01, 0x00, 0x00, 0x60, 0x01, 0x01};
|
||||
const u8 gItemEffect_SunStone[] = {0x00, 0x00, 0x00, 0x00, 0x80, 0x00};
|
||||
const u8 gItemEffect_MoonStone[] = {0x00, 0x00, 0x00, 0x00, 0x80, 0x00};
|
||||
const u8 gItemEffect_FireStone[] = {0x00, 0x00, 0x00, 0x00, 0x80, 0x00};
|
||||
const u8 gItemEffect_ThunderStone[] = {0x00, 0x00, 0x00, 0x00, 0x80, 0x00};
|
||||
const u8 gItemEffect_WaterStone[] = {0x00, 0x00, 0x00, 0x00, 0x80, 0x00};
|
||||
const u8 gItemEffect_LeafStone[] = {0x00, 0x00, 0x00, 0x00, 0x80, 0x00};
|
||||
const u8 gItemEffect_CheriBerry[] = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00};
|
||||
const u8 gItemEffect_ChestoBerry[] = {0x00, 0x00, 0x00, 0x20, 0x00, 0x00};
|
||||
const u8 gItemEffect_PechaBerry[] = {0x00, 0x00, 0x00, 0x10, 0x00, 0x00};
|
||||
const u8 gItemEffect_RawstBerry[] = {0x00, 0x00, 0x00, 0x08, 0x00, 0x00};
|
||||
const u8 gItemEffect_AspearBerry[] = {0x00, 0x00, 0x00, 0x04, 0x00, 0x00};
|
||||
const u8 gItemEffect_LeppaBerry[] = {0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x0a};
|
||||
const u8 gItemEffect_OranBerry[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 10};
|
||||
const u8 gItemEffect_PersimBerry[] = {0x00, 0x00, 0x00, 0x01, 0x00, 0x00};
|
||||
const u8 gItemEffect_LumBerry[] = {0x00, 0x00, 0x00, 0x3f, 0x00, 0x00};
|
||||
const u8 gItemEffect_SitrusBerry[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 30};
|
||||
const u8 gItemEffect_PomegBerry[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0xe0, 0xf6, 0x0a, 0x05, 0x02};
|
||||
const u8 gItemEffect_KelpsyBerry[] = {0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0xf6, 0x0a, 0x05, 0x02};
|
||||
const u8 gItemEffect_QualotBerry[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, 0xf6, 0x0a, 0x05, 0x02};
|
||||
const u8 gItemEffect_HondrewBerry[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0xf6, 0x0a, 0x05, 0x02};
|
||||
const u8 gItemEffect_GrepaBerry[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0xf6, 0x0a, 0x05, 0x02};
|
||||
const u8 gItemEffect_TamatoBerry[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0xf6, 0x0a, 0x05, 0x02};
|
||||
const u8 gItemEffect_Potion[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 20,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Antidote[6] = {
|
||||
[3] = ITEM3_POISON,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_BurnHeal[6] = {
|
||||
[3] = ITEM3_BURN,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_IceHeal[6] = {
|
||||
[3] = ITEM3_FREEZE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Awakening[6] = {
|
||||
[3] = ITEM3_SLEEP,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_ParalyzeHeal[6] = {
|
||||
[3] = ITEM3_PARALYSIS,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_FullRestore[7] = {
|
||||
[3] = ITEM3_STATUS_ALL,
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = -1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_MaxPotion[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = -1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_HyperPotion[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 200,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_SuperPotion[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 50,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_FullHeal[6] = {
|
||||
[3] = ITEM3_STATUS_ALL,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Revive[7] = {
|
||||
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
|
||||
[6] = -2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_MaxRevive[7] = {
|
||||
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
|
||||
[6] = -1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_FreshWater[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 50,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_SodaPop[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 60,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Lemonade[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 80,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_MoomooMilk[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 100,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_EnergyPowder[10] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 50,
|
||||
[7] = -5,
|
||||
[8] = -5,
|
||||
[9] = -10,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_EnergyRoot[10] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 200,
|
||||
[7] = -10,
|
||||
[8] = -10,
|
||||
[9] = -15,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_HealPowder[9] = {
|
||||
[3] = ITEM3_STATUS_ALL,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -5,
|
||||
[7] = -5,
|
||||
[8] = -10,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_RevivalHerb[10] = {
|
||||
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -1,
|
||||
[7] = -15,
|
||||
[8] = -15,
|
||||
[9] = -20,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Ether[7] = {
|
||||
[4] = ITEM4_HEAL_PP_ONE | ITEM4_HEAL_PP_ALL,
|
||||
[6] = 10,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_MaxEther[7] = {
|
||||
[4] = ITEM4_HEAL_PP_ONE | ITEM4_HEAL_PP_ALL,
|
||||
[6] = 0x7F,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Elixir[7] = {
|
||||
[4] = ITEM4_HEAL_PP_ALL,
|
||||
[6] = 10,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_MaxElixir[7] = {
|
||||
[4] = ITEM4_HEAL_PP_ALL,
|
||||
[6] = 0x7F,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_LavaCookie[6] = {
|
||||
[3] = ITEM3_STATUS_ALL,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_BlueFlute[6] = {
|
||||
[3] = ITEM3_SLEEP,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_YellowFlute[6] = {
|
||||
[3] = ITEM3_CONFUSION,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_RedFlute[6] = {
|
||||
[0] = ITEM0_INFATUATION,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_BerryJuice[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 20,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_SacredAsh[7] = {
|
||||
[0] = ITEM0_SACRED_ASH,
|
||||
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
|
||||
[6] = -1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_HPUp[10] = {
|
||||
[4] = ITEM4_EV_HP,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 10,
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Protein[10] = {
|
||||
[4] = ITEM4_EV_ATK,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 10,
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Iron[10] = {
|
||||
[5] = ITEM5_EV_DEF | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 10,
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Carbos[10] = {
|
||||
[5] = ITEM5_EV_SPEED | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 10,
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Calcium[10] = {
|
||||
[5] = ITEM5_EV_SPATK | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 10,
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_RareCandy[10] = {
|
||||
[3] = ITEM3_LEVEL_UP,
|
||||
[4] = ITEM4_REVIVE | ITEM4_HEAL_HP,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 0xFD,
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_PPUp[9] = {
|
||||
[4] = ITEM4_PP_UP,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 5,
|
||||
[7] = 3,
|
||||
[8] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Zinc[10] = {
|
||||
[5] = ITEM5_EV_SPDEF | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 10,
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_PPMax[9] = {
|
||||
[5] = ITEM5_PP_MAX | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = 5,
|
||||
[7] = 3,
|
||||
[8] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_GuardSpec[8] = {
|
||||
[3] = ITEM3_MIST,
|
||||
[5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID,
|
||||
[6] = 1,
|
||||
[7] = 1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_DireHit[8] = {
|
||||
[0] = 2 << 4,
|
||||
[5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID,
|
||||
[6] = 1,
|
||||
[7] = 1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_XAttack[8] = {
|
||||
[0] = 1,
|
||||
[5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID,
|
||||
[6] = 1,
|
||||
[7] = 1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_XDefend[8] = {
|
||||
[1] = 1 << 4,
|
||||
[5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID,
|
||||
[6] = 1,
|
||||
[7] = 1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_XSpeed[8] = {
|
||||
[1] = 1,
|
||||
[5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID,
|
||||
[6] = 1,
|
||||
[7] = 1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_XAccuracy[8] = {
|
||||
[2] = 1 << 4,
|
||||
[5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID,
|
||||
[6] = 1,
|
||||
[7] = 1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_XSpecial[8] = {
|
||||
[2] = 1,
|
||||
[5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID,
|
||||
[6] = 1,
|
||||
[7] = 1,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_SunStone[6] = {
|
||||
[4] = ITEM4_EVO_STONE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_MoonStone[6] = {
|
||||
[4] = ITEM4_EVO_STONE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_FireStone[6] = {
|
||||
[4] = ITEM4_EVO_STONE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_ThunderStone[6] = {
|
||||
[4] = ITEM4_EVO_STONE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_WaterStone[6] = {
|
||||
[4] = ITEM4_EVO_STONE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_LeafStone[6] = {
|
||||
[4] = ITEM4_EVO_STONE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_CheriBerry[6] = {
|
||||
[3] = ITEM3_PARALYSIS,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_ChestoBerry[6] = {
|
||||
[3] = ITEM3_SLEEP,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_PechaBerry[6] = {
|
||||
[3] = ITEM3_POISON,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_RawstBerry[6] = {
|
||||
[3] = ITEM3_BURN,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_AspearBerry[6] = {
|
||||
[3] = ITEM3_FREEZE,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_LeppaBerry[7] = {
|
||||
[4] = ITEM4_HEAL_PP_ONE | ITEM4_HEAL_PP_ALL,
|
||||
[6] = 10,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_OranBerry[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 10,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_PersimBerry[6] = {
|
||||
[3] = ITEM3_CONFUSION,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_LumBerry[6] = {
|
||||
[3] = ITEM3_STATUS_ALL,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_SitrusBerry[7] = {
|
||||
[4] = ITEM4_HEAL_HP,
|
||||
[6] = 30,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_PomegBerry[10] = {
|
||||
[4] = ITEM4_EV_HP,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -10,
|
||||
[7] = 10,
|
||||
[8] = 5,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_KelpsyBerry[10] = {
|
||||
[4] = ITEM4_EV_ATK,
|
||||
[5] = ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -10,
|
||||
[7] = 10,
|
||||
[8] = 5,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_QualotBerry[10] = {
|
||||
[5] = ITEM5_EV_DEF | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -10,
|
||||
[7] = 10,
|
||||
[8] = 5,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_HondrewBerry[10] = {
|
||||
[5] = ITEM5_EV_SPATK | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -10,
|
||||
[7] = 10,
|
||||
[8] = 5,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_GrepaBerry[10] = {
|
||||
[5] = ITEM5_EV_SPDEF | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -10,
|
||||
[7] = 10,
|
||||
[8] = 5,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_TamatoBerry[10] = {
|
||||
[5] = ITEM5_EV_SPEED | ITEM5_FRIENDSHIP_ALL,
|
||||
[6] = -10,
|
||||
[7] = 10,
|
||||
[8] = 5,
|
||||
[9] = 2,
|
||||
};
|
||||
|
||||
const u8 *const gItemEffectTable[] =
|
||||
{
|
||||
gItemEffect_Potion,
|
||||
gItemEffect_Antidote,
|
||||
gItemEffect_BurnHeal,
|
||||
gItemEffect_IceHeal,
|
||||
gItemEffect_Awakening,
|
||||
gItemEffect_ParalyzeHeal,
|
||||
gItemEffect_FullRestore,
|
||||
gItemEffect_MaxPotion,
|
||||
gItemEffect_HyperPotion,
|
||||
gItemEffect_SuperPotion,
|
||||
gItemEffect_FullHeal,
|
||||
gItemEffect_Revive,
|
||||
gItemEffect_MaxRevive,
|
||||
gItemEffect_FreshWater,
|
||||
gItemEffect_SodaPop,
|
||||
gItemEffect_Lemonade,
|
||||
gItemEffect_MoomooMilk,
|
||||
gItemEffect_EnergyPowder,
|
||||
gItemEffect_EnergyRoot,
|
||||
gItemEffect_HealPowder,
|
||||
gItemEffect_RevivalHerb,
|
||||
gItemEffect_Ether,
|
||||
gItemEffect_MaxEther,
|
||||
gItemEffect_Elixir,
|
||||
gItemEffect_MaxElixir,
|
||||
gItemEffect_LavaCookie,
|
||||
gItemEffect_BlueFlute,
|
||||
gItemEffect_YellowFlute,
|
||||
gItemEffect_RedFlute,
|
||||
NULL,
|
||||
NULL,
|
||||
gItemEffect_BerryJuice,
|
||||
gItemEffect_SacredAsh,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
gItemEffect_HPUp,
|
||||
gItemEffect_Protein,
|
||||
gItemEffect_Iron,
|
||||
gItemEffect_Carbos,
|
||||
gItemEffect_Calcium,
|
||||
gItemEffect_RareCandy,
|
||||
gItemEffect_PPUp,
|
||||
gItemEffect_Zinc,
|
||||
gItemEffect_PPMax,
|
||||
NULL,
|
||||
gItemEffect_GuardSpec,
|
||||
gItemEffect_DireHit,
|
||||
gItemEffect_XAttack,
|
||||
gItemEffect_XDefend,
|
||||
gItemEffect_XSpeed,
|
||||
gItemEffect_XAccuracy,
|
||||
gItemEffect_XSpecial,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
gItemEffect_SunStone,
|
||||
gItemEffect_MoonStone,
|
||||
gItemEffect_FireStone,
|
||||
gItemEffect_ThunderStone,
|
||||
gItemEffect_WaterStone,
|
||||
gItemEffect_LeafStone,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
gItemEffect_CheriBerry,
|
||||
gItemEffect_ChestoBerry,
|
||||
gItemEffect_PechaBerry,
|
||||
gItemEffect_RawstBerry,
|
||||
gItemEffect_AspearBerry,
|
||||
gItemEffect_LeppaBerry,
|
||||
gItemEffect_OranBerry,
|
||||
gItemEffect_PersimBerry,
|
||||
gItemEffect_LumBerry,
|
||||
gItemEffect_SitrusBerry,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
gItemEffect_PomegBerry,
|
||||
gItemEffect_KelpsyBerry,
|
||||
gItemEffect_QualotBerry,
|
||||
gItemEffect_HondrewBerry,
|
||||
gItemEffect_GrepaBerry,
|
||||
gItemEffect_TamatoBerry,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
[ITEM_POTION - ITEM_POTION] = gItemEffect_Potion,
|
||||
[ITEM_ANTIDOTE - ITEM_POTION] = gItemEffect_Antidote,
|
||||
[ITEM_BURN_HEAL - ITEM_POTION] = gItemEffect_BurnHeal,
|
||||
[ITEM_ICE_HEAL - ITEM_POTION] = gItemEffect_IceHeal,
|
||||
[ITEM_AWAKENING - ITEM_POTION] = gItemEffect_Awakening,
|
||||
[ITEM_PARALYZE_HEAL - ITEM_POTION] = gItemEffect_ParalyzeHeal,
|
||||
[ITEM_FULL_RESTORE - ITEM_POTION] = gItemEffect_FullRestore,
|
||||
[ITEM_MAX_POTION - ITEM_POTION] = gItemEffect_MaxPotion,
|
||||
[ITEM_HYPER_POTION - ITEM_POTION] = gItemEffect_HyperPotion,
|
||||
[ITEM_SUPER_POTION - ITEM_POTION] = gItemEffect_SuperPotion,
|
||||
[ITEM_FULL_HEAL - ITEM_POTION] = gItemEffect_FullHeal,
|
||||
[ITEM_REVIVE - ITEM_POTION] = gItemEffect_Revive,
|
||||
[ITEM_MAX_REVIVE - ITEM_POTION] = gItemEffect_MaxRevive,
|
||||
[ITEM_FRESH_WATER - ITEM_POTION] = gItemEffect_FreshWater,
|
||||
[ITEM_SODA_POP - ITEM_POTION] = gItemEffect_SodaPop,
|
||||
[ITEM_LEMONADE - ITEM_POTION] = gItemEffect_Lemonade,
|
||||
[ITEM_MOOMOO_MILK - ITEM_POTION] = gItemEffect_MoomooMilk,
|
||||
[ITEM_ENERGY_POWDER - ITEM_POTION] = gItemEffect_EnergyPowder,
|
||||
[ITEM_ENERGY_ROOT - ITEM_POTION] = gItemEffect_EnergyRoot,
|
||||
[ITEM_HEAL_POWDER - ITEM_POTION] = gItemEffect_HealPowder,
|
||||
[ITEM_REVIVAL_HERB - ITEM_POTION] = gItemEffect_RevivalHerb,
|
||||
[ITEM_ETHER - ITEM_POTION] = gItemEffect_Ether,
|
||||
[ITEM_MAX_ETHER - ITEM_POTION] = gItemEffect_MaxEther,
|
||||
[ITEM_ELIXIR - ITEM_POTION] = gItemEffect_Elixir,
|
||||
[ITEM_MAX_ELIXIR - ITEM_POTION] = gItemEffect_MaxElixir,
|
||||
[ITEM_LAVA_COOKIE - ITEM_POTION] = gItemEffect_LavaCookie,
|
||||
[ITEM_BLUE_FLUTE - ITEM_POTION] = gItemEffect_BlueFlute,
|
||||
[ITEM_YELLOW_FLUTE - ITEM_POTION] = gItemEffect_YellowFlute,
|
||||
[ITEM_RED_FLUTE - ITEM_POTION] = gItemEffect_RedFlute,
|
||||
[ITEM_BERRY_JUICE - ITEM_POTION] = gItemEffect_BerryJuice,
|
||||
[ITEM_SACRED_ASH - ITEM_POTION] = gItemEffect_SacredAsh,
|
||||
[ITEM_HP_UP - ITEM_POTION] = gItemEffect_HPUp,
|
||||
[ITEM_PROTEIN - ITEM_POTION] = gItemEffect_Protein,
|
||||
[ITEM_IRON - ITEM_POTION] = gItemEffect_Iron,
|
||||
[ITEM_CARBOS - ITEM_POTION] = gItemEffect_Carbos,
|
||||
[ITEM_CALCIUM - ITEM_POTION] = gItemEffect_Calcium,
|
||||
[ITEM_RARE_CANDY - ITEM_POTION] = gItemEffect_RareCandy,
|
||||
[ITEM_PP_UP - ITEM_POTION] = gItemEffect_PPUp,
|
||||
[ITEM_ZINC - ITEM_POTION] = gItemEffect_Zinc,
|
||||
[ITEM_PP_MAX - ITEM_POTION] = gItemEffect_PPMax,
|
||||
[ITEM_GUARD_SPEC - ITEM_POTION] = gItemEffect_GuardSpec,
|
||||
[ITEM_DIRE_HIT - ITEM_POTION] = gItemEffect_DireHit,
|
||||
[ITEM_X_ATTACK - ITEM_POTION] = gItemEffect_XAttack,
|
||||
[ITEM_X_DEFEND - ITEM_POTION] = gItemEffect_XDefend,
|
||||
[ITEM_X_SPEED - ITEM_POTION] = gItemEffect_XSpeed,
|
||||
[ITEM_X_ACCURACY - ITEM_POTION] = gItemEffect_XAccuracy,
|
||||
[ITEM_X_SPECIAL - ITEM_POTION] = gItemEffect_XSpecial,
|
||||
[ITEM_SUN_STONE - ITEM_POTION] = gItemEffect_SunStone,
|
||||
[ITEM_MOON_STONE - ITEM_POTION] = gItemEffect_MoonStone,
|
||||
[ITEM_FIRE_STONE - ITEM_POTION] = gItemEffect_FireStone,
|
||||
[ITEM_THUNDER_STONE - ITEM_POTION] = gItemEffect_ThunderStone,
|
||||
[ITEM_WATER_STONE - ITEM_POTION] = gItemEffect_WaterStone,
|
||||
[ITEM_LEAF_STONE - ITEM_POTION] = gItemEffect_LeafStone,
|
||||
[ITEM_CHERI_BERRY - ITEM_POTION] = gItemEffect_CheriBerry,
|
||||
[ITEM_CHESTO_BERRY - ITEM_POTION] = gItemEffect_ChestoBerry,
|
||||
[ITEM_PECHA_BERRY - ITEM_POTION] = gItemEffect_PechaBerry,
|
||||
[ITEM_RAWST_BERRY - ITEM_POTION] = gItemEffect_RawstBerry,
|
||||
[ITEM_ASPEAR_BERRY - ITEM_POTION] = gItemEffect_AspearBerry,
|
||||
[ITEM_LEPPA_BERRY - ITEM_POTION] = gItemEffect_LeppaBerry,
|
||||
[ITEM_ORAN_BERRY - ITEM_POTION] = gItemEffect_OranBerry,
|
||||
[ITEM_PERSIM_BERRY - ITEM_POTION] = gItemEffect_PersimBerry,
|
||||
[ITEM_LUM_BERRY - ITEM_POTION] = gItemEffect_LumBerry,
|
||||
[ITEM_SITRUS_BERRY - ITEM_POTION] = gItemEffect_SitrusBerry,
|
||||
[ITEM_POMEG_BERRY - ITEM_POTION] = gItemEffect_PomegBerry,
|
||||
[ITEM_KELPSY_BERRY - ITEM_POTION] = gItemEffect_KelpsyBerry,
|
||||
[ITEM_QUALOT_BERRY - ITEM_POTION] = gItemEffect_QualotBerry,
|
||||
[ITEM_HONDEW_BERRY - ITEM_POTION] = gItemEffect_HondrewBerry,
|
||||
[ITEM_GREPA_BERRY - ITEM_POTION] = gItemEffect_GrepaBerry,
|
||||
[ITEM_TAMATO_BERRY - ITEM_POTION] = gItemEffect_TamatoBerry,
|
||||
[LAST_BERRY_INDEX - ITEM_POTION] = NULL
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -37,6 +37,7 @@
|
||||
#include "constants/bg_event_constants.h"
|
||||
#include "constants/event_objects.h"
|
||||
#include "constants/flags.h"
|
||||
#include "constants/item_effects.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/vars.h"
|
||||
@ -1026,44 +1027,45 @@ void ItemUseInBattle_Escape(u8 taskId)
|
||||
|
||||
void ItemUseOutOfBattle_EnigmaBerry(u8 taskId)
|
||||
{
|
||||
switch (GetItemEffectType(gSpecialVar_ItemId) - 1)
|
||||
switch (GetItemEffectType(gSpecialVar_ItemId))
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
case ITEM_EFFECT_HEAL_HP:
|
||||
case ITEM_EFFECT_CURE_POISON:
|
||||
case ITEM_EFFECT_CURE_SLEEP:
|
||||
case ITEM_EFFECT_CURE_BURN:
|
||||
case ITEM_EFFECT_CURE_FREEZE:
|
||||
case ITEM_EFFECT_CURE_PARALYSIS:
|
||||
case ITEM_EFFECT_CURE_ALL_STATUS:
|
||||
case ITEM_EFFECT_ATK_EV:
|
||||
case ITEM_EFFECT_HP_EV:
|
||||
case ITEM_EFFECT_SPATK_EV:
|
||||
case ITEM_EFFECT_SPDEF_EV:
|
||||
case ITEM_EFFECT_SPEED_EV:
|
||||
case ITEM_EFFECT_DEF_EV:
|
||||
gTasks[taskId].data[4] = 1;
|
||||
ItemUseOutOfBattle_Medicine(taskId);
|
||||
break;
|
||||
case 9:
|
||||
case ITEM_EFFECT_SACRED_ASH:
|
||||
gTasks[taskId].data[4] = 1;
|
||||
ItemUseOutOfBattle_SacredAsh(taskId);
|
||||
break;
|
||||
case 0:
|
||||
case ITEM_EFFECT_RAISE_LEVEL:
|
||||
gTasks[taskId].data[4] = 1;
|
||||
ItemUseOutOfBattle_RareCandy(taskId);
|
||||
break;
|
||||
case 18:
|
||||
case 19:
|
||||
case ITEM_EFFECT_PP_UP:
|
||||
case ITEM_EFFECT_PP_MAX:
|
||||
gTasks[taskId].data[4] = 1;
|
||||
ItemUseOutOfBattle_PPUp(taskId);
|
||||
break;
|
||||
case 20:
|
||||
case ITEM_EFFECT_HEAL_PP:
|
||||
gTasks[taskId].data[4] = 1;
|
||||
ItemUseOutOfBattle_PPRecovery(taskId);
|
||||
break;
|
||||
default:
|
||||
gTasks[taskId].data[4] = 4;
|
||||
ItemUseOutOfBattle_CannotUse(taskId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1071,25 +1073,26 @@ void ItemUseInBattle_EnigmaBerry(u8 taskId)
|
||||
{
|
||||
switch (GetItemEffectType(gSpecialVar_ItemId))
|
||||
{
|
||||
case 0:
|
||||
case ITEM_EFFECT_X_ITEM:
|
||||
ItemUseInBattle_StatIncrease(taskId);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 11:
|
||||
case ITEM_EFFECT_HEAL_HP:
|
||||
case ITEM_EFFECT_CURE_POISON:
|
||||
case ITEM_EFFECT_CURE_SLEEP:
|
||||
case ITEM_EFFECT_CURE_BURN:
|
||||
case ITEM_EFFECT_CURE_FREEZE:
|
||||
case ITEM_EFFECT_CURE_PARALYSIS:
|
||||
case ITEM_EFFECT_CURE_ALL_STATUS:
|
||||
case ITEM_EFFECT_CURE_CONFUSION:
|
||||
case ITEM_EFFECT_CURE_INFATUATION:
|
||||
ItemUseInBattle_Medicine(taskId);
|
||||
break;
|
||||
case 21:
|
||||
case ITEM_EFFECT_HEAL_PP:
|
||||
ItemUseInBattle_PPRecovery(taskId);
|
||||
break;
|
||||
default:
|
||||
ItemUseOutOfBattle_CannotUse(taskId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2002,7 +2002,7 @@ void sub_8197080(u8 *destStr)
|
||||
Free(buffer);
|
||||
}
|
||||
|
||||
void sub_8197184(u8 windowId, u32 destOffset, u32 paletteId)
|
||||
void sub_8197184(u32 windowId, u32 destOffset, u32 paletteId)
|
||||
{
|
||||
u8 bg = GetWindowAttribute(windowId, WINDOW_BG);
|
||||
LoadBgTiles(bg, sUnknown_0860EA6C, 0x100, destOffset);
|
||||
|
177
src/party_menu.c
177
src/party_menu.c
@ -68,6 +68,7 @@
|
||||
#include "constants/easy_chat.h"
|
||||
#include "constants/field_effects.h"
|
||||
#include "constants/flags.h"
|
||||
#include "constants/item_effects.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/maps.h"
|
||||
#include "constants/moves.h"
|
||||
@ -298,8 +299,8 @@ static u8 sub_81B8984(void);
|
||||
static void sub_81B6280(u8);
|
||||
static void c2_815ABFC(void);
|
||||
static void sub_81B672C(u8);
|
||||
static u16 sub_81B691C(struct Pokemon*, u8);
|
||||
static void option_menu_get_string(u8, u8*);
|
||||
static u16 ItemEffectToMonEv(struct Pokemon*, u8);
|
||||
static void ItemEffectToStatString(u8, u8*);
|
||||
static void sub_81B6BB4(u8);
|
||||
static void ether_effect_related_2(u8);
|
||||
static void ether_effect_related(u8);
|
||||
@ -5230,7 +5231,7 @@ void sub_81B617C(void)
|
||||
doubleBattleStatus = 0;
|
||||
}
|
||||
|
||||
if (GetItemEffectType(gSpecialVar_ItemId) == 10)
|
||||
if (GetItemEffectType(gSpecialVar_ItemId) == ITEM_EFFECT_SACRED_ASH)
|
||||
{
|
||||
gUnknown_0203CEC8.unk9 = 0;
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
@ -5284,7 +5285,7 @@ static bool8 IsHPRecoveryItem(u16 item)
|
||||
else
|
||||
effect = gItemEffectTable[item - ITEM_POTION];
|
||||
|
||||
if ((effect[4] & 4) != 0)
|
||||
if (effect[4] & ITEM4_HEAL_HP)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@ -5294,59 +5295,59 @@ static void GetMedicineItemEffectMessage(u16 item)
|
||||
{
|
||||
switch (GetItemEffectType(item))
|
||||
{
|
||||
case 3:
|
||||
case ITEM_EFFECT_CURE_POISON:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnCuredOfPoison);
|
||||
break;
|
||||
case 4:
|
||||
case ITEM_EFFECT_CURE_SLEEP:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnWokeUp2);
|
||||
break;
|
||||
case 5:
|
||||
case ITEM_EFFECT_CURE_BURN:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBurnHealed);
|
||||
break;
|
||||
case 6:
|
||||
case ITEM_EFFECT_CURE_FREEZE:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnThawedOut);
|
||||
break;
|
||||
case 7:
|
||||
case ITEM_EFFECT_CURE_PARALYSIS:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnCuredOfParalysis);
|
||||
break;
|
||||
case 8:
|
||||
case ITEM_EFFECT_CURE_CONFUSION:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnSnappedOutOfConfusion);
|
||||
break;
|
||||
case 9:
|
||||
case ITEM_EFFECT_CURE_INFATUATION:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnGotOverInfatuation);
|
||||
break;
|
||||
case 11:
|
||||
case ITEM_EFFECT_CURE_ALL_STATUS:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBecameHealthy);
|
||||
break;
|
||||
case 13:
|
||||
case ITEM_EFFECT_HP_EV:
|
||||
StringCopy(gStringVar2, gText_HP3);
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased);
|
||||
break;
|
||||
case 12:
|
||||
case ITEM_EFFECT_ATK_EV:
|
||||
StringCopy(gStringVar2, gText_Attack3);
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased);
|
||||
break;
|
||||
case 17:
|
||||
case ITEM_EFFECT_DEF_EV:
|
||||
StringCopy(gStringVar2, gText_Defense3);
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased);
|
||||
break;
|
||||
case 16:
|
||||
case ITEM_EFFECT_SPEED_EV:
|
||||
StringCopy(gStringVar2, gText_Speed2);
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased);
|
||||
break;
|
||||
case 14:
|
||||
case ITEM_EFFECT_SPATK_EV:
|
||||
StringCopy(gStringVar2, gText_SpAtk3);
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased);
|
||||
break;
|
||||
case 15:
|
||||
case ITEM_EFFECT_SPDEF_EV:
|
||||
StringCopy(gStringVar2, gText_SpDef3);
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased);
|
||||
break;
|
||||
case 19:
|
||||
case 20:
|
||||
case ITEM_EFFECT_PP_UP:
|
||||
case ITEM_EFFECT_PP_MAX:
|
||||
StringExpandPlaceholders(gStringVar4, gText_MovesPPIncreased);
|
||||
break;
|
||||
case 21:
|
||||
case ITEM_EFFECT_HEAL_PP:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PPWasRestored);
|
||||
break;
|
||||
default:
|
||||
@ -5357,12 +5358,12 @@ static void GetMedicineItemEffectMessage(u16 item)
|
||||
|
||||
static bool8 UsingHPEVItemOnShedinja(struct Pokemon *mon, u16 item)
|
||||
{
|
||||
if (GetItemEffectType(item) == 13 && GetMonData(mon, MON_DATA_SPECIES) == SPECIES_SHEDINJA)
|
||||
if (GetItemEffectType(item) == ITEM_EFFECT_HP_EV && GetMonData(mon, MON_DATA_SPECIES) == SPECIES_SHEDINJA)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 IsBlueYellowRedFlute(u16 item)
|
||||
static bool8 IsItemFlute(u16 item)
|
||||
{
|
||||
if (item == ITEM_BLUE_FLUTE || item == ITEM_RED_FLUTE || item == ITEM_YELLOW_FLUTE)
|
||||
return TRUE;
|
||||
@ -5409,7 +5410,7 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task)
|
||||
goto iTriedHonestlyIDid;
|
||||
}
|
||||
gUnknown_0203CEE8 = 1;
|
||||
if (IsBlueYellowRedFlute(item) == FALSE)
|
||||
if (IsItemFlute(item) == FALSE)
|
||||
{
|
||||
PlaySE(SE_KAIFUKU);
|
||||
if (gUnknown_0203CEC8.unkB != 14)
|
||||
@ -5466,10 +5467,10 @@ void sub_81B67C8(u8 taskId, TaskFunc task)
|
||||
u16 item = gSpecialVar_ItemId;
|
||||
u8 effectType = GetItemEffectType(item);
|
||||
u16 friendship = GetMonData(mon, MON_DATA_FRIENDSHIP);
|
||||
u16 relevantEV = sub_81B691C(mon, effectType);
|
||||
u16 relevantEV = ItemEffectToMonEv(mon, effectType);
|
||||
bool8 cannotUseEffect = ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.unk9, item, 0);
|
||||
u16 newFriendship = GetMonData(mon, MON_DATA_FRIENDSHIP);
|
||||
u16 newRelevantEV = sub_81B691C(mon, effectType);
|
||||
u16 newRelevantEV = ItemEffectToMonEv(mon, effectType);
|
||||
|
||||
if (cannotUseEffect || (friendship == newFriendship && relevantEV == newRelevantEV))
|
||||
{
|
||||
@ -5485,7 +5486,7 @@ void sub_81B67C8(u8 taskId, TaskFunc task)
|
||||
PlaySE(SE_KAIFUKU);
|
||||
RemoveBagItem(item, 1);
|
||||
GetMonNickname(mon, gStringVar1);
|
||||
option_menu_get_string(effectType, gStringVar2);
|
||||
ItemEffectToStatString(effectType, gStringVar2);
|
||||
if (friendship != newFriendship)
|
||||
{
|
||||
if (relevantEV != newRelevantEV)
|
||||
@ -5503,48 +5504,48 @@ void sub_81B67C8(u8 taskId, TaskFunc task)
|
||||
}
|
||||
}
|
||||
|
||||
static u16 sub_81B691C(struct Pokemon *mon, u8 effectType)
|
||||
static u16 ItemEffectToMonEv(struct Pokemon *mon, u8 effectType)
|
||||
{
|
||||
switch (effectType)
|
||||
{
|
||||
case 13:
|
||||
case ITEM_EFFECT_HP_EV:
|
||||
if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_SHEDINJA)
|
||||
return GetMonData(mon, MON_DATA_HP_EV);
|
||||
break;
|
||||
case 12:
|
||||
case ITEM_EFFECT_ATK_EV:
|
||||
return GetMonData(mon, MON_DATA_ATK_EV);
|
||||
case 17:
|
||||
case ITEM_EFFECT_DEF_EV:
|
||||
return GetMonData(mon, MON_DATA_DEF_EV);
|
||||
case 16:
|
||||
case ITEM_EFFECT_SPEED_EV:
|
||||
return GetMonData(mon, MON_DATA_SPEED_EV);
|
||||
case 14:
|
||||
case ITEM_EFFECT_SPATK_EV:
|
||||
return GetMonData(mon, MON_DATA_SPATK_EV);
|
||||
case 15:
|
||||
case ITEM_EFFECT_SPDEF_EV:
|
||||
return GetMonData(mon, MON_DATA_SPDEF_EV);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void option_menu_get_string(u8 effectType, u8 *dest)
|
||||
static void ItemEffectToStatString(u8 effectType, u8 *dest)
|
||||
{
|
||||
switch (effectType)
|
||||
{
|
||||
case 13:
|
||||
case ITEM_EFFECT_HP_EV:
|
||||
StringCopy(dest, gText_HP3);
|
||||
break;
|
||||
case 12:
|
||||
case ITEM_EFFECT_ATK_EV:
|
||||
StringCopy(dest, gText_Attack3);
|
||||
break;
|
||||
case 17:
|
||||
case ITEM_EFFECT_DEF_EV:
|
||||
StringCopy(dest, gText_Defense3);
|
||||
break;
|
||||
case 16:
|
||||
case ITEM_EFFECT_SPEED_EV:
|
||||
StringCopy(dest, gText_Speed2);
|
||||
break;
|
||||
case 14:
|
||||
case ITEM_EFFECT_SPATK_EV:
|
||||
StringCopy(dest, gText_SpAtk3);
|
||||
break;
|
||||
case 15:
|
||||
case ITEM_EFFECT_SPDEF_EV:
|
||||
StringCopy(dest, gText_SpDef3);
|
||||
break;
|
||||
}
|
||||
@ -5598,7 +5599,7 @@ void dp05_ether(u8 taskId, TaskFunc task)
|
||||
else
|
||||
effect = gItemEffectTable[item - ITEM_POTION];
|
||||
|
||||
if ((effect[4] & 0x10) == 0)
|
||||
if (!(effect[4] & ITEM4_HEAL_PP_ONE))
|
||||
{
|
||||
gUnknown_0203CEC8.unkE = 0;
|
||||
ether_effect_related(taskId);
|
||||
@ -6221,8 +6222,8 @@ u8 GetItemEffectType(u16 item)
|
||||
const u8 *itemEffect;
|
||||
u32 statusCure;
|
||||
|
||||
if (!IS_POKEMON_ITEM(item))
|
||||
return 22;
|
||||
if (!ITEM_HAS_EFFECT(item))
|
||||
return ITEM_EFFECT_NONE;
|
||||
|
||||
// Read the item's effect properties.
|
||||
if (item == ITEM_ENIGMA_BERRY)
|
||||
@ -6230,58 +6231,58 @@ u8 GetItemEffectType(u16 item)
|
||||
else
|
||||
itemEffect = gItemEffectTable[item - ITEM_POTION];
|
||||
|
||||
if ((itemEffect[0] & 0x3F) || itemEffect[1] || itemEffect[2] || (itemEffect[3] & 0x80))
|
||||
return 0;
|
||||
else if (itemEffect[0] & 0x40)
|
||||
return 10;
|
||||
else if (itemEffect[3] & 0x40)
|
||||
return 1;
|
||||
if ((itemEffect[0] & (ITEM0_HIGH_CRIT | ITEM0_X_ATTACK)) || itemEffect[1] || itemEffect[2] || (itemEffect[3] & ITEM3_MIST))
|
||||
return ITEM_EFFECT_X_ITEM;
|
||||
else if (itemEffect[0] & ITEM0_SACRED_ASH)
|
||||
return ITEM_EFFECT_SACRED_ASH;
|
||||
else if (itemEffect[3] & ITEM3_LEVEL_UP)
|
||||
return ITEM_EFFECT_RAISE_LEVEL;
|
||||
|
||||
statusCure = itemEffect[3] & 0x3F;
|
||||
statusCure = itemEffect[3] & ITEM3_STATUS_ALL;
|
||||
if (statusCure || (itemEffect[0] >> 7))
|
||||
{
|
||||
if (statusCure == 0x20)
|
||||
return 4;
|
||||
else if (statusCure == 0x10)
|
||||
return 3;
|
||||
else if (statusCure == 0x8)
|
||||
return 5;
|
||||
else if (statusCure == 0x4)
|
||||
return 6;
|
||||
else if (statusCure == 0x2)
|
||||
return 7;
|
||||
else if (statusCure == 0x1)
|
||||
return 8;
|
||||
if (statusCure == ITEM3_SLEEP)
|
||||
return ITEM_EFFECT_CURE_SLEEP;
|
||||
else if (statusCure == ITEM3_POISON)
|
||||
return ITEM_EFFECT_CURE_POISON;
|
||||
else if (statusCure == ITEM3_BURN)
|
||||
return ITEM_EFFECT_CURE_BURN;
|
||||
else if (statusCure == ITEM3_FREEZE)
|
||||
return ITEM_EFFECT_CURE_FREEZE;
|
||||
else if (statusCure == ITEM3_PARALYSIS)
|
||||
return ITEM_EFFECT_CURE_PARALYSIS;
|
||||
else if (statusCure == ITEM3_CONFUSION)
|
||||
return ITEM_EFFECT_CURE_CONFUSION;
|
||||
else if (itemEffect[0] >> 7 && !statusCure)
|
||||
return 9;
|
||||
return ITEM_EFFECT_CURE_INFATUATION;
|
||||
else
|
||||
return 11;
|
||||
return ITEM_EFFECT_CURE_ALL_STATUS;
|
||||
}
|
||||
|
||||
if (itemEffect[4] & 0x44)
|
||||
return 2;
|
||||
else if (itemEffect[4] & 0x2)
|
||||
return 12;
|
||||
else if (itemEffect[4] & 0x1)
|
||||
return 13;
|
||||
else if (itemEffect[5] & 0x8)
|
||||
return 14;
|
||||
else if (itemEffect[5] & 0x4)
|
||||
return 15;
|
||||
else if (itemEffect[5] & 0x2)
|
||||
return 16;
|
||||
else if (itemEffect[5] & 0x1)
|
||||
return 17;
|
||||
else if (itemEffect[4] & 0x80)
|
||||
return 18;
|
||||
else if (itemEffect[4] & 0x20)
|
||||
return 19;
|
||||
else if (itemEffect[5] & 0x10)
|
||||
return 20;
|
||||
else if (itemEffect[4] & 0x18)
|
||||
return 21;
|
||||
if (itemEffect[4] & (ITEM4_REVIVE | ITEM4_HEAL_HP))
|
||||
return ITEM_EFFECT_HEAL_HP;
|
||||
else if (itemEffect[4] & ITEM4_EV_ATK)
|
||||
return ITEM_EFFECT_ATK_EV;
|
||||
else if (itemEffect[4] & ITEM4_EV_HP)
|
||||
return ITEM_EFFECT_HP_EV;
|
||||
else if (itemEffect[5] & ITEM5_EV_SPATK)
|
||||
return ITEM_EFFECT_SPATK_EV;
|
||||
else if (itemEffect[5] & ITEM5_EV_SPDEF)
|
||||
return ITEM_EFFECT_SPDEF_EV;
|
||||
else if (itemEffect[5] & ITEM5_EV_SPEED)
|
||||
return ITEM_EFFECT_SPEED_EV;
|
||||
else if (itemEffect[5] & ITEM5_EV_DEF)
|
||||
return ITEM_EFFECT_DEF_EV;
|
||||
else if (itemEffect[4] & ITEM4_EVO_STONE)
|
||||
return ITEM_EFFECT_EVO_STONE;
|
||||
else if (itemEffect[4] & ITEM4_PP_UP)
|
||||
return ITEM_EFFECT_PP_UP;
|
||||
else if (itemEffect[5] & ITEM5_PP_MAX)
|
||||
return ITEM_EFFECT_PP_MAX;
|
||||
else if (itemEffect[4] & (ITEM4_HEAL_PP_ALL | ITEM4_HEAL_PP_ONE))
|
||||
return ITEM_EFFECT_HEAL_PP;
|
||||
else
|
||||
return 22;
|
||||
return ITEM_EFFECT_NONE;
|
||||
}
|
||||
|
||||
static void sub_81B7E4C(u8 taskId)
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "constants/battle_frontier.h"
|
||||
#include "constants/battle_move_effects.h"
|
||||
#include "constants/hold_effects.h"
|
||||
#include "constants/item_effects.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/layouts.h"
|
||||
#include "constants/moves.h"
|
||||
@ -4810,9 +4811,9 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
battlerId = MAX_BATTLERS_COUNT;
|
||||
}
|
||||
|
||||
if (!IS_POKEMON_ITEM(item))
|
||||
if (!ITEM_HAS_EFFECT(item))
|
||||
return TRUE;
|
||||
if (gItemEffectTable[item - 13] == NULL && item != ITEM_ENIGMA_BERRY)
|
||||
if (gItemEffectTable[item - ITEM_POTION] == NULL && item != ITEM_ENIGMA_BERRY)
|
||||
return TRUE;
|
||||
|
||||
if (item == ITEM_ENIGMA_BERRY)
|
||||
@ -4824,82 +4825,82 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
}
|
||||
else
|
||||
{
|
||||
itemEffect = gItemEffectTable[item - 13];
|
||||
itemEffect = gItemEffectTable[item - ITEM_POTION];
|
||||
}
|
||||
|
||||
for (cmdIndex = 0; cmdIndex < 6; cmdIndex++)
|
||||
{
|
||||
switch (cmdIndex)
|
||||
{
|
||||
// status healing effects
|
||||
// infatuation heal, x attack, sacred ash and dire hit
|
||||
case 0:
|
||||
if ((itemEffect[cmdIndex] & 0x80)
|
||||
&& gMain.inBattle && battlerId != 4 && (gBattleMons[battlerId].status2 & STATUS2_INFATUATION))
|
||||
if ((itemEffect[cmdIndex] & ITEM0_INFATUATION)
|
||||
&& gMain.inBattle && battlerId != MAX_BATTLERS_COUNT && (gBattleMons[battlerId].status2 & STATUS2_INFATUATION))
|
||||
{
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_INFATUATION;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0x30)
|
||||
if ((itemEffect[cmdIndex] & ITEM0_HIGH_CRIT)
|
||||
&& !(gBattleMons[gActiveBattler].status2 & STATUS2_FOCUS_ENERGY))
|
||||
{
|
||||
gBattleMons[gActiveBattler].status2 |= STATUS2_FOCUS_ENERGY;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0xF)
|
||||
if ((itemEffect[cmdIndex] & ITEM0_X_ATTACK)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_ATK] < 12)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ATK] += itemEffect[cmdIndex] & 0xF;
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ATK] += itemEffect[cmdIndex] & ITEM0_X_ATTACK;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ATK] = 12;
|
||||
retVal = FALSE;
|
||||
}
|
||||
break;
|
||||
// in-battle stat boosting effects?
|
||||
// in-battle stat boosting effects
|
||||
case 1:
|
||||
if ((itemEffect[cmdIndex] & 0xF0)
|
||||
if ((itemEffect[cmdIndex] & ITEM1_X_DEFEND)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_DEF] < 12)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_DEF] += (itemEffect[cmdIndex] & 0xF0) >> 4;
|
||||
gBattleMons[gActiveBattler].statStages[STAT_DEF] += (itemEffect[cmdIndex] & ITEM1_X_DEFEND) >> 4;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_DEF] = 12;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0xF)
|
||||
if ((itemEffect[cmdIndex] & ITEM1_X_SPEED)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_SPEED] < 12)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += itemEffect[cmdIndex] & 0xF;
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += itemEffect[cmdIndex] & ITEM1_X_SPEED;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPEED] = 12;
|
||||
retVal = FALSE;
|
||||
}
|
||||
break;
|
||||
// more stat boosting effects?
|
||||
// more stat boosting effects
|
||||
case 2:
|
||||
if ((itemEffect[cmdIndex] & 0xF0)
|
||||
if ((itemEffect[cmdIndex] & ITEM2_X_ACCURACY)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_ACC] < 12)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ACC] += (itemEffect[cmdIndex] & 0xF0) >> 4;
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ACC] += (itemEffect[cmdIndex] & ITEM2_X_ACCURACY) >> 4;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ACC] = 12;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0xF)
|
||||
if ((itemEffect[cmdIndex] & ITEM2_X_SPATK)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_SPATK] < 12)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += itemEffect[cmdIndex] & 0xF;
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += itemEffect[cmdIndex] & ITEM2_X_SPATK;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPATK] = 12;
|
||||
retVal = FALSE;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if ((itemEffect[cmdIndex] & 0x80)
|
||||
if ((itemEffect[cmdIndex] & ITEM3_MIST)
|
||||
&& gSideTimers[GetBattlerSide(gActiveBattler)].mistTimer == 0)
|
||||
{
|
||||
gSideTimers[GetBattlerSide(gActiveBattler)].mistTimer = 5;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0x40) // raise level
|
||||
if ((itemEffect[cmdIndex] & ITEM3_LEVEL_UP)
|
||||
&& GetMonData(mon, MON_DATA_LEVEL, NULL) != MAX_LEVEL)
|
||||
{
|
||||
dataUnsigned = gExperienceTables[gBaseStats[GetMonData(mon, MON_DATA_SPECIES, NULL)].growthRate][GetMonData(mon, MON_DATA_LEVEL, NULL) + 1];
|
||||
@ -4907,23 +4908,23 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
CalculateMonStats(mon);
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0x20)
|
||||
if ((itemEffect[cmdIndex] & ITEM3_SLEEP)
|
||||
&& HealStatusConditions(mon, partyIndex, 7, battlerId) == 0)
|
||||
{
|
||||
if (battlerId != 4)
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & 0x10) && HealStatusConditions(mon, partyIndex, STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER, battlerId) == 0)
|
||||
if ((itemEffect[cmdIndex] & ITEM3_POISON) && HealStatusConditions(mon, partyIndex, STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER, battlerId) == 0)
|
||||
retVal = FALSE;
|
||||
if ((itemEffect[cmdIndex] & 8) && HealStatusConditions(mon, partyIndex, STATUS1_BURN, battlerId) == 0)
|
||||
if ((itemEffect[cmdIndex] & ITEM3_BURN) && HealStatusConditions(mon, partyIndex, STATUS1_BURN, battlerId) == 0)
|
||||
retVal = FALSE;
|
||||
if ((itemEffect[cmdIndex] & 4) && HealStatusConditions(mon, partyIndex, STATUS1_FREEZE, battlerId) == 0)
|
||||
if ((itemEffect[cmdIndex] & ITEM3_FREEZE) && HealStatusConditions(mon, partyIndex, STATUS1_FREEZE, battlerId) == 0)
|
||||
retVal = FALSE;
|
||||
if ((itemEffect[cmdIndex] & 2) && HealStatusConditions(mon, partyIndex, STATUS1_PARALYSIS, battlerId) == 0)
|
||||
if ((itemEffect[cmdIndex] & ITEM3_PARALYSIS) && HealStatusConditions(mon, partyIndex, STATUS1_PARALYSIS, battlerId) == 0)
|
||||
retVal = FALSE;
|
||||
if ((itemEffect[cmdIndex] & 1) // heal confusion
|
||||
&& gMain.inBattle && battlerId != 4 && (gBattleMons[battlerId].status2 & STATUS2_CONFUSION))
|
||||
if ((itemEffect[cmdIndex] & ITEM3_CONFUSION) // heal confusion
|
||||
&& gMain.inBattle && battlerId != MAX_BATTLERS_COUNT && (gBattleMons[battlerId].status2 & STATUS2_CONFUSION))
|
||||
{
|
||||
gBattleMons[battlerId].status2 &= ~STATUS2_CONFUSION;
|
||||
retVal = FALSE;
|
||||
@ -4932,9 +4933,9 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
// EV, HP, and PP raising effects
|
||||
case 4:
|
||||
r10 = itemEffect[cmdIndex];
|
||||
if (r10 & 0x20)
|
||||
if (r10 & ITEM4_PP_UP)
|
||||
{
|
||||
r10 &= ~0x20;
|
||||
r10 &= ~ITEM4_PP_UP;
|
||||
dataUnsigned = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2);
|
||||
var_38 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
|
||||
if (dataUnsigned <= 2 && var_38 > 4)
|
||||
@ -4957,6 +4958,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
// ev raise
|
||||
evCount = GetMonEVCount(mon);
|
||||
r5 = itemEffect[var_3C];
|
||||
dataSigned = GetMonData(mon, sGetMonDataEVConstants[var_38], NULL);
|
||||
@ -4995,7 +4997,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
retVal = FALSE;
|
||||
break;
|
||||
case 2:
|
||||
// revive?
|
||||
// revive
|
||||
if (r10 & 0x10)
|
||||
{
|
||||
if (GetMonData(mon, MON_DATA_HP, NULL) != 0)
|
||||
@ -5076,6 +5078,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
r10 &= 0xEF;
|
||||
break;
|
||||
case 3:
|
||||
// Heal pp in all moves.
|
||||
if (!(r10 & 2))
|
||||
{
|
||||
for (r5 = 0; (signed)(r5) < (signed)(4); r5++)
|
||||
@ -5095,7 +5098,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
}
|
||||
SetMonData(mon, MON_DATA_PP1 + r5, &dataUnsigned);
|
||||
if (gMain.inBattle
|
||||
&& battlerId != 4 && !(gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED)
|
||||
&& battlerId != MAX_BATTLERS_COUNT && !(gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED)
|
||||
&& !(gDisableStructs[battlerId].mimickedMoves & gBitTable[r5]))
|
||||
gBattleMons[battlerId].pp[r5] = dataUnsigned;
|
||||
retVal = FALSE;
|
||||
@ -5103,6 +5106,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
}
|
||||
var_3C++;
|
||||
}
|
||||
// Heal pp in one move.
|
||||
else
|
||||
{
|
||||
u16 moveId;
|
||||
@ -5127,6 +5131,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
}
|
||||
}
|
||||
break;
|
||||
// Evolution stone
|
||||
case 7:
|
||||
{
|
||||
u16 targetSpecies = GetEvolutionTargetSpecies(mon, 2, item);
|
||||
@ -5144,6 +5149,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
r10 >>= 1;
|
||||
}
|
||||
break;
|
||||
// EV and friendship
|
||||
case 5:
|
||||
r10 = itemEffect[cmdIndex];
|
||||
var_38 = 0;
|
||||
@ -5326,7 +5332,7 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit)
|
||||
|
||||
offset = 6;
|
||||
|
||||
temp = gItemEffectTable[itemId - 13];
|
||||
temp = gItemEffectTable[itemId - ITEM_POTION];
|
||||
|
||||
if (!temp && itemId != ITEM_ENIGMA_BERRY)
|
||||
return 0;
|
||||
@ -5351,8 +5357,8 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit)
|
||||
break;
|
||||
case 4:
|
||||
val = itemEffect[4];
|
||||
if (val & 0x20)
|
||||
val &= 0xDF;
|
||||
if (val & ITEM4_PP_UP)
|
||||
val &= ~(ITEM4_PP_UP);
|
||||
j = 0;
|
||||
while (val)
|
||||
{
|
||||
@ -5450,7 +5456,7 @@ u8 *sub_806CF78(u16 itemId)
|
||||
}
|
||||
else
|
||||
{
|
||||
itemEffect = gItemEffectTable[itemId - 13];
|
||||
itemEffect = gItemEffectTable[itemId - ITEM_POTION];
|
||||
}
|
||||
|
||||
gPotentialItemEffectBattler = gBattlerInMenuId;
|
||||
@ -5473,7 +5479,7 @@ u8 *sub_806CF78(u16 itemId)
|
||||
}
|
||||
}
|
||||
|
||||
if (itemEffect[3] & 0x80)
|
||||
if (itemEffect[3] & ITEM3_MIST)
|
||||
{
|
||||
gBattlerAttacker = gBattlerInMenuId;
|
||||
BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnShroudedInMist);
|
||||
|
@ -30,61 +30,50 @@ struct UnknownPokenavCallbackStruct
|
||||
{
|
||||
bool32 (*unk0)(void);
|
||||
u32 (*unk4)(void);
|
||||
u32 (*unk8)(void);
|
||||
u32 (*unkC)(void);
|
||||
bool32 (*unk8)(void);
|
||||
void (*unkC)(int);
|
||||
u32 (*unk10)(void);
|
||||
void (*unk14)(void);
|
||||
u32 (*unk18)(void);
|
||||
void (*unk18)(void);
|
||||
};
|
||||
|
||||
extern u32 sub_81C9924(void);
|
||||
extern bool32 sub_81C9924(void);
|
||||
extern u32 sub_81C99C0(void);
|
||||
extern u32 sub_81C9990(void);
|
||||
extern u32 sub_81C9940(void);
|
||||
extern u32 sub_81CC4D4(void);
|
||||
extern u32 sub_81CC554(void);
|
||||
extern u32 sub_81CC5F4(void);
|
||||
extern u32 sub_81CC62C(void);
|
||||
extern u32 sub_81CC65C(void);
|
||||
extern void sub_81CC524(void);
|
||||
extern u32 sub_81CC670(void);
|
||||
extern void sub_81C9990(int);
|
||||
extern bool32 sub_81C9940(void);
|
||||
extern u32 sub_81CCFD8(void);
|
||||
extern u32 sub_81CD070(void);
|
||||
extern u32 sub_81CDDD4(void);
|
||||
extern u32 sub_81CDE2C(void);
|
||||
extern bool32 sub_81CDDD4(void);
|
||||
extern void sub_81CDE2C(int);
|
||||
extern u32 sub_81CDE64(void);
|
||||
extern void sub_81CD1C0(void);
|
||||
extern u32 sub_81CECA0(void);
|
||||
extern void sub_81CECA0(void);
|
||||
extern u32 sub_81CEF3C(void);
|
||||
extern u32 sub_81CEFDC(void);
|
||||
extern u32 sub_81CF330(void);
|
||||
extern u32 sub_81CF3A0(void);
|
||||
extern bool32 sub_81CF330(void);
|
||||
extern void sub_81CF3A0(int);
|
||||
extern u32 sub_81CF3D0(void);
|
||||
extern void sub_81CEFF0(void);
|
||||
extern u32 sub_81CF3F8(void);
|
||||
extern void sub_81CF3F8(void);
|
||||
extern u32 sub_81CD024(void);
|
||||
extern u32 sub_81CEF98(void);
|
||||
extern u32 sub_81CF368(void);
|
||||
extern u32 sub_81CB260(void);
|
||||
extern u32 sub_81CB29C(void);
|
||||
extern u32 sub_81CB2CC(void);
|
||||
extern u32 sub_81CB2E0(void);
|
||||
extern bool32 sub_81CF368(void);
|
||||
extern u32 sub_81CF9BC(void);
|
||||
extern u32 sub_81CFA34(void);
|
||||
extern u32 sub_81CFDD0(void);
|
||||
extern u32 sub_81CFE40(void);
|
||||
extern bool32 sub_81CFDD0(void);
|
||||
extern void sub_81CFE40(int);
|
||||
extern u32 sub_81CFE70(void);
|
||||
extern void sub_81CFA48(void);
|
||||
extern u32 sub_81CFE98(void);
|
||||
extern void sub_81CFE98(void);
|
||||
extern u32 sub_81D0450(void);
|
||||
extern u32 sub_81D04A0(void);
|
||||
extern u32 sub_81D0978(void);
|
||||
extern u32 sub_81D09B0(void);
|
||||
extern bool32 sub_81D0978(void);
|
||||
extern void sub_81D09B0(int);
|
||||
extern u32 sub_81D09E0(void);
|
||||
extern void sub_81D04B8(void);
|
||||
extern u32 sub_81D09F4(void);
|
||||
extern void sub_81D09F4(void);
|
||||
extern u32 sub_81CFA04(void);
|
||||
extern u32 sub_81CFE08(void);
|
||||
extern bool32 sub_81CFE08(void);
|
||||
|
||||
static bool32 SetActivePokenavMenu(u32 menuId);
|
||||
static bool32 AnyMonHasRibbon(void);
|
||||
|
@ -502,7 +502,7 @@ void sub_81C7990(u32 a0, u16 a1)
|
||||
}
|
||||
|
||||
NAKED
|
||||
void sub_81C79BC(u16 *a0, u16 *a1, u32 a2, u32 a3, u32 a4, u32 a5)
|
||||
void sub_81C79BC(const u16 *a0, const u16 *a1, u32 a2, u32 a3, u32 a4, u16 *a5)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
push {r4-r7,lr}\n\
|
||||
|
@ -1119,8 +1119,6 @@ static void sub_81D1920(const match_call_text_data_t *sub0, u8 *dest)
|
||||
StringExpandPlaceholders(dest, sub0[i].text);
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
// There's some weird upmerge going on that I cannot replicate at this time.
|
||||
static void sub_81D199C(const match_call_text_data_t *sub0, u16 idx, u8 *dest)
|
||||
{
|
||||
u32 i;
|
||||
@ -1128,7 +1126,7 @@ static void sub_81D199C(const match_call_text_data_t *sub0, u16 idx, u8 *dest)
|
||||
{
|
||||
if (sub0[i].flag == 0xfffe)
|
||||
break;
|
||||
if (sub0[i].flag == 0xffff && !FlagGet(sub0[i].flag))
|
||||
if (sub0[i].flag != 0xffff && !FlagGet(sub0[i].flag))
|
||||
break;
|
||||
}
|
||||
if (sub0[i].flag != 0xfffe)
|
||||
@ -1141,127 +1139,22 @@ static void sub_81D199C(const match_call_text_data_t *sub0, u16 idx, u8 *dest)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!FlagGet(FLAG_SYS_GAME_CLEAR))
|
||||
;
|
||||
else if (gSaveBlock1Ptr->trainerRematches[idx])
|
||||
i += 2;
|
||||
else if (CountBattledRematchTeams(idx) >= 2)
|
||||
i += 3;
|
||||
else
|
||||
i++;
|
||||
if (FlagGet(FLAG_SYS_GAME_CLEAR))
|
||||
{
|
||||
do
|
||||
{
|
||||
if (gSaveBlock1Ptr->trainerRematches[idx])
|
||||
i += 2;
|
||||
else if (CountBattledRematchTeams(idx) >= 2)
|
||||
i += 3;
|
||||
else
|
||||
i++;
|
||||
} while (0);
|
||||
}
|
||||
|
||||
StringExpandPlaceholders(dest, sub0[i].text);
|
||||
}
|
||||
}
|
||||
#else
|
||||
static NAKED void sub_81D199C(const match_call_text_data_t *sub0, u16 idx, u8 *dest)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r10\n"
|
||||
"\tmov r6, r9\n"
|
||||
"\tmov r5, r8\n"
|
||||
"\tpush {r5-r7}\n"
|
||||
"\tadds r6, r0, 0\n"
|
||||
"\tmov r10, r2\n"
|
||||
"\tlsls r1, 16\n"
|
||||
"\tlsrs r7, r1, 16\n"
|
||||
"\tmovs r5, 0\n"
|
||||
"\tldr r0, [r6]\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbeq _081D19E6\n"
|
||||
"\tldrh r0, [r6, 0x4]\n"
|
||||
"\tldr r1, =0x0000fffe\n"
|
||||
"\tcmp r0, r1\n"
|
||||
"\tbeq _081D1A24\n"
|
||||
"\tldr r0, =0x0000ffff\n"
|
||||
"\tmov r9, r0\n"
|
||||
"\tmov r8, r1\n"
|
||||
"\tadds r4, r6, 0\n"
|
||||
"_081D19C6:\n"
|
||||
"\tldrh r0, [r4, 0x4]\n"
|
||||
"\tcmp r0, r9\n"
|
||||
"\tbeq _081D19D6\n"
|
||||
"\tbl FlagGet\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbeq _081D19E6\n"
|
||||
"_081D19D6:\n"
|
||||
"\tadds r4, 0x8\n"
|
||||
"\tadds r5, 0x1\n"
|
||||
"\tldr r0, [r4]\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbeq _081D19E6\n"
|
||||
"\tldrh r0, [r4, 0x4]\n"
|
||||
"\tcmp r0, r8\n"
|
||||
"\tbne _081D19C6\n"
|
||||
"_081D19E6:\n"
|
||||
"\tlsls r0, r5, 3\n"
|
||||
"\tadds r0, r6\n"
|
||||
"\tldrh r1, [r0, 0x4]\n"
|
||||
"\tldr r0, =0x0000fffe\n"
|
||||
"\tcmp r1, r0\n"
|
||||
"\tbeq _081D1A24\n"
|
||||
"\tcmp r5, 0\n"
|
||||
"\tbeq _081D19F8\n"
|
||||
"\tsubs r5, 0x1\n"
|
||||
"_081D19F8:\n"
|
||||
"\tlsls r0, r5, 3\n"
|
||||
"\tadds r4, r0, r6\n"
|
||||
"\tldrh r1, [r4, 0x6]\n"
|
||||
"\tldr r0, =0x0000ffff\n"
|
||||
"\tcmp r1, r0\n"
|
||||
"\tbeq _081D1A0A\n"
|
||||
"\tadds r0, r1, 0\n"
|
||||
"\tbl FlagSet\n"
|
||||
"_081D1A0A:\n"
|
||||
"\tldr r1, [r4]\n"
|
||||
"\tmov r0, r10\n"
|
||||
"\tbl StringExpandPlaceholders\n"
|
||||
"\tb _081D1A5C\n"
|
||||
"\t.pool\n"
|
||||
"_081D1A1C:\n"
|
||||
"\tadds r5, 0x2\n"
|
||||
"\tb _081D1A50\n"
|
||||
"_081D1A20:\n"
|
||||
"\tadds r5, 0x3\n"
|
||||
"\tb _081D1A50\n"
|
||||
"_081D1A24:\n"
|
||||
"\tldr r0, =0x00000864\n"
|
||||
"\tbl FlagGet\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbeq _081D1A50\n"
|
||||
"\tldr r0, =gSaveBlock1Ptr\n"
|
||||
"\tldr r0, [r0]\n"
|
||||
"\tldr r1, =0x000009ca\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tadds r0, r7\n"
|
||||
"\tldrb r0, [r0]\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbne _081D1A1C\n"
|
||||
"\tadds r0, r7, 0\n"
|
||||
"\tbl CountBattledRematchTeams\n"
|
||||
"\tlsls r0, 16\n"
|
||||
"\tlsrs r0, 16\n"
|
||||
"\tcmp r0, 0x1\n"
|
||||
"\tbhi _081D1A20\n"
|
||||
"\tadds r5, 0x1\n"
|
||||
"_081D1A50:\n"
|
||||
"\tlsls r0, r5, 3\n"
|
||||
"\tadds r0, r6\n"
|
||||
"\tldr r1, [r0]\n"
|
||||
"\tmov r0, r10\n"
|
||||
"\tbl StringExpandPlaceholders\n"
|
||||
"_081D1A5C:\n"
|
||||
"\tpop {r3-r5}\n"
|
||||
"\tmov r8, r3\n"
|
||||
"\tmov r9, r4\n"
|
||||
"\tmov r10, r5\n"
|
||||
"\tpop {r4-r7}\n"
|
||||
"\tpop {r0}\n"
|
||||
"\tbx r0\n"
|
||||
"\t.pool");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_81D1A78(u32 idx, const u8 **desc, const u8 **name)
|
||||
{
|
||||
|
@ -64,23 +64,6 @@ struct UnknownSubStruct_81C81D4
|
||||
u32 unk8A0;
|
||||
};
|
||||
|
||||
struct MatchCallListTemplate
|
||||
{
|
||||
u32 unk0;
|
||||
u16 unk4;
|
||||
u16 unk6;
|
||||
u8 unk8;
|
||||
u8 unk9;
|
||||
u8 unkA;
|
||||
u8 unkB;
|
||||
u8 unkC;
|
||||
u8 unkD;
|
||||
u8 unkE;
|
||||
void (*unk10)(u32, u8 *a1);
|
||||
void (*unk14)(u16 a0, u32 a1, u32 a2);
|
||||
};
|
||||
|
||||
extern void sub_81CBD48(u16 windowId, u32 a1);
|
||||
extern void sub_81DB620(u32 windowId, u32 a1, u32 a2, u32 a3, u32 a4);
|
||||
|
||||
void sub_81C82E4(struct UnknownSubStruct_81C81D4 *a0);
|
||||
@ -505,7 +488,7 @@ struct MatchCallWindowState *GetMatchCallWindowStruct(void)
|
||||
return &structPtr->unk888;
|
||||
}
|
||||
|
||||
u32 MatchCall_MoveCursorUp(void)
|
||||
int MatchCall_MoveCursorUp(void)
|
||||
{
|
||||
struct MatchCallWindowState *structPtr;
|
||||
structPtr = GetMatchCallWindowStruct();
|
||||
@ -529,7 +512,7 @@ u32 MatchCall_MoveCursorUp(void)
|
||||
}
|
||||
}
|
||||
|
||||
u32 MatchCall_MoveCursorDown(void)
|
||||
int MatchCall_MoveCursorDown(void)
|
||||
{
|
||||
struct MatchCallWindowState *structPtr;
|
||||
structPtr = GetMatchCallWindowStruct();
|
||||
@ -554,7 +537,7 @@ u32 MatchCall_MoveCursorDown(void)
|
||||
return 2;
|
||||
}
|
||||
|
||||
u32 MatchCall_PageUp(void)
|
||||
int MatchCall_PageUp(void)
|
||||
{
|
||||
struct MatchCallWindowState *structPtr;
|
||||
s32 scroll;
|
||||
@ -580,7 +563,7 @@ u32 MatchCall_PageUp(void)
|
||||
}
|
||||
}
|
||||
|
||||
u32 MatchCall_PageDown(void)
|
||||
int MatchCall_PageDown(void)
|
||||
{
|
||||
struct MatchCallWindowState *structPtr;
|
||||
structPtr = GetMatchCallWindowStruct();
|
||||
@ -648,7 +631,7 @@ void sub_81C877C(void)
|
||||
structPtr->unk8A0 = CreateLoopedTask(LoopedTask_sub_81C8870, 6);
|
||||
}
|
||||
|
||||
void sub_81C87AC(u16 a0)
|
||||
void sub_81C87AC(s16 a0)
|
||||
{
|
||||
u16 temp;
|
||||
struct UnknownSubStruct_81C81D4 *structPtr;
|
||||
|
@ -382,13 +382,14 @@ u16 sub_81CB02C(int arg0)
|
||||
return state->unk4[arg0];
|
||||
}
|
||||
|
||||
void sub_81CB050(struct Pokenav3Struct_Unk1C *arg0, u8 *str)
|
||||
void sub_81CB050(u32 arg0, u8 *str)
|
||||
{
|
||||
struct Pokenav3Struct_Unk1C *var0 = (struct Pokenav3Struct_Unk1C *)arg0;
|
||||
const u8 *trainerName;
|
||||
const u8 *className;
|
||||
if (!arg0->unk0)
|
||||
if (!var0->unk0)
|
||||
{
|
||||
int index = GetTrainerIdxByRematchIdx(arg0->unk2);
|
||||
int index = GetTrainerIdxByRematchIdx(var0->unk2);
|
||||
const struct Trainer *trainer = &gTrainers[index];
|
||||
int class = trainer->trainerClass;
|
||||
className = gTrainerClassNames[class];
|
||||
@ -396,7 +397,7 @@ void sub_81CB050(struct Pokenav3Struct_Unk1C *arg0, u8 *str)
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_81D1A78(arg0->unk2, &className, &trainerName);
|
||||
sub_81D1A78(var0->unk2, &className, &trainerName);
|
||||
}
|
||||
|
||||
if (className && trainerName)
|
||||
|
1119
src/pokenav_unk_4.c
Executable file
1119
src/pokenav_unk_4.c
Executable file
File diff suppressed because it is too large
Load Diff
636
src/pokenav_unk_5.c
Executable file
636
src/pokenav_unk_5.c
Executable file
@ -0,0 +1,636 @@
|
||||
#include "global.h"
|
||||
#include "bg.h"
|
||||
#include "decompress.h"
|
||||
#include "landmark.h"
|
||||
#include "main.h"
|
||||
#include "menu.h"
|
||||
#include "palette.h"
|
||||
#include "pokenav.h"
|
||||
#include "region_map.h"
|
||||
#include "sound.h"
|
||||
#include "sprite.h"
|
||||
#include "string_util.h"
|
||||
#include "task.h"
|
||||
#include "text_window.h"
|
||||
#include "window.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
struct Pokenav5Struct
|
||||
{
|
||||
u8 filler0[0xC];
|
||||
bool32 unkC;
|
||||
u32 (*unk10)(struct Pokenav5Struct *);
|
||||
};
|
||||
|
||||
struct Pokenav5Struct_2
|
||||
{
|
||||
bool32 (*unk0)(void);
|
||||
u32 unk4;
|
||||
u16 unk8;
|
||||
struct Sprite *cityFeatureTextSprites[3];
|
||||
u8 unk18[0x800];
|
||||
u8 cityZoomPics[22][0xC8];
|
||||
};
|
||||
|
||||
struct CityZoomPic
|
||||
{
|
||||
u16 mapSecId;
|
||||
u16 unk2;
|
||||
const u32 *data;
|
||||
};
|
||||
|
||||
static u32 sub_81CC568(struct Pokenav5Struct *);
|
||||
static u32 sub_81CC5B4(struct Pokenav5Struct *);
|
||||
static u32 sub_81CC5DC(struct Pokenav5Struct *);
|
||||
static u32 sub_81CC6F4(int);
|
||||
static u32 sub_81CCD34(int);
|
||||
static bool32 sub_81CC6BC(void);
|
||||
static void sub_81CC9EC(void);
|
||||
static void sub_81CC9C0(void);
|
||||
static void sub_81CCD10(void);
|
||||
static bool32 sub_81CCD24(void);
|
||||
static void sub_81CCA1C(struct Pokenav5Struct_2 *);
|
||||
static bool32 sub_81CCAFC(void);
|
||||
static void sub_81CCB0C(struct Pokenav5Struct_2 *);
|
||||
static bool32 sub_81CCC4C(struct Pokenav5Struct_2 *);
|
||||
static void sub_81CCC5C(int);
|
||||
static bool32 sub_81CCC88(void);
|
||||
static void sub_81CCE58(void);
|
||||
static void sub_81CCD70(struct Pokenav5Struct_2 *, int, int);
|
||||
static void sub_81CCDE8(struct Pokenav5Struct_2 *, int, int);
|
||||
static void sub_81CCFA4(int);
|
||||
static void sub_81CCC9C(u8 taskId);
|
||||
static void sub_81CCF78(void);
|
||||
|
||||
extern const LoopedTask gUnknown_086230E4[];
|
||||
extern const struct BgTemplate gUnknown_086230D8[2];
|
||||
extern const struct CompressedSpriteSheet gUnknown_086230F8[1];
|
||||
extern const struct SpritePalette gUnknown_08623100[];
|
||||
extern const struct WindowTemplate gUnknown_08623110;
|
||||
extern const u32 gUnknown_08622888[];
|
||||
extern const u16 gUnknown_08622868[];
|
||||
extern const u16 gHoennMapZoomIcons_Pal[];
|
||||
extern const struct CityZoomPic gUnknown_08623118[22];
|
||||
extern const struct SpriteTemplate gUnknown_086231D0;
|
||||
|
||||
u32 sub_81CC4D4(void)
|
||||
{
|
||||
struct Pokenav5Struct *state = AllocSubstruct(3, sizeof(struct Pokenav5Struct));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
if (!AllocSubstruct(16, sizeof(struct RegionMap)))
|
||||
return FALSE;
|
||||
|
||||
state->unkC = sub_8124668(gMapHeader.regionMapSectionId);
|
||||
if (!state->unkC)
|
||||
state->unk10 = sub_81CC568;
|
||||
else
|
||||
state->unk10 = sub_81CC5B4;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_81CC524(void)
|
||||
{
|
||||
gSaveBlock2Ptr->regionMapZoom = sub_8124658();
|
||||
FreePokenavSubstruct(16);
|
||||
FreePokenavSubstruct(3);
|
||||
}
|
||||
|
||||
u32 sub_81CC554(void)
|
||||
{
|
||||
struct Pokenav5Struct *state = GetSubstructPtr(3);
|
||||
state->unk10(state);
|
||||
}
|
||||
|
||||
static u32 sub_81CC568(struct Pokenav5Struct *state)
|
||||
{
|
||||
switch (sub_81230AC())
|
||||
{
|
||||
case 3:
|
||||
return 1;
|
||||
case 4:
|
||||
if (!sub_8124658())
|
||||
return 3;
|
||||
return 2;
|
||||
case 5:
|
||||
state->unk10 = sub_81CC5DC;
|
||||
return 4;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sub_81CC5B4(struct Pokenav5Struct *state)
|
||||
{
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
state->unk10 = sub_81CC5DC;
|
||||
return 4;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sub_81CC5DC(struct Pokenav5Struct *state)
|
||||
{
|
||||
return POKENAV_MENU_1;
|
||||
}
|
||||
|
||||
bool32 sub_81CC5E4(void)
|
||||
{
|
||||
struct Pokenav5Struct *state = GetSubstructPtr(3);
|
||||
return state->unkC;
|
||||
}
|
||||
|
||||
bool32 sub_81CC5F4(void)
|
||||
{
|
||||
struct Pokenav5Struct_2 *state = AllocSubstruct(4, sizeof(struct Pokenav5Struct_2));
|
||||
if (!state)
|
||||
return FALSE;
|
||||
|
||||
state->unk4 = CreateLoopedTask(sub_81CC6F4, 1);
|
||||
state->unk0 = sub_81CC6BC;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_81CC62C(int index)
|
||||
{
|
||||
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
|
||||
state->unk4 = CreateLoopedTask(gUnknown_086230E4[index], 1);
|
||||
state->unk0 = sub_81CC6BC;
|
||||
}
|
||||
|
||||
u32 sub_81CC65C(void)
|
||||
{
|
||||
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
|
||||
return state->unk0();
|
||||
}
|
||||
|
||||
void sub_81CC670(void)
|
||||
{
|
||||
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
|
||||
FreeRegionMapIconResources();
|
||||
sub_81CC9EC();
|
||||
RemoveWindow(state->unk8);
|
||||
FreePokenavSubstruct(16);
|
||||
FreePokenavSubstruct(4);
|
||||
SetPokenavVBlankCallback();
|
||||
SetBgMode(0);
|
||||
}
|
||||
|
||||
static void sub_81CC6A4(void)
|
||||
{
|
||||
TransferPlttBuffer();
|
||||
LoadOam();
|
||||
ProcessSpriteCopyRequests();
|
||||
UpdateRegionMapVideoRegs();
|
||||
}
|
||||
|
||||
static bool32 sub_81CC6BC(void)
|
||||
{
|
||||
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
|
||||
return IsLoopedTaskActive(state->unk4);
|
||||
}
|
||||
|
||||
static bool8 sub_81CC6D0(void)
|
||||
{
|
||||
if (sub_81CC5E4())
|
||||
return FALSE;
|
||||
|
||||
return gSaveBlock2Ptr->regionMapZoom == 1;
|
||||
}
|
||||
|
||||
static u32 sub_81CC6F4(int taskState)
|
||||
{
|
||||
int var0;
|
||||
struct RegionMap *regionMap;
|
||||
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
|
||||
switch (taskState)
|
||||
{
|
||||
case 0:
|
||||
SetVBlankCallback_(NULL);
|
||||
HideBg(1);
|
||||
HideBg(2);
|
||||
HideBg(3);
|
||||
SetBgMode(1);
|
||||
InitBgTemplates(gUnknown_086230D8, ARRAY_COUNT(gUnknown_086230D8));
|
||||
regionMap = GetSubstructPtr(16);
|
||||
sub_8122CF8(regionMap, &gUnknown_086230D8[1], sub_81CC6D0());
|
||||
sub_81CC9C0();
|
||||
return 0;
|
||||
case 1:
|
||||
if (sub_8122DB0())
|
||||
return 2;
|
||||
|
||||
if (!sub_81CC5E4())
|
||||
{
|
||||
CreateRegionMapPlayerIcon(4, 9);
|
||||
CreateRegionMapCursor(5, 10);
|
||||
sub_812454C();
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_8123030(0, 6);
|
||||
}
|
||||
return 0;
|
||||
case 2:
|
||||
sub_81CCD10();
|
||||
return 1;
|
||||
case 3:
|
||||
if (sub_81CCD24())
|
||||
return 2;
|
||||
|
||||
sub_81CCA1C(state);
|
||||
return 1;
|
||||
case 4:
|
||||
if (sub_81CCAFC())
|
||||
return 2;
|
||||
|
||||
sub_81CCB0C(state);
|
||||
sub_81C7B40();
|
||||
return 0;
|
||||
case 5:
|
||||
if (sub_81CCC4C(state))
|
||||
return 2;
|
||||
|
||||
ShowBg(1);
|
||||
ShowBg(2);
|
||||
SetVBlankCallback_(sub_81CC6A4);
|
||||
return 0;
|
||||
case 6:
|
||||
if (!sub_81CC6D0())
|
||||
var0 = 4;
|
||||
else
|
||||
var0 = 5;
|
||||
|
||||
LoadLeftHeaderGfxForIndex(var0);
|
||||
sub_81C7FA0(var0, 1, 1);
|
||||
sub_81C7AC0(1);
|
||||
return 0;
|
||||
case 7:
|
||||
if (IsPaletteFadeActive() || sub_81C8010())
|
||||
return 2;
|
||||
return 1;
|
||||
default:
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_81CC848(int taskState)
|
||||
{
|
||||
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
|
||||
switch (taskState)
|
||||
{
|
||||
case 0:
|
||||
sub_81CCB0C(state);
|
||||
return 0;
|
||||
case 1:
|
||||
if (sub_81CCC4C(state))
|
||||
return 2;
|
||||
break;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CC878(int taskState)
|
||||
{
|
||||
switch (taskState)
|
||||
{
|
||||
case 0:
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81CCC5C(0);
|
||||
sub_8123418();
|
||||
return 0;
|
||||
case 1:
|
||||
if (sub_8123514() || sub_81CCC88())
|
||||
return 2;
|
||||
|
||||
sub_81C7BA4(1);
|
||||
return 0;
|
||||
case 2:
|
||||
if (IsDma3ManagerBusyWithBgCopy_())
|
||||
return 2;
|
||||
|
||||
sub_81C7E14(4);
|
||||
break;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CC8D8(int taskState)
|
||||
{
|
||||
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
|
||||
switch (taskState)
|
||||
{
|
||||
case 0:
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81CCB0C(state);
|
||||
return 0;
|
||||
case 1:
|
||||
if (sub_81CCC4C(state))
|
||||
return 2;
|
||||
|
||||
sub_81CCC5C(1);
|
||||
sub_8123418();
|
||||
return 0;
|
||||
case 2:
|
||||
if (sub_8123514() || sub_81CCC88())
|
||||
return 2;
|
||||
|
||||
sub_81C7BA4(2);
|
||||
return 0;
|
||||
case 3:
|
||||
if (IsDma3ManagerBusyWithBgCopy_())
|
||||
return 2;
|
||||
|
||||
sub_81C7E14(5);
|
||||
break;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CC95C(int taskState)
|
||||
{
|
||||
switch (taskState)
|
||||
{
|
||||
case 0:
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81C7AC0(0);
|
||||
return 0;
|
||||
case 1:
|
||||
if (IsPaletteFadeActive())
|
||||
return 2;
|
||||
|
||||
sub_81C7FDC();
|
||||
sub_81C78A0();
|
||||
return 0;
|
||||
case 2:
|
||||
if (MainMenuLoopedTaskIsBusy())
|
||||
return 2;
|
||||
|
||||
HideBg(1);
|
||||
HideBg(2);
|
||||
HideBg(3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
static void sub_81CC9C0(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ARRAY_COUNT(gUnknown_086230F8); i++)
|
||||
LoadCompressedSpriteSheet(&gUnknown_086230F8[i]);
|
||||
|
||||
Pokenav_AllocAndLoadPalettes(gUnknown_08623100);
|
||||
sub_81CCE58();
|
||||
}
|
||||
|
||||
static void sub_81CC9EC(void)
|
||||
{
|
||||
int i;
|
||||
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
|
||||
FreeSpriteTilesByTag(6);
|
||||
FreeSpritePaletteByTag(11);
|
||||
for (i = 0; i < 3; i++)
|
||||
DestroySprite(state->cityFeatureTextSprites[i]);
|
||||
}
|
||||
|
||||
static void sub_81CCA1C(struct Pokenav5Struct_2 *state)
|
||||
{
|
||||
sub_8199DF0(1, PIXEL_FILL(0), 0x40, 1);
|
||||
sub_8199DF0(1, PIXEL_FILL(1), 0x41, 1);
|
||||
CpuFill16(0x1040, state->unk18, 0x800);
|
||||
SetBgTilemapBuffer(1, state->unk18);
|
||||
state->unk8 = AddWindow(&gUnknown_08623110);
|
||||
LoadUserWindowBorderGfx_(state->unk8, 0x42, 0x40);
|
||||
DrawTextBorderOuter(state->unk8, 0x42, 4);
|
||||
decompress_and_copy_tile_data_to_vram(1, gUnknown_08622888, 0, 0, 0);
|
||||
FillWindowPixelBuffer(state->unk8, PIXEL_FILL(1));
|
||||
PutWindowTilemap(state->unk8);
|
||||
CopyWindowToVram(state->unk8, 3);
|
||||
CopyPaletteIntoBufferUnfaded(gUnknown_08622868, 0x10, 0x20);
|
||||
CopyPaletteIntoBufferUnfaded(gHoennMapZoomIcons_Pal, 0x30, 0x20);
|
||||
if (!sub_8124658())
|
||||
ChangeBgY(1, -0x6000, 0);
|
||||
else
|
||||
ChangeBgY(1, 0, 0);
|
||||
|
||||
ChangeBgX(1, 0, 0);
|
||||
}
|
||||
|
||||
static bool32 sub_81CCAFC(void)
|
||||
{
|
||||
return free_temp_tile_data_buffers_if_possible();
|
||||
}
|
||||
|
||||
static void sub_81CCB0C(struct Pokenav5Struct_2 *state)
|
||||
{
|
||||
struct RegionMap *regionMap = GetSubstructPtr(16);
|
||||
switch (regionMap->iconDrawType)
|
||||
{
|
||||
case MAPSECTYPE_CITY_CANFLY:
|
||||
FillWindowPixelBuffer(state->unk8, PIXEL_FILL(1));
|
||||
PutWindowRectTilemap(state->unk8, 0, 0, 12, 2);
|
||||
AddTextPrinterParameterized(state->unk8, 7, regionMap->mapSecName, 0, 1, TEXT_SPEED_FF, NULL);
|
||||
sub_81CCD70(state, regionMap->mapSecId, regionMap->posWithinMapSec);
|
||||
CopyWindowToVram(state->unk8, 3);
|
||||
sub_81CCFA4(0);
|
||||
break;
|
||||
case MAPSECTYPE_CITY_CANTFLY:
|
||||
FillWindowPixelBuffer(state->unk8, PIXEL_FILL(1));
|
||||
PutWindowRectTilemap(state->unk8, 0, 0, 12, 2);
|
||||
AddTextPrinterParameterized(state->unk8, 7, regionMap->mapSecName, 0, 1, TEXT_SPEED_FF, NULL);
|
||||
FillBgTilemapBufferRect(1, 0x1041, 17, 6, 12, 11, 17);
|
||||
CopyWindowToVram(state->unk8, 3);
|
||||
sub_81CCFA4(1);
|
||||
break;
|
||||
case MAPSECTYPE_PLAIN:
|
||||
case MAPSECTYPE_BATTLE_FRONTIER:
|
||||
FillWindowPixelBuffer(state->unk8, PIXEL_FILL(1));
|
||||
PutWindowTilemap(state->unk8);
|
||||
AddTextPrinterParameterized(state->unk8, 7, regionMap->mapSecName, 0, 1, TEXT_SPEED_FF, NULL);
|
||||
sub_81CCDE8(state, regionMap->mapSecId, regionMap->posWithinMapSec);
|
||||
CopyWindowToVram(state->unk8, 3);
|
||||
sub_81CCFA4(1);
|
||||
break;
|
||||
case MAPSECTYPE_NONE:
|
||||
FillBgTilemapBufferRect(1, 0x1041, 17, 4, 12, 13, 17);
|
||||
CopyBgTilemapBufferToVram(1);
|
||||
sub_81CCFA4(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static bool32 sub_81CCC4C(struct Pokenav5Struct_2 *state)
|
||||
{
|
||||
return IsDma3ManagerBusyWithBgCopy();
|
||||
}
|
||||
|
||||
static void sub_81CCC5C(int arg0)
|
||||
{
|
||||
u8 taskId = CreateTask(sub_81CCC9C, 3);
|
||||
gTasks[taskId].data[0] = arg0;
|
||||
}
|
||||
|
||||
static bool32 sub_81CCC88(void)
|
||||
{
|
||||
return FuncIsActiveTask(sub_81CCC9C);
|
||||
}
|
||||
|
||||
static void sub_81CCC9C(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[0])
|
||||
{
|
||||
if (ChangeBgY(1, 0x480, 1) >= 0)
|
||||
{
|
||||
ChangeBgY(1, 0, 0);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
sub_81CCF78();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ChangeBgY(1, 0x480, 2) <= -0x6000)
|
||||
{
|
||||
ChangeBgY(1, -0x6000, 0);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
sub_81CCF78();
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81CCD10(void)
|
||||
{
|
||||
CreateLoopedTask(sub_81CCD34, 1);
|
||||
}
|
||||
|
||||
static bool32 sub_81CCD24(void)
|
||||
{
|
||||
return FuncIsActiveLoopedTask(sub_81CCD34);
|
||||
}
|
||||
|
||||
static u32 sub_81CCD34(int taskState)
|
||||
{
|
||||
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
|
||||
if (taskState < (int)ARRAY_COUNT(gUnknown_08623118))
|
||||
{
|
||||
LZ77UnCompWram(gUnknown_08623118[taskState].data, state->cityZoomPics[taskState]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
static void sub_81CCD70(struct Pokenav5Struct_2 *state, int mapSecId, int pos)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < (int)ARRAY_COUNT(gUnknown_08623118) && (gUnknown_08623118[i].mapSecId != mapSecId || gUnknown_08623118[i].unk2 != pos); i++)
|
||||
;
|
||||
|
||||
if (i == ARRAY_COUNT(gUnknown_08623118))
|
||||
return;
|
||||
|
||||
FillBgTilemapBufferRect_Palette0(1, 0x1041, 17, 6, 12, 11);
|
||||
CopyToBgTilemapBufferRect(1, state->cityZoomPics[i], 18, 6, 10, 10);
|
||||
}
|
||||
|
||||
static void sub_81CCDE8(struct Pokenav5Struct_2 *state, int mapSecId, int pos)
|
||||
{
|
||||
int i = 0;
|
||||
while (1)
|
||||
{
|
||||
const u8 *landmarkName = GetLandmarkName(mapSecId, pos, i);
|
||||
if (!landmarkName)
|
||||
break;
|
||||
|
||||
StringCopyPadded(gStringVar1, landmarkName, CHAR_SPACE, 12);
|
||||
AddTextPrinterParameterized(state->unk8, 7, gStringVar1, 0, i * 16 + 17, TEXT_SPEED_FF, NULL);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81CCE58(void)
|
||||
{
|
||||
int i;
|
||||
int y;
|
||||
struct Sprite *sprite;
|
||||
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
|
||||
|
||||
if (!sub_8124658())
|
||||
y = 228;
|
||||
else
|
||||
y = 132;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
u8 spriteId = CreateSprite(&gUnknown_086231D0, 152 + i * 32, y, 8);
|
||||
sprite = &gSprites[spriteId];
|
||||
sprite->data[0] = 0;
|
||||
sprite->data[1] = i * 4;
|
||||
sprite->data[2] = sprite->oam.tileNum;
|
||||
sprite->data[3] = 150;
|
||||
sprite->data[4] = i * 4;
|
||||
sprite->oam.tileNum += i * 4;
|
||||
state->cityFeatureTextSprites[i] = sprite;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81CCEF4(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->data[3])
|
||||
{
|
||||
sprite->data[3]--;
|
||||
return;
|
||||
}
|
||||
|
||||
if (++sprite->data[0] > 11)
|
||||
sprite->data[0] = 0;
|
||||
|
||||
if (++sprite->data[1] > 60)
|
||||
sprite->data[1] = 0;
|
||||
|
||||
sprite->oam.tileNum = sprite->data[2] + sprite->data[1];
|
||||
if (sprite->data[5] < 4)
|
||||
{
|
||||
if (sprite->data[0] == 0)
|
||||
{
|
||||
sprite->data[5]++;
|
||||
sprite->data[3] = 120;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sprite->data[1] == sprite->data[4])
|
||||
{
|
||||
sprite->data[5] = 0;
|
||||
sprite->data[0] = 0;
|
||||
sprite->data[3] = 120;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81CCF78(void)
|
||||
{
|
||||
int i;
|
||||
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
|
||||
int y = 132 - (GetBgY(1) >> 8);
|
||||
for (i = 0; i < 3; i++)
|
||||
state->cityFeatureTextSprites[i]->pos1.y = y;
|
||||
}
|
||||
|
||||
static void sub_81CCFA4(int invisible)
|
||||
{
|
||||
int i;
|
||||
struct Pokenav5Struct_2 *state = GetSubstructPtr(4);
|
||||
for (i = 0; i < 3; i++)
|
||||
state->cityFeatureTextSprites[i]->invisible = invisible;
|
||||
}
|
@ -493,7 +493,7 @@ void InitRegionMap(struct RegionMap *regionMap, bool8 zoomed)
|
||||
while (sub_8122DB0());
|
||||
}
|
||||
|
||||
void sub_8122CF8(struct RegionMap *regionMap, struct BgTemplate *template, bool8 zoomed)
|
||||
void sub_8122CF8(struct RegionMap *regionMap, const struct BgTemplate *template, bool8 zoomed)
|
||||
{
|
||||
gRegionMap = regionMap;
|
||||
gRegionMap->initStep = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user