mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some harmless or completely superseded PRs have been left alone, as there is not much benefit in attempting to undo them. Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136, #1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179, #1180, #1181, #1182 and #1183.
This commit is contained in:
parent
58a2b62bae
commit
7dc95a0103
2
Makefile
2
Makefile
@ -69,7 +69,7 @@ OBJ_DIR := build/emerald
|
|||||||
LIBPATH := -L ../../tools/agbcc/lib
|
LIBPATH := -L ../../tools/agbcc/lib
|
||||||
else
|
else
|
||||||
CC1 = $(shell $(CC) --print-prog-name=cc1) -quiet
|
CC1 = $(shell $(CC) --print-prog-name=cc1) -quiet
|
||||||
override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mcpu=arm7tdmi -fno-toplevel-reorder -Wno-pointer-to-int-cast
|
override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast
|
||||||
ROM := pokeemerald_modern.gba
|
ROM := pokeemerald_modern.gba
|
||||||
OBJ_DIR := build/modern
|
OBJ_DIR := build/modern
|
||||||
LIBPATH := -L "$(dir $(shell $(CC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(CC) -mthumb -print-file-name=libc.a))"
|
LIBPATH := -L "$(dir $(shell $(CC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(CC) -mthumb -print-file-name=libc.a))"
|
||||||
|
@ -109,7 +109,7 @@ _1a0:
|
|||||||
strh r1, [r0, 0xa] @ SIOMLT_SEND
|
strh r1, [r0, 0xa] @ SIOMLT_SEND
|
||||||
ldr r0, =_data_2f0
|
ldr r0, =_data_2f0
|
||||||
ldr r1, =gCode
|
ldr r1, =gCode
|
||||||
svc 0x11 << 16
|
swi 0x11 << 16
|
||||||
ldr lr, =gCode
|
ldr lr, =gCode
|
||||||
bx lr
|
bx lr
|
||||||
.pool
|
.pool
|
||||||
|
@ -100,12 +100,12 @@ struct CgbChannel
|
|||||||
u8 le;
|
u8 le;
|
||||||
u8 sw;
|
u8 sw;
|
||||||
u32 fr;
|
u32 fr;
|
||||||
u32 *wp;
|
u32 wp;
|
||||||
u32 *cp;
|
u32 cp;
|
||||||
void *tp;
|
u32 tp;
|
||||||
void *pp;
|
u32 pp;
|
||||||
void *np;
|
u32 np;
|
||||||
u32 d4[2];
|
u8 d4[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MusicPlayerTrack;
|
struct MusicPlayerTrack;
|
||||||
@ -138,10 +138,10 @@ struct SoundChannel
|
|||||||
u32 fw;
|
u32 fw;
|
||||||
u32 freq;
|
u32 freq;
|
||||||
struct WaveData *wav;
|
struct WaveData *wav;
|
||||||
s8 *cp;
|
u32 cp;
|
||||||
struct MusicPlayerTrack *track;
|
struct MusicPlayerTrack *track;
|
||||||
void *pp;
|
u32 pp;
|
||||||
void *np;
|
u32 np;
|
||||||
u32 d4;
|
u32 d4;
|
||||||
u16 xpi;
|
u16 xpi;
|
||||||
u16 xpc;
|
u16 xpc;
|
||||||
@ -172,11 +172,11 @@ struct SoundInfo
|
|||||||
u8 pcmDmaPeriod; // number of V-blanks per PCM DMA
|
u8 pcmDmaPeriod; // number of V-blanks per PCM DMA
|
||||||
u8 maxLines;
|
u8 maxLines;
|
||||||
u8 gap[3];
|
u8 gap[3];
|
||||||
u32 pcmSamplesPerVBlank;
|
s32 pcmSamplesPerVBlank;
|
||||||
u32 pcmFreq;
|
s32 pcmFreq;
|
||||||
u32 divFreq;
|
s32 divFreq;
|
||||||
struct CgbChannel *cgbChans;
|
struct CgbChannel *cgbChans;
|
||||||
void (*func)();
|
u32 func;
|
||||||
u32 intp;
|
u32 intp;
|
||||||
void (*CgbSound)(void);
|
void (*CgbSound)(void);
|
||||||
void (*CgbOscOff)(u8);
|
void (*CgbOscOff)(u8);
|
||||||
@ -184,7 +184,7 @@ struct SoundInfo
|
|||||||
u32 MPlayJumpTable;
|
u32 MPlayJumpTable;
|
||||||
u32 plynote;
|
u32 plynote;
|
||||||
u32 ExtVolPit;
|
u32 ExtVolPit;
|
||||||
u32 gap2[4];
|
u8 gap2[16];
|
||||||
struct SoundChannel chans[MAX_DIRECTSOUND_CHANNELS];
|
struct SoundChannel chans[MAX_DIRECTSOUND_CHANNELS];
|
||||||
s8 pcmBuffer[PCM_DMA_BUF_SIZE * 2];
|
s8 pcmBuffer[PCM_DMA_BUF_SIZE * 2];
|
||||||
};
|
};
|
||||||
@ -248,7 +248,7 @@ struct MusicPlayerTrack
|
|||||||
u8 key;
|
u8 key;
|
||||||
u8 velocity;
|
u8 velocity;
|
||||||
u8 runningStatus;
|
u8 runningStatus;
|
||||||
s8 keyM;
|
u8 keyM;
|
||||||
u8 pitM;
|
u8 pitM;
|
||||||
s8 keyShift;
|
s8 keyShift;
|
||||||
s8 keyShiftX;
|
s8 keyShiftX;
|
||||||
@ -312,7 +312,7 @@ struct MusicPlayerInfo
|
|||||||
struct MusicPlayerTrack *tracks;
|
struct MusicPlayerTrack *tracks;
|
||||||
struct ToneData *tone;
|
struct ToneData *tone;
|
||||||
u32 ident;
|
u32 ident;
|
||||||
void (*func)();
|
u32 func;
|
||||||
u32 intp;
|
u32 intp;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -447,7 +447,7 @@ void ply_tune(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
|||||||
void ply_port(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
void ply_port(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||||
void ply_xcmd(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
void ply_xcmd(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||||
void ply_endtie(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
void ply_endtie(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||||
void ply_note(u8, struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
void ply_note(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||||
|
|
||||||
// extended sound command handler functions
|
// extended sound command handler functions
|
||||||
void ply_xxx(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
void ply_xxx(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||||
|
@ -296,7 +296,7 @@ u8 HandleWriteSectorNBytes(u8 sectorNum, u8 *data, u16 size)
|
|||||||
|
|
||||||
u8 TryWriteSector(u8 sectorNum, u8 *data)
|
u8 TryWriteSector(u8 sectorNum, u8 *data)
|
||||||
{
|
{
|
||||||
if (ProgramFlashSectorAndVerify(sectorNum, data)) // is damaged?
|
if (ProgramFlashSectorAndVerify(sectorNum, data) != 0) // is damaged?
|
||||||
{
|
{
|
||||||
SetSectorDamagedStatus(SECTOR_DAMAGED, sectorNum); // set damaged sector bits.
|
SetSectorDamagedStatus(SECTOR_DAMAGED, sectorNum); // set damaged sector bits.
|
||||||
return SAVE_STATUS_ERROR;
|
return SAVE_STATUS_ERROR;
|
||||||
|
@ -26,9 +26,9 @@
|
|||||||
|
|
||||||
.set OAM, 0x7000000
|
.set OAM, 0x7000000
|
||||||
|
|
||||||
.set SOUND_INFO_PTR, IWRAM_END - 0x10
|
.set SOUND_INFO_PTR, 0x3007FF0
|
||||||
.set INTR_CHECK, IWRAM_END - 0x8
|
.set INTR_CHECK, 0x3007FF8
|
||||||
.set INTR_VECTOR, IWRAM_END - 0x4
|
.set INTR_VECTOR, 0x3007FFC
|
||||||
|
|
||||||
.set INTR_FLAG_VBLANK, 1 << 0
|
.set INTR_FLAG_VBLANK, 1 << 0
|
||||||
.set INTR_FLAG_HBLANK, 1 << 1
|
.set INTR_FLAG_HBLANK, 1 << 1
|
||||||
|
38
gflib/bg.c
38
gflib/bg.c
@ -34,8 +34,8 @@ struct BgConfig2
|
|||||||
u32 unk_3:18;
|
u32 unk_3:18;
|
||||||
|
|
||||||
void* tilemap;
|
void* tilemap;
|
||||||
s32 bg_x; // Maybe unsigned, but game treats it as if it is signed a LOT.
|
s32 bg_x;
|
||||||
s32 bg_y; // Same for this variable.
|
s32 bg_y;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct BgControl sGpuBgConfigs;
|
static struct BgControl sGpuBgConfigs;
|
||||||
@ -621,15 +621,17 @@ s32 GetBgX(u8 bg)
|
|||||||
{
|
{
|
||||||
if (IsInvalidBg32(bg))
|
if (IsInvalidBg32(bg))
|
||||||
return -1;
|
return -1;
|
||||||
if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
else if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||||
return -1;
|
return -1;
|
||||||
|
else
|
||||||
return sGpuBgConfigs2[bg].bg_x;
|
return sGpuBgConfigs2[bg].bg_x;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 ChangeBgY(u8 bg, s32 value, u8 op)
|
s32 ChangeBgY(u8 bg, s32 value, u8 op)
|
||||||
{
|
{
|
||||||
u8 mode;
|
u8 mode;
|
||||||
u16 temp1, temp2;
|
u16 temp1;
|
||||||
|
u16 temp2;
|
||||||
|
|
||||||
if (IsInvalidBg32(bg) || !GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
if (IsInvalidBg32(bg) || !GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||||
{
|
{
|
||||||
@ -698,7 +700,8 @@ s32 ChangeBgY(u8 bg, s32 value, u8 op)
|
|||||||
s32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op)
|
s32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op)
|
||||||
{
|
{
|
||||||
u8 mode;
|
u8 mode;
|
||||||
u16 temp1, temp2;
|
u16 temp1;
|
||||||
|
u16 temp2;
|
||||||
|
|
||||||
if (IsInvalidBg32(bg) || !GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
if (IsInvalidBg32(bg) || !GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||||
{
|
{
|
||||||
@ -769,8 +772,9 @@ s32 GetBgY(u8 bg)
|
|||||||
{
|
{
|
||||||
if (IsInvalidBg32(bg))
|
if (IsInvalidBg32(bg))
|
||||||
return -1;
|
return -1;
|
||||||
if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
else if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||||
return -1;
|
return -1;
|
||||||
|
else
|
||||||
return sGpuBgConfigs2[bg].bg_y;
|
return sGpuBgConfigs2[bg].bg_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -870,28 +874,29 @@ void* GetBgTilemapBuffer(u8 bg)
|
|||||||
{
|
{
|
||||||
if (IsInvalidBg32(bg))
|
if (IsInvalidBg32(bg))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
else if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
else
|
||||||
return sGpuBgConfigs2[bg].tilemap;
|
return sGpuBgConfigs2[bg].tilemap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset)
|
void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset)
|
||||||
{
|
{
|
||||||
if (IsInvalidBg32(bg) || IsTileMapOutsideWram(bg))
|
if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg))
|
||||||
return;
|
{
|
||||||
if (mode != 0)
|
if (mode != 0)
|
||||||
CpuCopy16(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)), mode);
|
CpuCopy16(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)), mode);
|
||||||
else
|
else
|
||||||
LZ77UnCompWram(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)));
|
LZ77UnCompWram(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CopyBgTilemapBufferToVram(u8 bg)
|
void CopyBgTilemapBufferToVram(u8 bg)
|
||||||
{
|
{
|
||||||
u16 sizeToLoad;
|
u16 sizeToLoad;
|
||||||
|
|
||||||
if (IsInvalidBg32(bg) || IsTileMapOutsideWram(bg))
|
if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg))
|
||||||
return;
|
{
|
||||||
|
|
||||||
switch (GetBgType(bg))
|
switch (GetBgType(bg))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@ -906,14 +911,16 @@ void CopyBgTilemapBufferToVram(u8 bg)
|
|||||||
}
|
}
|
||||||
LoadBgVram(bg, sGpuBgConfigs2[bg].tilemap, sizeToLoad, 0, 2);
|
LoadBgVram(bg, sGpuBgConfigs2[bg].tilemap, sizeToLoad, 0, 2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CopyToBgTilemapBufferRect(u8 bg, const void* src, u8 destX, u8 destY, u8 width, u8 height)
|
void CopyToBgTilemapBufferRect(u8 bg, const void* src, u8 destX, u8 destY, u8 width, u8 height)
|
||||||
{
|
{
|
||||||
u16 destX16, destY16;
|
u16 destX16;
|
||||||
|
u16 destY16;
|
||||||
u16 mode;
|
u16 mode;
|
||||||
|
|
||||||
if (IsInvalidBg32(bg) || IsTileMapOutsideWram(bg))
|
if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg))
|
||||||
return;
|
{
|
||||||
switch (GetBgType(bg))
|
switch (GetBgType(bg))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@ -943,6 +950,7 @@ void CopyToBgTilemapBufferRect(u8 bg, const void *src, u8 destX, u8 destY, u8 wi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CopyToBgTilemapBufferRect_ChangePalette(u8 bg, const void *src, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette)
|
void CopyToBgTilemapBufferRect_ChangePalette(u8 bg, const void *src, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette)
|
||||||
{
|
{
|
||||||
|
878
gflib/text.c
878
gflib/text.c
File diff suppressed because it is too large
Load Diff
21
gflib/text.h
21
gflib/text.h
@ -269,20 +269,13 @@
|
|||||||
|
|
||||||
#define TEXT_SPEED_FF 0xFF
|
#define TEXT_SPEED_FF 0xFF
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
COLOR_FOREGROUND,
|
|
||||||
COLOR_SHADOW,
|
|
||||||
COLOR_BACKGROUND
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
FONTATTR_MAX_LETTER_WIDTH,
|
FONTATTR_MAX_LETTER_WIDTH,
|
||||||
FONTATTR_MAX_LETTER_HEIGHT,
|
FONTATTR_MAX_LETTER_HEIGHT,
|
||||||
FONTATTR_LETTER_SPACING,
|
FONTATTR_LETTER_SPACING,
|
||||||
FONTATTR_LINE_SPACING,
|
FONTATTR_LINE_SPACING,
|
||||||
FONTATTR_STYLE,
|
FONTATTR_UNKNOWN, // dunno what this is yet
|
||||||
FONTATTR_COLOR_FOREGROUND,
|
FONTATTR_COLOR_FOREGROUND,
|
||||||
FONTATTR_COLOR_BACKGROUND,
|
FONTATTR_COLOR_BACKGROUND,
|
||||||
FONTATTR_COLOR_SHADOW
|
FONTATTR_COLOR_SHADOW
|
||||||
@ -310,7 +303,7 @@ struct TextPrinterTemplate
|
|||||||
u8 currentY;
|
u8 currentY;
|
||||||
u8 letterSpacing;
|
u8 letterSpacing;
|
||||||
u8 lineSpacing;
|
u8 lineSpacing;
|
||||||
u8 style:4; // 0xC
|
u8 unk:4; // 0xC
|
||||||
u8 fgColor:4;
|
u8 fgColor:4;
|
||||||
u8 bgColor:4;
|
u8 bgColor:4;
|
||||||
u8 shadowColor:4;
|
u8 shadowColor:4;
|
||||||
@ -329,7 +322,7 @@ struct TextPrinter
|
|||||||
u8 delayCounter;
|
u8 delayCounter;
|
||||||
u8 scrollDistance;
|
u8 scrollDistance;
|
||||||
u8 minLetterSpacing; // 0x20
|
u8 minLetterSpacing; // 0x20
|
||||||
bool8 japanese;
|
u8 japanese;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FontInfo
|
struct FontInfo
|
||||||
@ -339,7 +332,7 @@ struct FontInfo
|
|||||||
u8 maxLetterHeight;
|
u8 maxLetterHeight;
|
||||||
u8 letterSpacing;
|
u8 letterSpacing;
|
||||||
u8 lineSpacing;
|
u8 lineSpacing;
|
||||||
u8 style:4; //unused
|
u8 unk:4;
|
||||||
u8 fgColor:4;
|
u8 fgColor:4;
|
||||||
u8 bgColor:4;
|
u8 bgColor:4;
|
||||||
u8 shadowColor:4;
|
u8 shadowColor:4;
|
||||||
@ -373,13 +366,13 @@ struct Struct_03002F90
|
|||||||
u32 unk20[8];
|
u32 unk20[8];
|
||||||
u32 unk40[8];
|
u32 unk40[8];
|
||||||
u32 unk60[8];
|
u32 unk60[8];
|
||||||
u8 width;
|
u8 unk80;
|
||||||
u8 height;
|
u8 unk81;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TextFlags gTextFlags;
|
extern TextFlags gTextFlags;
|
||||||
|
|
||||||
extern bool8 gUnknown_03002F84;
|
extern u8 gUnknown_03002F84;
|
||||||
extern struct Struct_03002F90 gUnknown_03002F90;
|
extern struct Struct_03002F90 gUnknown_03002F90;
|
||||||
|
|
||||||
void SetFontsPointer(const struct FontInfo *fonts);
|
void SetFontsPointer(const struct FontInfo *fonts);
|
||||||
|
@ -30,18 +30,21 @@ static void nullsub_8(void)
|
|||||||
|
|
||||||
bool16 InitWindows(const struct WindowTemplate *templates)
|
bool16 InitWindows(const struct WindowTemplate *templates)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i;
|
||||||
u8* allocatedTilemapBuffer;
|
void *bgTilemapBuffer;
|
||||||
u16 attrib;
|
int j;
|
||||||
int allocatedBaseBlock;
|
|
||||||
u8 bgLayer;
|
u8 bgLayer;
|
||||||
|
u16 attrib;
|
||||||
|
u8* allocatedTilemapBuffer;
|
||||||
|
int allocatedBaseBlock;
|
||||||
|
|
||||||
for (i = 0; i < 0x4; ++i)
|
for (i = 0; i < 0x4; ++i)
|
||||||
{
|
{
|
||||||
if (GetBgTilemapBuffer(i) != NULL)
|
bgTilemapBuffer = GetBgTilemapBuffer(i);
|
||||||
|
if (bgTilemapBuffer != NULL)
|
||||||
gUnknown_03002F70[i] = nullsub_8;
|
gUnknown_03002F70[i] = nullsub_8;
|
||||||
else
|
else
|
||||||
gUnknown_03002F70[i] = NULL;
|
gUnknown_03002F70[i] = bgTilemapBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 0x20; ++i)
|
for (i = 0; i < 0x20; ++i)
|
||||||
@ -564,19 +567,19 @@ u32 GetWindowAttribute(u8 windowId, u8 attributeId)
|
|||||||
switch (attributeId)
|
switch (attributeId)
|
||||||
{
|
{
|
||||||
case WINDOW_BG:
|
case WINDOW_BG:
|
||||||
return (u32)gWindows[windowId].window.bg;
|
return gWindows[windowId].window.bg;
|
||||||
case WINDOW_TILEMAP_LEFT:
|
case WINDOW_TILEMAP_LEFT:
|
||||||
return (u32)gWindows[windowId].window.tilemapLeft;
|
return gWindows[windowId].window.tilemapLeft;
|
||||||
case WINDOW_TILEMAP_TOP:
|
case WINDOW_TILEMAP_TOP:
|
||||||
return (u32)gWindows[windowId].window.tilemapTop;
|
return gWindows[windowId].window.tilemapTop;
|
||||||
case WINDOW_WIDTH:
|
case WINDOW_WIDTH:
|
||||||
return (u32)gWindows[windowId].window.width;
|
return gWindows[windowId].window.width;
|
||||||
case WINDOW_HEIGHT:
|
case WINDOW_HEIGHT:
|
||||||
return (u32)gWindows[windowId].window.height;
|
return gWindows[windowId].window.height;
|
||||||
case WINDOW_PALETTE_NUM:
|
case WINDOW_PALETTE_NUM:
|
||||||
return (u32)gWindows[windowId].window.paletteNum;
|
return gWindows[windowId].window.paletteNum;
|
||||||
case WINDOW_BASE_BLOCK:
|
case WINDOW_BASE_BLOCK:
|
||||||
return (u32)gWindows[windowId].window.baseBlock;
|
return gWindows[windowId].window.baseBlock;
|
||||||
case WINDOW_TILE_DATA:
|
case WINDOW_TILE_DATA:
|
||||||
return (u32)(gWindows[windowId].tileData);
|
return (u32)(gWindows[windowId].tileData);
|
||||||
default:
|
default:
|
||||||
@ -640,10 +643,13 @@ u16 AddWindow8Bit(const struct WindowTemplate *template)
|
|||||||
}
|
}
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
gWindows[windowId].tileData = memAddress;
|
gWindows[windowId].tileData = memAddress;
|
||||||
gWindows[windowId].window = *template;
|
gWindows[windowId].window = *template;
|
||||||
return windowId;
|
return windowId;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FillWindowPixelBuffer8Bit(u8 windowId, u8 fillValue)
|
void FillWindowPixelBuffer8Bit(u8 windowId, u8 fillValue)
|
||||||
{
|
{
|
||||||
|
@ -176,8 +176,8 @@ typedef struct linkManagerTag
|
|||||||
/* 0x024 */ VBL_TIMER nameAcceptTimer;
|
/* 0x024 */ VBL_TIMER nameAcceptTimer;
|
||||||
/* 0x030 */ VBL_TIMER linkRecoveryTimer;
|
/* 0x030 */ VBL_TIMER linkRecoveryTimer;
|
||||||
/* 0x03c */ INIT_PARAM *init_param;
|
/* 0x03c */ INIT_PARAM *init_param;
|
||||||
/* 0x040 */ void (*LMAN_callback)(u8 msg, u8 paramCount);
|
/* 0x040 */ void (*LMAN_callback)(u8, u8);
|
||||||
/* 0x044 */ void (*MSC_callback)(u16 REQ_commandID);
|
/* 0x044 */ void (*MSC_callback)(u16);
|
||||||
} LINK_MANAGER;
|
} LINK_MANAGER;
|
||||||
|
|
||||||
extern struct linkManagerTag lman;
|
extern struct linkManagerTag lman;
|
||||||
|
@ -124,22 +124,22 @@ struct ProtectStruct
|
|||||||
u32 flinchImmobility:1;
|
u32 flinchImmobility:1;
|
||||||
u32 notFirstStrike:1;
|
u32 notFirstStrike:1;
|
||||||
u32 palaceUnableToUseMove:1;
|
u32 palaceUnableToUseMove:1;
|
||||||
s32 physicalDmg;
|
u32 physicalDmg;
|
||||||
s32 specialDmg;
|
u32 specialDmg;
|
||||||
u8 physicalBattlerId;
|
u8 physicalBattlerId;
|
||||||
u8 specialBattlerId;
|
u8 specialBattlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SpecialStatus
|
struct SpecialStatus
|
||||||
{
|
{
|
||||||
u32 statLowered:1;
|
u8 statLowered:1;
|
||||||
u32 lightningRodRedirected:1;
|
u8 lightningRodRedirected:1;
|
||||||
u32 restoredBattlerSprite: 1;
|
u8 restoredBattlerSprite: 1;
|
||||||
u32 intimidatedMon:1;
|
u8 intimidatedMon:1;
|
||||||
u32 traced:1;
|
u8 traced:1;
|
||||||
u32 ppNotAffectedByPressure:1;
|
u8 ppNotAffectedByPressure:1;
|
||||||
u32 flag40:1;
|
u8 flag40:1;
|
||||||
u32 focusBanded:1;
|
u8 focusBanded:1;
|
||||||
s32 dmg;
|
s32 dmg;
|
||||||
s32 physicalDmg;
|
s32 physicalDmg;
|
||||||
s32 specialDmg;
|
s32 specialDmg;
|
||||||
@ -254,7 +254,7 @@ struct BattleResults
|
|||||||
u16 playerMon2Species; // 0x26
|
u16 playerMon2Species; // 0x26
|
||||||
u16 caughtMonSpecies; // 0x28
|
u16 caughtMonSpecies; // 0x28
|
||||||
u8 caughtMonNick[POKEMON_NAME_LENGTH + 1]; // 0x2A
|
u8 caughtMonNick[POKEMON_NAME_LENGTH + 1]; // 0x2A
|
||||||
u8 filler35; // 0x35
|
u8 filler35[1]; // 0x35
|
||||||
u8 catchAttempts[11]; // 0x36
|
u8 catchAttempts[11]; // 0x36
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,6 +73,8 @@ void nullsub_20(void);
|
|||||||
void BeginBattleIntro(void);
|
void BeginBattleIntro(void);
|
||||||
void SwitchInClearSetData(void);
|
void SwitchInClearSetData(void);
|
||||||
void FaintClearSetData(void);
|
void FaintClearSetData(void);
|
||||||
|
void sub_803B3AC(void); // unused
|
||||||
|
void sub_803B598(void); // unused
|
||||||
void BattleTurnPassed(void);
|
void BattleTurnPassed(void);
|
||||||
u8 IsRunningFromBattleImpossible(void);
|
u8 IsRunningFromBattleImpossible(void);
|
||||||
void SwitchPartyOrder(u8 battlerId);
|
void SwitchPartyOrder(u8 battlerId);
|
||||||
@ -81,7 +83,6 @@ u8 GetWhoStrikesFirst(u8 battlerId1, u8 battlerId2, bool8 ignoreChosenMoves);
|
|||||||
void RunBattleScriptCommands_PopCallbacksStack(void);
|
void RunBattleScriptCommands_PopCallbacksStack(void);
|
||||||
void RunBattleScriptCommands(void);
|
void RunBattleScriptCommands(void);
|
||||||
bool8 TryRunFromBattle(u8 battlerId);
|
bool8 TryRunFromBattle(u8 battlerId);
|
||||||
void SpecialStatusesClear(void);
|
|
||||||
|
|
||||||
extern struct UnknownPokemonStruct4 gMultiPartnerParty[MULTI_PARTY_SIZE];
|
extern struct UnknownPokemonStruct4 gMultiPartnerParty[MULTI_PARTY_SIZE];
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@
|
|||||||
{ \
|
{ \
|
||||||
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
|
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
|
||||||
textVar[1] = B_BUFF_STRING; \
|
textVar[1] = B_BUFF_STRING; \
|
||||||
textVar[2] = (stringId & 0xFF); \
|
textVar[2] = stringId; \
|
||||||
textVar[3] = (stringId & 0xFF00) >> 8; \
|
textVar[3] = (stringId & 0xFF00) >> 8; \
|
||||||
textVar[4] = B_BUFF_EOS; \
|
textVar[4] = B_BUFF_EOS; \
|
||||||
}
|
}
|
||||||
|
@ -41,19 +41,6 @@
|
|||||||
#define WEATHER_HAS_EFFECT ((!ABILITY_ON_FIELD(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD(ABILITY_AIR_LOCK)))
|
#define WEATHER_HAS_EFFECT ((!ABILITY_ON_FIELD(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD(ABILITY_AIR_LOCK)))
|
||||||
#define WEATHER_HAS_EFFECT2 ((!ABILITY_ON_FIELD2(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD2(ABILITY_AIR_LOCK)))
|
#define WEATHER_HAS_EFFECT2 ((!ABILITY_ON_FIELD2(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD2(ABILITY_AIR_LOCK)))
|
||||||
|
|
||||||
void HandleAction_UseMove(void);
|
|
||||||
void HandleAction_Switch(void);
|
|
||||||
void HandleAction_UseItem(void);
|
|
||||||
void HandleAction_Run(void);
|
|
||||||
void HandleAction_WatchesCarefully(void);
|
|
||||||
void HandleAction_SafariZoneBallThrow(void);
|
|
||||||
void HandleAction_ThrowPokeblock(void);
|
|
||||||
void HandleAction_GoNear(void);
|
|
||||||
void HandleAction_SafariZoneRun(void);
|
|
||||||
void HandleAction_WallyBallThrow(void);
|
|
||||||
void HandleAction_TryFinish(void);
|
|
||||||
void HandleAction_NothingIsFainted(void);
|
|
||||||
void HandleAction_ActionFinished(void);
|
|
||||||
u8 GetBattlerForBattleScript(u8 caseId);
|
u8 GetBattlerForBattleScript(u8 caseId);
|
||||||
void PressurePPLose(u8 target, u8 attacker, u16 move);
|
void PressurePPLose(u8 target, u8 attacker, u16 move);
|
||||||
void PressurePPLoseOnUsingPerishSong(u8 attacker);
|
void PressurePPLoseOnUsingPerishSong(u8 attacker);
|
||||||
|
@ -186,7 +186,7 @@
|
|||||||
#define HITMARKER_x4000000 (1 << 26)
|
#define HITMARKER_x4000000 (1 << 26)
|
||||||
#define HITMARKER_CHARGING (1 << 27)
|
#define HITMARKER_CHARGING (1 << 27)
|
||||||
#define HITMARKER_FAINTED(battler) (gBitTable[battler] << 28)
|
#define HITMARKER_FAINTED(battler) (gBitTable[battler] << 28)
|
||||||
#define HITMARKER_FAINTED2(battler) ((1 << 28) << battler)
|
#define HITMARKER_FAINTED2(battler) (1 << (28 + battler))
|
||||||
|
|
||||||
// Per-side statuses that affect an entire party
|
// Per-side statuses that affect an entire party
|
||||||
#define SIDE_STATUS_REFLECT (1 << 0)
|
#define SIDE_STATUS_REFLECT (1 << 0)
|
||||||
|
@ -7,6 +7,16 @@
|
|||||||
#define FLOOR_WALKABLE_METATILE 0x28D
|
#define FLOOR_WALKABLE_METATILE 0x28D
|
||||||
#define FLOOR_EXIT_METATILE 0x28E
|
#define FLOOR_EXIT_METATILE 0x28E
|
||||||
|
|
||||||
|
#define HINT_EXIT_DIRECTION 0
|
||||||
|
#define HINT_REMAINING_ITEMS 1
|
||||||
|
#define HINT_REMAINING_TRAINERS 2
|
||||||
|
#define HINT_EXIT_SHORT_REMAINING_TRAINERS 3
|
||||||
|
#define HINT_EXIT_SHORT_REMAINING_ITEMS 4
|
||||||
|
#define HINT_EXIT_MEDIUM_REMAINING_TRAINERS 5
|
||||||
|
#define HINT_EXIT_MEDIUM_REMAINING_ITEMS 6
|
||||||
|
#define HINT_EXIT_FAR_REMAINING_TRAINERS 7
|
||||||
|
#define HINT_EXIT_FAR_REMAINING_ITEMS 8
|
||||||
|
|
||||||
#define OBJ_TRAINERS 0
|
#define OBJ_TRAINERS 0
|
||||||
#define OBJ_ITEMS 1
|
#define OBJ_ITEMS 1
|
||||||
|
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
#ifndef GUARD_RGB_H
|
#ifndef GUARD_RGB_H
|
||||||
#define GUARD_RGB_H
|
#define GUARD_RGB_H
|
||||||
|
|
||||||
#define GET_R(color) ((color) & 0x1F)
|
|
||||||
#define GET_G(color) (((color) >> 5) & 0x1F)
|
|
||||||
#define GET_B(color) (((color) >> 10) & 0x1F)
|
|
||||||
|
|
||||||
#define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10))
|
#define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10))
|
||||||
#define RGB2(r, g, b) (((b) << 10) | ((g) << 5) | (r))
|
#define RGB2(r, g, b) (((b) << 10) | ((g) << 5) | (r))
|
||||||
#define _RGB(r, g, b) ((((b) & 0x1F) << 10) + (((g) & 0x1F) << 5) + ((r) & 0x1F))
|
#define _RGB(r, g, b) ((((b) & 0x1F) << 10) + (((g) & 0x1F) << 5) + ((r) & 0x1F))
|
||||||
|
@ -140,13 +140,55 @@ struct SoundChannel
|
|||||||
struct WaveData *wav;
|
struct WaveData *wav;
|
||||||
u32 cp;
|
u32 cp;
|
||||||
struct MusicPlayerTrack *track;
|
struct MusicPlayerTrack *track;
|
||||||
void *pp;
|
u32 pp;
|
||||||
void *np;
|
u32 np;
|
||||||
void *d4;
|
u32 d4;
|
||||||
u16 xpi;
|
u16 xpi;
|
||||||
u16 xpc;
|
u16 xpc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define MAX_DIRECTSOUND_CHANNELS 12
|
||||||
|
|
||||||
|
#define PCM_DMA_BUF_SIZE 1584 // size of Direct Sound buffer
|
||||||
|
|
||||||
|
struct SoundInfo
|
||||||
|
{
|
||||||
|
// This field is normally equal to ID_NUMBER but it is set to other
|
||||||
|
// values during sensitive operations for locking purposes.
|
||||||
|
// This field should be volatile but isn't. This could potentially cause
|
||||||
|
// race conditions.
|
||||||
|
u32 ident;
|
||||||
|
|
||||||
|
vu8 pcmDmaCounter;
|
||||||
|
|
||||||
|
// Direct Sound
|
||||||
|
u8 reverb;
|
||||||
|
u8 maxChans;
|
||||||
|
u8 masterVolume;
|
||||||
|
u8 freq;
|
||||||
|
|
||||||
|
u8 mode;
|
||||||
|
u8 c15;
|
||||||
|
u8 pcmDmaPeriod; // number of V-blanks per PCM DMA
|
||||||
|
u8 maxLines;
|
||||||
|
u8 gap[3];
|
||||||
|
s32 pcmSamplesPerVBlank;
|
||||||
|
s32 pcmFreq;
|
||||||
|
s32 divFreq;
|
||||||
|
struct CgbChannel *cgbChans;
|
||||||
|
u32 func;
|
||||||
|
u32 intp;
|
||||||
|
void (*CgbSound)(void);
|
||||||
|
void (*CgbOscOff)(u8);
|
||||||
|
u32 (*MidiKeyToCgbFreq)(u8, u8, u8);
|
||||||
|
u32 MPlayJumpTable;
|
||||||
|
u32 plynote;
|
||||||
|
u32 ExtVolPit;
|
||||||
|
u8 gap2[16];
|
||||||
|
struct SoundChannel chans[MAX_DIRECTSOUND_CHANNELS];
|
||||||
|
s8 pcmBuffer[PCM_DMA_BUF_SIZE * 2];
|
||||||
|
};
|
||||||
|
|
||||||
struct SongHeader
|
struct SongHeader
|
||||||
{
|
{
|
||||||
u8 trackCount;
|
u8 trackCount;
|
||||||
@ -270,7 +312,7 @@ struct MusicPlayerInfo
|
|||||||
struct MusicPlayerTrack *tracks;
|
struct MusicPlayerTrack *tracks;
|
||||||
struct ToneData *tone;
|
struct ToneData *tone;
|
||||||
u32 ident;
|
u32 ident;
|
||||||
void (*func)();
|
u32 func;
|
||||||
u32 intp;
|
u32 intp;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -292,47 +334,7 @@ struct Song
|
|||||||
extern const struct MusicPlayer gMPlayTable[];
|
extern const struct MusicPlayer gMPlayTable[];
|
||||||
extern const struct Song gSongTable[];
|
extern const struct Song gSongTable[];
|
||||||
|
|
||||||
#define MAX_DIRECTSOUND_CHANNELS 12
|
|
||||||
|
|
||||||
#define PCM_DMA_BUF_SIZE 1584 // size of Direct Sound buffer
|
|
||||||
|
|
||||||
struct SoundInfo
|
|
||||||
{
|
|
||||||
// This field is normally equal to ID_NUMBER but it is set to other
|
|
||||||
// values during sensitive operations for locking purposes.
|
|
||||||
// This field should be volatile but isn't. This could potentially cause
|
|
||||||
// race conditions.
|
|
||||||
u32 ident;
|
|
||||||
|
|
||||||
vu8 pcmDmaCounter;
|
|
||||||
|
|
||||||
// Direct Sound
|
|
||||||
u8 reverb;
|
|
||||||
u8 maxChans;
|
|
||||||
u8 masterVolume;
|
|
||||||
u8 freq;
|
|
||||||
|
|
||||||
u8 mode;
|
|
||||||
u8 c15;
|
|
||||||
u8 pcmDmaPeriod; // number of V-blanks per PCM DMA
|
|
||||||
u8 maxLines;
|
|
||||||
u8 gap[3];
|
|
||||||
s32 pcmSamplesPerVBlank;
|
|
||||||
s32 pcmFreq;
|
|
||||||
s32 divFreq;
|
|
||||||
struct CgbChannel *cgbChans;
|
|
||||||
void (*func)();
|
|
||||||
u32 intp;
|
|
||||||
void (*CgbSound)();
|
|
||||||
void (*CgbOscOff)(u8);
|
|
||||||
u32 (*MidiKeyToCgbFreq)(u8, u8, u8);
|
|
||||||
void (**MPlayJumpTable)();
|
|
||||||
void (*plynote)(u8, struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
|
||||||
void (*ExtVolPit)(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
|
||||||
u32 gap2[4];
|
|
||||||
struct SoundChannel chans[MAX_DIRECTSOUND_CHANNELS];
|
|
||||||
s8 pcmBuffer[PCM_DMA_BUF_SIZE * 2];
|
|
||||||
};
|
|
||||||
|
|
||||||
extern u8 gMPlayMemAccArea[];
|
extern u8 gMPlayMemAccArea[];
|
||||||
|
|
||||||
@ -446,7 +448,7 @@ void ply_tune(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
|||||||
void ply_port(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
void ply_port(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||||
void ply_xcmd(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
void ply_xcmd(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||||
void ply_endtie(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
void ply_endtie(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||||
void ply_note(u8, struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
void ply_note(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||||
|
|
||||||
// extended sound command handler functions
|
// extended sound command handler functions
|
||||||
void ply_xxx(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
void ply_xxx(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||||
|
@ -99,7 +99,7 @@
|
|||||||
#define T2_READ_PTR(ptr) (void*) T2_READ_32(ptr)
|
#define T2_READ_PTR(ptr) (void*) T2_READ_32(ptr)
|
||||||
|
|
||||||
// Macros for checking the joypad
|
// Macros for checking the joypad
|
||||||
#define TEST_BUTTON(field, button) ((field) & (button))
|
#define TEST_BUTTON(field, button) ({(field) & (button);})
|
||||||
#define JOY_NEW(button) TEST_BUTTON(gMain.newKeys, button)
|
#define JOY_NEW(button) TEST_BUTTON(gMain.newKeys, button)
|
||||||
#define JOY_HELD(button) TEST_BUTTON(gMain.heldKeys, button)
|
#define JOY_HELD(button) TEST_BUTTON(gMain.heldKeys, button)
|
||||||
#define JOY_HELD_RAW(button) TEST_BUTTON(gMain.heldKeysRaw, button)
|
#define JOY_HELD_RAW(button) TEST_BUTTON(gMain.heldKeysRaw, button)
|
||||||
|
@ -24,7 +24,7 @@ struct ListMenu;
|
|||||||
struct ListMenuItem
|
struct ListMenuItem
|
||||||
{
|
{
|
||||||
const u8 *name;
|
const u8 *name;
|
||||||
u32 id;
|
s32 id;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ListMenuTemplate
|
struct ListMenuTemplate
|
||||||
@ -98,7 +98,7 @@ struct CursorStruct
|
|||||||
extern struct ScrollArrowsTemplate gTempScrollArrowTemplate;
|
extern struct ScrollArrowsTemplate gTempScrollArrowTemplate;
|
||||||
extern struct ListMenuTemplate gMultiuseListMenuTemplate;
|
extern struct ListMenuTemplate gMultiuseListMenuTemplate;
|
||||||
|
|
||||||
u32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum);
|
s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum);
|
||||||
u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow);
|
u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow);
|
||||||
u8 ListMenuInitInRect(struct ListMenuTemplate *listMenuTemplate, struct ListMenuWindowRect *arg1, u16 scrollOffset, u16 selectedRow);
|
u8 ListMenuInitInRect(struct ListMenuTemplate *listMenuTemplate, struct ListMenuWindowRect *arg1, u16 scrollOffset, u16 selectedRow);
|
||||||
s32 ListMenu_ProcessInput(u8 listTaskId);
|
s32 ListMenu_ProcessInput(u8 listTaskId);
|
||||||
|
@ -123,12 +123,12 @@ struct Pokemon
|
|||||||
|
|
||||||
struct Unknown_806F160_Struct
|
struct Unknown_806F160_Struct
|
||||||
{
|
{
|
||||||
u32 field_0_0:4;
|
u8 field_0_0:4;
|
||||||
u32 field_0_1:4;
|
u8 field_0_1:4;
|
||||||
u32 field_1:8;
|
u8 field_1;
|
||||||
u16 magic:8;
|
u8 magic;
|
||||||
u32 size:4;
|
u8 field_3_0:4;
|
||||||
u16 field_3_1:4;
|
u8 field_3_1:4;
|
||||||
void *bytes;
|
void *bytes;
|
||||||
u8 **byteArrays;
|
u8 **byteArrays;
|
||||||
struct SpriteTemplate *templates;
|
struct SpriteTemplate *templates;
|
||||||
|
@ -313,7 +313,7 @@ bool32 WaitForHelpBar(void);
|
|||||||
void sub_81C78A0(void);
|
void sub_81C78A0(void);
|
||||||
bool32 MainMenuLoopedTaskIsBusy(void);
|
bool32 MainMenuLoopedTaskIsBusy(void);
|
||||||
void sub_81C7FDC(void);
|
void sub_81C7FDC(void);
|
||||||
void sub_81C79BC(const u16 *a0, const u16 *a1, int a2, int a3, int a4, u16 *palette);
|
void sub_81C79BC(const u16 *a0, const u16 *a1, u32 a2, u32 a3, u32 a4, u16 *a5);
|
||||||
void sub_81C7B40(void);
|
void sub_81C7B40(void);
|
||||||
struct Sprite *PauseSpinningPokenavSprite(void);
|
struct Sprite *PauseSpinningPokenavSprite(void);
|
||||||
void ResumeSpinningPokenavSprite(void);
|
void ResumeSpinningPokenavSprite(void);
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
.include "../constants/gba_constants.inc"
|
.include "../constants/gba_constants.inc"
|
||||||
.include "../asm/macros/function.inc"
|
.include "../asm/macros/function.inc"
|
||||||
|
|
||||||
.syntax unified
|
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
.set SOFT_RESET_DIRECT_BUF, 0x03007FFA
|
.set SOFT_RESET_DIRECT_BUF, 0x03007FFA
|
||||||
.set USER_STACK, 0x03007F00
|
|
||||||
.set RESET_EX_WRAM_FLAG, 0x1
|
.set RESET_EX_WRAM_FLAG, 0x1
|
||||||
|
|
||||||
.ifdef NO_GRANULAR_AGBSYSCALL
|
.ifdef NO_GRANULAR_AGBSYSCALL
|
||||||
@ -109,7 +106,7 @@ SoundDriverVSyncOn:
|
|||||||
thumb_func_start Mod
|
thumb_func_start Mod
|
||||||
Mod:
|
Mod:
|
||||||
svc #6
|
svc #6
|
||||||
adds r0, r1, #0
|
mov r0, r1
|
||||||
bx lr
|
bx lr
|
||||||
thumb_func_end Mod
|
thumb_func_end Mod
|
||||||
.endif
|
.endif
|
||||||
@ -148,7 +145,7 @@ HuffUnComp:
|
|||||||
.endif
|
.endif
|
||||||
|
|
||||||
.ifdef L_SoftResetExram
|
.ifdef L_SoftResetExram
|
||||||
thumb_func_start SoftResetExram
|
arm_func_start SoftResetExram
|
||||||
SoftResetExram:
|
SoftResetExram:
|
||||||
ldr r3, =REG_IME
|
ldr r3, =REG_IME
|
||||||
movs r2, #0
|
movs r2, #0
|
||||||
@ -156,14 +153,14 @@ SoftResetExram:
|
|||||||
ldr r3, =SOFT_RESET_DIRECT_BUF
|
ldr r3, =SOFT_RESET_DIRECT_BUF
|
||||||
movs r2, #1
|
movs r2, #1
|
||||||
strb r2, [r3, #0]
|
strb r2, [r3, #0]
|
||||||
subs r3, #SOFT_RESET_DIRECT_BUF - USER_STACK
|
subs r3, #SOFT_RESET_DIRECT_BUF - 0x3007f00
|
||||||
mov sp, r3
|
mov sp, r3
|
||||||
movs r2, #RESET_EX_WRAM_FLAG
|
movs r2, #RESET_EX_WRAM_FLAG
|
||||||
bics r0, r2
|
bics r0, r2
|
||||||
svc #1
|
svc #1
|
||||||
svc #0
|
svc #0
|
||||||
.pool
|
.pool
|
||||||
thumb_func_end SoftResetExram
|
arm_func_end SoftResetExram
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.ifdef L_MusicPlayerFadeOut
|
.ifdef L_MusicPlayerFadeOut
|
||||||
@ -234,7 +231,7 @@ DivArm:
|
|||||||
thumb_func_start ModArm
|
thumb_func_start ModArm
|
||||||
ModArm:
|
ModArm:
|
||||||
svc #7
|
svc #7
|
||||||
adds r0, r1, #0
|
mov r0, r1
|
||||||
bx lr
|
bx lr
|
||||||
thumb_func_end ModArm
|
thumb_func_end ModArm
|
||||||
.endif
|
.endif
|
||||||
@ -274,7 +271,7 @@ Diff8bitUnFilterWram:
|
|||||||
.ifdef L_MultiBoot
|
.ifdef L_MultiBoot
|
||||||
thumb_func_start MultiBoot
|
thumb_func_start MultiBoot
|
||||||
MultiBoot:
|
MultiBoot:
|
||||||
movs r1, #1
|
mov r1, #1
|
||||||
svc #37
|
svc #37
|
||||||
bx lr
|
bx lr
|
||||||
thumb_func_end MultiBoot
|
thumb_func_end MultiBoot
|
||||||
@ -329,7 +326,7 @@ SoftResetRom:
|
|||||||
ldr r3, =SOFT_RESET_DIRECT_BUF
|
ldr r3, =SOFT_RESET_DIRECT_BUF
|
||||||
movs r2, #0
|
movs r2, #0
|
||||||
strb r2, [r3, #0]
|
strb r2, [r3, #0]
|
||||||
subs r3, #SOFT_RESET_DIRECT_BUF - USER_STACK
|
sub r3, #SOFT_RESET_DIRECT_BUF - 0x3007f00
|
||||||
mov sp, r3
|
mov sp, r3
|
||||||
svc #1
|
svc #1
|
||||||
svc #0
|
svc #0
|
||||||
@ -416,7 +413,7 @@ SoftReset:
|
|||||||
ldr r3, =REG_IME
|
ldr r3, =REG_IME
|
||||||
movs r2, #0
|
movs r2, #0
|
||||||
strb r2, [r3, #0]
|
strb r2, [r3, #0]
|
||||||
ldr r1, =USER_STACK
|
ldr r1, =0x3007f00
|
||||||
mov sp, r1
|
mov sp, r1
|
||||||
svc #1
|
svc #1
|
||||||
svc #0
|
svc #0
|
||||||
|
@ -352,7 +352,7 @@ static bool8 rfu_LMAN_linkWatcher(u16 REQ_commandID)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < RFU_CHILD_MAX; i++)
|
for (i = 0; i < RFU_CHILD_MAX; i++)
|
||||||
{
|
{
|
||||||
if (bm_linkLossSlot & (1 << i))
|
if ((bm_linkLossSlot >> i) & 1)
|
||||||
{
|
{
|
||||||
lman.linkRecoveryTimer.active |= (1 << i);
|
lman.linkRecoveryTimer.active |= (1 << i);
|
||||||
lman.linkRecoveryTimer.count[i] = lman.linkRecoveryTimer.count_max;
|
lman.linkRecoveryTimer.count[i] = lman.linkRecoveryTimer.count_max;
|
||||||
@ -396,7 +396,7 @@ static bool8 rfu_LMAN_linkWatcher(u16 REQ_commandID)
|
|||||||
bm_disconnectSlot = 0;
|
bm_disconnectSlot = 0;
|
||||||
for (i = 0; i < RFU_CHILD_MAX; i++)
|
for (i = 0; i < RFU_CHILD_MAX; i++)
|
||||||
{
|
{
|
||||||
if ((lman.linkRecoveryTimer.active) & (1 << i) && lman.linkRecoveryTimer.count[i] && --lman.linkRecoveryTimer.count[i] == 0)
|
if ((lman.linkRecoveryTimer.active >> i) & 1 && lman.linkRecoveryTimer.count[i] && --lman.linkRecoveryTimer.count[i] == 0)
|
||||||
{
|
{
|
||||||
lman.linkRecoveryTimer.active &= ~(1 << i);
|
lman.linkRecoveryTimer.active &= ~(1 << i);
|
||||||
bm_disconnectSlot |= (1 << i);
|
bm_disconnectSlot |= (1 << i);
|
||||||
@ -918,7 +918,7 @@ static void rfu_LMAN_REQ_callback(u16 reqCommandId, u16 reqResult)
|
|||||||
{
|
{
|
||||||
lman.reserveDisconnectSlot_flag = 0;
|
lman.reserveDisconnectSlot_flag = 0;
|
||||||
lman.acceptCount = 0;
|
lman.acceptCount = 0;
|
||||||
lman.acceptSlot_flag = 0;
|
lman.acceptSlot_flag = 0;;
|
||||||
lman.parent_child = MODE_NEUTRAL;
|
lman.parent_child = MODE_NEUTRAL;
|
||||||
rfu_LMAN_managerChangeAgbClockMaster();
|
rfu_LMAN_managerChangeAgbClockMaster();
|
||||||
if (reqCommandId == ID_STOP_MODE_REQ)
|
if (reqCommandId == ID_STOP_MODE_REQ)
|
||||||
|
@ -41,7 +41,7 @@ u16 ReadFlashId(void)
|
|||||||
u8 (*readFlash1)(u8 *);
|
u8 (*readFlash1)(u8 *);
|
||||||
|
|
||||||
SetReadFlash1(readFlash1Buffer);
|
SetReadFlash1(readFlash1Buffer);
|
||||||
readFlash1 = (u8 (*)(u8 *))((uintptr_t)readFlash1Buffer + 1);
|
readFlash1 = (u8 (*)(u8 *))((s32)readFlash1Buffer + 1);
|
||||||
|
|
||||||
// Enter ID mode.
|
// Enter ID mode.
|
||||||
FLASH_WRITE(0x5555, 0xAA);
|
FLASH_WRITE(0x5555, 0xAA);
|
||||||
@ -113,12 +113,12 @@ void SetReadFlash1(u16 *dest)
|
|||||||
u16 *src;
|
u16 *src;
|
||||||
u16 i;
|
u16 i;
|
||||||
|
|
||||||
PollFlashStatus = (u8 (*)(u8 *))((uintptr_t)dest + 1);
|
PollFlashStatus = (u8 (*)(u8 *))((s32)dest + 1);
|
||||||
|
|
||||||
src = (u16 *)ReadFlash1;
|
src = (u16 *)ReadFlash1;
|
||||||
src = (u16 *)((uintptr_t)src ^ 1);
|
src = (u16 *)((s32)src ^ 1);
|
||||||
|
|
||||||
i = ((uintptr_t)SetReadFlash1 - (uintptr_t)ReadFlash1) >> 1;
|
i = ((s32)SetReadFlash1 - (s32)ReadFlash1) >> 1;
|
||||||
|
|
||||||
while (i != 0)
|
while (i != 0)
|
||||||
{
|
{
|
||||||
@ -154,10 +154,10 @@ void ReadFlash(u16 sectorNum, u32 offset, u8 *dest, u32 size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
funcSrc = (vu16 *)ReadFlash_Core;
|
funcSrc = (vu16 *)ReadFlash_Core;
|
||||||
funcSrc = (vu16 *)((uintptr_t)funcSrc ^ 1);
|
funcSrc = (vu16 *)((s32)funcSrc ^ 1);
|
||||||
funcDest = readFlash_Core_Buffer;
|
funcDest = readFlash_Core_Buffer;
|
||||||
|
|
||||||
i = ((uintptr_t)ReadFlash - (uintptr_t)ReadFlash_Core) >> 1;
|
i = ((s32)ReadFlash - (s32)ReadFlash_Core) >> 1;
|
||||||
|
|
||||||
while (i != 0)
|
while (i != 0)
|
||||||
{
|
{
|
||||||
@ -165,7 +165,7 @@ void ReadFlash(u16 sectorNum, u32 offset, u8 *dest, u32 size)
|
|||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
|
||||||
readFlash_Core = (void (*)(vu8 *, u8 *, u32))((uintptr_t)readFlash_Core_Buffer + 1);
|
readFlash_Core = (void (*)(vu8 *, u8 *, u32))((s32)readFlash_Core_Buffer + 1);
|
||||||
|
|
||||||
src = FLASH_BASE + (sectorNum << gFlash->sector.shift) + offset;
|
src = FLASH_BASE + (sectorNum << gFlash->sector.shift) + offset;
|
||||||
|
|
||||||
@ -202,10 +202,10 @@ u32 VerifyFlashSector(u16 sectorNum, u8 *src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
funcSrc = (vu16 *)VerifyFlashSector_Core;
|
funcSrc = (vu16 *)VerifyFlashSector_Core;
|
||||||
funcSrc = (vu16 *)((uintptr_t)funcSrc ^ 1);
|
funcSrc = (vu16 *)((s32)funcSrc ^ 1);
|
||||||
funcDest = verifyFlashSector_Core_Buffer;
|
funcDest = verifyFlashSector_Core_Buffer;
|
||||||
|
|
||||||
i = (u16)(((uintptr_t)VerifyFlashSector - (uintptr_t)VerifyFlashSector_Core) >> 1);
|
i = ((s32)VerifyFlashSector - (s32)VerifyFlashSector_Core) >> 1;
|
||||||
|
|
||||||
while (i != 0)
|
while (i != 0)
|
||||||
{
|
{
|
||||||
@ -213,7 +213,7 @@ u32 VerifyFlashSector(u16 sectorNum, u8 *src)
|
|||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyFlashSector_Core = (u32 (*)(u8 *, u8 *, u32))((uintptr_t)verifyFlashSector_Core_Buffer + 1);
|
verifyFlashSector_Core = (u32 (*)(u8 *, u8 *, u32))((s32)verifyFlashSector_Core_Buffer + 1);
|
||||||
|
|
||||||
tgt = FLASH_BASE + (sectorNum << gFlash->sector.shift);
|
tgt = FLASH_BASE + (sectorNum << gFlash->sector.shift);
|
||||||
size = gFlash->sector.size;
|
size = gFlash->sector.size;
|
||||||
@ -239,10 +239,10 @@ u32 VerifyFlashSectorNBytes(u16 sectorNum, u8 *src, u32 n)
|
|||||||
REG_WAITCNT = (REG_WAITCNT & ~WAITCNT_SRAM_MASK) | WAITCNT_SRAM_8;
|
REG_WAITCNT = (REG_WAITCNT & ~WAITCNT_SRAM_MASK) | WAITCNT_SRAM_8;
|
||||||
|
|
||||||
funcSrc = (vu16 *)VerifyFlashSector_Core;
|
funcSrc = (vu16 *)VerifyFlashSector_Core;
|
||||||
funcSrc = (vu16 *)((uintptr_t)funcSrc ^ 1);
|
funcSrc = (vu16 *)((s32)funcSrc ^ 1);
|
||||||
funcDest = verifyFlashSector_Core_Buffer;
|
funcDest = verifyFlashSector_Core_Buffer;
|
||||||
|
|
||||||
i = ((uintptr_t)VerifyFlashSector - (uintptr_t)VerifyFlashSector_Core) >> 1;
|
i = ((s32)VerifyFlashSector - (s32)VerifyFlashSector_Core) >> 1;
|
||||||
|
|
||||||
while (i != 0)
|
while (i != 0)
|
||||||
{
|
{
|
||||||
@ -250,7 +250,7 @@ u32 VerifyFlashSectorNBytes(u16 sectorNum, u8 *src, u32 n)
|
|||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyFlashSector_Core = (u32 (*)(u8 *, u8 *, u32))((uintptr_t)verifyFlashSector_Core_Buffer + 1);
|
verifyFlashSector_Core = (u32 (*)(u8 *, u8 *, u32))((s32)verifyFlashSector_Core_Buffer + 1);
|
||||||
|
|
||||||
tgt = FLASH_BASE + (sectorNum << gFlash->sector.shift);
|
tgt = FLASH_BASE + (sectorNum << gFlash->sector.shift);
|
||||||
|
|
||||||
|
@ -1297,13 +1297,13 @@ const u8 *GetApprenticeNameInLanguage(u32 apprenticeId, s32 language)
|
|||||||
// Functionally unused
|
// Functionally unused
|
||||||
static void Task_SwitchToFollowupFuncAfterButtonPress(u8 taskId)
|
static void Task_SwitchToFollowupFuncAfterButtonPress(u8 taskId)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
|
||||||
SwitchTaskToFollowupFunc(taskId);
|
SwitchTaskToFollowupFunc(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_ExecuteFuncAfterButtonPress(u8 taskId)
|
static void Task_ExecuteFuncAfterButtonPress(u8 taskId)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
gApprenticeFunc = (void*)(u32)(((u16)gTasks[taskId].data[0] | (gTasks[taskId].data[1] << 16)));
|
gApprenticeFunc = (void*)(u32)(((u16)gTasks[taskId].data[0] | (gTasks[taskId].data[1] << 16)));
|
||||||
gApprenticeFunc();
|
gApprenticeFunc();
|
||||||
|
@ -1299,7 +1299,7 @@ static void Cmd_count_usable_party_mons(void)
|
|||||||
|
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||||
{
|
{
|
||||||
u8 position;
|
u32 position;
|
||||||
battlerOnField1 = gBattlerPartyIndexes[battlerId];
|
battlerOnField1 = gBattlerPartyIndexes[battlerId];
|
||||||
position = GetBattlerPosition(battlerId) ^ BIT_FLANK;
|
position = GetBattlerPosition(battlerId) ^ BIT_FLANK;
|
||||||
battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(position)];
|
battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(position)];
|
||||||
|
@ -372,20 +372,28 @@ static void AnimTranslateStinger(struct Sprite *sprite)
|
|||||||
{
|
{
|
||||||
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
|
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
|
||||||
}
|
}
|
||||||
else if (GetBattlerSide(gBattleAnimAttacker))
|
else
|
||||||
|
{
|
||||||
|
if (GetBattlerSide(gBattleAnimAttacker))
|
||||||
{
|
{
|
||||||
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
|
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
|
||||||
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
|
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
|
||||||
gBattleAnimArgs[3] = -gBattleAnimArgs[3];
|
gBattleAnimArgs[3] = -gBattleAnimArgs[3];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsContest() && GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget))
|
if (!IsContest() && GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget))
|
||||||
{
|
{
|
||||||
if (GetBattlerPosition(gBattleAnimTarget) == B_POSITION_PLAYER_LEFT
|
if (GetBattlerPosition(gBattleAnimTarget) == B_POSITION_PLAYER_LEFT
|
||||||
|| GetBattlerPosition(gBattleAnimTarget) == B_POSITION_OPPONENT_LEFT)
|
|| GetBattlerPosition(gBattleAnimTarget) == B_POSITION_OPPONENT_LEFT)
|
||||||
{
|
{
|
||||||
gBattleAnimArgs[2] *= -1;
|
s16 temp1, temp2;
|
||||||
gBattleAnimArgs[0] *= -1;
|
|
||||||
|
temp1 = gBattleAnimArgs[2];
|
||||||
|
gBattleAnimArgs[2] = -temp1;
|
||||||
|
|
||||||
|
temp2 = gBattleAnimArgs[0];
|
||||||
|
gBattleAnimArgs[0] = -temp2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,24 +448,28 @@ static void AnimMissileArc_Step(struct Sprite *sprite)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
s16 tempData[8];
|
s16 tempData[8];
|
||||||
s16 xpos, ypos;
|
u16 *data = sprite->data;
|
||||||
|
u16 x1 = sprite->pos1.x;
|
||||||
|
s16 x2 = sprite->pos2.x;
|
||||||
|
u16 y1 = sprite->pos1.y;
|
||||||
|
s16 y2 = sprite->pos2.y;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
tempData[i] = sprite->data[i];
|
tempData[i] = data[i];
|
||||||
|
|
||||||
xpos = sprite->pos1.x + sprite->pos2.x;
|
x2 += x1;
|
||||||
ypos = sprite->pos1.y + sprite->pos2.y;
|
y2 += y1;
|
||||||
|
|
||||||
if (!TranslateAnimHorizontalArc(sprite))
|
if (!TranslateAnimHorizontalArc(sprite))
|
||||||
{
|
{
|
||||||
u16 rotation = ArcTan2Neg(sprite->pos1.x + sprite->pos2.x - xpos, //Isn't this zero lol
|
u16 rotation = ArcTan2Neg(sprite->pos1.x + sprite->pos2.x - x2,
|
||||||
sprite->pos1.y + sprite->pos2.y - ypos);
|
sprite->pos1.y + sprite->pos2.y - y2);
|
||||||
rotation += 0xC000;
|
rotation += 0xC000;
|
||||||
TrySetSpriteRotScale(sprite, FALSE, 0x100, 0x100, rotation);
|
TrySetSpriteRotScale(sprite, FALSE, 0x100, 0x100, rotation);
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
sprite->data[i] = tempData[i];
|
data[i] = tempData[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -635,6 +635,8 @@ void AnimTask_MoveTargetMementoShadow(u8 taskId)
|
|||||||
|
|
||||||
static void AnimTask_MoveTargetMementoShadow_Step(u8 taskId)
|
static void AnimTask_MoveTargetMementoShadow_Step(u8 taskId)
|
||||||
{
|
{
|
||||||
|
u8 pos;
|
||||||
|
u16 i;
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
|
|
||||||
switch (task->data[0])
|
switch (task->data[0])
|
||||||
|
@ -3967,20 +3967,19 @@ static void AnimProtect(struct Sprite* sprite)
|
|||||||
|
|
||||||
static void AnimProtect_Step(struct Sprite *sprite)
|
static void AnimProtect_Step(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
int i, savedPal;
|
int i, id, savedPal;
|
||||||
sprite->data[5] += 96;
|
sprite->data[5] += 96;
|
||||||
sprite->pos2.x = -(sprite->data[5] >> 8);
|
sprite->pos2.x = -(sprite->data[5] >> 8);
|
||||||
if (++sprite->data[1] > 1)
|
if (++sprite->data[1] > 1)
|
||||||
{
|
{
|
||||||
int id;
|
|
||||||
sprite->data[1] = 0;
|
sprite->data[1] = 0;
|
||||||
savedPal = gPlttBufferFaded[sprite->data[2] + 1];
|
savedPal = gPlttBufferFaded[sprite->data[2] + 1];
|
||||||
i = 0;
|
i = 0;
|
||||||
do
|
while (i < 6)
|
||||||
{
|
{
|
||||||
id = sprite->data[2] + ++i;
|
id = sprite->data[2] + ++i;
|
||||||
gPlttBufferFaded[id] = gPlttBufferFaded[id + 1];
|
gPlttBufferFaded[id] = gPlttBufferFaded[id + 1];
|
||||||
} while (i < 6);
|
}
|
||||||
|
|
||||||
gPlttBufferFaded[sprite->data[2] + 7] = savedPal;
|
gPlttBufferFaded[sprite->data[2] + 7] = savedPal;
|
||||||
}
|
}
|
||||||
|
@ -5003,11 +5003,11 @@ void AnimTask_GetReturnPowerLevel(u8 taskId)
|
|||||||
void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
||||||
{
|
{
|
||||||
u8 spriteId, spriteId2;
|
u8 spriteId, spriteId2;
|
||||||
u32 personality;
|
int personality;
|
||||||
u32 otId;
|
int otId;
|
||||||
u16 species;
|
u16 species;
|
||||||
u8 subpriority;
|
u8 subpriority;
|
||||||
bool8 isBackPic;
|
u8 isBackPic;
|
||||||
s16 x;
|
s16 x;
|
||||||
|
|
||||||
switch (gTasks[taskId].data[0])
|
switch (gTasks[taskId].data[0])
|
||||||
@ -5035,10 +5035,12 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
|||||||
otId = gContestResources->moveAnim->otId;
|
otId = gContestResources->moveAnim->otId;
|
||||||
species = gContestResources->moveAnim->species;
|
species = gContestResources->moveAnim->species;
|
||||||
subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker);
|
subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker);
|
||||||
isBackPic = FALSE;
|
isBackPic = 0;
|
||||||
x = -32;
|
x = -32;
|
||||||
}
|
}
|
||||||
else if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
else
|
||||||
|
{
|
||||||
|
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
||||||
{
|
{
|
||||||
personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_PERSONALITY);
|
personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_PERSONALITY);
|
||||||
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_OT_ID);
|
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_OT_ID);
|
||||||
@ -5048,7 +5050,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
|||||||
species = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies;
|
species = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies;
|
||||||
|
|
||||||
subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority + 1;
|
subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority + 1;
|
||||||
isBackPic = FALSE;
|
isBackPic = 0;
|
||||||
x = 272;
|
x = 272;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -5061,9 +5063,10 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
|||||||
species = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies;
|
species = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies;
|
||||||
|
|
||||||
subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority - 1;
|
subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority - 1;
|
||||||
isBackPic = TRUE;
|
isBackPic = 1;
|
||||||
x = -32;
|
x = -32;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
spriteId2 = sub_80A8394(species, isBackPic, 0, x, GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y), subpriority, personality, otId, gBattleAnimAttacker, 0);
|
spriteId2 = sub_80A8394(species, isBackPic, 0, x, GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y), subpriority, personality, otId, gBattleAnimAttacker, 0);
|
||||||
if (gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies != SPECIES_NONE)
|
if (gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies != SPECIES_NONE)
|
||||||
@ -5089,7 +5092,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
|||||||
if (x < GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X))
|
if (x < GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X))
|
||||||
{
|
{
|
||||||
gTasks[taskId].data[14]++;
|
gTasks[taskId].data[14]++;
|
||||||
gBattleAnimArgs[7] = -1;
|
gBattleAnimArgs[7] = 0xFFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -5097,7 +5100,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
|||||||
if (x > GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X))
|
if (x > GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X))
|
||||||
{
|
{
|
||||||
gTasks[taskId].data[14]++;
|
gTasks[taskId].data[14]++;
|
||||||
gBattleAnimArgs[7] = -1;
|
gBattleAnimArgs[7] = 0xFFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5135,7 +5138,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
|||||||
gSprites[spriteId].pos2.x = 0;
|
gSprites[spriteId].pos2.x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
gTasks[taskId].data[1] &= 0xFF;
|
gTasks[taskId].data[1] = (u8)gTasks[taskId].data[1];
|
||||||
if (gSprites[spriteId].pos2.x == 0)
|
if (gSprites[spriteId].pos2.x == 0)
|
||||||
DestroyAnimVisualTask(taskId);
|
DestroyAnimVisualTask(taskId);
|
||||||
break;
|
break;
|
||||||
|
@ -380,18 +380,21 @@ static void AnimTask_AnimateGustTornadoPalette_Step(u8 taskId)
|
|||||||
{
|
{
|
||||||
u8 data2;
|
u8 data2;
|
||||||
u16 temp;
|
u16 temp;
|
||||||
|
int i, base;
|
||||||
|
|
||||||
if (gTasks[taskId].data[10]++ == gTasks[taskId].data[1])
|
if (gTasks[taskId].data[10]++ == gTasks[taskId].data[1])
|
||||||
{
|
{
|
||||||
int i, base;
|
|
||||||
gTasks[taskId].data[10] = 0;
|
gTasks[taskId].data[10] = 0;
|
||||||
data2 = gTasks[taskId].data[2];
|
data2 = gTasks[taskId].data[2];
|
||||||
temp = gPlttBufferFaded[16 * data2 + 0x108];
|
temp = gPlttBufferFaded[16 * data2 + 0x108];
|
||||||
i = 7;
|
i = 7;
|
||||||
base = data2 * 16;
|
base = data2 * 16;
|
||||||
|
|
||||||
for (; i > 0; --i)
|
do
|
||||||
|
{
|
||||||
gPlttBufferFaded[base + 0x101 + i] = gPlttBufferFaded[base + 0x100 + i];
|
gPlttBufferFaded[base + 0x101 + i] = gPlttBufferFaded[base + 0x100 + i];
|
||||||
|
i--;
|
||||||
|
} while (i > 0);
|
||||||
|
|
||||||
gPlttBufferFaded[base + 0x101] = temp;
|
gPlttBufferFaded[base + 0x101] = temp;
|
||||||
}
|
}
|
||||||
@ -533,8 +536,8 @@ static void AnimFlyBallAttack_Step(struct Sprite *sprite)
|
|||||||
|
|
||||||
void DestroyAnimSpriteAfterTimer(struct Sprite *sprite)
|
void DestroyAnimSpriteAfterTimer(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
if (sprite->data[0]-- > 0)
|
if (sprite->data[0]-- <= 0)
|
||||||
return;
|
{
|
||||||
if (sprite->oam.affineMode & ST_OAM_AFFINE_ON_MASK)
|
if (sprite->oam.affineMode & ST_OAM_AFFINE_ON_MASK)
|
||||||
{
|
{
|
||||||
FreeOamMatrix(sprite->oam.matrixNum);
|
FreeOamMatrix(sprite->oam.matrixNum);
|
||||||
@ -544,6 +547,7 @@ void DestroyAnimSpriteAfterTimer(struct Sprite *sprite)
|
|||||||
DestroySprite(sprite);
|
DestroySprite(sprite);
|
||||||
gAnimVisualTaskCount--;
|
gAnimVisualTaskCount--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct FeatherDanceData
|
struct FeatherDanceData
|
||||||
{
|
{
|
||||||
@ -563,41 +567,35 @@ struct FeatherDanceData
|
|||||||
u16 unkE_1:15;
|
u16 unkE_1:15;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ANIM_SWITCH(sprite) \
|
|
||||||
{ \
|
|
||||||
(sprite)->hFlip ^= 1; \
|
|
||||||
(sprite)->animNum = (sprite)->hFlip; \
|
|
||||||
(sprite)->animBeginning = TRUE; \
|
|
||||||
(sprite)->animEnded = FALSE; \
|
|
||||||
}
|
|
||||||
|
|
||||||
static void AnimFallingFeather(struct Sprite *sprite)
|
static void AnimFallingFeather(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
u8 battler, sinIndex;
|
u8 battler, matrixNum, sinIndex;
|
||||||
u32 matrixNum;
|
s16 spriteCoord, sinVal;
|
||||||
s16 sinVal;
|
|
||||||
|
|
||||||
struct FeatherDanceData *data = (struct FeatherDanceData *)sprite->data;
|
struct FeatherDanceData *data = (struct FeatherDanceData *)sprite->data;
|
||||||
|
|
||||||
battler = (gBattleAnimArgs[7] & 0x100) ? gBattleAnimAttacker : gBattleAnimTarget;
|
if (gBattleAnimArgs[7] & 0x100)
|
||||||
|
battler = gBattleAnimAttacker;
|
||||||
|
else
|
||||||
|
battler = gBattleAnimTarget;
|
||||||
|
|
||||||
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
|
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
|
||||||
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
|
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
|
||||||
|
|
||||||
sprite->pos1.x = GetBattlerSpriteCoord(battler, BATTLER_COORD_ATTR_HEIGHT) + gBattleAnimArgs[0];
|
sprite->pos1.x = GetBattlerSpriteCoord(battler, BATTLER_COORD_ATTR_HEIGHT) + gBattleAnimArgs[0];
|
||||||
sinVal = GetBattlerSpriteCoord(battler, BATTLER_COORD_ATTR_WIDTH);
|
spriteCoord = GetBattlerSpriteCoord(battler, BATTLER_COORD_ATTR_WIDTH);
|
||||||
sprite->pos1.y = sinVal + gBattleAnimArgs[1];
|
sprite->pos1.y = spriteCoord + gBattleAnimArgs[1];
|
||||||
|
|
||||||
data->unk8 = (u16)(sprite->pos1.y) << 8;
|
data->unk8 = sprite->pos1.y << 8;
|
||||||
data->unkE_1 = (u16)(sinVal + gBattleAnimArgs[6]);
|
data->unkE_1 = spriteCoord + gBattleAnimArgs[6];
|
||||||
data->unk0_0c = 1;
|
data->unk0_0c = 1;
|
||||||
data->unk2 = (u16)(gBattleAnimArgs[2] & 0xFF);
|
data->unk2 = gBattleAnimArgs[2] & 0xFF;
|
||||||
data->unkA = (u16)gBattleAnimArgs[2] >> 8;
|
data->unkA = (gBattleAnimArgs[2] >> 8) & 0xFF;
|
||||||
data->unk4 = gBattleAnimArgs[3];
|
data->unk4 = gBattleAnimArgs[3];
|
||||||
data->unk6 = (u16)gBattleAnimArgs[4];
|
data->unk6 = gBattleAnimArgs[4];
|
||||||
*(u16 *)(data->unkC) = (u16)gBattleAnimArgs[5];
|
*(u16*)(data->unkC) = gBattleAnimArgs[5];
|
||||||
|
|
||||||
if (data->unk2 >= 64 && data->unk2 < 192)
|
if (data->unk2 >= 64 && data->unk2 <= 191)
|
||||||
{
|
{
|
||||||
if (!IsContest())
|
if (!IsContest())
|
||||||
sprite->oam.priority = GetBattlerSpriteBGPriority(battler) + 1;
|
sprite->oam.priority = GetBattlerSpriteBGPriority(battler) + 1;
|
||||||
@ -608,7 +606,11 @@ static void AnimFallingFeather(struct Sprite *sprite)
|
|||||||
|
|
||||||
if (!(data->unk4 & 0x8000))
|
if (!(data->unk4 & 0x8000))
|
||||||
{
|
{
|
||||||
ANIM_SWITCH(sprite);
|
sprite->hFlip ^= 1;
|
||||||
|
sprite->animNum = sprite->hFlip;
|
||||||
|
|
||||||
|
sprite->animBeginning = 1;
|
||||||
|
sprite->animEnded = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -618,28 +620,42 @@ static void AnimFallingFeather(struct Sprite *sprite)
|
|||||||
|
|
||||||
if (data->unk4 & 0x8000)
|
if (data->unk4 & 0x8000)
|
||||||
{
|
{
|
||||||
ANIM_SWITCH(sprite);
|
sprite->hFlip ^= 1;
|
||||||
|
sprite->animNum = sprite->hFlip;
|
||||||
|
|
||||||
|
sprite->animBeginning = 1;
|
||||||
|
sprite->animEnded = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data->unk0_1 = data->unk2 / 64;
|
data->unk0_1 = data->unk2 >> 6;
|
||||||
sprite->pos2.x = (gSineTable[data->unk2] * (s32)data->unkC[0]) >> 8;
|
sprite->pos2.x = (gSineTable[data->unk2] * data->unkC[0]) >> 8;
|
||||||
matrixNum = sprite->oam.matrixNum;
|
matrixNum = sprite->oam.matrixNum;
|
||||||
|
|
||||||
sinIndex = (-sprite->pos2.x >> 1) + data->unkA;
|
sinIndex = (-sprite->pos2.x >> 1) + data->unkA;
|
||||||
sinVal = gSineTable[sinIndex];
|
sinVal = gSineTable[sinIndex];
|
||||||
|
|
||||||
gOamMatrices[matrixNum].a = gOamMatrices[matrixNum].d = gSineTable[sinIndex + 64];
|
gOamMatrices[matrixNum].a = gOamMatrices[matrixNum].d = gSineTable[sinIndex + 64];
|
||||||
|
// The comparison below is completely pointless. 'sprite' is sure to be a valid pointer and
|
||||||
|
// both the 'if' and 'else' parts are exactly the same.
|
||||||
|
// The only reason for this is making sure the compiler generates the exact ASM.
|
||||||
|
if (sprite)
|
||||||
|
{
|
||||||
gOamMatrices[matrixNum].b = sinVal;
|
gOamMatrices[matrixNum].b = sinVal;
|
||||||
gOamMatrices[matrixNum].c = -sinVal;
|
gOamMatrices[matrixNum].c = -sinVal;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gOamMatrices[matrixNum].b = sinVal;
|
||||||
|
gOamMatrices[matrixNum].c = -sinVal;
|
||||||
|
}
|
||||||
|
|
||||||
sprite->callback = sub_810E520;
|
sprite->callback = sub_810E520;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_810E520(struct Sprite *sprite)
|
static void sub_810E520(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
u8 sinIndex;
|
u8 matrixNum, sinIndex;
|
||||||
u32 matrixNum;
|
|
||||||
s16 sinVal = 0;
|
s16 sinVal = 0;
|
||||||
struct FeatherDanceData *data = (struct FeatherDanceData *)sprite->data;
|
struct FeatherDanceData *data = (struct FeatherDanceData *)sprite->data;
|
||||||
if (data->unk0_0a)
|
if (data->unk0_0a)
|
||||||
@ -649,19 +665,19 @@ static void sub_810E520(struct Sprite *sprite)
|
|||||||
data->unk0_0a = 0;
|
data->unk0_0a = 0;
|
||||||
data->unk1 = 0;
|
data->unk1 = 0;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
switch (data->unk2 / 64)
|
switch (data->unk2 / 64)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if ((u8)data->unk0_1 == 1) // this must be cast to u8
|
if (data->unk0_1 << 24 >> 24 == 1) // the shifts have to be here
|
||||||
{
|
{
|
||||||
data->unk0_0d = 1;
|
data->unk0_0d = 1;
|
||||||
data->unk0_0a = 1;
|
data->unk0_0a = 1;
|
||||||
data->unk1 = 0;
|
data->unk1 = 0;
|
||||||
}
|
}
|
||||||
else if ((u8)data->unk0_1 == 3)
|
else if (data->unk0_1 << 24 >> 24 == 3)
|
||||||
{
|
{
|
||||||
data->unk0_0b ^= 1;
|
data->unk0_0b ^= 1;
|
||||||
data->unk0_0a = 1;
|
data->unk0_0a = 1;
|
||||||
@ -669,7 +685,10 @@ static void sub_810E520(struct Sprite *sprite)
|
|||||||
}
|
}
|
||||||
else if (data->unk0_0d)
|
else if (data->unk0_0d)
|
||||||
{
|
{
|
||||||
ANIM_SWITCH(sprite);
|
sprite->hFlip ^= 1;
|
||||||
|
sprite->animNum = sprite->hFlip;
|
||||||
|
sprite->animBeginning = TRUE;
|
||||||
|
sprite->animEnded = FALSE;
|
||||||
if (data->unk0_0c)
|
if (data->unk0_0c)
|
||||||
{
|
{
|
||||||
if (!IsContest())
|
if (!IsContest())
|
||||||
@ -700,24 +719,28 @@ static void sub_810E520(struct Sprite *sprite)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
data->unk0_0d = 0;
|
data->unk0_0d = 0;
|
||||||
|
data->unk2;
|
||||||
}
|
}
|
||||||
data->unk0_1 = 0;
|
data->unk0_1 = 0;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if ((u8)data->unk0_1 == 0)
|
if (data->unk0_1 << 24 >> 24 == 0)
|
||||||
{
|
{
|
||||||
data->unk0_0d = 1;
|
data->unk0_0d = 1;
|
||||||
data->unk0_0a = 1;
|
data->unk0_0a = 1;
|
||||||
data->unk1 = 0;
|
data->unk1 = 0;
|
||||||
}
|
}
|
||||||
else if ((u8)data->unk0_1 == 2)
|
else if (data->unk0_1 << 24 >> 24 == 2)
|
||||||
{
|
{
|
||||||
data->unk0_0a = 1;
|
data->unk0_0a = 1;
|
||||||
data->unk1 = 0;
|
data->unk1 = 0;
|
||||||
}
|
}
|
||||||
else if (data->unk0_0d)
|
else if (data->unk0_0d)
|
||||||
{
|
{
|
||||||
ANIM_SWITCH(sprite);
|
sprite->hFlip ^= 1;
|
||||||
|
sprite->animNum = sprite->hFlip;
|
||||||
|
sprite->animBeginning = TRUE;
|
||||||
|
sprite->animEnded = FALSE;
|
||||||
if (data->unk0_0c)
|
if (data->unk0_0c)
|
||||||
{
|
{
|
||||||
if (!IsContest())
|
if (!IsContest())
|
||||||
@ -752,20 +775,23 @@ static void sub_810E520(struct Sprite *sprite)
|
|||||||
data->unk0_1 = 1;
|
data->unk0_1 = 1;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if ((u8)data->unk0_1 == 3)
|
if (data->unk0_1 << 24 >> 24 == 3)
|
||||||
{
|
{
|
||||||
data->unk0_0d = 1;
|
data->unk0_0d = 1;
|
||||||
data->unk0_0a = 1;
|
data->unk0_0a = 1;
|
||||||
data->unk1 = 0;
|
data->unk1 = 0;
|
||||||
}
|
}
|
||||||
else if ((u8)data->unk0_1 == 1)
|
else if (data->unk0_1 << 24 >> 24 == 1)
|
||||||
{
|
{
|
||||||
data->unk0_0a = 1;
|
data->unk0_0a = 1;
|
||||||
data->unk1 = 0;
|
data->unk1 = 0;
|
||||||
}
|
}
|
||||||
else if (data->unk0_0d)
|
else if (data->unk0_0d)
|
||||||
{
|
{
|
||||||
ANIM_SWITCH(sprite);
|
sprite->hFlip ^= 1;
|
||||||
|
sprite->animNum = sprite->hFlip;
|
||||||
|
sprite->animBeginning = TRUE;
|
||||||
|
sprite->animEnded = FALSE;
|
||||||
if (data->unk0_0c)
|
if (data->unk0_0c)
|
||||||
{
|
{
|
||||||
if (!IsContest())
|
if (!IsContest())
|
||||||
@ -800,11 +826,11 @@ static void sub_810E520(struct Sprite *sprite)
|
|||||||
data->unk0_1 = 2;
|
data->unk0_1 = 2;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if ((u8)data->unk0_1 == 2)
|
if (data->unk0_1 << 24 >> 24 == 2)
|
||||||
{
|
{
|
||||||
data->unk0_0d = 1;
|
data->unk0_0d = 1;
|
||||||
}
|
}
|
||||||
else if ((u8)data->unk0_1 == 0)
|
else if (data->unk0_1 << 24 >> 24 == 0)
|
||||||
{
|
{
|
||||||
data->unk0_0b ^= 1;
|
data->unk0_0b ^= 1;
|
||||||
data->unk0_0a = 1;
|
data->unk0_0a = 1;
|
||||||
@ -812,7 +838,10 @@ static void sub_810E520(struct Sprite *sprite)
|
|||||||
}
|
}
|
||||||
else if (data->unk0_0d)
|
else if (data->unk0_0d)
|
||||||
{
|
{
|
||||||
ANIM_SWITCH(sprite);
|
sprite->hFlip ^= 1;
|
||||||
|
sprite->animNum = sprite->hFlip;
|
||||||
|
sprite->animBeginning = TRUE;
|
||||||
|
sprite->animEnded = FALSE;
|
||||||
if (data->unk0_0c)
|
if (data->unk0_0c)
|
||||||
{
|
{
|
||||||
if (!IsContest())
|
if (!IsContest())
|
||||||
@ -847,11 +876,13 @@ static void sub_810E520(struct Sprite *sprite)
|
|||||||
data->unk0_1 = 3;
|
data->unk0_1 = 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifndef NONMATCHING
|
||||||
sprite->pos2.x = ((s32)(data->unkC[data->unk0_0b]) * gSineTable[data->unk2]) >> 8;
|
asm("":::"r8");
|
||||||
|
#endif
|
||||||
|
sprite->pos2.x = (data->unkC[data->unk0_0b] * gSineTable[data->unk2]) >> 8;
|
||||||
matrixNum = sprite->oam.matrixNum;
|
matrixNum = sprite->oam.matrixNum;
|
||||||
|
|
||||||
sinIndex = ((-sprite->pos2.x >> 1) + data->unkA);
|
sinIndex = (-sprite->pos2.x >> 1) + data->unkA;
|
||||||
sinVal = gSineTable[sinIndex];
|
sinVal = gSineTable[sinIndex];
|
||||||
|
|
||||||
gOamMatrices[matrixNum].a = gOamMatrices[matrixNum].d = gSineTable[sinIndex + 64];
|
gOamMatrices[matrixNum].a = gOamMatrices[matrixNum].d = gSineTable[sinIndex + 64];
|
||||||
@ -859,7 +890,7 @@ static void sub_810E520(struct Sprite *sprite)
|
|||||||
gOamMatrices[matrixNum].c = -sinVal;
|
gOamMatrices[matrixNum].c = -sinVal;
|
||||||
|
|
||||||
data->unk8 += data->unk6;
|
data->unk8 += data->unk6;
|
||||||
sprite->pos1.y = (s16)(data->unk8 >> 8);
|
sprite->pos1.y = data->unk8 >> 8;
|
||||||
if (data->unk4 & 0x8000)
|
if (data->unk4 & 0x8000)
|
||||||
data->unk2 = (data->unk2 - (data->unk4 & 0x7FFF)) & 0xFF;
|
data->unk2 = (data->unk2 - (data->unk4 & 0x7FFF)) & 0xFF;
|
||||||
else
|
else
|
||||||
@ -871,6 +902,7 @@ static void sub_810E520(struct Sprite *sprite)
|
|||||||
sprite->callback = DestroyAnimSpriteAfterTimer;
|
sprite->callback = DestroyAnimSpriteAfterTimer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void sub_810EA4C(struct Sprite *sprite)
|
static void sub_810EA4C(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
@ -912,20 +944,20 @@ static void sub_810EB40(struct Sprite *sprite)
|
|||||||
{
|
{
|
||||||
sprite->pos2.x += sprite->data[1] >> 8;
|
sprite->pos2.x += sprite->data[1] >> 8;
|
||||||
|
|
||||||
if (sprite->data[0]++ == 5)
|
if (++sprite->data[0] == 6)
|
||||||
{
|
{
|
||||||
sprite->data[0] = 0;
|
sprite->data[0] = 0;
|
||||||
sprite->pos2.x = 0;
|
sprite->pos2.x = 0;
|
||||||
StartSpriteAnim(sprite, 0);
|
StartSpriteAnim(sprite, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sprite->data[7]-- == 0)
|
if (--sprite->data[7] == -1)
|
||||||
DestroyAnimSprite(sprite);
|
DestroyAnimSprite(sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimTask_DrillPeckHitSplats(u8 task)
|
void AnimTask_DrillPeckHitSplats(u8 task)
|
||||||
{
|
{
|
||||||
if ((gTasks[task].data[0] % 32) == 0)
|
if (!(gTasks[task].data[0] % 32))
|
||||||
{
|
{
|
||||||
gAnimVisualTaskCount++;
|
gAnimVisualTaskCount++;
|
||||||
|
|
||||||
@ -1028,8 +1060,8 @@ static void AnimDiveBall_Step2(struct Sprite *sprite)
|
|||||||
|
|
||||||
static void AnimDiveWaterSplash(struct Sprite *sprite)
|
static void AnimDiveWaterSplash(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
u8 matrixNum;
|
u32 matrixNum;
|
||||||
s32 t1, t2;
|
int t1, t2;
|
||||||
|
|
||||||
switch (sprite->data[0])
|
switch (sprite->data[0])
|
||||||
{
|
{
|
||||||
@ -1051,7 +1083,7 @@ static void AnimDiveWaterSplash(struct Sprite *sprite)
|
|||||||
sprite->data[0]++;
|
sprite->data[0]++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (sprite->data[2] < 12)
|
if (sprite->data[2] <= 11)
|
||||||
sprite->data[1] -= 40;
|
sprite->data[1] -= 40;
|
||||||
else
|
else
|
||||||
sprite->data[1] += 40;
|
sprite->data[1] += 40;
|
||||||
@ -1083,8 +1115,8 @@ static void AnimDiveWaterSplash(struct Sprite *sprite)
|
|||||||
// Launches a water droplet away from the specified battler. Used by Astonish and Dive
|
// Launches a water droplet away from the specified battler. Used by Astonish and Dive
|
||||||
static void AnimSprayWaterDroplet(struct Sprite *sprite)
|
static void AnimSprayWaterDroplet(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
const u16 v1 = Random2() & 0x1ff;
|
int v1 = 0x1ff & Random2();
|
||||||
const u16 v2 = Random2() & 0x07f;
|
int v2 = 0x7f & Random2();
|
||||||
|
|
||||||
if (v1 % 2)
|
if (v1 % 2)
|
||||||
sprite->data[0] = 736 + v1;
|
sprite->data[0] = 736 + v1;
|
||||||
@ -1128,13 +1160,13 @@ static void AnimSprayWaterDroplet_Step(struct Sprite *sprite)
|
|||||||
sprite->pos2.y -= sprite->data[1] >> 8;
|
sprite->pos2.y -= sprite->data[1] >> 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprite->data[0] -= 0; // Needed to Match
|
sprite->data[0] = sprite->data[0];
|
||||||
sprite->data[1] -= 32;
|
sprite->data[1] -= 32;
|
||||||
|
|
||||||
if (sprite->data[0] < 0)
|
if (sprite->data[0] < 0)
|
||||||
sprite->data[0] = 0;
|
sprite->data[0] = 0;
|
||||||
|
|
||||||
if (sprite->data[3]++ == 30)
|
if (++sprite->data[3] == 31)
|
||||||
DestroyAnimSprite(sprite);
|
DestroyAnimSprite(sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1180,7 +1212,7 @@ static void AnimSkyAttackBird(struct Sprite *sprite)
|
|||||||
sprite->data[7] = ((posy - sprite->pos1.y) << 4) / 12;
|
sprite->data[7] = ((posy - sprite->pos1.y) << 4) / 12;
|
||||||
|
|
||||||
rotation = ArcTan2Neg(posx - sprite->pos1.x, posy - sprite->pos1.y);
|
rotation = ArcTan2Neg(posx - sprite->pos1.x, posy - sprite->pos1.y);
|
||||||
rotation -= 16384;
|
rotation += 49152;
|
||||||
|
|
||||||
TrySetSpriteRotScale(sprite, 1, 0x100, 0x100, rotation);
|
TrySetSpriteRotScale(sprite, 1, 0x100, 0x100, rotation);
|
||||||
|
|
||||||
@ -1204,12 +1236,12 @@ void unref_sub_810F184(u8 taskId)
|
|||||||
{
|
{
|
||||||
if (gBattleAnimArgs[0] == 0)
|
if (gBattleAnimArgs[0] == 0)
|
||||||
{
|
{
|
||||||
const u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
||||||
gSprites[spriteId].invisible = TRUE;
|
gSprites[spriteId].invisible = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
||||||
gSprites[spriteId].invisible = FALSE;
|
gSprites[spriteId].invisible = FALSE;
|
||||||
}
|
}
|
||||||
DestroyAnimVisualTask(taskId);
|
DestroyAnimVisualTask(taskId);
|
||||||
|
@ -1101,7 +1101,7 @@ static void AnimTask_TransparentCloneGrowAndShrink_Step(u8 taskId)
|
|||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
task->data[1] -= 4;
|
task->data[1] -= 4;
|
||||||
task->data[2] = 256 - (gSineTable[task->data[1]] >> 1);
|
task->data[2] = 256 - (gSineTable[task->data[1]] >> 1);;
|
||||||
SetSpriteRotScale(task->data[15], task->data[2], task->data[2], 0);
|
SetSpriteRotScale(task->data[15], task->data[2], task->data[2], 0);
|
||||||
SetBattlerSpriteYOffsetFromOtherYScale(task->data[15], task->data[13]);
|
SetBattlerSpriteYOffsetFromOtherYScale(task->data[15], task->data[13]);
|
||||||
if (task->data[1] == 0)
|
if (task->data[1] == 0)
|
||||||
|
@ -569,7 +569,7 @@ static void sub_81172EC(u8 taskId)
|
|||||||
if (gTasks[taskId].data[12] == 0)
|
if (gTasks[taskId].data[12] == 0)
|
||||||
{
|
{
|
||||||
sub_80A477C(0);
|
sub_80A477C(0);
|
||||||
gTasks[taskId].data[15]++;
|
gTasks[taskId].data[15]++;;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -52,7 +52,7 @@ static void CreateWaterSpoutLaunchDroplets(struct Task*, u8);
|
|||||||
static void CreateWaterSpoutRainDroplet(struct Task*, u8);
|
static void CreateWaterSpoutRainDroplet(struct Task*, u8);
|
||||||
static void AnimTask_WaterSport_Step(u8);
|
static void AnimTask_WaterSport_Step(u8);
|
||||||
static void CreateWaterSportDroplet(struct Task*);
|
static void CreateWaterSportDroplet(struct Task*);
|
||||||
static void CreateWaterPulseRingBubbles(struct Sprite*, s32, s32);
|
static void CreateWaterPulseRingBubbles(struct Sprite*, int, int);
|
||||||
|
|
||||||
// Both unused
|
// Both unused
|
||||||
const u8 gUnknown_8593C80[] = INCBIN_U8("graphics/unknown/unknown_593C80.4bpp");
|
const u8 gUnknown_8593C80[] = INCBIN_U8("graphics/unknown/unknown_593C80.4bpp");
|
||||||
@ -624,24 +624,98 @@ void AnimTask_RotateAuroraRingColors(u8 taskId)
|
|||||||
gTasks[taskId].func = AnimTask_RotateAuroraRingColors_Step;
|
gTasks[taskId].func = AnimTask_RotateAuroraRingColors_Step;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NONMATCHING
|
||||||
static void AnimTask_RotateAuroraRingColors_Step(u8 taskId)
|
static void AnimTask_RotateAuroraRingColors_Step(u8 taskId)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
u16 palIndex;
|
u16 palIndex;
|
||||||
|
u16 *palPtr1;
|
||||||
|
u16 *palPtr2;
|
||||||
|
u16 rgbBuffer;
|
||||||
|
|
||||||
if (++gTasks[taskId].data[10] == 3)
|
if (++gTasks[taskId].data[10] == 3)
|
||||||
{
|
{
|
||||||
u16 tempPlt;
|
|
||||||
gTasks[taskId].data[10] = 0;
|
gTasks[taskId].data[10] = 0;
|
||||||
palIndex = gTasks[taskId].data[2] + 1;
|
palIndex = gTasks[taskId].data[2] + 1;
|
||||||
tempPlt = gPlttBufferFaded[palIndex];
|
palPtr1 = &gPlttBufferFaded[palIndex];
|
||||||
for (i = 1; i < 8; i++)
|
rgbBuffer = *palPtr1;
|
||||||
gPlttBufferFaded[palIndex + i - 1] = gPlttBufferFaded[palIndex + i];
|
palPtr2 = &palPtr1[1];
|
||||||
gPlttBufferFaded[palIndex + 7] = tempPlt;
|
for (i = 0; i < 7; i++)
|
||||||
|
palPtr1[i] = palPtr2[i];
|
||||||
|
gPlttBufferFaded[palIndex + 7] = rgbBuffer;
|
||||||
}
|
}
|
||||||
if (++gTasks[taskId].data[11] == gTasks[taskId].data[0])
|
if (++gTasks[taskId].data[11] == gTasks[taskId].data[0])
|
||||||
DestroyAnimVisualTask(taskId);
|
DestroyAnimVisualTask(taskId);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
static void AnimTask_RotateAuroraRingColors_Step(u8 taskId)
|
||||||
|
{
|
||||||
|
asm_unified("push {r4-r7,lr}\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r4, r0, 24\n\
|
||||||
|
ldr r1, =gTasks\n\
|
||||||
|
lsls r0, r4, 2\n\
|
||||||
|
adds r0, r4\n\
|
||||||
|
lsls r0, 3\n\
|
||||||
|
adds r2, r0, r1\n\
|
||||||
|
ldrh r0, [r2, 0x1C]\n\
|
||||||
|
adds r0, 0x1\n\
|
||||||
|
strh r0, [r2, 0x1C]\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
asrs r0, 16\n\
|
||||||
|
mov r12, r1\n\
|
||||||
|
cmp r0, 0x3\n\
|
||||||
|
bne _081075BE\n\
|
||||||
|
movs r0, 0\n\
|
||||||
|
strh r0, [r2, 0x1C]\n\
|
||||||
|
ldrh r0, [r2, 0xC]\n\
|
||||||
|
adds r0, 0x1\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r5, r0, 16\n\
|
||||||
|
ldr r1, =gPlttBufferFaded\n\
|
||||||
|
lsls r0, r5, 1\n\
|
||||||
|
adds r0, r1\n\
|
||||||
|
ldrh r6, [r0]\n\
|
||||||
|
adds r7, r1, 0\n\
|
||||||
|
adds r3, r0, 0x2\n\
|
||||||
|
movs r1, 0x6\n\
|
||||||
|
adds r2, r0, 0\n\
|
||||||
|
_081075A8:\n\
|
||||||
|
ldrh r0, [r3]\n\
|
||||||
|
strh r0, [r2]\n\
|
||||||
|
adds r3, 0x2\n\
|
||||||
|
adds r2, 0x2\n\
|
||||||
|
subs r1, 0x1\n\
|
||||||
|
cmp r1, 0\n\
|
||||||
|
bge _081075A8\n\
|
||||||
|
adds r0, r5, 0x7\n\
|
||||||
|
lsls r0, 1\n\
|
||||||
|
adds r0, r7\n\
|
||||||
|
strh r6, [r0]\n\
|
||||||
|
_081075BE:\n\
|
||||||
|
lsls r0, r4, 2\n\
|
||||||
|
adds r0, r4\n\
|
||||||
|
lsls r0, 3\n\
|
||||||
|
add r0, r12\n\
|
||||||
|
ldrh r1, [r0, 0x1E]\n\
|
||||||
|
adds r1, 0x1\n\
|
||||||
|
strh r1, [r0, 0x1E]\n\
|
||||||
|
lsls r1, 16\n\
|
||||||
|
asrs r1, 16\n\
|
||||||
|
movs r2, 0x8\n\
|
||||||
|
ldrsh r0, [r0, r2]\n\
|
||||||
|
cmp r1, r0\n\
|
||||||
|
bne _081075DE\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
bl DestroyAnimVisualTask\n\
|
||||||
|
_081075DE:\n\
|
||||||
|
pop {r4-r7}\n\
|
||||||
|
pop {r0}\n\
|
||||||
|
bx r0\n\
|
||||||
|
.pool\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// For animating undulating beam attacks (e.g. Flamethrower, Hydro Pump, Signal Beam)
|
// For animating undulating beam attacks (e.g. Flamethrower, Hydro Pump, Signal Beam)
|
||||||
static void AnimToTargetInSinWave(struct Sprite *sprite)
|
static void AnimToTargetInSinWave(struct Sprite *sprite)
|
||||||
@ -748,7 +822,6 @@ static void AnimHydroCannonBeam(struct Sprite *sprite)
|
|||||||
if (GetBattlerPosition(gBattleAnimAttacker) == B_POSITION_PLAYER_LEFT || GetBattlerPosition(gBattleAnimAttacker) == B_POSITION_OPPONENT_LEFT)
|
if (GetBattlerPosition(gBattleAnimAttacker) == B_POSITION_PLAYER_LEFT || GetBattlerPosition(gBattleAnimAttacker) == B_POSITION_OPPONENT_LEFT)
|
||||||
gBattleAnimArgs[0] *= -1;
|
gBattleAnimArgs[0] *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gBattleAnimArgs[5] & 0xFF00) == 0)
|
if ((gBattleAnimArgs[5] & 0xFF00) == 0)
|
||||||
animType = TRUE;
|
animType = TRUE;
|
||||||
else
|
else
|
||||||
@ -794,25 +867,21 @@ static void AnimSmallBubblePair_Step(struct Sprite *sprite)
|
|||||||
sprite->pos2.x = Sin(sprite->data[0], 4);
|
sprite->pos2.x = Sin(sprite->data[0], 4);
|
||||||
sprite->data[1] += 48;
|
sprite->data[1] += 48;
|
||||||
sprite->pos2.y = -(sprite->data[1] >> 8);
|
sprite->pos2.y = -(sprite->data[1] >> 8);
|
||||||
if (sprite->data[7]-- == 0)
|
if (--sprite->data[7] == -1)
|
||||||
DestroyAnimSprite(sprite);
|
DestroyAnimSprite(sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NONMATCHING
|
||||||
void AnimTask_CreateSurfWave(u8 taskId)
|
void AnimTask_CreateSurfWave(u8 taskId)
|
||||||
{
|
{
|
||||||
struct BattleAnimBgData animBg;
|
struct BattleAnimBgData animBg;
|
||||||
u8 taskId2;
|
u8 taskId2;
|
||||||
u16 *x, *y; //These pointers are needed to match
|
|
||||||
|
|
||||||
x = &gBattle_BG1_X;
|
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
|
||||||
y = &gBattle_BG1_Y;
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
|
||||||
|
|
||||||
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL | BLDCNT_TGT1_BG1);
|
|
||||||
SetGpuReg(REG_OFFSET_BLDALPHA, (16 << 8));
|
|
||||||
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
||||||
SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 1);
|
SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 1);
|
||||||
sub_80A6B30(&animBg);
|
sub_80A6B30(&animBg);
|
||||||
|
|
||||||
if (!IsContest())
|
if (!IsContest())
|
||||||
{
|
{
|
||||||
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1);
|
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1);
|
||||||
@ -837,30 +906,30 @@ void AnimTask_CreateSurfWave(u8 taskId)
|
|||||||
gTasks[taskId2].data[2] = 0x1000;
|
gTasks[taskId2].data[2] = 0x1000;
|
||||||
if (IsContest())
|
if (IsContest())
|
||||||
{
|
{
|
||||||
*x = -80;
|
gBattle_BG1_X = -80;
|
||||||
*y = -48;
|
gBattle_BG1_Y = -48;
|
||||||
gTasks[taskId].data[0] = 2;
|
gTasks[taskId].data[0] = 2;
|
||||||
gTasks[taskId].data[1] = 1;
|
gTasks[taskId].data[1] = 1;
|
||||||
gTasks[taskId2].data[3] = 0;
|
gTasks[taskId2].data[3] = 0;
|
||||||
}
|
}
|
||||||
else if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT)
|
else if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT)
|
||||||
{
|
{
|
||||||
*x = -224;
|
gBattle_BG1_X = -224;
|
||||||
*y = 256;
|
gBattle_BG1_Y = 256;
|
||||||
gTasks[taskId].data[0] = 2;
|
gTasks[taskId].data[0] = 2;
|
||||||
gTasks[taskId].data[1] = -1;
|
gTasks[taskId].data[1] = -1;
|
||||||
gTasks[taskId2].data[3] = 1;
|
gTasks[taskId2].data[3] = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*x = 0;
|
gBattle_BG1_X = 0;
|
||||||
*y = -48;
|
gBattle_BG1_Y = -48;
|
||||||
gTasks[taskId].data[0] = -2;
|
gTasks[taskId].data[0] = -2;
|
||||||
gTasks[taskId].data[1] = 1;
|
gTasks[taskId].data[1] = 1;
|
||||||
gTasks[taskId2].data[3] = 0;
|
gTasks[taskId2].data[3] = 0;
|
||||||
}
|
}
|
||||||
SetGpuReg(REG_OFFSET_BG1HOFS, *x);
|
SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X);
|
||||||
SetGpuReg(REG_OFFSET_BG1VOFS, *y);
|
SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
|
||||||
if (gTasks[taskId2].data[3] == 0)
|
if (gTasks[taskId2].data[3] == 0)
|
||||||
{
|
{
|
||||||
gTasks[taskId2].data[4] = 48;
|
gTasks[taskId2].data[4] = 48;
|
||||||
@ -874,16 +943,245 @@ void AnimTask_CreateSurfWave(u8 taskId)
|
|||||||
gTasks[taskId].data[6] = 1;
|
gTasks[taskId].data[6] = 1;
|
||||||
gTasks[taskId].func = AnimTask_CreateSurfWave_Step1;
|
gTasks[taskId].func = AnimTask_CreateSurfWave_Step1;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
void AnimTask_CreateSurfWave(u8 taskId)
|
||||||
|
{
|
||||||
|
asm_unified("push {r4-r7,lr}\n\
|
||||||
|
mov r7, r10\n\
|
||||||
|
mov r6, r9\n\
|
||||||
|
mov r5, r8\n\
|
||||||
|
push {r5-r7}\n\
|
||||||
|
sub sp, 0x10\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r0, 24\n\
|
||||||
|
mov r10, r0\n\
|
||||||
|
ldr r1, =0x00003f42\n\
|
||||||
|
movs r0, 0x50\n\
|
||||||
|
bl SetGpuReg\n\
|
||||||
|
movs r1, 0x80\n\
|
||||||
|
lsls r1, 5\n\
|
||||||
|
movs r0, 0x52\n\
|
||||||
|
bl SetGpuReg\n\
|
||||||
|
movs r0, 0x1\n\
|
||||||
|
movs r1, 0x4\n\
|
||||||
|
movs r2, 0x1\n\
|
||||||
|
bl SetAnimBgAttribute\n\
|
||||||
|
movs r0, 0x1\n\
|
||||||
|
movs r1, 0\n\
|
||||||
|
movs r2, 0x1\n\
|
||||||
|
bl SetAnimBgAttribute\n\
|
||||||
|
mov r0, sp\n\
|
||||||
|
bl sub_80A6B30\n\
|
||||||
|
bl IsContest\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
bne _081079E0\n\
|
||||||
|
movs r0, 0x1\n\
|
||||||
|
movs r1, 0x3\n\
|
||||||
|
movs r2, 0x1\n\
|
||||||
|
bl SetAnimBgAttribute\n\
|
||||||
|
ldr r0, =gBattleAnimAttacker\n\
|
||||||
|
ldrb r0, [r0]\n\
|
||||||
|
bl GetBattlerSide\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r0, 24\n\
|
||||||
|
cmp r0, 0x1\n\
|
||||||
|
bne _081079D0\n\
|
||||||
|
mov r0, sp\n\
|
||||||
|
ldrb r0, [r0, 0x9]\n\
|
||||||
|
ldr r1, =gBattleAnimBgTilemap_SurfOpponent\n\
|
||||||
|
bl AnimLoadCompressedBgTilemap\n\
|
||||||
|
b _081079EA\n\
|
||||||
|
.pool\n\
|
||||||
|
_081079D0:\n\
|
||||||
|
mov r0, sp\n\
|
||||||
|
ldrb r0, [r0, 0x9]\n\
|
||||||
|
ldr r1, =gBattleAnimBgTilemap_SurfPlayer\n\
|
||||||
|
bl AnimLoadCompressedBgTilemap\n\
|
||||||
|
b _081079EA\n\
|
||||||
|
.pool\n\
|
||||||
|
_081079E0:\n\
|
||||||
|
ldr r1, =gBattleAnimBgTilemap_SurfContest\n\
|
||||||
|
mov r0, sp\n\
|
||||||
|
movs r2, 0x1\n\
|
||||||
|
bl AnimLoadCompressedBgTilemapHandleContest\n\
|
||||||
|
_081079EA:\n\
|
||||||
|
mov r0, sp\n\
|
||||||
|
ldrb r0, [r0, 0x9]\n\
|
||||||
|
ldr r1, =gBattleAnimBgImage_Surf\n\
|
||||||
|
mov r2, sp\n\
|
||||||
|
ldrh r2, [r2, 0xA]\n\
|
||||||
|
bl AnimLoadCompressedBgGfx\n\
|
||||||
|
ldr r0, =gBattleAnimArgs\n\
|
||||||
|
movs r1, 0\n\
|
||||||
|
ldrsh r0, [r0, r1]\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
bne _08107A24\n\
|
||||||
|
ldr r0, =gBattleAnimBgPalette_Surf\n\
|
||||||
|
mov r1, sp\n\
|
||||||
|
ldrb r1, [r1, 0x8]\n\
|
||||||
|
lsls r1, 4\n\
|
||||||
|
movs r2, 0x20\n\
|
||||||
|
bl LoadCompressedPalette\n\
|
||||||
|
b _08107A32\n\
|
||||||
|
.pool\n\
|
||||||
|
_08107A24:\n\
|
||||||
|
ldr r0, =gBattleAnimBackgroundImageMuddyWater_Pal\n\
|
||||||
|
mov r1, sp\n\
|
||||||
|
ldrb r1, [r1, 0x8]\n\
|
||||||
|
lsls r1, 4\n\
|
||||||
|
movs r2, 0x20\n\
|
||||||
|
bl LoadCompressedPalette\n\
|
||||||
|
_08107A32:\n\
|
||||||
|
ldr r0, =AnimTask_SurfWaveScanlineEffect\n\
|
||||||
|
ldr r4, =gTasks\n\
|
||||||
|
mov r2, r10\n\
|
||||||
|
lsls r5, r2, 2\n\
|
||||||
|
adds r1, r5, r2\n\
|
||||||
|
lsls r1, 3\n\
|
||||||
|
adds r6, r1, r4\n\
|
||||||
|
ldrb r1, [r6, 0x7]\n\
|
||||||
|
adds r1, 0x1\n\
|
||||||
|
lsls r1, 24\n\
|
||||||
|
lsrs r1, 24\n\
|
||||||
|
bl CreateTask\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r0, 24\n\
|
||||||
|
mov r8, r0\n\
|
||||||
|
movs r0, 0\n\
|
||||||
|
mov r9, r0\n\
|
||||||
|
mov r1, r8\n\
|
||||||
|
strh r1, [r6, 0x26]\n\
|
||||||
|
mov r2, r8\n\
|
||||||
|
lsls r0, r2, 2\n\
|
||||||
|
add r0, r8\n\
|
||||||
|
lsls r0, 3\n\
|
||||||
|
adds r7, r0, r4\n\
|
||||||
|
mov r0, r9\n\
|
||||||
|
strh r0, [r7, 0x8]\n\
|
||||||
|
movs r0, 0x80\n\
|
||||||
|
lsls r0, 5\n\
|
||||||
|
strh r0, [r7, 0xA]\n\
|
||||||
|
strh r0, [r7, 0xC]\n\
|
||||||
|
bl IsContest\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r4, r0, 24\n\
|
||||||
|
cmp r4, 0\n\
|
||||||
|
beq _08107AB4\n\
|
||||||
|
ldr r1, =0x0000ffb0\n\
|
||||||
|
adds r0, r1, 0\n\
|
||||||
|
ldr r2, =gBattle_BG1_X\n\
|
||||||
|
strh r0, [r2]\n\
|
||||||
|
adds r1, 0x20\n\
|
||||||
|
adds r0, r1, 0\n\
|
||||||
|
ldr r2, =gBattle_BG1_Y\n\
|
||||||
|
strh r0, [r2]\n\
|
||||||
|
movs r0, 0x2\n\
|
||||||
|
strh r0, [r6, 0x8]\n\
|
||||||
|
movs r0, 0x1\n\
|
||||||
|
strh r0, [r6, 0xA]\n\
|
||||||
|
mov r0, r9\n\
|
||||||
|
strh r0, [r7, 0xE]\n\
|
||||||
|
b _08107B0E\n\
|
||||||
|
.pool\n\
|
||||||
|
_08107AB4:\n\
|
||||||
|
ldr r0, =gBattleAnimAttacker\n\
|
||||||
|
ldrb r0, [r0]\n\
|
||||||
|
bl GetBattlerSide\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r1, r0, 24\n\
|
||||||
|
cmp r1, 0x1\n\
|
||||||
|
bne _08107AF8\n\
|
||||||
|
ldr r2, =0x0000ff20\n\
|
||||||
|
adds r0, r2, 0\n\
|
||||||
|
ldr r2, =gBattle_BG1_X\n\
|
||||||
|
strh r0, [r2]\n\
|
||||||
|
movs r2, 0x80\n\
|
||||||
|
lsls r2, 1\n\
|
||||||
|
adds r0, r2, 0\n\
|
||||||
|
ldr r2, =gBattle_BG1_Y\n\
|
||||||
|
strh r0, [r2]\n\
|
||||||
|
movs r0, 0x2\n\
|
||||||
|
strh r0, [r6, 0x8]\n\
|
||||||
|
ldr r0, =0x0000ffff\n\
|
||||||
|
strh r0, [r6, 0xA]\n\
|
||||||
|
strh r1, [r7, 0xE]\n\
|
||||||
|
b _08107B0E\n\
|
||||||
|
.pool\n\
|
||||||
|
_08107AF8:\n\
|
||||||
|
ldr r0, =gBattle_BG1_X\n\
|
||||||
|
strh r4, [r0]\n\
|
||||||
|
ldr r1, =0x0000ffd0\n\
|
||||||
|
adds r0, r1, 0\n\
|
||||||
|
ldr r2, =gBattle_BG1_Y\n\
|
||||||
|
strh r0, [r2]\n\
|
||||||
|
ldr r0, =0x0000fffe\n\
|
||||||
|
strh r0, [r6, 0x8]\n\
|
||||||
|
movs r0, 0x1\n\
|
||||||
|
strh r0, [r6, 0xA]\n\
|
||||||
|
strh r4, [r7, 0xE]\n\
|
||||||
|
_08107B0E:\n\
|
||||||
|
ldr r0, =gBattle_BG1_X\n\
|
||||||
|
ldrh r1, [r0]\n\
|
||||||
|
movs r0, 0x14\n\
|
||||||
|
bl SetGpuReg\n\
|
||||||
|
ldr r2, =gBattle_BG1_Y\n\
|
||||||
|
ldrh r1, [r2]\n\
|
||||||
|
movs r0, 0x16\n\
|
||||||
|
bl SetGpuReg\n\
|
||||||
|
ldr r1, =gTasks\n\
|
||||||
|
mov r2, r8\n\
|
||||||
|
lsls r0, r2, 2\n\
|
||||||
|
add r0, r8\n\
|
||||||
|
lsls r0, 3\n\
|
||||||
|
adds r1, r0, r1\n\
|
||||||
|
movs r2, 0xE\n\
|
||||||
|
ldrsh r0, [r1, r2]\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
bne _08107B54\n\
|
||||||
|
movs r0, 0x30\n\
|
||||||
|
strh r0, [r1, 0x10]\n\
|
||||||
|
movs r0, 0x70\n\
|
||||||
|
b _08107B58\n\
|
||||||
|
.pool\n\
|
||||||
|
_08107B54:\n\
|
||||||
|
movs r0, 0\n\
|
||||||
|
strh r0, [r1, 0x10]\n\
|
||||||
|
_08107B58:\n\
|
||||||
|
strh r0, [r1, 0x12]\n\
|
||||||
|
ldr r1, =gTasks\n\
|
||||||
|
mov r2, r10\n\
|
||||||
|
adds r0, r5, r2\n\
|
||||||
|
lsls r0, 3\n\
|
||||||
|
adds r0, r1\n\
|
||||||
|
movs r1, 0x1\n\
|
||||||
|
strh r1, [r0, 0x14]\n\
|
||||||
|
ldr r1, =AnimTask_CreateSurfWave_Step1\n\
|
||||||
|
str r1, [r0]\n\
|
||||||
|
add sp, 0x10\n\
|
||||||
|
pop {r3-r5}\n\
|
||||||
|
mov r8, r3\n\
|
||||||
|
mov r9, r4\n\
|
||||||
|
mov r10, r5\n\
|
||||||
|
pop {r4-r7}\n\
|
||||||
|
pop {r0}\n\
|
||||||
|
bx r0\n\
|
||||||
|
.pool\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NONMATCHING
|
||||||
static void AnimTask_CreateSurfWave_Step1(u8 taskId)
|
static void AnimTask_CreateSurfWave_Step1(u8 taskId)
|
||||||
{
|
{
|
||||||
u16 rgbBuffer;
|
|
||||||
u8 i;
|
|
||||||
u16 *BGptrX, *BGptrY;
|
|
||||||
struct BattleAnimBgData animBg;
|
struct BattleAnimBgData animBg;
|
||||||
|
u8 i;
|
||||||
BGptrX = &gBattle_BG1_X;
|
u16 rgbBuffer;
|
||||||
BGptrY = &gBattle_BG1_Y;
|
u16 *BGptrX = &gBattle_BG1_X;
|
||||||
|
u16 *BGptrY = &gBattle_BG1_Y;
|
||||||
|
s16 unkUse;
|
||||||
|
u32 palOffset;
|
||||||
|
u16 palNum;
|
||||||
|
|
||||||
*BGptrX += gTasks[taskId].data[0];
|
*BGptrX += gTasks[taskId].data[0];
|
||||||
*BGptrY += gTasks[taskId].data[1];
|
*BGptrY += gTasks[taskId].data[1];
|
||||||
@ -891,26 +1189,29 @@ static void AnimTask_CreateSurfWave_Step1(u8 taskId)
|
|||||||
gTasks[taskId].data[2] += gTasks[taskId].data[1];
|
gTasks[taskId].data[2] += gTasks[taskId].data[1];
|
||||||
if (++gTasks[taskId].data[5] == 4)
|
if (++gTasks[taskId].data[5] == 4)
|
||||||
{
|
{
|
||||||
rgbBuffer = gPlttBufferFaded[16 * animBg.paletteId + 7];
|
rgbBuffer = gPlttBufferFaded[animBg.paletteId * 16 + 7];
|
||||||
for (i = 6; i != 0; i--) // i > 0 generates the exact same code in this context
|
for (i = 6; i != 0; i--)
|
||||||
{
|
{
|
||||||
gPlttBufferFaded[16 * animBg.paletteId + 1 + i] = gPlttBufferFaded[16 * animBg.paletteId + 1 + i - 1]; // 1 + i - 1 is needed to match for some bizarre reason
|
palNum = animBg.paletteId * 16;
|
||||||
|
palOffset = 1 + i;
|
||||||
|
gPlttBufferFaded[palNum + palOffset] = gPlttBufferFaded[palNum + palOffset - 1];
|
||||||
}
|
}
|
||||||
gPlttBufferFaded[16 * animBg.paletteId + 1] = rgbBuffer;
|
gPlttBufferFaded[animBg.paletteId * 16 + 1] = rgbBuffer;
|
||||||
gTasks[taskId].data[5] = 0;
|
gTasks[taskId].data[5] = 0;
|
||||||
}
|
}
|
||||||
if (++gTasks[taskId].data[6] > 1)
|
if (++gTasks[taskId].data[6] > 1)
|
||||||
{
|
{
|
||||||
gTasks[taskId].data[6] = 0;
|
gTasks[taskId].data[6] = 0;
|
||||||
if (++gTasks[taskId].data[3] < 14)
|
unkUse = ++gTasks[taskId].data[3];
|
||||||
|
if (unkUse <= 13)
|
||||||
{
|
{
|
||||||
gTasks[gTasks[taskId].data[15]].data[1] = (s16)((gTasks[taskId].data[3]) | ((16 - gTasks[taskId].data[3]) << 8));
|
gTasks[gTasks[taskId].data[15]].data[1] = unkUse | ((16 - unkUse) * 256);
|
||||||
gTasks[taskId].data[4]++;
|
gTasks[taskId].data[4]++;
|
||||||
}
|
}
|
||||||
if (gTasks[taskId].data[3] > 54)
|
if (gTasks[taskId].data[3] > 54)
|
||||||
{
|
{
|
||||||
gTasks[taskId].data[4]--;
|
unkUse = --gTasks[taskId].data[4];
|
||||||
gTasks[gTasks[taskId].data[15]].data[1] = (s16)((gTasks[taskId].data[4]) | ((16 - gTasks[taskId].data[4]) << 8));
|
gTasks[gTasks[taskId].data[15]].data[1] = unkUse | ((16 - unkUse) * 256);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(gTasks[gTasks[taskId].data[15]].data[1] & 0x1F))
|
if (!(gTasks[gTasks[taskId].data[15]].data[1] & 0x1F))
|
||||||
@ -919,7 +1220,167 @@ static void AnimTask_CreateSurfWave_Step1(u8 taskId)
|
|||||||
gTasks[taskId].func = AnimTask_CreateSurfWave_Step2;
|
gTasks[taskId].func = AnimTask_CreateSurfWave_Step2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
static void AnimTask_CreateSurfWave_Step1(u8 taskId)
|
||||||
|
{
|
||||||
|
asm_unified("push {r4-r7,lr}\n\
|
||||||
|
sub sp, 0x10\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r5, r0, 24\n\
|
||||||
|
ldr r1, =gBattle_BG1_X\n\
|
||||||
|
ldr r2, =gBattle_BG1_Y\n\
|
||||||
|
ldr r0, =gTasks\n\
|
||||||
|
lsls r4, r5, 2\n\
|
||||||
|
adds r4, r5\n\
|
||||||
|
lsls r4, 3\n\
|
||||||
|
adds r4, r0\n\
|
||||||
|
ldrh r0, [r4, 0x8]\n\
|
||||||
|
ldrh r3, [r1]\n\
|
||||||
|
adds r0, r3\n\
|
||||||
|
strh r0, [r1]\n\
|
||||||
|
ldrh r0, [r4, 0xA]\n\
|
||||||
|
ldrh r1, [r2]\n\
|
||||||
|
adds r0, r1\n\
|
||||||
|
strh r0, [r2]\n\
|
||||||
|
mov r0, sp\n\
|
||||||
|
bl sub_80A6B30\n\
|
||||||
|
ldrh r0, [r4, 0xA]\n\
|
||||||
|
ldrh r3, [r4, 0xC]\n\
|
||||||
|
adds r0, r3\n\
|
||||||
|
strh r0, [r4, 0xC]\n\
|
||||||
|
ldrh r0, [r4, 0x12]\n\
|
||||||
|
adds r0, 0x1\n\
|
||||||
|
strh r0, [r4, 0x12]\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
asrs r0, 16\n\
|
||||||
|
cmp r0, 0x4\n\
|
||||||
|
bne _08107C18\n\
|
||||||
|
ldr r1, =gPlttBufferFaded\n\
|
||||||
|
mov r0, sp\n\
|
||||||
|
ldrb r0, [r0, 0x8]\n\
|
||||||
|
lsls r0, 4\n\
|
||||||
|
adds r0, 0x7\n\
|
||||||
|
lsls r0, 1\n\
|
||||||
|
adds r0, r1\n\
|
||||||
|
ldrh r6, [r0]\n\
|
||||||
|
movs r2, 0x6\n\
|
||||||
|
adds r7, r1, 0\n\
|
||||||
|
adds r3, r7, 0\n\
|
||||||
|
mov r4, sp\n\
|
||||||
|
_08107BDE:\n\
|
||||||
|
ldrb r0, [r4, 0x8]\n\
|
||||||
|
lsls r0, 4\n\
|
||||||
|
adds r1, r2, 0x1\n\
|
||||||
|
adds r0, r1\n\
|
||||||
|
lsls r1, r0, 1\n\
|
||||||
|
adds r1, r3\n\
|
||||||
|
subs r0, 0x1\n\
|
||||||
|
lsls r0, 1\n\
|
||||||
|
adds r0, r3\n\
|
||||||
|
ldrh r0, [r0]\n\
|
||||||
|
strh r0, [r1]\n\
|
||||||
|
subs r0, r2, 0x1\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r2, r0, 24\n\
|
||||||
|
cmp r2, 0\n\
|
||||||
|
bne _08107BDE\n\
|
||||||
|
mov r0, sp\n\
|
||||||
|
ldrb r0, [r0, 0x8]\n\
|
||||||
|
lsls r0, 4\n\
|
||||||
|
adds r0, 0x1\n\
|
||||||
|
lsls r0, 1\n\
|
||||||
|
adds r0, r7\n\
|
||||||
|
strh r6, [r0]\n\
|
||||||
|
ldr r1, =gTasks\n\
|
||||||
|
lsls r0, r5, 2\n\
|
||||||
|
adds r0, r5\n\
|
||||||
|
lsls r0, 3\n\
|
||||||
|
adds r0, r1\n\
|
||||||
|
strh r2, [r0, 0x12]\n\
|
||||||
|
_08107C18:\n\
|
||||||
|
ldr r1, =gTasks\n\
|
||||||
|
lsls r2, r5, 2\n\
|
||||||
|
adds r0, r2, r5\n\
|
||||||
|
lsls r0, 3\n\
|
||||||
|
adds r3, r0, r1\n\
|
||||||
|
ldrh r0, [r3, 0x14]\n\
|
||||||
|
adds r0, 0x1\n\
|
||||||
|
strh r0, [r3, 0x14]\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
asrs r0, 16\n\
|
||||||
|
adds r4, r1, 0\n\
|
||||||
|
adds r6, r2, 0\n\
|
||||||
|
cmp r0, 0x1\n\
|
||||||
|
ble _08107C86\n\
|
||||||
|
movs r0, 0\n\
|
||||||
|
strh r0, [r3, 0x14]\n\
|
||||||
|
ldrh r0, [r3, 0xE]\n\
|
||||||
|
adds r2, r0, 0x1\n\
|
||||||
|
strh r2, [r3, 0xE]\n\
|
||||||
|
lsls r0, r2, 16\n\
|
||||||
|
asrs r0, 16\n\
|
||||||
|
cmp r0, 0xD\n\
|
||||||
|
bgt _08107C62\n\
|
||||||
|
movs r1, 0x26\n\
|
||||||
|
ldrsh r0, [r3, r1]\n\
|
||||||
|
lsls r1, r0, 2\n\
|
||||||
|
adds r1, r0\n\
|
||||||
|
lsls r1, 3\n\
|
||||||
|
adds r1, r4\n\
|
||||||
|
movs r0, 0x10\n\
|
||||||
|
subs r0, r2\n\
|
||||||
|
lsls r0, 8\n\
|
||||||
|
orrs r2, r0\n\
|
||||||
|
strh r2, [r1, 0xA]\n\
|
||||||
|
ldrh r0, [r3, 0x10]\n\
|
||||||
|
adds r0, 0x1\n\
|
||||||
|
strh r0, [r3, 0x10]\n\
|
||||||
|
_08107C62:\n\
|
||||||
|
movs r1, 0xE\n\
|
||||||
|
ldrsh r0, [r3, r1]\n\
|
||||||
|
cmp r0, 0x36\n\
|
||||||
|
ble _08107C86\n\
|
||||||
|
ldrh r2, [r3, 0x10]\n\
|
||||||
|
subs r2, 0x1\n\
|
||||||
|
strh r2, [r3, 0x10]\n\
|
||||||
|
movs r1, 0x26\n\
|
||||||
|
ldrsh r0, [r3, r1]\n\
|
||||||
|
lsls r1, r0, 2\n\
|
||||||
|
adds r1, r0\n\
|
||||||
|
lsls r1, 3\n\
|
||||||
|
adds r1, r4\n\
|
||||||
|
movs r0, 0x10\n\
|
||||||
|
subs r0, r2\n\
|
||||||
|
lsls r0, 8\n\
|
||||||
|
orrs r2, r0\n\
|
||||||
|
strh r2, [r1, 0xA]\n\
|
||||||
|
_08107C86:\n\
|
||||||
|
adds r0, r6, r5\n\
|
||||||
|
lsls r0, 3\n\
|
||||||
|
adds r2, r0, r4\n\
|
||||||
|
movs r3, 0x26\n\
|
||||||
|
ldrsh r1, [r2, r3]\n\
|
||||||
|
lsls r0, r1, 2\n\
|
||||||
|
adds r0, r1\n\
|
||||||
|
lsls r0, 3\n\
|
||||||
|
adds r0, r4\n\
|
||||||
|
ldrh r0, [r0, 0xA]\n\
|
||||||
|
movs r3, 0x1F\n\
|
||||||
|
ands r3, r0\n\
|
||||||
|
cmp r3, 0\n\
|
||||||
|
bne _08107CA8\n\
|
||||||
|
strh r3, [r2, 0x8]\n\
|
||||||
|
ldr r0, =AnimTask_CreateSurfWave_Step2\n\
|
||||||
|
str r0, [r2]\n\
|
||||||
|
_08107CA8:\n\
|
||||||
|
add sp, 0x10\n\
|
||||||
|
pop {r4-r7}\n\
|
||||||
|
pop {r0}\n\
|
||||||
|
bx r0\n\
|
||||||
|
.pool\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void AnimTask_CreateSurfWave_Step2(u8 taskId)
|
static void AnimTask_CreateSurfWave_Step2(u8 taskId)
|
||||||
{
|
{
|
||||||
@ -1543,50 +2004,216 @@ static void AnimWaterPulseRing_Step(struct Sprite *sprite)
|
|||||||
sprite->data[0]++;
|
sprite->data[0]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CreateWaterPulseRingBubbles(struct Sprite *sprite, s32 xDiff, s32 yDiff)
|
#ifdef NONMATCHING
|
||||||
|
static void CreateWaterPulseRingBubbles(struct Sprite *sprite, int xDiff, int yDiff)
|
||||||
{
|
{
|
||||||
s16 combinedX, combinedY;
|
s16 something = sprite->data[0] / 2;
|
||||||
s16 i, something;
|
s16 combinedX = sprite->pos1.x + sprite->pos2.x;
|
||||||
s16 unusedVar = 1; //unusedVar is needed to match
|
s16 combinedY = sprite->pos1.y + sprite->pos2.y;
|
||||||
s16 somethingRandomX, somethingRandomY;
|
s16 randomSomethingY = yDiff + (Random2() % 10) - 5;
|
||||||
|
s16 randomSomethingX = -xDiff + (Random2() % 10) - 5;
|
||||||
|
s16 i;
|
||||||
u8 spriteId;
|
u8 spriteId;
|
||||||
|
|
||||||
something = sprite->data[0] / 2;
|
for (i = 0; i <= 0; i++)
|
||||||
combinedX = sprite->pos1.x + sprite->pos2.x;
|
|
||||||
combinedY = sprite->pos1.y + sprite->pos2.y;
|
|
||||||
if (yDiff < 0)
|
|
||||||
unusedVar *= -1; //Needed to Match
|
|
||||||
somethingRandomY = yDiff + (Random2() % 10) - 5;
|
|
||||||
somethingRandomX = -xDiff + (Random2() % 10) - 5;
|
|
||||||
|
|
||||||
for (i = 0; i < 1; i++)
|
|
||||||
{
|
{
|
||||||
spriteId = CreateSprite(&gWaterPulseRingBubbleSpriteTemplate, combinedX, combinedY + something, 130);
|
spriteId = CreateSprite(&gWaterPulseRingBubbleSpriteTemplate, combinedX, combinedY + something, 130);
|
||||||
gSprites[spriteId].data[0] = 20;
|
gSprites[spriteId].data[0] = 20;
|
||||||
gSprites[spriteId].data[1] = somethingRandomY;
|
gSprites[spriteId].data[1] = randomSomethingY;
|
||||||
gSprites[spriteId].subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker) - 1;
|
gSprites[spriteId].subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker) - 1;
|
||||||
if (somethingRandomX < 0)
|
if (randomSomethingX < 0)
|
||||||
{
|
gSprites[spriteId].data[2] = -randomSomethingX;
|
||||||
gSprites[spriteId].data[2] = -somethingRandomX;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
gSprites[spriteId].data[2] = randomSomethingX;
|
||||||
gSprites[spriteId].data[2] = somethingRandomX;
|
|
||||||
}
|
}
|
||||||
}
|
for (i = 0; i <= 0; i++)
|
||||||
for (i = 0; i < 1; i++)
|
|
||||||
{
|
{
|
||||||
spriteId = CreateSprite(&gWaterPulseRingBubbleSpriteTemplate, combinedX, combinedY - something, 130);
|
spriteId = CreateSprite(&gWaterPulseRingBubbleSpriteTemplate, combinedX, combinedY - something, 130);
|
||||||
gSprites[spriteId].data[0] = 20;
|
gSprites[spriteId].data[0] = 20;
|
||||||
gSprites[spriteId].data[1] = somethingRandomY;
|
gSprites[spriteId].data[1] = randomSomethingY;
|
||||||
gSprites[spriteId].subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker) - 1;
|
gSprites[spriteId].subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker) - 1;
|
||||||
if (somethingRandomX > 0)
|
if (randomSomethingX > 0)
|
||||||
{
|
gSprites[spriteId].data[2] = -randomSomethingX;
|
||||||
gSprites[spriteId].data[2] = -somethingRandomX;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
|
gSprites[spriteId].data[2] = randomSomethingX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
static void CreateWaterPulseRingBubbles(struct Sprite *sprite, int xDiff, int yDiff)
|
||||||
{
|
{
|
||||||
gSprites[spriteId].data[2] = somethingRandomX;
|
asm_unified("push {r4-r7,lr}\n\
|
||||||
}
|
mov r7, r10\n\
|
||||||
}
|
mov r6, r9\n\
|
||||||
|
mov r5, r8\n\
|
||||||
|
push {r5-r7}\n\
|
||||||
|
sub sp, 0x18\n\
|
||||||
|
adds r4, r1, 0\n\
|
||||||
|
adds r5, r2, 0\n\
|
||||||
|
movs r2, 0x2E\n\
|
||||||
|
ldrsh r1, [r0, r2]\n\
|
||||||
|
lsrs r2, r1, 31\n\
|
||||||
|
adds r1, r2\n\
|
||||||
|
lsls r1, 15\n\
|
||||||
|
lsrs r1, 16\n\
|
||||||
|
str r1, [sp]\n\
|
||||||
|
ldrh r1, [r0, 0x24]\n\
|
||||||
|
ldrh r3, [r0, 0x20]\n\
|
||||||
|
adds r1, r3\n\
|
||||||
|
lsls r1, 16\n\
|
||||||
|
lsrs r1, 16\n\
|
||||||
|
mov r8, r1\n\
|
||||||
|
ldrh r1, [r0, 0x26]\n\
|
||||||
|
ldrh r0, [r0, 0x22]\n\
|
||||||
|
adds r1, r0\n\
|
||||||
|
lsls r1, 16\n\
|
||||||
|
lsrs r1, 16\n\
|
||||||
|
mov r10, r1\n\
|
||||||
|
bl Random2\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r0, 16\n\
|
||||||
|
movs r1, 0xA\n\
|
||||||
|
bl __umodsi3\n\
|
||||||
|
adds r0, r5, r0\n\
|
||||||
|
subs r0, 0x5\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r0, 16\n\
|
||||||
|
mov r9, r0\n\
|
||||||
|
bl Random2\n\
|
||||||
|
negs r4, r4\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r0, 16\n\
|
||||||
|
movs r1, 0xA\n\
|
||||||
|
bl __umodsi3\n\
|
||||||
|
adds r4, r0\n\
|
||||||
|
subs r4, 0x5\n\
|
||||||
|
lsls r4, 16\n\
|
||||||
|
lsrs r7, r4, 16\n\
|
||||||
|
movs r6, 0\n\
|
||||||
|
mov r0, r8\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
mov r8, r0\n\
|
||||||
|
mov r1, r10\n\
|
||||||
|
lsls r1, 16\n\
|
||||||
|
str r1, [sp, 0xC]\n\
|
||||||
|
ldr r2, [sp]\n\
|
||||||
|
lsls r2, 16\n\
|
||||||
|
str r2, [sp, 0x10]\n\
|
||||||
|
asrs r1, 16\n\
|
||||||
|
lsls r0, r7, 16\n\
|
||||||
|
asrs r5, r0, 16\n\
|
||||||
|
str r0, [sp, 0x14]\n\
|
||||||
|
negs r3, r5\n\
|
||||||
|
str r3, [sp, 0x4]\n\
|
||||||
|
asrs r0, r2, 16\n\
|
||||||
|
adds r1, r0\n\
|
||||||
|
lsls r1, 16\n\
|
||||||
|
mov r10, r1\n\
|
||||||
|
_08108DE2:\n\
|
||||||
|
ldr r0, =gWaterPulseRingBubbleSpriteTemplate\n\
|
||||||
|
mov r2, r8\n\
|
||||||
|
asrs r1, r2, 16\n\
|
||||||
|
mov r3, r10\n\
|
||||||
|
asrs r2, r3, 16\n\
|
||||||
|
movs r3, 0x82\n\
|
||||||
|
bl CreateSprite\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r2, r0, 24\n\
|
||||||
|
ldr r1, =gSprites\n\
|
||||||
|
lsls r0, r2, 4\n\
|
||||||
|
adds r0, r2\n\
|
||||||
|
lsls r0, 2\n\
|
||||||
|
adds r4, r0, r1\n\
|
||||||
|
movs r0, 0x14\n\
|
||||||
|
strh r0, [r4, 0x2E]\n\
|
||||||
|
mov r0, r9\n\
|
||||||
|
strh r0, [r4, 0x30]\n\
|
||||||
|
ldr r0, =gBattleAnimAttacker\n\
|
||||||
|
ldrb r0, [r0]\n\
|
||||||
|
bl GetBattlerSpriteSubpriority\n\
|
||||||
|
subs r0, 0x1\n\
|
||||||
|
adds r1, r4, 0\n\
|
||||||
|
adds r1, 0x43\n\
|
||||||
|
strb r0, [r1]\n\
|
||||||
|
cmp r5, 0\n\
|
||||||
|
bge _08108E30\n\
|
||||||
|
mov r1, sp\n\
|
||||||
|
ldrh r1, [r1, 0x4]\n\
|
||||||
|
strh r1, [r4, 0x32]\n\
|
||||||
|
b _08108E32\n\
|
||||||
|
.pool\n\
|
||||||
|
_08108E30:\n\
|
||||||
|
strh r7, [r4, 0x32]\n\
|
||||||
|
_08108E32:\n\
|
||||||
|
lsls r0, r6, 16\n\
|
||||||
|
movs r2, 0x80\n\
|
||||||
|
lsls r2, 9\n\
|
||||||
|
adds r0, r2\n\
|
||||||
|
lsrs r6, r0, 16\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
ble _08108DE2\n\
|
||||||
|
movs r6, 0\n\
|
||||||
|
ldr r3, [sp, 0xC]\n\
|
||||||
|
asrs r1, r3, 16\n\
|
||||||
|
ldr r0, [sp, 0x14]\n\
|
||||||
|
asrs r5, r0, 16\n\
|
||||||
|
negs r2, r5\n\
|
||||||
|
str r2, [sp, 0x8]\n\
|
||||||
|
ldr r3, [sp, 0x10]\n\
|
||||||
|
asrs r0, r3, 16\n\
|
||||||
|
subs r1, r0\n\
|
||||||
|
lsls r1, 16\n\
|
||||||
|
mov r10, r1\n\
|
||||||
|
_08108E58:\n\
|
||||||
|
ldr r0, =gWaterPulseRingBubbleSpriteTemplate\n\
|
||||||
|
mov r2, r8\n\
|
||||||
|
asrs r1, r2, 16\n\
|
||||||
|
mov r3, r10\n\
|
||||||
|
asrs r2, r3, 16\n\
|
||||||
|
movs r3, 0x82\n\
|
||||||
|
bl CreateSprite\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r2, r0, 24\n\
|
||||||
|
ldr r1, =gSprites\n\
|
||||||
|
lsls r0, r2, 4\n\
|
||||||
|
adds r0, r2\n\
|
||||||
|
lsls r0, 2\n\
|
||||||
|
adds r4, r0, r1\n\
|
||||||
|
movs r0, 0x14\n\
|
||||||
|
strh r0, [r4, 0x2E]\n\
|
||||||
|
mov r0, r9\n\
|
||||||
|
strh r0, [r4, 0x30]\n\
|
||||||
|
ldr r0, =gBattleAnimAttacker\n\
|
||||||
|
ldrb r0, [r0]\n\
|
||||||
|
bl GetBattlerSpriteSubpriority\n\
|
||||||
|
subs r0, 0x1\n\
|
||||||
|
adds r1, r4, 0\n\
|
||||||
|
adds r1, 0x43\n\
|
||||||
|
strb r0, [r1]\n\
|
||||||
|
cmp r5, 0\n\
|
||||||
|
ble _08108EA8\n\
|
||||||
|
mov r1, sp\n\
|
||||||
|
ldrh r1, [r1, 0x8]\n\
|
||||||
|
strh r1, [r4, 0x32]\n\
|
||||||
|
b _08108EAA\n\
|
||||||
|
.pool\n\
|
||||||
|
_08108EA8:\n\
|
||||||
|
strh r7, [r4, 0x32]\n\
|
||||||
|
_08108EAA:\n\
|
||||||
|
lsls r0, r6, 16\n\
|
||||||
|
movs r2, 0x80\n\
|
||||||
|
lsls r2, 9\n\
|
||||||
|
adds r0, r2\n\
|
||||||
|
lsrs r6, r0, 16\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
ble _08108E58\n\
|
||||||
|
add sp, 0x18\n\
|
||||||
|
pop {r3-r5}\n\
|
||||||
|
mov r8, r3\n\
|
||||||
|
mov r9, r4\n\
|
||||||
|
mov r10, r5\n\
|
||||||
|
pop {r4-r7}\n\
|
||||||
|
pop {r0}\n\
|
||||||
|
bx r0\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -1126,7 +1126,7 @@ void DrawBattleEntryBackground(void)
|
|||||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||||
{
|
{
|
||||||
LZDecompressVram(gUnknown_08D778F0, (void*)(BG_CHAR_ADDR(1)));
|
LZDecompressVram(gUnknown_08D778F0, (void*)(BG_CHAR_ADDR(1)));
|
||||||
LZDecompressVram(gVsLettersGfx, (void*)(OBJ_VRAM0));
|
LZDecompressVram(gVsLettersGfx, (void*)(VRAM + 0x10000));
|
||||||
LoadCompressedPalette(gUnknown_08D77AE4, 0x60, 0x20);
|
LoadCompressedPalette(gUnknown_08D77AE4, 0x60, 0x20);
|
||||||
SetBgAttribute(1, BG_ATTR_SCREENSIZE, 1);
|
SetBgAttribute(1, BG_ATTR_SCREENSIZE, 1);
|
||||||
SetGpuReg(REG_OFFSET_BG1CNT, 0x5C04);
|
SetGpuReg(REG_OFFSET_BG1CNT, 0x5C04);
|
||||||
|
@ -240,12 +240,12 @@ static void HandleInputChooseAction(void)
|
|||||||
DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1);
|
DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1);
|
||||||
DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1);
|
DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1);
|
||||||
|
|
||||||
if (JOY_REPEAT(DPAD_ANY) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
|
if (gMain.newAndRepeatedKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
|
||||||
gPlayerDpadHoldFrames++;
|
gPlayerDpadHoldFrames++;
|
||||||
else
|
else
|
||||||
gPlayerDpadHoldFrames = 0;
|
gPlayerDpadHoldFrames = 0;
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ static void HandleInputChooseAction(void)
|
|||||||
}
|
}
|
||||||
PlayerBufferExecCompleted();
|
PlayerBufferExecCompleted();
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_LEFT))
|
else if (gMain.newKeys & DPAD_LEFT)
|
||||||
{
|
{
|
||||||
if (gActionSelectionCursor[gActiveBattler] & 1) // if is B_ACTION_USE_ITEM or B_ACTION_RUN
|
if (gActionSelectionCursor[gActiveBattler] & 1) // if is B_ACTION_USE_ITEM or B_ACTION_RUN
|
||||||
{
|
{
|
||||||
@ -276,7 +276,7 @@ static void HandleInputChooseAction(void)
|
|||||||
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_RIGHT))
|
else if (gMain.newKeys & DPAD_RIGHT)
|
||||||
{
|
{
|
||||||
if (!(gActionSelectionCursor[gActiveBattler] & 1)) // if is B_ACTION_USE_MOVE or B_ACTION_SWITCH
|
if (!(gActionSelectionCursor[gActiveBattler] & 1)) // if is B_ACTION_USE_MOVE or B_ACTION_SWITCH
|
||||||
{
|
{
|
||||||
@ -286,7 +286,7 @@ static void HandleInputChooseAction(void)
|
|||||||
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_UP))
|
else if (gMain.newKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
if (gActionSelectionCursor[gActiveBattler] & 2) // if is B_ACTION_SWITCH or B_ACTION_RUN
|
if (gActionSelectionCursor[gActiveBattler] & 2) // if is B_ACTION_SWITCH or B_ACTION_RUN
|
||||||
{
|
{
|
||||||
@ -296,7 +296,7 @@ static void HandleInputChooseAction(void)
|
|||||||
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_DOWN))
|
else if (gMain.newKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
if (!(gActionSelectionCursor[gActiveBattler] & 2)) // if is B_ACTION_USE_MOVE or B_ACTION_USE_ITEM
|
if (!(gActionSelectionCursor[gActiveBattler] & 2)) // if is B_ACTION_USE_MOVE or B_ACTION_USE_ITEM
|
||||||
{
|
{
|
||||||
@ -306,7 +306,7 @@ static void HandleInputChooseAction(void)
|
|||||||
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59)
|
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
|
||||||
{
|
{
|
||||||
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||||
&& GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT
|
&& GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT
|
||||||
@ -326,7 +326,7 @@ static void HandleInputChooseAction(void)
|
|||||||
PlayerBufferExecCompleted();
|
PlayerBufferExecCompleted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(START_BUTTON))
|
else if (gMain.newKeys & START_BUTTON)
|
||||||
{
|
{
|
||||||
SwapHpBarsWithHpText();
|
SwapHpBarsWithHpText();
|
||||||
}
|
}
|
||||||
@ -359,12 +359,12 @@ static void HandleInputChooseTarget(void)
|
|||||||
} while (i < gBattlersCount);
|
} while (i < gBattlersCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JOY_HELD(DPAD_ANY) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
|
if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
|
||||||
gPlayerDpadHoldFrames++;
|
gPlayerDpadHoldFrames++;
|
||||||
else
|
else
|
||||||
gPlayerDpadHoldFrames = 0;
|
gPlayerDpadHoldFrames = 0;
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
|
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
|
||||||
@ -372,7 +372,7 @@ static void HandleInputChooseTarget(void)
|
|||||||
EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
|
EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
|
||||||
PlayerBufferExecCompleted();
|
PlayerBufferExecCompleted();
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59)
|
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
|
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
|
||||||
@ -381,7 +381,7 @@ static void HandleInputChooseTarget(void)
|
|||||||
DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1);
|
DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1);
|
||||||
EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
|
EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_LEFT | DPAD_UP))
|
else if (gMain.newKeys & (DPAD_LEFT | DPAD_UP))
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
|
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
|
||||||
@ -423,7 +423,7 @@ static void HandleInputChooseTarget(void)
|
|||||||
} while (i == 0);
|
} while (i == 0);
|
||||||
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget;
|
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_RIGHT | DPAD_DOWN))
|
else if (gMain.newKeys & (DPAD_RIGHT | DPAD_DOWN))
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
|
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
|
||||||
@ -472,12 +472,12 @@ static void HandleInputChooseMove(void)
|
|||||||
bool32 canSelectTarget = FALSE;
|
bool32 canSelectTarget = FALSE;
|
||||||
struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBattler][4]);
|
struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBattler][4]);
|
||||||
|
|
||||||
if (JOY_HELD(DPAD_ANY) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
|
if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
|
||||||
gPlayerDpadHoldFrames++;
|
gPlayerDpadHoldFrames++;
|
||||||
else
|
else
|
||||||
gPlayerDpadHoldFrames = 0;
|
gPlayerDpadHoldFrames = 0;
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
u8 moveTarget;
|
u8 moveTarget;
|
||||||
|
|
||||||
@ -539,13 +539,13 @@ static void HandleInputChooseMove(void)
|
|||||||
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget;
|
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59)
|
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BtlController_EmitTwoReturnValues(1, 10, 0xFFFF);
|
BtlController_EmitTwoReturnValues(1, 10, 0xFFFF);
|
||||||
PlayerBufferExecCompleted();
|
PlayerBufferExecCompleted();
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_LEFT))
|
else if (gMain.newKeys & DPAD_LEFT)
|
||||||
{
|
{
|
||||||
if (gMoveSelectionCursor[gActiveBattler] & 1)
|
if (gMoveSelectionCursor[gActiveBattler] & 1)
|
||||||
{
|
{
|
||||||
@ -557,7 +557,7 @@ static void HandleInputChooseMove(void)
|
|||||||
MoveSelectionDisplayMoveType();
|
MoveSelectionDisplayMoveType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_RIGHT))
|
else if (gMain.newKeys & DPAD_RIGHT)
|
||||||
{
|
{
|
||||||
if (!(gMoveSelectionCursor[gActiveBattler] & 1)
|
if (!(gMoveSelectionCursor[gActiveBattler] & 1)
|
||||||
&& (gMoveSelectionCursor[gActiveBattler] ^ 1) < gNumberOfMovesToChoose)
|
&& (gMoveSelectionCursor[gActiveBattler] ^ 1) < gNumberOfMovesToChoose)
|
||||||
@ -570,7 +570,7 @@ static void HandleInputChooseMove(void)
|
|||||||
MoveSelectionDisplayMoveType();
|
MoveSelectionDisplayMoveType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_UP))
|
else if (gMain.newKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
if (gMoveSelectionCursor[gActiveBattler] & 2)
|
if (gMoveSelectionCursor[gActiveBattler] & 2)
|
||||||
{
|
{
|
||||||
@ -582,7 +582,7 @@ static void HandleInputChooseMove(void)
|
|||||||
MoveSelectionDisplayMoveType();
|
MoveSelectionDisplayMoveType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_DOWN))
|
else if (gMain.newKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
if (!(gMoveSelectionCursor[gActiveBattler] & 2)
|
if (!(gMoveSelectionCursor[gActiveBattler] & 2)
|
||||||
&& (gMoveSelectionCursor[gActiveBattler] ^ 2) < gNumberOfMovesToChoose)
|
&& (gMoveSelectionCursor[gActiveBattler] ^ 2) < gNumberOfMovesToChoose)
|
||||||
@ -595,7 +595,7 @@ static void HandleInputChooseMove(void)
|
|||||||
MoveSelectionDisplayMoveType();
|
MoveSelectionDisplayMoveType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(SELECT_BUTTON))
|
else if (gMain.newKeys & SELECT_BUTTON)
|
||||||
{
|
{
|
||||||
if (gNumberOfMovesToChoose > 1 && !(gBattleTypeFlags & BATTLE_TYPE_LINK))
|
if (gNumberOfMovesToChoose > 1 && !(gBattleTypeFlags & BATTLE_TYPE_LINK))
|
||||||
{
|
{
|
||||||
@ -617,26 +617,26 @@ u32 sub_8057FBC(void) // unused
|
|||||||
{
|
{
|
||||||
u32 var = 0;
|
u32 var = 0;
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
var = 1;
|
var = 1;
|
||||||
}
|
}
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
gBattle_BG0_X = 0;
|
gBattle_BG0_X = 0;
|
||||||
gBattle_BG0_Y = 0x140;
|
gBattle_BG0_Y = 0x140;
|
||||||
var = 0xFF;
|
var = 0xFF;
|
||||||
}
|
}
|
||||||
if (JOY_NEW(DPAD_LEFT) && gMoveSelectionCursor[gActiveBattler] & 1)
|
if (gMain.newKeys & DPAD_LEFT && gMoveSelectionCursor[gActiveBattler] & 1)
|
||||||
{
|
{
|
||||||
MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]);
|
MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]);
|
||||||
gMoveSelectionCursor[gActiveBattler] ^= 1;
|
gMoveSelectionCursor[gActiveBattler] ^= 1;
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0);
|
MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(DPAD_RIGHT) && !(gMoveSelectionCursor[gActiveBattler] & 1)
|
if (gMain.newKeys & DPAD_RIGHT && !(gMoveSelectionCursor[gActiveBattler] & 1)
|
||||||
&& (gMoveSelectionCursor[gActiveBattler] ^ 1) < gNumberOfMovesToChoose)
|
&& (gMoveSelectionCursor[gActiveBattler] ^ 1) < gNumberOfMovesToChoose)
|
||||||
{
|
{
|
||||||
MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]);
|
MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]);
|
||||||
@ -644,14 +644,14 @@ u32 sub_8057FBC(void) // unused
|
|||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0);
|
MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(DPAD_UP) && gMoveSelectionCursor[gActiveBattler] & 2)
|
if (gMain.newKeys & DPAD_UP && gMoveSelectionCursor[gActiveBattler] & 2)
|
||||||
{
|
{
|
||||||
MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]);
|
MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]);
|
||||||
gMoveSelectionCursor[gActiveBattler] ^= 2;
|
gMoveSelectionCursor[gActiveBattler] ^= 2;
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0);
|
MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(DPAD_DOWN) && !(gMoveSelectionCursor[gActiveBattler] & 2)
|
if (gMain.newKeys & DPAD_DOWN && !(gMoveSelectionCursor[gActiveBattler] & 2)
|
||||||
&& (gMoveSelectionCursor[gActiveBattler] ^ 2) < gNumberOfMovesToChoose)
|
&& (gMoveSelectionCursor[gActiveBattler] ^ 2) < gNumberOfMovesToChoose)
|
||||||
{
|
{
|
||||||
MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]);
|
MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]);
|
||||||
@ -669,7 +669,7 @@ static void HandleMoveSwitching(void)
|
|||||||
struct ChooseMoveStruct moveStruct;
|
struct ChooseMoveStruct moveStruct;
|
||||||
u8 totalPPBonuses;
|
u8 totalPPBonuses;
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON | SELECT_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | SELECT_BUTTON))
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
|
|
||||||
@ -763,7 +763,7 @@ static void HandleMoveSwitching(void)
|
|||||||
MoveSelectionDisplayPpNumber();
|
MoveSelectionDisplayPpNumber();
|
||||||
MoveSelectionDisplayMoveType();
|
MoveSelectionDisplayMoveType();
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON | SELECT_BUTTON))
|
else if (gMain.newKeys & (B_BUTTON | SELECT_BUTTON))
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor);
|
MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor);
|
||||||
@ -773,7 +773,7 @@ static void HandleMoveSwitching(void)
|
|||||||
MoveSelectionDisplayPpNumber();
|
MoveSelectionDisplayPpNumber();
|
||||||
MoveSelectionDisplayMoveType();
|
MoveSelectionDisplayMoveType();
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_LEFT))
|
else if (gMain.newKeys & DPAD_LEFT)
|
||||||
{
|
{
|
||||||
if (gMultiUsePlayerCursor & 1)
|
if (gMultiUsePlayerCursor & 1)
|
||||||
{
|
{
|
||||||
@ -791,7 +791,7 @@ static void HandleMoveSwitching(void)
|
|||||||
MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27);
|
MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_RIGHT))
|
else if (gMain.newKeys & DPAD_RIGHT)
|
||||||
{
|
{
|
||||||
if (!(gMultiUsePlayerCursor & 1) && (gMultiUsePlayerCursor ^ 1) < gNumberOfMovesToChoose)
|
if (!(gMultiUsePlayerCursor & 1) && (gMultiUsePlayerCursor ^ 1) < gNumberOfMovesToChoose)
|
||||||
{
|
{
|
||||||
@ -809,7 +809,7 @@ static void HandleMoveSwitching(void)
|
|||||||
MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27);
|
MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_UP))
|
else if (gMain.newKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
if (gMultiUsePlayerCursor & 2)
|
if (gMultiUsePlayerCursor & 2)
|
||||||
{
|
{
|
||||||
@ -827,7 +827,7 @@ static void HandleMoveSwitching(void)
|
|||||||
MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27);
|
MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_DOWN))
|
else if (gMain.newKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
if (!(gMultiUsePlayerCursor & 2) && (gMultiUsePlayerCursor ^ 2) < gNumberOfMovesToChoose)
|
if (!(gMultiUsePlayerCursor & 2) && (gMultiUsePlayerCursor ^ 2) < gNumberOfMovesToChoose)
|
||||||
{
|
{
|
||||||
@ -1402,21 +1402,21 @@ static void DoHitAnimBlinkSpriteEffect(void)
|
|||||||
|
|
||||||
static void PlayerHandleUnknownYesNoInput(void)
|
static void PlayerHandleUnknownYesNoInput(void)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(DPAD_UP) && gMultiUsePlayerCursor != 0)
|
if (gMain.newKeys & DPAD_UP && gMultiUsePlayerCursor != 0)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BattleDestroyYesNoCursorAt(gMultiUsePlayerCursor);
|
BattleDestroyYesNoCursorAt(gMultiUsePlayerCursor);
|
||||||
gMultiUsePlayerCursor = 0;
|
gMultiUsePlayerCursor = 0;
|
||||||
BattleCreateYesNoCursorAt(0);
|
BattleCreateYesNoCursorAt(0);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(DPAD_DOWN) && gMultiUsePlayerCursor == 0)
|
if (gMain.newKeys & DPAD_DOWN && gMultiUsePlayerCursor == 0)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BattleDestroyYesNoCursorAt(gMultiUsePlayerCursor);
|
BattleDestroyYesNoCursorAt(gMultiUsePlayerCursor);
|
||||||
gMultiUsePlayerCursor = 1;
|
gMultiUsePlayerCursor = 1;
|
||||||
BattleCreateYesNoCursorAt(1);
|
BattleCreateYesNoCursorAt(1);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
|
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
@ -1428,7 +1428,7 @@ static void PlayerHandleUnknownYesNoInput(void)
|
|||||||
|
|
||||||
PlayerBufferExecCompleted();
|
PlayerBufferExecCompleted();
|
||||||
}
|
}
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
|
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
|
@ -170,7 +170,7 @@ static void SafariBufferRunCommand(void)
|
|||||||
|
|
||||||
static void HandleInputChooseAction(void)
|
static void HandleInputChooseAction(void)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ static void HandleInputChooseAction(void)
|
|||||||
}
|
}
|
||||||
SafariBufferExecCompleted();
|
SafariBufferExecCompleted();
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_LEFT))
|
else if (gMain.newKeys & DPAD_LEFT)
|
||||||
{
|
{
|
||||||
if (gActionSelectionCursor[gActiveBattler] & 1)
|
if (gActionSelectionCursor[gActiveBattler] & 1)
|
||||||
{
|
{
|
||||||
@ -201,7 +201,7 @@ static void HandleInputChooseAction(void)
|
|||||||
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_RIGHT))
|
else if (gMain.newKeys & DPAD_RIGHT)
|
||||||
{
|
{
|
||||||
if (!(gActionSelectionCursor[gActiveBattler] & 1))
|
if (!(gActionSelectionCursor[gActiveBattler] & 1))
|
||||||
{
|
{
|
||||||
@ -211,7 +211,7 @@ static void HandleInputChooseAction(void)
|
|||||||
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_UP))
|
else if (gMain.newKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
if (gActionSelectionCursor[gActiveBattler] & 2)
|
if (gActionSelectionCursor[gActiveBattler] & 2)
|
||||||
{
|
{
|
||||||
@ -221,7 +221,7 @@ static void HandleInputChooseAction(void)
|
|||||||
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_DOWN))
|
else if (gMain.newKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
if (!(gActionSelectionCursor[gActiveBattler] & 2))
|
if (!(gActionSelectionCursor[gActiveBattler] & 2))
|
||||||
{
|
{
|
||||||
|
@ -2731,6 +2731,9 @@ static int SelectOpponentMonsFromParty(int *partyMovePoints, bool8 allowRandom)
|
|||||||
#define TYPE_x2 40
|
#define TYPE_x2 40
|
||||||
#define TYPE_x4 80
|
#define TYPE_x4 80
|
||||||
|
|
||||||
|
// Functionally equivalent, while loop is impossible to match.
|
||||||
|
// arg2 is either 2, a personality, or an OTID
|
||||||
|
#ifdef NONMATCHING
|
||||||
static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2)
|
static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2)
|
||||||
{
|
{
|
||||||
int defType1, defType2, defAbility, moveType;
|
int defType1, defType2, defAbility, moveType;
|
||||||
@ -2759,15 +2762,13 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2)
|
|||||||
i += 3;
|
i += 3;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (TYPE_EFFECT_ATK_TYPE(i) == moveType)
|
else if (TYPE_EFFECT_ATK_TYPE(i) == moveType)
|
||||||
{
|
{
|
||||||
// BUG: TYPE_x2 is not necessary and makes the condition always false if the ability is wonder guard.
|
// BUG: * 2 is not necessary and makes the condition always false if the ability is wonder guard.
|
||||||
if (TYPE_EFFECT_DEF_TYPE(i) == defType1)
|
if (TYPE_EFFECT_DEF_TYPE(i) == defType1 && (defAbility != ABILITY_WONDER_GUARD || TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE * 2))
|
||||||
if ((defAbility == ABILITY_WONDER_GUARD && TYPE_EFFECT_MULTIPLIER(i) == TYPE_x2) || defAbility != ABILITY_WONDER_GUARD)
|
typePower = (typePower * TYPE_EFFECT_MULTIPLIER(i)) / 10;
|
||||||
typePower = typePower * TYPE_EFFECT_MULTIPLIER(i) / 10;
|
if (TYPE_EFFECT_DEF_TYPE(i) == defType2 && defType1 != defType2 && (defAbility != ABILITY_WONDER_GUARD || TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE * 2))
|
||||||
if (TYPE_EFFECT_DEF_TYPE(i) == defType2 && defType1 != defType2)
|
typePower = (typePower * TYPE_EFFECT_MULTIPLIER(i)) / 10;
|
||||||
if ((defAbility == ABILITY_WONDER_GUARD && TYPE_EFFECT_MULTIPLIER(i) == TYPE_x2) || defAbility != ABILITY_WONDER_GUARD)
|
|
||||||
typePower = typePower * TYPE_EFFECT_MULTIPLIER(i) / 10;
|
|
||||||
}
|
}
|
||||||
i += 3;
|
i += 3;
|
||||||
}
|
}
|
||||||
@ -2778,10 +2779,10 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2)
|
|||||||
case 0:
|
case 0:
|
||||||
switch (typePower)
|
switch (typePower)
|
||||||
{
|
{
|
||||||
default:
|
|
||||||
case TYPE_x0:
|
|
||||||
case TYPE_x0_25:
|
|
||||||
case TYPE_x0_50:
|
case TYPE_x0_50:
|
||||||
|
case TYPE_x0_25:
|
||||||
|
case TYPE_x0:
|
||||||
|
default:
|
||||||
typePower = 0;
|
typePower = 0;
|
||||||
break;
|
break;
|
||||||
case TYPE_x1:
|
case TYPE_x1:
|
||||||
@ -2798,19 +2799,19 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2)
|
|||||||
case 1:
|
case 1:
|
||||||
switch (typePower)
|
switch (typePower)
|
||||||
{
|
{
|
||||||
case TYPE_x0:
|
default:
|
||||||
typePower = 8;
|
case TYPE_x1:
|
||||||
|
typePower = 0;
|
||||||
break;
|
break;
|
||||||
case TYPE_x0_25:
|
case TYPE_x0_25:
|
||||||
typePower = 4;
|
typePower = 4;
|
||||||
break;
|
break;
|
||||||
|
case TYPE_x0:
|
||||||
|
typePower = 8;
|
||||||
|
break;
|
||||||
case TYPE_x0_50:
|
case TYPE_x0_50:
|
||||||
typePower = 2;
|
typePower = 2;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
case TYPE_x1:
|
|
||||||
typePower = 0;
|
|
||||||
break;
|
|
||||||
case TYPE_x2:
|
case TYPE_x2:
|
||||||
typePower = -2;
|
typePower = -2;
|
||||||
break;
|
break;
|
||||||
@ -2828,8 +2829,8 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2)
|
|||||||
case TYPE_x0_25:
|
case TYPE_x0_25:
|
||||||
typePower = -8;
|
typePower = -8;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
case TYPE_x0_50:
|
case TYPE_x0_50:
|
||||||
|
default:
|
||||||
typePower = 0;
|
typePower = 0;
|
||||||
break;
|
break;
|
||||||
case TYPE_x1:
|
case TYPE_x1:
|
||||||
@ -2847,6 +2848,246 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2)
|
|||||||
|
|
||||||
return typePower;
|
return typePower;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
static int GetTypeEffectivenessPoints(int move, int species, int arg2)
|
||||||
|
{
|
||||||
|
asm_unified(
|
||||||
|
"push {r4-r7,lr}\n\
|
||||||
|
mov r7, r10\n\
|
||||||
|
mov r6, r9\n\
|
||||||
|
mov r5, r8\n\
|
||||||
|
push {r5-r7}\n\
|
||||||
|
sub sp, 0x8\n\
|
||||||
|
adds r3, r0, 0\n\
|
||||||
|
adds r4, r1, 0\n\
|
||||||
|
str r2, [sp]\n\
|
||||||
|
movs r6, 0\n\
|
||||||
|
movs r2, 0x14\n\
|
||||||
|
cmp r3, 0\n\
|
||||||
|
beq _0818FFF0\n\
|
||||||
|
ldr r0, =0x0000ffff\n\
|
||||||
|
cmp r3, r0\n\
|
||||||
|
beq _0818FFF0\n\
|
||||||
|
ldr r0, =gBattleMoves\n\
|
||||||
|
lsls r1, r3, 1\n\
|
||||||
|
adds r1, r3\n\
|
||||||
|
lsls r1, 2\n\
|
||||||
|
adds r3, r1, r0\n\
|
||||||
|
ldrb r0, [r3, 0x1]\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
bne _0818FFFC\n\
|
||||||
|
_0818FFF0:\n\
|
||||||
|
movs r0, 0\n\
|
||||||
|
b _08190156\n\
|
||||||
|
.pool\n\
|
||||||
|
_0818FFFC:\n\
|
||||||
|
ldr r1, =gBaseStats\n\
|
||||||
|
lsls r0, r4, 3\n\
|
||||||
|
subs r0, r4\n\
|
||||||
|
lsls r0, 2\n\
|
||||||
|
adds r0, r1\n\
|
||||||
|
ldrb r1, [r0, 0x6]\n\
|
||||||
|
mov r10, r1\n\
|
||||||
|
ldrb r1, [r0, 0x7]\n\
|
||||||
|
mov r9, r1\n\
|
||||||
|
ldrb r0, [r0, 0x16]\n\
|
||||||
|
mov r8, r0\n\
|
||||||
|
ldrb r3, [r3, 0x2]\n\
|
||||||
|
str r3, [sp, 0x4]\n\
|
||||||
|
cmp r0, 0x1A\n\
|
||||||
|
bne _0819002C\n\
|
||||||
|
cmp r3, 0x4\n\
|
||||||
|
bne _0819002C\n\
|
||||||
|
ldr r0, [sp]\n\
|
||||||
|
cmp r0, 0x1\n\
|
||||||
|
bne _081900AA\n\
|
||||||
|
movs r2, 0x8\n\
|
||||||
|
b _081900A4\n\
|
||||||
|
.pool\n\
|
||||||
|
_0819002C:\n\
|
||||||
|
ldr r0, =gTypeEffectiveness\n\
|
||||||
|
adds r1, r6, r0\n\
|
||||||
|
ldrb r0, [r1]\n\
|
||||||
|
ldr r7, =gTypeEffectiveness\n\
|
||||||
|
cmp r0, 0xFF\n\
|
||||||
|
beq _081900A4\n\
|
||||||
|
adds r4, r1, 0\n\
|
||||||
|
_0819003A:\n\
|
||||||
|
ldrb r0, [r4]\n\
|
||||||
|
cmp r0, 0xFE\n\
|
||||||
|
beq _08190096\n\
|
||||||
|
ldrb r0, [r4]\n\
|
||||||
|
ldr r1, [sp, 0x4]\n\
|
||||||
|
cmp r0, r1\n\
|
||||||
|
bne _08190096\n\
|
||||||
|
ldrb r0, [r4, 0x1]\n\
|
||||||
|
adds r5, r6, 0x1\n\
|
||||||
|
cmp r0, r10\n\
|
||||||
|
bne _0819006C\n\
|
||||||
|
adds r1, r6, 0x2\n\
|
||||||
|
mov r0, r8\n\
|
||||||
|
cmp r0, 0x19\n\
|
||||||
|
bne _0819005E\n\
|
||||||
|
ldrb r0, [r4, 0x2]\n\
|
||||||
|
cmp r0, 0x28\n\
|
||||||
|
bne _0819006C\n\
|
||||||
|
_0819005E:\n\
|
||||||
|
adds r0, r1, r7\n\
|
||||||
|
ldrb r0, [r0]\n\
|
||||||
|
muls r0, r2\n\
|
||||||
|
movs r1, 0xA\n\
|
||||||
|
bl __divsi3\n\
|
||||||
|
adds r2, r0, 0\n\
|
||||||
|
_0819006C:\n\
|
||||||
|
adds r0, r5, r7\n\
|
||||||
|
ldrb r0, [r0]\n\
|
||||||
|
cmp r0, r9\n\
|
||||||
|
bne _08190096\n\
|
||||||
|
cmp r10, r9\n\
|
||||||
|
beq _08190096\n\
|
||||||
|
adds r1, r6, 0x2\n\
|
||||||
|
mov r0, r8\n\
|
||||||
|
cmp r0, 0x19\n\
|
||||||
|
bne _08190088\n\
|
||||||
|
adds r0, r1, r7\n\
|
||||||
|
ldrb r0, [r0]\n\
|
||||||
|
cmp r0, 0x28\n\
|
||||||
|
bne _08190096\n\
|
||||||
|
_08190088:\n\
|
||||||
|
adds r0, r1, r7\n\
|
||||||
|
ldrb r0, [r0]\n\
|
||||||
|
muls r0, r2\n\
|
||||||
|
movs r1, 0xA\n\
|
||||||
|
bl __divsi3\n\
|
||||||
|
adds r2, r0, 0\n\
|
||||||
|
_08190096:\n\
|
||||||
|
adds r4, 0x3\n\
|
||||||
|
adds r6, 0x3\n\
|
||||||
|
ldr r1, =gTypeEffectiveness\n\
|
||||||
|
adds r0, r6, r1\n\
|
||||||
|
ldrb r0, [r0]\n\
|
||||||
|
cmp r0, 0xFF\n\
|
||||||
|
bne _0819003A\n\
|
||||||
|
_081900A4:\n\
|
||||||
|
ldr r0, [sp]\n\
|
||||||
|
cmp r0, 0x1\n\
|
||||||
|
beq _081900E0\n\
|
||||||
|
_081900AA:\n\
|
||||||
|
ldr r1, [sp]\n\
|
||||||
|
cmp r1, 0x1\n\
|
||||||
|
bgt _081900BC\n\
|
||||||
|
cmp r1, 0\n\
|
||||||
|
beq _081900C4\n\
|
||||||
|
b _08190154\n\
|
||||||
|
.pool\n\
|
||||||
|
_081900BC:\n\
|
||||||
|
ldr r0, [sp]\n\
|
||||||
|
cmp r0, 0x2\n\
|
||||||
|
beq _08190114\n\
|
||||||
|
b _08190154\n\
|
||||||
|
_081900C4:\n\
|
||||||
|
cmp r2, 0xA\n\
|
||||||
|
beq _08190146\n\
|
||||||
|
cmp r2, 0xA\n\
|
||||||
|
ble _08190146\n\
|
||||||
|
cmp r2, 0x28\n\
|
||||||
|
beq _0819014A\n\
|
||||||
|
cmp r2, 0x28\n\
|
||||||
|
bgt _081900DA\n\
|
||||||
|
cmp r2, 0x14\n\
|
||||||
|
beq _08190104\n\
|
||||||
|
b _08190146\n\
|
||||||
|
_081900DA:\n\
|
||||||
|
cmp r2, 0x50\n\
|
||||||
|
bne _08190146\n\
|
||||||
|
b _08190100\n\
|
||||||
|
_081900E0:\n\
|
||||||
|
cmp r2, 0xA\n\
|
||||||
|
beq _08190104\n\
|
||||||
|
cmp r2, 0xA\n\
|
||||||
|
bgt _081900F2\n\
|
||||||
|
cmp r2, 0\n\
|
||||||
|
beq _08190100\n\
|
||||||
|
cmp r2, 0x5\n\
|
||||||
|
beq _0819014A\n\
|
||||||
|
b _08190146\n\
|
||||||
|
_081900F2:\n\
|
||||||
|
cmp r2, 0x28\n\
|
||||||
|
beq _08190108\n\
|
||||||
|
cmp r2, 0x28\n\
|
||||||
|
ble _08190146\n\
|
||||||
|
cmp r2, 0x50\n\
|
||||||
|
beq _0819010E\n\
|
||||||
|
b _08190146\n\
|
||||||
|
_08190100:\n\
|
||||||
|
movs r2, 0x8\n\
|
||||||
|
b _08190154\n\
|
||||||
|
_08190104:\n\
|
||||||
|
movs r2, 0x2\n\
|
||||||
|
b _08190154\n\
|
||||||
|
_08190108:\n\
|
||||||
|
movs r2, 0x2\n\
|
||||||
|
negs r2, r2\n\
|
||||||
|
b _08190154\n\
|
||||||
|
_0819010E:\n\
|
||||||
|
movs r2, 0x4\n\
|
||||||
|
negs r2, r2\n\
|
||||||
|
b _08190154\n\
|
||||||
|
_08190114:\n\
|
||||||
|
cmp r2, 0xA\n\
|
||||||
|
beq _08190146\n\
|
||||||
|
cmp r2, 0xA\n\
|
||||||
|
bgt _08190126\n\
|
||||||
|
cmp r2, 0\n\
|
||||||
|
beq _0819013A\n\
|
||||||
|
cmp r2, 0x5\n\
|
||||||
|
beq _08190140\n\
|
||||||
|
b _08190146\n\
|
||||||
|
_08190126:\n\
|
||||||
|
cmp r2, 0x28\n\
|
||||||
|
beq _0819014E\n\
|
||||||
|
cmp r2, 0x28\n\
|
||||||
|
bgt _08190134\n\
|
||||||
|
cmp r2, 0x14\n\
|
||||||
|
beq _0819014A\n\
|
||||||
|
b _08190146\n\
|
||||||
|
_08190134:\n\
|
||||||
|
cmp r2, 0x50\n\
|
||||||
|
beq _08190152\n\
|
||||||
|
b _08190146\n\
|
||||||
|
_0819013A:\n\
|
||||||
|
movs r2, 0x10\n\
|
||||||
|
negs r2, r2\n\
|
||||||
|
b _08190154\n\
|
||||||
|
_08190140:\n\
|
||||||
|
movs r2, 0x8\n\
|
||||||
|
negs r2, r2\n\
|
||||||
|
b _08190154\n\
|
||||||
|
_08190146:\n\
|
||||||
|
movs r2, 0\n\
|
||||||
|
b _08190154\n\
|
||||||
|
_0819014A:\n\
|
||||||
|
movs r2, 0x4\n\
|
||||||
|
b _08190154\n\
|
||||||
|
_0819014E:\n\
|
||||||
|
movs r2, 0xC\n\
|
||||||
|
b _08190154\n\
|
||||||
|
_08190152:\n\
|
||||||
|
movs r2, 0x14\n\
|
||||||
|
_08190154:\n\
|
||||||
|
adds r0, r2, 0\n\
|
||||||
|
_08190156:\n\
|
||||||
|
add sp, 0x8\n\
|
||||||
|
pop {r3-r5}\n\
|
||||||
|
mov r8, r3\n\
|
||||||
|
mov r9, r4\n\
|
||||||
|
mov r10, r5\n\
|
||||||
|
pop {r4-r7}\n\
|
||||||
|
pop {r1}\n\
|
||||||
|
bx r1");
|
||||||
|
}
|
||||||
|
#endif // NONMATCHING
|
||||||
|
|
||||||
// Duplicate of GetFrontierTrainerFixedIvs
|
// Duplicate of GetFrontierTrainerFixedIvs
|
||||||
// NOTE: In CreateDomeOpponentMon a tournament trainer ID (0-15) is passed instead, resulting in all IVs of 3
|
// NOTE: In CreateDomeOpponentMon a tournament trainer ID (0-15) is passed instead, resulting in all IVs of 3
|
||||||
@ -4111,7 +4352,7 @@ static u8 Task_GetInfoCardInput(u8 taskId)
|
|||||||
u8 tourneyId = sTourneyTreeTrainerIds[position];
|
u8 tourneyId = sTourneyTreeTrainerIds[position];
|
||||||
u16 roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
|
u16 roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
input = INFOCARD_INPUT_AB;
|
input = INFOCARD_INPUT_AB;
|
||||||
|
|
||||||
// Next opponent card cant scroll
|
// Next opponent card cant scroll
|
||||||
@ -4122,7 +4363,7 @@ static u8 Task_GetInfoCardInput(u8 taskId)
|
|||||||
{
|
{
|
||||||
// For trainer info cards, pos is 0 when on a trainer info card (not viewing that trainer's match progression)
|
// For trainer info cards, pos is 0 when on a trainer info card (not viewing that trainer's match progression)
|
||||||
// Scrolling up/down from a trainer info card goes to other trainer info cards
|
// Scrolling up/down from a trainer info card goes to other trainer info cards
|
||||||
if (JOY_NEW(DPAD_UP) && sInfoCard->pos == 0)
|
if (gMain.newKeys & DPAD_UP && sInfoCard->pos == 0)
|
||||||
{
|
{
|
||||||
if (position == 0)
|
if (position == 0)
|
||||||
position = DOME_TOURNAMENT_TRAINERS_COUNT - 1;
|
position = DOME_TOURNAMENT_TRAINERS_COUNT - 1;
|
||||||
@ -4130,7 +4371,7 @@ static u8 Task_GetInfoCardInput(u8 taskId)
|
|||||||
position--;
|
position--;
|
||||||
input = TRAINERCARD_INPUT_UP;
|
input = TRAINERCARD_INPUT_UP;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_DOWN) && sInfoCard->pos == 0)
|
else if (gMain.newKeys & DPAD_DOWN && sInfoCard->pos == 0)
|
||||||
{
|
{
|
||||||
if (position == DOME_TOURNAMENT_TRAINERS_COUNT - 1)
|
if (position == DOME_TOURNAMENT_TRAINERS_COUNT - 1)
|
||||||
position = 0;
|
position = 0;
|
||||||
@ -4139,13 +4380,13 @@ static u8 Task_GetInfoCardInput(u8 taskId)
|
|||||||
input = TRAINERCARD_INPUT_DOWN;
|
input = TRAINERCARD_INPUT_DOWN;
|
||||||
}
|
}
|
||||||
// Scrolling left can only be done after scrolling right
|
// Scrolling left can only be done after scrolling right
|
||||||
else if (JOY_NEW(DPAD_LEFT) && sInfoCard->pos != 0)
|
else if (gMain.newKeys & DPAD_LEFT && sInfoCard->pos != 0)
|
||||||
{
|
{
|
||||||
sInfoCard->pos--;
|
sInfoCard->pos--;
|
||||||
input = TRAINERCARD_INPUT_LEFT;
|
input = TRAINERCARD_INPUT_LEFT;
|
||||||
}
|
}
|
||||||
// Scrolling right from a trainer info card shows their match progression
|
// Scrolling right from a trainer info card shows their match progression
|
||||||
else if (JOY_NEW(DPAD_RIGHT))
|
else if (gMain.newKeys & DPAD_RIGHT)
|
||||||
{
|
{
|
||||||
// Can only scroll right from a trainer card until the round they were eliminated
|
// Can only scroll right from a trainer card until the round they were eliminated
|
||||||
if (DOME_TRAINERS[tourneyId].isEliminated && sInfoCard->pos - 1 < DOME_TRAINERS[tourneyId].eliminatedAt)
|
if (DOME_TRAINERS[tourneyId].isEliminated && sInfoCard->pos - 1 < DOME_TRAINERS[tourneyId].eliminatedAt)
|
||||||
@ -4173,7 +4414,7 @@ static u8 Task_GetInfoCardInput(u8 taskId)
|
|||||||
{
|
{
|
||||||
// For match info cards, pos is 1 when on the match card, 0 when on the left trainer, and 1 when on the right trainer
|
// For match info cards, pos is 1 when on the match card, 0 when on the left trainer, and 1 when on the right trainer
|
||||||
// Scrolling up/down from a match info card goes to the next/previous match
|
// Scrolling up/down from a match info card goes to the next/previous match
|
||||||
if (JOY_NEW(DPAD_UP) && sInfoCard->pos == 1)
|
if (gMain.newKeys & DPAD_UP && sInfoCard->pos == 1)
|
||||||
{
|
{
|
||||||
if (position == DOME_TOURNAMENT_TRAINERS_COUNT)
|
if (position == DOME_TOURNAMENT_TRAINERS_COUNT)
|
||||||
position = sLastMatchCardNum[roundId];
|
position = sLastMatchCardNum[roundId];
|
||||||
@ -4181,7 +4422,7 @@ static u8 Task_GetInfoCardInput(u8 taskId)
|
|||||||
position--;
|
position--;
|
||||||
input = MATCHCARD_INPUT_UP;
|
input = MATCHCARD_INPUT_UP;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_DOWN) && sInfoCard->pos == 1)
|
else if (gMain.newKeys & DPAD_DOWN && sInfoCard->pos == 1)
|
||||||
{
|
{
|
||||||
if (position == sLastMatchCardNum[roundId])
|
if (position == sLastMatchCardNum[roundId])
|
||||||
position = DOME_TOURNAMENT_TRAINERS_COUNT;
|
position = DOME_TOURNAMENT_TRAINERS_COUNT;
|
||||||
@ -4190,12 +4431,12 @@ static u8 Task_GetInfoCardInput(u8 taskId)
|
|||||||
input = MATCHCARD_INPUT_DOWN;
|
input = MATCHCARD_INPUT_DOWN;
|
||||||
}
|
}
|
||||||
// Scrolling left/right from a match info card shows the trainer info card of the competitors for that match
|
// Scrolling left/right from a match info card shows the trainer info card of the competitors for that match
|
||||||
else if (JOY_NEW(DPAD_LEFT) && sInfoCard->pos != 0)
|
else if (gMain.newKeys & DPAD_LEFT && sInfoCard->pos != 0)
|
||||||
{
|
{
|
||||||
input = MATCHCARD_INPUT_LEFT;
|
input = MATCHCARD_INPUT_LEFT;
|
||||||
sInfoCard->pos--;
|
sInfoCard->pos--;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_RIGHT) && (sInfoCard->pos == 0 || sInfoCard->pos == 1))
|
else if (gMain.newKeys & DPAD_RIGHT && (sInfoCard->pos == 0 || sInfoCard->pos == 1))
|
||||||
{
|
{
|
||||||
input = MATCHCARD_INPUT_RIGHT;
|
input = MATCHCARD_INPUT_RIGHT;
|
||||||
sInfoCard->pos++;
|
sInfoCard->pos++;
|
||||||
@ -4305,7 +4546,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId)
|
|||||||
textPrinter.currentY = textPrinter.y;
|
textPrinter.currentY = textPrinter.y;
|
||||||
textPrinter.letterSpacing = 2;
|
textPrinter.letterSpacing = 2;
|
||||||
textPrinter.lineSpacing = 0;
|
textPrinter.lineSpacing = 0;
|
||||||
textPrinter.style = 0;
|
textPrinter.unk = 0;
|
||||||
textPrinter.fgColor = TEXT_DYNAMIC_COLOR_5;
|
textPrinter.fgColor = TEXT_DYNAMIC_COLOR_5;
|
||||||
textPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
|
textPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
|
||||||
textPrinter.shadowColor = TEXT_DYNAMIC_COLOR_4;
|
textPrinter.shadowColor = TEXT_DYNAMIC_COLOR_4;
|
||||||
@ -4838,7 +5079,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
|
|||||||
textPrinter.currentY = textPrinter.y;
|
textPrinter.currentY = textPrinter.y;
|
||||||
textPrinter.letterSpacing = 0;
|
textPrinter.letterSpacing = 0;
|
||||||
textPrinter.lineSpacing = 0;
|
textPrinter.lineSpacing = 0;
|
||||||
textPrinter.style = 0;
|
textPrinter.unk = 0;
|
||||||
textPrinter.fgColor = TEXT_DYNAMIC_COLOR_5;
|
textPrinter.fgColor = TEXT_DYNAMIC_COLOR_5;
|
||||||
textPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
|
textPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
|
||||||
textPrinter.shadowColor = TEXT_DYNAMIC_COLOR_4;
|
textPrinter.shadowColor = TEXT_DYNAMIC_COLOR_4;
|
||||||
@ -5043,12 +5284,12 @@ static u8 UpdateTourneyTreeCursor(u8 taskId)
|
|||||||
int tourneyTreeCursorSpriteId = gTasks[taskId].data[1];
|
int tourneyTreeCursorSpriteId = gTasks[taskId].data[1];
|
||||||
int roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
|
int roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
|
||||||
|
|
||||||
if (gMain.newKeys == B_BUTTON || (JOY_NEW(A_BUTTON) && tourneyTreeCursorSpriteId == TOURNEY_TREE_CLOSE_BUTTON))
|
if (gMain.newKeys == B_BUTTON || (gMain.newKeys & A_BUTTON && tourneyTreeCursorSpriteId == TOURNEY_TREE_CLOSE_BUTTON))
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
selection = TOURNEY_TREE_SELECTED_CLOSE;
|
selection = TOURNEY_TREE_SELECTED_CLOSE;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(A_BUTTON))
|
else if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
if (tourneyTreeCursorSpriteId < DOME_TOURNAMENT_TRAINERS_COUNT)
|
if (tourneyTreeCursorSpriteId < DOME_TOURNAMENT_TRAINERS_COUNT)
|
||||||
{
|
{
|
||||||
@ -5292,7 +5533,7 @@ static void Task_ShowTourneyTree(u8 taskId)
|
|||||||
gTasks[taskId].tState++;
|
gTasks[taskId].tState++;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
sTilemapBuffer = AllocZeroed(BG_SCREEN_SIZE);
|
sTilemapBuffer = AllocZeroed(0x800);
|
||||||
LZDecompressWram(gDomeTourneyLineMask_Tilemap, sTilemapBuffer);
|
LZDecompressWram(gDomeTourneyLineMask_Tilemap, sTilemapBuffer);
|
||||||
SetBgTilemapBuffer(1, sTilemapBuffer);
|
SetBgTilemapBuffer(1, sTilemapBuffer);
|
||||||
CopyBgTilemapBufferToVram(1);
|
CopyBgTilemapBufferToVram(1);
|
||||||
@ -5336,7 +5577,7 @@ static void Task_ShowTourneyTree(u8 taskId)
|
|||||||
textPrinter.lineSpacing = 0;
|
textPrinter.lineSpacing = 0;
|
||||||
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0x70, textPrinter.letterSpacing);
|
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0x70, textPrinter.letterSpacing);
|
||||||
textPrinter.currentY = 1;
|
textPrinter.currentY = 1;
|
||||||
textPrinter.style = 0;
|
textPrinter.unk = 0;
|
||||||
textPrinter.fgColor = TEXT_DYNAMIC_COLOR_5;
|
textPrinter.fgColor = TEXT_DYNAMIC_COLOR_5;
|
||||||
textPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
|
textPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
|
||||||
textPrinter.shadowColor = TEXT_DYNAMIC_COLOR_4;
|
textPrinter.shadowColor = TEXT_DYNAMIC_COLOR_4;
|
||||||
@ -5517,7 +5758,7 @@ static void Task_HandleStaticTourneyTreeInput(u8 taskId)
|
|||||||
textPrinter.y = 0;
|
textPrinter.y = 0;
|
||||||
textPrinter.letterSpacing = 2;
|
textPrinter.letterSpacing = 2;
|
||||||
textPrinter.lineSpacing = 0;
|
textPrinter.lineSpacing = 0;
|
||||||
textPrinter.style = 0;
|
textPrinter.unk = 0;
|
||||||
textPrinter.fgColor = TEXT_DYNAMIC_COLOR_2;
|
textPrinter.fgColor = TEXT_DYNAMIC_COLOR_2;
|
||||||
textPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
|
textPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
|
||||||
textPrinter.shadowColor = TEXT_DYNAMIC_COLOR_4;
|
textPrinter.shadowColor = TEXT_DYNAMIC_COLOR_4;
|
||||||
@ -5552,7 +5793,7 @@ static void Task_HandleStaticTourneyTreeInput(u8 taskId)
|
|||||||
gTasks[taskId].tState = STATE_WAIT_FOR_INPUT;
|
gTasks[taskId].tState = STATE_WAIT_FOR_INPUT;
|
||||||
break;
|
break;
|
||||||
case STATE_WAIT_FOR_INPUT:
|
case STATE_WAIT_FOR_INPUT:
|
||||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
{
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
|
||||||
gTasks[taskId].tState = STATE_CLOSE_TOURNEY_TREE;
|
gTasks[taskId].tState = STATE_CLOSE_TOURNEY_TREE;
|
||||||
|
@ -1478,7 +1478,7 @@ static void Task_HandleSelectionScreenYesNo(u8 taskId)
|
|||||||
gTasks[taskId].data[0] = 5;
|
gTasks[taskId].data[0] = 5;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
if (sFactorySelectScreen->yesNoCursorPos == 0)
|
if (sFactorySelectScreen->yesNoCursorPos == 0)
|
||||||
@ -1496,7 +1496,7 @@ static void Task_HandleSelectionScreenYesNo(u8 taskId)
|
|||||||
gTasks[taskId].func = Task_HandleSelectionScreenChooseMons;
|
gTasks[taskId].func = Task_HandleSelectionScreenChooseMons;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
sub_819B958(4);
|
sub_819B958(4);
|
||||||
@ -1505,12 +1505,12 @@ static void Task_HandleSelectionScreenYesNo(u8 taskId)
|
|||||||
gTasks[taskId].data[0] = 1;
|
gTasks[taskId].data[0] = 1;
|
||||||
gTasks[taskId].func = Task_HandleSelectionScreenChooseMons;
|
gTasks[taskId].func = Task_HandleSelectionScreenChooseMons;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_UP))
|
else if (gMain.newAndRepeatedKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
Select_UpdateYesNoCursorPosition(-1);
|
Select_UpdateYesNoCursorPosition(-1);
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_DOWN))
|
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
Select_UpdateYesNoCursorPosition(1);
|
Select_UpdateYesNoCursorPosition(1);
|
||||||
@ -1538,7 +1538,7 @@ static void Task_HandleSelectionScreenMenu(u8 taskId)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
u8 retVal;
|
u8 retVal;
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
@ -1565,7 +1565,7 @@ static void Task_HandleSelectionScreenMenu(u8 taskId)
|
|||||||
gTasks[taskId].func = Task_FromSelectScreenToSummaryScreen;
|
gTasks[taskId].func = Task_FromSelectScreenToSummaryScreen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
sub_819F3F8(sFactorySelectScreen->unk294[1], &sFactorySelectScreen->unk2A0, FALSE);
|
sub_819F3F8(sFactorySelectScreen->unk294[1], &sFactorySelectScreen->unk2A0, FALSE);
|
||||||
@ -1574,12 +1574,12 @@ static void Task_HandleSelectionScreenMenu(u8 taskId)
|
|||||||
gTasks[taskId].data[0] = 1;
|
gTasks[taskId].data[0] = 1;
|
||||||
gTasks[taskId].func = Task_HandleSelectionScreenChooseMons;
|
gTasks[taskId].func = Task_HandleSelectionScreenChooseMons;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_UP))
|
else if (gMain.newAndRepeatedKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
Select_UpdateMenuCursorPosition(-1);
|
Select_UpdateMenuCursorPosition(-1);
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_DOWN))
|
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
Select_UpdateMenuCursorPosition(1);
|
Select_UpdateMenuCursorPosition(1);
|
||||||
@ -1618,21 +1618,21 @@ static void Task_HandleSelectionScreenChooseMons(u8 taskId)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
sFactorySelectScreen->unk2A2 = FALSE;
|
sFactorySelectScreen->unk2A2 = FALSE;
|
||||||
gTasks[taskId].data[0] = 2;
|
gTasks[taskId].data[0] = 2;
|
||||||
gTasks[taskId].func = Task_HandleSelectionScreenMenu;
|
gTasks[taskId].func = Task_HandleSelectionScreenMenu;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_LEFT))
|
else if (gMain.newAndRepeatedKeys & DPAD_LEFT)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
Select_UpdateBallCursorPosition(-1);
|
Select_UpdateBallCursorPosition(-1);
|
||||||
Select_PrintMonCategory();
|
Select_PrintMonCategory();
|
||||||
Select_PrintMonSpecies();
|
Select_PrintMonSpecies();
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_RIGHT))
|
else if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
Select_UpdateBallCursorPosition(1);
|
Select_UpdateBallCursorPosition(1);
|
||||||
@ -1641,7 +1641,7 @@ static void Task_HandleSelectionScreenChooseMons(u8 taskId)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
sub_819F3F8(sFactorySelectScreen->unk294[1], &sFactorySelectScreen->unk2A0, FALSE);
|
sub_819F3F8(sFactorySelectScreen->unk294[1], &sFactorySelectScreen->unk2A0, FALSE);
|
||||||
@ -2361,7 +2361,7 @@ static void Task_HandleSwapScreenYesNo(u8 taskId)
|
|||||||
gTasks[taskId].data[0] = 5;
|
gTasks[taskId].data[0] = 5;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
if (sFactorySwapScreen->yesNoCursorPos == 0)
|
if (sFactorySwapScreen->yesNoCursorPos == 0)
|
||||||
@ -2380,7 +2380,7 @@ static void Task_HandleSwapScreenYesNo(u8 taskId)
|
|||||||
gTasks[taskId].func = (void*)((hiPtr << 16) | loPtr);
|
gTasks[taskId].func = (void*)((hiPtr << 16) | loPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
gTasks[taskId].data[1] = 0;
|
gTasks[taskId].data[1] = 0;
|
||||||
@ -2389,12 +2389,12 @@ static void Task_HandleSwapScreenYesNo(u8 taskId)
|
|||||||
loPtr = gTasks[taskId].data[7];
|
loPtr = gTasks[taskId].data[7];
|
||||||
gTasks[taskId].func = (void*)((hiPtr << 16) | loPtr);
|
gTasks[taskId].func = (void*)((hiPtr << 16) | loPtr);
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_UP))
|
else if (gMain.newAndRepeatedKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
Swap_UpdateYesNoCursorPosition(-1);
|
Swap_UpdateYesNoCursorPosition(-1);
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_DOWN))
|
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
Swap_UpdateYesNoCursorPosition(1);
|
Swap_UpdateYesNoCursorPosition(1);
|
||||||
@ -2485,12 +2485,12 @@ static void Task_HandleSwapScreenMenu(u8 taskId)
|
|||||||
case 3:
|
case 3:
|
||||||
if (sFactorySwapScreen->unk30 != TRUE)
|
if (sFactorySwapScreen->unk30 != TRUE)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
Swap_RunMenuOptionFunc(taskId);
|
Swap_RunMenuOptionFunc(taskId);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
sub_819F3F8(sFactorySwapScreen->unk2C, &sFactorySwapScreen->unk30, TRUE);
|
sub_819F3F8(sFactorySwapScreen->unk2C, &sFactorySwapScreen->unk30, TRUE);
|
||||||
@ -2501,11 +2501,11 @@ static void Task_HandleSwapScreenMenu(u8 taskId)
|
|||||||
gTasks[taskId].data[5] = 1;
|
gTasks[taskId].data[5] = 1;
|
||||||
gTasks[taskId].func = sub_819D770;
|
gTasks[taskId].func = sub_819D770;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_UP))
|
else if (gMain.newAndRepeatedKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
Swap_UpdateMenuCursorPosition(-1);
|
Swap_UpdateMenuCursorPosition(-1);
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_DOWN))
|
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
Swap_UpdateMenuCursorPosition(1);
|
Swap_UpdateMenuCursorPosition(1);
|
||||||
}
|
}
|
||||||
@ -2526,7 +2526,7 @@ static void Task_HandleSwapScreenChooseMons(u8 taskId)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
sFactorySwapScreen->unk22 = FALSE;
|
sFactorySwapScreen->unk22 = FALSE;
|
||||||
@ -2534,7 +2534,7 @@ static void Task_HandleSwapScreenChooseMons(u8 taskId)
|
|||||||
sub_819EAC0();
|
sub_819EAC0();
|
||||||
Swap_RunActionFunc(taskId);
|
Swap_RunActionFunc(taskId);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
sFactorySwapScreen->unk22 = FALSE;
|
sFactorySwapScreen->unk22 = FALSE;
|
||||||
@ -2546,25 +2546,25 @@ static void Task_HandleSwapScreenChooseMons(u8 taskId)
|
|||||||
gTasks[taskId].data[5] = 0;
|
gTasks[taskId].data[5] = 0;
|
||||||
gTasks[taskId].func = sub_819D588;
|
gTasks[taskId].func = sub_819D588;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_LEFT))
|
else if (gMain.newAndRepeatedKeys & DPAD_LEFT)
|
||||||
{
|
{
|
||||||
Swap_UpdateBallCursorPosition(-1);
|
Swap_UpdateBallCursorPosition(-1);
|
||||||
Swap_PrintMonCategory();
|
Swap_PrintMonCategory();
|
||||||
Swap_PrintMonSpecies();
|
Swap_PrintMonSpecies();
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_RIGHT))
|
else if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
|
||||||
{
|
{
|
||||||
Swap_UpdateBallCursorPosition(1);
|
Swap_UpdateBallCursorPosition(1);
|
||||||
Swap_PrintMonCategory();
|
Swap_PrintMonCategory();
|
||||||
Swap_PrintMonSpecies();
|
Swap_PrintMonSpecies();
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_DOWN))
|
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
Swap_UpdateActionCursorPosition(1);
|
Swap_UpdateActionCursorPosition(1);
|
||||||
Swap_PrintMonCategory();
|
Swap_PrintMonCategory();
|
||||||
Swap_PrintMonSpecies();
|
Swap_PrintMonSpecies();
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_UP))
|
else if (gMain.newAndRepeatedKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
Swap_UpdateActionCursorPosition(-1);
|
Swap_UpdateActionCursorPosition(-1);
|
||||||
Swap_PrintMonCategory();
|
Swap_PrintMonCategory();
|
||||||
@ -3929,7 +3929,7 @@ static void Task_SwapCantHaveSameMons(u8 taskId)
|
|||||||
gTasks[taskId].data[0]++;
|
gTasks[taskId].data[0]++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
sub_819F3F8(sFactorySwapScreen->unk2C, &sFactorySwapScreen->unk30, TRUE);
|
sub_819F3F8(sFactorySwapScreen->unk2C, &sFactorySwapScreen->unk30, TRUE);
|
||||||
|
@ -957,7 +957,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform
|
|||||||
}
|
}
|
||||||
|
|
||||||
src = gMonSpritesGfxPtr->sprites[position];
|
src = gMonSpritesGfxPtr->sprites[position];
|
||||||
dst = (void *)(OBJ_VRAM0 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32);
|
dst = (void *)(VRAM + 0x10000 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32);
|
||||||
DmaCopy32(3, src, dst, 0x800);
|
DmaCopy32(3, src, dst, 0x800);
|
||||||
paletteOffset = 0x100 + battlerAtk * 16;
|
paletteOffset = 0x100 + battlerAtk * 16;
|
||||||
lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue);
|
lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue);
|
||||||
@ -1014,7 +1014,9 @@ void BattleLoadSubstituteOrMonSpriteGfx(u8 battlerId, bool8 loadMonSprite)
|
|||||||
palOffset = (battlerId * 16) + 0x100;
|
palOffset = (battlerId * 16) + 0x100;
|
||||||
LoadCompressedPalette(gSubstituteDollPal, palOffset, 32);
|
LoadCompressedPalette(gSubstituteDollPal, palOffset, 32);
|
||||||
}
|
}
|
||||||
else if (!IsContest())
|
else
|
||||||
|
{
|
||||||
|
if (!IsContest())
|
||||||
{
|
{
|
||||||
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
|
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
|
||||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||||
@ -1022,6 +1024,7 @@ void BattleLoadSubstituteOrMonSpriteGfx(u8 battlerId, bool8 loadMonSprite)
|
|||||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LoadBattleMonGfxAndAnimate(u8 battlerId, bool8 loadMonSprite, u8 spriteId)
|
void LoadBattleMonGfxAndAnimate(u8 battlerId, bool8 loadMonSprite, u8 spriteId)
|
||||||
{
|
{
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2995,7 +2995,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId)
|
|||||||
printerTemplate.currentY = printerTemplate.y;
|
printerTemplate.currentY = printerTemplate.y;
|
||||||
printerTemplate.letterSpacing = textInfo[windowId].letterSpacing;
|
printerTemplate.letterSpacing = textInfo[windowId].letterSpacing;
|
||||||
printerTemplate.lineSpacing = textInfo[windowId].lineSpacing;
|
printerTemplate.lineSpacing = textInfo[windowId].lineSpacing;
|
||||||
printerTemplate.style = 0;
|
printerTemplate.unk = 0;
|
||||||
printerTemplate.fgColor = textInfo[windowId].fgColor;
|
printerTemplate.fgColor = textInfo[windowId].fgColor;
|
||||||
printerTemplate.bgColor = textInfo[windowId].bgColor;
|
printerTemplate.bgColor = textInfo[windowId].bgColor;
|
||||||
printerTemplate.shadowColor = textInfo[windowId].shadowColor;
|
printerTemplate.shadowColor = textInfo[windowId].shadowColor;
|
||||||
|
@ -523,19 +523,6 @@ static const u8 sTrainerTextGroups[50][2] =
|
|||||||
{FACILITY_CLASS_HIKER, 4},
|
{FACILITY_CLASS_HIKER, 4},
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
HINT_EXIT_DIRECTION,
|
|
||||||
HINT_REMAINING_ITEMS,
|
|
||||||
HINT_REMAINING_TRAINERS,
|
|
||||||
HINT_EXIT_SHORT_REMAINING_TRAINERS,
|
|
||||||
HINT_EXIT_SHORT_REMAINING_ITEMS,
|
|
||||||
HINT_EXIT_MEDIUM_REMAINING_TRAINERS,
|
|
||||||
HINT_EXIT_MEDIUM_REMAINING_ITEMS,
|
|
||||||
HINT_EXIT_FAR_REMAINING_TRAINERS,
|
|
||||||
HINT_EXIT_FAR_REMAINING_ITEMS,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const u8 *const sExitDirectionHintTexts1[] =
|
static const u8 *const sExitDirectionHintTexts1[] =
|
||||||
{
|
{
|
||||||
BattlePyramid_Text_ExitHintUp1,
|
BattlePyramid_Text_ExitHintUp1,
|
||||||
|
@ -839,7 +839,7 @@ static void Task_HandlePyramidBagInput(u8 taskId)
|
|||||||
s16 *data = gTasks[taskId].data;
|
s16 *data = gTasks[taskId].data;
|
||||||
if (MenuHelpers_CallLinkSomething() != TRUE && !gPaletteFade.active)
|
if (MenuHelpers_CallLinkSomething() != TRUE && !gPaletteFade.active)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(SELECT_BUTTON))
|
if (gMain.newKeys & SELECT_BUTTON)
|
||||||
{
|
{
|
||||||
if (gPyramidBagCursorData.unk4 != 2)
|
if (gPyramidBagCursorData.unk4 != 2)
|
||||||
{
|
{
|
||||||
@ -965,7 +965,7 @@ static void HandleMenuActionInput(u8 taskId)
|
|||||||
if (MenuHelpers_CallLinkSomething() != TRUE)
|
if (MenuHelpers_CallLinkSomething() != TRUE)
|
||||||
{
|
{
|
||||||
s8 id = Menu_GetCursorPos();
|
s8 id = Menu_GetCursorPos();
|
||||||
if (JOY_NEW(DPAD_UP))
|
if (gMain.newKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
if (id > 0 && IsValidMenuAction(id - 2))
|
if (id > 0 && IsValidMenuAction(id - 2))
|
||||||
{
|
{
|
||||||
@ -973,7 +973,7 @@ static void HandleMenuActionInput(u8 taskId)
|
|||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_UP);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_UP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_DOWN))
|
else if (gMain.newKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
if (id < gPyramidBagResources->menuActionsCount - 2 && IsValidMenuAction(id + 2))
|
if (id < gPyramidBagResources->menuActionsCount - 2 && IsValidMenuAction(id + 2))
|
||||||
{
|
{
|
||||||
@ -981,7 +981,7 @@ static void HandleMenuActionInput(u8 taskId)
|
|||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_DOWN);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_DOWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_LEFT) || GetLRKeysPressed() == MENU_L_PRESSED)
|
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysPressed() == MENU_L_PRESSED)
|
||||||
{
|
{
|
||||||
if (id & 1 && IsValidMenuAction(id - 1))
|
if (id & 1 && IsValidMenuAction(id - 1))
|
||||||
{
|
{
|
||||||
@ -989,7 +989,7 @@ static void HandleMenuActionInput(u8 taskId)
|
|||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_LEFT, MENU_CURSOR_DELTA_NONE);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_LEFT, MENU_CURSOR_DELTA_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
|
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysPressed() == MENU_R_PRESSED)
|
||||||
{
|
{
|
||||||
if (!(id & 1) && IsValidMenuAction(id + 1))
|
if (!(id & 1) && IsValidMenuAction(id + 1))
|
||||||
{
|
{
|
||||||
@ -997,13 +997,13 @@ static void HandleMenuActionInput(u8 taskId)
|
|||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_RIGHT, MENU_CURSOR_DELTA_NONE);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_RIGHT, MENU_CURSOR_DELTA_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(A_BUTTON))
|
else if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
if (sMenuActions[gPyramidBagResources->menuActionIds[id]].func.void_u8 != NULL)
|
if (sMenuActions[gPyramidBagResources->menuActionIds[id]].func.void_u8 != NULL)
|
||||||
sMenuActions[gPyramidBagResources->menuActionIds[id]].func.void_u8(taskId);
|
sMenuActions[gPyramidBagResources->menuActionIds[id]].func.void_u8(taskId);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
sMenuActions[ACTION_CANCEL].func.void_u8(taskId);
|
sMenuActions[ACTION_CANCEL].func.void_u8(taskId);
|
||||||
@ -1143,7 +1143,7 @@ static void sub_81C64B4(u8 taskId)
|
|||||||
{
|
{
|
||||||
sub_81C645C(data[8]);
|
sub_81C645C(data[8]);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(A_BUTTON))
|
else if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
ClearStdWindowAndFrameToTransparent(3, 0);
|
ClearStdWindowAndFrameToTransparent(3, 0);
|
||||||
@ -1151,7 +1151,7 @@ static void sub_81C64B4(u8 taskId)
|
|||||||
ScheduleBgCopyTilemapToVram(1);
|
ScheduleBgCopyTilemapToVram(1);
|
||||||
sub_81C6350(taskId);
|
sub_81C6350(taskId);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
ClearStdWindowAndFrameToTransparent(3, 0);
|
ClearStdWindowAndFrameToTransparent(3, 0);
|
||||||
@ -1179,7 +1179,7 @@ static void sub_81C65CC(u8 taskId)
|
|||||||
u16 *scrollOffset = &gPyramidBagCursorData.scrollPosition;
|
u16 *scrollOffset = &gPyramidBagCursorData.scrollPosition;
|
||||||
u16 *selectedRow = &gPyramidBagCursorData.cursorPosition;
|
u16 *selectedRow = &gPyramidBagCursorData.cursorPosition;
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
RemovePyramidBagItem(gSpecialVar_ItemId, data[8]);
|
RemovePyramidBagItem(gSpecialVar_ItemId, data[8]);
|
||||||
@ -1220,7 +1220,7 @@ static void sub_81C66AC(u8 taskId)
|
|||||||
|
|
||||||
static void sub_81C66EC(u8 taskId)
|
static void sub_81C66EC(u8 taskId)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
Task_CloseBattlePyramidBagMessage(taskId);
|
Task_CloseBattlePyramidBagMessage(taskId);
|
||||||
@ -1277,7 +1277,7 @@ static void Task_ItemSwapHandleInput(u8 taskId)
|
|||||||
s16 *data = gTasks[taskId].data;
|
s16 *data = gTasks[taskId].data;
|
||||||
if (MenuHelpers_CallLinkSomething() != TRUE)
|
if (MenuHelpers_CallLinkSomething() != TRUE)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(SELECT_BUTTON))
|
if (gMain.newKeys & SELECT_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
ListMenuGetScrollAndRow(data[0], &gPyramidBagCursorData.scrollPosition, &gPyramidBagCursorData.cursorPosition);
|
ListMenuGetScrollAndRow(data[0], &gPyramidBagCursorData.scrollPosition, &gPyramidBagCursorData.cursorPosition);
|
||||||
@ -1295,7 +1295,7 @@ static void Task_ItemSwapHandleInput(u8 taskId)
|
|||||||
break;
|
break;
|
||||||
case LIST_CANCEL:
|
case LIST_CANCEL:
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
PerformItemSwap(taskId);
|
PerformItemSwap(taskId);
|
||||||
else
|
else
|
||||||
sub_81C6A14(taskId);
|
sub_81C6A14(taskId);
|
||||||
|
@ -356,7 +356,7 @@ static void Task_CloseTrainerHillRecordsOnButton(u8 taskId)
|
|||||||
{
|
{
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
task->func = Task_BeginPaletteFade;
|
task->func = Task_BeginPaletteFade;
|
||||||
@ -485,7 +485,7 @@ static void CB2_ShowTrainerHillRecords(void)
|
|||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
sTilemapBuffer = AllocZeroed(BG_SCREEN_SIZE);
|
sTilemapBuffer = AllocZeroed(0x800);
|
||||||
ResetBgsAndClearDma3BusyFlags(0);
|
ResetBgsAndClearDma3BusyFlags(0);
|
||||||
InitBgsFromTemplates(0, sTrainerHillRecordsBgTemplates, ARRAY_COUNT(sTrainerHillRecordsBgTemplates));
|
InitBgsFromTemplates(0, sTrainerHillRecordsBgTemplates, ARRAY_COUNT(sTrainerHillRecordsBgTemplates));
|
||||||
SetBgTilemapBuffer(3, sTilemapBuffer);
|
SetBgTilemapBuffer(3, sTilemapBuffer);
|
||||||
|
@ -3489,6 +3489,7 @@ static void Cmd_getexp(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NONMATCHING
|
||||||
static void Cmd_unknown_24(void)
|
static void Cmd_unknown_24(void)
|
||||||
{
|
{
|
||||||
u16 HP_count = 0;
|
u16 HP_count = 0;
|
||||||
@ -3520,9 +3521,7 @@ static void Cmd_unknown_24(void)
|
|||||||
if (HP_count == 0)
|
if (HP_count == 0)
|
||||||
gBattleOutcome |= B_OUTCOME_LOST;
|
gBattleOutcome |= B_OUTCOME_LOST;
|
||||||
|
|
||||||
HP_count = 0;
|
for (HP_count = 0, i = 0; i < PARTY_SIZE; i++)
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
|
||||||
{
|
{
|
||||||
if (GetMonData(&gEnemyParty[i], MON_DATA_SPECIES) && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG)
|
if (GetMonData(&gEnemyParty[i], MON_DATA_SPECIES) && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG)
|
||||||
&& (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostOpponentMons & gBitTable[i])))
|
&& (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostOpponentMons & gBitTable[i])))
|
||||||
@ -3536,31 +3535,33 @@ static void Cmd_unknown_24(void)
|
|||||||
|
|
||||||
if (gBattleOutcome == 0 && (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)))
|
if (gBattleOutcome == 0 && (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)))
|
||||||
{
|
{
|
||||||
s32 foundPlayer = 0, foundOpponent;
|
s32 foundPlayer;
|
||||||
for (i = 0; i < gBattlersCount; i += 2)
|
s32 foundOpponent;
|
||||||
|
|
||||||
|
// Impossible to decompile loops.
|
||||||
|
for (foundPlayer = 0, i = 0; i < gBattlersCount; i += 2)
|
||||||
{
|
{
|
||||||
if ((gHitMarker & HITMARKER_FAINTED2(i)) && (!gSpecialStatuses[i].flag40))
|
if (HITMARKER_FAINTED2(i) & gHitMarker && !gSpecialStatuses[i].flag40)
|
||||||
foundPlayer++;
|
foundPlayer++;
|
||||||
}
|
}
|
||||||
|
|
||||||
foundOpponent = 0;
|
for (foundOpponent = 0, i = 1; i < gBattlersCount; i += 2)
|
||||||
for (i = 1; i < gBattlersCount; i += 2)
|
|
||||||
{
|
{
|
||||||
if ((gHitMarker & HITMARKER_FAINTED2(i)) && (!gSpecialStatuses[i].flag40))
|
if (HITMARKER_FAINTED2(i) & gHitMarker && !gSpecialStatuses[i].flag40)
|
||||||
foundOpponent++;
|
foundOpponent++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||||
{
|
{
|
||||||
if (foundOpponent + foundPlayer > 1)
|
if (foundOpponent + foundPlayer > 1)
|
||||||
gBattlescriptCurrInstr = (u8*) T2_READ_32(gBattlescriptCurrInstr + 1);
|
gBattlescriptCurrInstr = T2_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||||
else
|
else
|
||||||
gBattlescriptCurrInstr += 5;
|
gBattlescriptCurrInstr += 5;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (foundOpponent != 0 && foundPlayer != 0)
|
if (foundOpponent != 0 && foundPlayer != 0)
|
||||||
gBattlescriptCurrInstr = (u8*) T2_READ_32(gBattlescriptCurrInstr + 1);
|
gBattlescriptCurrInstr = T2_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||||
else
|
else
|
||||||
gBattlescriptCurrInstr += 5;
|
gBattlescriptCurrInstr += 5;
|
||||||
}
|
}
|
||||||
@ -3570,6 +3571,301 @@ static void Cmd_unknown_24(void)
|
|||||||
gBattlescriptCurrInstr += 5;
|
gBattlescriptCurrInstr += 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
static void Cmd_unknown_24(void)
|
||||||
|
{
|
||||||
|
asm("\n\
|
||||||
|
.syntax unified\n\
|
||||||
|
push {r4-r7,lr}\n\
|
||||||
|
mov r7, r8\n\
|
||||||
|
push {r7}\n\
|
||||||
|
movs r6, 0\n\
|
||||||
|
ldr r0, =gBattleControllerExecFlags\n\
|
||||||
|
ldr r0, [r0]\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0804ACE2\n\
|
||||||
|
b _0804AF22\n\
|
||||||
|
_0804ACE2:\n\
|
||||||
|
ldr r0, =gBattleTypeFlags\n\
|
||||||
|
ldr r0, [r0]\n\
|
||||||
|
movs r1, 0x80\n\
|
||||||
|
lsls r1, 15\n\
|
||||||
|
ands r0, r1\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0804AD48\n\
|
||||||
|
ldr r0, =gPartnerTrainerId\n\
|
||||||
|
ldrh r1, [r0]\n\
|
||||||
|
ldr r0, =0x00000c03\n\
|
||||||
|
cmp r1, r0\n\
|
||||||
|
bne _0804AD48\n\
|
||||||
|
movs r5, 0\n\
|
||||||
|
_0804ACFC:\n\
|
||||||
|
movs r0, 0x64\n\
|
||||||
|
adds r1, r5, 0\n\
|
||||||
|
muls r1, r0\n\
|
||||||
|
ldr r0, =gPlayerParty\n\
|
||||||
|
adds r4, r1, r0\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0xB\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0804AD2C\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0x2D\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
bne _0804AD2C\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0x39\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
adds r0, r6, r0\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r6, r0, 16\n\
|
||||||
|
_0804AD2C:\n\
|
||||||
|
adds r5, 0x1\n\
|
||||||
|
cmp r5, 0x2\n\
|
||||||
|
ble _0804ACFC\n\
|
||||||
|
b _0804ADA8\n\
|
||||||
|
.pool\n\
|
||||||
|
_0804AD48:\n\
|
||||||
|
movs r5, 0\n\
|
||||||
|
_0804AD4A:\n\
|
||||||
|
movs r0, 0x64\n\
|
||||||
|
adds r1, r5, 0\n\
|
||||||
|
muls r1, r0\n\
|
||||||
|
ldr r0, =gPlayerParty\n\
|
||||||
|
adds r4, r1, r0\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0xB\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0804ADA2\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0x2D\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
bne _0804ADA2\n\
|
||||||
|
ldr r0, =gBattleTypeFlags\n\
|
||||||
|
ldr r0, [r0]\n\
|
||||||
|
movs r1, 0x80\n\
|
||||||
|
lsls r1, 11\n\
|
||||||
|
ands r0, r1\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0804AD94\n\
|
||||||
|
ldr r0, =gBattleStruct\n\
|
||||||
|
ldr r0, [r0]\n\
|
||||||
|
movs r1, 0xA8\n\
|
||||||
|
lsls r1, 2\n\
|
||||||
|
adds r0, r1\n\
|
||||||
|
ldrb r1, [r0]\n\
|
||||||
|
ldr r2, =gBitTable\n\
|
||||||
|
lsls r0, r5, 2\n\
|
||||||
|
adds r0, r2\n\
|
||||||
|
ldr r0, [r0]\n\
|
||||||
|
ands r1, r0\n\
|
||||||
|
cmp r1, 0\n\
|
||||||
|
bne _0804ADA2\n\
|
||||||
|
_0804AD94:\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0x39\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
adds r0, r6, r0\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r6, r0, 16\n\
|
||||||
|
_0804ADA2:\n\
|
||||||
|
adds r5, 0x1\n\
|
||||||
|
cmp r5, 0x5\n\
|
||||||
|
ble _0804AD4A\n\
|
||||||
|
_0804ADA8:\n\
|
||||||
|
cmp r6, 0\n\
|
||||||
|
bne _0804ADB6\n\
|
||||||
|
ldr r0, =gBattleOutcome\n\
|
||||||
|
ldrb r1, [r0]\n\
|
||||||
|
movs r2, 0x2\n\
|
||||||
|
orrs r1, r2\n\
|
||||||
|
strb r1, [r0]\n\
|
||||||
|
_0804ADB6:\n\
|
||||||
|
movs r6, 0\n\
|
||||||
|
movs r5, 0\n\
|
||||||
|
_0804ADBA:\n\
|
||||||
|
movs r0, 0x64\n\
|
||||||
|
adds r1, r5, 0\n\
|
||||||
|
muls r1, r0\n\
|
||||||
|
ldr r0, =gEnemyParty\n\
|
||||||
|
adds r4, r1, r0\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0xB\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0804AE10\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0x2D\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
bne _0804AE10\n\
|
||||||
|
ldr r0, =gBattleTypeFlags\n\
|
||||||
|
ldr r0, [r0]\n\
|
||||||
|
movs r1, 0x80\n\
|
||||||
|
lsls r1, 11\n\
|
||||||
|
ands r0, r1\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0804AE02\n\
|
||||||
|
ldr r0, =gBattleStruct\n\
|
||||||
|
ldr r0, [r0]\n\
|
||||||
|
ldr r1, =0x000002a1\n\
|
||||||
|
adds r0, r1\n\
|
||||||
|
ldrb r1, [r0]\n\
|
||||||
|
ldr r2, =gBitTable\n\
|
||||||
|
lsls r0, r5, 2\n\
|
||||||
|
adds r0, r2\n\
|
||||||
|
ldr r0, [r0]\n\
|
||||||
|
ands r1, r0\n\
|
||||||
|
cmp r1, 0\n\
|
||||||
|
bne _0804AE10\n\
|
||||||
|
_0804AE02:\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0x39\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
adds r0, r6, r0\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r6, r0, 16\n\
|
||||||
|
_0804AE10:\n\
|
||||||
|
adds r5, 0x1\n\
|
||||||
|
cmp r5, 0x5\n\
|
||||||
|
ble _0804ADBA\n\
|
||||||
|
ldr r2, =gBattleOutcome\n\
|
||||||
|
cmp r6, 0\n\
|
||||||
|
bne _0804AE24\n\
|
||||||
|
ldrb r0, [r2]\n\
|
||||||
|
movs r1, 0x1\n\
|
||||||
|
orrs r0, r1\n\
|
||||||
|
strb r0, [r2]\n\
|
||||||
|
_0804AE24:\n\
|
||||||
|
ldrb r0, [r2]\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
bne _0804AF1A\n\
|
||||||
|
ldr r0, =gBattleTypeFlags\n\
|
||||||
|
ldr r1, [r0]\n\
|
||||||
|
ldr r2, =0x02000002\n\
|
||||||
|
ands r1, r2\n\
|
||||||
|
mov r8, r0\n\
|
||||||
|
cmp r1, 0\n\
|
||||||
|
beq _0804AF1A\n\
|
||||||
|
movs r3, 0\n\
|
||||||
|
movs r5, 0\n\
|
||||||
|
ldr r0, =gBattlersCount\n\
|
||||||
|
ldrb r1, [r0]\n\
|
||||||
|
mov r12, r0\n\
|
||||||
|
ldr r7, =gBattlescriptCurrInstr\n\
|
||||||
|
cmp r3, r1\n\
|
||||||
|
bge _0804AE70\n\
|
||||||
|
ldr r0, =gHitMarker\n\
|
||||||
|
movs r6, 0x80\n\
|
||||||
|
lsls r6, 21\n\
|
||||||
|
ldr r4, [r0]\n\
|
||||||
|
adds r2, r1, 0\n\
|
||||||
|
ldr r1, =gSpecialStatuses\n\
|
||||||
|
_0804AE54:\n\
|
||||||
|
adds r0, r6, 0\n\
|
||||||
|
lsls r0, r5\n\
|
||||||
|
ands r0, r4\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0804AE68\n\
|
||||||
|
ldrb r0, [r1]\n\
|
||||||
|
lsls r0, 25\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
blt _0804AE68\n\
|
||||||
|
adds r3, 0x1\n\
|
||||||
|
_0804AE68:\n\
|
||||||
|
adds r1, 0x28\n\
|
||||||
|
adds r5, 0x2\n\
|
||||||
|
cmp r5, r2\n\
|
||||||
|
blt _0804AE54\n\
|
||||||
|
_0804AE70:\n\
|
||||||
|
movs r2, 0\n\
|
||||||
|
movs r5, 0x1\n\
|
||||||
|
mov r4, r12\n\
|
||||||
|
ldrb r1, [r4]\n\
|
||||||
|
cmp r5, r1\n\
|
||||||
|
bge _0804AEAA\n\
|
||||||
|
ldr r0, =gHitMarker\n\
|
||||||
|
movs r4, 0x80\n\
|
||||||
|
lsls r4, 21\n\
|
||||||
|
mov r12, r4\n\
|
||||||
|
ldr r6, [r0]\n\
|
||||||
|
ldr r0, =gSpecialStatuses\n\
|
||||||
|
adds r4, r1, 0\n\
|
||||||
|
adds r1, r0, 0\n\
|
||||||
|
adds r1, 0x14\n\
|
||||||
|
_0804AE8E:\n\
|
||||||
|
mov r0, r12\n\
|
||||||
|
lsls r0, r5\n\
|
||||||
|
ands r0, r6\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0804AEA2\n\
|
||||||
|
ldrb r0, [r1]\n\
|
||||||
|
lsls r0, 25\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
blt _0804AEA2\n\
|
||||||
|
adds r2, 0x1\n\
|
||||||
|
_0804AEA2:\n\
|
||||||
|
adds r1, 0x28\n\
|
||||||
|
adds r5, 0x2\n\
|
||||||
|
cmp r5, r4\n\
|
||||||
|
blt _0804AE8E\n\
|
||||||
|
_0804AEAA:\n\
|
||||||
|
mov r1, r8\n\
|
||||||
|
ldr r0, [r1]\n\
|
||||||
|
movs r1, 0x40\n\
|
||||||
|
ands r0, r1\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0804AEF0\n\
|
||||||
|
adds r0, r2, r3\n\
|
||||||
|
cmp r0, 0x1\n\
|
||||||
|
bgt _0804AEF8\n\
|
||||||
|
b _0804AF12\n\
|
||||||
|
.pool\n\
|
||||||
|
_0804AEF0:\n\
|
||||||
|
cmp r2, 0\n\
|
||||||
|
beq _0804AF12\n\
|
||||||
|
cmp r3, 0\n\
|
||||||
|
beq _0804AF12\n\
|
||||||
|
_0804AEF8:\n\
|
||||||
|
ldr r2, [r7]\n\
|
||||||
|
ldrb r1, [r2, 0x1]\n\
|
||||||
|
ldrb r0, [r2, 0x2]\n\
|
||||||
|
lsls r0, 8\n\
|
||||||
|
adds r1, r0\n\
|
||||||
|
ldrb r0, [r2, 0x3]\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
adds r1, r0\n\
|
||||||
|
ldrb r0, [r2, 0x4]\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
adds r1, r0\n\
|
||||||
|
str r1, [r7]\n\
|
||||||
|
b _0804AF22\n\
|
||||||
|
_0804AF12:\n\
|
||||||
|
ldr r0, [r7]\n\
|
||||||
|
adds r0, 0x5\n\
|
||||||
|
str r0, [r7]\n\
|
||||||
|
b _0804AF22\n\
|
||||||
|
_0804AF1A:\n\
|
||||||
|
ldr r1, =gBattlescriptCurrInstr\n\
|
||||||
|
ldr r0, [r1]\n\
|
||||||
|
adds r0, 0x5\n\
|
||||||
|
str r0, [r1]\n\
|
||||||
|
_0804AF22:\n\
|
||||||
|
pop {r3}\n\
|
||||||
|
mov r8, r3\n\
|
||||||
|
pop {r4-r7}\n\
|
||||||
|
pop {r0}\n\
|
||||||
|
bx r0\n\
|
||||||
|
.pool\n\
|
||||||
|
.syntax divided");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // NONMATCHING
|
||||||
|
|
||||||
static void MoveValuesCleanUp(void)
|
static void MoveValuesCleanUp(void)
|
||||||
{
|
{
|
||||||
@ -4661,10 +4957,8 @@ static void Cmd_jumpifcantswitch(void)
|
|||||||
|| (gStatuses3[gActiveBattler] & STATUS3_ROOTED)))
|
|| (gStatuses3[gActiveBattler] & STATUS3_ROOTED)))
|
||||||
{
|
{
|
||||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
|
|
||||||
{
|
{
|
||||||
#ifndef NONMATCHING
|
#ifndef NONMATCHING
|
||||||
asm("":::"r5");
|
asm("":::"r5");
|
||||||
@ -5362,21 +5656,21 @@ static void Cmd_yesnoboxlearnmove(void)
|
|||||||
BattleCreateYesNoCursorAt(0);
|
BattleCreateYesNoCursorAt(0);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (JOY_NEW(DPAD_UP) && gBattleCommunication[CURSOR_POSITION] != 0)
|
if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
||||||
gBattleCommunication[CURSOR_POSITION] = 0;
|
gBattleCommunication[CURSOR_POSITION] = 0;
|
||||||
BattleCreateYesNoCursorAt(0);
|
BattleCreateYesNoCursorAt(0);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(DPAD_DOWN) && gBattleCommunication[CURSOR_POSITION] == 0)
|
if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
||||||
gBattleCommunication[CURSOR_POSITION] = 1;
|
gBattleCommunication[CURSOR_POSITION] = 1;
|
||||||
BattleCreateYesNoCursorAt(1);
|
BattleCreateYesNoCursorAt(1);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
if (gBattleCommunication[1] == 0)
|
if (gBattleCommunication[1] == 0)
|
||||||
@ -5390,7 +5684,7 @@ static void Cmd_yesnoboxlearnmove(void)
|
|||||||
gBattleScripting.learnMoveState = 5;
|
gBattleScripting.learnMoveState = 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
gBattleScripting.learnMoveState = 5;
|
gBattleScripting.learnMoveState = 5;
|
||||||
@ -5479,21 +5773,21 @@ static void Cmd_yesnoboxstoplearningmove(void)
|
|||||||
BattleCreateYesNoCursorAt(0);
|
BattleCreateYesNoCursorAt(0);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (JOY_NEW(DPAD_UP) && gBattleCommunication[CURSOR_POSITION] != 0)
|
if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
||||||
gBattleCommunication[CURSOR_POSITION] = 0;
|
gBattleCommunication[CURSOR_POSITION] = 0;
|
||||||
BattleCreateYesNoCursorAt(0);
|
BattleCreateYesNoCursorAt(0);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(DPAD_DOWN) && gBattleCommunication[CURSOR_POSITION] == 0)
|
if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
||||||
gBattleCommunication[CURSOR_POSITION] = 1;
|
gBattleCommunication[CURSOR_POSITION] = 1;
|
||||||
BattleCreateYesNoCursorAt(1);
|
BattleCreateYesNoCursorAt(1);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
|
|
||||||
@ -5504,7 +5798,7 @@ static void Cmd_yesnoboxstoplearningmove(void)
|
|||||||
|
|
||||||
HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, WINDOW_CLEAR);
|
HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, WINDOW_CLEAR);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||||
@ -5537,8 +5831,8 @@ static void Cmd_hitanimation(void)
|
|||||||
static u32 GetTrainerMoneyToGive(u16 trainerId)
|
static u32 GetTrainerMoneyToGive(u16 trainerId)
|
||||||
{
|
{
|
||||||
u32 i = 0;
|
u32 i = 0;
|
||||||
u32 moneyReward;
|
u32 lastMonLevel = 0;
|
||||||
u8 lastMonLevel = 0;
|
u32 moneyReward = 0;
|
||||||
|
|
||||||
if (trainerId == TRAINER_SECRET_BASE)
|
if (trainerId == TRAINER_SECRET_BASE)
|
||||||
{
|
{
|
||||||
@ -5774,28 +6068,28 @@ static void Cmd_yesnobox(void)
|
|||||||
BattleCreateYesNoCursorAt(0);
|
BattleCreateYesNoCursorAt(0);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (JOY_NEW(DPAD_UP) && gBattleCommunication[CURSOR_POSITION] != 0)
|
if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
||||||
gBattleCommunication[CURSOR_POSITION] = 0;
|
gBattleCommunication[CURSOR_POSITION] = 0;
|
||||||
BattleCreateYesNoCursorAt(0);
|
BattleCreateYesNoCursorAt(0);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(DPAD_DOWN) && gBattleCommunication[CURSOR_POSITION] == 0)
|
if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
||||||
gBattleCommunication[CURSOR_POSITION] = 1;
|
gBattleCommunication[CURSOR_POSITION] = 1;
|
||||||
BattleCreateYesNoCursorAt(1);
|
BattleCreateYesNoCursorAt(1);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
gBattleCommunication[CURSOR_POSITION] = 1;
|
gBattleCommunication[CURSOR_POSITION] = 1;
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
|
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
|
||||||
gBattlescriptCurrInstr++;
|
gBattlescriptCurrInstr++;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(A_BUTTON))
|
else if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
|
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
|
||||||
@ -6038,7 +6332,7 @@ static void PutLevelAndGenderOnLvlUpBox(void)
|
|||||||
printerTemplate.currentY = 0;
|
printerTemplate.currentY = 0;
|
||||||
printerTemplate.letterSpacing = 0;
|
printerTemplate.letterSpacing = 0;
|
||||||
printerTemplate.lineSpacing = 0;
|
printerTemplate.lineSpacing = 0;
|
||||||
printerTemplate.style = 0;
|
printerTemplate.unk = 0;
|
||||||
printerTemplate.fgColor = TEXT_COLOR_WHITE;
|
printerTemplate.fgColor = TEXT_COLOR_WHITE;
|
||||||
printerTemplate.bgColor = TEXT_COLOR_TRANSPARENT;
|
printerTemplate.bgColor = TEXT_COLOR_TRANSPARENT;
|
||||||
printerTemplate.shadowColor = TEXT_COLOR_DARK_GREY;
|
printerTemplate.shadowColor = TEXT_COLOR_DARK_GREY;
|
||||||
@ -7129,12 +7423,18 @@ static void Cmd_forcerandomswitch(void)
|
|||||||
s32 i;
|
s32 i;
|
||||||
s32 battler1PartyId = 0;
|
s32 battler1PartyId = 0;
|
||||||
s32 battler2PartyId = 0;
|
s32 battler2PartyId = 0;
|
||||||
s32 firstMonId;
|
|
||||||
|
#ifdef NONMATCHING
|
||||||
s32 lastMonId = 0; // + 1
|
s32 lastMonId = 0; // + 1
|
||||||
s32 monsCount;
|
#else
|
||||||
|
register s32 lastMonId asm("r8") = 0; // + 1
|
||||||
|
#endif // NONMATCHING
|
||||||
|
|
||||||
|
s32 firstMonId = 0;
|
||||||
|
s32 monsCount = 0;
|
||||||
struct Pokemon* party = NULL;
|
struct Pokemon* party = NULL;
|
||||||
s32 validMons = 0;
|
s32 validMons = 0;
|
||||||
s32 minNeeded;
|
s32 minNeeded = 0;
|
||||||
|
|
||||||
if ((gBattleTypeFlags & BATTLE_TYPE_TRAINER))
|
if ((gBattleTypeFlags & BATTLE_TYPE_TRAINER))
|
||||||
{
|
{
|
||||||
@ -7243,17 +7543,17 @@ static void Cmd_forcerandomswitch(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (TryDoForceSwitchOut())
|
if (TryDoForceSwitchOut())
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
i = Random() % monsCount;
|
i = Random() % monsCount;
|
||||||
i += firstMonId;
|
i += firstMonId;
|
||||||
} while (i == battler2PartyId || i == battler1PartyId);
|
}
|
||||||
} while (GetMonData(&party[i], MON_DATA_SPECIES) == SPECIES_NONE
|
while (i == battler2PartyId
|
||||||
|
|| i == battler1PartyId
|
||||||
|
|| GetMonData(&party[i], MON_DATA_SPECIES) == SPECIES_NONE
|
||||||
|| GetMonData(&party[i], MON_DATA_IS_EGG) == TRUE
|
|| GetMonData(&party[i], MON_DATA_IS_EGG) == TRUE
|
||||||
|| GetMonData(&party[i], MON_DATA_HP) == 0); // Should be one while loop, conjoined by an ||, but that doesn't match. Equivalent logic though
|
|| GetMonData(&party[i], MON_DATA_HP) == 0);
|
||||||
}
|
}
|
||||||
*(gBattleStruct->monToSwitchIntoId + gBattlerTarget) = i;
|
*(gBattleStruct->monToSwitchIntoId + gBattlerTarget) = i;
|
||||||
|
|
||||||
@ -10072,21 +10372,21 @@ static void Cmd_trygivecaughtmonnick(void)
|
|||||||
BattleCreateYesNoCursorAt(0);
|
BattleCreateYesNoCursorAt(0);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (JOY_NEW(DPAD_UP) && gBattleCommunication[CURSOR_POSITION] != 0)
|
if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
||||||
gBattleCommunication[CURSOR_POSITION] = 0;
|
gBattleCommunication[CURSOR_POSITION] = 0;
|
||||||
BattleCreateYesNoCursorAt(0);
|
BattleCreateYesNoCursorAt(0);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(DPAD_DOWN) && gBattleCommunication[CURSOR_POSITION] == 0)
|
if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
|
||||||
gBattleCommunication[CURSOR_POSITION] = 1;
|
gBattleCommunication[CURSOR_POSITION] = 1;
|
||||||
BattleCreateYesNoCursorAt(1);
|
BattleCreateYesNoCursorAt(1);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
if (gBattleCommunication[CURSOR_POSITION] == 0)
|
if (gBattleCommunication[CURSOR_POSITION] == 0)
|
||||||
@ -10099,7 +10399,7 @@ static void Cmd_trygivecaughtmonnick(void)
|
|||||||
gBattleCommunication[MULTIUSE_STATE] = 4;
|
gBattleCommunication[MULTIUSE_STATE] = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
gBattleCommunication[MULTIUSE_STATE] = 4;
|
gBattleCommunication[MULTIUSE_STATE] = 4;
|
||||||
|
@ -1447,7 +1447,7 @@ u8 GetFrontierOpponentClass(u16 trainerId)
|
|||||||
}
|
}
|
||||||
else if (trainerId == TRAINER_FRONTIER_BRAIN)
|
else if (trainerId == TRAINER_FRONTIER_BRAIN)
|
||||||
{
|
{
|
||||||
return GetFrontierBrainTrainerClass(); // This sticks out like a sore thumb, but this is the only other way that matches. Maybe it SHOULD be assigned to ret, or all early returns. I don't know.
|
trainerClass = GetFrontierBrainTrainerClass();
|
||||||
}
|
}
|
||||||
else if (trainerId == TRAINER_STEVEN_PARTNER)
|
else if (trainerId == TRAINER_STEVEN_PARTNER)
|
||||||
{
|
{
|
||||||
@ -1466,6 +1466,9 @@ u8 GetFrontierOpponentClass(u16 trainerId)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
trainerClass = gFacilityClassToTrainerClass[gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].facilityClass];
|
trainerClass = gFacilityClassToTrainerClass[gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].facilityClass];
|
||||||
|
#ifndef NONMATCHING
|
||||||
|
asm("");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1477,6 +1480,9 @@ u8 GetFrontierOpponentClass(u16 trainerId)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
trainerClass = gFacilityClassToTrainerClass[gApprentices[gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].id].facilityClass];
|
trainerClass = gFacilityClassToTrainerClass[gApprentices[gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].id].facilityClass];
|
||||||
|
#ifndef NONMATCHING
|
||||||
|
asm("");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3973,8 +3973,11 @@ static bool8 Phase2_FrontierLogoWave_Func4(struct Task *task)
|
|||||||
|
|
||||||
for (i = 0; i < 160; i++, var6 += var8)
|
for (i = 0; i < 160; i++, var6 += var8)
|
||||||
{
|
{
|
||||||
const u16 index = var6 >> 8;
|
s16 index = var6 / 256;
|
||||||
gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_16 + Sin(index & 0xff, amplitude);
|
#ifndef NONMATCHING
|
||||||
|
asm("");
|
||||||
|
#endif
|
||||||
|
gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_16 + Sin(index, amplitude);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++task->tData3 == 101)
|
if (++task->tData3 == 101)
|
||||||
|
347
src/battle_tv.c
347
src/battle_tv.c
@ -713,18 +713,20 @@ void BattleTv_SetDataBasedOnAnimation(u8 animationId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NONMATCHING
|
||||||
|
// for loop has an unused stack variable
|
||||||
void TryPutLinkBattleTvShowOnAir(void)
|
void TryPutLinkBattleTvShowOnAir(void)
|
||||||
{
|
{
|
||||||
u16 playerBestSpecies = 0, opponentBestSpecies = 0, moveId = 0;
|
u16 playerBestSpecies = 0, opponentBestSpecies = 0;
|
||||||
s16 sum = 0, playerBestSum = 0, opponentBestSum = SHRT_MAX;
|
s16 playerBestSum = 0, opponentBestSum = SHRT_MAX;
|
||||||
u8 playerBestMonId = 0, opponentBestMonId = 0;
|
u8 playerBestMonId = 0, opponentBestMonId = 0;
|
||||||
struct BattleTvMovePoints *movePoints = NULL;
|
struct BattleTvMovePoints *movePoints = NULL;
|
||||||
u8 countPlayer = 0, countOpponent = 0;
|
u8 countPlayer = 0, countOpponent = 0;
|
||||||
u16 species;
|
s16 sum = 0;
|
||||||
|
u16 species = 0;
|
||||||
|
u16 moveId = 0;
|
||||||
s32 i, j;
|
s32 i, j;
|
||||||
|
|
||||||
int zero = 0, one = 1; // stupid variables needed to match. Feel free to get rid of them.
|
|
||||||
|
|
||||||
if (gBattleStruct->anyMonHasTransformed)
|
if (gBattleStruct->anyMonHasTransformed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -746,7 +748,7 @@ void TryPutLinkBattleTvShowOnAir(void)
|
|||||||
if (species != SPECIES_NONE && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG, NULL))
|
if (species != SPECIES_NONE && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG, NULL))
|
||||||
{
|
{
|
||||||
for (sum = 0, j = 0; j < MAX_MON_MOVES; j++)
|
for (sum = 0, j = 0; j < MAX_MON_MOVES; j++)
|
||||||
sum += movePoints->points[zero][i * 4 + j];
|
sum += movePoints->points[0][i * 4 + j];
|
||||||
|
|
||||||
if (playerBestSum < sum)
|
if (playerBestSum < sum)
|
||||||
{
|
{
|
||||||
@ -760,7 +762,7 @@ void TryPutLinkBattleTvShowOnAir(void)
|
|||||||
if (species != SPECIES_NONE && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG, NULL))
|
if (species != SPECIES_NONE && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG, NULL))
|
||||||
{
|
{
|
||||||
for (sum = 0, j = 0; j < MAX_MON_MOVES; j++)
|
for (sum = 0, j = 0; j < MAX_MON_MOVES; j++)
|
||||||
sum += movePoints->points[one][i * 4 + j];
|
sum += movePoints->points[1][i * 4 + j];
|
||||||
|
|
||||||
if (opponentBestSum == sum)
|
if (opponentBestSum == sum)
|
||||||
{
|
{
|
||||||
@ -782,9 +784,9 @@ void TryPutLinkBattleTvShowOnAir(void)
|
|||||||
|
|
||||||
for (sum = 0, i = 0, j = 0; j < MAX_MON_MOVES; j++)
|
for (sum = 0, i = 0, j = 0; j < MAX_MON_MOVES; j++)
|
||||||
{
|
{
|
||||||
if (sum < movePoints->points[zero][playerBestMonId * 4 + j])
|
if (sum < movePoints->points[0][playerBestMonId * 4 + j])
|
||||||
{
|
{
|
||||||
sum = movePoints->points[zero][playerBestMonId * 4 + j];
|
sum = movePoints->points[0][playerBestMonId * 4 + j];
|
||||||
i = j;
|
i = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -808,6 +810,333 @@ void TryPutLinkBattleTvShowOnAir(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
void TryPutLinkBattleTvShowOnAir(void)
|
||||||
|
{
|
||||||
|
asm_unified(
|
||||||
|
"push {r4-r7,lr}\n\
|
||||||
|
mov r7, r10\n\
|
||||||
|
mov r6, r9\n\
|
||||||
|
mov r5, r8\n\
|
||||||
|
push {r5-r7}\n\
|
||||||
|
sub sp, 0x20\n\
|
||||||
|
movs r0, 0\n\
|
||||||
|
str r0, [sp]\n\
|
||||||
|
movs r1, 0\n\
|
||||||
|
str r1, [sp, 0x4]\n\
|
||||||
|
movs r2, 0\n\
|
||||||
|
str r2, [sp, 0x8]\n\
|
||||||
|
ldr r3, =0x00007fff\n\
|
||||||
|
str r3, [sp, 0xC]\n\
|
||||||
|
movs r4, 0\n\
|
||||||
|
str r4, [sp, 0x10]\n\
|
||||||
|
movs r7, 0\n\
|
||||||
|
str r7, [sp, 0x14]\n\
|
||||||
|
mov r8, r0\n\
|
||||||
|
ldr r0, =gBattleStruct\n\
|
||||||
|
ldr r1, [r0]\n\
|
||||||
|
adds r0, r1, 0\n\
|
||||||
|
adds r0, 0xB3\n\
|
||||||
|
ldrb r0, [r0]\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0817E42A\n\
|
||||||
|
b _0817E670\n\
|
||||||
|
_0817E42A:\n\
|
||||||
|
movs r2, 0xD2\n\
|
||||||
|
lsls r2, 1\n\
|
||||||
|
adds r2, r1\n\
|
||||||
|
mov r10, r2\n\
|
||||||
|
movs r6, 0\n\
|
||||||
|
_0817E434:\n\
|
||||||
|
movs r0, 0x64\n\
|
||||||
|
adds r4, r6, 0\n\
|
||||||
|
muls r4, r0\n\
|
||||||
|
ldr r0, =gPlayerParty\n\
|
||||||
|
adds r0, r4, r0\n\
|
||||||
|
movs r1, 0xB\n\
|
||||||
|
movs r2, 0\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0817E454\n\
|
||||||
|
mov r0, r8\n\
|
||||||
|
adds r0, 0x1\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r0, 24\n\
|
||||||
|
mov r8, r0\n\
|
||||||
|
_0817E454:\n\
|
||||||
|
ldr r5, =gEnemyParty\n\
|
||||||
|
adds r0, r4, r5\n\
|
||||||
|
movs r1, 0xB\n\
|
||||||
|
movs r2, 0\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0817E46A\n\
|
||||||
|
adds r0, r7, 0x1\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r7, r0, 24\n\
|
||||||
|
_0817E46A:\n\
|
||||||
|
adds r6, 0x1\n\
|
||||||
|
cmp r6, 0x5\n\
|
||||||
|
ble _0817E434\n\
|
||||||
|
ldr r0, =gBattleTypeFlags\n\
|
||||||
|
ldr r0, [r0]\n\
|
||||||
|
movs r1, 0x2\n\
|
||||||
|
ands r0, r1\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
bne _0817E47E\n\
|
||||||
|
b _0817E670\n\
|
||||||
|
_0817E47E:\n\
|
||||||
|
cmp r8, r7\n\
|
||||||
|
beq _0817E484\n\
|
||||||
|
b _0817E670\n\
|
||||||
|
_0817E484:\n\
|
||||||
|
movs r6, 0\n\
|
||||||
|
lsls r3, r6, 1\n\
|
||||||
|
str r3, [sp, 0x18]\n\
|
||||||
|
movs r4, 0x64\n\
|
||||||
|
mov r8, r4\n\
|
||||||
|
_0817E48E:\n\
|
||||||
|
mov r1, r8\n\
|
||||||
|
muls r1, r6\n\
|
||||||
|
ldr r0, =gPlayerParty\n\
|
||||||
|
adds r4, r1, r0\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0xB\n\
|
||||||
|
movs r2, 0\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r7, r0, 16\n\
|
||||||
|
adds r0, r6, 0x1\n\
|
||||||
|
mov r9, r0\n\
|
||||||
|
cmp r7, 0\n\
|
||||||
|
beq _0817E4EE\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0x2D\n\
|
||||||
|
movs r2, 0\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
bne _0817E4EE\n\
|
||||||
|
movs r4, 0\n\
|
||||||
|
lsls r0, r6, 3\n\
|
||||||
|
mov r2, r10\n\
|
||||||
|
adds r1, r0, r2\n\
|
||||||
|
movs r3, 0x3\n\
|
||||||
|
_0817E4C4:\n\
|
||||||
|
lsls r0, r4, 16\n\
|
||||||
|
asrs r0, 16\n\
|
||||||
|
ldrh r4, [r1]\n\
|
||||||
|
adds r0, r4\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r4, r0, 16\n\
|
||||||
|
adds r1, 0x2\n\
|
||||||
|
subs r3, 0x1\n\
|
||||||
|
cmp r3, 0\n\
|
||||||
|
bge _0817E4C4\n\
|
||||||
|
ldr r1, [sp, 0x8]\n\
|
||||||
|
lsls r0, r1, 16\n\
|
||||||
|
lsls r1, r4, 16\n\
|
||||||
|
cmp r0, r1\n\
|
||||||
|
bge _0817E4EE\n\
|
||||||
|
lsls r0, r6, 24\n\
|
||||||
|
lsrs r0, 24\n\
|
||||||
|
str r0, [sp, 0x10]\n\
|
||||||
|
lsrs r1, 16\n\
|
||||||
|
str r1, [sp, 0x8]\n\
|
||||||
|
str r7, [sp]\n\
|
||||||
|
_0817E4EE:\n\
|
||||||
|
mov r0, r8\n\
|
||||||
|
muls r0, r6\n\
|
||||||
|
ldr r2, =gEnemyParty\n\
|
||||||
|
adds r4, r0, r2\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0xB\n\
|
||||||
|
movs r2, 0\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r7, r0, 16\n\
|
||||||
|
ldr r3, [sp, 0x8]\n\
|
||||||
|
lsls r3, 16\n\
|
||||||
|
str r3, [sp, 0x1C]\n\
|
||||||
|
cmp r7, 0\n\
|
||||||
|
beq _0817E5A0\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0x2D\n\
|
||||||
|
movs r2, 0\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
bne _0817E5A0\n\
|
||||||
|
movs r4, 0\n\
|
||||||
|
ldr r0, [sp, 0xC]\n\
|
||||||
|
lsls r2, r0, 16\n\
|
||||||
|
movs r3, 0x1\n\
|
||||||
|
lsls r1, r3, 1\n\
|
||||||
|
adds r1, 0x1\n\
|
||||||
|
lsls r1, 4\n\
|
||||||
|
lsls r0, r6, 3\n\
|
||||||
|
adds r0, r1\n\
|
||||||
|
mov r3, r10\n\
|
||||||
|
adds r1, r0, r3\n\
|
||||||
|
movs r3, 0x3\n\
|
||||||
|
_0817E534:\n\
|
||||||
|
lsls r0, r4, 16\n\
|
||||||
|
asrs r0, 16\n\
|
||||||
|
ldrh r4, [r1]\n\
|
||||||
|
adds r0, r4\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r4, r0, 16\n\
|
||||||
|
adds r1, 0x2\n\
|
||||||
|
subs r3, 0x1\n\
|
||||||
|
cmp r3, 0\n\
|
||||||
|
bge _0817E534\n\
|
||||||
|
asrs r1, r2, 16\n\
|
||||||
|
lsls r5, r4, 16\n\
|
||||||
|
asrs r0, r5, 16\n\
|
||||||
|
cmp r1, r0\n\
|
||||||
|
bne _0817E590\n\
|
||||||
|
mov r0, r8\n\
|
||||||
|
muls r0, r6\n\
|
||||||
|
ldr r1, =gEnemyParty\n\
|
||||||
|
adds r0, r1\n\
|
||||||
|
movs r1, 0x19\n\
|
||||||
|
movs r2, 0\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
adds r4, r0, 0\n\
|
||||||
|
ldr r2, [sp, 0x14]\n\
|
||||||
|
mov r0, r8\n\
|
||||||
|
muls r0, r2\n\
|
||||||
|
ldr r3, =gEnemyParty\n\
|
||||||
|
adds r0, r3\n\
|
||||||
|
movs r1, 0x19\n\
|
||||||
|
movs r2, 0\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
cmp r4, r0\n\
|
||||||
|
bls _0817E5A0\n\
|
||||||
|
b _0817E594\n\
|
||||||
|
.pool\n\
|
||||||
|
_0817E590:\n\
|
||||||
|
cmp r1, r0\n\
|
||||||
|
ble _0817E5A0\n\
|
||||||
|
_0817E594:\n\
|
||||||
|
lsls r0, r6, 24\n\
|
||||||
|
lsrs r0, 24\n\
|
||||||
|
str r0, [sp, 0x14]\n\
|
||||||
|
lsrs r5, 16\n\
|
||||||
|
str r5, [sp, 0xC]\n\
|
||||||
|
str r7, [sp, 0x4]\n\
|
||||||
|
_0817E5A0:\n\
|
||||||
|
mov r6, r9\n\
|
||||||
|
cmp r6, 0x5\n\
|
||||||
|
bgt _0817E5A8\n\
|
||||||
|
b _0817E48E\n\
|
||||||
|
_0817E5A8:\n\
|
||||||
|
movs r4, 0\n\
|
||||||
|
movs r6, 0\n\
|
||||||
|
movs r3, 0\n\
|
||||||
|
ldr r5, =gPlayerParty\n\
|
||||||
|
ldr r7, [sp, 0x10]\n\
|
||||||
|
lsls r0, r7, 3\n\
|
||||||
|
mov r1, r10\n\
|
||||||
|
adds r2, r0, r1\n\
|
||||||
|
_0817E5B8:\n\
|
||||||
|
lsls r0, r4, 16\n\
|
||||||
|
asrs r0, 16\n\
|
||||||
|
movs r7, 0\n\
|
||||||
|
ldrsh r1, [r2, r7]\n\
|
||||||
|
cmp r0, r1\n\
|
||||||
|
bge _0817E5C8\n\
|
||||||
|
ldrh r4, [r2]\n\
|
||||||
|
adds r6, r3, 0\n\
|
||||||
|
_0817E5C8:\n\
|
||||||
|
adds r2, 0x2\n\
|
||||||
|
adds r3, 0x1\n\
|
||||||
|
cmp r3, 0x3\n\
|
||||||
|
ble _0817E5B8\n\
|
||||||
|
movs r0, 0x64\n\
|
||||||
|
ldr r1, [sp, 0x10]\n\
|
||||||
|
muls r0, r1\n\
|
||||||
|
adds r0, r5\n\
|
||||||
|
adds r1, r6, 0\n\
|
||||||
|
adds r1, 0xD\n\
|
||||||
|
movs r2, 0\n\
|
||||||
|
bl GetMonData\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r4, r0, 16\n\
|
||||||
|
ldr r2, [sp, 0x1C]\n\
|
||||||
|
cmp r2, 0\n\
|
||||||
|
beq _0817E670\n\
|
||||||
|
cmp r4, 0\n\
|
||||||
|
beq _0817E670\n\
|
||||||
|
ldr r0, =gBattleTypeFlags\n\
|
||||||
|
ldr r0, [r0]\n\
|
||||||
|
movs r1, 0x40\n\
|
||||||
|
ands r0, r1\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0817E65C\n\
|
||||||
|
ldr r3, [sp, 0x10]\n\
|
||||||
|
cmp r3, 0x2\n\
|
||||||
|
bhi _0817E620\n\
|
||||||
|
ldr r0, =gBattleScripting\n\
|
||||||
|
adds r0, 0x25\n\
|
||||||
|
ldrb r0, [r0]\n\
|
||||||
|
bl GetLinkTrainerFlankId\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0817E630\n\
|
||||||
|
b _0817E670\n\
|
||||||
|
.pool\n\
|
||||||
|
_0817E620:\n\
|
||||||
|
ldr r0, =gBattleScripting\n\
|
||||||
|
adds r0, 0x25\n\
|
||||||
|
ldrb r0, [r0]\n\
|
||||||
|
bl GetLinkTrainerFlankId\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _0817E670\n\
|
||||||
|
_0817E630:\n\
|
||||||
|
movs r3, 0\n\
|
||||||
|
ldr r7, [sp, 0x14]\n\
|
||||||
|
cmp r7, 0x2\n\
|
||||||
|
bls _0817E63A\n\
|
||||||
|
movs r3, 0x1\n\
|
||||||
|
_0817E63A:\n\
|
||||||
|
lsls r0, r3, 24\n\
|
||||||
|
lsrs r0, 24\n\
|
||||||
|
ldr r1, =gBattleScripting\n\
|
||||||
|
adds r1, 0x25\n\
|
||||||
|
ldrb r1, [r1]\n\
|
||||||
|
bl sub_806EF84\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r0, 24\n\
|
||||||
|
adds r1, r4, 0\n\
|
||||||
|
ldr r2, [sp]\n\
|
||||||
|
ldr r3, [sp, 0x4]\n\
|
||||||
|
bl PutBattleUpdateOnTheAir\n\
|
||||||
|
b _0817E670\n\
|
||||||
|
.pool\n\
|
||||||
|
_0817E65C:\n\
|
||||||
|
ldr r0, =gBattleScripting\n\
|
||||||
|
adds r0, 0x25\n\
|
||||||
|
ldrb r1, [r0]\n\
|
||||||
|
movs r0, 0x1\n\
|
||||||
|
eors r0, r1\n\
|
||||||
|
adds r1, r4, 0\n\
|
||||||
|
ldr r2, [sp]\n\
|
||||||
|
ldr r3, [sp, 0x4]\n\
|
||||||
|
bl PutBattleUpdateOnTheAir\n\
|
||||||
|
_0817E670:\n\
|
||||||
|
add sp, 0x20\n\
|
||||||
|
pop {r3-r5}\n\
|
||||||
|
mov r8, r3\n\
|
||||||
|
mov r9, r4\n\
|
||||||
|
mov r10, r5\n\
|
||||||
|
pop {r4-r7}\n\
|
||||||
|
pop {r0}\n\
|
||||||
|
bx r0\n\
|
||||||
|
.pool");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void AddMovePoints(u8 caseId, u16 arg1, u8 arg2, u8 arg3)
|
static void AddMovePoints(u8 caseId, u16 arg1, u8 arg2, u8 arg3)
|
||||||
{
|
{
|
||||||
struct BattleTvMovePoints *movePoints = &gBattleStruct->tvMovePoints;
|
struct BattleTvMovePoints *movePoints = &gBattleStruct->tvMovePoints;
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "battle.h"
|
#include "battle.h"
|
||||||
#include "battle_util.h"
|
|
||||||
#include "battle_anim.h"
|
#include "battle_anim.h"
|
||||||
#include "pokemon.h"
|
#include "pokemon.h"
|
||||||
#include "item.h"
|
#include "item.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "battle_scripts.h"
|
#include "battle_scripts.h"
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
|
#include "text.h"
|
||||||
#include "string_util.h"
|
#include "string_util.h"
|
||||||
|
#include "battle_message.h"
|
||||||
#include "battle_ai_script_commands.h"
|
#include "battle_ai_script_commands.h"
|
||||||
#include "battle_controllers.h"
|
#include "battle_controllers.h"
|
||||||
#include "event_data.h"
|
#include "event_data.h"
|
||||||
#include "link.h"
|
#include "link.h"
|
||||||
#include "field_weather.h"
|
#include "field_weather.h"
|
||||||
#include "constants/abilities.h"
|
#include "constants/abilities.h"
|
||||||
|
#include "constants/battle_anim.h"
|
||||||
#include "constants/battle_move_effects.h"
|
#include "constants/battle_move_effects.h"
|
||||||
#include "constants/battle_script_commands.h"
|
#include "constants/battle_script_commands.h"
|
||||||
#include "constants/battle_string_ids.h"
|
#include "constants/battle_string_ids.h"
|
||||||
@ -23,615 +25,6 @@
|
|||||||
#include "constants/moves.h"
|
#include "constants/moves.h"
|
||||||
#include "constants/species.h"
|
#include "constants/species.h"
|
||||||
#include "constants/weather.h"
|
#include "constants/weather.h"
|
||||||
#include "battle_arena.h"
|
|
||||||
#include "battle_pyramid.h"
|
|
||||||
#include "international_string_util.h"
|
|
||||||
#include "safari_zone.h"
|
|
||||||
#include "sound.h"
|
|
||||||
#include "task.h"
|
|
||||||
#include "trig.h"
|
|
||||||
#include "window.h"
|
|
||||||
#include "constants/songs.h"
|
|
||||||
|
|
||||||
extern const u8 *const gBattleScriptsForMoveEffects[];
|
|
||||||
extern const u8 *const gBattlescriptsForBallThrow[];
|
|
||||||
extern const u8 *const gBattlescriptsForRunningByItem[];
|
|
||||||
extern const u8 *const gBattlescriptsForUsingItem[];
|
|
||||||
extern const u8 *const gBattlescriptsForSafariActions[];
|
|
||||||
|
|
||||||
static const u8 sPkblToEscapeFactor[][3] = {{0, 0, 0}, {3, 5, 0}, {2, 3, 0}, {1, 2, 0}, {1, 1, 0}};
|
|
||||||
static const u8 sGoNearCounterToCatchFactor[] = {4, 3, 2, 1};
|
|
||||||
static const u8 sGoNearCounterToEscapeFactor[] = {4, 4, 4, 4};
|
|
||||||
|
|
||||||
void HandleAction_UseMove(void)
|
|
||||||
{
|
|
||||||
u8 side;
|
|
||||||
u8 var = 4;
|
|
||||||
|
|
||||||
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
|
||||||
|
|
||||||
if (*(&gBattleStruct->field_91) & gBitTable[gBattlerAttacker])
|
|
||||||
{
|
|
||||||
gCurrentActionFuncId = B_ACTION_FINISHED;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gCritMultiplier = 1;
|
|
||||||
gBattleScripting.dmgMultiplier = 1;
|
|
||||||
gBattleStruct->atkCancellerTracker = 0;
|
|
||||||
gMoveResultFlags = 0;
|
|
||||||
gMultiHitCounter = 0;
|
|
||||||
gBattleCommunication[6] = 0;
|
|
||||||
gCurrMovePos = gChosenMovePos = *(gBattleStruct->chosenMovePositions + gBattlerAttacker);
|
|
||||||
|
|
||||||
// choose move
|
|
||||||
if (gProtectStructs[gBattlerAttacker].noValidMoves)
|
|
||||||
{
|
|
||||||
gProtectStructs[gBattlerAttacker].noValidMoves = 0;
|
|
||||||
gCurrentMove = gChosenMove = MOVE_STRUGGLE;
|
|
||||||
gHitMarker |= HITMARKER_NO_PPDEDUCT;
|
|
||||||
*(gBattleStruct->moveTarget + gBattlerAttacker) = GetMoveTarget(MOVE_STRUGGLE, 0);
|
|
||||||
}
|
|
||||||
else if (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS || gBattleMons[gBattlerAttacker].status2 & STATUS2_RECHARGE)
|
|
||||||
{
|
|
||||||
gCurrentMove = gChosenMove = gLockedMoves[gBattlerAttacker];
|
|
||||||
}
|
|
||||||
// encore forces you to use the same move
|
|
||||||
else if (gDisableStructs[gBattlerAttacker].encoredMove != MOVE_NONE
|
|
||||||
&& gDisableStructs[gBattlerAttacker].encoredMove == gBattleMons[gBattlerAttacker].moves[gDisableStructs[gBattlerAttacker].encoredMovePos])
|
|
||||||
{
|
|
||||||
gCurrentMove = gChosenMove = gDisableStructs[gBattlerAttacker].encoredMove;
|
|
||||||
gCurrMovePos = gChosenMovePos = gDisableStructs[gBattlerAttacker].encoredMovePos;
|
|
||||||
*(gBattleStruct->moveTarget + gBattlerAttacker) = GetMoveTarget(gCurrentMove, 0);
|
|
||||||
}
|
|
||||||
// check if the encored move wasn't overwritten
|
|
||||||
else if (gDisableStructs[gBattlerAttacker].encoredMove != MOVE_NONE
|
|
||||||
&& gDisableStructs[gBattlerAttacker].encoredMove != gBattleMons[gBattlerAttacker].moves[gDisableStructs[gBattlerAttacker].encoredMovePos])
|
|
||||||
{
|
|
||||||
gCurrMovePos = gChosenMovePos = gDisableStructs[gBattlerAttacker].encoredMovePos;
|
|
||||||
gCurrentMove = gChosenMove = gBattleMons[gBattlerAttacker].moves[gCurrMovePos];
|
|
||||||
gDisableStructs[gBattlerAttacker].encoredMove = MOVE_NONE;
|
|
||||||
gDisableStructs[gBattlerAttacker].encoredMovePos = 0;
|
|
||||||
gDisableStructs[gBattlerAttacker].encoreTimer = 0;
|
|
||||||
*(gBattleStruct->moveTarget + gBattlerAttacker) = GetMoveTarget(gCurrentMove, 0);
|
|
||||||
}
|
|
||||||
else if (gBattleMons[gBattlerAttacker].moves[gCurrMovePos] != gChosenMoveByBattler[gBattlerAttacker])
|
|
||||||
{
|
|
||||||
gCurrentMove = gChosenMove = gBattleMons[gBattlerAttacker].moves[gCurrMovePos];
|
|
||||||
*(gBattleStruct->moveTarget + gBattlerAttacker) = GetMoveTarget(gCurrentMove, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gCurrentMove = gChosenMove = gBattleMons[gBattlerAttacker].moves[gCurrMovePos];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gBattleMons[gBattlerAttacker].hp != 0)
|
|
||||||
{
|
|
||||||
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER)
|
|
||||||
gBattleResults.lastUsedMovePlayer = gCurrentMove;
|
|
||||||
else
|
|
||||||
gBattleResults.lastUsedMoveOpponent = gCurrentMove;
|
|
||||||
}
|
|
||||||
|
|
||||||
// choose target
|
|
||||||
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
|
|
||||||
if (gSideTimers[side].followmeTimer != 0
|
|
||||||
&& gBattleMoves[gCurrentMove].target == MOVE_TARGET_SELECTED
|
|
||||||
&& GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gSideTimers[side].followmeTarget)
|
|
||||||
&& gBattleMons[gSideTimers[side].followmeTarget].hp != 0)
|
|
||||||
{
|
|
||||||
gBattlerTarget = gSideTimers[side].followmeTarget;
|
|
||||||
}
|
|
||||||
else if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
|
||||||
&& gSideTimers[side].followmeTimer == 0
|
|
||||||
&& (gBattleMoves[gCurrentMove].power != 0
|
|
||||||
|| gBattleMoves[gCurrentMove].target != MOVE_TARGET_USER)
|
|
||||||
&& gBattleMons[*(gBattleStruct->moveTarget + gBattlerAttacker)].ability != ABILITY_LIGHTNING_ROD
|
|
||||||
&& gBattleMoves[gCurrentMove].type == TYPE_ELECTRIC)
|
|
||||||
{
|
|
||||||
side = GetBattlerSide(gBattlerAttacker);
|
|
||||||
for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++)
|
|
||||||
{
|
|
||||||
if (side != GetBattlerSide(gActiveBattler)
|
|
||||||
&& *(gBattleStruct->moveTarget + gBattlerAttacker) != gActiveBattler
|
|
||||||
&& gBattleMons[gActiveBattler].ability == ABILITY_LIGHTNING_ROD
|
|
||||||
&& GetBattlerTurnOrderNum(gActiveBattler) < var)
|
|
||||||
{
|
|
||||||
var = GetBattlerTurnOrderNum(gActiveBattler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (var == 4)
|
|
||||||
{
|
|
||||||
if (gBattleMoves[gChosenMove].target & MOVE_TARGET_RANDOM)
|
|
||||||
{
|
|
||||||
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER)
|
|
||||||
{
|
|
||||||
if (Random() & 1)
|
|
||||||
gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
|
||||||
else
|
|
||||||
gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Random() & 1)
|
|
||||||
gBattlerTarget = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
|
|
||||||
else
|
|
||||||
gBattlerTarget = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gBattlerTarget = *(gBattleStruct->moveTarget + gBattlerAttacker);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gAbsentBattlerFlags & gBitTable[gBattlerTarget])
|
|
||||||
{
|
|
||||||
if (GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget))
|
|
||||||
{
|
|
||||||
gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_SIDE);
|
|
||||||
if (gAbsentBattlerFlags & gBitTable[gBattlerTarget])
|
|
||||||
gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gActiveBattler = gBattlerByTurnOrder[var];
|
|
||||||
RecordAbilityBattle(gActiveBattler, gBattleMons[gActiveBattler].ability);
|
|
||||||
gSpecialStatuses[gActiveBattler].lightningRodRedirected = 1;
|
|
||||||
gBattlerTarget = gActiveBattler;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
|
|
||||||
&& gBattleMoves[gChosenMove].target & MOVE_TARGET_RANDOM)
|
|
||||||
{
|
|
||||||
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER)
|
|
||||||
{
|
|
||||||
if (Random() & 1)
|
|
||||||
gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
|
||||||
else
|
|
||||||
gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Random() & 1)
|
|
||||||
gBattlerTarget = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
|
|
||||||
else
|
|
||||||
gBattlerTarget = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]
|
|
||||||
&& GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget))
|
|
||||||
{
|
|
||||||
gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gBattlerTarget = *(gBattleStruct->moveTarget + gBattlerAttacker);
|
|
||||||
if (gAbsentBattlerFlags & gBitTable[gBattlerTarget])
|
|
||||||
{
|
|
||||||
if (GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget))
|
|
||||||
{
|
|
||||||
gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_SIDE);
|
|
||||||
if (gAbsentBattlerFlags & gBitTable[gBattlerTarget])
|
|
||||||
gBattlerTarget = GetBattlerAtPosition(GetBattlerPosition(gBattlerTarget) ^ BIT_FLANK);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// choose battlescript
|
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_PALACE
|
|
||||||
&& gProtectStructs[gBattlerAttacker].palaceUnableToUseMove)
|
|
||||||
{
|
|
||||||
if (gBattleMons[gBattlerAttacker].hp == 0)
|
|
||||||
{
|
|
||||||
gCurrentActionFuncId = B_ACTION_FINISHED;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (gPalaceSelectionBattleScripts[gBattlerAttacker] != NULL)
|
|
||||||
{
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 4;
|
|
||||||
gBattlescriptCurrInstr = gPalaceSelectionBattleScripts[gBattlerAttacker];
|
|
||||||
gPalaceSelectionBattleScripts[gBattlerAttacker] = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 4;
|
|
||||||
gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gBattlescriptCurrInstr = gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
|
|
||||||
BattleArena_AddMindPoints(gBattlerAttacker);
|
|
||||||
|
|
||||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleAction_Switch(void)
|
|
||||||
{
|
|
||||||
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
|
||||||
gBattle_BG0_X = 0;
|
|
||||||
gBattle_BG0_Y = 0;
|
|
||||||
gActionSelectionCursor[gBattlerAttacker] = 0;
|
|
||||||
gMoveSelectionCursor[gBattlerAttacker] = 0;
|
|
||||||
|
|
||||||
PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, gBattlerAttacker, *(gBattleStruct->field_58 + gBattlerAttacker))
|
|
||||||
|
|
||||||
gBattleScripting.battler = gBattlerAttacker;
|
|
||||||
gBattlescriptCurrInstr = BattleScript_ActionSwitch;
|
|
||||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
|
||||||
|
|
||||||
if (gBattleResults.playerSwitchesCounter < 255)
|
|
||||||
gBattleResults.playerSwitchesCounter++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleAction_UseItem(void)
|
|
||||||
{
|
|
||||||
gBattlerAttacker = gBattlerTarget = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
|
||||||
gBattle_BG0_X = 0;
|
|
||||||
gBattle_BG0_Y = 0;
|
|
||||||
|
|
||||||
ClearFuryCutterDestinyBondGrudge(gBattlerAttacker);
|
|
||||||
|
|
||||||
gLastUsedItem = gBattleBufferB[gBattlerAttacker][1] | (gBattleBufferB[gBattlerAttacker][2] << 8);
|
|
||||||
|
|
||||||
if (gLastUsedItem <= LAST_BALL) // is ball
|
|
||||||
{
|
|
||||||
gBattlescriptCurrInstr = gBattlescriptsForBallThrow[gLastUsedItem];
|
|
||||||
}
|
|
||||||
else if (gLastUsedItem == ITEM_POKE_DOLL || gLastUsedItem == ITEM_FLUFFY_TAIL)
|
|
||||||
{
|
|
||||||
gBattlescriptCurrInstr = gBattlescriptsForRunningByItem[0];
|
|
||||||
}
|
|
||||||
else if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER)
|
|
||||||
{
|
|
||||||
gBattlescriptCurrInstr = gBattlescriptsForUsingItem[0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gBattleScripting.battler = gBattlerAttacker;
|
|
||||||
|
|
||||||
switch (*(gBattleStruct->AI_itemType + (gBattlerAttacker >> 1)))
|
|
||||||
{
|
|
||||||
case AI_ITEM_FULL_RESTORE:
|
|
||||||
case AI_ITEM_HEAL_HP:
|
|
||||||
break;
|
|
||||||
case AI_ITEM_CURE_CONDITION:
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
|
||||||
if (*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) & 1)
|
|
||||||
{
|
|
||||||
if (*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) & 0x3E)
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 5;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) >>= 1;
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER]++;
|
|
||||||
} while (!(*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) & 1));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case AI_ITEM_X_STAT:
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 4;
|
|
||||||
if (*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) & 0x80)
|
|
||||||
{
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 5;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK)
|
|
||||||
PREPARE_STRING_BUFFER(gBattleTextBuff2, CHAR_X)
|
|
||||||
|
|
||||||
while (!((*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1))) & 1))
|
|
||||||
{
|
|
||||||
*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) >>= 1;
|
|
||||||
gBattleTextBuff1[2]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
gBattleScripting.animArg1 = gBattleTextBuff1[2] + 14;
|
|
||||||
gBattleScripting.animArg2 = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case AI_ITEM_GUARD_SPECS:
|
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
|
||||||
else
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
gBattlescriptCurrInstr = gBattlescriptsForUsingItem[*(gBattleStruct->AI_itemType + (gBattlerAttacker >> 1))];
|
|
||||||
}
|
|
||||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool8 TryRunFromBattle(u8 battler)
|
|
||||||
{
|
|
||||||
bool8 effect = FALSE;
|
|
||||||
u8 holdEffect;
|
|
||||||
u8 pyramidMultiplier;
|
|
||||||
u8 speedVar;
|
|
||||||
|
|
||||||
if (gBattleMons[battler].item == ITEM_ENIGMA_BERRY)
|
|
||||||
holdEffect = gEnigmaBerries[battler].holdEffect;
|
|
||||||
else
|
|
||||||
holdEffect = ItemId_GetHoldEffect(gBattleMons[battler].item);
|
|
||||||
|
|
||||||
gPotentialItemEffectBattler = battler;
|
|
||||||
|
|
||||||
if (holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN)
|
|
||||||
{
|
|
||||||
gLastUsedItem = gBattleMons[battler].item;
|
|
||||||
gProtectStructs[battler].fleeFlag = 1;
|
|
||||||
effect++;
|
|
||||||
}
|
|
||||||
else if (gBattleMons[battler].ability == ABILITY_RUN_AWAY)
|
|
||||||
{
|
|
||||||
if (InBattlePyramid())
|
|
||||||
{
|
|
||||||
gBattleStruct->runTries++;
|
|
||||||
pyramidMultiplier = GetPyramidRunMultiplier();
|
|
||||||
speedVar = (gBattleMons[battler].speed * pyramidMultiplier) / (gBattleMons[BATTLE_OPPOSITE(battler)].speed) + (gBattleStruct->runTries * 30);
|
|
||||||
if (speedVar > (Random() & 0xFF))
|
|
||||||
{
|
|
||||||
gLastUsedAbility = ABILITY_RUN_AWAY;
|
|
||||||
gProtectStructs[battler].fleeFlag = 2;
|
|
||||||
effect++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gLastUsedAbility = ABILITY_RUN_AWAY;
|
|
||||||
gProtectStructs[battler].fleeFlag = 2;
|
|
||||||
effect++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_TRAINER_HILL) && gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
|
||||||
{
|
|
||||||
effect++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
|
|
||||||
{
|
|
||||||
if (InBattlePyramid())
|
|
||||||
{
|
|
||||||
pyramidMultiplier = GetPyramidRunMultiplier();
|
|
||||||
speedVar = (gBattleMons[battler].speed * pyramidMultiplier) / (gBattleMons[BATTLE_OPPOSITE(battler)].speed) + (gBattleStruct->runTries * 30);
|
|
||||||
if (speedVar > (Random() & 0xFF))
|
|
||||||
effect++;
|
|
||||||
}
|
|
||||||
else if (gBattleMons[battler].speed < gBattleMons[BATTLE_OPPOSITE(battler)].speed)
|
|
||||||
{
|
|
||||||
speedVar = (gBattleMons[battler].speed * 128) / (gBattleMons[BATTLE_OPPOSITE(battler)].speed) + (gBattleStruct->runTries * 30);
|
|
||||||
if (speedVar > (Random() & 0xFF))
|
|
||||||
effect++;
|
|
||||||
}
|
|
||||||
else // same speed or faster
|
|
||||||
{
|
|
||||||
effect++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gBattleStruct->runTries++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (effect)
|
|
||||||
{
|
|
||||||
gCurrentTurnActionNumber = gBattlersCount;
|
|
||||||
gBattleOutcome = B_OUTCOME_RAN;
|
|
||||||
}
|
|
||||||
|
|
||||||
return effect;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleAction_Run(void)
|
|
||||||
{
|
|
||||||
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
|
||||||
|
|
||||||
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))
|
|
||||||
{
|
|
||||||
gCurrentTurnActionNumber = gBattlersCount;
|
|
||||||
|
|
||||||
for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++)
|
|
||||||
{
|
|
||||||
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
|
|
||||||
{
|
|
||||||
if (gChosenActionByBattler[gActiveBattler] == B_ACTION_RUN)
|
|
||||||
gBattleOutcome |= B_OUTCOME_LOST;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (gChosenActionByBattler[gActiveBattler] == B_ACTION_RUN)
|
|
||||||
gBattleOutcome |= B_OUTCOME_WON;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gBattleOutcome |= B_OUTCOME_LINK_BATTLE_RAN;
|
|
||||||
gSaveBlock2Ptr->frontier.disableRecordBattle = TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER)
|
|
||||||
{
|
|
||||||
if (!TryRunFromBattle(gBattlerAttacker)) // failed to run away
|
|
||||||
{
|
|
||||||
ClearFuryCutterDestinyBondGrudge(gBattlerAttacker);
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 3;
|
|
||||||
gBattlescriptCurrInstr = BattleScript_PrintFailedToRunString;
|
|
||||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (gBattleMons[gBattlerAttacker].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION))
|
|
||||||
{
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 4;
|
|
||||||
gBattlescriptCurrInstr = BattleScript_PrintFailedToRunString;
|
|
||||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gCurrentTurnActionNumber = gBattlersCount;
|
|
||||||
gBattleOutcome = B_OUTCOME_MON_FLED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleAction_WatchesCarefully(void)
|
|
||||||
{
|
|
||||||
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
|
||||||
gBattle_BG0_X = 0;
|
|
||||||
gBattle_BG0_Y = 0;
|
|
||||||
gBattlescriptCurrInstr = gBattlescriptsForSafariActions[0];
|
|
||||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleAction_SafariZoneBallThrow(void)
|
|
||||||
{
|
|
||||||
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
|
||||||
gBattle_BG0_X = 0;
|
|
||||||
gBattle_BG0_Y = 0;
|
|
||||||
gNumSafariBalls--;
|
|
||||||
gLastUsedItem = ITEM_SAFARI_BALL;
|
|
||||||
gBattlescriptCurrInstr = gBattlescriptsForBallThrow[ITEM_SAFARI_BALL];
|
|
||||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleAction_ThrowPokeblock(void)
|
|
||||||
{
|
|
||||||
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
|
||||||
gBattle_BG0_X = 0;
|
|
||||||
gBattle_BG0_Y = 0;
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = gBattleBufferB[gBattlerAttacker][1] - 1;
|
|
||||||
gLastUsedItem = gBattleBufferB[gBattlerAttacker][2];
|
|
||||||
|
|
||||||
if (gBattleResults.pokeblockThrows < 0xFF)
|
|
||||||
gBattleResults.pokeblockThrows++;
|
|
||||||
if (gBattleStruct->safariPkblThrowCounter < 3)
|
|
||||||
gBattleStruct->safariPkblThrowCounter++;
|
|
||||||
if (gBattleStruct->safariEscapeFactor > 1)
|
|
||||||
{
|
|
||||||
if (gBattleStruct->safariEscapeFactor < sPkblToEscapeFactor[gBattleStruct->safariPkblThrowCounter][gBattleCommunication[MULTISTRING_CHOOSER]])
|
|
||||||
gBattleStruct->safariEscapeFactor = 1;
|
|
||||||
else
|
|
||||||
gBattleStruct->safariEscapeFactor -= sPkblToEscapeFactor[gBattleStruct->safariPkblThrowCounter][gBattleCommunication[MULTISTRING_CHOOSER]];
|
|
||||||
}
|
|
||||||
|
|
||||||
gBattlescriptCurrInstr = gBattlescriptsForSafariActions[2];
|
|
||||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleAction_GoNear(void)
|
|
||||||
{
|
|
||||||
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
|
||||||
gBattle_BG0_X = 0;
|
|
||||||
gBattle_BG0_Y = 0;
|
|
||||||
|
|
||||||
gBattleStruct->safariCatchFactor += sGoNearCounterToCatchFactor[gBattleStruct->safariGoNearCounter];
|
|
||||||
if (gBattleStruct->safariCatchFactor > 20)
|
|
||||||
gBattleStruct->safariCatchFactor = 20;
|
|
||||||
|
|
||||||
gBattleStruct->safariEscapeFactor += sGoNearCounterToEscapeFactor[gBattleStruct->safariGoNearCounter];
|
|
||||||
if (gBattleStruct->safariEscapeFactor > 20)
|
|
||||||
gBattleStruct->safariEscapeFactor = 20;
|
|
||||||
|
|
||||||
if (gBattleStruct->safariGoNearCounter < 3)
|
|
||||||
{
|
|
||||||
gBattleStruct->safariGoNearCounter++;
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1; // Can't get closer.
|
|
||||||
}
|
|
||||||
gBattlescriptCurrInstr = gBattlescriptsForSafariActions[1];
|
|
||||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleAction_SafariZoneRun(void)
|
|
||||||
{
|
|
||||||
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
|
||||||
PlaySE(SE_FLEE);
|
|
||||||
gCurrentTurnActionNumber = gBattlersCount;
|
|
||||||
gBattleOutcome = B_OUTCOME_RAN;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleAction_WallyBallThrow(void)
|
|
||||||
{
|
|
||||||
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
|
||||||
gBattle_BG0_X = 0;
|
|
||||||
gBattle_BG0_Y = 0;
|
|
||||||
|
|
||||||
PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, gBattlerAttacker, gBattlerPartyIndexes[gBattlerAttacker])
|
|
||||||
|
|
||||||
gBattlescriptCurrInstr = gBattlescriptsForSafariActions[3];
|
|
||||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
|
||||||
gActionsByTurnOrder[1] = B_ACTION_FINISHED;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleAction_TryFinish(void)
|
|
||||||
{
|
|
||||||
if (!HandleFaintedMonActions())
|
|
||||||
{
|
|
||||||
gBattleStruct->faintedActionsState = 0;
|
|
||||||
gCurrentActionFuncId = B_ACTION_FINISHED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleAction_NothingIsFainted(void)
|
|
||||||
{
|
|
||||||
gCurrentTurnActionNumber++;
|
|
||||||
gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber];
|
|
||||||
gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED
|
|
||||||
| HITMARKER_NO_PPDEDUCT | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_IGNORE_ON_AIR
|
|
||||||
| HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_x100000
|
|
||||||
| HITMARKER_OBEYS | HITMARKER_x10 | HITMARKER_SYNCHRONISE_EFFECT
|
|
||||||
| HITMARKER_CHARGING | HITMARKER_x4000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleAction_ActionFinished(void)
|
|
||||||
{
|
|
||||||
*(gBattleStruct->monToSwitchIntoId + gBattlerByTurnOrder[gCurrentTurnActionNumber]) = 6;
|
|
||||||
gCurrentTurnActionNumber++;
|
|
||||||
gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber];
|
|
||||||
SpecialStatusesClear();
|
|
||||||
gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED
|
|
||||||
| HITMARKER_NO_PPDEDUCT | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_IGNORE_ON_AIR
|
|
||||||
| HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_x100000
|
|
||||||
| HITMARKER_OBEYS | HITMARKER_x10 | HITMARKER_SYNCHRONISE_EFFECT
|
|
||||||
| HITMARKER_CHARGING | HITMARKER_x4000000);
|
|
||||||
|
|
||||||
gCurrentMove = 0;
|
|
||||||
gBattleMoveDamage = 0;
|
|
||||||
gMoveResultFlags = 0;
|
|
||||||
gBattleScripting.animTurn = 0;
|
|
||||||
gBattleScripting.animTargetsHit = 0;
|
|
||||||
gLastLandedMoves[gBattlerAttacker] = 0;
|
|
||||||
gLastHitByType[gBattlerAttacker] = 0;
|
|
||||||
gBattleStruct->dynamicMoveType = 0;
|
|
||||||
gDynamicBasePower = 0;
|
|
||||||
gBattleScripting.moveendState = 0;
|
|
||||||
gBattleCommunication[3] = 0;
|
|
||||||
gBattleCommunication[4] = 0;
|
|
||||||
gBattleScripting.multihitMoveEffect = 0;
|
|
||||||
gBattleResources->battleScriptsStack->size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// rom const data
|
// rom const data
|
||||||
static const u16 sSoundMovesTable[] =
|
static const u16 sSoundMovesTable[] =
|
||||||
@ -2241,8 +1634,16 @@ bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// FIXME: Compiler insists on moving r4 into r1 before doing the eor.
|
||||||
|
#ifndef NONMATCHING
|
||||||
|
register u32 var asm("r1");
|
||||||
|
#else
|
||||||
|
u32 var;
|
||||||
|
#endif // NONMATCHING
|
||||||
|
|
||||||
party = gEnemyParty;
|
party = gEnemyParty;
|
||||||
if (battler == 1)
|
var = battler ^ BIT_SIDE;
|
||||||
|
if (var == 0)
|
||||||
id1 = 0;
|
id1 = 0;
|
||||||
else
|
else
|
||||||
id1 = 1;
|
id1 = 1;
|
||||||
|
@ -1331,7 +1331,7 @@ void ResetBerryTreeSparkleFlags(void)
|
|||||||
s16 bottom;
|
s16 bottom;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
GetCameraCoords((u16*)&cam_left, (u16*)&cam_top);
|
GetCameraCoords(&cam_left, &cam_top);
|
||||||
left = cam_left;
|
left = cam_left;
|
||||||
top = cam_top + 3;
|
top = cam_top + 3;
|
||||||
right = cam_left + 14;
|
right = cam_left + 14;
|
||||||
|
@ -168,8 +168,8 @@ struct BerryBlender
|
|||||||
u16 progressBarValue;
|
u16 progressBarValue;
|
||||||
u16 maxProgressBarValue;
|
u16 maxProgressBarValue;
|
||||||
u16 centerScale;
|
u16 centerScale;
|
||||||
s16 bg_X;
|
u16 bg_X;
|
||||||
s16 bg_Y;
|
u16 bg_Y;
|
||||||
u8 opponentTaskIds[BLENDER_MAX_PLAYERS - 1];
|
u8 opponentTaskIds[BLENDER_MAX_PLAYERS - 1];
|
||||||
u8 perfectOpponents; // for debugging, NPCs will always hit Best
|
u8 perfectOpponents; // for debugging, NPCs will always hit Best
|
||||||
u16 scores[BLENDER_MAX_PLAYERS][NUM_SCORE_TYPES];
|
u16 scores[BLENDER_MAX_PLAYERS][NUM_SCORE_TYPES];
|
||||||
@ -3387,13 +3387,13 @@ static void RestoreBgCoord(s16* coord)
|
|||||||
// For "unshaking" the screen after ShakeBgCoordForHit is called
|
// For "unshaking" the screen after ShakeBgCoordForHit is called
|
||||||
static void RestoreBgCoords(void)
|
static void RestoreBgCoords(void)
|
||||||
{
|
{
|
||||||
RestoreBgCoord((s16 *)&sBerryBlender->bg_X);
|
RestoreBgCoord(&sBerryBlender->bg_X);
|
||||||
RestoreBgCoord((s16 *)&sBerryBlender->bg_Y);
|
RestoreBgCoord(&sBerryBlender->bg_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BlenderLandShakeBgCoord(s16* coord, u16 timer)
|
static void BlenderLandShakeBgCoord(s16* coord, u16 timer)
|
||||||
{
|
{
|
||||||
u8 strength;
|
s32 strength;
|
||||||
|
|
||||||
if (timer < 10)
|
if (timer < 10)
|
||||||
strength = 16;
|
strength = 16;
|
||||||
|
@ -146,49 +146,38 @@ struct BerryCrushGame
|
|||||||
{
|
{
|
||||||
MainCallback unk0;
|
MainCallback unk0;
|
||||||
u32 (* unk4)(struct BerryCrushGame *, u8 *);
|
u32 (* unk4)(struct BerryCrushGame *, u8 *);
|
||||||
|
|
||||||
u8 unk8;
|
u8 unk8;
|
||||||
u8 unk9;
|
u8 unk9;
|
||||||
u8 unkA;
|
u8 unkA;
|
||||||
u8 unkB;
|
u8 unkB;
|
||||||
|
|
||||||
u8 unkC;
|
u8 unkC;
|
||||||
u8 unkD;
|
u8 unkD;
|
||||||
|
|
||||||
u8 unkE;
|
u8 unkE;
|
||||||
u8 unkF;
|
u8 unkF;
|
||||||
|
|
||||||
u16 unk10;
|
u16 unk10;
|
||||||
u16 unk12;
|
u16 unk12;
|
||||||
u16 unk14;
|
u16 unk14;
|
||||||
|
|
||||||
u16 unk16;
|
u16 unk16;
|
||||||
s16 unk18;
|
s16 unk18;
|
||||||
s16 unk1A;
|
s16 unk1A;
|
||||||
s32 unk1C;
|
int unk1C;
|
||||||
s32 unk20;
|
s32 unk20;
|
||||||
u8 unk24;
|
u8 unk24;
|
||||||
|
|
||||||
u8 unk25_0:1;
|
u8 unk25_0:1;
|
||||||
u8 unk25_1:1;
|
u8 unk25_1:1;
|
||||||
u8 unk25_2:1;
|
u8 unk25_2:1;
|
||||||
u8 unk25_3:1;
|
u8 unk25_3:1;
|
||||||
u8 unk25_4:1;
|
u8 unk25_4:1;
|
||||||
u8 unk25_5:3;
|
u8 unk25_5:3;
|
||||||
|
|
||||||
u16 unk26;
|
u16 unk26;
|
||||||
|
|
||||||
u16 unk28;
|
u16 unk28;
|
||||||
s16 unk2A;
|
s16 unk2A;
|
||||||
s16 unk2C;
|
s16 unk2C;
|
||||||
|
|
||||||
s16 unk2E;
|
s16 unk2E;
|
||||||
s16 unk30;
|
s16 unk30;
|
||||||
s16 unk32;
|
s16 unk32;
|
||||||
s16 unk34;
|
s16 unk34;
|
||||||
|
|
||||||
u8 unk36[0xA];
|
u8 unk36[0xA];
|
||||||
|
|
||||||
struct BerryCrushGame_40 unk40;
|
struct BerryCrushGame_40 unk40;
|
||||||
struct BerryCrushGame_5C unk5C;
|
struct BerryCrushGame_5C unk5C;
|
||||||
union BerryCrushGame_68 unk68;
|
union BerryCrushGame_68 unk68;
|
||||||
@ -215,7 +204,7 @@ void sub_8022524(struct BerryCrushGame_138 *, u16);
|
|||||||
void sub_8022B28(struct Sprite *);
|
void sub_8022B28(struct Sprite *);
|
||||||
void sub_8022554(struct BerryCrushGame_138 *r0);
|
void sub_8022554(struct BerryCrushGame_138 *r0);
|
||||||
void sub_8024578(struct BerryCrushGame *);
|
void sub_8024578(struct BerryCrushGame *);
|
||||||
void sub_8024644(u8 *, u8, u8, u16, u8);
|
void sub_8024644(u8 *, u32, u32, u32, u32);
|
||||||
static void sub_8022A20(struct Sprite *sprite);
|
static void sub_8022A20(struct Sprite *sprite);
|
||||||
static u32 BerryCrushCommand_BeginNormalPaletteFade(struct BerryCrushGame *r6, u8 *r1);
|
static u32 BerryCrushCommand_BeginNormalPaletteFade(struct BerryCrushGame *r6, u8 *r1);
|
||||||
static u32 sub_8022CB0(struct BerryCrushGame *r4, u8 *r5);
|
static u32 sub_8022CB0(struct BerryCrushGame *r4, u8 *r5);
|
||||||
@ -1676,7 +1665,7 @@ static void Task_ShowBerryCrushRankings(u8 taskId)
|
|||||||
CopyWindowToVram(data[1], 3);
|
CopyWindowToVram(data[1], 3);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
@ -1997,29 +1986,29 @@ static u32 BerryCrushCommand_BeginNormalPaletteFade(struct BerryCrushGame *game,
|
|||||||
// byte 9: if TRUE, communicate on fade complete
|
// byte 9: if TRUE, communicate on fade complete
|
||||||
|
|
||||||
u16 color;
|
u16 color;
|
||||||
u32 selectedPals[2];
|
u32 selectedPals;
|
||||||
|
selectedPals = ({
|
||||||
|
#ifndef NONMATCHING
|
||||||
|
register u32 value asm("r2");
|
||||||
|
register u32 b asm("r3");
|
||||||
|
#else
|
||||||
|
u32 value;
|
||||||
|
u32 b;
|
||||||
|
#endif //NONMATCHING
|
||||||
|
value = params[0] << 0;
|
||||||
|
value |= (b = params[1] << 8);
|
||||||
|
value |= (b = params[2] << 16);
|
||||||
|
value |= (b = params[3] << 24);
|
||||||
|
value;
|
||||||
|
});
|
||||||
|
|
||||||
selectedPals[0] = (u32)params[0];
|
|
||||||
selectedPals[1] = (u32)params[1];
|
|
||||||
selectedPals[1] <<= 8;
|
|
||||||
|
|
||||||
selectedPals[0] |= selectedPals[1];
|
|
||||||
selectedPals[1] = (u32)params[2];
|
|
||||||
selectedPals[1] <<= 16;
|
|
||||||
|
|
||||||
selectedPals[0] |= selectedPals[1];
|
|
||||||
selectedPals[1] = (u32)params[3];
|
|
||||||
selectedPals[1] <<= 24;
|
|
||||||
|
|
||||||
selectedPals[0] |= selectedPals[1];
|
|
||||||
params[0] = params[9];
|
params[0] = params[9];
|
||||||
|
|
||||||
color = params[8];
|
color = params[8] << 8;
|
||||||
color <<= 8;
|
color |= params[7] << 0;
|
||||||
color |= params[7];
|
|
||||||
|
|
||||||
gPaletteFade.bufferTransferDisabled = FALSE;
|
gPaletteFade.bufferTransferDisabled = FALSE;
|
||||||
BeginNormalPaletteFade(selectedPals[0], params[4], params[5], params[6], color);
|
BeginNormalPaletteFade(selectedPals, params[4], params[5], params[6], color);
|
||||||
UpdatePaletteFade();
|
UpdatePaletteFade();
|
||||||
game->unkE = 2;
|
game->unkE = 2;
|
||||||
return 0;
|
return 0;
|
||||||
@ -2401,7 +2390,7 @@ void sub_802339C(struct BerryCrushGame *r4)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (r8 >= 2)
|
if (r8 > 1)
|
||||||
{
|
{
|
||||||
for (r7 = 0; r7 < r4->unk9; ++r7)
|
for (r7 = 0; r7 < r4->unk9; ++r7)
|
||||||
{
|
{
|
||||||
@ -2509,9 +2498,9 @@ void sub_8023558(struct BerryCrushGame *r3)
|
|||||||
|
|
||||||
void sub_80236B8(struct BerryCrushGame *r5)
|
void sub_80236B8(struct BerryCrushGame *r5)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
r5->unk5C.unk02_2 = 1;
|
r5->unk5C.unk02_2 = 1;
|
||||||
if (JOY_HELD(A_BUTTON))
|
if (gMain.heldKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
if (r5->unk68.as_four_players.others[r5->unk8].unk4.as_hwords[5] < r5->unk28)
|
if (r5->unk68.as_four_players.others[r5->unk8].unk4.as_hwords[5] < r5->unk28)
|
||||||
++r5->unk68.as_four_players.others[r5->unk8].unk4.as_hwords[5];
|
++r5->unk68.as_four_players.others[r5->unk8].unk4.as_hwords[5];
|
||||||
@ -2591,7 +2580,6 @@ void sub_802385C(struct BerryCrushGame *r5)
|
|||||||
for (r4 = 0; r4 < r5->unk9; ++r4)
|
for (r4 = 0; r4 < r5->unk9; ++r4)
|
||||||
r5->unk68.as_four_players.others[r4].unk4.as_2d_bytes[1][5] = 0;
|
r5->unk68.as_four_players.others[r4].unk4.as_2d_bytes[1][5] = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET
|
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET
|
||||||
|| gRecvCmds[0][1] != 2)
|
|| gRecvCmds[0][1] != 2)
|
||||||
{
|
{
|
||||||
@ -2978,7 +2966,7 @@ static u32 sub_8024048(struct BerryCrushGame *r5, u8 *r6)
|
|||||||
--r5->unk138.unk0;
|
--r5->unk138.unk0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!(JOY_NEW(A_BUTTON)))
|
if (!(gMain.newKeys & A_BUTTON))
|
||||||
return 0;
|
return 0;
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
sub_802222C(r5);
|
sub_802222C(r5);
|
||||||
@ -3281,11 +3269,14 @@ static void BerryCrush_SetPaletteFadeParams(u8 *params, bool8 communicateAfter,
|
|||||||
params[9] = communicateAfter;
|
params[9] = communicateAfter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8024644(u8 *r0, u8 r1, u8 r2, u16 r3, u8 r5)
|
void sub_8024644(u8 *r0, u32 r1, u32 r2, u32 r3, u32 r5)
|
||||||
{
|
{
|
||||||
|
u8 sp[4];
|
||||||
|
|
||||||
|
0[(u16 *)sp] = r3;
|
||||||
r0[0] = r1;
|
r0[0] = r1;
|
||||||
r0[1] = r2;
|
r0[1] = r2;
|
||||||
r0[2] = ((u8 *)&r3)[0];
|
r0[2] = sp[0];
|
||||||
r0[3] = ((u8 *)&r3)[1];
|
r0[3] = sp[1];
|
||||||
r0[4] = r5;
|
r0[4] = r5;
|
||||||
}
|
}
|
||||||
|
@ -190,13 +190,13 @@ static void berry_fix_main(void)
|
|||||||
berry_fix_mb_manager->state = 1;
|
berry_fix_mb_manager->state = 1;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (berry_fix_text_update(5) == 5 && (JOY_NEW(A_BUTTON)))
|
if (berry_fix_text_update(5) == 5 && (gMain.newKeys & A_BUTTON))
|
||||||
{
|
{
|
||||||
berry_fix_mb_manager->state = 2;
|
berry_fix_mb_manager->state = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (berry_fix_text_update(0) == 0 && (JOY_NEW(A_BUTTON)))
|
if (berry_fix_text_update(0) == 0 && (gMain.newKeys & A_BUTTON))
|
||||||
{
|
{
|
||||||
berry_fix_mb_manager->state = 3;
|
berry_fix_mb_manager->state = 3;
|
||||||
}
|
}
|
||||||
@ -235,13 +235,13 @@ static void berry_fix_main(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
if (berry_fix_text_update(3) == 3 && JOY_NEW(A_BUTTON))
|
if (berry_fix_text_update(3) == 3 && gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
DoSoftReset();
|
DoSoftReset();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
if (berry_fix_text_update(4) == 4 && JOY_NEW(A_BUTTON))
|
if (berry_fix_text_update(4) == 4 && gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
berry_fix_mb_manager->state = 1;
|
berry_fix_mb_manager->state = 1;
|
||||||
}
|
}
|
||||||
|
@ -536,12 +536,12 @@ static void Task_HandleInput(u8 taskId)
|
|||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
u16 arrowKeys = JOY_REPEAT(DPAD_ANY);
|
u16 arrowKeys = gMain.newAndRepeatedKeys & DPAD_ANY;
|
||||||
if (arrowKeys == DPAD_UP)
|
if (arrowKeys == DPAD_UP)
|
||||||
TryChangeDisplayedBerry(taskId, -1);
|
TryChangeDisplayedBerry(taskId, -1);
|
||||||
else if (arrowKeys == DPAD_DOWN)
|
else if (arrowKeys == DPAD_DOWN)
|
||||||
TryChangeDisplayedBerry(taskId, 1);
|
TryChangeDisplayedBerry(taskId, 1);
|
||||||
else if (JOY_NEW(A_BUTTON | B_BUTTON))
|
else if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
PrepareToCloseBerryTagScreen(taskId);
|
PrepareToCloseBerryTagScreen(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ static bool32 CheckLinkErrored(u8 taskId)
|
|||||||
|
|
||||||
static bool32 CheckLinkCanceledBeforeConnection(u8 taskId)
|
static bool32 CheckLinkCanceledBeforeConnection(u8 taskId)
|
||||||
{
|
{
|
||||||
if ((JOY_NEW(B_BUTTON))
|
if ((gMain.newKeys & B_BUTTON)
|
||||||
&& IsLinkConnectionEstablished() == FALSE)
|
&& IsLinkConnectionEstablished() == FALSE)
|
||||||
{
|
{
|
||||||
gLinkType = 0;
|
gLinkType = 0;
|
||||||
@ -178,7 +178,7 @@ static bool32 CheckLinkCanceled(u8 taskId)
|
|||||||
if (IsLinkConnectionEstablished())
|
if (IsLinkConnectionEstablished())
|
||||||
SetSuppressLinkErrorMessage(TRUE);
|
SetSuppressLinkErrorMessage(TRUE);
|
||||||
|
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
gLinkType = 0;
|
gLinkType = 0;
|
||||||
gTasks[taskId].func = Task_LinkupFailed;
|
gTasks[taskId].func = Task_LinkupFailed;
|
||||||
@ -277,7 +277,7 @@ static void Task_LinkupAwaitConfirmation(u8 taskId)
|
|||||||
|
|
||||||
UpdateLinkPlayerCountDisplay(taskId, linkPlayerCount);
|
UpdateLinkPlayerCountDisplay(taskId, linkPlayerCount);
|
||||||
|
|
||||||
if (!(JOY_NEW(A_BUTTON)))
|
if (!(gMain.newKeys & A_BUTTON))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (linkPlayerCount < tMinPlayers)
|
if (linkPlayerCount < tMinPlayers)
|
||||||
@ -304,12 +304,12 @@ static void Task_LinkupTryConfirmation(u8 taskId)
|
|||||||
ShowFieldAutoScrollMessage(gText_ConfirmLinkWhenPlayersReady);
|
ShowFieldAutoScrollMessage(gText_ConfirmLinkWhenPlayersReady);
|
||||||
gTasks[taskId].func = Task_LinkupConfirmWhenReady;
|
gTasks[taskId].func = Task_LinkupConfirmWhenReady;
|
||||||
}
|
}
|
||||||
else if (JOY_HELD(B_BUTTON))
|
else if (gMain.heldKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
ShowFieldAutoScrollMessage(gText_ConfirmLinkWhenPlayersReady);
|
ShowFieldAutoScrollMessage(gText_ConfirmLinkWhenPlayersReady);
|
||||||
gTasks[taskId].func = Task_LinkupConfirmWhenReady;
|
gTasks[taskId].func = Task_LinkupConfirmWhenReady;
|
||||||
}
|
}
|
||||||
else if (JOY_HELD(A_BUTTON))
|
else if (gMain.heldKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
CheckShouldAdvanceLinkState();
|
CheckShouldAdvanceLinkState();
|
||||||
|
@ -30,8 +30,10 @@ static void sub_81520A8(void *dest, u16 value, u8 left, u8 top, u8 width, u8 hei
|
|||||||
|
|
||||||
static void sub_8152134(void *dest, const u16 *src, u8 left, u8 top, u8 width, u8 height) // Unused.
|
static void sub_8152134(void *dest, const u16 *src, u8 left, u8 top, u8 width, u8 height) // Unused.
|
||||||
{
|
{
|
||||||
u8 i, j;
|
u8 i;
|
||||||
u8 x, y;
|
u8 j;
|
||||||
|
u8 x;
|
||||||
|
u8 y;
|
||||||
const u16 *_src;
|
const u16 *_src;
|
||||||
|
|
||||||
for (i = 0, _src = src, y = top; i < height; i++)
|
for (i = 0, _src = src, y = top; i < height; i++)
|
||||||
|
@ -999,6 +999,8 @@ void ResetLinkContestBoolean(void)
|
|||||||
|
|
||||||
static void SetupContestGpuRegs(void)
|
static void SetupContestGpuRegs(void)
|
||||||
{
|
{
|
||||||
|
u16 savedIme;
|
||||||
|
|
||||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP);
|
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP);
|
||||||
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
||||||
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
||||||
@ -1493,7 +1495,7 @@ static void Task_DisplayAppealNumberText(u8 taskId)
|
|||||||
static void Task_TryShowMoveSelectScreen(u8 taskId)
|
static void Task_TryShowMoveSelectScreen(u8 taskId)
|
||||||
{
|
{
|
||||||
// Wait for button press to show move select screen
|
// Wait for button press to show move select screen
|
||||||
if ((JOY_NEW(A_BUTTON)) || (gMain.newKeys == B_BUTTON))
|
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys == B_BUTTON))
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex))
|
if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex))
|
||||||
@ -1559,7 +1561,7 @@ static void Task_HandleMoveSelectInput(u8 taskId)
|
|||||||
numMoves++;
|
numMoves++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
gTasks[taskId].func = Task_SelectedMove;
|
gTasks[taskId].func = Task_SelectedMove;
|
||||||
@ -3408,7 +3410,8 @@ static void GetAllChosenMoves(void)
|
|||||||
|
|
||||||
static void RankContestants(void)
|
static void RankContestants(void)
|
||||||
{
|
{
|
||||||
s32 i, j;
|
s32 i;
|
||||||
|
s32 j;
|
||||||
s16 arr[CONTESTANT_COUNT];
|
s16 arr[CONTESTANT_COUNT];
|
||||||
|
|
||||||
for (i = 0; i < CONTESTANT_COUNT; i++)
|
for (i = 0; i < CONTESTANT_COUNT; i++)
|
||||||
@ -3483,6 +3486,7 @@ static bool8 ContestantCanUseTurn(u8 contestant)
|
|||||||
{
|
{
|
||||||
if (eContestantStatus[contestant].numTurnsSkipped != 0 || eContestantStatus[contestant].noMoreTurns)
|
if (eContestantStatus[contestant].numTurnsSkipped != 0 || eContestantStatus[contestant].noMoreTurns)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
else
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3537,6 +3541,7 @@ bool8 Contest_IsMonsTurnDisabled(u8 contestant)
|
|||||||
{
|
{
|
||||||
if (eContestantStatus[contestant].numTurnsSkipped != 0 || eContestantStatus[contestant].noMoreTurns)
|
if (eContestantStatus[contestant].numTurnsSkipped != 0 || eContestantStatus[contestant].noMoreTurns)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4137,12 +4142,12 @@ static u8 CreateContestantBoxBlinkSprites(u8 contestant)
|
|||||||
CpuFill32(0, gContestResources->boxBlinkTiles2 + 0x500, 0x300);
|
CpuFill32(0, gContestResources->boxBlinkTiles2 + 0x500, 0x300);
|
||||||
|
|
||||||
RequestDma3Copy(gContestResources->boxBlinkTiles1,
|
RequestDma3Copy(gContestResources->boxBlinkTiles1,
|
||||||
(u8 *)(OBJ_VRAM0 + gSprites[spriteId1].oam.tileNum * 32),
|
(u8 *)(VRAM + 0x10000 + gSprites[spriteId1].oam.tileNum * 32),
|
||||||
0x800,
|
0x800,
|
||||||
1);
|
1);
|
||||||
|
|
||||||
RequestDma3Copy(gContestResources->boxBlinkTiles2,
|
RequestDma3Copy(gContestResources->boxBlinkTiles2,
|
||||||
(u8 *)(OBJ_VRAM0 + gSprites[spriteId2].oam.tileNum * 32),
|
(u8 *)(VRAM + 0x10000 + gSprites[spriteId2].oam.tileNum * 32),
|
||||||
0x800,
|
0x800,
|
||||||
1);
|
1);
|
||||||
|
|
||||||
@ -4480,7 +4485,9 @@ static void CalculateAppealMoveImpact(u8 contestant)
|
|||||||
eContestantStatus[contestant].comboAppealBonus = eContestantStatus[contestant].baseAppeal * eContestantStatus[contestant].completedCombo;
|
eContestantStatus[contestant].comboAppealBonus = eContestantStatus[contestant].baseAppeal * eContestantStatus[contestant].completedCombo;
|
||||||
eContestantStatus[contestant].completedComboFlag = TRUE; // Redundant with completedCombo, used by AI
|
eContestantStatus[contestant].completedComboFlag = TRUE; // Redundant with completedCombo, used by AI
|
||||||
}
|
}
|
||||||
else if (gContestMoves[eContestantStatus[contestant].currMove].comboStarterId != 0)
|
else
|
||||||
|
{
|
||||||
|
if (gContestMoves[eContestantStatus[contestant].currMove].comboStarterId != 0)
|
||||||
{
|
{
|
||||||
eContestantStatus[contestant].hasJudgesAttention = TRUE;
|
eContestantStatus[contestant].hasJudgesAttention = TRUE;
|
||||||
eContestantStatus[contestant].usedComboMove = TRUE;
|
eContestantStatus[contestant].usedComboMove = TRUE;
|
||||||
@ -4490,6 +4497,7 @@ static void CalculateAppealMoveImpact(u8 contestant)
|
|||||||
eContestantStatus[contestant].hasJudgesAttention = FALSE;
|
eContestantStatus[contestant].hasJudgesAttention = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (eContestantStatus[contestant].repeatedMove)
|
if (eContestantStatus[contestant].repeatedMove)
|
||||||
eContestantStatus[contestant].repeatJam = (eContestantStatus[contestant].moveRepeatCount + 1) * 10;
|
eContestantStatus[contestant].repeatJam = (eContestantStatus[contestant].moveRepeatCount + 1) * 10;
|
||||||
|
|
||||||
@ -4728,8 +4736,8 @@ static void UpdateApplauseMeter(void)
|
|||||||
src = &gContestApplauseMeterGfx[64];
|
src = &gContestApplauseMeterGfx[64];
|
||||||
else
|
else
|
||||||
src = gContestApplauseMeterGfx;
|
src = gContestApplauseMeterGfx;
|
||||||
CpuCopy32(src, (void *)(OBJ_VRAM0 + (gSprites[eContest.applauseMeterSpriteId].oam.tileNum + 17 + i) * 32), 32);
|
CpuCopy32(src, (void *)(VRAM + 0x10000 + (gSprites[eContest.applauseMeterSpriteId].oam.tileNum + 17 + i) * 32), 32);
|
||||||
CpuCopy32(src + 32, (void *)(OBJ_VRAM0 + (gSprites[eContest.applauseMeterSpriteId].oam.tileNum + 25 + i) * 32), 32);
|
CpuCopy32(src + 32, (void *)(VRAM + 0x10000 + (gSprites[eContest.applauseMeterSpriteId].oam.tileNum + 25 + i) * 32), 32);
|
||||||
|
|
||||||
if (eContest.applauseLevel > 4)
|
if (eContest.applauseLevel > 4)
|
||||||
StartApplauseOverflowAnimation();
|
StartApplauseOverflowAnimation();
|
||||||
@ -5411,7 +5419,7 @@ static void Contest_PrintTextToBg0WindowStd(u32 windowId, const u8 *b)
|
|||||||
printerTemplate.currentY = 1;
|
printerTemplate.currentY = 1;
|
||||||
printerTemplate.letterSpacing = 0;
|
printerTemplate.letterSpacing = 0;
|
||||||
printerTemplate.lineSpacing = 0;
|
printerTemplate.lineSpacing = 0;
|
||||||
printerTemplate.style = 0;
|
printerTemplate.unk = 0;
|
||||||
printerTemplate.fgColor = 15;
|
printerTemplate.fgColor = 15;
|
||||||
printerTemplate.bgColor = 0;
|
printerTemplate.bgColor = 0;
|
||||||
printerTemplate.shadowColor = 8;
|
printerTemplate.shadowColor = 8;
|
||||||
@ -5434,7 +5442,7 @@ void Contest_PrintTextToBg0WindowAt(u32 windowId, u8 *currChar, s32 x, s32 y, s3
|
|||||||
printerTemplate.currentY = y;
|
printerTemplate.currentY = y;
|
||||||
printerTemplate.letterSpacing = 0;
|
printerTemplate.letterSpacing = 0;
|
||||||
printerTemplate.lineSpacing = 0;
|
printerTemplate.lineSpacing = 0;
|
||||||
printerTemplate.style = 0;
|
printerTemplate.unk = 0;
|
||||||
printerTemplate.fgColor = 15;
|
printerTemplate.fgColor = 15;
|
||||||
printerTemplate.bgColor = 0;
|
printerTemplate.bgColor = 0;
|
||||||
printerTemplate.shadowColor = 8;
|
printerTemplate.shadowColor = 8;
|
||||||
@ -5458,7 +5466,7 @@ static void Contest_StartTextPrinter(const u8 *currChar, bool32 b)
|
|||||||
printerTemplate.currentY = 1;
|
printerTemplate.currentY = 1;
|
||||||
printerTemplate.letterSpacing = 0;
|
printerTemplate.letterSpacing = 0;
|
||||||
printerTemplate.lineSpacing = 0;
|
printerTemplate.lineSpacing = 0;
|
||||||
printerTemplate.style = 0;
|
printerTemplate.unk = 0;
|
||||||
printerTemplate.fgColor = 1;
|
printerTemplate.fgColor = 1;
|
||||||
printerTemplate.bgColor = 0;
|
printerTemplate.bgColor = 0;
|
||||||
printerTemplate.shadowColor = 8;
|
printerTemplate.shadowColor = 8;
|
||||||
|
@ -248,7 +248,7 @@ static void HoldContestPainting(void)
|
|||||||
gContestPaintingFadeCounter--;
|
gContestPaintingFadeCounter--;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON)))
|
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))
|
||||||
{
|
{
|
||||||
gContestPaintingState++;
|
gContestPaintingState++;
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
|
||||||
@ -384,6 +384,8 @@ static void InitContestMonPixels(u16 species, u8 whichSprite)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NONMATCHING
|
||||||
|
// functionally equivalent.
|
||||||
static void _InitContestMonPixels(u8 *spriteGfx, u16 *palette, u16 (*destPixels)[64][64])
|
static void _InitContestMonPixels(u8 *spriteGfx, u16 *palette, u16 (*destPixels)[64][64])
|
||||||
{
|
{
|
||||||
u16 tileY, tileX, pixelY, pixelX;
|
u16 tileY, tileX, pixelY, pixelX;
|
||||||
@ -397,21 +399,125 @@ static void _InitContestMonPixels(u8 *spriteGfx, u16 *palette, u16 (*destPixels)
|
|||||||
{
|
{
|
||||||
for (pixelX = 0; pixelX < 8; pixelX++)
|
for (pixelX = 0; pixelX < 8; pixelX++)
|
||||||
{
|
{
|
||||||
colorIndex = spriteGfx[((tileY * 8) + tileX) * 32 + (pixelY << 2) + (pixelX >> 1)];
|
int offset = 32 * (8 * tileY + tileX) + (pixelY * 4 + pixelX / 2);
|
||||||
|
colorIndex = spriteGfx[offset];
|
||||||
if (pixelX & 1)
|
if (pixelX & 1)
|
||||||
colorIndex >>= 4;
|
colorIndex >>= 4;
|
||||||
else
|
else
|
||||||
colorIndex &= 0xF; // %=16 works here too. Both match
|
colorIndex &= 0xF;
|
||||||
|
|
||||||
if (colorIndex == 0) // transparent pixel
|
if (colorIndex == 0) // transparent pixel
|
||||||
(*destPixels)[tileY * 8 + pixelY][tileX * 8 + pixelX] = 0x8000;
|
(*destPixels)[8 * tileY + pixelY][tileX * 8 + pixelX] = 0x8000;
|
||||||
else
|
else
|
||||||
(*destPixels)[tileY * 8 + pixelY][tileX * 8 + pixelX] = palette[colorIndex];
|
(*destPixels)[8 * tileY + pixelY][tileX * 8 + pixelX] = palette[colorIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
static void _InitContestMonPixels(u8 *spriteGfx, u16 *palette, u16 (*destPixels)[64][64])
|
||||||
|
{
|
||||||
|
asm_unified("\n\
|
||||||
|
push {r4-r7,lr}\n\
|
||||||
|
mov r7, r10\n\
|
||||||
|
mov r6, r9\n\
|
||||||
|
mov r5, r8\n\
|
||||||
|
push {r5-r7}\n\
|
||||||
|
sub sp, 0xC\n\
|
||||||
|
mov r10, r0\n\
|
||||||
|
mov r9, r1\n\
|
||||||
|
str r2, [sp]\n\
|
||||||
|
movs r0, 0\n\
|
||||||
|
_08130394:\n\
|
||||||
|
movs r3, 0\n\
|
||||||
|
adds r1, r0, 0x1\n\
|
||||||
|
str r1, [sp, 0x4]\n\
|
||||||
|
lsls r0, 3\n\
|
||||||
|
str r0, [sp, 0x8]\n\
|
||||||
|
_0813039E:\n\
|
||||||
|
movs r1, 0\n\
|
||||||
|
adds r2, r3, 0x1\n\
|
||||||
|
mov r8, r2\n\
|
||||||
|
ldr r7, [sp, 0x8]\n\
|
||||||
|
adds r0, r7, r3\n\
|
||||||
|
lsls r0, 5\n\
|
||||||
|
mov r12, r0\n\
|
||||||
|
lsls r4, r3, 3\n\
|
||||||
|
_081303AE:\n\
|
||||||
|
movs r3, 0\n\
|
||||||
|
lsls r0, r1, 2\n\
|
||||||
|
adds r6, r1, 0x1\n\
|
||||||
|
mov r2, r12\n\
|
||||||
|
adds r5, r2, r0\n\
|
||||||
|
ldr r7, [sp, 0x8]\n\
|
||||||
|
adds r0, r7, r1\n\
|
||||||
|
lsls r0, 7\n\
|
||||||
|
ldr r1, [sp]\n\
|
||||||
|
adds r2, r0, r1\n\
|
||||||
|
_081303C2:\n\
|
||||||
|
lsrs r0, r3, 1\n\
|
||||||
|
adds r0, r5, r0\n\
|
||||||
|
add r0, r10\n\
|
||||||
|
ldrb r1, [r0]\n\
|
||||||
|
movs r0, 0x1\n\
|
||||||
|
ands r0, r3\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _081303D6\n\
|
||||||
|
lsrs r1, 4\n\
|
||||||
|
b _081303DA\n\
|
||||||
|
_081303D6:\n\
|
||||||
|
movs r0, 0xF\n\
|
||||||
|
ands r1, r0\n\
|
||||||
|
_081303DA:\n\
|
||||||
|
cmp r1, 0\n\
|
||||||
|
bne _081303EC\n\
|
||||||
|
adds r0, r4, r3\n\
|
||||||
|
lsls r0, 1\n\
|
||||||
|
adds r0, r2\n\
|
||||||
|
movs r7, 0x80\n\
|
||||||
|
lsls r7, 8\n\
|
||||||
|
adds r1, r7, 0\n\
|
||||||
|
b _081303F8\n\
|
||||||
|
_081303EC:\n\
|
||||||
|
adds r0, r4, r3\n\
|
||||||
|
lsls r0, 1\n\
|
||||||
|
adds r0, r2\n\
|
||||||
|
lsls r1, 1\n\
|
||||||
|
add r1, r9\n\
|
||||||
|
ldrh r1, [r1]\n\
|
||||||
|
_081303F8:\n\
|
||||||
|
strh r1, [r0]\n\
|
||||||
|
adds r0, r3, 0x1\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r3, r0, 16\n\
|
||||||
|
cmp r3, 0x7\n\
|
||||||
|
bls _081303C2\n\
|
||||||
|
lsls r0, r6, 16\n\
|
||||||
|
lsrs r1, r0, 16\n\
|
||||||
|
cmp r1, 0x7\n\
|
||||||
|
bls _081303AE\n\
|
||||||
|
mov r1, r8\n\
|
||||||
|
lsls r0, r1, 16\n\
|
||||||
|
lsrs r3, r0, 16\n\
|
||||||
|
cmp r3, 0x7\n\
|
||||||
|
bls _0813039E\n\
|
||||||
|
ldr r2, [sp, 0x4]\n\
|
||||||
|
lsls r0, r2, 16\n\
|
||||||
|
lsrs r0, 16\n\
|
||||||
|
cmp r0, 0x7\n\
|
||||||
|
bls _08130394\n\
|
||||||
|
add sp, 0xC\n\
|
||||||
|
pop {r3-r5}\n\
|
||||||
|
mov r8, r3\n\
|
||||||
|
mov r9, r4\n\
|
||||||
|
mov r10, r5\n\
|
||||||
|
pop {r4-r7}\n\
|
||||||
|
pop {r0}\n\
|
||||||
|
bx r0");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define VRAM_PICTURE_DATA(x, y) (((u16 *)(BG_SCREEN_ADDR(12)))[(y) * 32 + (x)])
|
#define VRAM_PICTURE_DATA(x, y) (((u16 *)(BG_SCREEN_ADDR(12)))[(y) * 32 + (x)])
|
||||||
|
|
||||||
@ -501,21 +607,21 @@ static void LoadContestPaintingFrame(u8 contestWinnerId, bool8 arg1)
|
|||||||
|
|
||||||
static void InitPaintingMonOamData(u8 contestWinnerId)
|
static void InitPaintingMonOamData(u8 contestWinnerId)
|
||||||
{
|
{
|
||||||
|
//Some hacks just to get the asm to match
|
||||||
|
#ifndef NONMATCHING
|
||||||
|
asm(""::"r"(contestWinnerId));
|
||||||
|
#endif
|
||||||
|
|
||||||
gMain.oamBuffer[0] = sContestPaintingMonOamData;
|
gMain.oamBuffer[0] = sContestPaintingMonOamData;
|
||||||
gMain.oamBuffer[0].tileNum = 0;
|
gMain.oamBuffer[0].tileNum = 0;
|
||||||
|
|
||||||
if (contestWinnerId > 1)
|
#ifndef NONMATCHING
|
||||||
{
|
if (contestWinnerId) contestWinnerId = gMain.oamBuffer[0].tileNum;
|
||||||
|
#endif
|
||||||
|
|
||||||
gMain.oamBuffer[0].x = 88;
|
gMain.oamBuffer[0].x = 88;
|
||||||
gMain.oamBuffer[0].y = 24;
|
gMain.oamBuffer[0].y = 24;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
gMain.oamBuffer[0].x = 88; // Duplicated Code
|
|
||||||
gMain.oamBuffer[0].y = 24;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static u8 GetImageEffectForContestWinner(u8 contestWinnerId)
|
static u8 GetImageEffectForContestWinner(u8 contestWinnerId)
|
||||||
{
|
{
|
||||||
|
@ -1148,40 +1148,43 @@ static void TryCreateWirelessSprites(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Functionally equivalent, the same except compiler generated variables from
|
||||||
|
// src are placed on different stack positions.
|
||||||
|
|
||||||
|
#ifdef NONMATCHING
|
||||||
static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
|
static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
|
||||||
{
|
{
|
||||||
|
u8 *windowTilesPtr;
|
||||||
u16 windowId;
|
u16 windowId;
|
||||||
s32 origWidth, strWidth;
|
int origWidth;
|
||||||
|
struct WindowTemplate windowTemplate;
|
||||||
|
int strWidth;
|
||||||
u8 *spriteTilePtrs[4];
|
u8 *spriteTilePtrs[4];
|
||||||
u8 *dst;
|
u8 *dst;
|
||||||
|
int i;
|
||||||
|
struct Sprite *sprite;
|
||||||
|
const u8 *src; // The culprit.
|
||||||
|
|
||||||
{
|
|
||||||
struct WindowTemplate windowTemplate; //It's important the lifetime of this struct ends after the clear
|
|
||||||
memset(&windowTemplate, 0, sizeof(windowTemplate));
|
memset(&windowTemplate, 0, sizeof(windowTemplate));
|
||||||
windowTemplate.width = 30;
|
windowTemplate.width = 30;
|
||||||
windowTemplate.height = 2;
|
windowTemplate.height = 2;
|
||||||
windowId = AddWindow(&windowTemplate);
|
windowId = AddWindow(&windowTemplate);
|
||||||
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
|
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
|
||||||
}
|
|
||||||
|
|
||||||
origWidth = GetStringWidth(1, text, 0);
|
origWidth = GetStringWidth(1, text, 0);
|
||||||
if ((strWidth = (origWidth + 9) / 8) > 30)
|
strWidth = (origWidth + 9) / 8;
|
||||||
|
if (strWidth > 30)
|
||||||
strWidth = 30;
|
strWidth = 30;
|
||||||
|
|
||||||
AddTextPrinterParameterized3(windowId, 1, (strWidth * 8 - origWidth) / 2, 1, sContestLinkTextColors, -1, text);
|
AddTextPrinterParameterized3(windowId, 1, (strWidth * 8 - origWidth) / 2, 1, sContestLinkTextColors, -1, text);
|
||||||
|
windowTilesPtr = (u8 *)(GetWindowAttribute(windowId, WINDOW_TILE_DATA));
|
||||||
{
|
src = (u8 *)(sUnknown_0858D6D0);
|
||||||
s32 i;
|
|
||||||
struct Sprite *sprite;
|
|
||||||
const u8 *src, *windowTilesPtr;
|
|
||||||
windowTilesPtr = (const u8 *)(GetWindowAttribute(windowId, WINDOW_TILE_DATA));
|
|
||||||
src = sUnknown_0858D6D0;
|
|
||||||
|
|
||||||
sprite = &gSprites[spriteId];
|
sprite = &gSprites[spriteId];
|
||||||
spriteTilePtrs[0] = (u8 *)((OBJ_VRAM0) + sprite->oam.tileNum * 32);
|
spriteTilePtrs[0] = (u8 *)(sprite->oam.tileNum * 32 + VRAM + 0x10000);
|
||||||
|
|
||||||
for (i = 1; i < 4; i++)
|
for (i = 1; i < 4; i++)
|
||||||
spriteTilePtrs[i] = (u8 *)((OBJ_VRAM0) + gSprites[sprite->data[i - 1]].oam.tileNum * 32);
|
spriteTilePtrs[i] = (void*)(gSprites[sprite->data[i - 1]].oam.tileNum * 32 + VRAM + 0x10000);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
CpuFill32(0, spriteTilePtrs[i], 0x400);
|
CpuFill32(0, spriteTilePtrs[i], 0x400);
|
||||||
@ -1207,12 +1210,288 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
|
|||||||
CpuCopy32(src + 160, dst + 0x100, 0x20);
|
CpuCopy32(src + 160, dst + 0x100, 0x20);
|
||||||
CpuCopy32(src + 160, dst + 0x200, 0x20);
|
CpuCopy32(src + 160, dst + 0x200, 0x20);
|
||||||
CpuCopy32(src + 96, dst + 0x300, 0x20);
|
CpuCopy32(src + 96, dst + 0x300, 0x20);
|
||||||
}
|
|
||||||
RemoveWindow(windowId);
|
RemoveWindow(windowId);
|
||||||
|
|
||||||
return (240 - (strWidth + 2) * 8) / 2;
|
return (240 - (strWidth + 2) * 8) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
|
||||||
|
{
|
||||||
|
asm_unified(
|
||||||
|
"push {r4-r7,lr}\n\
|
||||||
|
mov r7, r10\n\
|
||||||
|
mov r6, r9\n\
|
||||||
|
mov r5, r8\n\
|
||||||
|
push {r5-r7}\n\
|
||||||
|
sub sp, 0x44\n\
|
||||||
|
adds r5, r0, 0\n\
|
||||||
|
lsls r1, 24\n\
|
||||||
|
lsrs r7, r1, 24\n\
|
||||||
|
add r4, sp, 0x20\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0\n\
|
||||||
|
movs r2, 0x8\n\
|
||||||
|
bl memset\n\
|
||||||
|
movs r0, 0x1E\n\
|
||||||
|
strb r0, [r4, 0x3]\n\
|
||||||
|
movs r0, 0x2\n\
|
||||||
|
strb r0, [r4, 0x4]\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
bl AddWindow\n\
|
||||||
|
lsls r6, r0, 24\n\
|
||||||
|
lsrs r4, r6, 24\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0x11\n\
|
||||||
|
bl FillWindowPixelBuffer\n\
|
||||||
|
movs r0, 0x1\n\
|
||||||
|
adds r1, r5, 0\n\
|
||||||
|
movs r2, 0\n\
|
||||||
|
bl GetStringWidth\n\
|
||||||
|
adds r2, r0, 0\n\
|
||||||
|
adds r2, 0x9\n\
|
||||||
|
cmp r2, 0\n\
|
||||||
|
bge _080F6BC4\n\
|
||||||
|
adds r2, 0x7\n\
|
||||||
|
_080F6BC4:\n\
|
||||||
|
asrs r2, 3\n\
|
||||||
|
mov r10, r2\n\
|
||||||
|
cmp r2, 0x1E\n\
|
||||||
|
ble _080F6BD0\n\
|
||||||
|
movs r1, 0x1E\n\
|
||||||
|
mov r10, r1\n\
|
||||||
|
_080F6BD0:\n\
|
||||||
|
mov r1, r10\n\
|
||||||
|
lsls r2, r1, 3\n\
|
||||||
|
subs r2, r0\n\
|
||||||
|
lsrs r0, r2, 31\n\
|
||||||
|
adds r2, r0\n\
|
||||||
|
asrs r2, 1\n\
|
||||||
|
lsls r2, 24\n\
|
||||||
|
lsrs r2, 24\n\
|
||||||
|
ldr r0, =sContestLinkTextColors\n\
|
||||||
|
str r0, [sp]\n\
|
||||||
|
movs r0, 0x1\n\
|
||||||
|
negs r0, r0\n\
|
||||||
|
str r0, [sp, 0x4]\n\
|
||||||
|
str r5, [sp, 0x8]\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0x1\n\
|
||||||
|
movs r3, 0x1\n\
|
||||||
|
bl AddTextPrinterParameterized3\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0x7\n\
|
||||||
|
bl GetWindowAttribute\n\
|
||||||
|
mov r9, r0\n\
|
||||||
|
ldr r2, =sUnknown_0858D6D0\n\
|
||||||
|
mov r8, r2\n\
|
||||||
|
lsls r1, r7, 4\n\
|
||||||
|
adds r1, r7\n\
|
||||||
|
lsls r1, 2\n\
|
||||||
|
ldr r3, =gSprites\n\
|
||||||
|
adds r1, r3\n\
|
||||||
|
ldrh r0, [r1, 0x4]\n\
|
||||||
|
lsls r0, 22\n\
|
||||||
|
lsrs r0, 17\n\
|
||||||
|
ldr r2, =0x06010000\n\
|
||||||
|
adds r0, r2\n\
|
||||||
|
str r0, [sp, 0xC]\n\
|
||||||
|
str r6, [sp, 0x38]\n\
|
||||||
|
mov r7, sp\n\
|
||||||
|
adds r7, 0x1C\n\
|
||||||
|
str r7, [sp, 0x2C]\n\
|
||||||
|
mov r0, r10\n\
|
||||||
|
adds r0, 0x2\n\
|
||||||
|
str r0, [sp, 0x30]\n\
|
||||||
|
movs r5, 0\n\
|
||||||
|
add r7, sp, 0x10\n\
|
||||||
|
mov r12, r7\n\
|
||||||
|
adds r6, r1, 0\n\
|
||||||
|
adds r6, 0x2E\n\
|
||||||
|
movs r4, 0x2\n\
|
||||||
|
_080F6C34:\n\
|
||||||
|
adds r0, r6, r5\n\
|
||||||
|
movs r7, 0\n\
|
||||||
|
ldrsh r1, [r0, r7]\n\
|
||||||
|
lsls r0, r1, 4\n\
|
||||||
|
adds r0, r1\n\
|
||||||
|
lsls r0, 2\n\
|
||||||
|
adds r0, r3\n\
|
||||||
|
ldrh r0, [r0, 0x4]\n\
|
||||||
|
lsls r0, 22\n\
|
||||||
|
lsrs r0, 17\n\
|
||||||
|
adds r0, r2\n\
|
||||||
|
mov r1, r12\n\
|
||||||
|
adds r1, 0x4\n\
|
||||||
|
mov r12, r1\n\
|
||||||
|
subs r1, 0x4\n\
|
||||||
|
stm r1!, {r0}\n\
|
||||||
|
adds r5, 0x2\n\
|
||||||
|
subs r4, 0x1\n\
|
||||||
|
cmp r4, 0\n\
|
||||||
|
bge _080F6C34\n\
|
||||||
|
mov r7, r8\n\
|
||||||
|
adds r7, 0x80\n\
|
||||||
|
mov r2, r8\n\
|
||||||
|
adds r2, 0x40\n\
|
||||||
|
str r2, [sp, 0x28]\n\
|
||||||
|
mov r0, r8\n\
|
||||||
|
adds r0, 0x20\n\
|
||||||
|
str r0, [sp, 0x3C]\n\
|
||||||
|
mov r1, r8\n\
|
||||||
|
adds r1, 0xA0\n\
|
||||||
|
str r1, [sp, 0x40]\n\
|
||||||
|
adds r2, 0x20\n\
|
||||||
|
str r2, [sp, 0x34]\n\
|
||||||
|
add r5, sp, 0xC\n\
|
||||||
|
movs r6, 0\n\
|
||||||
|
movs r4, 0x3\n\
|
||||||
|
_080F6C7C:\n\
|
||||||
|
str r6, [sp, 0x1C]\n\
|
||||||
|
ldm r5!, {r1}\n\
|
||||||
|
ldr r0, [sp, 0x2C]\n\
|
||||||
|
ldr r2, =0x05000100\n\
|
||||||
|
bl CpuSet\n\
|
||||||
|
subs r4, 0x1\n\
|
||||||
|
cmp r4, 0\n\
|
||||||
|
bge _080F6C7C\n\
|
||||||
|
ldr r5, [sp, 0xC]\n\
|
||||||
|
ldr r6, =0x04000008\n\
|
||||||
|
mov r0, r8\n\
|
||||||
|
adds r1, r5, 0\n\
|
||||||
|
adds r2, r6, 0\n\
|
||||||
|
bl CpuSet\n\
|
||||||
|
movs r0, 0x80\n\
|
||||||
|
lsls r0, 1\n\
|
||||||
|
adds r1, r5, r0\n\
|
||||||
|
adds r0, r7, 0\n\
|
||||||
|
adds r2, r6, 0\n\
|
||||||
|
bl CpuSet\n\
|
||||||
|
movs r2, 0x80\n\
|
||||||
|
lsls r2, 2\n\
|
||||||
|
adds r1, r5, r2\n\
|
||||||
|
adds r0, r7, 0\n\
|
||||||
|
adds r2, r6, 0\n\
|
||||||
|
bl CpuSet\n\
|
||||||
|
movs r7, 0xC0\n\
|
||||||
|
lsls r7, 2\n\
|
||||||
|
adds r1, r5, r7\n\
|
||||||
|
ldr r0, [sp, 0x28]\n\
|
||||||
|
adds r2, r6, 0\n\
|
||||||
|
bl CpuSet\n\
|
||||||
|
movs r4, 0\n\
|
||||||
|
cmp r4, r10\n\
|
||||||
|
bge _080F6D32\n\
|
||||||
|
adds r7, r6, 0\n\
|
||||||
|
_080F6CCE:\n\
|
||||||
|
adds r6, r4, 0x1\n\
|
||||||
|
adds r0, r6, 0\n\
|
||||||
|
cmp r6, 0\n\
|
||||||
|
bge _080F6CDA\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
adds r0, 0x8\n\
|
||||||
|
_080F6CDA:\n\
|
||||||
|
asrs r0, 3\n\
|
||||||
|
lsls r1, r0, 2\n\
|
||||||
|
add r1, sp\n\
|
||||||
|
adds r1, 0xC\n\
|
||||||
|
lsls r0, 3\n\
|
||||||
|
subs r0, r6, r0\n\
|
||||||
|
lsls r0, 5\n\
|
||||||
|
ldr r1, [r1]\n\
|
||||||
|
adds r5, r1, r0\n\
|
||||||
|
mov r0, r8\n\
|
||||||
|
adds r0, 0xC0\n\
|
||||||
|
adds r1, r5, 0\n\
|
||||||
|
adds r2, r7, 0\n\
|
||||||
|
bl CpuSet\n\
|
||||||
|
movs r0, 0x80\n\
|
||||||
|
lsls r0, 1\n\
|
||||||
|
adds r1, r5, r0\n\
|
||||||
|
mov r0, r9\n\
|
||||||
|
adds r2, r7, 0\n\
|
||||||
|
bl CpuSet\n\
|
||||||
|
movs r0, 0xF0\n\
|
||||||
|
lsls r0, 2\n\
|
||||||
|
add r0, r9\n\
|
||||||
|
movs r2, 0x80\n\
|
||||||
|
lsls r2, 2\n\
|
||||||
|
adds r1, r5, r2\n\
|
||||||
|
adds r2, r7, 0\n\
|
||||||
|
bl CpuSet\n\
|
||||||
|
movs r0, 0xC0\n\
|
||||||
|
lsls r0, 2\n\
|
||||||
|
adds r1, r5, r0\n\
|
||||||
|
mov r0, r8\n\
|
||||||
|
adds r0, 0xE0\n\
|
||||||
|
adds r2, r7, 0\n\
|
||||||
|
bl CpuSet\n\
|
||||||
|
movs r1, 0x20\n\
|
||||||
|
add r9, r1\n\
|
||||||
|
adds r4, r6, 0\n\
|
||||||
|
cmp r4, r10\n\
|
||||||
|
blt _080F6CCE\n\
|
||||||
|
_080F6D32:\n\
|
||||||
|
adds r2, r4, 0x1\n\
|
||||||
|
adds r0, r2, 0\n\
|
||||||
|
cmp r2, 0\n\
|
||||||
|
bge _080F6D3E\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
adds r0, 0x8\n\
|
||||||
|
_080F6D3E:\n\
|
||||||
|
asrs r0, 3\n\
|
||||||
|
lsls r1, r0, 2\n\
|
||||||
|
add r1, sp\n\
|
||||||
|
adds r1, 0xC\n\
|
||||||
|
lsls r0, 3\n\
|
||||||
|
subs r0, r2, r0\n\
|
||||||
|
lsls r0, 5\n\
|
||||||
|
ldr r1, [r1]\n\
|
||||||
|
adds r5, r1, r0\n\
|
||||||
|
ldr r4, =0x04000008\n\
|
||||||
|
ldr r0, [sp, 0x3C]\n\
|
||||||
|
adds r1, r5, 0\n\
|
||||||
|
adds r2, r4, 0\n\
|
||||||
|
bl CpuSet\n\
|
||||||
|
movs r2, 0x80\n\
|
||||||
|
lsls r2, 1\n\
|
||||||
|
adds r1, r5, r2\n\
|
||||||
|
ldr r0, [sp, 0x40]\n\
|
||||||
|
adds r2, r4, 0\n\
|
||||||
|
bl CpuSet\n\
|
||||||
|
movs r7, 0x80\n\
|
||||||
|
lsls r7, 2\n\
|
||||||
|
adds r1, r5, r7\n\
|
||||||
|
ldr r0, [sp, 0x40]\n\
|
||||||
|
adds r2, r4, 0\n\
|
||||||
|
bl CpuSet\n\
|
||||||
|
movs r0, 0xC0\n\
|
||||||
|
lsls r0, 2\n\
|
||||||
|
adds r1, r5, r0\n\
|
||||||
|
ldr r0, [sp, 0x34]\n\
|
||||||
|
adds r2, r4, 0\n\
|
||||||
|
bl CpuSet\n\
|
||||||
|
ldr r1, [sp, 0x38]\n\
|
||||||
|
lsrs r0, r1, 24\n\
|
||||||
|
bl RemoveWindow\n\
|
||||||
|
ldr r2, [sp, 0x30]\n\
|
||||||
|
lsls r1, r2, 3\n\
|
||||||
|
movs r0, 0xF0\n\
|
||||||
|
subs r0, r1\n\
|
||||||
|
asrs r0, 1\n\
|
||||||
|
add sp, 0x44\n\
|
||||||
|
pop {r3-r5}\n\
|
||||||
|
mov r8, r3\n\
|
||||||
|
mov r9, r4\n\
|
||||||
|
mov r10, r5\n\
|
||||||
|
pop {r4-r7}\n\
|
||||||
|
pop {r1}\n\
|
||||||
|
bx r1\n\
|
||||||
|
.pool");
|
||||||
|
}
|
||||||
|
#endif // NONMATCHING
|
||||||
|
|
||||||
static void LoadContestResultSprites(void)
|
static void LoadContestResultSprites(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -1922,7 +2201,7 @@ static void AddContestTextPrinter(int windowId, u8 *str, int x)
|
|||||||
textPrinter.currentY = 2;
|
textPrinter.currentY = 2;
|
||||||
textPrinter.letterSpacing = 0;
|
textPrinter.letterSpacing = 0;
|
||||||
textPrinter.lineSpacing = 0;
|
textPrinter.lineSpacing = 0;
|
||||||
textPrinter.style = 0;
|
textPrinter.unk = 0;
|
||||||
textPrinter.fgColor = 1;
|
textPrinter.fgColor = 1;
|
||||||
textPrinter.bgColor = 0;
|
textPrinter.bgColor = 0;
|
||||||
textPrinter.shadowColor = 8;
|
textPrinter.shadowColor = 8;
|
||||||
|
@ -1143,7 +1143,7 @@ static void CB2_RunCreditsSequence(void)
|
|||||||
RunTasks();
|
RunTasks();
|
||||||
AnimateSprites();
|
AnimateSprites();
|
||||||
|
|
||||||
if ((JOY_HELD(B_BUTTON))
|
if ((gMain.heldKeys & B_BUTTON)
|
||||||
&& gHasHallOfFameRecords != 0
|
&& gHasHallOfFameRecords != 0
|
||||||
&& gTasks[gUnknown_0203BCE2].func == Task_ProgressCreditTasks)
|
&& gTasks[gUnknown_0203BCE2].func == Task_ProgressCreditTasks)
|
||||||
{
|
{
|
||||||
@ -1160,7 +1160,7 @@ static void sub_8175548(void)
|
|||||||
{
|
{
|
||||||
ResetBgsAndClearDma3BusyFlags(0);
|
ResetBgsAndClearDma3BusyFlags(0);
|
||||||
InitBgsFromTemplates(0, sBackgroundTemplates, 1);
|
InitBgsFromTemplates(0, sBackgroundTemplates, 1);
|
||||||
SetBgTilemapBuffer(0, AllocZeroed(BG_SCREEN_SIZE));
|
SetBgTilemapBuffer(0, AllocZeroed(0x800));
|
||||||
LoadPalette(gUnknown_085E56F0, 0x80, 0x40);
|
LoadPalette(gUnknown_085E56F0, 0x80, 0x40);
|
||||||
InitWindows(sWindowTemplates);
|
InitWindows(sWindowTemplates);
|
||||||
DeactivateAllTextPrinters();
|
DeactivateAllTextPrinters();
|
||||||
|
@ -1186,7 +1186,7 @@ static void DaycareAddTextPrinter(u8 windowId, const u8 *text, u32 x, u32 y)
|
|||||||
printer.y = y;
|
printer.y = y;
|
||||||
printer.currentX = x;
|
printer.currentX = x;
|
||||||
printer.currentY = y;
|
printer.currentY = y;
|
||||||
printer.style = 0;
|
printer.unk = 0;
|
||||||
gTextFlags.useAlternateDownArrow = 0;
|
gTextFlags.useAlternateDownArrow = 0;
|
||||||
printer.letterSpacing = 0;
|
printer.letterSpacing = 0;
|
||||||
printer.lineSpacing = 1;
|
printer.lineSpacing = 1;
|
||||||
@ -1237,7 +1237,7 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId)
|
|||||||
{
|
{
|
||||||
u32 input = ListMenu_ProcessInput(gTasks[taskId].tMenuListTaskId);
|
u32 input = ListMenu_ProcessInput(gTasks[taskId].tMenuListTaskId);
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
switch (input)
|
switch (input)
|
||||||
{
|
{
|
||||||
@ -1255,7 +1255,7 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId)
|
|||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
EnableBothScriptContexts();
|
EnableBothScriptContexts();
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
gSpecialVar_Result = DAYCARE_EXITED_LEVEL_MENU;
|
gSpecialVar_Result = DAYCARE_EXITED_LEVEL_MENU;
|
||||||
DestroyListMenuTask(gTasks[taskId].tMenuListTaskId, NULL, NULL);
|
DestroyListMenuTask(gTasks[taskId].tMenuListTaskId, NULL, NULL);
|
||||||
|
@ -1147,7 +1147,7 @@ static void DontTossDecoration(u8 taskId)
|
|||||||
|
|
||||||
static void ReturnToDecorationItemsAfterInvalidSelection(u8 taskId)
|
static void ReturnToDecorationItemsAfterInvalidSelection(u8 taskId)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
{
|
||||||
ClearDialogWindowAndFrame(0, 0);
|
ClearDialogWindowAndFrame(0, 0);
|
||||||
AddDecorationWindow(WINDOW_DECORATION_CATEGORIES);
|
AddDecorationWindow(WINDOW_DECORATION_CATEGORIES);
|
||||||
@ -1803,7 +1803,7 @@ static bool8 ApplyCursorMovement_IsInvalid(u8 taskId)
|
|||||||
|
|
||||||
static bool8 IsHoldingDirection(void)
|
static bool8 IsHoldingDirection(void)
|
||||||
{
|
{
|
||||||
u16 heldKeys = JOY_HELD(DPAD_ANY);
|
u16 heldKeys = gMain.heldKeys & DPAD_ANY;
|
||||||
if (heldKeys != DPAD_UP && heldKeys != DPAD_DOWN && heldKeys != DPAD_LEFT && heldKeys != DPAD_RIGHT)
|
if (heldKeys != DPAD_UP && heldKeys != DPAD_DOWN && heldKeys != DPAD_LEFT && heldKeys != DPAD_RIGHT)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -1827,14 +1827,13 @@ static void Task_SelectLocation(u8 taskId)
|
|||||||
sPlacePutAwayYesNoFunctions[tDecorationItemsMenuCommand].yesFunc(taskId);
|
sPlacePutAwayYesNoFunctions[tDecorationItemsMenuCommand].yesFunc(taskId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (tButton == B_BUTTON)
|
||||||
if (tButton == B_BUTTON)
|
|
||||||
{
|
{
|
||||||
sPlacePutAwayYesNoFunctions[tDecorationItemsMenuCommand].noFunc(taskId);
|
sPlacePutAwayYesNoFunctions[tDecorationItemsMenuCommand].noFunc(taskId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((JOY_HELD(DPAD_ANY)) == DPAD_UP)
|
if ((gMain.heldKeys & DPAD_ANY) == DPAD_UP)
|
||||||
{
|
{
|
||||||
sDecorationLastDirectionMoved = DIR_SOUTH;
|
sDecorationLastDirectionMoved = DIR_SOUTH;
|
||||||
gSprites[sDecor_CameraSpriteObjectIdx1].data[2] = 0;
|
gSprites[sDecor_CameraSpriteObjectIdx1].data[2] = 0;
|
||||||
@ -1842,7 +1841,7 @@ static void Task_SelectLocation(u8 taskId)
|
|||||||
tCursorY--;
|
tCursorY--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((JOY_HELD(DPAD_ANY)) == DPAD_DOWN)
|
if ((gMain.heldKeys & DPAD_ANY) == DPAD_DOWN)
|
||||||
{
|
{
|
||||||
sDecorationLastDirectionMoved = DIR_NORTH;
|
sDecorationLastDirectionMoved = DIR_NORTH;
|
||||||
gSprites[sDecor_CameraSpriteObjectIdx1].data[2] = 0;
|
gSprites[sDecor_CameraSpriteObjectIdx1].data[2] = 0;
|
||||||
@ -1850,7 +1849,7 @@ static void Task_SelectLocation(u8 taskId)
|
|||||||
tCursorY++;
|
tCursorY++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((JOY_HELD(DPAD_ANY)) == DPAD_LEFT)
|
if ((gMain.heldKeys & DPAD_ANY) == DPAD_LEFT)
|
||||||
{
|
{
|
||||||
sDecorationLastDirectionMoved = DIR_WEST;
|
sDecorationLastDirectionMoved = DIR_WEST;
|
||||||
gSprites[sDecor_CameraSpriteObjectIdx1].data[2] = -2;
|
gSprites[sDecor_CameraSpriteObjectIdx1].data[2] = -2;
|
||||||
@ -1858,7 +1857,7 @@ static void Task_SelectLocation(u8 taskId)
|
|||||||
tCursorX--;
|
tCursorX--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((JOY_HELD(DPAD_ANY)) == DPAD_RIGHT)
|
if ((gMain.heldKeys & DPAD_ANY) == DPAD_RIGHT)
|
||||||
{
|
{
|
||||||
sDecorationLastDirectionMoved = DIR_EAST;
|
sDecorationLastDirectionMoved = DIR_EAST;
|
||||||
gSprites[sDecor_CameraSpriteObjectIdx1].data[2] = 2;
|
gSprites[sDecor_CameraSpriteObjectIdx1].data[2] = 2;
|
||||||
@ -1878,10 +1877,10 @@ static void Task_SelectLocation(u8 taskId)
|
|||||||
|
|
||||||
if (!tButton)
|
if (!tButton)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
tButton = A_BUTTON;
|
tButton = A_BUTTON;
|
||||||
|
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & B_BUTTON)
|
||||||
tButton = B_BUTTON;
|
tButton = B_BUTTON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1896,7 +1895,7 @@ static void ContinueDecorating(u8 taskId)
|
|||||||
|
|
||||||
static void CantPlaceDecorationPrompt(u8 taskId)
|
static void CantPlaceDecorationPrompt(u8 taskId)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
|
||||||
ContinueDecorating(taskId);
|
ContinueDecorating(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1929,7 +1928,7 @@ static void CopyTile(u8 *dest, u16 tile)
|
|||||||
case BG_TILE_H_FLIP(0) >> 10:
|
case BG_TILE_H_FLIP(0) >> 10:
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
dest[4 * i + 0] = (buffer[4 * (i + 1) - 1] >> 4) + ((buffer[4 * (i + 1) - 1] & 0x0F) << 4);
|
dest[4 * i] = (buffer[4 * (i + 1) - 1] >> 4) + ((buffer[4 * (i + 1) - 1] & 0x0F) << 4);
|
||||||
dest[4 * i + 1] = (buffer[4 * (i + 1) - 2] >> 4) + ((buffer[4 * (i + 1) - 2] & 0x0F) << 4);
|
dest[4 * i + 1] = (buffer[4 * (i + 1) - 2] >> 4) + ((buffer[4 * (i + 1) - 2] & 0x0F) << 4);
|
||||||
dest[4 * i + 2] = (buffer[4 * (i + 1) - 3] >> 4) + ((buffer[4 * (i + 1) - 3] & 0x0F) << 4);
|
dest[4 * i + 2] = (buffer[4 * (i + 1) - 3] >> 4) + ((buffer[4 * (i + 1) - 3] & 0x0F) << 4);
|
||||||
dest[4 * i + 3] = (buffer[4 * (i + 1) - 4] >> 4) + ((buffer[4 * (i + 1) - 4] & 0x0F) << 4);
|
dest[4 * i + 3] = (buffer[4 * (i + 1) - 4] >> 4) + ((buffer[4 * (i + 1) - 4] & 0x0F) << 4);
|
||||||
@ -1938,7 +1937,7 @@ static void CopyTile(u8 *dest, u16 tile)
|
|||||||
case BG_TILE_V_FLIP(0) >> 10:
|
case BG_TILE_V_FLIP(0) >> 10:
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
dest[4 * i + 0] = buffer[4 * (7 - i) + 0];
|
dest[4 * i] = buffer[4 * (7 - i)];
|
||||||
dest[4 * i + 1] = buffer[4 * (7 - i) + 1];
|
dest[4 * i + 1] = buffer[4 * (7 - i) + 1];
|
||||||
dest[4 * i + 2] = buffer[4 * (7 - i) + 2];
|
dest[4 * i + 2] = buffer[4 * (7 - i) + 2];
|
||||||
dest[4 * i + 3] = buffer[4 * (7 - i) + 3];
|
dest[4 * i + 3] = buffer[4 * (7 - i) + 3];
|
||||||
@ -2387,7 +2386,7 @@ static void AttemptPutAwayDecoration_(u8 taskId)
|
|||||||
|
|
||||||
static void ContinuePuttingAwayDecorationsPrompt(u8 taskId)
|
static void ContinuePuttingAwayDecorationsPrompt(u8 taskId)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
|
||||||
ContinuePuttingAwayDecorations(taskId);
|
ContinuePuttingAwayDecorations(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,22 +219,18 @@ void BufferTrendyPhraseString(void)
|
|||||||
ConvertEasyChatWordsToString(gStringVar1, s->words, 2, 1);
|
ConvertEasyChatWordsToString(gStringVar1, s->words, 2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TrendyPhraseIsOld(void)
|
void TrendyPhraseIsOld(void)
|
||||||
{
|
{
|
||||||
u8 result = 0;
|
u16 result = 0;
|
||||||
|
|
||||||
do
|
if (gSaveBlock1Ptr->easyChatPairs[0].unk0_0 - gSaveBlock1Ptr->easyChatPairs[1].unk0_0 < 2)
|
||||||
{
|
{
|
||||||
if (gSaveBlock1Ptr->easyChatPairs[0].unk0_0 - gSaveBlock1Ptr->easyChatPairs[1].unk0_0 > 1)
|
#ifndef NONMATCHING
|
||||||
break;
|
asm("":::"r2"); //Force the compiler to store address of gSaveBlock1 in r3 instead of r2
|
||||||
if (gSaveBlock1Ptr->easyChatPairs[0].unk1_6)
|
#endif
|
||||||
break;
|
if (!gSaveBlock1Ptr->easyChatPairs[0].unk1_6 && gSaveBlock1Ptr->easyChatPairs[1].unk1_6)
|
||||||
if (!gSaveBlock1Ptr->easyChatPairs[1].unk1_6)
|
|
||||||
break;
|
|
||||||
result = 1;
|
result = 1;
|
||||||
} while (0);
|
}
|
||||||
|
|
||||||
gSpecialVar_Result = result;
|
gSpecialVar_Result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,46 +245,46 @@ static bool8 sub_8122A58(struct EasyChatPair *a, struct EasyChatPair *b, u8 c)
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if (a->unk0_0 > b->unk0_0)
|
if (a->unk0_0 > b->unk0_0)
|
||||||
return TRUE;
|
return 1;
|
||||||
if (a->unk0_0 < b->unk0_0)
|
if (a->unk0_0 < b->unk0_0)
|
||||||
return FALSE;
|
return 0;
|
||||||
if (a->unk0_7 > b->unk0_7)
|
if (a->unk0_7 > b->unk0_7)
|
||||||
return TRUE;
|
return 1;
|
||||||
if (a->unk0_7 < b->unk0_7)
|
if (a->unk0_7 < b->unk0_7)
|
||||||
return FALSE;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (a->unk0_7 > b->unk0_7)
|
if (a->unk0_7 > b->unk0_7)
|
||||||
return TRUE;
|
return 1;
|
||||||
if (a->unk0_7 < b->unk0_7)
|
if (a->unk0_7 < b->unk0_7)
|
||||||
return FALSE;
|
return 0;
|
||||||
if (a->unk0_0 > b->unk0_0)
|
if (a->unk0_0 > b->unk0_0)
|
||||||
return TRUE;
|
return 1;
|
||||||
if (a->unk0_0 < b->unk0_0)
|
if (a->unk0_0 < b->unk0_0)
|
||||||
return FALSE;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (a->unk0_0 > b->unk0_0)
|
if (a->unk0_0 > b->unk0_0)
|
||||||
return TRUE;
|
return 1;
|
||||||
if (a->unk0_0 < b->unk0_0)
|
if (a->unk0_0 < b->unk0_0)
|
||||||
return FALSE;
|
return 0;
|
||||||
if (a->unk0_7 > b->unk0_7)
|
if (a->unk0_7 > b->unk0_7)
|
||||||
return TRUE;
|
return 1;
|
||||||
if (a->unk0_7 < b->unk0_7)
|
if (a->unk0_7 < b->unk0_7)
|
||||||
return FALSE;
|
return 0;
|
||||||
if (a->unk2 > b->unk2)
|
if (a->unk2 > b->unk2)
|
||||||
return TRUE;
|
return 1;
|
||||||
if (a->unk2 < b->unk2)
|
if (a->unk2 < b->unk2)
|
||||||
return FALSE;
|
return 0;
|
||||||
if (a->words[0] > b->words[0])
|
if (a->words[0] > b->words[0])
|
||||||
return TRUE;
|
return 1;
|
||||||
if (a->words[0] < b->words[0])
|
if (a->words[0] < b->words[0])
|
||||||
return FALSE;
|
return 0;
|
||||||
if (a->words[1] > b->words[1])
|
if (a->words[1] > b->words[1])
|
||||||
return TRUE;
|
return 1;
|
||||||
if (a->words[1] < b->words[1])
|
if (a->words[1] < b->words[1])
|
||||||
return FALSE;
|
return 0;
|
||||||
return TRUE;
|
return 1;
|
||||||
}
|
}
|
||||||
return Random() & 1;
|
return Random() & 1;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ struct DigitPrinterAlloc
|
|||||||
};
|
};
|
||||||
|
|
||||||
// this file's functions
|
// this file's functions
|
||||||
static u8 GetFirstOamId(u8 oamCount);
|
static u8 GetFirstOamId(u8 oamCount);;
|
||||||
static void CopyWorkToOam(struct DigitPrinter *objWork);
|
static void CopyWorkToOam(struct DigitPrinter *objWork);
|
||||||
static void DrawNumObjsLeadingZeros(struct DigitPrinter *objWork, s32 num, bool32 sign);
|
static void DrawNumObjsLeadingZeros(struct DigitPrinter *objWork, s32 num, bool32 sign);
|
||||||
static void DrawNumObjsMinusInFront(struct DigitPrinter *objWork, s32 num, bool32 sign);
|
static void DrawNumObjsMinusInFront(struct DigitPrinter *objWork, s32 num, bool32 sign);
|
||||||
|
@ -107,7 +107,7 @@ static void Task_DiplomaFadeIn(u8 taskId)
|
|||||||
|
|
||||||
static void Task_DiplomaWaitForKeyPress(u8 taskId)
|
static void Task_DiplomaWaitForKeyPress(u8 taskId)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
{
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
|
||||||
gTasks[taskId].func = Task_DiplomaFadeOut;
|
gTasks[taskId].func = Task_DiplomaFadeOut;
|
||||||
|
@ -2355,19 +2355,19 @@ static void sub_8027554(void)
|
|||||||
{
|
{
|
||||||
if (gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] == 0)
|
if (gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] == 0)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(DPAD_UP))
|
if (gMain.newKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 2;
|
gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 2;
|
||||||
gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] = 6;
|
gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] = 6;
|
||||||
PlaySE(SE_M_CHARM);
|
PlaySE(SE_M_CHARM);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_LEFT))
|
else if (gMain.newKeys & DPAD_LEFT)
|
||||||
{
|
{
|
||||||
gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 3;
|
gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 3;
|
||||||
gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] = 6;
|
gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] = 6;
|
||||||
PlaySE(SE_M_CHARM);
|
PlaySE(SE_M_CHARM);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_RIGHT))
|
else if (gMain.newKeys & DPAD_RIGHT)
|
||||||
{
|
{
|
||||||
gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 1;
|
gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 1;
|
||||||
gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] = 6;
|
gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] = 6;
|
||||||
@ -2653,7 +2653,7 @@ static void Task_ShowDodrioBerryPickingRecords(u8 taskId)
|
|||||||
data[0]++;
|
data[0]++;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
{
|
||||||
rbox_fill_rectangle(data[1]);
|
rbox_fill_rectangle(data[1]);
|
||||||
CopyWindowToVram(data[1], 1);
|
CopyWindowToVram(data[1], 1);
|
||||||
@ -4266,7 +4266,7 @@ static void sub_802988C(void)
|
|||||||
gUnknown_02022CF8->state++;
|
gUnknown_02022CF8->state++;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (++gUnknown_02022CF8->unk301C >= 30 && JOY_NEW(A_BUTTON))
|
if (++gUnknown_02022CF8->unk301C >= 30 && gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
gUnknown_02022CF8->unk301C = 0;
|
gUnknown_02022CF8->unk301C = 0;
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
@ -4298,7 +4298,7 @@ static void sub_802988C(void)
|
|||||||
gUnknown_02022CF8->state++;
|
gUnknown_02022CF8->state++;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
if (++gUnknown_02022CF8->unk301C >= 30 && JOY_NEW(A_BUTTON))
|
if (++gUnknown_02022CF8->unk301C >= 30 && gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
gUnknown_02022CF8->unk301C = 0;
|
gUnknown_02022CF8->unk301C = 0;
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
@ -4358,7 +4358,7 @@ static void sub_802988C(void)
|
|||||||
gUnknown_02022CF8->state++;
|
gUnknown_02022CF8->state++;
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
if (++gUnknown_02022CF8->unk301C >= 30 && JOY_NEW(A_BUTTON))
|
if (++gUnknown_02022CF8->unk301C >= 30 && gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
gUnknown_02022CF8->unk301C = 0;
|
gUnknown_02022CF8->unk301C = 0;
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
@ -4424,14 +4424,14 @@ static void sub_802A010(void)
|
|||||||
AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_SelectorArrow2, 0, ((y - 1) * 16) + 1, -1, NULL);
|
AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_SelectorArrow2, 0, ((y - 1) * 16) + 1, -1, NULL);
|
||||||
CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 3);
|
CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 3);
|
||||||
// Increment state only if A or B button have been pressed.
|
// Increment state only if A or B button have been pressed.
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
if (gUnknown_02022CF8->unk3020 == 0)
|
if (gUnknown_02022CF8->unk3020 == 0)
|
||||||
gUnknown_02022CF8->unk3020 = 1;
|
gUnknown_02022CF8->unk3020 = 1;
|
||||||
gUnknown_02022CF8->state++;
|
gUnknown_02022CF8->state++;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_UP | DPAD_DOWN))
|
else if (gMain.newKeys & (DPAD_UP | DPAD_DOWN))
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
switch (gUnknown_02022CF8->unk3020)
|
switch (gUnknown_02022CF8->unk3020)
|
||||||
@ -4447,7 +4447,7 @@ static void sub_802A010(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
gUnknown_02022CF8->unk3020 = 2;
|
gUnknown_02022CF8->unk3020 = 2;
|
||||||
|
@ -1523,7 +1523,7 @@ static u16 sub_811AB68(void)
|
|||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
sub_811BF78();
|
sub_811BF78();
|
||||||
sEasyChatScreen->state = 2;
|
sEasyChatScreen->state = 2;
|
||||||
@ -1532,30 +1532,30 @@ static u16 sub_811AB68(void)
|
|||||||
sEasyChatScreen->unk_0c = 0;
|
sEasyChatScreen->unk_0c = 0;
|
||||||
return 9;
|
return 9;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
return sub_811B150();
|
return sub_811B150();
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(START_BUTTON))
|
else if (gMain.newKeys & START_BUTTON)
|
||||||
{
|
{
|
||||||
return sub_811B1B4();
|
return sub_811B1B4();
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_UP))
|
else if (gMain.newKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
sEasyChatScreen->mainCursorRow--;
|
sEasyChatScreen->mainCursorRow--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_LEFT))
|
else if (gMain.newKeys & DPAD_LEFT)
|
||||||
{
|
{
|
||||||
sEasyChatScreen->mainCursorColumn--;
|
sEasyChatScreen->mainCursorColumn--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_DOWN))
|
else if (gMain.newKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
sEasyChatScreen->mainCursorRow++;
|
sEasyChatScreen->mainCursorRow++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_RIGHT))
|
else if (gMain.newKeys & DPAD_RIGHT)
|
||||||
{
|
{
|
||||||
sEasyChatScreen->mainCursorColumn++;
|
sEasyChatScreen->mainCursorColumn++;
|
||||||
break;
|
break;
|
||||||
@ -1595,7 +1595,7 @@ static u16 sub_811ACDC(void)
|
|||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
switch (sEasyChatScreen->mainCursorColumn)
|
switch (sEasyChatScreen->mainCursorColumn)
|
||||||
{
|
{
|
||||||
@ -1610,30 +1610,30 @@ static u16 sub_811ACDC(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
return sub_811B150();
|
return sub_811B150();
|
||||||
}
|
}
|
||||||
if (JOY_NEW(START_BUTTON))
|
else if (gMain.newKeys & START_BUTTON)
|
||||||
{
|
{
|
||||||
return sub_811B1B4();
|
return sub_811B1B4();
|
||||||
}
|
}
|
||||||
if (JOY_NEW(DPAD_UP))
|
else if (gMain.newKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
sEasyChatScreen->mainCursorRow--;
|
sEasyChatScreen->mainCursorRow--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (JOY_NEW(DPAD_LEFT))
|
else if (gMain.newKeys & DPAD_LEFT)
|
||||||
{
|
{
|
||||||
sEasyChatScreen->mainCursorColumn--;
|
sEasyChatScreen->mainCursorColumn--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (JOY_NEW(DPAD_DOWN))
|
else if (gMain.newKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
sEasyChatScreen->mainCursorRow = 0;
|
sEasyChatScreen->mainCursorRow = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (JOY_NEW(DPAD_RIGHT))
|
else if (gMain.newKeys & DPAD_RIGHT)
|
||||||
{
|
{
|
||||||
sEasyChatScreen->mainCursorColumn++;
|
sEasyChatScreen->mainCursorColumn++;
|
||||||
break;
|
break;
|
||||||
@ -1666,10 +1666,10 @@ static u16 sub_811ACDC(void)
|
|||||||
|
|
||||||
static u16 sub_811AE44(void)
|
static u16 sub_811AE44(void)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & B_BUTTON)
|
||||||
return sub_811B32C();
|
return sub_811B32C();
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
if (sEasyChatScreen->unk_0a != -1)
|
if (sEasyChatScreen->unk_0a != -1)
|
||||||
return sub_811B2B0();
|
return sub_811B2B0();
|
||||||
@ -1685,19 +1685,19 @@ static u16 sub_811AE44(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JOY_NEW(SELECT_BUTTON))
|
if (gMain.newKeys & SELECT_BUTTON)
|
||||||
return sub_811B33C();
|
return sub_811B33C();
|
||||||
|
|
||||||
if (JOY_REPEAT(DPAD_UP))
|
if (gMain.newAndRepeatedKeys & DPAD_UP)
|
||||||
return sub_811B528(2);
|
return sub_811B528(2);
|
||||||
|
|
||||||
if (JOY_REPEAT(DPAD_DOWN))
|
if (gMain.newAndRepeatedKeys & DPAD_DOWN)
|
||||||
return sub_811B528(3);
|
return sub_811B528(3);
|
||||||
|
|
||||||
if (JOY_REPEAT(DPAD_LEFT))
|
if (gMain.newAndRepeatedKeys & DPAD_LEFT)
|
||||||
return sub_811B528(1);
|
return sub_811B528(1);
|
||||||
|
|
||||||
if (JOY_REPEAT(DPAD_RIGHT))
|
if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
|
||||||
return sub_811B528(0);
|
return sub_811B528(0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1705,31 +1705,31 @@ static u16 sub_811AE44(void)
|
|||||||
|
|
||||||
static u16 sub_811AF00(void)
|
static u16 sub_811AF00(void)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
sEasyChatScreen->state = 2;
|
sEasyChatScreen->state = 2;
|
||||||
return 14;
|
return 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
return sub_811B394();
|
return sub_811B394();
|
||||||
|
|
||||||
if (JOY_NEW(START_BUTTON))
|
if (gMain.newKeys & START_BUTTON)
|
||||||
return sub_811B794(4);
|
return sub_811B794(4);
|
||||||
|
|
||||||
if (JOY_NEW(SELECT_BUTTON))
|
if (gMain.newKeys & SELECT_BUTTON)
|
||||||
return sub_811B794(5);
|
return sub_811B794(5);
|
||||||
|
|
||||||
if (JOY_REPEAT(DPAD_UP))
|
if (gMain.newAndRepeatedKeys & DPAD_UP)
|
||||||
return sub_811B794(2);
|
return sub_811B794(2);
|
||||||
|
|
||||||
if (JOY_REPEAT(DPAD_DOWN))
|
if (gMain.newAndRepeatedKeys & DPAD_DOWN)
|
||||||
return sub_811B794(3);
|
return sub_811B794(3);
|
||||||
|
|
||||||
if (JOY_REPEAT(DPAD_LEFT))
|
if (gMain.newAndRepeatedKeys & DPAD_LEFT)
|
||||||
return sub_811B794(1);
|
return sub_811B794(1);
|
||||||
|
|
||||||
if (JOY_REPEAT(DPAD_RIGHT))
|
if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
|
||||||
return sub_811B794(0);
|
return sub_811B794(0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1794,10 +1794,10 @@ static u16 sub_811B040(void)
|
|||||||
|
|
||||||
static u16 sub_811B08C(void)
|
static u16 sub_811B08C(void)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
return 26;
|
return 26;
|
||||||
|
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & B_BUTTON)
|
||||||
return sub_811B150();
|
return sub_811B150();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1805,7 +1805,7 @@ static u16 sub_811B08C(void)
|
|||||||
|
|
||||||
static u16 sub_811B0BC(void)
|
static u16 sub_811B0BC(void)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
{
|
||||||
sEasyChatScreen->state = sub_811B2A4();
|
sEasyChatScreen->state = sub_811B2A4();
|
||||||
return 7;
|
return 7;
|
||||||
@ -2537,7 +2537,7 @@ u8 sub_811BBBC(void)
|
|||||||
return sEasyChatScreen->unk_0c;
|
return sEasyChatScreen->unk_0c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_811BBC8(s8 *arg0, s8 *arg1)
|
void sub_811BBC8(u8 *arg0, u8 *arg1)
|
||||||
{
|
{
|
||||||
*arg0 = sEasyChatScreen->unk_10;
|
*arg0 = sEasyChatScreen->unk_10;
|
||||||
*arg1 = sEasyChatScreen->unk_11;
|
*arg1 = sEasyChatScreen->unk_11;
|
||||||
@ -4529,19 +4529,19 @@ static void sub_811E30C(void)
|
|||||||
x = var0 * 13;
|
x = var0 * 13;
|
||||||
x = x * 8 + 28;
|
x = x * 8 + 28;
|
||||||
y = var1 * 16 + 96;
|
y = var1 * 16 + 96;
|
||||||
sub_811E34C((u8)x, (u8)y);
|
sub_811E34C(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_811E34C(u8 x, u8 y)
|
static void sub_811E34C(u8 x, u8 y)
|
||||||
{
|
{
|
||||||
if (!sUnknown_0203A11C->unk2E4)
|
if (sUnknown_0203A11C->unk2E4)
|
||||||
return;
|
{
|
||||||
|
sUnknown_0203A11C->unk2E4->pos1.x = x;
|
||||||
sUnknown_0203A11C->unk2E4->pos1.x = (s16)x;
|
sUnknown_0203A11C->unk2E4->pos1.y = y;
|
||||||
sUnknown_0203A11C->unk2E4->pos1.y = (s16)y;
|
|
||||||
sUnknown_0203A11C->unk2E4->pos2.x = 0;
|
sUnknown_0203A11C->unk2E4->pos2.x = 0;
|
||||||
sUnknown_0203A11C->unk2E4->data[0] = 0;
|
sUnknown_0203A11C->unk2E4->data[0] = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void sub_811E380(void)
|
static void sub_811E380(void)
|
||||||
{
|
{
|
||||||
|
@ -137,7 +137,7 @@ static u32 sub_81D4EE4(u8 *arg0, u16 *arg1)
|
|||||||
{
|
{
|
||||||
*arg0 = 1;
|
*arg0 = 1;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
*arg0 = 0;
|
*arg0 = 0;
|
||||||
return 1;
|
return 1;
|
||||||
@ -158,7 +158,7 @@ static u32 sub_81D4EE4(u8 *arg0, u16 *arg1)
|
|||||||
*arg1 = 0;
|
*arg1 = 0;
|
||||||
*arg0 = 3;
|
*arg0 = 3;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
*arg0 = 0;
|
*arg0 = 0;
|
||||||
return 1;
|
return 1;
|
||||||
@ -288,7 +288,7 @@ static void sub_81D5084(u8 taskId)
|
|||||||
OpenEReaderLink();
|
OpenEReaderLink();
|
||||||
data->unk8 = 6;
|
data->unk8 = 6;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
sub_81D505C(&data->unk0);
|
sub_81D505C(&data->unk0);
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
@ -296,7 +296,7 @@ static void sub_81D5084(u8 taskId)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
CloseLink();
|
CloseLink();
|
||||||
@ -436,7 +436,7 @@ static void sub_81D5084(u8 taskId)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
if (IsFanfareTaskInactive() && (JOY_NEW(A_BUTTON | B_BUTTON)))
|
if (IsFanfareTaskInactive() && (gMain.newKeys & (A_BUTTON | B_BUTTON)))
|
||||||
data->unk8 = 26;
|
data->unk8 = 26;
|
||||||
break;
|
break;
|
||||||
case 23:
|
case 23:
|
||||||
|
@ -1223,6 +1223,7 @@ static u8 InitObjectEventStateFromTemplate(struct ObjectEventTemplate *template,
|
|||||||
objectEvent->movementType = template->movementType;
|
objectEvent->movementType = template->movementType;
|
||||||
objectEvent->localId = template->localId;
|
objectEvent->localId = template->localId;
|
||||||
objectEvent->mapNum = mapNum;
|
objectEvent->mapNum = mapNum;
|
||||||
|
objectEvent++; objectEvent--;
|
||||||
objectEvent->mapGroup = mapGroup;
|
objectEvent->mapGroup = mapGroup;
|
||||||
objectEvent->initialCoords.x = x;
|
objectEvent->initialCoords.x = x;
|
||||||
objectEvent->initialCoords.y = y;
|
objectEvent->initialCoords.y = y;
|
||||||
@ -1235,11 +1236,13 @@ static u8 InitObjectEventStateFromTemplate(struct ObjectEventTemplate *template,
|
|||||||
objectEvent->range.as_nybbles.x = template->movementRangeX;
|
objectEvent->range.as_nybbles.x = template->movementRangeX;
|
||||||
objectEvent->range.as_nybbles.y = template->movementRangeY;
|
objectEvent->range.as_nybbles.y = template->movementRangeY;
|
||||||
objectEvent->trainerType = template->trainerType;
|
objectEvent->trainerType = template->trainerType;
|
||||||
objectEvent->mapNum = mapNum; //redundant, but needed to match
|
|
||||||
objectEvent->trainerRange_berryTreeId = template->trainerRange_berryTreeId;
|
objectEvent->trainerRange_berryTreeId = template->trainerRange_berryTreeId;
|
||||||
objectEvent->previousMovementDirection = gInitialMovementTypeFacingDirections[template->movementType];
|
objectEvent->previousMovementDirection = gInitialMovementTypeFacingDirections[template->movementType];
|
||||||
SetObjectEventDirection(objectEvent, objectEvent->previousMovementDirection);
|
SetObjectEventDirection(objectEvent, objectEvent->previousMovementDirection);
|
||||||
SetObjectEventDynamicGraphicsId(objectEvent);
|
SetObjectEventDynamicGraphicsId(objectEvent);
|
||||||
|
#ifndef NONMATCHING
|
||||||
|
asm("":::"r5", "r6");
|
||||||
|
#endif
|
||||||
if (gRangedMovementTypes[objectEvent->movementType])
|
if (gRangedMovementTypes[objectEvent->movementType])
|
||||||
{
|
{
|
||||||
if (objectEvent->range.as_nybbles.x == 0)
|
if (objectEvent->range.as_nybbles.x == 0)
|
||||||
@ -8216,7 +8219,8 @@ bool8 FreezeObjectEvent(struct ObjectEvent *objectEvent)
|
|||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
objectEvent->frozen = 1;
|
objectEvent->frozen = 1;
|
||||||
objectEvent->spriteAnimPausedBackup = gSprites[objectEvent->spriteId].animPaused;
|
objectEvent->spriteAnimPausedBackup = gSprites[objectEvent->spriteId].animPaused;
|
||||||
objectEvent->spriteAffineAnimPausedBackup = gSprites[objectEvent->spriteId].affineAnimPaused;
|
objectEvent->spriteAffineAnimPausedBackup = gSprites[objectEvent->spriteId].affineAnimPaused;
|
||||||
@ -8224,6 +8228,7 @@ bool8 FreezeObjectEvent(struct ObjectEvent *objectEvent)
|
|||||||
gSprites[objectEvent->spriteId].affineAnimPaused = 1;
|
gSprites[objectEvent->spriteId].affineAnimPaused = 1;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FreezeObjectEvents(void)
|
void FreezeObjectEvents(void)
|
||||||
{
|
{
|
||||||
@ -8395,7 +8400,7 @@ bool8 sub_80976EC(struct Sprite *sprite)
|
|||||||
|
|
||||||
if (sprite->data[5] > 15)
|
if (sprite->data[5] > 15)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8476,15 +8481,15 @@ static bool8 AnimateSpriteInFigure8(struct Sprite *sprite)
|
|||||||
return finished;
|
return finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const s8 gUnknown_0850E802[16] = {
|
static const s8 gUnknown_0850E802[] = {
|
||||||
-4, -6, -8, -10, -11, -12, -12, -12, -11, -10, -9, -8, -6, -4, 0, 0
|
-4, -6, -8, -10, -11, -12, -12, -12, -11, -10, -9, -8, -6, -4, 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
static const s8 gUnknown_0850E812[16] = {
|
static const s8 gUnknown_0850E812[] = {
|
||||||
0, -2, -3, -4, -5, -6, -6, -6, -5, -5, -4, -3, -2, 0, 0, 0
|
0, -2, -3, -4, -5, -6, -6, -6, -5, -5, -4, -3, -2, 0, 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
static const s8 gUnknown_0850E822[16] = {
|
static const s8 gUnknown_0850E822[] = {
|
||||||
-2, -4, -6, -8, -9, -10, -10, -10, -9, -8, -6, -5, -3, -2, 0, 0
|
-2, -4, -6, -8, -9, -10, -10, -10, -9, -8, -6, -5, -3, -2, 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -8507,11 +8512,23 @@ void sub_809783C(struct Sprite *sprite, u8 a2, u8 a3, u8 a4)
|
|||||||
sprite->data[6] = 0;
|
sprite->data[6] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const s16 gUnknown_0850E840[] = {
|
||||||
|
16, 16, 32,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const u8 gUnknown_0850E846[] = {
|
||||||
|
0, 0, 1,
|
||||||
|
};
|
||||||
|
|
||||||
u8 sub_809785C(struct Sprite *sprite)
|
u8 sub_809785C(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
s16 v5[] = {16, 16, 32};
|
s16 v5[3];
|
||||||
u8 v6[] = {0, 0, 1};
|
u8 v6[3];
|
||||||
u8 v2 = 0;
|
u8 v2;
|
||||||
|
|
||||||
|
memcpy(v5, gUnknown_0850E840, 6); // TODO: get rid of memcpy
|
||||||
|
memcpy(v6, gUnknown_0850E846, 3);
|
||||||
|
v2 = 0;
|
||||||
|
|
||||||
if (sprite->data[4])
|
if (sprite->data[4])
|
||||||
Step1(sprite, sprite->data[3]);
|
Step1(sprite, sprite->data[3]);
|
||||||
@ -8532,11 +8549,23 @@ u8 sub_809785C(struct Sprite *sprite)
|
|||||||
return v2;
|
return v2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const s16 gUnknown_0850E84A[] = {
|
||||||
|
32, 32, 64,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const u8 gUnknown_0850E850[] = {
|
||||||
|
1, 1, 2,
|
||||||
|
};
|
||||||
|
|
||||||
u8 sub_80978E4(struct Sprite *sprite)
|
u8 sub_80978E4(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
s16 v5[] = {32, 32, 64};
|
s16 v5[3];
|
||||||
u8 v6[] = {1, 1, 2};
|
u8 v6[3];
|
||||||
u8 v2 = 0;
|
u8 v2;
|
||||||
|
|
||||||
|
memcpy(v5, gUnknown_0850E84A, 6);
|
||||||
|
memcpy(v6, gUnknown_0850E850, 3);
|
||||||
|
v2 = 0;
|
||||||
|
|
||||||
if (sprite->data[4] && !(sprite->data[6] & 1))
|
if (sprite->data[4] && !(sprite->data[6] & 1))
|
||||||
Step1(sprite, sprite->data[3]);
|
Step1(sprite, sprite->data[3]);
|
||||||
@ -8564,8 +8593,11 @@ static void SetMovementDelay(struct Sprite *sprite, s16 timer)
|
|||||||
|
|
||||||
static bool8 WaitForMovementDelay(struct Sprite *sprite)
|
static bool8 WaitForMovementDelay(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
if (--sprite->data[3] == 0)
|
sprite->data[3]--;
|
||||||
|
|
||||||
|
if (sprite->data[3] == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8580,6 +8612,7 @@ bool8 SpriteAnimEnded(struct Sprite *sprite)
|
|||||||
{
|
{
|
||||||
if (sprite->animEnded)
|
if (sprite->animEnded)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8759,14 +8792,14 @@ static void UpdateObjectEventSpritePosition(struct Sprite *sprite)
|
|||||||
{
|
{
|
||||||
switch(sprite->tAnimNum)
|
switch(sprite->tAnimNum)
|
||||||
{
|
{
|
||||||
case 0:
|
|
||||||
break;
|
|
||||||
case UNION_ROOM_SPAWN_IN:
|
case UNION_ROOM_SPAWN_IN:
|
||||||
MoveUnionRoomObjectDown(sprite);
|
MoveUnionRoomObjectDown(sprite);
|
||||||
break;
|
break;
|
||||||
case UNION_ROOM_SPAWN_OUT:
|
case UNION_ROOM_SPAWN_OUT:
|
||||||
MoveUnionRoomObjectUp(sprite);
|
MoveUnionRoomObjectUp(sprite);
|
||||||
break;
|
break;
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
sprite->tAnimNum = 0;
|
sprite->tAnimNum = 0;
|
||||||
break;
|
break;
|
||||||
@ -8835,18 +8868,21 @@ u8 (*const gMovementActionFuncs_FlyDown[])(struct ObjectEvent *, struct Sprite *
|
|||||||
|
|
||||||
u8 MovementAction_StoreAndLockAnim_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
u8 MovementAction_StoreAndLockAnim_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
bool8 ableToStore = FALSE;
|
u32 one;
|
||||||
|
bool32 ableToStore = FALSE;
|
||||||
if (gLockedAnimObjectEvents == NULL)
|
if (gLockedAnimObjectEvents == NULL)
|
||||||
{
|
{
|
||||||
gLockedAnimObjectEvents = AllocZeroed(sizeof(struct LockedAnimObjectEvents));
|
gLockedAnimObjectEvents = AllocZeroed(sizeof(struct LockedAnimObjectEvents));
|
||||||
gLockedAnimObjectEvents->objectEventIds[0] = objectEvent->localId;
|
gLockedAnimObjectEvents->objectEventIds[0] = objectEvent->localId;
|
||||||
gLockedAnimObjectEvents->count = 1;
|
// needed to match
|
||||||
ableToStore = TRUE;
|
gLockedAnimObjectEvents->count = (one = 1);
|
||||||
|
ableToStore = one;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u8 i, firstFreeSlot;
|
u8 i;
|
||||||
bool8 found;
|
u8 firstFreeSlot;
|
||||||
|
bool32 found;
|
||||||
for (firstFreeSlot = 16, found = FALSE, i = 0; i < 16; i++)
|
for (firstFreeSlot = 16, found = FALSE, i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
if (firstFreeSlot == 16 && gLockedAnimObjectEvents->objectEventIds[i] == 0)
|
if (firstFreeSlot == 16 && gLockedAnimObjectEvents->objectEventIds[i] == 0)
|
||||||
@ -8879,7 +8915,7 @@ u8 MovementAction_StoreAndLockAnim_Step0(struct ObjectEvent *objectEvent, struct
|
|||||||
|
|
||||||
u8 MovementAction_FreeAndUnlockAnim_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
u8 MovementAction_FreeAndUnlockAnim_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
bool8 ableToStore;
|
bool32 ableToStore;
|
||||||
u8 index;
|
u8 index;
|
||||||
|
|
||||||
sprite->data[2] = 1;
|
sprite->data[2] = 1;
|
||||||
@ -8923,7 +8959,7 @@ void CreateLevitateMovementTask(struct ObjectEvent *objectEvent)
|
|||||||
u8 taskId = CreateTask(ApplyLevitateMovement, 0xFF);
|
u8 taskId = CreateTask(ApplyLevitateMovement, 0xFF);
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
|
|
||||||
StoreWordInTwoHalfwords((u16 *)&task->data[0], (u32)objectEvent);
|
StoreWordInTwoHalfwords(&task->data[0], (u32)objectEvent);
|
||||||
objectEvent->warpArrowSpriteId = taskId;
|
objectEvent->warpArrowSpriteId = taskId;
|
||||||
task->data[3] = 0xFFFF;
|
task->data[3] = 0xFFFF;
|
||||||
}
|
}
|
||||||
@ -8934,7 +8970,7 @@ static void ApplyLevitateMovement(u8 taskId)
|
|||||||
struct Sprite *sprite;
|
struct Sprite *sprite;
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
|
|
||||||
LoadWordFromTwoHalfwords((u16 *)&task->data[0], (u32 *)&objectEvent); // load the map object pointer.
|
LoadWordFromTwoHalfwords(&task->data[0], (u32 *)&objectEvent); // load the map object pointer.
|
||||||
sprite = &gSprites[objectEvent->spriteId];
|
sprite = &gSprites[objectEvent->spriteId];
|
||||||
|
|
||||||
if(!(task->data[2] & 0x3))
|
if(!(task->data[2] & 0x3))
|
||||||
@ -8951,7 +8987,7 @@ void DestroyExtraMovementTask(u8 taskId)
|
|||||||
struct ObjectEvent *objectEvent;
|
struct ObjectEvent *objectEvent;
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
|
|
||||||
LoadWordFromTwoHalfwords((u16 *)&task->data[0], (u32 *)&objectEvent); // unused objectEvent
|
LoadWordFromTwoHalfwords(&task->data[0], (u32 *)&objectEvent); // unused objectEvent
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -859,21 +859,21 @@ static void Task_EvolutionScene(u8 taskID)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (JOY_NEW(DPAD_UP) && sEvoCursorPos != 0)
|
if (gMain.newKeys & DPAD_UP && sEvoCursorPos != 0)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BattleDestroyYesNoCursorAt(sEvoCursorPos);
|
BattleDestroyYesNoCursorAt(sEvoCursorPos);
|
||||||
sEvoCursorPos = 0;
|
sEvoCursorPos = 0;
|
||||||
BattleCreateYesNoCursorAt(0);
|
BattleCreateYesNoCursorAt(0);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(DPAD_DOWN) && sEvoCursorPos == 0)
|
if (gMain.newKeys & DPAD_DOWN && sEvoCursorPos == 0)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BattleDestroyYesNoCursorAt(sEvoCursorPos);
|
BattleDestroyYesNoCursorAt(sEvoCursorPos);
|
||||||
sEvoCursorPos = 1;
|
sEvoCursorPos = 1;
|
||||||
BattleCreateYesNoCursorAt(1);
|
BattleCreateYesNoCursorAt(1);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
|
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
@ -889,7 +889,7 @@ static void Task_EvolutionScene(u8 taskID)
|
|||||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
|
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
|
@ -181,8 +181,9 @@ u32 GetMewMoveDirection(void)
|
|||||||
{
|
{
|
||||||
if (ShouldMewMoveEast(mew, 1))
|
if (ShouldMewMoveEast(mew, 1))
|
||||||
return GetRandomMewDirectionCandidate(2);
|
return GetRandomMewDirectionCandidate(2);
|
||||||
if (ShouldMewMoveWest(mew, 1))
|
else if (ShouldMewMoveWest(mew, 1))
|
||||||
return GetRandomMewDirectionCandidate(2);
|
return GetRandomMewDirectionCandidate(2);
|
||||||
|
else
|
||||||
return DIR_NORTH;
|
return DIR_NORTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,8 +191,9 @@ u32 GetMewMoveDirection(void)
|
|||||||
{
|
{
|
||||||
if (ShouldMewMoveEast(mew, 1))
|
if (ShouldMewMoveEast(mew, 1))
|
||||||
return GetRandomMewDirectionCandidate(2);
|
return GetRandomMewDirectionCandidate(2);
|
||||||
if (ShouldMewMoveWest(mew, 1))
|
else if (ShouldMewMoveWest(mew, 1))
|
||||||
return GetRandomMewDirectionCandidate(2);
|
return GetRandomMewDirectionCandidate(2);
|
||||||
|
else
|
||||||
return DIR_SOUTH;
|
return DIR_SOUTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,8 +201,9 @@ u32 GetMewMoveDirection(void)
|
|||||||
{
|
{
|
||||||
if (ShouldMewMoveNorth(mew, 1))
|
if (ShouldMewMoveNorth(mew, 1))
|
||||||
return GetRandomMewDirectionCandidate(2);
|
return GetRandomMewDirectionCandidate(2);
|
||||||
if (ShouldMewMoveSouth(mew, 1))
|
else if (ShouldMewMoveSouth(mew, 1))
|
||||||
return GetRandomMewDirectionCandidate(2);
|
return GetRandomMewDirectionCandidate(2);
|
||||||
|
else
|
||||||
return DIR_EAST;
|
return DIR_EAST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,8 +211,9 @@ u32 GetMewMoveDirection(void)
|
|||||||
{
|
{
|
||||||
if (ShouldMewMoveNorth(mew, 1))
|
if (ShouldMewMoveNorth(mew, 1))
|
||||||
return GetRandomMewDirectionCandidate(2);
|
return GetRandomMewDirectionCandidate(2);
|
||||||
if (ShouldMewMoveSouth(mew, 1))
|
else if (ShouldMewMoveSouth(mew, 1))
|
||||||
return GetRandomMewDirectionCandidate(2);
|
return GetRandomMewDirectionCandidate(2);
|
||||||
|
else
|
||||||
return DIR_WEST;
|
return DIR_WEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,6 +315,7 @@ static u8 GetValidMewMoveDirection(u8 ignoredDir)
|
|||||||
|
|
||||||
if (count > 1)
|
if (count > 1)
|
||||||
return sMewDirectionCandidates[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % count];
|
return sMewDirectionCandidates[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % count];
|
||||||
|
else
|
||||||
return sMewDirectionCandidates[0];
|
return sMewDirectionCandidates[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2597,7 +2597,7 @@ static void FieldMoveShowMonOutdoorsEffect_Init(struct Task *task)
|
|||||||
{
|
{
|
||||||
task->data[11] = REG_WININ;
|
task->data[11] = REG_WININ;
|
||||||
task->data[12] = REG_WINOUT;
|
task->data[12] = REG_WINOUT;
|
||||||
StoreWordInTwoHalfwords((u16 *)&task->data[13], (u32)gMain.vblankCallback);
|
StoreWordInTwoHalfwords(&task->data[13], (u32)gMain.vblankCallback);
|
||||||
task->tWinHoriz = WIN_RANGE(DISPLAY_WIDTH, DISPLAY_WIDTH + 1);
|
task->tWinHoriz = WIN_RANGE(DISPLAY_WIDTH, DISPLAY_WIDTH + 1);
|
||||||
task->tWinVert = WIN_RANGE(DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 2 + 1);
|
task->tWinVert = WIN_RANGE(DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 2 + 1);
|
||||||
task->tWinIn = WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR;
|
task->tWinIn = WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR;
|
||||||
|
@ -101,9 +101,9 @@ static void sub_808C280(struct ObjectEvent *);
|
|||||||
|
|
||||||
static void StartStrengthAnim(u8, u8);
|
static void StartStrengthAnim(u8, u8);
|
||||||
static void Task_PushBoulder(u8 taskId);
|
static void Task_PushBoulder(u8 taskId);
|
||||||
static bool8 PushBoulder_Start(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject);
|
static u8 PushBoulder_Start(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject);
|
||||||
static bool8 PushBoulder_Move(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject);
|
static u8 PushBoulder_Move(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject);
|
||||||
static bool8 PushBoulder_End(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject);
|
static u8 PushBoulder_End(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject);
|
||||||
|
|
||||||
static void DoPlayerMatJump(void);
|
static void DoPlayerMatJump(void);
|
||||||
static void DoPlayerAvatarSecretBaseMatJump(u8 taskId);
|
static void DoPlayerAvatarSecretBaseMatJump(u8 taskId);
|
||||||
@ -1789,7 +1789,7 @@ static bool8 Fishing_ShowDots(struct Task *task)
|
|||||||
|
|
||||||
AlignFishingAnimationFrames();
|
AlignFishingAnimationFrames();
|
||||||
task->tFrameCounter++;
|
task->tFrameCounter++;
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
task->tStep = FISHING_NO_BITE;
|
task->tStep = FISHING_NO_BITE;
|
||||||
if (task->tRoundsPlayed != 0)
|
if (task->tRoundsPlayed != 0)
|
||||||
@ -1878,7 +1878,7 @@ static bool8 Fishing_WaitForA(struct Task *task)
|
|||||||
task->tFrameCounter++;
|
task->tFrameCounter++;
|
||||||
if (task->tFrameCounter >= reelTimeouts[task->tFishingRod])
|
if (task->tFrameCounter >= reelTimeouts[task->tFishingRod])
|
||||||
task->tStep = FISHING_GOT_AWAY;
|
task->tStep = FISHING_GOT_AWAY;
|
||||||
else if (JOY_NEW(A_BUTTON))
|
else if (gMain.newKeys & A_BUTTON)
|
||||||
task->tStep++;
|
task->tStep++;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ void Task_HandlePorthole(u8 taskId)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IDLE_CHECK:
|
case IDLE_CHECK:
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
data[1] = 1;
|
data[1] = 1;
|
||||||
if (!ScriptMovement_IsObjectMovementFinished(OBJ_EVENT_ID_PLAYER, location->mapNum, location->mapGroup))
|
if (!ScriptMovement_IsObjectMovementFinished(OBJ_EVENT_ID_PLAYER, location->mapNum, location->mapGroup))
|
||||||
return;
|
return;
|
||||||
|
@ -227,7 +227,9 @@ bool8 SetUpFieldMove_Cut(void)
|
|||||||
y = gPlayerFacingPosition.y + sHyperCutStruct[i].y;
|
y = gPlayerFacingPosition.y + sHyperCutStruct[i].y;
|
||||||
tileCuttable = TRUE;
|
tileCuttable = TRUE;
|
||||||
|
|
||||||
for (j = 0; j < 2; ++j) {
|
j = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
if (sHyperCutStruct[i].unk2[j] == 0)
|
if (sHyperCutStruct[i].unk2[j] == 0)
|
||||||
break;
|
break;
|
||||||
if (cutTiles[(u8)(sHyperCutStruct[i].unk2[j] - 1)] == FALSE)
|
if (cutTiles[(u8)(sHyperCutStruct[i].unk2[j] - 1)] == FALSE)
|
||||||
@ -235,7 +237,7 @@ bool8 SetUpFieldMove_Cut(void)
|
|||||||
tileCuttable = FALSE;
|
tileCuttable = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} while (++j <= 1);
|
||||||
|
|
||||||
if (tileCuttable == TRUE)
|
if (tileCuttable == TRUE)
|
||||||
{
|
{
|
||||||
@ -251,11 +253,14 @@ bool8 SetUpFieldMove_Cut(void)
|
|||||||
sHyperCutTiles[tileArrayId] = TRUE;
|
sHyperCutTiles[tileArrayId] = TRUE;
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
else if (MetatileBehavior_IsCuttableGrass(tileBehavior) == TRUE)
|
else
|
||||||
|
{
|
||||||
|
if (MetatileBehavior_IsCuttableGrass(tileBehavior) == TRUE)
|
||||||
sHyperCutTiles[tileArrayId] = TRUE;
|
sHyperCutTiles[tileArrayId] = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ret == TRUE)
|
if (ret == TRUE)
|
||||||
{
|
{
|
||||||
|
@ -937,14 +937,14 @@ static void Task_HandleFrontierPassInput(u8 taskId)
|
|||||||
{
|
{
|
||||||
u8 var = FALSE; // Reused, first informs whether the cursor moves, then used as the new cursor area.
|
u8 var = FALSE; // Reused, first informs whether the cursor moves, then used as the new cursor area.
|
||||||
|
|
||||||
if (JOY_HELD(DPAD_UP) && sPassGfx->cursorSprite->pos1.y >= 9)
|
if (gMain.heldKeys & DPAD_UP && sPassGfx->cursorSprite->pos1.y >= 9)
|
||||||
{
|
{
|
||||||
sPassGfx->cursorSprite->pos1.y -= 2;
|
sPassGfx->cursorSprite->pos1.y -= 2;
|
||||||
if (sPassGfx->cursorSprite->pos1.y <= 7)
|
if (sPassGfx->cursorSprite->pos1.y <= 7)
|
||||||
sPassGfx->cursorSprite->pos1.y = 2;
|
sPassGfx->cursorSprite->pos1.y = 2;
|
||||||
var = TRUE;
|
var = TRUE;
|
||||||
}
|
}
|
||||||
if (JOY_HELD(DPAD_DOWN) && sPassGfx->cursorSprite->pos1.y <= 135)
|
if (gMain.heldKeys & DPAD_DOWN && sPassGfx->cursorSprite->pos1.y <= 135)
|
||||||
{
|
{
|
||||||
sPassGfx->cursorSprite->pos1.y += 2;
|
sPassGfx->cursorSprite->pos1.y += 2;
|
||||||
if (sPassGfx->cursorSprite->pos1.y >= 137)
|
if (sPassGfx->cursorSprite->pos1.y >= 137)
|
||||||
@ -952,14 +952,14 @@ static void Task_HandleFrontierPassInput(u8 taskId)
|
|||||||
var = TRUE;
|
var = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JOY_HELD(DPAD_LEFT) && sPassGfx->cursorSprite->pos1.x >= 6)
|
if (gMain.heldKeys & DPAD_LEFT && sPassGfx->cursorSprite->pos1.x >= 6)
|
||||||
{
|
{
|
||||||
sPassGfx->cursorSprite->pos1.x -= 2;
|
sPassGfx->cursorSprite->pos1.x -= 2;
|
||||||
if (sPassGfx->cursorSprite->pos1.x <= 4)
|
if (sPassGfx->cursorSprite->pos1.x <= 4)
|
||||||
sPassGfx->cursorSprite->pos1.x = 5;
|
sPassGfx->cursorSprite->pos1.x = 5;
|
||||||
var = TRUE;
|
var = TRUE;
|
||||||
}
|
}
|
||||||
if (JOY_HELD(DPAD_RIGHT) && sPassGfx->cursorSprite->pos1.x <= 231)
|
if (gMain.heldKeys & DPAD_RIGHT && sPassGfx->cursorSprite->pos1.x <= 231)
|
||||||
{
|
{
|
||||||
sPassGfx->cursorSprite->pos1.x += 2;
|
sPassGfx->cursorSprite->pos1.x += 2;
|
||||||
if (sPassGfx->cursorSprite->pos1.x >= 233)
|
if (sPassGfx->cursorSprite->pos1.x >= 233)
|
||||||
@ -969,7 +969,7 @@ static void Task_HandleFrontierPassInput(u8 taskId)
|
|||||||
|
|
||||||
if (!var) // Cursor did not change.
|
if (!var) // Cursor did not change.
|
||||||
{
|
{
|
||||||
if (sPassData->cursorArea != CURSOR_AREA_NOTHING && JOY_NEW(A_BUTTON))
|
if (sPassData->cursorArea != CURSOR_AREA_NOTHING && gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
if (sPassData->cursorArea <= CURSOR_AREA_RECORD) // Map, Card, Record
|
if (sPassData->cursorArea <= CURSOR_AREA_RECORD) // Map, Card, Record
|
||||||
{
|
{
|
||||||
@ -986,7 +986,7 @@ static void Task_HandleFrontierPassInput(u8 taskId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_PC_OFF);
|
PlaySE(SE_PC_OFF);
|
||||||
SetMainCallback2(CB2_HideFrontierPass);
|
SetMainCallback2(CB2_HideFrontierPass);
|
||||||
@ -1173,47 +1173,75 @@ static void sub_80C5F58(bool8 arg0, bool8 arg1)
|
|||||||
|
|
||||||
static void sub_80C6104(u8 cursorArea, u8 previousCursorArea)
|
static void sub_80C6104(u8 cursorArea, u8 previousCursorArea)
|
||||||
{
|
{
|
||||||
|
bool32 var;
|
||||||
|
|
||||||
switch (previousCursorArea)
|
switch (previousCursorArea)
|
||||||
{
|
{
|
||||||
case CURSOR_AREA_MAP:
|
case CURSOR_AREA_MAP:
|
||||||
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24, 16, 3, 12, 7, 17);
|
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24, 16, 3, 12, 7, 17);
|
||||||
|
var = TRUE;
|
||||||
break;
|
break;
|
||||||
case CURSOR_AREA_CARD:
|
case CURSOR_AREA_CARD:
|
||||||
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24 + 336, 16, 10, 12, 7, 17);
|
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24 + 336, 16, 10, 12, 7, 17);
|
||||||
|
var = TRUE;
|
||||||
break;
|
break;
|
||||||
case CURSOR_AREA_RECORD:
|
case CURSOR_AREA_RECORD:
|
||||||
if (sPassData->hasBattleRecord)
|
if (!sPassData->hasBattleRecord)
|
||||||
|
{
|
||||||
|
var = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk28, 2, 10, 12, 3, 17);
|
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk28, 2, 10, 12, 3, 17);
|
||||||
else if (cursorArea == CURSOR_AREA_NOTHING || cursorArea > CURSOR_AREA_CANCEL)
|
var = TRUE;
|
||||||
return;
|
}
|
||||||
break;
|
break;
|
||||||
case CURSOR_AREA_CANCEL:
|
case CURSOR_AREA_CANCEL:
|
||||||
CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_08DE3350, 21, 0, 9, 2, 17);
|
CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_08DE3350, 21, 0, 9, 2, 17);
|
||||||
|
var = TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
var = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!var)
|
||||||
|
{
|
||||||
if (cursorArea == CURSOR_AREA_NOTHING || cursorArea > CURSOR_AREA_CANCEL)
|
if (cursorArea == CURSOR_AREA_NOTHING || cursorArea > CURSOR_AREA_CANCEL)
|
||||||
return;
|
return;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (cursorArea)
|
switch (cursorArea)
|
||||||
{
|
{
|
||||||
case CURSOR_AREA_MAP:
|
case CURSOR_AREA_MAP:
|
||||||
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24 + 168, 16, 3, 12, 7, 17);
|
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24 + 168, 16, 3, 12, 7, 17);
|
||||||
|
var = TRUE;
|
||||||
break;
|
break;
|
||||||
case CURSOR_AREA_CARD:
|
case CURSOR_AREA_CARD:
|
||||||
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24 + 504, 16, 10, 12, 7, 17);
|
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk24 + 504, 16, 10, 12, 7, 17);
|
||||||
|
var = TRUE;
|
||||||
break;
|
break;
|
||||||
case CURSOR_AREA_RECORD:
|
case CURSOR_AREA_RECORD:
|
||||||
if (sPassData->hasBattleRecord)
|
if (!sPassData->hasBattleRecord)
|
||||||
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk28 + 72, 2, 10, 12, 3, 17);
|
|
||||||
else
|
|
||||||
return;
|
return;
|
||||||
break; // needed
|
|
||||||
|
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk28 + 72, 2, 10, 12, 3, 17);
|
||||||
|
var = TRUE;
|
||||||
|
break;
|
||||||
case CURSOR_AREA_CANCEL:
|
case CURSOR_AREA_CANCEL:
|
||||||
CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_08DE3374, 21, 0, 9, 2, 17);
|
CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_08DE3374, 21, 0, 9, 2, 17);
|
||||||
|
var = TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
var = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!var)
|
||||||
|
{
|
||||||
|
#ifndef NONMATCHING
|
||||||
|
asm("":::"r4");
|
||||||
|
#endif
|
||||||
if (previousCursorArea == CURSOR_AREA_NOTHING || previousCursorArea > CURSOR_AREA_CANCEL)
|
if (previousCursorArea == CURSOR_AREA_NOTHING || previousCursorArea > CURSOR_AREA_CANCEL)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1443,19 +1471,19 @@ static void Task_HandleFrontierMap(u8 taskId)
|
|||||||
break;
|
break;
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1:
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_PC_OFF);
|
PlaySE(SE_PC_OFF);
|
||||||
data[0] = 4;
|
data[0] = 4;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_DOWN))
|
else if (gMain.newKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
if (sMapData->cursorPos >= NUM_FRONTIER_FACILITIES - 1)
|
if (sMapData->cursorPos >= NUM_FRONTIER_FACILITIES - 1)
|
||||||
HandleFrontierMapCursorMove(0);
|
HandleFrontierMapCursorMove(0);
|
||||||
else
|
else
|
||||||
data[0] = 2;
|
data[0] = 2;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_UP))
|
else if (gMain.newKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
if (sMapData->cursorPos == 0)
|
if (sMapData->cursorPos == 0)
|
||||||
HandleFrontierMapCursorMove(1);
|
HandleFrontierMapCursorMove(1);
|
||||||
|
@ -2486,6 +2486,7 @@ void SetFrontierBrainObjEventGfx_2(void)
|
|||||||
|
|
||||||
#define FRONTIER_BRAIN_OTID 61226
|
#define FRONTIER_BRAIN_OTID 61226
|
||||||
|
|
||||||
|
#ifdef NONMATCHING
|
||||||
void CreateFrontierBrainPokemon(void)
|
void CreateFrontierBrainPokemon(void)
|
||||||
{
|
{
|
||||||
s32 i, j;
|
s32 i, j;
|
||||||
@ -2508,13 +2509,11 @@ void CreateFrontierBrainPokemon(void)
|
|||||||
{
|
{
|
||||||
if (!(selectedMonBits & 1))
|
if (!(selectedMonBits & 1))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
do
|
j = Random32();
|
||||||
{
|
} while (IsShinyOtIdPersonality(FRONTIER_BRAIN_OTID, j) || sFrontierBrainsMons[facility][symbol][i].nature != GetNatureFromPersonality(j));
|
||||||
j = Random32(); //Should be one while loop, but that doesn't match
|
|
||||||
} while (IsShinyOtIdPersonality(FRONTIER_BRAIN_OTID, j));
|
|
||||||
} while (sFrontierBrainsMons[facility][symbol][i].nature != GetNatureFromPersonality(j));
|
|
||||||
CreateMon(&gEnemyParty[monPartyId],
|
CreateMon(&gEnemyParty[monPartyId],
|
||||||
sFrontierBrainsMons[facility][symbol][i].species,
|
sFrontierBrainsMons[facility][symbol][i].species,
|
||||||
monLevel,
|
monLevel,
|
||||||
@ -2536,6 +2535,242 @@ void CreateFrontierBrainPokemon(void)
|
|||||||
monPartyId++;
|
monPartyId++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
void CreateFrontierBrainPokemon(void)
|
||||||
|
{
|
||||||
|
asm_unified(
|
||||||
|
"push {r4-r7,lr}\n\
|
||||||
|
mov r7, r10\n\
|
||||||
|
mov r6, r9\n\
|
||||||
|
mov r5, r8\n\
|
||||||
|
push {r5-r7}\n\
|
||||||
|
sub sp, 0x44\n\
|
||||||
|
ldr r0, =0x000040cf\n\
|
||||||
|
bl VarGet\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r0, 16\n\
|
||||||
|
str r0, [sp, 0x20]\n\
|
||||||
|
bl GetFronterBrainSymbol\n\
|
||||||
|
str r0, [sp, 0x24]\n\
|
||||||
|
ldr r0, [sp, 0x20]\n\
|
||||||
|
cmp r0, 0x1\n\
|
||||||
|
bne _081A4E44\n\
|
||||||
|
ldr r0, =0x000003fe\n\
|
||||||
|
bl TrainerIdToDomeTournamentId\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r0, 16\n\
|
||||||
|
bl GetDomeTrainerSelectedMons\n\
|
||||||
|
adds r4, r0, 0\n\
|
||||||
|
b _081A4E46\n\
|
||||||
|
.pool\n\
|
||||||
|
_081A4E44:\n\
|
||||||
|
movs r4, 0x7\n\
|
||||||
|
_081A4E46:\n\
|
||||||
|
bl ZeroEnemyPartyMons\n\
|
||||||
|
movs r1, 0\n\
|
||||||
|
str r1, [sp, 0x18]\n\
|
||||||
|
bl SetFacilityPtrsGetLevel\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r0, 24\n\
|
||||||
|
str r0, [sp, 0x1C]\n\
|
||||||
|
movs r2, 0\n\
|
||||||
|
str r2, [sp, 0x14]\n\
|
||||||
|
_081A4E5C:\n\
|
||||||
|
movs r0, 0x1\n\
|
||||||
|
ands r0, r4\n\
|
||||||
|
asrs r4, 1\n\
|
||||||
|
str r4, [sp, 0x30]\n\
|
||||||
|
ldr r3, [sp, 0x14]\n\
|
||||||
|
adds r3, 0x1\n\
|
||||||
|
str r3, [sp, 0x28]\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
bne _081A4E70\n\
|
||||||
|
b _081A4FC4\n\
|
||||||
|
_081A4E70:\n\
|
||||||
|
ldr r4, [sp, 0x14]\n\
|
||||||
|
lsls r4, 2\n\
|
||||||
|
mov r9, r4\n\
|
||||||
|
ldr r0, [sp, 0x24]\n\
|
||||||
|
lsls r0, 4\n\
|
||||||
|
str r0, [sp, 0x38]\n\
|
||||||
|
ldr r1, [sp, 0x20]\n\
|
||||||
|
lsls r1, 4\n\
|
||||||
|
str r1, [sp, 0x34]\n\
|
||||||
|
ldr r2, [sp, 0x1C]\n\
|
||||||
|
lsls r2, 24\n\
|
||||||
|
str r2, [sp, 0x3C]\n\
|
||||||
|
ldr r3, [sp, 0x18]\n\
|
||||||
|
adds r3, 0x1\n\
|
||||||
|
str r3, [sp, 0x2C]\n\
|
||||||
|
ldr r0, [sp, 0x14]\n\
|
||||||
|
add r0, r9\n\
|
||||||
|
lsls r0, 2\n\
|
||||||
|
mov r8, r0\n\
|
||||||
|
_081A4E96:\n\
|
||||||
|
bl Random\n\
|
||||||
|
adds r4, r0, 0\n\
|
||||||
|
bl Random\n\
|
||||||
|
lsls r4, 16\n\
|
||||||
|
lsrs r7, r4, 16\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
orrs r7, r0\n\
|
||||||
|
ldr r0, =0x0000ef2a\n\
|
||||||
|
adds r1, r7, 0\n\
|
||||||
|
bl IsShinyOtIdPersonality\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
bne _081A4E96\n\
|
||||||
|
ldr r4, [sp, 0x38]\n\
|
||||||
|
ldr r1, [sp, 0x24]\n\
|
||||||
|
subs r0, r4, r1\n\
|
||||||
|
lsls r5, r0, 2\n\
|
||||||
|
mov r2, r8\n\
|
||||||
|
adds r4, r2, r5\n\
|
||||||
|
ldr r3, [sp, 0x34]\n\
|
||||||
|
ldr r1, [sp, 0x20]\n\
|
||||||
|
subs r0, r3, r1\n\
|
||||||
|
lsls r6, r0, 3\n\
|
||||||
|
adds r4, r6\n\
|
||||||
|
ldr r2, =sFrontierBrainsMons\n\
|
||||||
|
adds r4, r2\n\
|
||||||
|
adds r0, r7, 0\n\
|
||||||
|
bl GetNatureFromPersonality\n\
|
||||||
|
ldrb r1, [r4, 0x5]\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r0, 24\n\
|
||||||
|
cmp r1, r0\n\
|
||||||
|
bne _081A4E96\n\
|
||||||
|
ldr r4, [sp, 0x18]\n\
|
||||||
|
movs r0, 0x64\n\
|
||||||
|
adds r3, r4, 0\n\
|
||||||
|
muls r3, r0\n\
|
||||||
|
mov r8, r3\n\
|
||||||
|
ldr r1, =gEnemyParty\n\
|
||||||
|
add r1, r8\n\
|
||||||
|
mov r10, r1\n\
|
||||||
|
ldr r4, [sp, 0x14]\n\
|
||||||
|
add r4, r9\n\
|
||||||
|
lsls r4, 2\n\
|
||||||
|
adds r0, r4, r5\n\
|
||||||
|
adds r0, r6\n\
|
||||||
|
ldr r2, =sFrontierBrainsMons\n\
|
||||||
|
adds r0, r2\n\
|
||||||
|
ldrh r1, [r0]\n\
|
||||||
|
ldr r3, [sp, 0x3C]\n\
|
||||||
|
lsrs r2, r3, 24\n\
|
||||||
|
ldrb r3, [r0, 0x4]\n\
|
||||||
|
movs r0, 0x1\n\
|
||||||
|
str r0, [sp]\n\
|
||||||
|
str r7, [sp, 0x4]\n\
|
||||||
|
str r0, [sp, 0x8]\n\
|
||||||
|
ldr r0, =0x0000ef2a\n\
|
||||||
|
str r0, [sp, 0xC]\n\
|
||||||
|
mov r0, r10\n\
|
||||||
|
bl CreateMon\n\
|
||||||
|
ldr r0, =sFrontierBrainsMons\n\
|
||||||
|
adds r5, r0\n\
|
||||||
|
adds r5, r6, r5\n\
|
||||||
|
adds r4, r5, r4\n\
|
||||||
|
adds r4, 0x2\n\
|
||||||
|
mov r0, r10\n\
|
||||||
|
movs r1, 0xC\n\
|
||||||
|
adds r2, r4, 0\n\
|
||||||
|
bl SetMonData\n\
|
||||||
|
movs r7, 0\n\
|
||||||
|
mov r6, r8\n\
|
||||||
|
ldr r3, =gEnemyParty\n\
|
||||||
|
_081A4F32:\n\
|
||||||
|
adds r1, r7, 0\n\
|
||||||
|
adds r1, 0x1A\n\
|
||||||
|
ldr r0, [sp, 0x14]\n\
|
||||||
|
add r0, r9\n\
|
||||||
|
lsls r4, r0, 2\n\
|
||||||
|
adds r2, r5, r4\n\
|
||||||
|
adds r0, r7, 0x6\n\
|
||||||
|
adds r2, r0\n\
|
||||||
|
adds r0, r6, r3\n\
|
||||||
|
str r3, [sp, 0x40]\n\
|
||||||
|
bl SetMonData\n\
|
||||||
|
adds r7, 0x1\n\
|
||||||
|
ldr r3, [sp, 0x40]\n\
|
||||||
|
cmp r7, 0x5\n\
|
||||||
|
ble _081A4F32\n\
|
||||||
|
movs r1, 0xFF\n\
|
||||||
|
add r0, sp, 0x10\n\
|
||||||
|
strb r1, [r0]\n\
|
||||||
|
movs r7, 0\n\
|
||||||
|
ldr r1, [sp, 0x18]\n\
|
||||||
|
movs r2, 0x64\n\
|
||||||
|
adds r6, r1, 0\n\
|
||||||
|
muls r6, r2\n\
|
||||||
|
ldr r3, =sFrontierBrainsMons + 0xC\n\
|
||||||
|
mov r8, r3\n\
|
||||||
|
ldr r3, =gEnemyParty\n\
|
||||||
|
adds r5, r4, 0\n\
|
||||||
|
_081A4F6A:\n\
|
||||||
|
ldr r4, [sp, 0x38]\n\
|
||||||
|
ldr r0, [sp, 0x24]\n\
|
||||||
|
subs r1, r4, r0\n\
|
||||||
|
lsls r1, 2\n\
|
||||||
|
adds r1, r5, r1\n\
|
||||||
|
ldr r2, [sp, 0x34]\n\
|
||||||
|
ldr r4, [sp, 0x20]\n\
|
||||||
|
subs r0, r2, r4\n\
|
||||||
|
lsls r0, 3\n\
|
||||||
|
adds r1, r0\n\
|
||||||
|
add r1, r8\n\
|
||||||
|
ldrh r4, [r1]\n\
|
||||||
|
lsls r2, r7, 24\n\
|
||||||
|
lsrs r2, 24\n\
|
||||||
|
adds r0, r6, r3\n\
|
||||||
|
adds r1, r4, 0\n\
|
||||||
|
str r3, [sp, 0x40]\n\
|
||||||
|
bl SetMonMoveSlot\n\
|
||||||
|
ldr r3, [sp, 0x40]\n\
|
||||||
|
cmp r4, 0xDA\n\
|
||||||
|
bne _081A4F9C\n\
|
||||||
|
movs r1, 0\n\
|
||||||
|
add r0, sp, 0x10\n\
|
||||||
|
strb r1, [r0]\n\
|
||||||
|
_081A4F9C:\n\
|
||||||
|
adds r5, 0x2\n\
|
||||||
|
adds r7, 0x1\n\
|
||||||
|
cmp r7, 0x3\n\
|
||||||
|
ble _081A4F6A\n\
|
||||||
|
ldr r0, [sp, 0x18]\n\
|
||||||
|
movs r1, 0x64\n\
|
||||||
|
adds r4, r0, 0\n\
|
||||||
|
muls r4, r1\n\
|
||||||
|
ldr r0, =gEnemyParty\n\
|
||||||
|
adds r4, r0\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
movs r1, 0x20\n\
|
||||||
|
add r2, sp, 0x10\n\
|
||||||
|
bl SetMonData\n\
|
||||||
|
adds r0, r4, 0\n\
|
||||||
|
bl CalculateMonStats\n\
|
||||||
|
ldr r2, [sp, 0x2C]\n\
|
||||||
|
str r2, [sp, 0x18]\n\
|
||||||
|
_081A4FC4:\n\
|
||||||
|
ldr r4, [sp, 0x30]\n\
|
||||||
|
ldr r3, [sp, 0x28]\n\
|
||||||
|
str r3, [sp, 0x14]\n\
|
||||||
|
cmp r3, 0x2\n\
|
||||||
|
bgt _081A4FD0\n\
|
||||||
|
b _081A4E5C\n\
|
||||||
|
_081A4FD0:\n\
|
||||||
|
add sp, 0x44\n\
|
||||||
|
pop {r3-r5}\n\
|
||||||
|
mov r8, r3\n\
|
||||||
|
mov r9, r4\n\
|
||||||
|
mov r10, r5\n\
|
||||||
|
pop {r4-r7}\n\
|
||||||
|
pop {r0}\n\
|
||||||
|
bx r0\n\
|
||||||
|
.pool");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
u16 GetFrontierBrainMonSpecies(u8 monId)
|
u16 GetFrontierBrainMonSpecies(u8 monId)
|
||||||
{
|
{
|
||||||
|
@ -730,7 +730,7 @@ static void Task_Hof_WaitAndPrintPlayerInfo(u8 taskId)
|
|||||||
|
|
||||||
static void Task_Hof_ExitOnKeyPressed(u8 taskId)
|
static void Task_Hof_ExitOnKeyPressed(u8 taskId)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
FadeOutBGM(4);
|
FadeOutBGM(4);
|
||||||
gTasks[taskId].func = Task_Hof_HandlePaletteOnExit;
|
gTasks[taskId].func = Task_Hof_HandlePaletteOnExit;
|
||||||
@ -992,7 +992,7 @@ static void Task_HofPC_HandleInput(u8 taskId)
|
|||||||
{
|
{
|
||||||
u16 i;
|
u16 i;
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
if (gTasks[taskId].tCurrTeamNo != 0) // prepare another team to view
|
if (gTasks[taskId].tCurrTeamNo != 0) // prepare another team to view
|
||||||
{
|
{
|
||||||
@ -1020,7 +1020,7 @@ static void Task_HofPC_HandleInput(u8 taskId)
|
|||||||
gTasks[taskId].func = Task_HofPC_HandlePaletteOnExit;
|
gTasks[taskId].func = Task_HofPC_HandlePaletteOnExit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON)) // turn off hall of fame PC
|
else if (gMain.newKeys & B_BUTTON) // turn off hall of fame PC
|
||||||
{
|
{
|
||||||
if (IsCryPlayingOrClearCrySongs())
|
if (IsCryPlayingOrClearCrySongs())
|
||||||
{
|
{
|
||||||
@ -1029,12 +1029,12 @@ static void Task_HofPC_HandleInput(u8 taskId)
|
|||||||
}
|
}
|
||||||
gTasks[taskId].func = Task_HofPC_HandlePaletteOnExit;
|
gTasks[taskId].func = Task_HofPC_HandlePaletteOnExit;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_UP) && gTasks[taskId].tCurrMonId != 0) // change mon -1
|
else if (gMain.newKeys & DPAD_UP && gTasks[taskId].tCurrMonId != 0) // change mon -1
|
||||||
{
|
{
|
||||||
gTasks[taskId].tCurrMonId--;
|
gTasks[taskId].tCurrMonId--;
|
||||||
gTasks[taskId].func = Task_HofPC_PrintMonInfo;
|
gTasks[taskId].func = Task_HofPC_PrintMonInfo;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_DOWN) && gTasks[taskId].tCurrMonId < gTasks[taskId].tMonNo - 1) // change mon +1
|
else if (gMain.newKeys & DPAD_DOWN && gTasks[taskId].tCurrMonId < gTasks[taskId].tMonNo - 1) // change mon +1
|
||||||
{
|
{
|
||||||
gTasks[taskId].tCurrMonId++;
|
gTasks[taskId].tCurrMonId++;
|
||||||
gTasks[taskId].func = Task_HofPC_PrintMonInfo;
|
gTasks[taskId].func = Task_HofPC_PrintMonInfo;
|
||||||
@ -1098,7 +1098,7 @@ static void Task_HofPC_PrintDataIsCorrupted(u8 taskId)
|
|||||||
|
|
||||||
static void Task_HofPC_ExitOnButtonPress(u8 taskId)
|
static void Task_HofPC_ExitOnButtonPress(u8 taskId)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
gTasks[taskId].func = Task_HofPC_HandlePaletteOnExit;
|
gTasks[taskId].func = Task_HofPC_HandlePaletteOnExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -824,7 +824,7 @@ void sub_817B1C8(u8 a)
|
|||||||
LZ77UnCompVram(gUnknown_085F1398, (void *)(BG_SCREEN_ADDR(6)));
|
LZ77UnCompVram(gUnknown_085F1398, (void *)(BG_SCREEN_ADDR(6)));
|
||||||
LoadPalette(&gUnknown_085F0CFC, 0, 96);
|
LoadPalette(&gUnknown_085F0CFC, 0, 96);
|
||||||
LoadCompressedSpriteSheet(gUnknown_085F5064);
|
LoadCompressedSpriteSheet(gUnknown_085F5064);
|
||||||
LZ77UnCompVram(gUnknown_085F16A8, (void *)(OBJ_VRAM0));
|
LZ77UnCompVram(gUnknown_085F16A8, (void *)(VRAM + 0x10000));
|
||||||
LoadPalette(&gUnknown_085F1668, 256, 32);
|
LoadPalette(&gUnknown_085F1668, 256, 32);
|
||||||
sub_817B76C();
|
sub_817B76C();
|
||||||
break;
|
break;
|
||||||
@ -834,7 +834,7 @@ void sub_817B1C8(u8 a)
|
|||||||
LZ77UnCompVram(gUnknown_085F1398, (void *)(BG_SCREEN_ADDR(6)));
|
LZ77UnCompVram(gUnknown_085F1398, (void *)(BG_SCREEN_ADDR(6)));
|
||||||
LoadPalette(&gUnknown_085F0D5C, 0, 96);
|
LoadPalette(&gUnknown_085F0D5C, 0, 96);
|
||||||
LoadCompressedSpriteSheet(gUnknown_085F5064);
|
LoadCompressedSpriteSheet(gUnknown_085F5064);
|
||||||
LZ77UnCompVram(gUnknown_085F16A8, (void *)(OBJ_VRAM0));
|
LZ77UnCompVram(gUnknown_085F16A8, (void *)(VRAM + 0x10000));
|
||||||
LoadPalette(&gUnknown_085F1688, 256, 32);
|
LoadPalette(&gUnknown_085F1688, 256, 32);
|
||||||
sub_817B76C();
|
sub_817B76C();
|
||||||
break;
|
break;
|
||||||
|
185
src/item.c
185
src/item.c
@ -181,18 +181,24 @@ bool8 HasAtLeastOneBerry(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NONMATCHING
|
||||||
|
// Refuses to match.
|
||||||
bool8 CheckBagHasSpace(u16 itemId, u16 count)
|
bool8 CheckBagHasSpace(u16 itemId, u16 count)
|
||||||
{
|
{
|
||||||
u8 i, pocket;
|
u8 i;
|
||||||
u16 slotCapacity, ownedCount;
|
|
||||||
|
|
||||||
if (ItemId_GetPocket(itemId) == POCKET_NONE)
|
if (ItemId_GetPocket(itemId) == POCKET_NONE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (InBattlePyramid() || (FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE))
|
if (InBattlePyramid() || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE)
|
||||||
{
|
{
|
||||||
return CheckPyramidBagHasSpace(itemId, count);
|
return CheckPyramidBagHasSpace(itemId, count);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
u8 pocket;
|
||||||
|
u16 slotCapacity;
|
||||||
|
u16 ownedCount;
|
||||||
|
|
||||||
pocket = ItemId_GetPocket(itemId) - 1;
|
pocket = ItemId_GetPocket(itemId) - 1;
|
||||||
if (pocket != BERRIES_POCKET)
|
if (pocket != BERRIES_POCKET)
|
||||||
@ -210,38 +216,187 @@ bool8 CheckBagHasSpace(u16 itemId, u16 count)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
if (pocket == TMHM_POCKET || pocket == BERRIES_POCKET)
|
if (pocket == TMHM_POCKET || pocket == BERRIES_POCKET)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
count -= (slotCapacity - ownedCount);
|
count -= slotCapacity - ownedCount;
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
break; //Should just be "return TRUE", since setting count to 0 means all the remaining checks until return will be false anyway, but that doesn't match
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check space in empty item slots
|
// Check space in empty item slots
|
||||||
if (count > 0) //if (count !=0) also works here; both match
|
if (count > 0)
|
||||||
{
|
{
|
||||||
for (i = 0; i < gBagPockets[pocket].capacity; i++)
|
for (i = 0; i < gBagPockets[pocket].capacity; i++)
|
||||||
{
|
{
|
||||||
if (gBagPockets[pocket].itemSlots[i].itemId == 0)
|
if (gBagPockets[pocket].itemSlots[i].itemId == 0)
|
||||||
{
|
{
|
||||||
if (count > slotCapacity)
|
if (count <= slotCapacity)
|
||||||
{
|
return TRUE;
|
||||||
if (pocket == TMHM_POCKET || pocket == BERRIES_POCKET)
|
if (pocket == TMHM_POCKET || pocket == BERRIES_POCKET)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
count -= slotCapacity;
|
count -= slotCapacity;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
count = 0; //Should just be "return TRUE", since setting count to 0 means all the remaining checks until return will be false anyway, but that doesn't match
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
if (count > 0)
|
||||||
}
|
|
||||||
if (count > 0) //if (count !=0) also works here; both match
|
|
||||||
return FALSE; // No more item slots. The bag is full
|
return FALSE; // No more item slots. The bag is full
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
bool8 CheckBagHasSpace(u16 itemId, u16 count)
|
||||||
|
{
|
||||||
|
asm_unified(
|
||||||
|
"push {r4-r7,lr}\n\
|
||||||
|
mov r7, r10\n\
|
||||||
|
mov r6, r9\n\
|
||||||
|
mov r5, r8\n\
|
||||||
|
push {r5-r7}\n\
|
||||||
|
sub sp, 0x4\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r0, 16\n\
|
||||||
|
mov r8, r0\n\
|
||||||
|
lsls r1, 16\n\
|
||||||
|
lsrs r5, r1, 16\n\
|
||||||
|
bl ItemId_GetPocket\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
beq _080D6906\n\
|
||||||
|
bl InBattlePyramid\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
bne _080D6838\n\
|
||||||
|
ldr r0, =0x00004004\n\
|
||||||
|
bl FlagGet\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r0, 24\n\
|
||||||
|
cmp r0, 0x1\n\
|
||||||
|
bne _080D684C\n\
|
||||||
|
_080D6838:\n\
|
||||||
|
mov r0, r8\n\
|
||||||
|
adds r1, r5, 0\n\
|
||||||
|
bl CheckPyramidBagHasSpace\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r0, 24\n\
|
||||||
|
b _080D6916\n\
|
||||||
|
.pool\n\
|
||||||
|
_080D684C:\n\
|
||||||
|
mov r0, r8\n\
|
||||||
|
bl ItemId_GetPocket\n\
|
||||||
|
subs r0, 0x1\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r2, r0, 24\n\
|
||||||
|
ldr r7, =0x000003e7\n\
|
||||||
|
cmp r2, 0x3\n\
|
||||||
|
beq _080D6860\n\
|
||||||
|
movs r7, 0x63\n\
|
||||||
|
_080D6860:\n\
|
||||||
|
movs r6, 0\n\
|
||||||
|
ldr r1, =gBagPockets\n\
|
||||||
|
lsls r4, r2, 3\n\
|
||||||
|
adds r0, r4, r1\n\
|
||||||
|
mov r9, r4\n\
|
||||||
|
ldrb r0, [r0, 0x4]\n\
|
||||||
|
cmp r6, r0\n\
|
||||||
|
bcs _080D68BC\n\
|
||||||
|
subs r0, r2, 0x2\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r0, 24\n\
|
||||||
|
mov r10, r0\n\
|
||||||
|
_080D6878:\n\
|
||||||
|
adds r0, r4, r1\n\
|
||||||
|
ldr r1, [r0]\n\
|
||||||
|
lsls r0, r6, 2\n\
|
||||||
|
adds r1, r0, r1\n\
|
||||||
|
ldrh r0, [r1]\n\
|
||||||
|
cmp r0, r8\n\
|
||||||
|
bne _080D68AC\n\
|
||||||
|
adds r0, r1, 0x2\n\
|
||||||
|
str r2, [sp]\n\
|
||||||
|
bl GetBagItemQuantity\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r1, r0, 16\n\
|
||||||
|
adds r0, r1, r5\n\
|
||||||
|
ldr r2, [sp]\n\
|
||||||
|
cmp r0, r7\n\
|
||||||
|
ble _080D6914\n\
|
||||||
|
mov r0, r10\n\
|
||||||
|
cmp r0, 0x1\n\
|
||||||
|
bls _080D6906\n\
|
||||||
|
subs r0, r7, r1\n\
|
||||||
|
subs r0, r5, r0\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r5, r0, 16\n\
|
||||||
|
cmp r5, 0\n\
|
||||||
|
beq _080D6914\n\
|
||||||
|
_080D68AC:\n\
|
||||||
|
adds r0, r6, 0x1\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r6, r0, 24\n\
|
||||||
|
ldr r1, =gBagPockets\n\
|
||||||
|
adds r0, r4, r1\n\
|
||||||
|
ldrb r0, [r0, 0x4]\n\
|
||||||
|
cmp r6, r0\n\
|
||||||
|
bcc _080D6878\n\
|
||||||
|
_080D68BC:\n\
|
||||||
|
cmp r5, 0\n\
|
||||||
|
beq _080D6914\n\
|
||||||
|
movs r6, 0\n\
|
||||||
|
ldr r3, =gBagPockets\n\
|
||||||
|
mov r1, r9\n\
|
||||||
|
adds r0, r1, r3\n\
|
||||||
|
ldrb r0, [r0, 0x4]\n\
|
||||||
|
cmp r6, r0\n\
|
||||||
|
bcs _080D6902\n\
|
||||||
|
adds r4, r3, 0\n\
|
||||||
|
subs r0, r2, 0x2\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r2, r0, 24\n\
|
||||||
|
_080D68D6:\n\
|
||||||
|
adds r0, r1, r4\n\
|
||||||
|
ldr r1, [r0]\n\
|
||||||
|
lsls r0, r6, 2\n\
|
||||||
|
adds r0, r1\n\
|
||||||
|
ldrh r0, [r0]\n\
|
||||||
|
cmp r0, 0\n\
|
||||||
|
bne _080D68F2\n\
|
||||||
|
cmp r5, r7\n\
|
||||||
|
bls _080D6914\n\
|
||||||
|
cmp r2, 0x1\n\
|
||||||
|
bls _080D6906\n\
|
||||||
|
subs r0, r5, r7\n\
|
||||||
|
lsls r0, 16\n\
|
||||||
|
lsrs r5, r0, 16\n\
|
||||||
|
_080D68F2:\n\
|
||||||
|
adds r0, r6, 0x1\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r6, r0, 24\n\
|
||||||
|
mov r1, r9\n\
|
||||||
|
adds r0, r1, r3\n\
|
||||||
|
ldrb r0, [r0, 0x4]\n\
|
||||||
|
cmp r6, r0\n\
|
||||||
|
bcc _080D68D6\n\
|
||||||
|
_080D6902:\n\
|
||||||
|
cmp r5, 0\n\
|
||||||
|
beq _080D6914\n\
|
||||||
|
_080D6906:\n\
|
||||||
|
movs r0, 0\n\
|
||||||
|
b _080D6916\n\
|
||||||
|
.pool\n\
|
||||||
|
_080D6914:\n\
|
||||||
|
movs r0, 0x1\n\
|
||||||
|
_080D6916:\n\
|
||||||
|
add sp, 0x4\n\
|
||||||
|
pop {r3-r5}\n\
|
||||||
|
mov r8, r3\n\
|
||||||
|
mov r9, r4\n\
|
||||||
|
mov r10, r5\n\
|
||||||
|
pop {r4-r7}\n\
|
||||||
|
pop {r1}\n\
|
||||||
|
bx r1");
|
||||||
|
}
|
||||||
|
#endif // NONMATCHING
|
||||||
|
|
||||||
bool8 AddBagItem(u16 itemId, u16 count)
|
bool8 AddBagItem(u16 itemId, u16 count)
|
||||||
{
|
{
|
||||||
|
@ -628,6 +628,7 @@ void CB2_Bag(void)
|
|||||||
|
|
||||||
bool8 SetupBagMenu(void)
|
bool8 SetupBagMenu(void)
|
||||||
{
|
{
|
||||||
|
u32 index;
|
||||||
u8 taskId;
|
u8 taskId;
|
||||||
|
|
||||||
switch (gMain.state)
|
switch (gMain.state)
|
||||||
@ -1166,7 +1167,7 @@ void Task_BagMenu_HandleInput(u8 taskId)
|
|||||||
SwitchBagPocket(taskId, MENU_CURSOR_DELTA_RIGHT, 0);
|
SwitchBagPocket(taskId, MENU_CURSOR_DELTA_RIGHT, 0);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
if (JOY_NEW(SELECT_BUTTON))
|
if (gMain.newKeys & SELECT_BUTTON)
|
||||||
{
|
{
|
||||||
if (CanSwapItems() == TRUE)
|
if (CanSwapItems() == TRUE)
|
||||||
{
|
{
|
||||||
@ -1228,12 +1229,12 @@ static u8 GetSwitchBagPocketDirection(void)
|
|||||||
if (gBagMenu->pocketSwitchDisabled)
|
if (gBagMenu->pocketSwitchDisabled)
|
||||||
return SWITCH_POCKET_NONE;
|
return SWITCH_POCKET_NONE;
|
||||||
LRKeys = GetLRKeysPressed();
|
LRKeys = GetLRKeysPressed();
|
||||||
if (JOY_NEW(DPAD_LEFT) || LRKeys == MENU_L_PRESSED)
|
if ((gMain.newKeys & DPAD_LEFT) || LRKeys == MENU_L_PRESSED)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return SWITCH_POCKET_LEFT;
|
return SWITCH_POCKET_LEFT;
|
||||||
}
|
}
|
||||||
if (JOY_NEW(DPAD_RIGHT) || LRKeys == MENU_R_PRESSED)
|
if ((gMain.newKeys & DPAD_RIGHT) || LRKeys == MENU_R_PRESSED)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return SWITCH_POCKET_RIGHT;
|
return SWITCH_POCKET_RIGHT;
|
||||||
@ -1387,7 +1388,7 @@ static void Task_HandleSwappingItemsInput(u8 taskId)
|
|||||||
|
|
||||||
if (MenuHelpers_CallLinkSomething() != TRUE)
|
if (MenuHelpers_CallLinkSomething() != TRUE)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(SELECT_BUTTON))
|
if (gMain.newKeys & SELECT_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
ListMenuGetScrollAndRow(data[0], &gBagPositionStruct.scrollPosition[gBagPositionStruct.pocket], &gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket]);
|
ListMenuGetScrollAndRow(data[0], &gBagPositionStruct.scrollPosition[gBagPositionStruct.pocket], &gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket]);
|
||||||
@ -1405,7 +1406,7 @@ static void Task_HandleSwappingItemsInput(u8 taskId)
|
|||||||
break;
|
break;
|
||||||
case LIST_CANCEL:
|
case LIST_CANCEL:
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
sub_81AC498(taskId);
|
sub_81AC498(taskId);
|
||||||
else
|
else
|
||||||
sub_81AC590(taskId);
|
sub_81AC590(taskId);
|
||||||
@ -1644,7 +1645,7 @@ void Task_HandleOutOfBattleItemMenuInput(u8 taskId)
|
|||||||
if (MenuHelpers_CallLinkSomething() != TRUE)
|
if (MenuHelpers_CallLinkSomething() != TRUE)
|
||||||
{
|
{
|
||||||
s8 cursorPos = Menu_GetCursorPos();
|
s8 cursorPos = Menu_GetCursorPos();
|
||||||
if (JOY_NEW(DPAD_UP))
|
if (gMain.newKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
if (cursorPos > 0 && sub_81ACDFC(cursorPos - 2))
|
if (cursorPos > 0 && sub_81ACDFC(cursorPos - 2))
|
||||||
{
|
{
|
||||||
@ -1652,7 +1653,7 @@ void Task_HandleOutOfBattleItemMenuInput(u8 taskId)
|
|||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_UP);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_UP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_DOWN))
|
else if (gMain.newKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
if (cursorPos < (gBagMenu->contextMenuNumItems - 2) && sub_81ACDFC(cursorPos + 2))
|
if (cursorPos < (gBagMenu->contextMenuNumItems - 2) && sub_81ACDFC(cursorPos + 2))
|
||||||
{
|
{
|
||||||
@ -1660,7 +1661,7 @@ void Task_HandleOutOfBattleItemMenuInput(u8 taskId)
|
|||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_DOWN);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_DOWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((JOY_NEW(DPAD_LEFT)) || GetLRKeysPressed() == MENU_L_PRESSED)
|
else if ((gMain.newKeys & DPAD_LEFT) || GetLRKeysPressed() == MENU_L_PRESSED)
|
||||||
{
|
{
|
||||||
if ((cursorPos & 1) && sub_81ACDFC(cursorPos - 1))
|
if ((cursorPos & 1) && sub_81ACDFC(cursorPos - 1))
|
||||||
{
|
{
|
||||||
@ -1668,7 +1669,7 @@ void Task_HandleOutOfBattleItemMenuInput(u8 taskId)
|
|||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_LEFT, MENU_CURSOR_DELTA_NONE);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_LEFT, MENU_CURSOR_DELTA_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
|
else if ((gMain.newKeys & DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
|
||||||
{
|
{
|
||||||
if (!(cursorPos & 1) && sub_81ACDFC(cursorPos + 1))
|
if (!(cursorPos & 1) && sub_81ACDFC(cursorPos + 1))
|
||||||
{
|
{
|
||||||
@ -1676,12 +1677,12 @@ void Task_HandleOutOfBattleItemMenuInput(u8 taskId)
|
|||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_RIGHT, MENU_CURSOR_DELTA_NONE);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_RIGHT, MENU_CURSOR_DELTA_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(A_BUTTON))
|
else if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
sItemMenuActions[gBagMenu->contextMenuItemsPtr[cursorPos]].func.void_u8(taskId);
|
sItemMenuActions[gBagMenu->contextMenuItemsPtr[cursorPos]].func.void_u8(taskId);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
sItemMenuActions[ITEMMENUACTION_CANCEL].func.void_u8(taskId);
|
sItemMenuActions[ITEMMENUACTION_CANCEL].func.void_u8(taskId);
|
||||||
@ -1785,13 +1786,13 @@ void Task_ChooseHowManyToToss(u8 taskId)
|
|||||||
{
|
{
|
||||||
PrintItemDepositAmount(gBagMenu->windowPointers[7], tItemCount);
|
PrintItemDepositAmount(gBagMenu->windowPointers[7], tItemCount);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(A_BUTTON))
|
else if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BagMenu_RemoveWindow(7);
|
BagMenu_RemoveWindow(7);
|
||||||
BagMenu_TossItems(taskId);
|
BagMenu_TossItems(taskId);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BagMenu_RemoveWindow(7);
|
BagMenu_RemoveWindow(7);
|
||||||
@ -1817,7 +1818,7 @@ void Task_ActuallyToss(u8 taskId)
|
|||||||
u16* scrollPos = &gBagPositionStruct.scrollPosition[gBagPositionStruct.pocket];
|
u16* scrollPos = &gBagPositionStruct.scrollPosition[gBagPositionStruct.pocket];
|
||||||
u16* cursorPos = &gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket];
|
u16* cursorPos = &gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket];
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
RemoveBagItem(gSpecialVar_ItemId, tItemCount);
|
RemoveBagItem(gSpecialVar_ItemId, tItemCount);
|
||||||
@ -1885,7 +1886,7 @@ static void BagMenu_PrintItemCantBeHeld(u8 taskId)
|
|||||||
|
|
||||||
void sub_81AD350(u8 taskId)
|
void sub_81AD350(u8 taskId)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BagMenu_InitListsMenu(taskId);
|
BagMenu_InitListsMenu(taskId);
|
||||||
@ -2059,13 +2060,13 @@ static void Task_SellHowManyDialogueHandleInput(u8 taskId)
|
|||||||
{
|
{
|
||||||
PrintItemSoldAmount(gBagMenu->windowPointers[8], tItemCount, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount);
|
PrintItemSoldAmount(gBagMenu->windowPointers[8], tItemCount, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(A_BUTTON))
|
else if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BagMenu_RemoveWindow(8);
|
BagMenu_RemoveWindow(8);
|
||||||
DisplaySellItemPriceAndConfirm(taskId);
|
DisplaySellItemPriceAndConfirm(taskId);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BagMenu_PrintCursor_(data[0], 0);
|
BagMenu_PrintCursor_(data[0], 0);
|
||||||
@ -2107,7 +2108,7 @@ static void BagMenu_Sell_UpdateItemListAndMoney(u8 taskId)
|
|||||||
|
|
||||||
static void BagMenu_Sell_WaitForABPress(u8 taskId)
|
static void BagMenu_Sell_WaitForABPress(u8 taskId)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
RemoveMoneyWindow();
|
RemoveMoneyWindow();
|
||||||
@ -2143,13 +2144,13 @@ static void Task_ChooseHowManyToDeposit(u8 taskId)
|
|||||||
{
|
{
|
||||||
PrintItemDepositAmount(gBagMenu->windowPointers[7], tItemCount);
|
PrintItemDepositAmount(gBagMenu->windowPointers[7], tItemCount);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(A_BUTTON))
|
else if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BagMenu_RemoveWindow(7);
|
BagMenu_RemoveWindow(7);
|
||||||
BagMenu_TryDepositItem(taskId);
|
BagMenu_TryDepositItem(taskId);
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BagMenu_PrintDescription(data[1]);
|
BagMenu_PrintDescription(data[1]);
|
||||||
@ -2188,7 +2189,7 @@ static void BagMenu_Deposit_WaitForABPress(u8 taskId)
|
|||||||
{
|
{
|
||||||
s16* data = gTasks[taskId].data;
|
s16* data = gTasks[taskId].data;
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BagMenu_PrintDescription(data[1]);
|
BagMenu_PrintDescription(data[1]);
|
||||||
|
@ -721,7 +721,7 @@ static void ItemUseOnFieldCB_WailmerPailBerry(u8 taskId)
|
|||||||
|
|
||||||
static bool8 TryToWaterSudowoodo(void)
|
static bool8 TryToWaterSudowoodo(void)
|
||||||
{
|
{
|
||||||
s16 x, y;
|
u16 x, y;
|
||||||
u8 z;
|
u8 z;
|
||||||
u8 objId;
|
u8 objId;
|
||||||
GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
|
GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
|
||||||
@ -792,7 +792,7 @@ static void BootUpSoundTMHM(u8 taskId)
|
|||||||
|
|
||||||
static void Task_ShowTMHMContainedMessage(u8 taskId)
|
static void Task_ShowTMHMContainedMessage(u8 taskId)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
{
|
||||||
StringCopy(gStringVar1, gMoveNames[ItemIdToBattleMoveId(gSpecialVar_ItemId)]);
|
StringCopy(gStringVar1, gMoveNames[ItemIdToBattleMoveId(gSpecialVar_ItemId)]);
|
||||||
StringExpandPlaceholders(gStringVar4, gText_TMHMContainedVar1);
|
StringExpandPlaceholders(gStringVar4, gText_TMHMContainedVar1);
|
||||||
@ -956,7 +956,7 @@ void ItemUseInBattle_PokeBall(u8 taskId)
|
|||||||
|
|
||||||
static void Task_CloseStatIncreaseMessage(u8 taskId)
|
static void Task_CloseStatIncreaseMessage(u8 taskId)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
{
|
||||||
if (!InBattlePyramid())
|
if (!InBattlePyramid())
|
||||||
Task_FadeAndCloseBagMenu(taskId);
|
Task_FadeAndCloseBagMenu(taskId);
|
||||||
|
16
src/link.c
16
src/link.c
@ -445,27 +445,27 @@ static void TestBlockTransfer(u8 nothing, u8 is, u8 used)
|
|||||||
|
|
||||||
static void LinkTestProcessKeyInput(void)
|
static void LinkTestProcessKeyInput(void)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
gShouldAdvanceLinkState = 1;
|
gShouldAdvanceLinkState = 1;
|
||||||
}
|
}
|
||||||
if (JOY_HELD(B_BUTTON))
|
if (gMain.heldKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
InitBlockSend(gHeap + 0x4000, 0x00002004);
|
InitBlockSend(gHeap + 0x4000, 0x00002004);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(L_BUTTON))
|
if (gMain.newKeys & L_BUTTON)
|
||||||
{
|
{
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(2, 0, 0));
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(2, 0, 0));
|
||||||
}
|
}
|
||||||
if (JOY_NEW(START_BUTTON))
|
if (gMain.newKeys & START_BUTTON)
|
||||||
{
|
{
|
||||||
SetSuppressLinkErrorMessage(TRUE);
|
SetSuppressLinkErrorMessage(TRUE);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(R_BUTTON))
|
if (gMain.newKeys & R_BUTTON)
|
||||||
{
|
{
|
||||||
TrySavingData(SAVE_LINK);
|
TrySavingData(SAVE_LINK);
|
||||||
}
|
}
|
||||||
if (JOY_NEW(SELECT_BUTTON))
|
if (gMain.newKeys & SELECT_BUTTON)
|
||||||
{
|
{
|
||||||
SetCloseLinkCallback();
|
SetCloseLinkCallback();
|
||||||
}
|
}
|
||||||
@ -1754,7 +1754,7 @@ static void CB2_PrintErrorMessage(void)
|
|||||||
{
|
{
|
||||||
if (gWirelessCommType == 1)
|
if (gWirelessCommType == 1)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_PIN);
|
PlaySE(SE_PIN);
|
||||||
gWirelessCommType = 0;
|
gWirelessCommType = 0;
|
||||||
@ -1764,7 +1764,7 @@ static void CB2_PrintErrorMessage(void)
|
|||||||
}
|
}
|
||||||
else if (gWirelessCommType == 2)
|
else if (gWirelessCommType == 2)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
rfu_REQ_stopMode();
|
rfu_REQ_stopMode();
|
||||||
rfu_waitREQComplete();
|
rfu_waitREQComplete();
|
||||||
|
@ -876,7 +876,8 @@ static void sub_800F498(u16 *a0, u8 *a1)
|
|||||||
|
|
||||||
static bool32 RfuProcessEnqueuedRecvBlock(void)
|
static bool32 RfuProcessEnqueuedRecvBlock(void)
|
||||||
{
|
{
|
||||||
u8 i, j;
|
u8 i;
|
||||||
|
u8 j;
|
||||||
u8 sp00[MAX_RFU_PLAYERS * (2 * (CMD_LENGTH - 1))];
|
u8 sp00[MAX_RFU_PLAYERS * (2 * (CMD_LENGTH - 1))];
|
||||||
u8 sp48[2 * (CMD_LENGTH - 1)];
|
u8 sp48[2 * (CMD_LENGTH - 1)];
|
||||||
u8 status;
|
u8 status;
|
||||||
@ -922,7 +923,7 @@ static bool32 RfuProcessEnqueuedRecvBlock(void)
|
|||||||
|
|
||||||
static void HandleSendFailure(u8 unused, u32 flags)
|
static void HandleSendFailure(u8 unused, u32 flags)
|
||||||
{
|
{
|
||||||
s32 i, j, temp;
|
s32 i, j;
|
||||||
|
|
||||||
const u8 *r10 = Rfu.sendBlock.payload;
|
const u8 *r10 = Rfu.sendBlock.payload;
|
||||||
for (i = 0; i < Rfu.sendBlock.count; i++)
|
for (i = 0; i < Rfu.sendBlock.count; i++)
|
||||||
@ -932,15 +933,14 @@ static void HandleSendFailure(u8 unused, u32 flags)
|
|||||||
sResendBlock16[0] = RFUCMD_0x8900 | i;
|
sResendBlock16[0] = RFUCMD_0x8900 | i;
|
||||||
for (j = 0; j < 7; j++)
|
for (j = 0; j < 7; j++)
|
||||||
{
|
{
|
||||||
temp = j << 1;
|
sResendBlock16[j + 1] = (r10[12 * i + (j << 1) + 1] << 8) | r10[12 * i + (j << 1) + 0];
|
||||||
sResendBlock16[j + 1] = (r10[i * 12 + temp + 1] << 8) | r10[i * 12 + temp];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < 7; j++)
|
for (j = 0; j < 7; j++)
|
||||||
{
|
{
|
||||||
temp = j << 1;
|
sResendBlock8[2 * j + 1] = sResendBlock16[j] >> 8;
|
||||||
sResendBlock8[temp + 1] = sResendBlock16[j] >> 8;
|
sResendBlock8[2 * j + 0] = sResendBlock16[j];
|
||||||
sResendBlock8[temp + 0] = sResendBlock16[j] & 0xff;
|
|
||||||
|
j++;j--; // Needed to match;
|
||||||
}
|
}
|
||||||
RfuSendQueue_Enqueue(&Rfu.sendQueue, sResendBlock8);
|
RfuSendQueue_Enqueue(&Rfu.sendQueue, sResendBlock8);
|
||||||
Rfu.sendBlock.failedFlags |= (1 << i);
|
Rfu.sendBlock.failedFlags |= (1 << i);
|
||||||
@ -1024,7 +1024,8 @@ void Rfu_SetBerryBlenderLinkCallback(void)
|
|||||||
|
|
||||||
static void RfuHandleReceiveCommand(u8 unused)
|
static void RfuHandleReceiveCommand(u8 unused)
|
||||||
{
|
{
|
||||||
u16 i, j;
|
u16 i;
|
||||||
|
u16 j;
|
||||||
|
|
||||||
for (i = 0; i < MAX_RFU_PLAYERS; i++)
|
for (i = 0; i < MAX_RFU_PLAYERS; i++)
|
||||||
{
|
{
|
||||||
@ -1038,7 +1039,7 @@ static void RfuHandleReceiveCommand(u8 unused)
|
|||||||
if (gRfuLinkStatus->parentChild == MODE_CHILD)
|
if (gRfuLinkStatus->parentChild == MODE_CHILD)
|
||||||
{
|
{
|
||||||
Rfu.playerCount = gRecvCmds[i][1];
|
Rfu.playerCount = gRecvCmds[i][1];
|
||||||
Rfu.multiplayerId = sub_800F74C((u8 *)(&gRecvCmds[i][2]));
|
Rfu.multiplayerId = sub_800F74C((u8 *)(gRecvCmds[i] + 2));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RFUCMD_0x8800:
|
case RFUCMD_0x8800:
|
||||||
@ -1237,9 +1238,10 @@ void Rfu_SendPacket(void *data)
|
|||||||
bool32 Rfu_InitBlockSend(const u8 *src, size_t size)
|
bool32 Rfu_InitBlockSend(const u8 *src, size_t size)
|
||||||
{
|
{
|
||||||
bool8 r4;
|
bool8 r4;
|
||||||
if (Rfu.callback != NULL || gSendCmd[0] != 0)
|
if (Rfu.callback != NULL)
|
||||||
|
return FALSE;
|
||||||
|
if (gSendCmd[0] != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (Rfu.sendBlock.sending)
|
if (Rfu.sendBlock.sending)
|
||||||
{
|
{
|
||||||
sRfuDebug.unk_83++;
|
sRfuDebug.unk_83++;
|
||||||
@ -1417,13 +1419,17 @@ void Rfu_SetCloseLinkCallback(void)
|
|||||||
|
|
||||||
static void SendReadyExitStandbyUntilAllReady(void)
|
static void SendReadyExitStandbyUntilAllReady(void)
|
||||||
{
|
{
|
||||||
u8 i, playerCount;
|
u8 playerCount;
|
||||||
|
u8 i;
|
||||||
|
|
||||||
if (GetMultiplayerId() != 0 && Rfu.recvQueue.count == 0 && Rfu.resendExitStandbyTimer > 60)
|
if (GetMultiplayerId() != 0)
|
||||||
|
{
|
||||||
|
if (Rfu.recvQueue.count == 0 && Rfu.resendExitStandbyTimer > 60)
|
||||||
{
|
{
|
||||||
RfuPrepareSendBuffer(RFUCMD_READY_EXIT_STANDBY);
|
RfuPrepareSendBuffer(RFUCMD_READY_EXIT_STANDBY);
|
||||||
Rfu.resendExitStandbyTimer = 0;
|
Rfu.resendExitStandbyTimer = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
playerCount = GetLinkPlayerCount();
|
playerCount = GetLinkPlayerCount();
|
||||||
for (i = 0; i < playerCount; i++)
|
for (i = 0; i < playerCount; i++)
|
||||||
{
|
{
|
||||||
@ -1452,7 +1458,8 @@ static void LinkLeaderReadyToExitStandby(void)
|
|||||||
// RFU equivalent of LinkCB_Standby and LinkCB_StandbyForAll
|
// RFU equivalent of LinkCB_Standby and LinkCB_StandbyForAll
|
||||||
static void Rfu_LinkStandby(void)
|
static void Rfu_LinkStandby(void)
|
||||||
{
|
{
|
||||||
u8 i, playerCount;
|
u8 i;
|
||||||
|
u8 playerCount;
|
||||||
|
|
||||||
if (GetMultiplayerId() != 0)
|
if (GetMultiplayerId() != 0)
|
||||||
{
|
{
|
||||||
@ -1548,12 +1555,9 @@ static bool8 CheckForLeavingGroupMembers(void)
|
|||||||
bool8 memberLeft = FALSE;
|
bool8 memberLeft = FALSE;
|
||||||
for (i = 0; i < RFU_CHILD_MAX; i++)
|
for (i = 0; i < RFU_CHILD_MAX; i++)
|
||||||
{
|
{
|
||||||
if (Rfu.partnerSendStatuses[i] == RFU_STATUS_JOIN_GROUP_OK
|
if (Rfu.partnerSendStatuses[i] < RFU_STATUS_JOIN_GROUP_OK
|
||||||
|| Rfu.partnerSendStatuses[i] == RFU_STATUS_JOIN_GROUP_NO)
|
|| Rfu.partnerSendStatuses[i] > RFU_STATUS_JOIN_GROUP_NO)
|
||||||
{
|
{
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gRfuSlotStatusNI[i]->recv.state == SLOT_STATE_RECV_SUCCESS
|
if (gRfuSlotStatusNI[i]->recv.state == SLOT_STATE_RECV_SUCCESS
|
||||||
|| gRfuSlotStatusNI[i]->recv.state == SLOT_STATE_RECV_SUCCESS_AND_SENDSIDE_UNKNOWN)
|
|| gRfuSlotStatusNI[i]->recv.state == SLOT_STATE_RECV_SUCCESS_AND_SENDSIDE_UNKNOWN)
|
||||||
{
|
{
|
||||||
@ -1565,10 +1569,13 @@ static bool8 CheckForLeavingGroupMembers(void)
|
|||||||
rfu_NI_setSendData(1 << i, 8, &Rfu.partnerSendStatuses[i], 1);
|
rfu_NI_setSendData(1 << i, 8, &Rfu.partnerSendStatuses[i], 1);
|
||||||
memberLeft = TRUE;
|
memberLeft = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (gRfuSlotStatusNI[Rfu.childSlot]->recv.state == SLOT_STATE_RECV_FAILED)
|
else if (gRfuSlotStatusNI[Rfu.childSlot]->recv.state == SLOT_STATE_RECV_FAILED)
|
||||||
{
|
|
||||||
rfu_clearSlot(TYPE_NI_RECV, i);
|
rfu_clearSlot(TYPE_NI_RECV, i);
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return memberLeft;
|
return memberLeft;
|
||||||
@ -2044,7 +2051,8 @@ void sub_80110B8(u32 a0)
|
|||||||
if ((r8 >> i) & 1)
|
if ((r8 >> i) & 1)
|
||||||
{
|
{
|
||||||
child_sprite_genders |= ((0x80 | ((gLinkPlayers[Rfu.linkPlayerIdx[i]].gender & 1) << 3) | (gLinkPlayers[Rfu.linkPlayerIdx[i]].trainerId & 7)) << (numConnectedChildren << 3));
|
child_sprite_genders |= ((0x80 | ((gLinkPlayers[Rfu.linkPlayerIdx[i]].gender & 1) << 3) | (gLinkPlayers[Rfu.linkPlayerIdx[i]].trainerId & 7)) << (numConnectedChildren << 3));
|
||||||
if (++numConnectedChildren == a0 - 1)
|
numConnectedChildren++;
|
||||||
|
if (numConnectedChildren == a0 - 1)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2089,7 +2097,8 @@ static void sub_80111FC(void)
|
|||||||
|
|
||||||
static void sub_801120C(u8 msg, u8 paramCount)
|
static void sub_801120C(u8 msg, u8 paramCount)
|
||||||
{
|
{
|
||||||
u8 i, disconnectFlag = 0;
|
u8 i;
|
||||||
|
u8 disconnectFlag = 0;
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
case LMAN_MSG_INITIALIZE_COMPLETED:
|
case LMAN_MSG_INITIALIZE_COMPLETED:
|
||||||
|
@ -309,7 +309,8 @@ static const struct SpriteTemplate sWirelessStatusIndicatorSpriteTemplate = {
|
|||||||
|
|
||||||
void RfuRecvQueue_Reset(struct RfuRecvQueue *queue)
|
void RfuRecvQueue_Reset(struct RfuRecvQueue *queue)
|
||||||
{
|
{
|
||||||
s32 i, j;
|
s32 i;
|
||||||
|
s32 j;
|
||||||
|
|
||||||
for (i = 0; i < RECV_QUEUE_NUM_SLOTS; i++)
|
for (i = 0; i < RECV_QUEUE_NUM_SLOTS; i++)
|
||||||
{
|
{
|
||||||
@ -326,7 +327,8 @@ void RfuRecvQueue_Reset(struct RfuRecvQueue *queue)
|
|||||||
|
|
||||||
void RfuSendQueue_Reset(struct RfuSendQueue *queue)
|
void RfuSendQueue_Reset(struct RfuSendQueue *queue)
|
||||||
{
|
{
|
||||||
s32 i, j;
|
s32 i;
|
||||||
|
s32 j;
|
||||||
|
|
||||||
for (i = 0; i < SEND_QUEUE_NUM_SLOTS; i++)
|
for (i = 0; i < SEND_QUEUE_NUM_SLOTS; i++)
|
||||||
{
|
{
|
||||||
@ -343,7 +345,8 @@ void RfuSendQueue_Reset(struct RfuSendQueue *queue)
|
|||||||
|
|
||||||
static void RfuUnusedQueue_Reset(struct RfuUnusedQueue *queue)
|
static void RfuUnusedQueue_Reset(struct RfuUnusedQueue *queue)
|
||||||
{
|
{
|
||||||
s32 i, j;
|
s32 i;
|
||||||
|
s32 j;
|
||||||
|
|
||||||
for (i = 0; i < UNUSED_QUEUE_NUM_SLOTS; i++)
|
for (i = 0; i < UNUSED_QUEUE_NUM_SLOTS; i++)
|
||||||
{
|
{
|
||||||
@ -620,39 +623,105 @@ static void ASCIIToPkmnStr(u8 *pkmnStr, const u8 *asciiStr)
|
|||||||
pkmnStr[i] = EOS;
|
pkmnStr[i] = EOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NONMATCHING
|
||||||
static u8 GetConnectedChildStrength(u8 maxFlags)
|
static u8 GetConnectedChildStrength(u8 maxFlags)
|
||||||
{
|
{
|
||||||
u8 flagCount = 0;
|
u8 flagCount = 0;
|
||||||
u8 flags = gRfuLinkStatus->connSlotFlag;
|
u32 flags = gRfuLinkStatus->connSlotFlag;
|
||||||
u8 i;
|
u8 i;
|
||||||
|
|
||||||
if (gRfuLinkStatus->parentChild == MODE_PARENT)
|
if (gRfuLinkStatus->parentChild == MODE_PARENT)
|
||||||
{
|
{
|
||||||
for (i = 0; i < RFU_CHILD_MAX; i++)
|
for (i = 0; i < 4; flags >>= 1, i++)
|
||||||
{
|
{
|
||||||
if (flags & 1)
|
if (flags & 1)
|
||||||
{
|
{
|
||||||
if (maxFlags == flagCount + 1)
|
if (maxFlags == flagCount + 1)
|
||||||
{
|
|
||||||
return gRfuLinkStatus->strength[i];
|
return gRfuLinkStatus->strength[i];
|
||||||
break; // This break is needed to match
|
|
||||||
}
|
|
||||||
flagCount++;
|
flagCount++;
|
||||||
}
|
}
|
||||||
flags >>= 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; flags >>= 1, i++)
|
||||||
{
|
{
|
||||||
if (flags & 1)
|
if (flags & 1)
|
||||||
return gRfuLinkStatus->strength[i];
|
return gRfuLinkStatus->strength[i];
|
||||||
flags >>= 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
static u8 GetConnectedChildStrength(u8 maxFlags)
|
||||||
|
{
|
||||||
|
asm_unified("\tpush {r4-r7,lr}\n"
|
||||||
|
"\tlsls r0, 24\n"
|
||||||
|
"\tlsrs r5, r0, 24\n"
|
||||||
|
"\tmovs r6, 0\n"
|
||||||
|
"\tldr r0, =gRfuLinkStatus\n"
|
||||||
|
"\tldr r4, [r0]\n"
|
||||||
|
"\tldrb r2, [r4, 0x2]\n"
|
||||||
|
"\tldrb r1, [r4]\n"
|
||||||
|
"\tadds r7, r0, 0\n"
|
||||||
|
"\tcmp r1, 0x1\n"
|
||||||
|
"\tbne _0800DD72\n"
|
||||||
|
"\tmovs r3, 0\n"
|
||||||
|
"\tands r1, r2\n"
|
||||||
|
"\tcmp r1, 0\n"
|
||||||
|
"\tbeq _0800DD4E\n"
|
||||||
|
"\tcmp r5, 0x1\n"
|
||||||
|
"\tbne _0800DD48\n"
|
||||||
|
"\tldrb r0, [r4, 0xA]\n"
|
||||||
|
"\tb _0800DD8C\n"
|
||||||
|
"\t.pool\n"
|
||||||
|
"_0800DD48:\n"
|
||||||
|
"\tadds r0, r6, 0x1\n"
|
||||||
|
"\tlsls r0, 24\n"
|
||||||
|
"\tlsrs r6, r0, 24\n"
|
||||||
|
"_0800DD4E:\n"
|
||||||
|
"\tlsrs r2, 1\n"
|
||||||
|
"\tadds r0, r3, 0x1\n"
|
||||||
|
"\tlsls r0, 24\n"
|
||||||
|
"\tlsrs r3, r0, 24\n"
|
||||||
|
"\tcmp r3, 0x3\n"
|
||||||
|
"\tbhi _0800DD8A\n"
|
||||||
|
"\tmovs r0, 0x1\n"
|
||||||
|
"\tands r0, r2\n"
|
||||||
|
"\tcmp r0, 0\n"
|
||||||
|
"\tbeq _0800DD4E\n"
|
||||||
|
"\tadds r0, r6, 0x1\n"
|
||||||
|
"\tcmp r5, r0\n"
|
||||||
|
"\tbne _0800DD48\n"
|
||||||
|
"_0800DD68:\n"
|
||||||
|
"\tldr r0, [r7]\n"
|
||||||
|
"\tadds r0, 0xA\n"
|
||||||
|
"\tadds r0, r3\n"
|
||||||
|
"\tldrb r0, [r0]\n"
|
||||||
|
"\tb _0800DD8C\n"
|
||||||
|
"_0800DD72:\n"
|
||||||
|
"\tmovs r3, 0\n"
|
||||||
|
"\tmovs r1, 0x1\n"
|
||||||
|
"_0800DD76:\n"
|
||||||
|
"\tadds r0, r2, 0\n"
|
||||||
|
"\tands r0, r1\n"
|
||||||
|
"\tcmp r0, 0\n"
|
||||||
|
"\tbne _0800DD68\n"
|
||||||
|
"\tlsrs r2, 1\n"
|
||||||
|
"\tadds r0, r3, 0x1\n"
|
||||||
|
"\tlsls r0, 24\n"
|
||||||
|
"\tlsrs r3, r0, 24\n"
|
||||||
|
"\tcmp r3, 0x3\n"
|
||||||
|
"\tbls _0800DD76\n"
|
||||||
|
"_0800DD8A:\n"
|
||||||
|
"\tmovs r0, 0\n"
|
||||||
|
"_0800DD8C:\n"
|
||||||
|
"\tpop {r4-r7}\n"
|
||||||
|
"\tpop {r1}\n"
|
||||||
|
"\tbx r1");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void InitHostRFUtgtGname(struct GFtgtGname *data, u8 activity, bool32 started, s32 child_sprite_genders)
|
void InitHostRFUtgtGname(struct GFtgtGname *data, u8 activity, bool32 started, s32 child_sprite_genders)
|
||||||
{
|
{
|
||||||
@ -922,7 +991,8 @@ void RecordMixTrainerNames(void)
|
|||||||
{
|
{
|
||||||
if (gWirelessCommType != 0)
|
if (gWirelessCommType != 0)
|
||||||
{
|
{
|
||||||
s32 i, j;
|
s32 i;
|
||||||
|
s32 j;
|
||||||
s32 nextSpace;
|
s32 nextSpace;
|
||||||
s32 connectedTrainerRecordIndices[5];
|
s32 connectedTrainerRecordIndices[5];
|
||||||
struct TrainerNameRecord *newRecords = calloc(ARRAY_COUNT(gSaveBlock1Ptr->trainerNameRecords), sizeof(struct TrainerNameRecord));
|
struct TrainerNameRecord *newRecords = calloc(ARRAY_COUNT(gSaveBlock1Ptr->trainerNameRecords), sizeof(struct TrainerNameRecord));
|
||||||
|
@ -312,7 +312,7 @@ static void ListMenuDummyTask(u8 taskId)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum)
|
s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum)
|
||||||
{
|
{
|
||||||
switch (sMysteryGiftLinkMenu.state)
|
switch (sMysteryGiftLinkMenu.state)
|
||||||
{
|
{
|
||||||
@ -335,11 +335,11 @@ u32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const str
|
|||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
sMysteryGiftLinkMenu.currItemId = ListMenu_ProcessInput(sMysteryGiftLinkMenu.listTaskId);
|
sMysteryGiftLinkMenu.currItemId = ListMenu_ProcessInput(sMysteryGiftLinkMenu.listTaskId);
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
sMysteryGiftLinkMenu.state = 2;
|
sMysteryGiftLinkMenu.state = 2;
|
||||||
}
|
}
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
sMysteryGiftLinkMenu.currItemId = LIST_CANCEL;
|
sMysteryGiftLinkMenu.currItemId = LIST_CANCEL;
|
||||||
sMysteryGiftLinkMenu.state = 2;
|
sMysteryGiftLinkMenu.state = 2;
|
||||||
@ -410,20 +410,20 @@ s32 ListMenu_ProcessInput(u8 listTaskId)
|
|||||||
{
|
{
|
||||||
struct ListMenu *list = (void*) gTasks[listTaskId].data;
|
struct ListMenu *list = (void*) gTasks[listTaskId].data;
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
return list->template.items[list->scrollOffset + list->selectedRow].id;
|
return list->template.items[list->scrollOffset + list->selectedRow].id;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
return LIST_CANCEL;
|
return LIST_CANCEL;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_UP))
|
else if (gMain.newAndRepeatedKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
ListMenuChangeSelection(list, TRUE, 1, FALSE);
|
ListMenuChangeSelection(list, TRUE, 1, FALSE);
|
||||||
return LIST_NOTHING_CHOSEN;
|
return LIST_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_DOWN))
|
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
ListMenuChangeSelection(list, TRUE, 1, TRUE);
|
ListMenuChangeSelection(list, TRUE, 1, TRUE);
|
||||||
return LIST_NOTHING_CHOSEN;
|
return LIST_NOTHING_CHOSEN;
|
||||||
@ -439,12 +439,12 @@ s32 ListMenu_ProcessInput(u8 listTaskId)
|
|||||||
rightButton = FALSE;
|
rightButton = FALSE;
|
||||||
break;
|
break;
|
||||||
case LIST_MULTIPLE_SCROLL_DPAD:
|
case LIST_MULTIPLE_SCROLL_DPAD:
|
||||||
leftButton = JOY_REPEAT(DPAD_LEFT);
|
leftButton = gMain.newAndRepeatedKeys & DPAD_LEFT;
|
||||||
rightButton = JOY_REPEAT(DPAD_RIGHT);
|
rightButton = gMain.newAndRepeatedKeys & DPAD_RIGHT;
|
||||||
break;
|
break;
|
||||||
case LIST_MULTIPLE_SCROLL_L_R:
|
case LIST_MULTIPLE_SCROLL_L_R:
|
||||||
leftButton = JOY_REPEAT(L_BUTTON);
|
leftButton = gMain.newAndRepeatedKeys & L_BUTTON;
|
||||||
rightButton = JOY_REPEAT(R_BUTTON);
|
rightButton = gMain.newAndRepeatedKeys & R_BUTTON;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1257,17 +1257,17 @@ void ListMenuSetUpRedOutlineCursorSpriteOamTable(u16 rowWidth, u16 rowHeight, st
|
|||||||
s32 i, j, id = 0;
|
s32 i, j, id = 0;
|
||||||
|
|
||||||
subsprites[id] = sSubsprite_RedOutline1;
|
subsprites[id] = sSubsprite_RedOutline1;
|
||||||
subsprites[id].x = -120;
|
subsprites[id].x = 136;
|
||||||
subsprites[id].y = -120;
|
subsprites[id].y = 136;
|
||||||
id++;
|
id++;
|
||||||
|
|
||||||
subsprites[id] = sSubsprite_RedOutline2;
|
subsprites[id] = sSubsprite_RedOutline2;
|
||||||
subsprites[id].x = rowWidth + 128;
|
subsprites[id].x = rowWidth + 128;
|
||||||
subsprites[id].y = -120;
|
subsprites[id].y = 136;
|
||||||
id++;
|
id++;
|
||||||
|
|
||||||
subsprites[id] = sSubsprite_RedOutline7;
|
subsprites[id] = sSubsprite_RedOutline7;
|
||||||
subsprites[id].x = -120;
|
subsprites[id].x = 136;
|
||||||
subsprites[id].y = rowHeight + 128;
|
subsprites[id].y = rowHeight + 128;
|
||||||
id++;
|
id++;
|
||||||
|
|
||||||
@ -1297,7 +1297,7 @@ void ListMenuSetUpRedOutlineCursorSpriteOamTable(u16 rowWidth, u16 rowHeight, st
|
|||||||
for (j = 8; j < rowHeight - 8; j += 8)
|
for (j = 8; j < rowHeight - 8; j += 8)
|
||||||
{
|
{
|
||||||
subsprites[id] = sSubsprite_RedOutline4;
|
subsprites[id] = sSubsprite_RedOutline4;
|
||||||
subsprites[id].x = -120;
|
subsprites[id].x = 136;
|
||||||
subsprites[id].y = j - 120;
|
subsprites[id].y = j - 120;
|
||||||
id++;
|
id++;
|
||||||
|
|
||||||
|
95
src/m4a.c
95
src/m4a.c
@ -22,7 +22,8 @@ u8 gMPlayMemAccArea[0x10];
|
|||||||
|
|
||||||
u32 MidiKeyToFreq(struct WaveData *wav, u8 key, u8 fineAdjust)
|
u32 MidiKeyToFreq(struct WaveData *wav, u8 key, u8 fineAdjust)
|
||||||
{
|
{
|
||||||
u32 val1, val2;
|
u32 val1;
|
||||||
|
u32 val2;
|
||||||
u32 fineAdjustShifted = fineAdjust << 24;
|
u32 fineAdjustShifted = fineAdjust << 24;
|
||||||
|
|
||||||
if (key > 178)
|
if (key > 178)
|
||||||
@ -314,7 +315,7 @@ void MPlayExtender(struct CgbChannel *cgbChans)
|
|||||||
|
|
||||||
void MusicPlayerJumpTableCopy(void)
|
void MusicPlayerJumpTableCopy(void)
|
||||||
{
|
{
|
||||||
asm("svc 0x2A");
|
asm("swi 0x2A");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearChain(void *x)
|
void ClearChain(void *x)
|
||||||
@ -351,25 +352,25 @@ void SoundInit(struct SoundInfo *soundInfo)
|
|||||||
| SOUND_ALL_MIX_FULL;
|
| SOUND_ALL_MIX_FULL;
|
||||||
REG_SOUNDBIAS_H = (REG_SOUNDBIAS_H & 0x3F) | 0x40;
|
REG_SOUNDBIAS_H = (REG_SOUNDBIAS_H & 0x3F) | 0x40;
|
||||||
|
|
||||||
REG_DMA1SAD = (u32)soundInfo->pcmBuffer;
|
REG_DMA1SAD = (s32)soundInfo->pcmBuffer;
|
||||||
REG_DMA1DAD = (u32)®_FIFO_A;
|
REG_DMA1DAD = (s32)®_FIFO_A;
|
||||||
REG_DMA2SAD = (u32)soundInfo->pcmBuffer + PCM_DMA_BUF_SIZE;
|
REG_DMA2SAD = (s32)soundInfo->pcmBuffer + PCM_DMA_BUF_SIZE;
|
||||||
REG_DMA2DAD = (u32)®_FIFO_B;
|
REG_DMA2DAD = (s32)®_FIFO_B;
|
||||||
|
|
||||||
SOUND_INFO_PTR = soundInfo;
|
SOUND_INFO_PTR = soundInfo;
|
||||||
CpuFill32(0, soundInfo, sizeof(struct SoundInfo));
|
CpuFill32(0, soundInfo, sizeof(struct SoundInfo));
|
||||||
|
|
||||||
soundInfo->maxChans = 8;
|
soundInfo->maxChans = 8;
|
||||||
soundInfo->masterVolume = 15;
|
soundInfo->masterVolume = 15;
|
||||||
soundInfo->plynote = ply_note;
|
soundInfo->plynote = (u32)ply_note;
|
||||||
soundInfo->CgbSound = DummyFunc;
|
soundInfo->CgbSound = DummyFunc;
|
||||||
soundInfo->CgbOscOff = (void (*)(u8))DummyFunc;
|
soundInfo->CgbOscOff = (void (*)(u8))DummyFunc;
|
||||||
soundInfo->MidiKeyToCgbFreq = (u32 (*)(u8, u8, u8))DummyFunc;
|
soundInfo->MidiKeyToCgbFreq = (u32 (*)(u8, u8, u8))DummyFunc;
|
||||||
soundInfo->ExtVolPit = (void (*)(struct MusicPlayerInfo *, struct MusicPlayerTrack *))DummyFunc;
|
soundInfo->ExtVolPit = (u32)DummyFunc;
|
||||||
|
|
||||||
MPlayJumpTableCopy(gMPlayJumpTable);
|
MPlayJumpTableCopy(gMPlayJumpTable);
|
||||||
|
|
||||||
soundInfo->MPlayJumpTable = (void (**)())gMPlayJumpTable;
|
soundInfo->MPlayJumpTable = (u32)gMPlayJumpTable;
|
||||||
|
|
||||||
SampleFreqSet(SOUND_MODE_FREQ_13379);
|
SampleFreqSet(SOUND_MODE_FREQ_13379);
|
||||||
|
|
||||||
@ -380,7 +381,7 @@ void SampleFreqSet(u32 freq)
|
|||||||
{
|
{
|
||||||
struct SoundInfo *soundInfo = SOUND_INFO_PTR;
|
struct SoundInfo *soundInfo = SOUND_INFO_PTR;
|
||||||
|
|
||||||
freq = (freq & SOUND_MODE_FREQ) >> SOUND_MODE_FREQ_SHIFT;
|
freq = (freq & 0xF0000) >> 16;
|
||||||
soundInfo->freq = freq;
|
soundInfo->freq = freq;
|
||||||
soundInfo->pcmSamplesPerVBlank = gPcmSamplesPerVBlankTable[freq - 1];
|
soundInfo->pcmSamplesPerVBlank = gPcmSamplesPerVBlankTable[freq - 1];
|
||||||
soundInfo->pcmDmaPeriod = PCM_DMA_BUF_SIZE / soundInfo->pcmSamplesPerVBlank;
|
soundInfo->pcmDmaPeriod = PCM_DMA_BUF_SIZE / soundInfo->pcmSamplesPerVBlank;
|
||||||
@ -431,9 +432,14 @@ void m4aSoundMode(u32 mode)
|
|||||||
|
|
||||||
soundInfo->maxChans = temp >> SOUND_MODE_MAXCHN_SHIFT;
|
soundInfo->maxChans = temp >> SOUND_MODE_MAXCHN_SHIFT;
|
||||||
|
|
||||||
for (temp = MAX_DIRECTSOUND_CHANNELS, chan = soundInfo->chans; temp != 0; temp--,chan++)
|
temp = MAX_DIRECTSOUND_CHANNELS;
|
||||||
|
chan = &soundInfo->chans[0];
|
||||||
|
|
||||||
|
while (temp != 0)
|
||||||
{
|
{
|
||||||
chan->status = 0;
|
chan->status = 0;
|
||||||
|
temp--;
|
||||||
|
chan++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,28 +469,37 @@ void m4aSoundMode(u32 mode)
|
|||||||
|
|
||||||
void SoundClear(void)
|
void SoundClear(void)
|
||||||
{
|
{
|
||||||
s32 i;
|
|
||||||
struct SoundInfo *soundInfo = SOUND_INFO_PTR;
|
struct SoundInfo *soundInfo = SOUND_INFO_PTR;
|
||||||
struct SoundChannel *chan;
|
s32 i;
|
||||||
|
void *chan;
|
||||||
|
|
||||||
if (soundInfo->ident != ID_NUMBER)
|
if (soundInfo->ident != ID_NUMBER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
soundInfo->ident++;
|
soundInfo->ident++;
|
||||||
|
|
||||||
for (i = MAX_DIRECTSOUND_CHANNELS, chan = soundInfo->chans; i > 0; i--,chan++)
|
i = MAX_DIRECTSOUND_CHANNELS;
|
||||||
|
chan = &soundInfo->chans[0];
|
||||||
|
|
||||||
|
while (i > 0)
|
||||||
{
|
{
|
||||||
chan->status = 0;
|
((struct SoundChannel *)chan)->status = 0;
|
||||||
|
i--;
|
||||||
|
chan = (void *)((s32)chan + sizeof(struct SoundChannel));
|
||||||
}
|
}
|
||||||
|
|
||||||
chan = (struct SoundChannel *)soundInfo->cgbChans;
|
chan = soundInfo->cgbChans;
|
||||||
|
|
||||||
if (chan)
|
if (chan)
|
||||||
{
|
{
|
||||||
for (i=1; i<=4; i++,chan++)
|
i = 1;
|
||||||
|
|
||||||
|
while (i <= 4)
|
||||||
{
|
{
|
||||||
soundInfo->CgbOscOff(i);
|
soundInfo->CgbOscOff(i);
|
||||||
chan->status = 0;
|
((struct CgbChannel *)chan)->sf = 0;
|
||||||
|
i++;
|
||||||
|
chan = (void *)((s32)chan + sizeof(struct CgbChannel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,8 +510,8 @@ void m4aSoundVSyncOff(void)
|
|||||||
{
|
{
|
||||||
struct SoundInfo *soundInfo = SOUND_INFO_PTR;
|
struct SoundInfo *soundInfo = SOUND_INFO_PTR;
|
||||||
|
|
||||||
if (soundInfo->ident < ID_NUMBER || soundInfo->ident > ID_NUMBER + 1)
|
if (soundInfo->ident >= ID_NUMBER && soundInfo->ident <= ID_NUMBER + 1)
|
||||||
return;
|
{
|
||||||
soundInfo->ident += 10;
|
soundInfo->ident += 10;
|
||||||
|
|
||||||
if (REG_DMA1CNT & (DMA_REPEAT << 16))
|
if (REG_DMA1CNT & (DMA_REPEAT << 16))
|
||||||
@ -510,6 +525,7 @@ void m4aSoundVSyncOff(void)
|
|||||||
|
|
||||||
CpuFill32(0, soundInfo->pcmBuffer, sizeof(soundInfo->pcmBuffer));
|
CpuFill32(0, soundInfo->pcmBuffer, sizeof(soundInfo->pcmBuffer));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void m4aSoundVSyncOn(void)
|
void m4aSoundVSyncOn(void)
|
||||||
{
|
{
|
||||||
@ -564,7 +580,7 @@ void MPlayOpen(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *track
|
|||||||
}
|
}
|
||||||
|
|
||||||
soundInfo->intp = (u32)mplayInfo;
|
soundInfo->intp = (u32)mplayInfo;
|
||||||
soundInfo->func = MPlayMain;
|
soundInfo->func = (u32)MPlayMain;
|
||||||
soundInfo->ident = ID_NUMBER;
|
soundInfo->ident = ID_NUMBER;
|
||||||
mplayInfo->ident = ID_NUMBER;
|
mplayInfo->ident = ID_NUMBER;
|
||||||
}
|
}
|
||||||
@ -598,21 +614,28 @@ void MPlayStart(struct MusicPlayerInfo *mplayInfo, struct SongHeader *songHeader
|
|||||||
mplayInfo->tempoC = 0;
|
mplayInfo->tempoC = 0;
|
||||||
mplayInfo->fadeOI = 0;
|
mplayInfo->fadeOI = 0;
|
||||||
|
|
||||||
for (i = 0, track = mplayInfo->tracks; i < songHeader->trackCount && i < mplayInfo->trackCount; i++, track++)
|
i = 0;
|
||||||
|
track = mplayInfo->tracks;
|
||||||
|
|
||||||
|
while (i < songHeader->trackCount && i < mplayInfo->trackCount)
|
||||||
{
|
{
|
||||||
TrackStop(mplayInfo, track);
|
TrackStop(mplayInfo, track);
|
||||||
track->flags = MPT_FLG_EXIST | MPT_FLG_START;
|
track->flags = MPT_FLG_EXIST | MPT_FLG_START;
|
||||||
track->chan = 0;
|
track->chan = 0;
|
||||||
track->cmdPtr = songHeader->part[i];
|
track->cmdPtr = songHeader->part[i];
|
||||||
|
i++;
|
||||||
|
track++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < mplayInfo->trackCount; i++, track++)
|
while (i < mplayInfo->trackCount)
|
||||||
{
|
{
|
||||||
TrackStop(mplayInfo, track);
|
TrackStop(mplayInfo, track);
|
||||||
track->flags = 0;
|
track->flags = 0;
|
||||||
|
i++;
|
||||||
|
track++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (songHeader->reverb & SOUND_MODE_REVERB_SET)
|
if (songHeader->reverb & 0x80)
|
||||||
m4aSoundMode(songHeader->reverb);
|
m4aSoundMode(songHeader->reverb);
|
||||||
|
|
||||||
mplayInfo->ident = ID_NUMBER;
|
mplayInfo->ident = ID_NUMBER;
|
||||||
@ -630,9 +653,14 @@ void m4aMPlayStop(struct MusicPlayerInfo *mplayInfo)
|
|||||||
mplayInfo->ident++;
|
mplayInfo->ident++;
|
||||||
mplayInfo->status |= MUSICPLAYER_STATUS_PAUSE;
|
mplayInfo->status |= MUSICPLAYER_STATUS_PAUSE;
|
||||||
|
|
||||||
for (i = mplayInfo->trackCount, track = mplayInfo->tracks; i > 0; i--, track++)
|
i = mplayInfo->trackCount;
|
||||||
|
track = mplayInfo->tracks;
|
||||||
|
|
||||||
|
while (i > 0)
|
||||||
{
|
{
|
||||||
TrackStop(mplayInfo, track);
|
TrackStop(mplayInfo, track);
|
||||||
|
i--;
|
||||||
|
track++;
|
||||||
}
|
}
|
||||||
|
|
||||||
mplayInfo->ident = ID_NUMBER;
|
mplayInfo->ident = ID_NUMBER;
|
||||||
@ -676,8 +704,10 @@ void FadeOutBody(struct MusicPlayerInfo *mplayInfo)
|
|||||||
|
|
||||||
if ((s16)(mplayInfo->fadeOV & mask) <= 0)
|
if ((s16)(mplayInfo->fadeOV & mask) <= 0)
|
||||||
{
|
{
|
||||||
|
i = mplayInfo->trackCount;
|
||||||
|
track = mplayInfo->tracks;
|
||||||
|
|
||||||
for (i = mplayInfo->trackCount, track = mplayInfo->tracks; i > 0; i--, track++)
|
while (i > 0)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
@ -689,6 +719,9 @@ void FadeOutBody(struct MusicPlayerInfo *mplayInfo)
|
|||||||
|
|
||||||
if (!val)
|
if (!val)
|
||||||
track->flags = 0;
|
track->flags = 0;
|
||||||
|
|
||||||
|
i--;
|
||||||
|
track++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mplayInfo->fadeOV & TEMPORARY_FADE)
|
if (mplayInfo->fadeOV & TEMPORARY_FADE)
|
||||||
@ -701,7 +734,10 @@ void FadeOutBody(struct MusicPlayerInfo *mplayInfo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = mplayInfo->trackCount, track = mplayInfo->tracks; i > 0; i--, track++)
|
i = mplayInfo->trackCount;
|
||||||
|
track = mplayInfo->tracks;
|
||||||
|
|
||||||
|
while (i > 0)
|
||||||
{
|
{
|
||||||
if (track->flags & MPT_FLG_EXIST)
|
if (track->flags & MPT_FLG_EXIST)
|
||||||
{
|
{
|
||||||
@ -710,6 +746,9 @@ void FadeOutBody(struct MusicPlayerInfo *mplayInfo)
|
|||||||
track->volX = (fadeOV >> FADE_VOL_SHIFT);
|
track->volX = (fadeOV >> FADE_VOL_SHIFT);
|
||||||
track->flags |= MPT_FLG_VOLCHG;
|
track->flags |= MPT_FLG_VOLCHG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i--;
|
||||||
|
track++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -717,7 +756,7 @@ void TrkVolPitSet(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *tr
|
|||||||
{
|
{
|
||||||
if (track->flags & MPT_FLG_VOLSET)
|
if (track->flags & MPT_FLG_VOLSET)
|
||||||
{
|
{
|
||||||
u32 x;
|
s32 x;
|
||||||
s32 y;
|
s32 y;
|
||||||
|
|
||||||
x = (u32)(track->vol * track->volX) >> 5;
|
x = (u32)(track->vol * track->volX) >> 5;
|
||||||
|
466
src/m4a_1.s
466
src/m4a_1.s
File diff suppressed because it is too large
Load Diff
@ -83,7 +83,7 @@ const u8 gScaleTable[] =
|
|||||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
|
||||||
};
|
};
|
||||||
|
|
||||||
const u32 gFreqTable[12] =
|
const u32 gFreqTable[] =
|
||||||
{
|
{
|
||||||
2147483648u,
|
2147483648u,
|
||||||
2275179671u,
|
2275179671u,
|
||||||
@ -99,7 +99,7 @@ const u32 gFreqTable[12] =
|
|||||||
4053909305u,
|
4053909305u,
|
||||||
};
|
};
|
||||||
|
|
||||||
const u16 gPcmSamplesPerVBlankTable[12] =
|
const u16 gPcmSamplesPerVBlankTable[] =
|
||||||
{
|
{
|
||||||
96,
|
96,
|
||||||
132,
|
132,
|
||||||
@ -130,7 +130,7 @@ const u8 gCgbScaleTable[] =
|
|||||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB,
|
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB,
|
||||||
};
|
};
|
||||||
|
|
||||||
const s16 gCgbFreqTable[12] =
|
const s16 gCgbFreqTable[] =
|
||||||
{
|
{
|
||||||
-2004,
|
-2004,
|
||||||
-1891,
|
-1891,
|
||||||
|
@ -525,7 +525,7 @@ static void CB2_WaitForPaletteExitOnKeyPress(void)
|
|||||||
|
|
||||||
static void CB2_ExitOnKeyPress(void)
|
static void CB2_ExitOnKeyPress(void)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
{
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
|
||||||
sMailRead->callback2 = CB2_ExitMailReadFreeVars;
|
sMailRead->callback2 = CB2_ExitMailReadFreeVars;
|
||||||
|
20
src/main.c
20
src/main.c
@ -81,6 +81,8 @@ void InitIntrHandlers(void);
|
|||||||
static void WaitForVBlank(void);
|
static void WaitForVBlank(void);
|
||||||
void EnableVCountIntrAtLine150(void);
|
void EnableVCountIntrAtLine150(void);
|
||||||
|
|
||||||
|
#define B_START_SELECT (B_BUTTON | START_BUTTON | SELECT_BUTTON)
|
||||||
|
|
||||||
void AgbMain()
|
void AgbMain()
|
||||||
{
|
{
|
||||||
#if MODERN
|
#if MODERN
|
||||||
@ -134,11 +136,9 @@ void AgbMain()
|
|||||||
{
|
{
|
||||||
ReadKeys();
|
ReadKeys();
|
||||||
|
|
||||||
if (!gSoftResetDisabled
|
if (gSoftResetDisabled == FALSE
|
||||||
&& JOY_HELD_RAW(A_BUTTON)
|
&& (gMain.heldKeysRaw & A_BUTTON)
|
||||||
&& JOY_HELD_RAW(B_BUTTON)
|
&& (gMain.heldKeysRaw & B_START_SELECT) == B_START_SELECT)
|
||||||
&& JOY_HELD_RAW(START_BUTTON)
|
|
||||||
&& JOY_HELD_RAW(SELECT_BUTTON)) //The reset key combo A + B + START + SELECT
|
|
||||||
{
|
{
|
||||||
rfu_REQ_stopMode();
|
rfu_REQ_stopMode();
|
||||||
rfu_waitREQComplete();
|
rfu_waitREQComplete();
|
||||||
@ -262,7 +262,9 @@ static void ReadKeys(void)
|
|||||||
|
|
||||||
if (keyInput != 0 && gMain.heldKeys == keyInput)
|
if (keyInput != 0 && gMain.heldKeys == keyInput)
|
||||||
{
|
{
|
||||||
if (--gMain.keyRepeatCounter == 0)
|
gMain.keyRepeatCounter--;
|
||||||
|
|
||||||
|
if (gMain.keyRepeatCounter == 0)
|
||||||
{
|
{
|
||||||
gMain.newAndRepeatedKeys = keyInput;
|
gMain.newAndRepeatedKeys = keyInput;
|
||||||
gMain.keyRepeatCounter = gKeyRepeatContinueDelay;
|
gMain.keyRepeatCounter = gKeyRepeatContinueDelay;
|
||||||
@ -280,10 +282,10 @@ static void ReadKeys(void)
|
|||||||
// Remap L to A if the L=A option is enabled.
|
// Remap L to A if the L=A option is enabled.
|
||||||
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
|
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(L_BUTTON))
|
if (gMain.newKeys & L_BUTTON)
|
||||||
gMain.newKeys |= A_BUTTON;
|
gMain.newKeys |= A_BUTTON;
|
||||||
|
|
||||||
if (JOY_HELD(L_BUTTON))
|
if (gMain.heldKeys & L_BUTTON)
|
||||||
gMain.heldKeys |= A_BUTTON;
|
gMain.heldKeys |= A_BUTTON;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +343,7 @@ static void VBlankIntr(void)
|
|||||||
{
|
{
|
||||||
if (gWirelessCommType != 0)
|
if (gWirelessCommType != 0)
|
||||||
RfuVSync();
|
RfuVSync();
|
||||||
else if (!gLinkVSyncDisabled)
|
else if (gLinkVSyncDisabled == FALSE)
|
||||||
LinkVSync();
|
LinkVSync();
|
||||||
|
|
||||||
gMain.vblankCounter1++;
|
gMain.vblankCounter1++;
|
||||||
|
@ -696,7 +696,7 @@ static void Task_MainMenuCheckSaveFile(u8 taskId)
|
|||||||
static void Task_WaitForSaveFileErrorWindow(u8 taskId)
|
static void Task_WaitForSaveFileErrorWindow(u8 taskId)
|
||||||
{
|
{
|
||||||
RunTextPrinters();
|
RunTextPrinters();
|
||||||
if (!IsTextPrinterActive(7) && (JOY_NEW(A_BUTTON)))
|
if (!IsTextPrinterActive(7) && (gMain.newKeys & A_BUTTON))
|
||||||
{
|
{
|
||||||
ClearWindowTilemap(7);
|
ClearWindowTilemap(7);
|
||||||
ClearMainMenuWindowTilemap(&sWindowTemplates_MainMenu[7]);
|
ClearMainMenuWindowTilemap(&sWindowTemplates_MainMenu[7]);
|
||||||
@ -731,7 +731,7 @@ static void Task_MainMenuCheckBattery(u8 taskId)
|
|||||||
static void Task_WaitForBatteryDryErrorWindow(u8 taskId)
|
static void Task_WaitForBatteryDryErrorWindow(u8 taskId)
|
||||||
{
|
{
|
||||||
RunTextPrinters();
|
RunTextPrinters();
|
||||||
if (!IsTextPrinterActive(7) && (JOY_NEW(A_BUTTON)))
|
if (!IsTextPrinterActive(7) && (gMain.newKeys & A_BUTTON))
|
||||||
{
|
{
|
||||||
ClearWindowTilemap(7);
|
ClearWindowTilemap(7);
|
||||||
ClearMainMenuWindowTilemap(&sWindowTemplates_MainMenu[7]);
|
ClearMainMenuWindowTilemap(&sWindowTemplates_MainMenu[7]);
|
||||||
@ -887,14 +887,14 @@ static bool8 HandleMainMenuInput(u8 taskId)
|
|||||||
{
|
{
|
||||||
s16* data = gTasks[taskId].data;
|
s16* data = gTasks[taskId].data;
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
IsWirelessAdapterConnected(); // why bother calling this here? debug? Task_HandleMainMenuAPressed will check too
|
IsWirelessAdapterConnected(); // why bother calling this here? debug? Task_HandleMainMenuAPressed will check too
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
|
||||||
gTasks[taskId].func = Task_HandleMainMenuAPressed;
|
gTasks[taskId].func = Task_HandleMainMenuAPressed;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_WHITEALPHA);
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_WHITEALPHA);
|
||||||
@ -902,7 +902,7 @@ static bool8 HandleMainMenuInput(u8 taskId)
|
|||||||
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, 160));
|
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, 160));
|
||||||
gTasks[taskId].func = Task_HandleMainMenuBPressed;
|
gTasks[taskId].func = Task_HandleMainMenuBPressed;
|
||||||
}
|
}
|
||||||
else if ((JOY_NEW(DPAD_UP)) && tCurrItem > 0)
|
else if ((gMain.newKeys & DPAD_UP) && tCurrItem > 0)
|
||||||
{
|
{
|
||||||
if (tMenuType == HAS_MYSTERY_EVENTS && tIsScrolled == TRUE && tCurrItem == 1)
|
if (tMenuType == HAS_MYSTERY_EVENTS && tIsScrolled == TRUE && tCurrItem == 1)
|
||||||
{
|
{
|
||||||
@ -914,7 +914,7 @@ static bool8 HandleMainMenuInput(u8 taskId)
|
|||||||
sCurrItemAndOptionMenuCheck = tCurrItem;
|
sCurrItemAndOptionMenuCheck = tCurrItem;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if ((JOY_NEW(DPAD_DOWN)) && tCurrItem < tItemCount - 1)
|
else if ((gMain.newKeys & DPAD_DOWN) && tCurrItem < tItemCount - 1)
|
||||||
{
|
{
|
||||||
if (tMenuType == HAS_MYSTERY_EVENTS && tCurrItem == 3 && tIsScrolled == FALSE)
|
if (tMenuType == HAS_MYSTERY_EVENTS && tCurrItem == 3 && tIsScrolled == FALSE)
|
||||||
{
|
{
|
||||||
@ -1151,7 +1151,7 @@ static void Task_DisplayMainMenuInvalidActionError(u8 taskId)
|
|||||||
gTasks[taskId].tCurrItem++;
|
gTasks[taskId].tCurrItem++;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
|
||||||
@ -1594,7 +1594,7 @@ static void Task_NewGameBirchSpeech_WaitForWhatsYourNameToPrint(u8 taskId)
|
|||||||
|
|
||||||
static void Task_NewGameBirchSpeech_WaitPressBeforeNameChoice(u8 taskId)
|
static void Task_NewGameBirchSpeech_WaitPressBeforeNameChoice(u8 taskId)
|
||||||
{
|
{
|
||||||
if ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON)))
|
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))
|
||||||
{
|
{
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
|
||||||
gTasks[taskId].func = Task_NewGameBirchSpeech_StartNamingScreen;
|
gTasks[taskId].func = Task_NewGameBirchSpeech_StartNamingScreen;
|
||||||
|
@ -1253,7 +1253,7 @@ static bool32 sub_81962D8(u8 taskId)
|
|||||||
static bool32 sub_8196330(u8 taskId)
|
static bool32 sub_8196330(u8 taskId)
|
||||||
{
|
{
|
||||||
s16 *taskData = gTasks[taskId].data;
|
s16 *taskData = gTasks[taskId].data;
|
||||||
if (!ExecuteMatchCallTextPrinter(taskData[2]) && !IsSEPlaying() && JOY_NEW(A_BUTTON | B_BUTTON))
|
if (!ExecuteMatchCallTextPrinter(taskData[2]) && !IsSEPlaying() && gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
{
|
||||||
FillWindowPixelBuffer(taskData[2], PIXEL_FILL(8));
|
FillWindowPixelBuffer(taskData[2], PIXEL_FILL(8));
|
||||||
CopyWindowToVram(taskData[2], 2);
|
CopyWindowToVram(taskData[2], 2);
|
||||||
@ -1335,7 +1335,7 @@ static void InitMatchCallTextPrinter(int windowId, const u8 *str)
|
|||||||
printerTemplate.currentY = 1;
|
printerTemplate.currentY = 1;
|
||||||
printerTemplate.letterSpacing = 0;
|
printerTemplate.letterSpacing = 0;
|
||||||
printerTemplate.lineSpacing = 0;
|
printerTemplate.lineSpacing = 0;
|
||||||
printerTemplate.style = 0;
|
printerTemplate.unk = 0;
|
||||||
printerTemplate.fgColor = 10;
|
printerTemplate.fgColor = 10;
|
||||||
printerTemplate.bgColor = 8;
|
printerTemplate.bgColor = 8;
|
||||||
printerTemplate.shadowColor = 14;
|
printerTemplate.shadowColor = 14;
|
||||||
@ -1346,7 +1346,7 @@ static void InitMatchCallTextPrinter(int windowId, const u8 *str)
|
|||||||
|
|
||||||
static bool32 ExecuteMatchCallTextPrinter(int windowId)
|
static bool32 ExecuteMatchCallTextPrinter(int windowId)
|
||||||
{
|
{
|
||||||
if (JOY_HELD(A_BUTTON))
|
if (gMain.heldKeys & A_BUTTON)
|
||||||
gTextFlags.canABSpeedUpPrint = 1;
|
gTextFlags.canABSpeedUpPrint = 1;
|
||||||
else
|
else
|
||||||
gTextFlags.canABSpeedUpPrint = 0;
|
gTextFlags.canABSpeedUpPrint = 0;
|
||||||
@ -1774,7 +1774,7 @@ static int GetNumOwnedBadges(void)
|
|||||||
static bool32 sub_8196D74(int matchCallId)
|
static bool32 sub_8196D74(int matchCallId)
|
||||||
{
|
{
|
||||||
int dayCount;
|
int dayCount;
|
||||||
u32 otId;
|
int otId;
|
||||||
u16 easyChatWord;
|
u16 easyChatWord;
|
||||||
int numRematchTrainersFought;
|
int numRematchTrainersFought;
|
||||||
int var0, var1, var2;
|
int var0, var1, var2;
|
||||||
|
100
src/menu.c
100
src/menu.c
@ -180,7 +180,7 @@ u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed
|
|||||||
printer.currentY = 1;
|
printer.currentY = 1;
|
||||||
printer.letterSpacing = 0;
|
printer.letterSpacing = 0;
|
||||||
printer.lineSpacing = 0;
|
printer.lineSpacing = 0;
|
||||||
printer.style = 0;
|
printer.unk = 0;
|
||||||
printer.fgColor = fgColor;
|
printer.fgColor = fgColor;
|
||||||
printer.bgColor = bgColor;
|
printer.bgColor = bgColor;
|
||||||
printer.shadowColor = shadowColor;
|
printer.shadowColor = shadowColor;
|
||||||
@ -981,23 +981,23 @@ u8 Menu_GetCursorPos(void)
|
|||||||
|
|
||||||
s8 Menu_ProcessInput(void)
|
s8 Menu_ProcessInput(void)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
if (!sMenu.APressMuted)
|
if (!sMenu.APressMuted)
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return sMenu.cursorPos;
|
return sMenu.cursorPos;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
return MENU_B_PRESSED;
|
return MENU_B_PRESSED;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_UP))
|
else if (gMain.newKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
Menu_MoveCursor(-1);
|
Menu_MoveCursor(-1);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_DOWN))
|
else if (gMain.newKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
Menu_MoveCursor(1);
|
Menu_MoveCursor(1);
|
||||||
@ -1011,23 +1011,23 @@ s8 Menu_ProcessInputNoWrap(void)
|
|||||||
{
|
{
|
||||||
u8 oldPos = sMenu.cursorPos;
|
u8 oldPos = sMenu.cursorPos;
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
if (!sMenu.APressMuted)
|
if (!sMenu.APressMuted)
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return sMenu.cursorPos;
|
return sMenu.cursorPos;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
return MENU_B_PRESSED;
|
return MENU_B_PRESSED;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_UP))
|
else if (gMain.newKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
if (oldPos != Menu_MoveCursorNoWrapAround(-1))
|
if (oldPos != Menu_MoveCursorNoWrapAround(-1))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_DOWN))
|
else if (gMain.newKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
if (oldPos != Menu_MoveCursorNoWrapAround(1))
|
if (oldPos != Menu_MoveCursorNoWrapAround(1))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
@ -1039,23 +1039,23 @@ s8 Menu_ProcessInputNoWrap(void)
|
|||||||
|
|
||||||
s8 ProcessMenuInput_other(void)
|
s8 ProcessMenuInput_other(void)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
if (!sMenu.APressMuted)
|
if (!sMenu.APressMuted)
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return sMenu.cursorPos;
|
return sMenu.cursorPos;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
return MENU_B_PRESSED;
|
return MENU_B_PRESSED;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_UP)
|
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
Menu_MoveCursor(-1);
|
Menu_MoveCursor(-1);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_DOWN)
|
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
Menu_MoveCursor(1);
|
Menu_MoveCursor(1);
|
||||||
@ -1069,23 +1069,23 @@ s8 Menu_ProcessInputNoWrapAround_other(void)
|
|||||||
{
|
{
|
||||||
u8 oldPos = sMenu.cursorPos;
|
u8 oldPos = sMenu.cursorPos;
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
if (!sMenu.APressMuted)
|
if (!sMenu.APressMuted)
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return sMenu.cursorPos;
|
return sMenu.cursorPos;
|
||||||
}
|
}
|
||||||
if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
return MENU_B_PRESSED;
|
return MENU_B_PRESSED;
|
||||||
}
|
}
|
||||||
if (JOY_REPEAT(DPAD_ANY) == DPAD_UP)
|
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
|
||||||
{
|
{
|
||||||
if (oldPos != Menu_MoveCursorNoWrapAround(-1))
|
if (oldPos != Menu_MoveCursorNoWrapAround(-1))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
if (JOY_REPEAT(DPAD_ANY) == DPAD_DOWN)
|
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN)
|
||||||
{
|
{
|
||||||
if (oldPos != Menu_MoveCursorNoWrapAround(1))
|
if (oldPos != Menu_MoveCursorNoWrapAround(1))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
@ -1130,7 +1130,7 @@ void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 l
|
|||||||
printer.fgColor = GetFontAttribute(fontId, FONTATTR_COLOR_FOREGROUND);
|
printer.fgColor = GetFontAttribute(fontId, FONTATTR_COLOR_FOREGROUND);
|
||||||
printer.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
|
printer.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
|
||||||
printer.shadowColor = GetFontAttribute(fontId, FONTATTR_COLOR_SHADOW);
|
printer.shadowColor = GetFontAttribute(fontId, FONTATTR_COLOR_SHADOW);
|
||||||
printer.style = GetFontAttribute(fontId, FONTATTR_STYLE);
|
printer.unk = GetFontAttribute(fontId, FONTATTR_UNKNOWN);
|
||||||
printer.letterSpacing = letterSpacing;
|
printer.letterSpacing = letterSpacing;
|
||||||
printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
|
printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
|
||||||
printer.x = left;
|
printer.x = left;
|
||||||
@ -1194,7 +1194,7 @@ void sub_8198AF8(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top
|
|||||||
printer.fgColor = GetFontAttribute(fontId, FONTATTR_COLOR_FOREGROUND);
|
printer.fgColor = GetFontAttribute(fontId, FONTATTR_COLOR_FOREGROUND);
|
||||||
printer.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
|
printer.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
|
||||||
printer.shadowColor = GetFontAttribute(fontId, FONTATTR_COLOR_SHADOW);
|
printer.shadowColor = GetFontAttribute(fontId, FONTATTR_COLOR_SHADOW);
|
||||||
printer.style = GetFontAttribute(fontId, FONTATTR_STYLE);
|
printer.unk = GetFontAttribute(fontId, FONTATTR_UNKNOWN);
|
||||||
printer.letterSpacing = GetFontAttribute(fontId, FONTATTR_LETTER_SPACING);
|
printer.letterSpacing = GetFontAttribute(fontId, FONTATTR_LETTER_SPACING);
|
||||||
printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
|
printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
|
||||||
|
|
||||||
@ -1252,7 +1252,7 @@ void sub_8198DBC(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 itemCount, u
|
|||||||
printer.fgColor = GetFontAttribute(fontId, FONTATTR_COLOR_FOREGROUND);
|
printer.fgColor = GetFontAttribute(fontId, FONTATTR_COLOR_FOREGROUND);
|
||||||
printer.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
|
printer.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
|
||||||
printer.shadowColor = GetFontAttribute(fontId, FONTATTR_COLOR_SHADOW);
|
printer.shadowColor = GetFontAttribute(fontId, FONTATTR_COLOR_SHADOW);
|
||||||
printer.style = GetFontAttribute(fontId, FONTATTR_STYLE);
|
printer.unk = GetFontAttribute(fontId, FONTATTR_UNKNOWN);
|
||||||
printer.letterSpacing = GetFontAttribute(fontId, FONTATTR_LETTER_SPACING);
|
printer.letterSpacing = GetFontAttribute(fontId, FONTATTR_LETTER_SPACING);
|
||||||
printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
|
printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
|
||||||
|
|
||||||
@ -1407,34 +1407,34 @@ u8 ChangeGridMenuCursorPosition(s8 deltaX, s8 deltaY)
|
|||||||
|
|
||||||
s8 sub_8199284(void)
|
s8 sub_8199284(void)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return sMenu.cursorPos;
|
return sMenu.cursorPos;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
return MENU_B_PRESSED;
|
return MENU_B_PRESSED;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_UP))
|
else if (gMain.newKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_UP);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_UP);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_DOWN))
|
else if (gMain.newKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_DOWN);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_DOWN);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_LEFT) || GetLRKeysPressed() == MENU_L_PRESSED)
|
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysPressed() == MENU_L_PRESSED)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_LEFT, MENU_CURSOR_DELTA_NONE);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_LEFT, MENU_CURSOR_DELTA_NONE);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
|
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysPressed() == MENU_R_PRESSED)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_RIGHT, MENU_CURSOR_DELTA_NONE);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_RIGHT, MENU_CURSOR_DELTA_NONE);
|
||||||
@ -1448,34 +1448,34 @@ s8 Menu_ProcessInputGridLayout(void)
|
|||||||
{
|
{
|
||||||
u8 oldPos = sMenu.cursorPos;
|
u8 oldPos = sMenu.cursorPos;
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return sMenu.cursorPos;
|
return sMenu.cursorPos;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
return MENU_B_PRESSED;
|
return MENU_B_PRESSED;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_UP))
|
else if (gMain.newKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
if (oldPos != ChangeGridMenuCursorPosition(0, -1))
|
if (oldPos != ChangeGridMenuCursorPosition(0, -1))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_DOWN))
|
else if (gMain.newKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
if (oldPos != ChangeGridMenuCursorPosition(0, 1))
|
if (oldPos != ChangeGridMenuCursorPosition(0, 1))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_LEFT) || GetLRKeysPressed() == MENU_L_PRESSED)
|
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysPressed() == MENU_L_PRESSED)
|
||||||
{
|
{
|
||||||
if (oldPos != ChangeGridMenuCursorPosition(-1, 0))
|
if (oldPos != ChangeGridMenuCursorPosition(-1, 0))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
|
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysPressed() == MENU_R_PRESSED)
|
||||||
{
|
{
|
||||||
if (oldPos != ChangeGridMenuCursorPosition(1, 0))
|
if (oldPos != ChangeGridMenuCursorPosition(1, 0))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
@ -1487,34 +1487,34 @@ s8 Menu_ProcessInputGridLayout(void)
|
|||||||
|
|
||||||
s8 sub_81993D8(void)
|
s8 sub_81993D8(void)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return sMenu.cursorPos;
|
return sMenu.cursorPos;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
return MENU_B_PRESSED;
|
return MENU_B_PRESSED;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_UP)
|
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_UP);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_UP);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_DOWN)
|
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_DOWN);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_DOWN);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
|
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_LEFT, MENU_CURSOR_DELTA_NONE);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_LEFT, MENU_CURSOR_DELTA_NONE);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
|
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_RIGHT, MENU_CURSOR_DELTA_NONE);
|
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_RIGHT, MENU_CURSOR_DELTA_NONE);
|
||||||
@ -1529,34 +1529,34 @@ s8 sub_8199484(void)
|
|||||||
{
|
{
|
||||||
u8 oldPos = sMenu.cursorPos;
|
u8 oldPos = sMenu.cursorPos;
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return sMenu.cursorPos;
|
return sMenu.cursorPos;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
return MENU_B_PRESSED;
|
return MENU_B_PRESSED;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_UP)
|
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
|
||||||
{
|
{
|
||||||
if (oldPos != ChangeGridMenuCursorPosition(0, -1))
|
if (oldPos != ChangeGridMenuCursorPosition(0, -1))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_DOWN)
|
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN)
|
||||||
{
|
{
|
||||||
if (oldPos != ChangeGridMenuCursorPosition(0, 1))
|
if (oldPos != ChangeGridMenuCursorPosition(0, 1))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
|
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
|
||||||
{
|
{
|
||||||
if (oldPos != ChangeGridMenuCursorPosition(-1, 0))
|
if (oldPos != ChangeGridMenuCursorPosition(-1, 0))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return MENU_NOTHING_CHOSEN;
|
return MENU_NOTHING_CHOSEN;
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
|
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
|
||||||
{
|
{
|
||||||
if (oldPos != ChangeGridMenuCursorPosition(1, 0))
|
if (oldPos != ChangeGridMenuCursorPosition(1, 0))
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
@ -1616,7 +1616,7 @@ void sub_81995E4(u8 windowId, u8 itemCount, const struct MenuAction *strs, const
|
|||||||
printer.fgColor = GetFontAttribute(1, FONTATTR_COLOR_FOREGROUND);
|
printer.fgColor = GetFontAttribute(1, FONTATTR_COLOR_FOREGROUND);
|
||||||
printer.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND);
|
printer.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND);
|
||||||
printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW);
|
printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW);
|
||||||
printer.style = GetFontAttribute(1, FONTATTR_STYLE);
|
printer.unk = GetFontAttribute(1, FONTATTR_UNKNOWN);
|
||||||
printer.letterSpacing = 0;
|
printer.letterSpacing = 0;
|
||||||
printer.lineSpacing = 0;
|
printer.lineSpacing = 0;
|
||||||
printer.x = 8;
|
printer.x = 8;
|
||||||
@ -1650,7 +1650,7 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa
|
|||||||
printer.fgColor = GetFontAttribute(1, FONTATTR_COLOR_FOREGROUND);
|
printer.fgColor = GetFontAttribute(1, FONTATTR_COLOR_FOREGROUND);
|
||||||
printer.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND);
|
printer.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND);
|
||||||
printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW);
|
printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW);
|
||||||
printer.style = GetFontAttribute(1, FONTATTR_STYLE);
|
printer.unk = GetFontAttribute(1, FONTATTR_UNKNOWN);
|
||||||
printer.letterSpacing = 0;
|
printer.letterSpacing = 0;
|
||||||
printer.lineSpacing = 0;
|
printer.lineSpacing = 0;
|
||||||
|
|
||||||
@ -1681,7 +1681,7 @@ void sub_819983C(u8 windowId, u8 a4, u8 itemCount, u8 itemCount2, const struct M
|
|||||||
printer.fgColor = GetFontAttribute(1, FONTATTR_COLOR_FOREGROUND);
|
printer.fgColor = GetFontAttribute(1, FONTATTR_COLOR_FOREGROUND);
|
||||||
printer.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND);
|
printer.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND);
|
||||||
printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW);
|
printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW);
|
||||||
printer.style = GetFontAttribute(1, FONTATTR_STYLE);
|
printer.unk = GetFontAttribute(1, FONTATTR_UNKNOWN);
|
||||||
printer.letterSpacing = 0;
|
printer.letterSpacing = 0;
|
||||||
printer.lineSpacing = 0;
|
printer.lineSpacing = 0;
|
||||||
|
|
||||||
@ -1949,7 +1949,7 @@ void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const
|
|||||||
printer.currentY = printer.y;
|
printer.currentY = printer.y;
|
||||||
printer.letterSpacing = GetFontAttribute(fontId, 2);
|
printer.letterSpacing = GetFontAttribute(fontId, 2);
|
||||||
printer.lineSpacing = GetFontAttribute(fontId, 3);
|
printer.lineSpacing = GetFontAttribute(fontId, 3);
|
||||||
printer.style = 0;
|
printer.unk = 0;
|
||||||
printer.fgColor = color[1];
|
printer.fgColor = color[1];
|
||||||
printer.bgColor = color[0];
|
printer.bgColor = color[0];
|
||||||
printer.shadowColor = color[2];
|
printer.shadowColor = color[2];
|
||||||
@ -1970,7 +1970,7 @@ void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 left, u8 top, u8 le
|
|||||||
printer.currentY = printer.y;
|
printer.currentY = printer.y;
|
||||||
printer.letterSpacing = letterSpacing;
|
printer.letterSpacing = letterSpacing;
|
||||||
printer.lineSpacing = lineSpacing;
|
printer.lineSpacing = lineSpacing;
|
||||||
printer.style = 0;
|
printer.unk = 0;
|
||||||
printer.fgColor = color[1];
|
printer.fgColor = color[1];
|
||||||
printer.bgColor = color[0];
|
printer.bgColor = color[0];
|
||||||
printer.shadowColor = color[2];
|
printer.shadowColor = color[2];
|
||||||
@ -1991,7 +1991,7 @@ void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left
|
|||||||
printer.currentY = top;
|
printer.currentY = top;
|
||||||
printer.letterSpacing = letterSpacing;
|
printer.letterSpacing = letterSpacing;
|
||||||
printer.lineSpacing = lineSpacing;
|
printer.lineSpacing = lineSpacing;
|
||||||
printer.style = 0;
|
printer.unk = 0;
|
||||||
|
|
||||||
printer.fgColor = GetFontAttribute(fontId, 5);
|
printer.fgColor = GetFontAttribute(fontId, 5);
|
||||||
printer.bgColor = GetFontAttribute(fontId, 6);
|
printer.bgColor = GetFontAttribute(fontId, 6);
|
||||||
|
@ -183,7 +183,7 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
|
|||||||
{
|
{
|
||||||
s16 valBefore = (*arg0);
|
s16 valBefore = (*arg0);
|
||||||
|
|
||||||
if (JOY_REPEAT(DPAD_ANY) == DPAD_UP)
|
if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
|
||||||
{
|
{
|
||||||
(*arg0)++;
|
(*arg0)++;
|
||||||
if ((*arg0) > arg1)
|
if ((*arg0) > arg1)
|
||||||
@ -199,7 +199,7 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_DOWN)
|
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN)
|
||||||
{
|
{
|
||||||
(*arg0)--;
|
(*arg0)--;
|
||||||
if ((*arg0) <= 0)
|
if ((*arg0) <= 0)
|
||||||
@ -215,7 +215,7 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_RIGHT)
|
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT)
|
||||||
{
|
{
|
||||||
(*arg0) += 10;
|
(*arg0) += 10;
|
||||||
if ((*arg0) > arg1)
|
if ((*arg0) > arg1)
|
||||||
@ -231,7 +231,7 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_LEFT)
|
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT)
|
||||||
{
|
{
|
||||||
(*arg0) -= 10;
|
(*arg0) -= 10;
|
||||||
if ((*arg0) <= 0)
|
if ((*arg0) <= 0)
|
||||||
@ -255,9 +255,9 @@ u8 GetLRKeysPressed(void)
|
|||||||
{
|
{
|
||||||
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)
|
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)
|
||||||
{
|
{
|
||||||
if (JOY_NEW(L_BUTTON))
|
if (gMain.newKeys & L_BUTTON)
|
||||||
return MENU_L_PRESSED;
|
return MENU_L_PRESSED;
|
||||||
if (JOY_NEW(R_BUTTON))
|
if (gMain.newKeys & R_BUTTON)
|
||||||
return MENU_R_PRESSED;
|
return MENU_R_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,9 +268,9 @@ u8 GetLRKeysPressedAndHeld(void)
|
|||||||
{
|
{
|
||||||
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)
|
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)
|
||||||
{
|
{
|
||||||
if (JOY_REPEAT(L_BUTTON))
|
if (gMain.newAndRepeatedKeys & L_BUTTON)
|
||||||
return MENU_L_PRESSED;
|
return MENU_L_PRESSED;
|
||||||
if (JOY_REPEAT(R_BUTTON))
|
if (gMain.newAndRepeatedKeys & R_BUTTON)
|
||||||
return MENU_R_PRESSED;
|
return MENU_R_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ void sub_81D1D04(u8 a0)
|
|||||||
sUnknown_0203CF48[a0] = 0xFF;
|
sUnknown_0203CF48[a0] = 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 sub_81D1D34(u8 a0) // unused
|
static u8 sub_81D1D34(u8 a0)
|
||||||
{
|
{
|
||||||
return sUnknown_0203CF48[a0];
|
return sUnknown_0203CF48[a0];
|
||||||
}
|
}
|
||||||
@ -894,6 +894,8 @@ static u8 *GetConditionMenuMonString(u8 *dst, u16 boxId, u16 monId)
|
|||||||
{
|
{
|
||||||
return StringCopyPadded(dst, gText_EggNickname, 0, 12);
|
return StringCopyPadded(dst, gText_EggNickname, 0, 12);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
GetBoxOrPartyMonData(boxId, monId, MON_DATA_NICKNAME, dst);
|
GetBoxOrPartyMonData(boxId, monId, MON_DATA_NICKNAME, dst);
|
||||||
StringGetEnd10(dst);
|
StringGetEnd10(dst);
|
||||||
species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES, NULL);
|
species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES, NULL);
|
||||||
@ -905,8 +907,8 @@ static u8 *GetConditionMenuMonString(u8 *dst, u16 boxId, u16 monId)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Needed to match, feel free to remove.
|
// Needed to match, feel free to remove.
|
||||||
boxId++, boxId--;
|
boxId++;boxId--;
|
||||||
monId++, monId--;
|
monId++;monId--;
|
||||||
|
|
||||||
boxMon = GetBoxedMonPtr(boxId, monId);
|
boxMon = GetBoxedMonPtr(boxId, monId);
|
||||||
gender = GetBoxMonGender(boxMon);
|
gender = GetBoxMonGender(boxMon);
|
||||||
@ -962,6 +964,7 @@ static u8 *GetConditionMenuMonString(u8 *dst, u16 boxId, u16 monId)
|
|||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Buffers the string in src to dest up to n chars. If src is less than n chars, fill with spaces
|
// Buffers the string in src to dest up to n chars. If src is less than n chars, fill with spaces
|
||||||
static u8 *BufferConditionMenuSpacedStringN(u8 *dst, const u8 *src, s16 n)
|
static u8 *BufferConditionMenuSpacedStringN(u8 *dst, const u8 *src, s16 n)
|
||||||
|
@ -168,7 +168,7 @@ const struct PulseBlendSettings gMirageTowerPulseBlendSettings = {
|
|||||||
.numColors = 15,
|
.numColors = 15,
|
||||||
.delay = 5,
|
.delay = 5,
|
||||||
.numFadeCycles = -1,
|
.numFadeCycles = -1,
|
||||||
.maxBlendCoeff = -5,
|
.maxBlendCoeff = 11,
|
||||||
.fadeType = 1,
|
.fadeType = 1,
|
||||||
.restorePaletteOnUnload = FALSE,
|
.restorePaletteOnUnload = FALSE,
|
||||||
.unk7_7 = 1,
|
.unk7_7 = 1,
|
||||||
@ -412,9 +412,10 @@ void DoMirageTowerCeilingCrumble(void)
|
|||||||
|
|
||||||
static void WaitCeilingCrumble(u8 taskId)
|
static void WaitCeilingCrumble(u8 taskId)
|
||||||
{
|
{
|
||||||
u16 *data = (u16 *)gTasks[taskId].data;
|
u16 *data = gTasks[taskId].data;
|
||||||
|
data[1]++;
|
||||||
// Either wait 1000 frames, or until all 16 crumble sprites and the one screen-shake task are completed.
|
// Either wait 1000 frames, or until all 16 crumble sprites and the one screen-shake task are completed.
|
||||||
if (++data[1] == 1000 || data[0] == 17)
|
if (data[1] == 1000 || data[0] == 17)
|
||||||
gTasks[taskId].func = FinishCeilingCrumbleTask;
|
gTasks[taskId].func = FinishCeilingCrumbleTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -690,7 +691,7 @@ static void DoFossilFallAndSink(u8 taskId)
|
|||||||
if (gSprites[sUnknown_0203CF0C->spriteId].callback != SpriteCallbackDummy)
|
if (gSprites[sUnknown_0203CF0C->spriteId].callback != SpriteCallbackDummy)
|
||||||
return;
|
return;
|
||||||
DestroySprite(&gSprites[sUnknown_0203CF0C->spriteId]);
|
DestroySprite(&gSprites[sUnknown_0203CF0C->spriteId]);
|
||||||
FREE_AND_SET_NULL(sUnknown_0203CF0C->unkC);
|
FREE_AND_SET_NULL(sUnknown_0203CF0C->unkC);;
|
||||||
FREE_AND_SET_NULL(sUnknown_0203CF0C->frameImage);
|
FREE_AND_SET_NULL(sUnknown_0203CF0C->frameImage);
|
||||||
FREE_AND_SET_NULL(sUnknown_0203CF0C->frameImageTiles);
|
FREE_AND_SET_NULL(sUnknown_0203CF0C->frameImageTiles);
|
||||||
FREE_AND_SET_NULL(sUnknown_0203CF0C);
|
FREE_AND_SET_NULL(sUnknown_0203CF0C);
|
||||||
@ -723,40 +724,144 @@ static void sub_81BF248(struct Sprite *sprite)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NONMATCHING
|
||||||
static void sub_81BF2B8(u8* a, u16 b, u8 c, u8 d, u8 e)
|
static void sub_81BF2B8(u8* a, u16 b, u8 c, u8 d, u8 e)
|
||||||
{
|
{
|
||||||
u16 var, var2;
|
u8 r5, r4, r0, r2;
|
||||||
u8 r0, r5, r4, r2;
|
u16 var;
|
||||||
u8 r2_1, r4_1;
|
|
||||||
u8 b2, c2;
|
|
||||||
|
|
||||||
r4 = b / d;
|
r4 = r5 = b / d;
|
||||||
gUnknown_030012A8[0] = r4;
|
gUnknown_030012A8[0] = r4;
|
||||||
|
|
||||||
r2 = b % d;
|
r0 = r2 = b % d;
|
||||||
gUnknown_030012A8[1] = r2;
|
gUnknown_030012A8[1] = r2;
|
||||||
|
|
||||||
r4_1 = r4 & 7;
|
r4 &= 7;
|
||||||
r2_1 = r2 & 7;
|
r2 &= 7;
|
||||||
|
gUnknown_030012A8[2] = r4;
|
||||||
|
gUnknown_030012A8[3] = r2;
|
||||||
|
|
||||||
gUnknown_030012A8[2] = r4 & 7; //should be r4_1 but that doesn't match
|
r0 /= 8;
|
||||||
gUnknown_030012A8[3] = r2 & 7; //should be r2_1 but that doesn't match
|
r5 /= 8;
|
||||||
|
gUnknown_030012A8[4] = r0;
|
||||||
r0 = r2 / 8;
|
gUnknown_030012A8[5] = r5;
|
||||||
r5 = r4 / 8;
|
|
||||||
|
|
||||||
gUnknown_030012A8[4] = r2 / 8; //should just be r0, but that doesn't match
|
|
||||||
gUnknown_030012A8[5] = r4 / 8; //should be just r5 but that doesn't match
|
|
||||||
|
|
||||||
var = (d / 8) * (r5 * 64) + (r0 * 64);
|
|
||||||
|
|
||||||
|
var = ((d / 8) * (r5 * 64)) + (r0 * 64);
|
||||||
gUnknown_030012A8[6] = var;
|
gUnknown_030012A8[6] = var;
|
||||||
|
|
||||||
var2 = var + ((r4_1 * 8) + r2_1);
|
var += (r4 * 8) + r2;
|
||||||
var2 /= 2;
|
gUnknown_030012A8[7] = var;
|
||||||
gUnknown_030012A8[7] = var + ((r4_1 * 8) + r2_1); // should be var2 with var2 being divided by 2 AFTER this assignment, but that doesn't match.
|
|
||||||
|
|
||||||
b2 = ((b % 2) ^ 1);
|
// This part is non-matching. 99% sure it IS functionally equivalent, though.
|
||||||
c2 = (c << (b2 << 2)) | (15 << (((b2 ^ 1) << 2)));
|
b = (b & 1) ^ 1;
|
||||||
a[var2 + (e * 32)] &= c2;
|
c = (c << ((b) << 2)) | (15 << ((b ^ 1) << 2));
|
||||||
|
|
||||||
|
a[(var / 2) + (e * 32)] &= c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
static void sub_81BF2B8(u8* a, u16 b, u8 c, u8 d, u8 e)
|
||||||
|
{
|
||||||
|
asm_unified(
|
||||||
|
"push {r4-r7,lr}\n\
|
||||||
|
mov r7, r10\n\
|
||||||
|
mov r6, r9\n\
|
||||||
|
mov r5, r8\n\
|
||||||
|
push {r5-r7}\n\
|
||||||
|
sub sp, 0x8\n\
|
||||||
|
str r0, [sp]\n\
|
||||||
|
mov r10, r1\n\
|
||||||
|
adds r6, r2, 0\n\
|
||||||
|
mov r8, r3\n\
|
||||||
|
ldr r0, [sp, 0x28]\n\
|
||||||
|
mov r9, r0\n\
|
||||||
|
lsls r1, 16\n\
|
||||||
|
lsrs r1, 16\n\
|
||||||
|
mov r10, r1\n\
|
||||||
|
lsls r6, 24\n\
|
||||||
|
lsrs r6, 24\n\
|
||||||
|
mov r0, r8\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
mov r8, r0\n\
|
||||||
|
lsrs r7, r0, 24\n\
|
||||||
|
mov r1, r9\n\
|
||||||
|
lsls r1, 24\n\
|
||||||
|
lsrs r1, 24\n\
|
||||||
|
mov r9, r1\n\
|
||||||
|
mov r0, r10\n\
|
||||||
|
adds r1, r7, 0\n\
|
||||||
|
bl __divsi3\n\
|
||||||
|
adds r5, r0, 0\n\
|
||||||
|
lsls r5, 24\n\
|
||||||
|
lsrs r4, r5, 24\n\
|
||||||
|
ldr r3, =gUnknown_030012A8\n\
|
||||||
|
strh r4, [r3]\n\
|
||||||
|
mov r0, r10\n\
|
||||||
|
adds r1, r7, 0\n\
|
||||||
|
str r3, [sp, 0x4]\n\
|
||||||
|
bl __modsi3\n\
|
||||||
|
lsls r0, 24\n\
|
||||||
|
lsrs r2, r0, 24\n\
|
||||||
|
ldr r3, [sp, 0x4]\n\
|
||||||
|
strh r2, [r3, 0x2]\n\
|
||||||
|
movs r1, 0x7\n\
|
||||||
|
ands r4, r1\n\
|
||||||
|
ands r2, r1\n\
|
||||||
|
strh r4, [r3, 0x4]\n\
|
||||||
|
strh r2, [r3, 0x6]\n\
|
||||||
|
lsrs r0, 27\n\
|
||||||
|
lsrs r5, 27\n\
|
||||||
|
strh r0, [r3, 0x8]\n\
|
||||||
|
strh r5, [r3, 0xA]\n\
|
||||||
|
mov r1, r8\n\
|
||||||
|
lsrs r1, 27\n\
|
||||||
|
lsls r1, 6\n\
|
||||||
|
mov r8, r1\n\
|
||||||
|
mov r1, r8\n\
|
||||||
|
muls r1, r5\n\
|
||||||
|
lsls r0, 6\n\
|
||||||
|
adds r1, r0\n\
|
||||||
|
lsls r1, 16\n\
|
||||||
|
lsrs r1, 16\n\
|
||||||
|
strh r1, [r3, 0xC]\n\
|
||||||
|
lsls r4, 3\n\
|
||||||
|
adds r4, r2\n\
|
||||||
|
adds r1, r4\n\
|
||||||
|
lsls r4, r1, 16\n\
|
||||||
|
lsrs r4, 17\n\
|
||||||
|
strh r1, [r3, 0xE]\n\
|
||||||
|
movs r1, 0x1\n\
|
||||||
|
mov r0, r10\n\
|
||||||
|
ands r1, r0\n\
|
||||||
|
movs r2, 0x1\n\
|
||||||
|
eors r1, r2\n\
|
||||||
|
lsls r0, r1, 2\n\
|
||||||
|
lsls r6, r0\n\
|
||||||
|
eors r1, r2\n\
|
||||||
|
lsls r1, 2\n\
|
||||||
|
movs r0, 0xF\n\
|
||||||
|
lsls r0, r1\n\
|
||||||
|
orrs r6, r0\n\
|
||||||
|
lsls r6, 24\n\
|
||||||
|
lsrs r6, 24\n\
|
||||||
|
mov r1, r9\n\
|
||||||
|
lsls r1, 5\n\
|
||||||
|
mov r9, r1\n\
|
||||||
|
add r9, r4\n\
|
||||||
|
ldr r1, [sp]\n\
|
||||||
|
add r1, r9\n\
|
||||||
|
ldrb r0, [r1]\n\
|
||||||
|
ands r6, r0\n\
|
||||||
|
strb r6, [r1]\n\
|
||||||
|
add sp, 0x8\n\
|
||||||
|
pop {r3-r5}\n\
|
||||||
|
mov r8, r3\n\
|
||||||
|
mov r9, r4\n\
|
||||||
|
mov r10, r5\n\
|
||||||
|
pop {r4-r7}\n\
|
||||||
|
pop {r0}\n\
|
||||||
|
bx r0\n\
|
||||||
|
.pool");
|
||||||
|
}
|
||||||
|
#endif // NONMATCHING
|
||||||
|
@ -394,7 +394,7 @@ bool8 sub_811FBA4(void)
|
|||||||
{
|
{
|
||||||
u16 i;
|
u16 i;
|
||||||
|
|
||||||
if (JOY_NEW(DPAD_UP))
|
if (gMain.newKeys & DPAD_UP)
|
||||||
{
|
{
|
||||||
s8 pos;
|
s8 pos;
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
@ -404,7 +404,7 @@ bool8 sub_811FBA4(void)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JOY_NEW(DPAD_DOWN))
|
if (gMain.newKeys & DPAD_DOWN)
|
||||||
{
|
{
|
||||||
s8 pos;
|
s8 pos;
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
@ -414,7 +414,7 @@ bool8 sub_811FBA4(void)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (gMain.newKeys & A_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
|
|
||||||
@ -433,7 +433,7 @@ bool8 sub_811FBA4(void)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (gMain.newKeys & B_BUTTON)
|
||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user