mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 19:54:21 +01:00
Merge pull request #1189 from aaaaaa123456789/reverts
Undo PokeCodec's PRs and port changes
This commit is contained in:
commit
99dd461bef
2
Makefile
2
Makefile
@ -69,7 +69,7 @@ OBJ_DIR := build/emerald
|
||||
LIBPATH := -L ../../tools/agbcc/lib
|
||||
else
|
||||
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
|
||||
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))"
|
||||
|
@ -109,7 +109,7 @@ _1a0:
|
||||
strh r1, [r0, 0xa] @ SIOMLT_SEND
|
||||
ldr r0, =_data_2f0
|
||||
ldr r1, =gCode
|
||||
svc 0x11 << 16
|
||||
swi 0x11 << 16
|
||||
ldr lr, =gCode
|
||||
bx lr
|
||||
.pool
|
||||
|
@ -100,12 +100,12 @@ struct CgbChannel
|
||||
u8 le;
|
||||
u8 sw;
|
||||
u32 fr;
|
||||
u32 *wp;
|
||||
u32 *cp;
|
||||
void *tp;
|
||||
void *pp;
|
||||
void *np;
|
||||
u32 d4[2];
|
||||
u32 wp;
|
||||
u32 cp;
|
||||
u32 tp;
|
||||
u32 pp;
|
||||
u32 np;
|
||||
u8 d4[8];
|
||||
};
|
||||
|
||||
struct MusicPlayerTrack;
|
||||
@ -138,10 +138,10 @@ struct SoundChannel
|
||||
u32 fw;
|
||||
u32 freq;
|
||||
struct WaveData *wav;
|
||||
s8 *cp;
|
||||
u32 cp;
|
||||
struct MusicPlayerTrack *track;
|
||||
void *pp;
|
||||
void *np;
|
||||
u32 pp;
|
||||
u32 np;
|
||||
u32 d4;
|
||||
u16 xpi;
|
||||
u16 xpc;
|
||||
@ -172,11 +172,11 @@ struct SoundInfo
|
||||
u8 pcmDmaPeriod; // number of V-blanks per PCM DMA
|
||||
u8 maxLines;
|
||||
u8 gap[3];
|
||||
u32 pcmSamplesPerVBlank;
|
||||
u32 pcmFreq;
|
||||
u32 divFreq;
|
||||
s32 pcmSamplesPerVBlank;
|
||||
s32 pcmFreq;
|
||||
s32 divFreq;
|
||||
struct CgbChannel *cgbChans;
|
||||
void (*func)();
|
||||
u32 func;
|
||||
u32 intp;
|
||||
void (*CgbSound)(void);
|
||||
void (*CgbOscOff)(u8);
|
||||
@ -184,7 +184,7 @@ struct SoundInfo
|
||||
u32 MPlayJumpTable;
|
||||
u32 plynote;
|
||||
u32 ExtVolPit;
|
||||
u32 gap2[4];
|
||||
u8 gap2[16];
|
||||
struct SoundChannel chans[MAX_DIRECTSOUND_CHANNELS];
|
||||
s8 pcmBuffer[PCM_DMA_BUF_SIZE * 2];
|
||||
};
|
||||
@ -248,7 +248,7 @@ struct MusicPlayerTrack
|
||||
u8 key;
|
||||
u8 velocity;
|
||||
u8 runningStatus;
|
||||
s8 keyM;
|
||||
u8 keyM;
|
||||
u8 pitM;
|
||||
s8 keyShift;
|
||||
s8 keyShiftX;
|
||||
@ -312,7 +312,7 @@ struct MusicPlayerInfo
|
||||
struct MusicPlayerTrack *tracks;
|
||||
struct ToneData *tone;
|
||||
u32 ident;
|
||||
void (*func)();
|
||||
u32 func;
|
||||
u32 intp;
|
||||
};
|
||||
|
||||
@ -447,7 +447,7 @@ void ply_tune(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_port(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_xcmd(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
|
||||
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)
|
||||
{
|
||||
if (ProgramFlashSectorAndVerify(sectorNum, data)) // is damaged?
|
||||
if (ProgramFlashSectorAndVerify(sectorNum, data) != 0) // is damaged?
|
||||
{
|
||||
SetSectorDamagedStatus(SECTOR_DAMAGED, sectorNum); // set damaged sector bits.
|
||||
return SAVE_STATUS_ERROR;
|
||||
|
@ -26,9 +26,9 @@
|
||||
|
||||
.set OAM, 0x7000000
|
||||
|
||||
.set SOUND_INFO_PTR, IWRAM_END - 0x10
|
||||
.set INTR_CHECK, IWRAM_END - 0x8
|
||||
.set INTR_VECTOR, IWRAM_END - 0x4
|
||||
.set SOUND_INFO_PTR, 0x3007FF0
|
||||
.set INTR_CHECK, 0x3007FF8
|
||||
.set INTR_VECTOR, 0x3007FFC
|
||||
|
||||
.set INTR_FLAG_VBLANK, 1 << 0
|
||||
.set INTR_FLAG_HBLANK, 1 << 1
|
||||
|
38
gflib/bg.c
38
gflib/bg.c
@ -34,8 +34,8 @@ struct BgConfig2
|
||||
u32 unk_3:18;
|
||||
|
||||
void* tilemap;
|
||||
s32 bg_x; // Maybe unsigned, but game treats it as if it is signed a LOT.
|
||||
s32 bg_y; // Same for this variable.
|
||||
s32 bg_x;
|
||||
s32 bg_y;
|
||||
};
|
||||
|
||||
static struct BgControl sGpuBgConfigs;
|
||||
@ -621,15 +621,17 @@ s32 GetBgX(u8 bg)
|
||||
{
|
||||
if (IsInvalidBg32(bg))
|
||||
return -1;
|
||||
if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
else if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
return -1;
|
||||
else
|
||||
return sGpuBgConfigs2[bg].bg_x;
|
||||
}
|
||||
|
||||
s32 ChangeBgY(u8 bg, s32 value, u8 op)
|
||||
{
|
||||
u8 mode;
|
||||
u16 temp1, temp2;
|
||||
u16 temp1;
|
||||
u16 temp2;
|
||||
|
||||
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)
|
||||
{
|
||||
u8 mode;
|
||||
u16 temp1, temp2;
|
||||
u16 temp1;
|
||||
u16 temp2;
|
||||
|
||||
if (IsInvalidBg32(bg) || !GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
{
|
||||
@ -769,8 +772,9 @@ s32 GetBgY(u8 bg)
|
||||
{
|
||||
if (IsInvalidBg32(bg))
|
||||
return -1;
|
||||
if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
else if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
return -1;
|
||||
else
|
||||
return sGpuBgConfigs2[bg].bg_y;
|
||||
}
|
||||
|
||||
@ -870,28 +874,29 @@ void* GetBgTilemapBuffer(u8 bg)
|
||||
{
|
||||
if (IsInvalidBg32(bg))
|
||||
return NULL;
|
||||
if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
else if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
return NULL;
|
||||
else
|
||||
return sGpuBgConfigs2[bg].tilemap;
|
||||
}
|
||||
|
||||
void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset)
|
||||
{
|
||||
if (IsInvalidBg32(bg) || IsTileMapOutsideWram(bg))
|
||||
return;
|
||||
if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg))
|
||||
{
|
||||
if (mode != 0)
|
||||
CpuCopy16(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)), mode);
|
||||
else
|
||||
LZ77UnCompWram(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)));
|
||||
}
|
||||
}
|
||||
|
||||
void CopyBgTilemapBufferToVram(u8 bg)
|
||||
{
|
||||
u16 sizeToLoad;
|
||||
|
||||
if (IsInvalidBg32(bg) || IsTileMapOutsideWram(bg))
|
||||
return;
|
||||
|
||||
if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg))
|
||||
{
|
||||
switch (GetBgType(bg))
|
||||
{
|
||||
case 0:
|
||||
@ -906,14 +911,16 @@ void CopyBgTilemapBufferToVram(u8 bg)
|
||||
}
|
||||
LoadBgVram(bg, sGpuBgConfigs2[bg].tilemap, sizeToLoad, 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void CopyToBgTilemapBufferRect(u8 bg, const void* src, u8 destX, u8 destY, u8 width, u8 height)
|
||||
{
|
||||
u16 destX16, destY16;
|
||||
u16 destX16;
|
||||
u16 destY16;
|
||||
u16 mode;
|
||||
|
||||
if (IsInvalidBg32(bg) || IsTileMapOutsideWram(bg))
|
||||
return;
|
||||
if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg))
|
||||
{
|
||||
switch (GetBgType(bg))
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
68
gflib/text.c
68
gflib/text.c
@ -21,7 +21,7 @@ static u16 gLastTextFgColor;
|
||||
static u16 gLastTextShadowColor;
|
||||
|
||||
const struct FontInfo *gFonts;
|
||||
bool8 gUnknown_03002F84;
|
||||
u8 gUnknown_03002F84;
|
||||
struct Struct_03002F90 gUnknown_03002F90;
|
||||
TextFlags gTextFlags;
|
||||
|
||||
@ -154,7 +154,7 @@ u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8
|
||||
printerTemplate.currentY = y;
|
||||
printerTemplate.letterSpacing = gFonts[fontId].letterSpacing;
|
||||
printerTemplate.lineSpacing = gFonts[fontId].lineSpacing;
|
||||
printerTemplate.style = gFonts[fontId].style;
|
||||
printerTemplate.unk = gFonts[fontId].unk;
|
||||
printerTemplate.fgColor = gFonts[fontId].fgColor;
|
||||
printerTemplate.bgColor = gFonts[fontId].bgColor;
|
||||
printerTemplate.shadowColor = gFonts[fontId].shadowColor;
|
||||
@ -205,7 +205,7 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi
|
||||
CopyWindowToVram(gTempTextPrinter.printerTemplate.windowId, 2);
|
||||
gTextPrinters[printerTemplate->windowId].active = 0;
|
||||
}
|
||||
gUnknown_03002F84 = FALSE;
|
||||
gUnknown_03002F84 = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ void RunTextPrinters(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!gUnknown_03002F84)
|
||||
if (gUnknown_03002F84 == 0)
|
||||
{
|
||||
for (i = 0; i < NUM_TEXT_PRINTERS; ++i)
|
||||
{
|
||||
@ -451,18 +451,18 @@ u8 GetLastTextColor(u8 colorType)
|
||||
{
|
||||
switch (colorType)
|
||||
{
|
||||
case COLOR_FOREGROUND:
|
||||
case 0:
|
||||
return gLastTextFgColor;
|
||||
case COLOR_BACKGROUND:
|
||||
case 2:
|
||||
return gLastTextBgColor;
|
||||
case COLOR_SHADOW:
|
||||
case 1:
|
||||
return gLastTextShadowColor;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline static void GLYPH_COPY(u8 *windowTiles, u32 widthOffset, u32 j, u32 i, u32 *ptr, s32 width, s32 height) //
|
||||
inline static void GLYPH_COPY(u8 *windowTiles, u32 widthOffset, u32 j, u32 i, u32 *ptr, s32 width, s32 height)
|
||||
{
|
||||
u32 xAdd, yAdd, r5, bits, toOrr, dummyX;
|
||||
u8 *dst;
|
||||
@ -570,7 +570,7 @@ u16 Font0Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (!subStruct->hasGlyphIdBeenSet)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
subStruct->glyphId = 0;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
@ -582,7 +582,7 @@ u16 Font1Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (!subStruct->hasGlyphIdBeenSet)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
subStruct->glyphId = 1;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
@ -594,7 +594,7 @@ u16 Font2Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (!subStruct->hasGlyphIdBeenSet)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
subStruct->glyphId = 2;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
@ -606,7 +606,7 @@ u16 Font3Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (!subStruct->hasGlyphIdBeenSet)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
subStruct->glyphId = 3;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
@ -618,7 +618,7 @@ u16 Font4Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (!subStruct->hasGlyphIdBeenSet)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
subStruct->glyphId = 4;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
@ -630,7 +630,7 @@ u16 Font5Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (!subStruct->hasGlyphIdBeenSet)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
subStruct->glyphId = 5;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
@ -642,7 +642,7 @@ u16 Font7Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (!subStruct->hasGlyphIdBeenSet)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
subStruct->glyphId = 7;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
@ -654,7 +654,7 @@ u16 Font8Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (!subStruct->hasGlyphIdBeenSet)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
subStruct->glyphId = 8;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
@ -666,7 +666,7 @@ void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
|
||||
if (gTextFlags.autoScroll == TRUE)
|
||||
if (gTextFlags.autoScroll == 1)
|
||||
{
|
||||
subStruct->autoScrollDelay = 0;
|
||||
}
|
||||
@ -682,7 +682,7 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter)
|
||||
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
|
||||
const u8 *arrowTiles;
|
||||
|
||||
if (!gTextFlags.autoScroll)
|
||||
if (gTextFlags.autoScroll == 0)
|
||||
{
|
||||
if (subStruct->downArrowDelay != 0)
|
||||
{
|
||||
@ -758,7 +758,7 @@ bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter)
|
||||
bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter)
|
||||
{
|
||||
bool8 result = FALSE;
|
||||
if (gTextFlags.autoScroll)
|
||||
if (gTextFlags.autoScroll != 0)
|
||||
{
|
||||
result = TextPrinterWaitAutoMode(textPrinter);
|
||||
}
|
||||
@ -777,15 +777,18 @@ bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter)
|
||||
bool16 TextPrinterWait(struct TextPrinter *textPrinter)
|
||||
{
|
||||
bool16 result = FALSE;
|
||||
if (gTextFlags.autoScroll)
|
||||
if (gTextFlags.autoScroll != 0)
|
||||
{
|
||||
result = TextPrinterWaitAutoMode(textPrinter);
|
||||
}
|
||||
else if (JOY_NEW(A_BUTTON | B_BUTTON))
|
||||
else
|
||||
{
|
||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
||||
{
|
||||
result = TRUE;
|
||||
PlaySE(SE_SELECT);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -800,7 +803,7 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c
|
||||
else
|
||||
{
|
||||
FillWindowPixelRect(windowId, (bgColor << 4) | bgColor, x, y, 0x8, 0x10);
|
||||
if (!drawArrow)
|
||||
if (drawArrow == 0)
|
||||
{
|
||||
switch (gTextFlags.useAlternateDownArrow)
|
||||
{
|
||||
@ -992,10 +995,10 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
||||
textPrinter->minLetterSpacing = *textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_JPN:
|
||||
textPrinter->japanese = TRUE;
|
||||
textPrinter->japanese = 1;
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_ENG:
|
||||
textPrinter->japanese = FALSE;
|
||||
textPrinter->japanese = 0;
|
||||
return 2;
|
||||
}
|
||||
break;
|
||||
@ -1056,10 +1059,13 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
||||
textPrinter->printerTemplate.currentX += width;
|
||||
}
|
||||
}
|
||||
else if (textPrinter->japanese)
|
||||
else
|
||||
{
|
||||
if (textPrinter->japanese)
|
||||
textPrinter->printerTemplate.currentX += (gUnknown_03002F90.width + textPrinter->printerTemplate.letterSpacing);
|
||||
else
|
||||
textPrinter->printerTemplate.currentX += gUnknown_03002F90.width;
|
||||
}
|
||||
return 0;
|
||||
case 1:
|
||||
if (TextPrinterWait(textPrinter))
|
||||
@ -1545,7 +1551,7 @@ void SetDefaultFontsPointer(void)
|
||||
|
||||
u8 GetFontAttribute(u8 fontId, u8 attributeId)
|
||||
{
|
||||
u8 result = 0;
|
||||
int result = 0;
|
||||
switch (attributeId)
|
||||
{
|
||||
case FONTATTR_MAX_LETTER_WIDTH:
|
||||
@ -1560,8 +1566,8 @@ u8 GetFontAttribute(u8 fontId, u8 attributeId)
|
||||
case FONTATTR_LINE_SPACING:
|
||||
result = gFontInfos[fontId].lineSpacing;
|
||||
break;
|
||||
case FONTATTR_STYLE:
|
||||
result = gFontInfos[fontId].style;
|
||||
case FONTATTR_UNKNOWN:
|
||||
result = gFontInfos[fontId].unk;
|
||||
break;
|
||||
case FONTATTR_COLOR_FOREGROUND:
|
||||
result = gFontInfos[fontId].fgColor;
|
||||
@ -1716,9 +1722,9 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese)
|
||||
{
|
||||
glyphs = gFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7));
|
||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
||||
DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20);
|
||||
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40);
|
||||
DecompressGlyphTile(glyphs + 0x88, gUnknown_03002F90.unk60);
|
||||
DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20); // gUnknown_03002F90 + 0x40
|
||||
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x20
|
||||
DecompressGlyphTile(glyphs + 0x88, gUnknown_03002F90.unk60); // gUnknown_03002F90 + 0x60
|
||||
gUnknown_03002F90.width = gFont2JapaneseGlyphWidths[glyphId]; // gGlyphWidth
|
||||
gUnknown_03002F90.height = 14; // gGlyphHeight
|
||||
}
|
||||
|
17
gflib/text.h
17
gflib/text.h
@ -269,20 +269,13 @@
|
||||
|
||||
#define TEXT_SPEED_FF 0xFF
|
||||
|
||||
enum
|
||||
{
|
||||
COLOR_FOREGROUND,
|
||||
COLOR_SHADOW,
|
||||
COLOR_BACKGROUND
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FONTATTR_MAX_LETTER_WIDTH,
|
||||
FONTATTR_MAX_LETTER_HEIGHT,
|
||||
FONTATTR_LETTER_SPACING,
|
||||
FONTATTR_LINE_SPACING,
|
||||
FONTATTR_STYLE,
|
||||
FONTATTR_UNKNOWN, // dunno what this is yet
|
||||
FONTATTR_COLOR_FOREGROUND,
|
||||
FONTATTR_COLOR_BACKGROUND,
|
||||
FONTATTR_COLOR_SHADOW
|
||||
@ -310,7 +303,7 @@ struct TextPrinterTemplate
|
||||
u8 currentY;
|
||||
u8 letterSpacing;
|
||||
u8 lineSpacing;
|
||||
u8 style:4; // 0xC
|
||||
u8 unk:4; // 0xC
|
||||
u8 fgColor:4;
|
||||
u8 bgColor:4;
|
||||
u8 shadowColor:4;
|
||||
@ -329,7 +322,7 @@ struct TextPrinter
|
||||
u8 delayCounter;
|
||||
u8 scrollDistance;
|
||||
u8 minLetterSpacing; // 0x20
|
||||
bool8 japanese;
|
||||
u8 japanese;
|
||||
};
|
||||
|
||||
struct FontInfo
|
||||
@ -339,7 +332,7 @@ struct FontInfo
|
||||
u8 maxLetterHeight;
|
||||
u8 letterSpacing;
|
||||
u8 lineSpacing;
|
||||
u8 style:4; //unused
|
||||
u8 unk:4;
|
||||
u8 fgColor:4;
|
||||
u8 bgColor:4;
|
||||
u8 shadowColor:4;
|
||||
@ -379,7 +372,7 @@ struct Struct_03002F90
|
||||
|
||||
extern TextFlags gTextFlags;
|
||||
|
||||
extern bool8 gUnknown_03002F84;
|
||||
extern u8 gUnknown_03002F84;
|
||||
extern struct Struct_03002F90 gUnknown_03002F90;
|
||||
|
||||
void SetFontsPointer(const struct FontInfo *fonts);
|
||||
|
@ -30,18 +30,21 @@ static void nullsub_8(void)
|
||||
|
||||
bool16 InitWindows(const struct WindowTemplate *templates)
|
||||
{
|
||||
int i, j;
|
||||
u8* allocatedTilemapBuffer;
|
||||
u16 attrib;
|
||||
int allocatedBaseBlock;
|
||||
int i;
|
||||
void *bgTilemapBuffer;
|
||||
int j;
|
||||
u8 bgLayer;
|
||||
u16 attrib;
|
||||
u8* allocatedTilemapBuffer;
|
||||
int allocatedBaseBlock;
|
||||
|
||||
for (i = 0; i < 0x4; ++i)
|
||||
{
|
||||
if (GetBgTilemapBuffer(i) != NULL)
|
||||
bgTilemapBuffer = GetBgTilemapBuffer(i);
|
||||
if (bgTilemapBuffer != NULL)
|
||||
gUnknown_03002F70[i] = nullsub_8;
|
||||
else
|
||||
gUnknown_03002F70[i] = NULL;
|
||||
gUnknown_03002F70[i] = bgTilemapBuffer;
|
||||
}
|
||||
|
||||
for (i = 0; i < 0x20; ++i)
|
||||
@ -564,19 +567,19 @@ u32 GetWindowAttribute(u8 windowId, u8 attributeId)
|
||||
switch (attributeId)
|
||||
{
|
||||
case WINDOW_BG:
|
||||
return (u32)gWindows[windowId].window.bg;
|
||||
return gWindows[windowId].window.bg;
|
||||
case WINDOW_TILEMAP_LEFT:
|
||||
return (u32)gWindows[windowId].window.tilemapLeft;
|
||||
return gWindows[windowId].window.tilemapLeft;
|
||||
case WINDOW_TILEMAP_TOP:
|
||||
return (u32)gWindows[windowId].window.tilemapTop;
|
||||
return gWindows[windowId].window.tilemapTop;
|
||||
case WINDOW_WIDTH:
|
||||
return (u32)gWindows[windowId].window.width;
|
||||
return gWindows[windowId].window.width;
|
||||
case WINDOW_HEIGHT:
|
||||
return (u32)gWindows[windowId].window.height;
|
||||
return gWindows[windowId].window.height;
|
||||
case WINDOW_PALETTE_NUM:
|
||||
return (u32)gWindows[windowId].window.paletteNum;
|
||||
return gWindows[windowId].window.paletteNum;
|
||||
case WINDOW_BASE_BLOCK:
|
||||
return (u32)gWindows[windowId].window.baseBlock;
|
||||
return gWindows[windowId].window.baseBlock;
|
||||
case WINDOW_TILE_DATA:
|
||||
return (u32)(gWindows[windowId].tileData);
|
||||
default:
|
||||
@ -640,10 +643,13 @@ u16 AddWindow8Bit(const struct WindowTemplate *template)
|
||||
}
|
||||
return 0xFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
gWindows[windowId].tileData = memAddress;
|
||||
gWindows[windowId].window = *template;
|
||||
return windowId;
|
||||
}
|
||||
}
|
||||
|
||||
void FillWindowPixelBuffer8Bit(u8 windowId, u8 fillValue)
|
||||
{
|
||||
|
@ -176,8 +176,8 @@ typedef struct linkManagerTag
|
||||
/* 0x024 */ VBL_TIMER nameAcceptTimer;
|
||||
/* 0x030 */ VBL_TIMER linkRecoveryTimer;
|
||||
/* 0x03c */ INIT_PARAM *init_param;
|
||||
/* 0x040 */ void (*LMAN_callback)(u8 msg, u8 paramCount);
|
||||
/* 0x044 */ void (*MSC_callback)(u16 REQ_commandID);
|
||||
/* 0x040 */ void (*LMAN_callback)(u8, u8);
|
||||
/* 0x044 */ void (*MSC_callback)(u16);
|
||||
} LINK_MANAGER;
|
||||
|
||||
extern struct linkManagerTag lman;
|
||||
|
@ -124,8 +124,8 @@ struct ProtectStruct
|
||||
u32 flinchImmobility:1;
|
||||
u32 notFirstStrike:1;
|
||||
u32 palaceUnableToUseMove:1;
|
||||
s32 physicalDmg;
|
||||
s32 specialDmg;
|
||||
u32 physicalDmg;
|
||||
u32 specialDmg;
|
||||
u8 physicalBattlerId;
|
||||
u8 specialBattlerId;
|
||||
};
|
||||
|
@ -145,7 +145,7 @@
|
||||
{ \
|
||||
textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
|
||||
textVar[1] = B_BUFF_STRING; \
|
||||
textVar[2] = (stringId & 0xFF); \
|
||||
textVar[2] = stringId; \
|
||||
textVar[3] = (stringId & 0xFF00) >> 8; \
|
||||
textVar[4] = B_BUFF_EOS; \
|
||||
}
|
||||
|
@ -7,6 +7,16 @@
|
||||
#define FLOOR_WALKABLE_METATILE 0x28D
|
||||
#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_ITEMS 1
|
||||
|
||||
|
@ -140,13 +140,55 @@ struct SoundChannel
|
||||
struct WaveData *wav;
|
||||
u32 cp;
|
||||
struct MusicPlayerTrack *track;
|
||||
void *pp;
|
||||
void *np;
|
||||
void *d4;
|
||||
u32 pp;
|
||||
u32 np;
|
||||
u32 d4;
|
||||
u16 xpi;
|
||||
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
|
||||
{
|
||||
u8 trackCount;
|
||||
@ -270,7 +312,7 @@ struct MusicPlayerInfo
|
||||
struct MusicPlayerTrack *tracks;
|
||||
struct ToneData *tone;
|
||||
u32 ident;
|
||||
void (*func)();
|
||||
u32 func;
|
||||
u32 intp;
|
||||
};
|
||||
|
||||
@ -292,47 +334,7 @@ struct Song
|
||||
extern const struct MusicPlayer gMPlayTable[];
|
||||
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[];
|
||||
|
||||
@ -446,7 +448,7 @@ void ply_tune(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_port(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
void ply_xcmd(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
|
||||
void ply_xxx(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
|
@ -98,7 +98,7 @@
|
||||
#define T2_READ_PTR(ptr) (void*) T2_READ_32(ptr)
|
||||
|
||||
// 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_HELD(button) TEST_BUTTON(gMain.heldKeys, button)
|
||||
#define JOY_HELD_RAW(button) TEST_BUTTON(gMain.heldKeysRaw, button)
|
||||
|
@ -24,7 +24,7 @@ struct ListMenu;
|
||||
struct ListMenuItem
|
||||
{
|
||||
const u8 *name;
|
||||
u32 id;
|
||||
s32 id;
|
||||
};
|
||||
|
||||
struct ListMenuTemplate
|
||||
@ -98,7 +98,7 @@ struct CursorStruct
|
||||
extern struct ScrollArrowsTemplate gTempScrollArrowTemplate;
|
||||
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 ListMenuInitInRect(struct ListMenuTemplate *listMenuTemplate, struct ListMenuWindowRect *arg1, u16 scrollOffset, u16 selectedRow);
|
||||
s32 ListMenu_ProcessInput(u8 listTaskId);
|
||||
|
@ -127,8 +127,8 @@ struct Unknown_806F160_Struct
|
||||
u32 field_0_1:4;
|
||||
u32 field_1:8;
|
||||
u16 magic:8;
|
||||
u32 size:4;
|
||||
u16 field_3_1:4;
|
||||
u32 field_3_0:4;
|
||||
u32 field_3_1:4;
|
||||
void *bytes;
|
||||
u8 **byteArrays;
|
||||
struct SpriteTemplate *templates;
|
||||
|
@ -1,12 +1,9 @@
|
||||
.include "../constants/gba_constants.inc"
|
||||
.include "../asm/macros/function.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
.set SOFT_RESET_DIRECT_BUF, 0x03007FFA
|
||||
.set USER_STACK, 0x03007F00
|
||||
.set RESET_EX_WRAM_FLAG, 0x1
|
||||
|
||||
.ifdef NO_GRANULAR_AGBSYSCALL
|
||||
@ -109,7 +106,7 @@ SoundDriverVSyncOn:
|
||||
thumb_func_start Mod
|
||||
Mod:
|
||||
svc #6
|
||||
adds r0, r1, #0
|
||||
mov r0, r1
|
||||
bx lr
|
||||
thumb_func_end Mod
|
||||
.endif
|
||||
@ -148,7 +145,7 @@ HuffUnComp:
|
||||
.endif
|
||||
|
||||
.ifdef L_SoftResetExram
|
||||
thumb_func_start SoftResetExram
|
||||
arm_func_start SoftResetExram
|
||||
SoftResetExram:
|
||||
ldr r3, =REG_IME
|
||||
movs r2, #0
|
||||
@ -156,14 +153,14 @@ SoftResetExram:
|
||||
ldr r3, =SOFT_RESET_DIRECT_BUF
|
||||
movs r2, #1
|
||||
strb r2, [r3, #0]
|
||||
subs r3, #SOFT_RESET_DIRECT_BUF - USER_STACK
|
||||
subs r3, #SOFT_RESET_DIRECT_BUF - 0x3007f00
|
||||
mov sp, r3
|
||||
movs r2, #RESET_EX_WRAM_FLAG
|
||||
bics r0, r2
|
||||
svc #1
|
||||
svc #0
|
||||
.pool
|
||||
thumb_func_end SoftResetExram
|
||||
arm_func_end SoftResetExram
|
||||
.endif
|
||||
|
||||
.ifdef L_MusicPlayerFadeOut
|
||||
@ -234,7 +231,7 @@ DivArm:
|
||||
thumb_func_start ModArm
|
||||
ModArm:
|
||||
svc #7
|
||||
adds r0, r1, #0
|
||||
mov r0, r1
|
||||
bx lr
|
||||
thumb_func_end ModArm
|
||||
.endif
|
||||
@ -274,7 +271,7 @@ Diff8bitUnFilterWram:
|
||||
.ifdef L_MultiBoot
|
||||
thumb_func_start MultiBoot
|
||||
MultiBoot:
|
||||
movs r1, #1
|
||||
mov r1, #1
|
||||
svc #37
|
||||
bx lr
|
||||
thumb_func_end MultiBoot
|
||||
@ -329,7 +326,7 @@ SoftResetRom:
|
||||
ldr r3, =SOFT_RESET_DIRECT_BUF
|
||||
movs r2, #0
|
||||
strb r2, [r3, #0]
|
||||
subs r3, #SOFT_RESET_DIRECT_BUF - USER_STACK
|
||||
sub r3, #SOFT_RESET_DIRECT_BUF - 0x3007f00
|
||||
mov sp, r3
|
||||
svc #1
|
||||
svc #0
|
||||
@ -416,7 +413,7 @@ SoftReset:
|
||||
ldr r3, =REG_IME
|
||||
movs r2, #0
|
||||
strb r2, [r3, #0]
|
||||
ldr r1, =USER_STACK
|
||||
ldr r1, =0x3007f00
|
||||
mov sp, r1
|
||||
svc #1
|
||||
svc #0
|
||||
|
@ -352,7 +352,7 @@ static bool8 rfu_LMAN_linkWatcher(u16 REQ_commandID)
|
||||
{
|
||||
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.count[i] = lman.linkRecoveryTimer.count_max;
|
||||
@ -396,7 +396,7 @@ static bool8 rfu_LMAN_linkWatcher(u16 REQ_commandID)
|
||||
bm_disconnectSlot = 0;
|
||||
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);
|
||||
bm_disconnectSlot |= (1 << i);
|
||||
|
@ -41,7 +41,7 @@ u16 ReadFlashId(void)
|
||||
u8 (*readFlash1)(u8 *);
|
||||
|
||||
SetReadFlash1(readFlash1Buffer);
|
||||
readFlash1 = (u8 (*)(u8 *))((uintptr_t)readFlash1Buffer + 1);
|
||||
readFlash1 = (u8 (*)(u8 *))((s32)readFlash1Buffer + 1);
|
||||
|
||||
// Enter ID mode.
|
||||
FLASH_WRITE(0x5555, 0xAA);
|
||||
@ -113,12 +113,12 @@ void SetReadFlash1(u16 *dest)
|
||||
u16 *src;
|
||||
u16 i;
|
||||
|
||||
PollFlashStatus = (u8 (*)(u8 *))((uintptr_t)dest + 1);
|
||||
PollFlashStatus = (u8 (*)(u8 *))((s32)dest + 1);
|
||||
|
||||
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)
|
||||
{
|
||||
@ -154,10 +154,10 @@ void ReadFlash(u16 sectorNum, u32 offset, u8 *dest, u32 size)
|
||||
}
|
||||
|
||||
funcSrc = (vu16 *)ReadFlash_Core;
|
||||
funcSrc = (vu16 *)((uintptr_t)funcSrc ^ 1);
|
||||
funcSrc = (vu16 *)((s32)funcSrc ^ 1);
|
||||
funcDest = readFlash_Core_Buffer;
|
||||
|
||||
i = ((uintptr_t)ReadFlash - (uintptr_t)ReadFlash_Core) >> 1;
|
||||
i = ((s32)ReadFlash - (s32)ReadFlash_Core) >> 1;
|
||||
|
||||
while (i != 0)
|
||||
{
|
||||
@ -165,7 +165,7 @@ void ReadFlash(u16 sectorNum, u32 offset, u8 *dest, u32 size)
|
||||
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;
|
||||
|
||||
@ -202,10 +202,10 @@ u32 VerifyFlashSector(u16 sectorNum, u8 *src)
|
||||
}
|
||||
|
||||
funcSrc = (vu16 *)VerifyFlashSector_Core;
|
||||
funcSrc = (vu16 *)((uintptr_t)funcSrc ^ 1);
|
||||
funcSrc = (vu16 *)((s32)funcSrc ^ 1);
|
||||
funcDest = verifyFlashSector_Core_Buffer;
|
||||
|
||||
i = (u16)(((uintptr_t)VerifyFlashSector - (uintptr_t)VerifyFlashSector_Core) >> 1);
|
||||
i = ((s32)VerifyFlashSector - (s32)VerifyFlashSector_Core) >> 1;
|
||||
|
||||
while (i != 0)
|
||||
{
|
||||
@ -213,7 +213,7 @@ u32 VerifyFlashSector(u16 sectorNum, u8 *src)
|
||||
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);
|
||||
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;
|
||||
|
||||
funcSrc = (vu16 *)VerifyFlashSector_Core;
|
||||
funcSrc = (vu16 *)((uintptr_t)funcSrc ^ 1);
|
||||
funcSrc = (vu16 *)((s32)funcSrc ^ 1);
|
||||
funcDest = verifyFlashSector_Core_Buffer;
|
||||
|
||||
i = ((uintptr_t)VerifyFlashSector - (uintptr_t)VerifyFlashSector_Core) >> 1;
|
||||
i = ((s32)VerifyFlashSector - (s32)VerifyFlashSector_Core) >> 1;
|
||||
|
||||
while (i != 0)
|
||||
{
|
||||
@ -250,7 +250,7 @@ u32 VerifyFlashSectorNBytes(u16 sectorNum, u8 *src, u32 n)
|
||||
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);
|
||||
|
||||
|
@ -1298,7 +1298,7 @@ static void Cmd_count_usable_party_mons(void)
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
{
|
||||
u8 position;
|
||||
u32 position;
|
||||
battlerOnField1 = gBattlerPartyIndexes[battlerId];
|
||||
position = GetBattlerPosition(battlerId) ^ BIT_FLANK;
|
||||
battlerOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(position)];
|
||||
|
@ -372,12 +372,15 @@ static void AnimTranslateStinger(struct Sprite *sprite)
|
||||
{
|
||||
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
|
||||
}
|
||||
else if (GetBattlerSide(gBattleAnimAttacker))
|
||||
else
|
||||
{
|
||||
if (GetBattlerSide(gBattleAnimAttacker))
|
||||
{
|
||||
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
|
||||
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
|
||||
gBattleAnimArgs[3] = -gBattleAnimArgs[3];
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsContest() && GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget))
|
||||
{
|
||||
@ -440,24 +443,28 @@ static void AnimMissileArc_Step(struct Sprite *sprite)
|
||||
else
|
||||
{
|
||||
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;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
tempData[i] = sprite->data[i];
|
||||
tempData[i] = data[i];
|
||||
|
||||
xpos = sprite->pos1.x + sprite->pos2.x;
|
||||
ypos = sprite->pos1.y + sprite->pos2.y;
|
||||
x2 += x1;
|
||||
y2 += y1;
|
||||
|
||||
if (!TranslateAnimHorizontalArc(sprite))
|
||||
{
|
||||
u16 rotation = ArcTan2Neg(sprite->pos1.x + sprite->pos2.x - xpos, //Isn't this zero lol
|
||||
sprite->pos1.y + sprite->pos2.y - ypos);
|
||||
u16 rotation = ArcTan2Neg(sprite->pos1.x + sprite->pos2.x - x2,
|
||||
sprite->pos1.y + sprite->pos2.y - y2);
|
||||
rotation += 0xC000;
|
||||
TrySetSpriteRotScale(sprite, FALSE, 0x100, 0x100, rotation);
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
sprite->data[i] = tempData[i];
|
||||
data[i] = tempData[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3967,20 +3967,19 @@ static void AnimProtect(struct Sprite* sprite)
|
||||
|
||||
static void AnimProtect_Step(struct Sprite *sprite)
|
||||
{
|
||||
int i, savedPal;
|
||||
int i, id, savedPal;
|
||||
sprite->data[5] += 96;
|
||||
sprite->pos2.x = -(sprite->data[5] >> 8);
|
||||
if (++sprite->data[1] > 1)
|
||||
{
|
||||
int id;
|
||||
sprite->data[1] = 0;
|
||||
savedPal = gPlttBufferFaded[sprite->data[2] + 1];
|
||||
i = 0;
|
||||
do
|
||||
while (i < 6)
|
||||
{
|
||||
id = sprite->data[2] + ++i;
|
||||
gPlttBufferFaded[id] = gPlttBufferFaded[id + 1];
|
||||
} while (i < 6);
|
||||
}
|
||||
|
||||
gPlttBufferFaded[sprite->data[2] + 7] = savedPal;
|
||||
}
|
||||
|
@ -5002,8 +5002,8 @@ void AnimTask_GetReturnPowerLevel(u8 taskId)
|
||||
void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
||||
{
|
||||
u8 spriteId, spriteId2;
|
||||
u32 personality;
|
||||
u32 otId;
|
||||
int personality;
|
||||
int otId;
|
||||
u16 species;
|
||||
u8 subpriority;
|
||||
bool8 isBackPic;
|
||||
@ -5037,7 +5037,9 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
||||
isBackPic = FALSE;
|
||||
x = -32;
|
||||
}
|
||||
else if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
||||
else
|
||||
{
|
||||
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
|
||||
{
|
||||
personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_PERSONALITY);
|
||||
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_OT_ID);
|
||||
@ -5063,6 +5065,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
||||
isBackPic = TRUE;
|
||||
x = -32;
|
||||
}
|
||||
}
|
||||
|
||||
spriteId2 = sub_80A8394(species, isBackPic, 0, x, GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y), subpriority, personality, otId, gBattleAnimAttacker, 0);
|
||||
if (gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies != SPECIES_NONE)
|
||||
@ -5088,7 +5091,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
||||
if (x < GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X))
|
||||
{
|
||||
gTasks[taskId].data[14]++;
|
||||
gBattleAnimArgs[7] = -1;
|
||||
gBattleAnimArgs[7] = 0xFFFF;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -5096,7 +5099,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
|
||||
if (x > GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X))
|
||||
{
|
||||
gTasks[taskId].data[14]++;
|
||||
gBattleAnimArgs[7] = -1;
|
||||
gBattleAnimArgs[7] = 0xFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -380,18 +380,21 @@ static void AnimTask_AnimateGustTornadoPalette_Step(u8 taskId)
|
||||
{
|
||||
u8 data2;
|
||||
u16 temp;
|
||||
int i, base;
|
||||
|
||||
if (gTasks[taskId].data[10]++ == gTasks[taskId].data[1])
|
||||
{
|
||||
int i, base;
|
||||
gTasks[taskId].data[10] = 0;
|
||||
data2 = gTasks[taskId].data[2];
|
||||
temp = gPlttBufferFaded[16 * data2 + 0x108];
|
||||
i = 7;
|
||||
base = data2 * 16;
|
||||
|
||||
for (; i > 0; --i)
|
||||
do
|
||||
{
|
||||
gPlttBufferFaded[base + 0x101 + i] = gPlttBufferFaded[base + 0x100 + i];
|
||||
i--;
|
||||
} while (i > 0);
|
||||
|
||||
gPlttBufferFaded[base + 0x101] = temp;
|
||||
}
|
||||
@ -533,8 +536,8 @@ static void AnimFlyBallAttack_Step(struct Sprite *sprite)
|
||||
|
||||
void DestroyAnimSpriteAfterTimer(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->data[0]-- > 0)
|
||||
return;
|
||||
if (sprite->data[0]-- <= 0)
|
||||
{
|
||||
if (sprite->oam.affineMode & ST_OAM_AFFINE_ON_MASK)
|
||||
{
|
||||
FreeOamMatrix(sprite->oam.matrixNum);
|
||||
@ -544,6 +547,7 @@ void DestroyAnimSpriteAfterTimer(struct Sprite *sprite)
|
||||
DestroySprite(sprite);
|
||||
gAnimVisualTaskCount--;
|
||||
}
|
||||
}
|
||||
|
||||
struct FeatherDanceData
|
||||
{
|
||||
@ -563,41 +567,35 @@ struct FeatherDanceData
|
||||
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)
|
||||
{
|
||||
u8 battler, sinIndex;
|
||||
u32 matrixNum;
|
||||
s16 sinVal;
|
||||
u8 battler, matrixNum, sinIndex;
|
||||
s16 spriteCoord;
|
||||
|
||||
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)
|
||||
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
|
||||
|
||||
sprite->pos1.x = GetBattlerSpriteCoord(battler, BATTLER_COORD_ATTR_HEIGHT) + gBattleAnimArgs[0];
|
||||
sinVal = GetBattlerSpriteCoord(battler, BATTLER_COORD_ATTR_WIDTH);
|
||||
sprite->pos1.y = sinVal + gBattleAnimArgs[1];
|
||||
spriteCoord = GetBattlerSpriteCoord(battler, BATTLER_COORD_ATTR_WIDTH);
|
||||
sprite->pos1.y = spriteCoord + gBattleAnimArgs[1];
|
||||
|
||||
data->unk8 = (u16)(sprite->pos1.y) << 8;
|
||||
data->unkE_1 = (u16)(sinVal + gBattleAnimArgs[6]);
|
||||
data->unk8 = sprite->pos1.y << 8;
|
||||
data->unkE_1 = spriteCoord + gBattleAnimArgs[6];
|
||||
data->unk0_0c = 1;
|
||||
data->unk2 = (u16)(gBattleAnimArgs[2] & 0xFF);
|
||||
data->unkA = (u16)gBattleAnimArgs[2] >> 8;
|
||||
data->unk2 = gBattleAnimArgs[2] & 0xFF;
|
||||
data->unkA = (gBattleAnimArgs[2] >> 8) & 0xFF;
|
||||
data->unk4 = gBattleAnimArgs[3];
|
||||
data->unk6 = (u16)gBattleAnimArgs[4];
|
||||
*(u16 *)(data->unkC) = (u16)gBattleAnimArgs[5];
|
||||
data->unk6 = gBattleAnimArgs[4];
|
||||
*(u16*)(data->unkC) = gBattleAnimArgs[5];
|
||||
|
||||
if (data->unk2 >= 64 && data->unk2 < 192)
|
||||
if (data->unk2 >= 64 && data->unk2 <= 191)
|
||||
{
|
||||
if (!IsContest())
|
||||
sprite->oam.priority = GetBattlerSpriteBGPriority(battler) + 1;
|
||||
@ -608,7 +606,11 @@ static void AnimFallingFeather(struct Sprite *sprite)
|
||||
|
||||
if (!(data->unk4 & 0x8000))
|
||||
{
|
||||
ANIM_SWITCH(sprite);
|
||||
sprite->hFlip ^= 1;
|
||||
sprite->animNum = sprite->hFlip;
|
||||
|
||||
sprite->animBeginning = 1;
|
||||
sprite->animEnded = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -618,28 +620,31 @@ static void AnimFallingFeather(struct Sprite *sprite)
|
||||
|
||||
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;
|
||||
sprite->pos2.x = (gSineTable[data->unk2] * (s32)data->unkC[0]) >> 8;
|
||||
data->unk0_1 = data->unk2 >> 6;
|
||||
sprite->pos2.x = (gSineTable[data->unk2] * data->unkC[0]) >> 8;
|
||||
matrixNum = sprite->oam.matrixNum;
|
||||
|
||||
sinIndex = (-sprite->pos2.x >> 1) + data->unkA;
|
||||
sinVal = gSineTable[sinIndex];
|
||||
spriteCoord = gSineTable[sinIndex];
|
||||
|
||||
gOamMatrices[matrixNum].a = gOamMatrices[matrixNum].d = gSineTable[sinIndex + 64];
|
||||
gOamMatrices[matrixNum].b = sinVal;
|
||||
gOamMatrices[matrixNum].c = -sinVal;
|
||||
gOamMatrices[matrixNum].b = spriteCoord;
|
||||
gOamMatrices[matrixNum].c = -spriteCoord;
|
||||
|
||||
sprite->callback = sub_810E520;
|
||||
}
|
||||
|
||||
static void sub_810E520(struct Sprite *sprite)
|
||||
{
|
||||
u8 sinIndex;
|
||||
u32 matrixNum;
|
||||
u8 matrixNum, sinIndex;
|
||||
s16 sinVal = 0;
|
||||
struct FeatherDanceData *data = (struct FeatherDanceData *)sprite->data;
|
||||
if (data->unk0_0a)
|
||||
@ -649,13 +654,13 @@ static void sub_810E520(struct Sprite *sprite)
|
||||
data->unk0_0a = 0;
|
||||
data->unk1 = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
switch (data->unk2 / 64)
|
||||
{
|
||||
case 0:
|
||||
if ((u8)data->unk0_1 == 1) // this must be cast to u8
|
||||
if ((u8)data->unk0_1 == 1) //casts to u8 here are necessary for matching
|
||||
{
|
||||
data->unk0_0d = 1;
|
||||
data->unk0_0a = 1;
|
||||
@ -669,7 +674,10 @@ static void sub_810E520(struct Sprite *sprite)
|
||||
}
|
||||
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 (!IsContest())
|
||||
@ -700,6 +708,7 @@ static void sub_810E520(struct Sprite *sprite)
|
||||
}
|
||||
}
|
||||
data->unk0_0d = 0;
|
||||
data->unk2;
|
||||
}
|
||||
data->unk0_1 = 0;
|
||||
break;
|
||||
@ -717,7 +726,10 @@ static void sub_810E520(struct Sprite *sprite)
|
||||
}
|
||||
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 (!IsContest())
|
||||
@ -765,7 +777,10 @@ static void sub_810E520(struct Sprite *sprite)
|
||||
}
|
||||
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 (!IsContest())
|
||||
@ -812,7 +827,10 @@ static void sub_810E520(struct Sprite *sprite)
|
||||
}
|
||||
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 (!IsContest())
|
||||
@ -848,10 +866,10 @@ static void sub_810E520(struct Sprite *sprite)
|
||||
break;
|
||||
}
|
||||
|
||||
sprite->pos2.x = ((s32)(data->unkC[data->unk0_0b]) * gSineTable[data->unk2]) >> 8;
|
||||
sprite->pos2.x = ((s32)data->unkC[data->unk0_0b] * gSineTable[data->unk2]) >> 8;
|
||||
matrixNum = sprite->oam.matrixNum;
|
||||
|
||||
sinIndex = ((-sprite->pos2.x >> 1) + data->unkA);
|
||||
sinIndex = (-sprite->pos2.x >> 1) + data->unkA;
|
||||
sinVal = gSineTable[sinIndex];
|
||||
|
||||
gOamMatrices[matrixNum].a = gOamMatrices[matrixNum].d = gSineTable[sinIndex + 64];
|
||||
@ -859,7 +877,7 @@ static void sub_810E520(struct Sprite *sprite)
|
||||
gOamMatrices[matrixNum].c = -sinVal;
|
||||
|
||||
data->unk8 += data->unk6;
|
||||
sprite->pos1.y = (s16)(data->unk8 >> 8);
|
||||
sprite->pos1.y = data->unk8 >> 8;
|
||||
if (data->unk4 & 0x8000)
|
||||
data->unk2 = (data->unk2 - (data->unk4 & 0x7FFF)) & 0xFF;
|
||||
else
|
||||
@ -871,6 +889,7 @@ static void sub_810E520(struct Sprite *sprite)
|
||||
sprite->callback = DestroyAnimSpriteAfterTimer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_810EA4C(struct Sprite *sprite)
|
||||
{
|
||||
@ -912,20 +931,20 @@ static void sub_810EB40(struct Sprite *sprite)
|
||||
{
|
||||
sprite->pos2.x += sprite->data[1] >> 8;
|
||||
|
||||
if (sprite->data[0]++ == 5)
|
||||
if (++sprite->data[0] == 6)
|
||||
{
|
||||
sprite->data[0] = 0;
|
||||
sprite->pos2.x = 0;
|
||||
StartSpriteAnim(sprite, 0);
|
||||
}
|
||||
|
||||
if (sprite->data[7]-- == 0)
|
||||
if (--sprite->data[7] == -1)
|
||||
DestroyAnimSprite(sprite);
|
||||
}
|
||||
|
||||
void AnimTask_DrillPeckHitSplats(u8 task)
|
||||
{
|
||||
if ((gTasks[task].data[0] % 32) == 0)
|
||||
if (!(gTasks[task].data[0] % 32))
|
||||
{
|
||||
gAnimVisualTaskCount++;
|
||||
|
||||
@ -1028,8 +1047,8 @@ static void AnimDiveBall_Step2(struct Sprite *sprite)
|
||||
|
||||
static void AnimDiveWaterSplash(struct Sprite *sprite)
|
||||
{
|
||||
u8 matrixNum;
|
||||
s32 t1, t2;
|
||||
u32 matrixNum;
|
||||
int t1, t2;
|
||||
|
||||
switch (sprite->data[0])
|
||||
{
|
||||
@ -1051,7 +1070,7 @@ static void AnimDiveWaterSplash(struct Sprite *sprite)
|
||||
sprite->data[0]++;
|
||||
break;
|
||||
case 1:
|
||||
if (sprite->data[2] < 12)
|
||||
if (sprite->data[2] <= 11)
|
||||
sprite->data[1] -= 40;
|
||||
else
|
||||
sprite->data[1] += 40;
|
||||
@ -1083,8 +1102,8 @@ static void AnimDiveWaterSplash(struct Sprite *sprite)
|
||||
// Launches a water droplet away from the specified battler. Used by Astonish and Dive
|
||||
static void AnimSprayWaterDroplet(struct Sprite *sprite)
|
||||
{
|
||||
const u16 v1 = Random2() & 0x1ff;
|
||||
const u16 v2 = Random2() & 0x07f;
|
||||
int v1 = 0x1ff & Random2();
|
||||
int v2 = 0x7f & Random2();
|
||||
|
||||
if (v1 % 2)
|
||||
sprite->data[0] = 736 + v1;
|
||||
@ -1128,13 +1147,13 @@ static void AnimSprayWaterDroplet_Step(struct Sprite *sprite)
|
||||
sprite->pos2.y -= sprite->data[1] >> 8;
|
||||
}
|
||||
|
||||
sprite->data[0] -= 0; // Needed to Match
|
||||
sprite->data[0] = sprite->data[0];
|
||||
sprite->data[1] -= 32;
|
||||
|
||||
if (sprite->data[0] < 0)
|
||||
sprite->data[0] = 0;
|
||||
|
||||
if (sprite->data[3]++ == 30)
|
||||
if (++sprite->data[3] == 31)
|
||||
DestroyAnimSprite(sprite);
|
||||
}
|
||||
|
||||
@ -1204,12 +1223,12 @@ void unref_sub_810F184(u8 taskId)
|
||||
{
|
||||
if (gBattleAnimArgs[0] == 0)
|
||||
{
|
||||
const u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
||||
u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
||||
gSprites[spriteId].invisible = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
const u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
||||
u8 spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
||||
gSprites[spriteId].invisible = FALSE;
|
||||
}
|
||||
DestroyAnimVisualTask(taskId);
|
||||
|
@ -52,7 +52,7 @@ static void CreateWaterSpoutLaunchDroplets(struct Task*, u8);
|
||||
static void CreateWaterSpoutRainDroplet(struct Task*, u8);
|
||||
static void AnimTask_WaterSport_Step(u8);
|
||||
static void CreateWaterSportDroplet(struct Task*);
|
||||
static void CreateWaterPulseRingBubbles(struct Sprite*, s32, s32);
|
||||
static void CreateWaterPulseRingBubbles(struct Sprite*, int, int);
|
||||
|
||||
// Both unused
|
||||
const u8 gUnknown_8593C80[] = INCBIN_U8("graphics/unknown/unknown_593C80.4bpp");
|
||||
@ -631,13 +631,13 @@ static void AnimTask_RotateAuroraRingColors_Step(u8 taskId)
|
||||
|
||||
if (++gTasks[taskId].data[10] == 3)
|
||||
{
|
||||
u16 tempPlt;
|
||||
u16 rgbBuffer;
|
||||
gTasks[taskId].data[10] = 0;
|
||||
palIndex = gTasks[taskId].data[2] + 1;
|
||||
tempPlt = gPlttBufferFaded[palIndex];
|
||||
rgbBuffer = gPlttBufferFaded[palIndex];
|
||||
for (i = 1; i < 8; i++)
|
||||
gPlttBufferFaded[palIndex + i - 1] = gPlttBufferFaded[palIndex + i];
|
||||
gPlttBufferFaded[palIndex + 7] = tempPlt;
|
||||
gPlttBufferFaded[palIndex + 7] = rgbBuffer;
|
||||
}
|
||||
if (++gTasks[taskId].data[11] == gTasks[taskId].data[0])
|
||||
DestroyAnimVisualTask(taskId);
|
||||
@ -748,7 +748,6 @@ static void AnimHydroCannonBeam(struct Sprite *sprite)
|
||||
if (GetBattlerPosition(gBattleAnimAttacker) == B_POSITION_PLAYER_LEFT || GetBattlerPosition(gBattleAnimAttacker) == B_POSITION_OPPONENT_LEFT)
|
||||
gBattleAnimArgs[0] *= -1;
|
||||
}
|
||||
|
||||
if ((gBattleAnimArgs[5] & 0xFF00) == 0)
|
||||
animType = TRUE;
|
||||
else
|
||||
@ -794,7 +793,7 @@ static void AnimSmallBubblePair_Step(struct Sprite *sprite)
|
||||
sprite->pos2.x = Sin(sprite->data[0], 4);
|
||||
sprite->data[1] += 48;
|
||||
sprite->pos2.y = -(sprite->data[1] >> 8);
|
||||
if (sprite->data[7]-- == 0)
|
||||
if (--sprite->data[7] == -1)
|
||||
DestroyAnimSprite(sprite);
|
||||
}
|
||||
|
||||
@ -802,17 +801,17 @@ void AnimTask_CreateSurfWave(u8 taskId)
|
||||
{
|
||||
struct BattleAnimBgData animBg;
|
||||
u8 taskId2;
|
||||
u16 *x, *y; //These pointers are needed to match
|
||||
u16 *x;
|
||||
u16 *y;
|
||||
|
||||
x = &gBattle_BG1_X;
|
||||
y = &gBattle_BG1_Y;
|
||||
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL | BLDCNT_TGT1_BG1);
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, (16 << 8));
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
|
||||
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
||||
SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 1);
|
||||
sub_80A6B30(&animBg);
|
||||
|
||||
if (!IsContest())
|
||||
{
|
||||
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1);
|
||||
@ -877,13 +876,13 @@ void AnimTask_CreateSurfWave(u8 taskId)
|
||||
|
||||
static void AnimTask_CreateSurfWave_Step1(u8 taskId)
|
||||
{
|
||||
u16 rgbBuffer;
|
||||
u8 i;
|
||||
u16 *BGptrX, *BGptrY;
|
||||
struct BattleAnimBgData animBg;
|
||||
|
||||
BGptrX = &gBattle_BG1_X;
|
||||
BGptrY = &gBattle_BG1_Y;
|
||||
u8 i;
|
||||
u16 rgbBuffer;
|
||||
u16 *BGptrX = &gBattle_BG1_X;
|
||||
u16 *BGptrY = &gBattle_BG1_Y;
|
||||
u32 palOffset;
|
||||
u16 palNum;
|
||||
|
||||
*BGptrX += gTasks[taskId].data[0];
|
||||
*BGptrY += gTasks[taskId].data[1];
|
||||
@ -891,18 +890,18 @@ static void AnimTask_CreateSurfWave_Step1(u8 taskId)
|
||||
gTasks[taskId].data[2] += gTasks[taskId].data[1];
|
||||
if (++gTasks[taskId].data[5] == 4)
|
||||
{
|
||||
rgbBuffer = gPlttBufferFaded[16 * animBg.paletteId + 7];
|
||||
for (i = 6; i != 0; i--) // i > 0 generates the exact same code in this context
|
||||
rgbBuffer = gPlttBufferFaded[animBg.paletteId * 16 + 7];
|
||||
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
|
||||
gPlttBufferFaded[animBg.paletteId * 16 + 1 + i] = gPlttBufferFaded[animBg.paletteId * 16 + 1 + i - 1]; // 1 + i - 1 is needed to match for some bizarre reason
|
||||
}
|
||||
gPlttBufferFaded[16 * animBg.paletteId + 1] = rgbBuffer;
|
||||
gPlttBufferFaded[animBg.paletteId * 16 + 1] = rgbBuffer;
|
||||
gTasks[taskId].data[5] = 0;
|
||||
}
|
||||
if (++gTasks[taskId].data[6] > 1)
|
||||
{
|
||||
gTasks[taskId].data[6] = 0;
|
||||
if (++gTasks[taskId].data[3] < 14)
|
||||
if (++gTasks[taskId].data[3] <= 13)
|
||||
{
|
||||
gTasks[gTasks[taskId].data[15]].data[1] = (s16)((gTasks[taskId].data[3]) | ((16 - gTasks[taskId].data[3]) << 8));
|
||||
gTasks[taskId].data[4]++;
|
||||
@ -920,7 +919,6 @@ static void AnimTask_CreateSurfWave_Step1(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void AnimTask_CreateSurfWave_Step2(u8 taskId)
|
||||
{
|
||||
u16 *BGptrX = &gBattle_BG1_X;
|
||||
@ -1543,50 +1541,45 @@ static void AnimWaterPulseRing_Step(struct Sprite *sprite)
|
||||
sprite->data[0]++;
|
||||
}
|
||||
|
||||
static void CreateWaterPulseRingBubbles(struct Sprite *sprite, s32 xDiff, s32 yDiff)
|
||||
static void CreateWaterPulseRingBubbles(struct Sprite *sprite, int xDiff, int yDiff)
|
||||
{
|
||||
s16 combinedX, combinedY;
|
||||
s16 i, something;
|
||||
s16 combinedX;
|
||||
s16 combinedY;
|
||||
s16 i;
|
||||
s16 something;
|
||||
s16 unusedVar = 1; //unusedVar is needed to match
|
||||
s16 somethingRandomX, somethingRandomY;
|
||||
s16 randomSomethingY;
|
||||
s16 randomSomethingX;
|
||||
u8 spriteId;
|
||||
|
||||
something = sprite->data[0] / 2;
|
||||
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;
|
||||
unusedVar *= -1; //Needed to match
|
||||
randomSomethingY = yDiff + (Random2() % 10) - 5;
|
||||
randomSomethingX = -xDiff + (Random2() % 10) - 5;
|
||||
|
||||
for (i = 0; i < 1; i++)
|
||||
for (i = 0; i <= 0; i++)
|
||||
{
|
||||
spriteId = CreateSprite(&gWaterPulseRingBubbleSpriteTemplate, combinedX, combinedY + something, 130);
|
||||
gSprites[spriteId].data[0] = 20;
|
||||
gSprites[spriteId].data[1] = somethingRandomY;
|
||||
gSprites[spriteId].data[1] = randomSomethingY;
|
||||
gSprites[spriteId].subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker) - 1;
|
||||
if (somethingRandomX < 0)
|
||||
{
|
||||
gSprites[spriteId].data[2] = -somethingRandomX;
|
||||
}
|
||||
if (randomSomethingX < 0)
|
||||
gSprites[spriteId].data[2] = -randomSomethingX;
|
||||
else
|
||||
{
|
||||
gSprites[spriteId].data[2] = somethingRandomX;
|
||||
gSprites[spriteId].data[2] = randomSomethingX;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 1; i++)
|
||||
for (i = 0; i <= 0; i++)
|
||||
{
|
||||
spriteId = CreateSprite(&gWaterPulseRingBubbleSpriteTemplate, combinedX, combinedY - something, 130);
|
||||
gSprites[spriteId].data[0] = 20;
|
||||
gSprites[spriteId].data[1] = somethingRandomY;
|
||||
gSprites[spriteId].data[1] = randomSomethingY;
|
||||
gSprites[spriteId].subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker) - 1;
|
||||
if (somethingRandomX > 0)
|
||||
{
|
||||
gSprites[spriteId].data[2] = -somethingRandomX;
|
||||
}
|
||||
if (randomSomethingX > 0)
|
||||
gSprites[spriteId].data[2] = -randomSomethingX;
|
||||
else
|
||||
{
|
||||
gSprites[spriteId].data[2] = somethingRandomX;
|
||||
}
|
||||
gSprites[spriteId].data[2] = randomSomethingX;
|
||||
}
|
||||
}
|
||||
|
@ -1126,7 +1126,7 @@ void DrawBattleEntryBackground(void)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||
{
|
||||
LZDecompressVram(gUnknown_08D778F0, (void*)(BG_CHAR_ADDR(1)));
|
||||
LZDecompressVram(gVsLettersGfx, (void*)(OBJ_VRAM0));
|
||||
LZDecompressVram(gVsLettersGfx, (void*)(VRAM + 0x10000));
|
||||
LoadCompressedPalette(gUnknown_08D77AE4, 0x60, 0x20);
|
||||
SetBgAttribute(1, BG_ATTR_SCREENSIZE, 1);
|
||||
SetGpuReg(REG_OFFSET_BG1CNT, 0x5C04);
|
||||
|
@ -2763,10 +2763,10 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2)
|
||||
// BUG: TYPE_x2 is not necessary and makes the condition always false if the ability is wonder guard.
|
||||
if (TYPE_EFFECT_DEF_TYPE(i) == defType1)
|
||||
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)
|
||||
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;
|
||||
}
|
||||
i += 3;
|
||||
}
|
||||
@ -2777,10 +2777,10 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2)
|
||||
case 0:
|
||||
switch (typePower)
|
||||
{
|
||||
default:
|
||||
case TYPE_x0:
|
||||
case TYPE_x0_25:
|
||||
case TYPE_x0_50:
|
||||
case TYPE_x0_25:
|
||||
case TYPE_x0:
|
||||
default:
|
||||
typePower = 0;
|
||||
break;
|
||||
case TYPE_x1:
|
||||
@ -2797,19 +2797,19 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2)
|
||||
case 1:
|
||||
switch (typePower)
|
||||
{
|
||||
case TYPE_x0:
|
||||
typePower = 8;
|
||||
default:
|
||||
case TYPE_x1:
|
||||
typePower = 0;
|
||||
break;
|
||||
case TYPE_x0_25:
|
||||
typePower = 4;
|
||||
break;
|
||||
case TYPE_x0:
|
||||
typePower = 8;
|
||||
break;
|
||||
case TYPE_x0_50:
|
||||
typePower = 2;
|
||||
break;
|
||||
default:
|
||||
case TYPE_x1:
|
||||
typePower = 0;
|
||||
break;
|
||||
case TYPE_x2:
|
||||
typePower = -2;
|
||||
break;
|
||||
@ -2827,8 +2827,8 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2)
|
||||
case TYPE_x0_25:
|
||||
typePower = -8;
|
||||
break;
|
||||
default:
|
||||
case TYPE_x0_50:
|
||||
default:
|
||||
typePower = 0;
|
||||
break;
|
||||
case TYPE_x1:
|
||||
@ -4304,7 +4304,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId)
|
||||
textPrinter.currentY = textPrinter.y;
|
||||
textPrinter.letterSpacing = 2;
|
||||
textPrinter.lineSpacing = 0;
|
||||
textPrinter.style = 0;
|
||||
textPrinter.unk = 0;
|
||||
textPrinter.fgColor = TEXT_DYNAMIC_COLOR_5;
|
||||
textPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
|
||||
textPrinter.shadowColor = TEXT_DYNAMIC_COLOR_4;
|
||||
@ -4837,7 +4837,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
|
||||
textPrinter.currentY = textPrinter.y;
|
||||
textPrinter.letterSpacing = 0;
|
||||
textPrinter.lineSpacing = 0;
|
||||
textPrinter.style = 0;
|
||||
textPrinter.unk = 0;
|
||||
textPrinter.fgColor = TEXT_DYNAMIC_COLOR_5;
|
||||
textPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
|
||||
textPrinter.shadowColor = TEXT_DYNAMIC_COLOR_4;
|
||||
@ -5335,7 +5335,7 @@ static void Task_ShowTourneyTree(u8 taskId)
|
||||
textPrinter.lineSpacing = 0;
|
||||
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0x70, textPrinter.letterSpacing);
|
||||
textPrinter.currentY = 1;
|
||||
textPrinter.style = 0;
|
||||
textPrinter.unk = 0;
|
||||
textPrinter.fgColor = TEXT_DYNAMIC_COLOR_5;
|
||||
textPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
|
||||
textPrinter.shadowColor = TEXT_DYNAMIC_COLOR_4;
|
||||
@ -5516,7 +5516,7 @@ static void Task_HandleStaticTourneyTreeInput(u8 taskId)
|
||||
textPrinter.y = 0;
|
||||
textPrinter.letterSpacing = 2;
|
||||
textPrinter.lineSpacing = 0;
|
||||
textPrinter.style = 0;
|
||||
textPrinter.unk = 0;
|
||||
textPrinter.fgColor = TEXT_DYNAMIC_COLOR_2;
|
||||
textPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
|
||||
textPrinter.shadowColor = TEXT_DYNAMIC_COLOR_4;
|
||||
|
@ -956,7 +956,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform
|
||||
}
|
||||
|
||||
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);
|
||||
paletteOffset = 0x100 + battlerAtk * 16;
|
||||
lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue);
|
||||
@ -1013,7 +1013,9 @@ void BattleLoadSubstituteOrMonSpriteGfx(u8 battlerId, bool8 loadMonSprite)
|
||||
palOffset = (battlerId * 16) + 0x100;
|
||||
LoadCompressedPalette(gSubstituteDollPal, palOffset, 32);
|
||||
}
|
||||
else if (!IsContest())
|
||||
else
|
||||
{
|
||||
if (!IsContest())
|
||||
{
|
||||
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
|
||||
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
@ -1021,6 +1023,7 @@ void BattleLoadSubstituteOrMonSpriteGfx(u8 battlerId, bool8 loadMonSprite)
|
||||
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battlerId]], battlerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LoadBattleMonGfxAndAnimate(u8 battlerId, bool8 loadMonSprite, u8 spriteId)
|
||||
{
|
||||
|
@ -127,7 +127,6 @@ static void HandleEndTurn_RanFromBattle(void);
|
||||
static void HandleEndTurn_MonFled(void);
|
||||
static void HandleEndTurn_FinishBattle(void);
|
||||
|
||||
|
||||
// EWRAM vars
|
||||
EWRAM_DATA u16 gBattle_BG0_X = 0;
|
||||
EWRAM_DATA u16 gBattle_BG0_Y = 0;
|
||||
@ -633,16 +632,19 @@ static void CB2_InitBattleInternal(void)
|
||||
gBattle_WIN0V = 0x5051;
|
||||
ScanlineEffect_Clear();
|
||||
|
||||
for (i = 0; i < 80; i++)
|
||||
i = 0;
|
||||
while (i < 80)
|
||||
{
|
||||
gScanlineEffectRegBuffers[0][i] = 0xF0;
|
||||
gScanlineEffectRegBuffers[1][i] = 0xF0;
|
||||
i++;
|
||||
}
|
||||
|
||||
for (; i < 160; i++)
|
||||
while (i < 160)
|
||||
{
|
||||
gScanlineEffectRegBuffers[0][i] = 0xFF10;
|
||||
gScanlineEffectRegBuffers[1][i] = 0xFF10;
|
||||
i++;
|
||||
}
|
||||
|
||||
ScanlineEffect_SetParams(sIntroScanlineParams16Bit);
|
||||
@ -769,7 +771,8 @@ static void SetPlayerBerryDataInBattleStruct(void)
|
||||
|
||||
static void SetAllPlayersBerryData(void)
|
||||
{
|
||||
s32 i, j;
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK))
|
||||
{
|
||||
@ -2685,7 +2688,8 @@ static void sub_80398BC(struct Sprite *sprite) // unused?
|
||||
|
||||
static void sub_80398D0(struct Sprite *sprite)
|
||||
{
|
||||
if (--sprite->data[4] == 0)
|
||||
sprite->data[4]--;
|
||||
if (sprite->data[4] == 0)
|
||||
{
|
||||
sprite->data[4] = 8;
|
||||
sprite->invisible ^= 1;
|
||||
@ -3416,13 +3420,17 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
|
||||
}
|
||||
}
|
||||
|
||||
if ((gBattleTypeFlags & BATTLE_TYPE_MULTI) && (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT || GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT))
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||
{
|
||||
if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT
|
||||
|| GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT)
|
||||
{
|
||||
BtlController_EmitDrawTrainerPic(0);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
}
|
||||
|
||||
if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT))
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS && GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT)
|
||||
{
|
||||
BtlController_EmitDrawTrainerPic(0);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
@ -3529,7 +3537,7 @@ static void BattleIntroPrintWildMonAttacked(void)
|
||||
|
||||
static void BattleIntroPrintOpponentSendsOut(void)
|
||||
{
|
||||
u8 position;
|
||||
u32 position;
|
||||
|
||||
if (gBattleControllerExecFlags)
|
||||
return;
|
||||
@ -3552,7 +3560,7 @@ static void BattleIntroPrintOpponentSendsOut(void)
|
||||
|
||||
static void BattleIntroOpponent2SendsOutMonAnimation(void)
|
||||
{
|
||||
u8 position;
|
||||
u32 position;
|
||||
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
|
||||
position = B_POSITION_OPPONENT_RIGHT;
|
||||
@ -3580,7 +3588,7 @@ static void BattleIntroOpponent2SendsOutMonAnimation(void)
|
||||
|
||||
static void BattleIntroOpponent1SendsOutMonAnimation(void)
|
||||
{
|
||||
u8 position;
|
||||
u32 position;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
||||
{
|
||||
@ -3595,9 +3603,7 @@ static void BattleIntroOpponent1SendsOutMonAnimation(void)
|
||||
position = B_POSITION_OPPONENT_LEFT;
|
||||
}
|
||||
else
|
||||
{
|
||||
position = B_POSITION_OPPONENT_LEFT;
|
||||
}
|
||||
|
||||
if (gBattleControllerExecFlags)
|
||||
return;
|
||||
@ -3639,7 +3645,7 @@ static void BattleIntroRecordMonsToDex(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_803B3AC(void) // unused
|
||||
void sub_803B3AC(void) // unused
|
||||
{
|
||||
if (gBattleControllerExecFlags == 0)
|
||||
gBattleMainFunc = BattleIntroPrintPlayerSendsOut;
|
||||
@ -3672,7 +3678,7 @@ static void BattleIntroPrintPlayerSendsOut(void)
|
||||
|
||||
static void BattleIntroPlayer2SendsOutMonAnimation(void)
|
||||
{
|
||||
u8 position;
|
||||
u32 position;
|
||||
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
|
||||
position = B_POSITION_PLAYER_RIGHT;
|
||||
@ -3704,7 +3710,7 @@ static void BattleIntroPlayer2SendsOutMonAnimation(void)
|
||||
|
||||
static void BattleIntroPlayer1SendsOutMonAnimation(void)
|
||||
{
|
||||
u8 position;
|
||||
u32 position;
|
||||
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
|
||||
position = B_POSITION_PLAYER_LEFT;
|
||||
@ -3742,7 +3748,7 @@ static void BattleIntroPlayer1SendsOutMonAnimation(void)
|
||||
gBattleMainFunc = TryDoEventsBeforeFirstTurn;
|
||||
}
|
||||
|
||||
static void sub_803B598(void) // unused
|
||||
void sub_803B598(void) // unused
|
||||
{
|
||||
if (gBattleControllerExecFlags == 0)
|
||||
{
|
||||
@ -3765,7 +3771,8 @@ static void sub_803B598(void) // unused
|
||||
|
||||
static void TryDoEventsBeforeFirstTurn(void)
|
||||
{
|
||||
s32 i, j;
|
||||
s32 i;
|
||||
s32 j;
|
||||
u8 effect = 0;
|
||||
|
||||
if (gBattleControllerExecFlags)
|
||||
@ -3955,7 +3962,11 @@ u8 IsRunningFromBattleImpossible(void)
|
||||
|
||||
gPotentialItemEffectBattler = gActiveBattler;
|
||||
|
||||
if ((holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN) || (gBattleTypeFlags & BATTLE_TYPE_LINK) || (gBattleMons[gActiveBattler].ability == ABILITY_RUN_AWAY))
|
||||
if (holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN)
|
||||
return 0;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||
return 0;
|
||||
if (gBattleMons[gActiveBattler].ability == ABILITY_RUN_AWAY)
|
||||
return 0;
|
||||
|
||||
side = GetBattlerSide(gActiveBattler);
|
||||
@ -4732,6 +4743,8 @@ static void SetActionsAndBattlersTurnOrder(void)
|
||||
gBattleStruct->focusPunchBattlerId = 0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++)
|
||||
{
|
||||
if (gChosenActionByBattler[gActiveBattler] == B_ACTION_USE_ITEM || gChosenActionByBattler[gActiveBattler] == B_ACTION_SWITCH)
|
||||
@ -4756,7 +4769,6 @@ static void SetActionsAndBattlersTurnOrder(void)
|
||||
{
|
||||
u8 battler1 = gBattlerByTurnOrder[i];
|
||||
u8 battler2 = gBattlerByTurnOrder[j];
|
||||
|
||||
if (gActionsByTurnOrder[i] != B_ACTION_USE_ITEM
|
||||
&& gActionsByTurnOrder[j] != B_ACTION_USE_ITEM
|
||||
&& gActionsByTurnOrder[i] != B_ACTION_SWITCH
|
||||
@ -4768,6 +4780,7 @@ static void SetActionsAndBattlersTurnOrder(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts;
|
||||
gBattleStruct->focusPunchBattlerId = 0;
|
||||
}
|
||||
@ -4841,8 +4854,8 @@ static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void)
|
||||
}
|
||||
|
||||
TryClearRageStatuses();
|
||||
gCurrentTurnActionNumber = 0; //See comment underneath
|
||||
gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber]; //Should be gActionsByTurnOrder[(gCurrentTurnActionNumber = 0)], but that doesn't match
|
||||
gCurrentTurnActionNumber = 0;
|
||||
gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber];
|
||||
gDynamicBasePower = 0;
|
||||
gBattleStruct->dynamicMoveType = 0;
|
||||
gBattleMainFunc = RunTurnActionsFunctions;
|
||||
@ -4865,12 +4878,15 @@ static void RunTurnActionsFunctions(void)
|
||||
gHitMarker &= ~(HITMARKER_x100000);
|
||||
gBattleMainFunc = sEndTurnFuncsTable[gBattleOutcome & 0x7F];
|
||||
}
|
||||
else if (gBattleStruct->savedTurnActionNumber != gCurrentTurnActionNumber) // action turn has been done, clear hitmarker bits for another battlerId
|
||||
else
|
||||
{
|
||||
if (gBattleStruct->savedTurnActionNumber != gCurrentTurnActionNumber) // action turn has been done, clear hitmarker bits for another battlerId
|
||||
{
|
||||
gHitMarker &= ~(HITMARKER_NO_ATTACKSTRING);
|
||||
gHitMarker &= ~(HITMARKER_UNABLE_TO_USE_MOVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void HandleEndTurn_BattleWon(void)
|
||||
{
|
||||
@ -4985,15 +5001,15 @@ static void HandleEndTurn_RanFromBattle(void)
|
||||
{
|
||||
switch (gProtectStructs[gBattlerAttacker].fleeFlag)
|
||||
{
|
||||
default:
|
||||
gBattlescriptCurrInstr = BattleScript_GotAwaySafely;
|
||||
break;
|
||||
case 1:
|
||||
gBattlescriptCurrInstr = BattleScript_SmokeBallEscape;
|
||||
break;
|
||||
case 2:
|
||||
gBattlescriptCurrInstr = BattleScript_RanAwayUsingMonAbility;
|
||||
break;
|
||||
default:
|
||||
gBattlescriptCurrInstr = BattleScript_GotAwaySafely;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5077,8 +5093,11 @@ static void FreeResetData_ReturnToOvOrDoEvolutions(void)
|
||||
gBattleMainFunc = ReturnFromBattleToOverworld;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleMainFunc = TryEvolvePokemon;
|
||||
}
|
||||
}
|
||||
|
||||
FreeAllWindowBuffers();
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK))
|
||||
@ -5172,4 +5191,3 @@ void RunBattleScriptCommands(void)
|
||||
if (gBattleControllerExecFlags == 0)
|
||||
gBattleScriptingCommandsTable[gBattlescriptCurrInstr[0]]();
|
||||
}
|
||||
|
||||
|
@ -2995,7 +2995,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId)
|
||||
printerTemplate.currentY = printerTemplate.y;
|
||||
printerTemplate.letterSpacing = textInfo[windowId].letterSpacing;
|
||||
printerTemplate.lineSpacing = textInfo[windowId].lineSpacing;
|
||||
printerTemplate.style = 0;
|
||||
printerTemplate.unk = 0;
|
||||
printerTemplate.fgColor = textInfo[windowId].fgColor;
|
||||
printerTemplate.bgColor = textInfo[windowId].bgColor;
|
||||
printerTemplate.shadowColor = textInfo[windowId].shadowColor;
|
||||
|
@ -522,19 +522,6 @@ static const u8 sTrainerTextGroups[50][2] =
|
||||
{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[] =
|
||||
{
|
||||
BattlePyramid_Text_ExitHintUp1,
|
||||
|
@ -3535,7 +3535,9 @@ static void Cmd_unknown_24(void)
|
||||
|
||||
if (gBattleOutcome == 0 && (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)))
|
||||
{
|
||||
s32 foundPlayer = 0, foundOpponent;
|
||||
s32 foundPlayer = 0;
|
||||
s32 foundOpponent;
|
||||
|
||||
for (i = 0; i < gBattlersCount; i += 2)
|
||||
{
|
||||
if ((gHitMarker & HITMARKER_FAINTED2(i)) && (!gSpecialStatuses[i].flag40))
|
||||
@ -3543,6 +3545,7 @@ static void Cmd_unknown_24(void)
|
||||
}
|
||||
|
||||
foundOpponent = 0;
|
||||
|
||||
for (i = 1; i < gBattlersCount; i += 2)
|
||||
{
|
||||
if ((gHitMarker & HITMARKER_FAINTED2(i)) && (!gSpecialStatuses[i].flag40))
|
||||
@ -3552,14 +3555,14 @@ static void Cmd_unknown_24(void)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||
{
|
||||
if (foundOpponent + foundPlayer > 1)
|
||||
gBattlescriptCurrInstr = (u8*) T2_READ_32(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = T2_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||
else
|
||||
gBattlescriptCurrInstr += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (foundOpponent != 0 && foundPlayer != 0)
|
||||
gBattlescriptCurrInstr = (u8*) T2_READ_32(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = T2_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||
else
|
||||
gBattlescriptCurrInstr += 5;
|
||||
}
|
||||
@ -4660,10 +4663,8 @@ static void Cmd_jumpifcantswitch(void)
|
||||
|| (gStatuses3[gActiveBattler] & STATUS3_ROOTED)))
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
|
||||
{
|
||||
#ifndef NONMATCHING
|
||||
asm("":::"r5");
|
||||
@ -5536,8 +5537,8 @@ static void Cmd_hitanimation(void)
|
||||
static u32 GetTrainerMoneyToGive(u16 trainerId)
|
||||
{
|
||||
u32 i = 0;
|
||||
u32 lastMonLevel = 0;
|
||||
u32 moneyReward;
|
||||
u8 lastMonLevel = 0;
|
||||
|
||||
if (trainerId == TRAINER_SECRET_BASE)
|
||||
{
|
||||
@ -6037,7 +6038,7 @@ static void PutLevelAndGenderOnLvlUpBox(void)
|
||||
printerTemplate.currentY = 0;
|
||||
printerTemplate.letterSpacing = 0;
|
||||
printerTemplate.lineSpacing = 0;
|
||||
printerTemplate.style = 0;
|
||||
printerTemplate.unk = 0;
|
||||
printerTemplate.fgColor = TEXT_COLOR_WHITE;
|
||||
printerTemplate.bgColor = TEXT_COLOR_TRANSPARENT;
|
||||
printerTemplate.shadowColor = TEXT_COLOR_DARK_GREY;
|
||||
@ -7128,6 +7129,7 @@ static void Cmd_forcerandomswitch(void)
|
||||
s32 i;
|
||||
s32 battler1PartyId = 0;
|
||||
s32 battler2PartyId = 0;
|
||||
|
||||
s32 firstMonId;
|
||||
s32 lastMonId = 0; // + 1
|
||||
s32 monsCount;
|
||||
@ -7249,10 +7251,11 @@ static void Cmd_forcerandomswitch(void)
|
||||
{
|
||||
i = Random() % monsCount;
|
||||
i += firstMonId;
|
||||
} while (i == battler2PartyId || i == battler1PartyId);
|
||||
}
|
||||
while (i == battler2PartyId || i == battler1PartyId);
|
||||
} while (GetMonData(&party[i], MON_DATA_SPECIES) == SPECIES_NONE
|
||||
|| 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); //should be one while loop, but that doesn't match.
|
||||
}
|
||||
*(gBattleStruct->monToSwitchIntoId + gBattlerTarget) = i;
|
||||
|
||||
|
@ -1446,7 +1446,7 @@ u8 GetFrontierOpponentClass(u16 trainerId)
|
||||
}
|
||||
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.
|
||||
return GetFrontierBrainTrainerClass();
|
||||
}
|
||||
else if (trainerId == TRAINER_STEVEN_PARTNER)
|
||||
{
|
||||
|
@ -3973,7 +3973,7 @@ static bool8 Phase2_FrontierLogoWave_Func4(struct Task *task)
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -714,15 +714,16 @@ void BattleTv_SetDataBasedOnAnimation(u8 animationId)
|
||||
|
||||
void TryPutLinkBattleTvShowOnAir(void)
|
||||
{
|
||||
u16 playerBestSpecies = 0, opponentBestSpecies = 0, moveId = 0;
|
||||
s16 sum = 0, playerBestSum = 0, opponentBestSum = SHRT_MAX;
|
||||
u16 playerBestSpecies = 0, opponentBestSpecies = 0;
|
||||
s16 playerBestSum = 0, opponentBestSum = SHRT_MAX;
|
||||
u8 playerBestMonId = 0, opponentBestMonId = 0;
|
||||
struct BattleTvMovePoints *movePoints = NULL;
|
||||
u8 countPlayer = 0, countOpponent = 0;
|
||||
u16 species;
|
||||
s16 sum = 0;
|
||||
u16 species = 0;
|
||||
u16 moveId = 0;
|
||||
s32 i, j;
|
||||
|
||||
int zero = 0, one = 1; // stupid variables needed to match. Feel free to get rid of them.
|
||||
int zero = 0, one = 1; //needed for matching
|
||||
|
||||
if (gBattleStruct->anyMonHasTransformed)
|
||||
return;
|
||||
|
@ -1,19 +1,31 @@
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "battle_util.h"
|
||||
#include "battle_anim.h"
|
||||
#include "battle_arena.h"
|
||||
#include "battle_pyramid.h"
|
||||
#include "battle_util.h"
|
||||
#include "pokemon.h"
|
||||
#include "international_string_util.h"
|
||||
#include "item.h"
|
||||
#include "util.h"
|
||||
#include "battle_scripts.h"
|
||||
#include "random.h"
|
||||
#include "text.h"
|
||||
#include "safari_zone.h"
|
||||
#include "sound.h"
|
||||
#include "sprite.h"
|
||||
#include "string_util.h"
|
||||
#include "task.h"
|
||||
#include "trig.h"
|
||||
#include "window.h"
|
||||
#include "battle_message.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "event_data.h"
|
||||
#include "link.h"
|
||||
#include "field_weather.h"
|
||||
#include "constants/abilities.h"
|
||||
#include "constants/battle_anim.h"
|
||||
#include "constants/battle_move_effects.h"
|
||||
#include "constants/battle_script_commands.h"
|
||||
#include "constants/battle_string_ids.h"
|
||||
@ -21,16 +33,16 @@
|
||||
#include "constants/hold_effects.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/moves.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"
|
||||
#include "constants/species.h"
|
||||
#include "constants/weather.h"
|
||||
|
||||
/*
|
||||
NOTE: The data and functions in this file up until (but not including) sSoundMovesTable
|
||||
are actually part of battle_main.c. They needed to be moved to this file in order to
|
||||
match the ROM; this is also why sSoundMovesTable's declaration is in the middle of
|
||||
functions instead of at the top of the file with the other declarations.
|
||||
*/
|
||||
|
||||
extern const u8 *const gBattleScriptsForMoveEffects[];
|
||||
extern const u8 *const gBattlescriptsForBallThrow[];
|
||||
@ -282,9 +294,7 @@ 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
|
||||
@ -310,18 +320,18 @@ void HandleAction_UseItem(void)
|
||||
break;
|
||||
case AI_ITEM_CURE_CONDITION:
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
if (*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) & 1)
|
||||
if (*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) & 1)
|
||||
{
|
||||
if (*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) & 0x3E)
|
||||
if (*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) & 0x3E)
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
while (!(*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) & 1))
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) >>= 1;
|
||||
*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) >>= 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER]++;
|
||||
} while (!(*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) & 1));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AI_ITEM_X_STAT:
|
||||
@ -337,7 +347,7 @@ void HandleAction_UseItem(void)
|
||||
|
||||
while (!((*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1))) & 1))
|
||||
{
|
||||
*(gBattleStruct->AI_itemFlags + (gBattlerAttacker >> 1)) >>= 1;
|
||||
*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) >>= 1;
|
||||
gBattleTextBuff1[2]++;
|
||||
}
|
||||
|
||||
@ -353,7 +363,7 @@ void HandleAction_UseItem(void)
|
||||
break;
|
||||
}
|
||||
|
||||
gBattlescriptCurrInstr = gBattlescriptsForUsingItem[*(gBattleStruct->AI_itemType + (gBattlerAttacker >> 1))];
|
||||
gBattlescriptCurrInstr = gBattlescriptsForUsingItem[*(gBattleStruct->AI_itemType + gBattlerAttacker / 2)];
|
||||
}
|
||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
||||
}
|
||||
|
@ -1331,7 +1331,7 @@ void ResetBerryTreeSparkleFlags(void)
|
||||
s16 bottom;
|
||||
int i;
|
||||
|
||||
GetCameraCoords((u16*)&cam_left, (u16*)&cam_top);
|
||||
GetCameraCoords(&cam_left, &cam_top);
|
||||
left = cam_left;
|
||||
top = cam_top + 3;
|
||||
right = cam_left + 14;
|
||||
|
@ -168,8 +168,8 @@ struct BerryBlender
|
||||
u16 progressBarValue;
|
||||
u16 maxProgressBarValue;
|
||||
u16 centerScale;
|
||||
s16 bg_X;
|
||||
s16 bg_Y;
|
||||
u16 bg_X;
|
||||
u16 bg_Y;
|
||||
u8 opponentTaskIds[BLENDER_MAX_PLAYERS - 1];
|
||||
u8 perfectOpponents; // for debugging, NPCs will always hit Best
|
||||
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
|
||||
static void RestoreBgCoords(void)
|
||||
{
|
||||
RestoreBgCoord((s16 *)&sBerryBlender->bg_X);
|
||||
RestoreBgCoord((s16 *)&sBerryBlender->bg_Y);
|
||||
RestoreBgCoord(&sBerryBlender->bg_X);
|
||||
RestoreBgCoord(&sBerryBlender->bg_Y);
|
||||
}
|
||||
|
||||
static void BlenderLandShakeBgCoord(s16* coord, u16 timer)
|
||||
{
|
||||
u8 strength;
|
||||
s32 strength;
|
||||
|
||||
if (timer < 10)
|
||||
strength = 16;
|
||||
|
@ -146,49 +146,38 @@ struct BerryCrushGame
|
||||
{
|
||||
MainCallback unk0;
|
||||
u32 (* unk4)(struct BerryCrushGame *, u8 *);
|
||||
|
||||
u8 unk8;
|
||||
u8 unk9;
|
||||
u8 unkA;
|
||||
u8 unkB;
|
||||
|
||||
u8 unkC;
|
||||
u8 unkD;
|
||||
|
||||
u8 unkE;
|
||||
u8 unkF;
|
||||
|
||||
u16 unk10;
|
||||
u16 unk12;
|
||||
u16 unk14;
|
||||
|
||||
u16 unk16;
|
||||
s16 unk18;
|
||||
s16 unk1A;
|
||||
s32 unk1C;
|
||||
int unk1C;
|
||||
s32 unk20;
|
||||
u8 unk24;
|
||||
|
||||
u8 unk25_0:1;
|
||||
u8 unk25_1:1;
|
||||
u8 unk25_2:1;
|
||||
u8 unk25_3:1;
|
||||
u8 unk25_4:1;
|
||||
u8 unk25_5:3;
|
||||
|
||||
u16 unk26;
|
||||
|
||||
u16 unk28;
|
||||
s16 unk2A;
|
||||
s16 unk2C;
|
||||
|
||||
s16 unk2E;
|
||||
s16 unk30;
|
||||
s16 unk32;
|
||||
s16 unk34;
|
||||
|
||||
u8 unk36[0xA];
|
||||
|
||||
struct BerryCrushGame_40 unk40;
|
||||
struct BerryCrushGame_5C unk5C;
|
||||
union BerryCrushGame_68 unk68;
|
||||
@ -215,7 +204,7 @@ void sub_8022524(struct BerryCrushGame_138 *, u16);
|
||||
void sub_8022B28(struct Sprite *);
|
||||
void sub_8022554(struct BerryCrushGame_138 *r0);
|
||||
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 u32 BerryCrushCommand_BeginNormalPaletteFade(struct BerryCrushGame *r6, u8 *r1);
|
||||
static u32 sub_8022CB0(struct BerryCrushGame *r4, u8 *r5);
|
||||
@ -2401,7 +2390,7 @@ void sub_802339C(struct BerryCrushGame *r4)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (r8 >= 2)
|
||||
if (r8 > 1)
|
||||
{
|
||||
for (r7 = 0; r7 < r4->unk9; ++r7)
|
||||
{
|
||||
@ -2591,7 +2580,6 @@ void sub_802385C(struct BerryCrushGame *r5)
|
||||
for (r4 = 0; r4 < r5->unk9; ++r4)
|
||||
r5->unk68.as_four_players.others[r4].unk4.as_2d_bytes[1][5] = 0;
|
||||
#endif
|
||||
|
||||
if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET
|
||||
|| gRecvCmds[0][1] != 2)
|
||||
{
|
||||
@ -3281,11 +3269,14 @@ static void BerryCrush_SetPaletteFadeParams(u8 *params, bool8 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[1] = r2;
|
||||
r0[2] = ((u8 *)&r3)[0];
|
||||
r0[3] = ((u8 *)&r3)[1];
|
||||
r0[2] = sp[0];
|
||||
r0[3] = sp[1];
|
||||
r0[4] = r5;
|
||||
}
|
||||
|
@ -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.
|
||||
{
|
||||
u8 i, j;
|
||||
u8 x, y;
|
||||
u8 i;
|
||||
u8 j;
|
||||
u8 x;
|
||||
u8 y;
|
||||
const u16 *_src;
|
||||
|
||||
for (i = 0, _src = src, y = top; i < height; i++)
|
||||
|
@ -3407,7 +3407,8 @@ static void GetAllChosenMoves(void)
|
||||
|
||||
static void RankContestants(void)
|
||||
{
|
||||
s32 i, j;
|
||||
s32 i;
|
||||
s32 j;
|
||||
s16 arr[CONTESTANT_COUNT];
|
||||
|
||||
for (i = 0; i < CONTESTANT_COUNT; i++)
|
||||
@ -3482,6 +3483,7 @@ static bool8 ContestantCanUseTurn(u8 contestant)
|
||||
{
|
||||
if (eContestantStatus[contestant].numTurnsSkipped != 0 || eContestantStatus[contestant].noMoreTurns)
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -3536,6 +3538,7 @@ bool8 Contest_IsMonsTurnDisabled(u8 contestant)
|
||||
{
|
||||
if (eContestantStatus[contestant].numTurnsSkipped != 0 || eContestantStatus[contestant].noMoreTurns)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -4479,7 +4482,9 @@ static void CalculateAppealMoveImpact(u8 contestant)
|
||||
eContestantStatus[contestant].comboAppealBonus = eContestantStatus[contestant].baseAppeal * eContestantStatus[contestant].completedCombo;
|
||||
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].usedComboMove = TRUE;
|
||||
@ -4489,6 +4494,7 @@ static void CalculateAppealMoveImpact(u8 contestant)
|
||||
eContestantStatus[contestant].hasJudgesAttention = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (eContestantStatus[contestant].repeatedMove)
|
||||
eContestantStatus[contestant].repeatJam = (eContestantStatus[contestant].moveRepeatCount + 1) * 10;
|
||||
|
||||
@ -5009,7 +5015,7 @@ static void ShowHideNextTurnGfx(bool8 show)
|
||||
{
|
||||
if (eContestantStatus[i].turnOrderMod != 0 && show)
|
||||
{
|
||||
CpuCopy32(GetTurnOrderNumberGfx(i), (void *)(VRAM + 0x10000 + (gSprites[eContestGfxState[i].nextTurnSpriteId].oam.tileNum + 6) * 32), 32);
|
||||
CpuCopy32(GetTurnOrderNumberGfx(i), (void *)(OBJ_VRAM0 + (gSprites[eContestGfxState[i].nextTurnSpriteId].oam.tileNum + 6) * 32), 32);
|
||||
gSprites[eContestGfxState[i].nextTurnSpriteId].pos1.y = sNextTurnSpriteYPositions[gContestantTurnOrder[i]];
|
||||
gSprites[eContestGfxState[i].nextTurnSpriteId].invisible = FALSE;
|
||||
}
|
||||
@ -5410,7 +5416,7 @@ static void Contest_PrintTextToBg0WindowStd(u32 windowId, const u8 *b)
|
||||
printerTemplate.currentY = 1;
|
||||
printerTemplate.letterSpacing = 0;
|
||||
printerTemplate.lineSpacing = 0;
|
||||
printerTemplate.style = 0;
|
||||
printerTemplate.unk = 0;
|
||||
printerTemplate.fgColor = 15;
|
||||
printerTemplate.bgColor = 0;
|
||||
printerTemplate.shadowColor = 8;
|
||||
@ -5433,7 +5439,7 @@ void Contest_PrintTextToBg0WindowAt(u32 windowId, u8 *currChar, s32 x, s32 y, s3
|
||||
printerTemplate.currentY = y;
|
||||
printerTemplate.letterSpacing = 0;
|
||||
printerTemplate.lineSpacing = 0;
|
||||
printerTemplate.style = 0;
|
||||
printerTemplate.unk = 0;
|
||||
printerTemplate.fgColor = 15;
|
||||
printerTemplate.bgColor = 0;
|
||||
printerTemplate.shadowColor = 8;
|
||||
@ -5457,7 +5463,7 @@ static void Contest_StartTextPrinter(const u8 *currChar, bool32 b)
|
||||
printerTemplate.currentY = 1;
|
||||
printerTemplate.letterSpacing = 0;
|
||||
printerTemplate.lineSpacing = 0;
|
||||
printerTemplate.style = 0;
|
||||
printerTemplate.unk = 0;
|
||||
printerTemplate.fgColor = 1;
|
||||
printerTemplate.bgColor = 0;
|
||||
printerTemplate.shadowColor = 8;
|
||||
@ -6092,4 +6098,3 @@ void StripPlayerAndMonNamesForLinkContest(struct ContestPokemon *mon, s32 langua
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -397,16 +397,16 @@ static void _InitContestMonPixels(u8 *spriteGfx, u16 *palette, u16 (*destPixels)
|
||||
{
|
||||
for (pixelX = 0; pixelX < 8; pixelX++)
|
||||
{
|
||||
colorIndex = spriteGfx[((tileY * 8) + tileX) * 32 + (pixelY << 2) + (pixelX >> 1)];
|
||||
colorIndex = spriteGfx[32 * (tileY * 8 + tileX) + (pixelY << 2) + (pixelX >> 1)];
|
||||
if (pixelX & 1)
|
||||
colorIndex >>= 4;
|
||||
else
|
||||
colorIndex &= 0xF; // %=16 works here too. Both match
|
||||
colorIndex &= 0xF;
|
||||
|
||||
if (colorIndex == 0) // transparent pixel
|
||||
(*destPixels)[tileY * 8 + pixelY][tileX * 8 + pixelX] = 0x8000;
|
||||
(*destPixels)[8 * tileY + pixelY][tileX * 8 + pixelX] = 0x8000;
|
||||
else
|
||||
(*destPixels)[tileY * 8 + pixelY][tileX * 8 + pixelX] = palette[colorIndex];
|
||||
(*destPixels)[8 * tileY + pixelY][tileX * 8 + pixelX] = palette[colorIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -501,7 +501,6 @@ static void LoadContestPaintingFrame(u8 contestWinnerId, bool8 arg1)
|
||||
|
||||
static void InitPaintingMonOamData(u8 contestWinnerId)
|
||||
{
|
||||
|
||||
gMain.oamBuffer[0] = sContestPaintingMonOamData;
|
||||
gMain.oamBuffer[0].tileNum = 0;
|
||||
|
||||
@ -512,7 +511,7 @@ static void InitPaintingMonOamData(u8 contestWinnerId)
|
||||
}
|
||||
else
|
||||
{
|
||||
gMain.oamBuffer[0].x = 88; // Duplicated Code
|
||||
gMain.oamBuffer[0].x = 88; // Duplicated code
|
||||
gMain.oamBuffer[0].y = 24;
|
||||
}
|
||||
}
|
||||
|
@ -1151,12 +1151,12 @@ static void TryCreateWirelessSprites(void)
|
||||
static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
|
||||
{
|
||||
u16 windowId;
|
||||
s32 origWidth, strWidth;
|
||||
int origWidth;
|
||||
int strWidth;
|
||||
u8 *spriteTilePtrs[4];
|
||||
u8 *dst;
|
||||
|
||||
{
|
||||
struct WindowTemplate windowTemplate; //It's important the lifetime of this struct ends after the clear
|
||||
struct WindowTemplate windowTemplate;
|
||||
memset(&windowTemplate, 0, sizeof(windowTemplate));
|
||||
windowTemplate.width = 30;
|
||||
windowTemplate.height = 2;
|
||||
@ -1165,23 +1165,23 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
|
||||
}
|
||||
|
||||
origWidth = GetStringWidth(1, text, 0);
|
||||
if ((strWidth = (origWidth + 9) / 8) > 30)
|
||||
strWidth = (origWidth + 9) / 8;
|
||||
if (strWidth > 30)
|
||||
strWidth = 30;
|
||||
|
||||
AddTextPrinterParameterized3(windowId, 1, (strWidth * 8 - origWidth) / 2, 1, sContestLinkTextColors, -1, text);
|
||||
|
||||
{
|
||||
s32 i;
|
||||
struct Sprite *sprite;
|
||||
const u8 *src, *windowTilesPtr;
|
||||
windowTilesPtr = (const u8 *)(GetWindowAttribute(windowId, WINDOW_TILE_DATA));
|
||||
src = sUnknown_0858D6D0;
|
||||
windowTilesPtr = (u8 *)(GetWindowAttribute(windowId, WINDOW_TILE_DATA));
|
||||
src = (u8 *)(sUnknown_0858D6D0);
|
||||
|
||||
sprite = &gSprites[spriteId];
|
||||
spriteTilePtrs[0] = (u8 *)((OBJ_VRAM0) + sprite->oam.tileNum * 32);
|
||||
spriteTilePtrs[0] = (u8 *)(sprite->oam.tileNum * 32 + OBJ_VRAM0);
|
||||
|
||||
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 + OBJ_VRAM0);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
CpuFill32(0, spriteTilePtrs[i], 0x400);
|
||||
@ -1922,7 +1922,7 @@ static void AddContestTextPrinter(int windowId, u8 *str, int x)
|
||||
textPrinter.currentY = 2;
|
||||
textPrinter.letterSpacing = 0;
|
||||
textPrinter.lineSpacing = 0;
|
||||
textPrinter.style = 0;
|
||||
textPrinter.unk = 0;
|
||||
textPrinter.fgColor = 1;
|
||||
textPrinter.bgColor = 0;
|
||||
textPrinter.shadowColor = 8;
|
||||
|
@ -1185,7 +1185,7 @@ static void DaycareAddTextPrinter(u8 windowId, const u8 *text, u32 x, u32 y)
|
||||
printer.y = y;
|
||||
printer.currentX = x;
|
||||
printer.currentY = y;
|
||||
printer.style = 0;
|
||||
printer.unk = 0;
|
||||
gTextFlags.useAlternateDownArrow = 0;
|
||||
printer.letterSpacing = 0;
|
||||
printer.lineSpacing = 1;
|
||||
|
@ -219,10 +219,9 @@ void BufferTrendyPhraseString(void)
|
||||
ConvertEasyChatWordsToString(gStringVar1, s->words, 2, 1);
|
||||
}
|
||||
|
||||
|
||||
void TrendyPhraseIsOld(void)
|
||||
{
|
||||
u8 result = 0;
|
||||
u16 result = 0;
|
||||
|
||||
do
|
||||
{
|
||||
@ -249,46 +248,46 @@ static bool8 sub_8122A58(struct EasyChatPair *a, struct EasyChatPair *b, u8 c)
|
||||
{
|
||||
case 0:
|
||||
if (a->unk0_0 > b->unk0_0)
|
||||
return TRUE;
|
||||
return 1;
|
||||
if (a->unk0_0 < b->unk0_0)
|
||||
return FALSE;
|
||||
return 0;
|
||||
if (a->unk0_7 > b->unk0_7)
|
||||
return TRUE;
|
||||
return 1;
|
||||
if (a->unk0_7 < b->unk0_7)
|
||||
return FALSE;
|
||||
return 0;
|
||||
break;
|
||||
case 1:
|
||||
if (a->unk0_7 > b->unk0_7)
|
||||
return TRUE;
|
||||
return 1;
|
||||
if (a->unk0_7 < b->unk0_7)
|
||||
return FALSE;
|
||||
return 0;
|
||||
if (a->unk0_0 > b->unk0_0)
|
||||
return TRUE;
|
||||
return 1;
|
||||
if (a->unk0_0 < b->unk0_0)
|
||||
return FALSE;
|
||||
return 0;
|
||||
break;
|
||||
case 2:
|
||||
if (a->unk0_0 > b->unk0_0)
|
||||
return TRUE;
|
||||
return 1;
|
||||
if (a->unk0_0 < b->unk0_0)
|
||||
return FALSE;
|
||||
return 0;
|
||||
if (a->unk0_7 > b->unk0_7)
|
||||
return TRUE;
|
||||
return 1;
|
||||
if (a->unk0_7 < b->unk0_7)
|
||||
return FALSE;
|
||||
return 0;
|
||||
if (a->unk2 > b->unk2)
|
||||
return TRUE;
|
||||
return 1;
|
||||
if (a->unk2 < b->unk2)
|
||||
return FALSE;
|
||||
return 0;
|
||||
if (a->words[0] > b->words[0])
|
||||
return TRUE;
|
||||
return 1;
|
||||
if (a->words[0] < b->words[0])
|
||||
return FALSE;
|
||||
return 0;
|
||||
if (a->words[1] > b->words[1])
|
||||
return TRUE;
|
||||
return 1;
|
||||
if (a->words[1] < b->words[1])
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
return Random() & 1;
|
||||
}
|
||||
|
@ -1613,26 +1613,26 @@ static u16 sub_811ACDC(void)
|
||||
{
|
||||
return sub_811B150();
|
||||
}
|
||||
if (JOY_NEW(START_BUTTON))
|
||||
else if (JOY_NEW(START_BUTTON))
|
||||
{
|
||||
return sub_811B1B4();
|
||||
}
|
||||
if (JOY_NEW(DPAD_UP))
|
||||
else if (JOY_NEW(DPAD_UP))
|
||||
{
|
||||
sEasyChatScreen->mainCursorRow--;
|
||||
break;
|
||||
}
|
||||
if (JOY_NEW(DPAD_LEFT))
|
||||
else if (JOY_NEW(DPAD_LEFT))
|
||||
{
|
||||
sEasyChatScreen->mainCursorColumn--;
|
||||
break;
|
||||
}
|
||||
if (JOY_NEW(DPAD_DOWN))
|
||||
else if (JOY_NEW(DPAD_DOWN))
|
||||
{
|
||||
sEasyChatScreen->mainCursorRow = 0;
|
||||
break;
|
||||
}
|
||||
if (JOY_NEW(DPAD_RIGHT))
|
||||
else if (JOY_NEW(DPAD_RIGHT))
|
||||
{
|
||||
sEasyChatScreen->mainCursorColumn++;
|
||||
break;
|
||||
@ -2536,7 +2536,7 @@ u8 sub_811BBBC(void)
|
||||
return sEasyChatScreen->unk_0c;
|
||||
}
|
||||
|
||||
static void sub_811BBC8(s8 *arg0, s8 *arg1)
|
||||
void sub_811BBC8(u8 *arg0, u8 *arg1)
|
||||
{
|
||||
*arg0 = sEasyChatScreen->unk_10;
|
||||
*arg1 = sEasyChatScreen->unk_11;
|
||||
@ -4528,19 +4528,19 @@ static void sub_811E30C(void)
|
||||
x = var0 * 13;
|
||||
x = x * 8 + 28;
|
||||
y = var1 * 16 + 96;
|
||||
sub_811E34C((u8)x, (u8)y);
|
||||
sub_811E34C(x, y);
|
||||
}
|
||||
|
||||
static void sub_811E34C(u8 x, u8 y)
|
||||
{
|
||||
if (!sUnknown_0203A11C->unk2E4)
|
||||
return;
|
||||
|
||||
sUnknown_0203A11C->unk2E4->pos1.x = (s16)x;
|
||||
sUnknown_0203A11C->unk2E4->pos1.y = (s16)y;
|
||||
if (sUnknown_0203A11C->unk2E4)
|
||||
{
|
||||
sUnknown_0203A11C->unk2E4->pos1.x = x;
|
||||
sUnknown_0203A11C->unk2E4->pos1.y = y;
|
||||
sUnknown_0203A11C->unk2E4->pos2.x = 0;
|
||||
sUnknown_0203A11C->unk2E4->data[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_811E380(void)
|
||||
{
|
||||
|
@ -1235,7 +1235,7 @@ static u8 InitObjectEventStateFromTemplate(struct ObjectEventTemplate *template,
|
||||
objectEvent->range.as_nybbles.x = template->movementRangeX;
|
||||
objectEvent->range.as_nybbles.y = template->movementRangeY;
|
||||
objectEvent->trainerType = template->trainerType;
|
||||
objectEvent->mapNum = mapNum; //redundant, but needed to match
|
||||
objectEvent->mapNum = mapNum;
|
||||
objectEvent->trainerRange_berryTreeId = template->trainerRange_berryTreeId;
|
||||
objectEvent->previousMovementDirection = gInitialMovementTypeFacingDirections[template->movementType];
|
||||
SetObjectEventDirection(objectEvent, objectEvent->previousMovementDirection);
|
||||
@ -8216,7 +8216,8 @@ bool8 FreezeObjectEvent(struct ObjectEvent *objectEvent)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
objectEvent->frozen = 1;
|
||||
objectEvent->spriteAnimPausedBackup = gSprites[objectEvent->spriteId].animPaused;
|
||||
objectEvent->spriteAffineAnimPausedBackup = gSprites[objectEvent->spriteId].affineAnimPaused;
|
||||
@ -8224,6 +8225,7 @@ bool8 FreezeObjectEvent(struct ObjectEvent *objectEvent)
|
||||
gSprites[objectEvent->spriteId].affineAnimPaused = 1;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void FreezeObjectEvents(void)
|
||||
{
|
||||
@ -8395,7 +8397,7 @@ bool8 sub_80976EC(struct Sprite *sprite)
|
||||
|
||||
if (sprite->data[5] > 15)
|
||||
return TRUE;
|
||||
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -8476,15 +8478,15 @@ static bool8 AnimateSpriteInFigure8(struct Sprite *sprite)
|
||||
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
|
||||
};
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
@ -8564,8 +8566,11 @@ static void SetMovementDelay(struct Sprite *sprite, s16 timer)
|
||||
|
||||
static bool8 WaitForMovementDelay(struct Sprite *sprite)
|
||||
{
|
||||
if (--sprite->data[3] == 0)
|
||||
sprite->data[3]--;
|
||||
|
||||
if (sprite->data[3] == 0)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -8580,6 +8585,7 @@ bool8 SpriteAnimEnded(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->animEnded)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -8759,14 +8765,14 @@ static void UpdateObjectEventSpritePosition(struct Sprite *sprite)
|
||||
{
|
||||
switch(sprite->tAnimNum)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case UNION_ROOM_SPAWN_IN:
|
||||
MoveUnionRoomObjectDown(sprite);
|
||||
break;
|
||||
case UNION_ROOM_SPAWN_OUT:
|
||||
MoveUnionRoomObjectUp(sprite);
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
sprite->tAnimNum = 0;
|
||||
break;
|
||||
@ -8835,7 +8841,7 @@ u8 (*const gMovementActionFuncs_FlyDown[])(struct ObjectEvent *, struct Sprite *
|
||||
|
||||
u8 MovementAction_StoreAndLockAnim_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
bool8 ableToStore = FALSE;
|
||||
bool32 ableToStore = FALSE;
|
||||
if (gLockedAnimObjectEvents == NULL)
|
||||
{
|
||||
gLockedAnimObjectEvents = AllocZeroed(sizeof(struct LockedAnimObjectEvents));
|
||||
@ -8845,8 +8851,9 @@ u8 MovementAction_StoreAndLockAnim_Step0(struct ObjectEvent *objectEvent, struct
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 i, firstFreeSlot;
|
||||
bool8 found;
|
||||
u8 i;
|
||||
u8 firstFreeSlot;
|
||||
bool32 found;
|
||||
for (firstFreeSlot = 16, found = FALSE, i = 0; i < 16; i++)
|
||||
{
|
||||
if (firstFreeSlot == 16 && gLockedAnimObjectEvents->objectEventIds[i] == 0)
|
||||
@ -8879,7 +8886,7 @@ u8 MovementAction_StoreAndLockAnim_Step0(struct ObjectEvent *objectEvent, struct
|
||||
|
||||
u8 MovementAction_FreeAndUnlockAnim_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
bool8 ableToStore;
|
||||
bool32 ableToStore;
|
||||
u8 index;
|
||||
|
||||
sprite->data[2] = 1;
|
||||
@ -8923,7 +8930,7 @@ void CreateLevitateMovementTask(struct ObjectEvent *objectEvent)
|
||||
u8 taskId = CreateTask(ApplyLevitateMovement, 0xFF);
|
||||
struct Task *task = &gTasks[taskId];
|
||||
|
||||
StoreWordInTwoHalfwords((u16 *)&task->data[0], (u32)objectEvent);
|
||||
StoreWordInTwoHalfwords(&task->data[0], (u32)objectEvent);
|
||||
objectEvent->warpArrowSpriteId = taskId;
|
||||
task->data[3] = 0xFFFF;
|
||||
}
|
||||
@ -8934,7 +8941,7 @@ static void ApplyLevitateMovement(u8 taskId)
|
||||
struct Sprite *sprite;
|
||||
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];
|
||||
|
||||
if(!(task->data[2] & 0x3))
|
||||
@ -8951,7 +8958,7 @@ void DestroyExtraMovementTask(u8 taskId)
|
||||
struct ObjectEvent *objectEvent;
|
||||
struct Task *task = &gTasks[taskId];
|
||||
|
||||
LoadWordFromTwoHalfwords((u16 *)&task->data[0], (u32 *)&objectEvent); // unused objectEvent
|
||||
LoadWordFromTwoHalfwords(&task->data[0], (u32 *)&objectEvent); // unused objectEvent
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
|
@ -181,8 +181,9 @@ u32 GetMewMoveDirection(void)
|
||||
{
|
||||
if (ShouldMewMoveEast(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
if (ShouldMewMoveWest(mew, 1))
|
||||
else if (ShouldMewMoveWest(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
else
|
||||
return DIR_NORTH;
|
||||
}
|
||||
|
||||
@ -190,8 +191,9 @@ u32 GetMewMoveDirection(void)
|
||||
{
|
||||
if (ShouldMewMoveEast(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
if (ShouldMewMoveWest(mew, 1))
|
||||
else if (ShouldMewMoveWest(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
else
|
||||
return DIR_SOUTH;
|
||||
}
|
||||
|
||||
@ -199,8 +201,9 @@ u32 GetMewMoveDirection(void)
|
||||
{
|
||||
if (ShouldMewMoveNorth(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
if (ShouldMewMoveSouth(mew, 1))
|
||||
else if (ShouldMewMoveSouth(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
else
|
||||
return DIR_EAST;
|
||||
}
|
||||
|
||||
@ -208,8 +211,9 @@ u32 GetMewMoveDirection(void)
|
||||
{
|
||||
if (ShouldMewMoveNorth(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
if (ShouldMewMoveSouth(mew, 1))
|
||||
else if (ShouldMewMoveSouth(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
else
|
||||
return DIR_WEST;
|
||||
}
|
||||
|
||||
@ -311,6 +315,7 @@ static u8 GetValidMewMoveDirection(u8 ignoredDir)
|
||||
|
||||
if (count > 1)
|
||||
return sMewDirectionCandidates[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % count];
|
||||
else
|
||||
return sMewDirectionCandidates[0];
|
||||
}
|
||||
|
||||
|
@ -2597,7 +2597,7 @@ static void FieldMoveShowMonOutdoorsEffect_Init(struct Task *task)
|
||||
{
|
||||
task->data[11] = REG_WININ;
|
||||
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->tWinVert = WIN_RANGE(DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 2 + 1);
|
||||
task->tWinIn = WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR;
|
||||
|
@ -227,7 +227,9 @@ bool8 SetUpFieldMove_Cut(void)
|
||||
y = gPlayerFacingPosition.y + sHyperCutStruct[i].y;
|
||||
tileCuttable = TRUE;
|
||||
|
||||
for (j = 0; j < 2; ++j) {
|
||||
j = 0;
|
||||
do
|
||||
{
|
||||
if (sHyperCutStruct[i].unk2[j] == 0)
|
||||
break;
|
||||
if (cutTiles[(u8)(sHyperCutStruct[i].unk2[j] - 1)] == FALSE)
|
||||
@ -235,7 +237,7 @@ bool8 SetUpFieldMove_Cut(void)
|
||||
tileCuttable = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (++j <= 1);
|
||||
|
||||
if (tileCuttable == TRUE)
|
||||
{
|
||||
@ -251,11 +253,14 @@ bool8 SetUpFieldMove_Cut(void)
|
||||
sHyperCutTiles[tileArrayId] = TRUE;
|
||||
ret = TRUE;
|
||||
}
|
||||
else if (MetatileBehavior_IsCuttableGrass(tileBehavior) == TRUE)
|
||||
else
|
||||
{
|
||||
if (MetatileBehavior_IsCuttableGrass(tileBehavior) == TRUE)
|
||||
sHyperCutTiles[tileArrayId] = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == TRUE)
|
||||
{
|
||||
|
@ -1209,7 +1209,7 @@ static void sub_80C6104(u8 cursorArea, u8 previousCursorArea)
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, sPassGfx->unk28 + 72, 2, 10, 12, 3, 17);
|
||||
else
|
||||
return;
|
||||
break; // needed
|
||||
break; //needed to match
|
||||
case CURSOR_AREA_CANCEL:
|
||||
CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_08DE3374, 21, 0, 9, 2, 17);
|
||||
break;
|
||||
|
@ -2507,11 +2507,12 @@ void CreateFrontierBrainPokemon(void)
|
||||
{
|
||||
if (!(selectedMonBits & 1))
|
||||
continue;
|
||||
|
||||
do
|
||||
{
|
||||
do
|
||||
{
|
||||
j = Random32(); //Should be one while loop, but that doesn't match
|
||||
j = Random32(); //should just 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],
|
||||
|
16
src/item.c
16
src/item.c
@ -183,13 +183,15 @@ bool8 HasAtLeastOneBerry(void)
|
||||
|
||||
bool8 CheckBagHasSpace(u16 itemId, u16 count)
|
||||
{
|
||||
u8 i, pocket;
|
||||
u16 slotCapacity, ownedCount;
|
||||
u8 i;
|
||||
u8 pocket;
|
||||
u16 slotCapacity;
|
||||
u16 ownedCount;
|
||||
|
||||
if (ItemId_GetPocket(itemId) == POCKET_NONE)
|
||||
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);
|
||||
}
|
||||
@ -212,12 +214,12 @@ bool8 CheckBagHasSpace(u16 itemId, u16 count)
|
||||
return FALSE;
|
||||
count -= (slotCapacity - ownedCount);
|
||||
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
|
||||
break; //should be return TRUE, but that doesn't match
|
||||
}
|
||||
}
|
||||
|
||||
// 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++)
|
||||
{
|
||||
@ -231,12 +233,12 @@ bool8 CheckBagHasSpace(u16 itemId, u16 count)
|
||||
}
|
||||
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
|
||||
count = 0; //should be return TRUE, but that doesn't match
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count > 0) //if (count !=0) also works here; both match
|
||||
if (count > 0)
|
||||
return FALSE; // No more item slots. The bag is full
|
||||
}
|
||||
|
||||
|
@ -628,6 +628,7 @@ void CB2_Bag(void)
|
||||
|
||||
bool8 SetupBagMenu(void)
|
||||
{
|
||||
u32 index;
|
||||
u8 taskId;
|
||||
|
||||
switch (gMain.state)
|
||||
@ -1228,12 +1229,12 @@ static u8 GetSwitchBagPocketDirection(void)
|
||||
if (gBagMenu->pocketSwitchDisabled)
|
||||
return SWITCH_POCKET_NONE;
|
||||
LRKeys = GetLRKeysPressed();
|
||||
if (JOY_NEW(DPAD_LEFT) || LRKeys == MENU_L_PRESSED)
|
||||
if ((JOY_NEW(DPAD_LEFT)) || LRKeys == MENU_L_PRESSED)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
return SWITCH_POCKET_LEFT;
|
||||
}
|
||||
if (JOY_NEW(DPAD_RIGHT) || LRKeys == MENU_R_PRESSED)
|
||||
if ((JOY_NEW(DPAD_RIGHT)) || LRKeys == MENU_R_PRESSED)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
return SWITCH_POCKET_RIGHT;
|
||||
@ -1668,7 +1669,7 @@ void Task_HandleOutOfBattleItemMenuInput(u8 taskId)
|
||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_LEFT, MENU_CURSOR_DELTA_NONE);
|
||||
}
|
||||
}
|
||||
else if (JOY_NEW(DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
|
||||
else if ((JOY_NEW(DPAD_RIGHT)) || GetLRKeysPressed() == MENU_R_PRESSED)
|
||||
{
|
||||
if (!(cursorPos & 1) && sub_81ACDFC(cursorPos + 1))
|
||||
{
|
||||
|
@ -721,7 +721,7 @@ static void ItemUseOnFieldCB_WailmerPailBerry(u8 taskId)
|
||||
|
||||
static bool8 TryToWaterSudowoodo(void)
|
||||
{
|
||||
s16 x, y;
|
||||
u16 x, y;
|
||||
u8 z;
|
||||
u8 objId;
|
||||
GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
|
||||
|
@ -875,7 +875,8 @@ static void sub_800F498(u16 *a0, u8 *a1)
|
||||
|
||||
static bool32 RfuProcessEnqueuedRecvBlock(void)
|
||||
{
|
||||
u8 i, j;
|
||||
u8 i;
|
||||
u8 j;
|
||||
u8 sp00[MAX_RFU_PLAYERS * (2 * (CMD_LENGTH - 1))];
|
||||
u8 sp48[2 * (CMD_LENGTH - 1)];
|
||||
u8 status;
|
||||
@ -932,14 +933,13 @@ static void HandleSendFailure(u8 unused, u32 flags)
|
||||
for (j = 0; j < 7; j++)
|
||||
{
|
||||
temp = j << 1;
|
||||
sResendBlock16[j + 1] = (r10[i * 12 + temp + 1] << 8) | r10[i * 12 + temp];
|
||||
sResendBlock16[j + 1] = (r10[12 * i + temp + 1] << 8) | r10[12 * i + temp + 0];
|
||||
}
|
||||
|
||||
for (j = 0; j < 7; j++)
|
||||
{
|
||||
temp = j << 1;
|
||||
sResendBlock8[temp + 1] = sResendBlock16[j] >> 8;
|
||||
sResendBlock8[temp + 0] = sResendBlock16[j] & 0xff;
|
||||
sResendBlock8[temp + 0] = sResendBlock16[j];
|
||||
}
|
||||
RfuSendQueue_Enqueue(&Rfu.sendQueue, sResendBlock8);
|
||||
Rfu.sendBlock.failedFlags |= (1 << i);
|
||||
@ -1023,7 +1023,8 @@ void Rfu_SetBerryBlenderLinkCallback(void)
|
||||
|
||||
static void RfuHandleReceiveCommand(u8 unused)
|
||||
{
|
||||
u16 i, j;
|
||||
u16 i;
|
||||
u16 j;
|
||||
|
||||
for (i = 0; i < MAX_RFU_PLAYERS; i++)
|
||||
{
|
||||
@ -1037,7 +1038,7 @@ static void RfuHandleReceiveCommand(u8 unused)
|
||||
if (gRfuLinkStatus->parentChild == MODE_CHILD)
|
||||
{
|
||||
Rfu.playerCount = gRecvCmds[i][1];
|
||||
Rfu.multiplayerId = sub_800F74C((u8 *)(&gRecvCmds[i][2]));
|
||||
Rfu.multiplayerId = sub_800F74C((u8 *)(gRecvCmds[i] + 2));
|
||||
}
|
||||
break;
|
||||
case RFUCMD_0x8800:
|
||||
@ -1236,9 +1237,10 @@ void Rfu_SendPacket(void *data)
|
||||
bool32 Rfu_InitBlockSend(const u8 *src, size_t size)
|
||||
{
|
||||
bool8 r4;
|
||||
if (Rfu.callback != NULL || gSendCmd[0] != 0)
|
||||
if (Rfu.callback != NULL)
|
||||
return FALSE;
|
||||
if (gSendCmd[0] != 0)
|
||||
return FALSE;
|
||||
|
||||
if (Rfu.sendBlock.sending)
|
||||
{
|
||||
sRfuDebug.unk_83++;
|
||||
@ -1416,13 +1418,17 @@ void Rfu_SetCloseLinkCallback(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);
|
||||
Rfu.resendExitStandbyTimer = 0;
|
||||
}
|
||||
}
|
||||
playerCount = GetLinkPlayerCount();
|
||||
for (i = 0; i < playerCount; i++)
|
||||
{
|
||||
@ -1451,7 +1457,8 @@ static void LinkLeaderReadyToExitStandby(void)
|
||||
// RFU equivalent of LinkCB_Standby and LinkCB_StandbyForAll
|
||||
static void Rfu_LinkStandby(void)
|
||||
{
|
||||
u8 i, playerCount;
|
||||
u8 i;
|
||||
u8 playerCount;
|
||||
|
||||
if (GetMultiplayerId() != 0)
|
||||
{
|
||||
@ -1547,12 +1554,9 @@ static bool8 CheckForLeavingGroupMembers(void)
|
||||
bool8 memberLeft = FALSE;
|
||||
for (i = 0; i < RFU_CHILD_MAX; i++)
|
||||
{
|
||||
if (Rfu.partnerSendStatuses[i] == RFU_STATUS_JOIN_GROUP_OK
|
||||
|| Rfu.partnerSendStatuses[i] == RFU_STATUS_JOIN_GROUP_NO)
|
||||
if (Rfu.partnerSendStatuses[i] < RFU_STATUS_JOIN_GROUP_OK
|
||||
|| Rfu.partnerSendStatuses[i] > RFU_STATUS_JOIN_GROUP_NO)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (gRfuSlotStatusNI[i]->recv.state == SLOT_STATE_RECV_SUCCESS
|
||||
|| gRfuSlotStatusNI[i]->recv.state == SLOT_STATE_RECV_SUCCESS_AND_SENDSIDE_UNKNOWN)
|
||||
{
|
||||
@ -1564,10 +1568,13 @@ static bool8 CheckForLeavingGroupMembers(void)
|
||||
rfu_NI_setSendData(1 << i, 8, &Rfu.partnerSendStatuses[i], 1);
|
||||
memberLeft = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
else if (gRfuSlotStatusNI[Rfu.childSlot]->recv.state == SLOT_STATE_RECV_FAILED)
|
||||
{
|
||||
rfu_clearSlot(TYPE_NI_RECV, i);
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return memberLeft;
|
||||
@ -2043,7 +2050,8 @@ void sub_80110B8(u32 a0)
|
||||
if ((r8 >> i) & 1)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -2088,7 +2096,8 @@ static void sub_80111FC(void)
|
||||
|
||||
static void sub_801120C(u8 msg, u8 paramCount)
|
||||
{
|
||||
u8 i, disconnectFlag = 0;
|
||||
u8 i;
|
||||
u8 disconnectFlag = 0;
|
||||
switch (msg)
|
||||
{
|
||||
case LMAN_MSG_INITIALIZE_COMPLETED:
|
||||
|
@ -309,7 +309,8 @@ static const struct SpriteTemplate sWirelessStatusIndicatorSpriteTemplate = {
|
||||
|
||||
void RfuRecvQueue_Reset(struct RfuRecvQueue *queue)
|
||||
{
|
||||
s32 i, j;
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
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)
|
||||
{
|
||||
s32 i, j;
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
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)
|
||||
{
|
||||
s32 i, j;
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
for (i = 0; i < UNUSED_QUEUE_NUM_SLOTS; i++)
|
||||
{
|
||||
@ -623,32 +626,30 @@ static void ASCIIToPkmnStr(u8 *pkmnStr, const u8 *asciiStr)
|
||||
static u8 GetConnectedChildStrength(u8 maxFlags)
|
||||
{
|
||||
u8 flagCount = 0;
|
||||
u8 flags = gRfuLinkStatus->connSlotFlag;
|
||||
u32 flags = gRfuLinkStatus->connSlotFlag;
|
||||
u8 i;
|
||||
|
||||
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 (maxFlags == flagCount + 1)
|
||||
{
|
||||
return gRfuLinkStatus->strength[i];
|
||||
break; // This break is needed to match
|
||||
break;
|
||||
}
|
||||
flagCount++;
|
||||
}
|
||||
flags >>= 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < 4; flags >>= 1, i++)
|
||||
{
|
||||
if (flags & 1)
|
||||
return gRfuLinkStatus->strength[i];
|
||||
flags >>= 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -922,7 +923,8 @@ void RecordMixTrainerNames(void)
|
||||
{
|
||||
if (gWirelessCommType != 0)
|
||||
{
|
||||
s32 i, j;
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 nextSpace;
|
||||
s32 connectedTrainerRecordIndices[5];
|
||||
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)
|
||||
{
|
||||
@ -439,12 +439,14 @@ s32 ListMenu_ProcessInput(u8 listTaskId)
|
||||
rightButton = FALSE;
|
||||
break;
|
||||
case LIST_MULTIPLE_SCROLL_DPAD:
|
||||
leftButton = JOY_REPEAT(DPAD_LEFT);
|
||||
rightButton = JOY_REPEAT(DPAD_RIGHT);
|
||||
// note: JOY_REPEAT won't match here
|
||||
leftButton = gMain.newAndRepeatedKeys & DPAD_LEFT;
|
||||
rightButton = gMain.newAndRepeatedKeys & DPAD_RIGHT;
|
||||
break;
|
||||
case LIST_MULTIPLE_SCROLL_L_R:
|
||||
leftButton = JOY_REPEAT(L_BUTTON);
|
||||
rightButton = JOY_REPEAT(R_BUTTON);
|
||||
// same as above
|
||||
leftButton = gMain.newAndRepeatedKeys & L_BUTTON;
|
||||
rightButton = gMain.newAndRepeatedKeys & R_BUTTON;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1257,17 +1259,17 @@ void ListMenuSetUpRedOutlineCursorSpriteOamTable(u16 rowWidth, u16 rowHeight, st
|
||||
s32 i, j, id = 0;
|
||||
|
||||
subsprites[id] = sSubsprite_RedOutline1;
|
||||
subsprites[id].x = -120;
|
||||
subsprites[id].y = -120;
|
||||
subsprites[id].x = 136;
|
||||
subsprites[id].y = 136;
|
||||
id++;
|
||||
|
||||
subsprites[id] = sSubsprite_RedOutline2;
|
||||
subsprites[id].x = rowWidth + 128;
|
||||
subsprites[id].y = -120;
|
||||
subsprites[id].y = 136;
|
||||
id++;
|
||||
|
||||
subsprites[id] = sSubsprite_RedOutline7;
|
||||
subsprites[id].x = -120;
|
||||
subsprites[id].x = 136;
|
||||
subsprites[id].y = rowHeight + 128;
|
||||
id++;
|
||||
|
||||
@ -1297,7 +1299,7 @@ void ListMenuSetUpRedOutlineCursorSpriteOamTable(u16 rowWidth, u16 rowHeight, st
|
||||
for (j = 8; j < rowHeight - 8; j += 8)
|
||||
{
|
||||
subsprites[id] = sSubsprite_RedOutline4;
|
||||
subsprites[id].x = -120;
|
||||
subsprites[id].x = 136;
|
||||
subsprites[id].y = j - 120;
|
||||
id++;
|
||||
|
||||
|
94
src/m4a.c
94
src/m4a.c
@ -22,7 +22,8 @@ u8 gMPlayMemAccArea[0x10];
|
||||
|
||||
u32 MidiKeyToFreq(struct WaveData *wav, u8 key, u8 fineAdjust)
|
||||
{
|
||||
u32 val1, val2;
|
||||
u32 val1;
|
||||
u32 val2;
|
||||
u32 fineAdjustShifted = fineAdjust << 24;
|
||||
|
||||
if (key > 178)
|
||||
@ -314,7 +315,7 @@ void MPlayExtender(struct CgbChannel *cgbChans)
|
||||
|
||||
void MusicPlayerJumpTableCopy(void)
|
||||
{
|
||||
asm("svc 0x2A");
|
||||
asm("swi 0x2A");
|
||||
}
|
||||
|
||||
void ClearChain(void *x)
|
||||
@ -351,25 +352,25 @@ void SoundInit(struct SoundInfo *soundInfo)
|
||||
| SOUND_ALL_MIX_FULL;
|
||||
REG_SOUNDBIAS_H = (REG_SOUNDBIAS_H & 0x3F) | 0x40;
|
||||
|
||||
REG_DMA1SAD = (u32)soundInfo->pcmBuffer;
|
||||
REG_DMA1DAD = (u32)®_FIFO_A;
|
||||
REG_DMA2SAD = (u32)soundInfo->pcmBuffer + PCM_DMA_BUF_SIZE;
|
||||
REG_DMA2DAD = (u32)®_FIFO_B;
|
||||
REG_DMA1SAD = (s32)soundInfo->pcmBuffer;
|
||||
REG_DMA1DAD = (s32)®_FIFO_A;
|
||||
REG_DMA2SAD = (s32)soundInfo->pcmBuffer + PCM_DMA_BUF_SIZE;
|
||||
REG_DMA2DAD = (s32)®_FIFO_B;
|
||||
|
||||
SOUND_INFO_PTR = soundInfo;
|
||||
CpuFill32(0, soundInfo, sizeof(struct SoundInfo));
|
||||
|
||||
soundInfo->maxChans = 8;
|
||||
soundInfo->masterVolume = 15;
|
||||
soundInfo->plynote = ply_note;
|
||||
soundInfo->plynote = (u32)ply_note;
|
||||
soundInfo->CgbSound = DummyFunc;
|
||||
soundInfo->CgbOscOff = (void (*)(u8))DummyFunc;
|
||||
soundInfo->MidiKeyToCgbFreq = (u32 (*)(u8, u8, u8))DummyFunc;
|
||||
soundInfo->ExtVolPit = (void (*)(struct MusicPlayerInfo *, struct MusicPlayerTrack *))DummyFunc;
|
||||
soundInfo->ExtVolPit = (u32)DummyFunc;
|
||||
|
||||
MPlayJumpTableCopy(gMPlayJumpTable);
|
||||
|
||||
soundInfo->MPlayJumpTable = (void (**)())gMPlayJumpTable;
|
||||
soundInfo->MPlayJumpTable = (u32)gMPlayJumpTable;
|
||||
|
||||
SampleFreqSet(SOUND_MODE_FREQ_13379);
|
||||
|
||||
@ -380,7 +381,7 @@ void SampleFreqSet(u32 freq)
|
||||
{
|
||||
struct SoundInfo *soundInfo = SOUND_INFO_PTR;
|
||||
|
||||
freq = (freq & SOUND_MODE_FREQ) >> SOUND_MODE_FREQ_SHIFT;
|
||||
freq = (freq & 0xF0000) >> 16;
|
||||
soundInfo->freq = freq;
|
||||
soundInfo->pcmSamplesPerVBlank = gPcmSamplesPerVBlankTable[freq - 1];
|
||||
soundInfo->pcmDmaPeriod = PCM_DMA_BUF_SIZE / soundInfo->pcmSamplesPerVBlank;
|
||||
@ -431,9 +432,14 @@ void m4aSoundMode(u32 mode)
|
||||
|
||||
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;
|
||||
temp--;
|
||||
chan++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -463,28 +469,37 @@ void m4aSoundMode(u32 mode)
|
||||
|
||||
void SoundClear(void)
|
||||
{
|
||||
s32 i;
|
||||
struct SoundInfo *soundInfo = SOUND_INFO_PTR;
|
||||
struct SoundChannel *chan;
|
||||
s32 i;
|
||||
void *chan;
|
||||
|
||||
if (soundInfo->ident != ID_NUMBER)
|
||||
return;
|
||||
|
||||
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)
|
||||
{
|
||||
for (i=1; i<=4; i++,chan++)
|
||||
i = 1;
|
||||
|
||||
while (i <= 4)
|
||||
{
|
||||
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;
|
||||
|
||||
if (soundInfo->ident < ID_NUMBER || soundInfo->ident > ID_NUMBER + 1)
|
||||
return;
|
||||
if (soundInfo->ident >= ID_NUMBER && soundInfo->ident <= ID_NUMBER + 1)
|
||||
{
|
||||
soundInfo->ident += 10;
|
||||
|
||||
if (REG_DMA1CNT & (DMA_REPEAT << 16))
|
||||
@ -510,6 +525,7 @@ void m4aSoundVSyncOff(void)
|
||||
|
||||
CpuFill32(0, soundInfo->pcmBuffer, sizeof(soundInfo->pcmBuffer));
|
||||
}
|
||||
}
|
||||
|
||||
void m4aSoundVSyncOn(void)
|
||||
{
|
||||
@ -564,7 +580,7 @@ void MPlayOpen(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *track
|
||||
}
|
||||
|
||||
soundInfo->intp = (u32)mplayInfo;
|
||||
soundInfo->func = MPlayMain;
|
||||
soundInfo->func = (u32)MPlayMain;
|
||||
soundInfo->ident = ID_NUMBER;
|
||||
mplayInfo->ident = ID_NUMBER;
|
||||
}
|
||||
@ -598,18 +614,25 @@ void MPlayStart(struct MusicPlayerInfo *mplayInfo, struct SongHeader *songHeader
|
||||
mplayInfo->tempoC = 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);
|
||||
track->flags = MPT_FLG_EXIST | MPT_FLG_START;
|
||||
track->chan = 0;
|
||||
track->cmdPtr = songHeader->part[i];
|
||||
i++;
|
||||
track++;
|
||||
}
|
||||
|
||||
for (; i < mplayInfo->trackCount; i++, track++)
|
||||
while (i < mplayInfo->trackCount)
|
||||
{
|
||||
TrackStop(mplayInfo, track);
|
||||
track->flags = 0;
|
||||
i++;
|
||||
track++;
|
||||
}
|
||||
|
||||
if (songHeader->reverb & SOUND_MODE_REVERB_SET)
|
||||
@ -630,9 +653,14 @@ void m4aMPlayStop(struct MusicPlayerInfo *mplayInfo)
|
||||
mplayInfo->ident++;
|
||||
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);
|
||||
i--;
|
||||
track++;
|
||||
}
|
||||
|
||||
mplayInfo->ident = ID_NUMBER;
|
||||
@ -663,7 +691,10 @@ void FadeOutBody(struct MusicPlayerInfo *mplayInfo)
|
||||
{
|
||||
if ((s16)(mplayInfo->fadeOV -= (4 << FADE_VOL_SHIFT)) <= 0)
|
||||
{
|
||||
for (i = mplayInfo->trackCount, track = mplayInfo->tracks; i > 0; i--, track++)
|
||||
i = mplayInfo->trackCount;
|
||||
track = mplayInfo->tracks;
|
||||
|
||||
while (i > 0)
|
||||
{
|
||||
u32 val;
|
||||
|
||||
@ -675,6 +706,9 @@ void FadeOutBody(struct MusicPlayerInfo *mplayInfo)
|
||||
|
||||
if (!val)
|
||||
track->flags = 0;
|
||||
|
||||
i--;
|
||||
track++;
|
||||
}
|
||||
|
||||
if (mplayInfo->fadeOV & TEMPORARY_FADE)
|
||||
@ -687,7 +721,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)
|
||||
{
|
||||
@ -696,6 +733,9 @@ void FadeOutBody(struct MusicPlayerInfo *mplayInfo)
|
||||
track->volX = (fadeOV >> FADE_VOL_SHIFT);
|
||||
track->flags |= MPT_FLG_VOLCHG;
|
||||
}
|
||||
|
||||
i--;
|
||||
track++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -703,7 +743,7 @@ void TrkVolPitSet(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *tr
|
||||
{
|
||||
if (track->flags & MPT_FLG_VOLSET)
|
||||
{
|
||||
u32 x;
|
||||
s32 x;
|
||||
s32 y;
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
const u32 gFreqTable[12] =
|
||||
const u32 gFreqTable[] =
|
||||
{
|
||||
2147483648u,
|
||||
2275179671u,
|
||||
@ -99,7 +99,7 @@ const u32 gFreqTable[12] =
|
||||
4053909305u,
|
||||
};
|
||||
|
||||
const u16 gPcmSamplesPerVBlankTable[12] =
|
||||
const u16 gPcmSamplesPerVBlankTable[] =
|
||||
{
|
||||
96,
|
||||
132,
|
||||
@ -130,7 +130,7 @@ const u8 gCgbScaleTable[] =
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB,
|
||||
};
|
||||
|
||||
const s16 gCgbFreqTable[12] =
|
||||
const s16 gCgbFreqTable[] =
|
||||
{
|
||||
-2004,
|
||||
-1891,
|
||||
|
16
src/main.c
16
src/main.c
@ -81,6 +81,8 @@ void InitIntrHandlers(void);
|
||||
static void WaitForVBlank(void);
|
||||
void EnableVCountIntrAtLine150(void);
|
||||
|
||||
#define B_START_SELECT (B_BUTTON | START_BUTTON | SELECT_BUTTON)
|
||||
|
||||
void AgbMain()
|
||||
{
|
||||
#if MODERN
|
||||
@ -134,11 +136,9 @@ void AgbMain()
|
||||
{
|
||||
ReadKeys();
|
||||
|
||||
if (!gSoftResetDisabled
|
||||
&& JOY_HELD_RAW(A_BUTTON)
|
||||
&& JOY_HELD_RAW(B_BUTTON)
|
||||
&& JOY_HELD_RAW(START_BUTTON)
|
||||
&& JOY_HELD_RAW(SELECT_BUTTON)) //The reset key combo A + B + START + SELECT
|
||||
if (gSoftResetDisabled == FALSE
|
||||
&& (gMain.heldKeysRaw & A_BUTTON)
|
||||
&& (gMain.heldKeysRaw & B_START_SELECT) == B_START_SELECT)
|
||||
{
|
||||
rfu_REQ_stopMode();
|
||||
rfu_waitREQComplete();
|
||||
@ -262,7 +262,9 @@ static void ReadKeys(void)
|
||||
|
||||
if (keyInput != 0 && gMain.heldKeys == keyInput)
|
||||
{
|
||||
if (--gMain.keyRepeatCounter == 0)
|
||||
gMain.keyRepeatCounter--;
|
||||
|
||||
if (gMain.keyRepeatCounter == 0)
|
||||
{
|
||||
gMain.newAndRepeatedKeys = keyInput;
|
||||
gMain.keyRepeatCounter = gKeyRepeatContinueDelay;
|
||||
@ -341,7 +343,7 @@ static void VBlankIntr(void)
|
||||
{
|
||||
if (gWirelessCommType != 0)
|
||||
RfuVSync();
|
||||
else if (!gLinkVSyncDisabled)
|
||||
else if (gLinkVSyncDisabled == FALSE)
|
||||
LinkVSync();
|
||||
|
||||
gMain.vblankCounter1++;
|
||||
|
@ -1334,7 +1334,7 @@ static void InitMatchCallTextPrinter(int windowId, const u8 *str)
|
||||
printerTemplate.currentY = 1;
|
||||
printerTemplate.letterSpacing = 0;
|
||||
printerTemplate.lineSpacing = 0;
|
||||
printerTemplate.style = 0;
|
||||
printerTemplate.unk = 0;
|
||||
printerTemplate.fgColor = 10;
|
||||
printerTemplate.bgColor = 8;
|
||||
printerTemplate.shadowColor = 14;
|
||||
@ -1773,7 +1773,7 @@ static int GetNumOwnedBadges(void)
|
||||
static bool32 sub_8196D74(int matchCallId)
|
||||
{
|
||||
int dayCount;
|
||||
u32 otId;
|
||||
int otId;
|
||||
u16 easyChatWord;
|
||||
int numRematchTrainersFought;
|
||||
int var0, var1, var2;
|
||||
|
46
src/menu.c
46
src/menu.c
@ -180,7 +180,7 @@ u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed
|
||||
printer.currentY = 1;
|
||||
printer.letterSpacing = 0;
|
||||
printer.lineSpacing = 0;
|
||||
printer.style = 0;
|
||||
printer.unk = 0;
|
||||
printer.fgColor = fgColor;
|
||||
printer.bgColor = bgColor;
|
||||
printer.shadowColor = shadowColor;
|
||||
@ -1049,13 +1049,13 @@ s8 ProcessMenuInput_other(void)
|
||||
{
|
||||
return MENU_B_PRESSED;
|
||||
}
|
||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_UP)
|
||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_UP)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
Menu_MoveCursor(-1);
|
||||
return MENU_NOTHING_CHOSEN;
|
||||
}
|
||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_DOWN)
|
||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_DOWN)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
Menu_MoveCursor(1);
|
||||
@ -1075,17 +1075,17 @@ s8 Menu_ProcessInputNoWrapAround_other(void)
|
||||
PlaySE(SE_SELECT);
|
||||
return sMenu.cursorPos;
|
||||
}
|
||||
if (JOY_NEW(B_BUTTON))
|
||||
else if (JOY_NEW(B_BUTTON))
|
||||
{
|
||||
return MENU_B_PRESSED;
|
||||
}
|
||||
if (JOY_REPEAT(DPAD_ANY) == DPAD_UP)
|
||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_UP)
|
||||
{
|
||||
if (oldPos != Menu_MoveCursorNoWrapAround(-1))
|
||||
PlaySE(SE_SELECT);
|
||||
return MENU_NOTHING_CHOSEN;
|
||||
}
|
||||
if (JOY_REPEAT(DPAD_ANY) == DPAD_DOWN)
|
||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_DOWN)
|
||||
{
|
||||
if (oldPos != Menu_MoveCursorNoWrapAround(1))
|
||||
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.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
|
||||
printer.shadowColor = GetFontAttribute(fontId, FONTATTR_COLOR_SHADOW);
|
||||
printer.style = GetFontAttribute(fontId, FONTATTR_STYLE);
|
||||
printer.unk = GetFontAttribute(fontId, FONTATTR_UNKNOWN);
|
||||
printer.letterSpacing = letterSpacing;
|
||||
printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
|
||||
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.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
|
||||
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.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.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
|
||||
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.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
|
||||
|
||||
@ -1496,25 +1496,25 @@ s8 sub_81993D8(void)
|
||||
{
|
||||
return MENU_B_PRESSED;
|
||||
}
|
||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_UP)
|
||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_UP)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_UP);
|
||||
return MENU_NOTHING_CHOSEN;
|
||||
}
|
||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_DOWN)
|
||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_DOWN)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_DOWN);
|
||||
return MENU_NOTHING_CHOSEN;
|
||||
}
|
||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
|
||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_LEFT, MENU_CURSOR_DELTA_NONE);
|
||||
return MENU_NOTHING_CHOSEN;
|
||||
}
|
||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
|
||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_RIGHT, MENU_CURSOR_DELTA_NONE);
|
||||
@ -1538,25 +1538,25 @@ s8 sub_8199484(void)
|
||||
{
|
||||
return MENU_B_PRESSED;
|
||||
}
|
||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_UP)
|
||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_UP)
|
||||
{
|
||||
if (oldPos != ChangeGridMenuCursorPosition(0, -1))
|
||||
PlaySE(SE_SELECT);
|
||||
return MENU_NOTHING_CHOSEN;
|
||||
}
|
||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_DOWN)
|
||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_DOWN)
|
||||
{
|
||||
if (oldPos != ChangeGridMenuCursorPosition(0, 1))
|
||||
PlaySE(SE_SELECT);
|
||||
return MENU_NOTHING_CHOSEN;
|
||||
}
|
||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
|
||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
|
||||
{
|
||||
if (oldPos != ChangeGridMenuCursorPosition(-1, 0))
|
||||
PlaySE(SE_SELECT);
|
||||
return MENU_NOTHING_CHOSEN;
|
||||
}
|
||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
|
||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
|
||||
{
|
||||
if (oldPos != ChangeGridMenuCursorPosition(1, 0))
|
||||
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.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND);
|
||||
printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW);
|
||||
printer.style = GetFontAttribute(1, FONTATTR_STYLE);
|
||||
printer.unk = GetFontAttribute(1, FONTATTR_UNKNOWN);
|
||||
printer.letterSpacing = 0;
|
||||
printer.lineSpacing = 0;
|
||||
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.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND);
|
||||
printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW);
|
||||
printer.style = GetFontAttribute(1, FONTATTR_STYLE);
|
||||
printer.unk = GetFontAttribute(1, FONTATTR_UNKNOWN);
|
||||
printer.letterSpacing = 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.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND);
|
||||
printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW);
|
||||
printer.style = GetFontAttribute(1, FONTATTR_STYLE);
|
||||
printer.unk = GetFontAttribute(1, FONTATTR_UNKNOWN);
|
||||
printer.letterSpacing = 0;
|
||||
printer.lineSpacing = 0;
|
||||
|
||||
@ -1949,7 +1949,7 @@ void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const
|
||||
printer.currentY = printer.y;
|
||||
printer.letterSpacing = GetFontAttribute(fontId, 2);
|
||||
printer.lineSpacing = GetFontAttribute(fontId, 3);
|
||||
printer.style = 0;
|
||||
printer.unk = 0;
|
||||
printer.fgColor = color[1];
|
||||
printer.bgColor = color[0];
|
||||
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.letterSpacing = letterSpacing;
|
||||
printer.lineSpacing = lineSpacing;
|
||||
printer.style = 0;
|
||||
printer.unk = 0;
|
||||
printer.fgColor = color[1];
|
||||
printer.bgColor = color[0];
|
||||
printer.shadowColor = color[2];
|
||||
@ -1991,7 +1991,7 @@ void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left
|
||||
printer.currentY = top;
|
||||
printer.letterSpacing = letterSpacing;
|
||||
printer.lineSpacing = lineSpacing;
|
||||
printer.style = 0;
|
||||
printer.unk = 0;
|
||||
|
||||
printer.fgColor = GetFontAttribute(fontId, 5);
|
||||
printer.bgColor = GetFontAttribute(fontId, 6);
|
||||
|
@ -183,7 +183,7 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
|
||||
{
|
||||
s16 valBefore = (*arg0);
|
||||
|
||||
if (JOY_REPEAT(DPAD_ANY) == DPAD_UP)
|
||||
if ((JOY_REPEAT(DPAD_ANY)) == DPAD_UP)
|
||||
{
|
||||
(*arg0)++;
|
||||
if ((*arg0) > arg1)
|
||||
@ -199,7 +199,7 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_DOWN)
|
||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_DOWN)
|
||||
{
|
||||
(*arg0)--;
|
||||
if ((*arg0) <= 0)
|
||||
@ -215,7 +215,7 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_RIGHT)
|
||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_RIGHT)
|
||||
{
|
||||
(*arg0) += 10;
|
||||
if ((*arg0) > arg1)
|
||||
@ -231,7 +231,7 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (JOY_REPEAT(DPAD_ANY) == DPAD_LEFT)
|
||||
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_LEFT)
|
||||
{
|
||||
(*arg0) -= 10;
|
||||
if ((*arg0) <= 0)
|
||||
|
@ -249,7 +249,7 @@ void sub_81D1D04(u8 a0)
|
||||
sUnknown_0203CF48[a0] = 0xFF;
|
||||
}
|
||||
|
||||
static u8 sub_81D1D34(u8 a0) // unused
|
||||
static u8 sub_81D1D34(u8 a0)
|
||||
{
|
||||
return sUnknown_0203CF48[a0];
|
||||
}
|
||||
@ -893,6 +893,8 @@ static u8 *GetConditionMenuMonString(u8 *dst, u16 boxId, u16 monId)
|
||||
{
|
||||
return StringCopyPadded(dst, gText_EggNickname, 0, 12);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetBoxOrPartyMonData(boxId, monId, MON_DATA_NICKNAME, dst);
|
||||
StringGetEnd10(dst);
|
||||
species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES, NULL);
|
||||
@ -904,8 +906,8 @@ static u8 *GetConditionMenuMonString(u8 *dst, u16 boxId, u16 monId)
|
||||
else
|
||||
{
|
||||
// Needed to match, feel free to remove.
|
||||
boxId++, boxId--;
|
||||
monId++, monId--;
|
||||
boxId++;boxId--;
|
||||
monId++;monId--;
|
||||
|
||||
boxMon = GetBoxedMonPtr(boxId, monId);
|
||||
gender = GetBoxMonGender(boxMon);
|
||||
@ -961,6 +963,7 @@ static u8 *GetConditionMenuMonString(u8 *dst, u16 boxId, u16 monId)
|
||||
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
@ -168,7 +168,7 @@ const struct PulseBlendSettings gMirageTowerPulseBlendSettings = {
|
||||
.numColors = 15,
|
||||
.delay = 5,
|
||||
.numFadeCycles = -1,
|
||||
.maxBlendCoeff = -5,
|
||||
.maxBlendCoeff = 11,
|
||||
.fadeType = 1,
|
||||
.restorePaletteOnUnload = FALSE,
|
||||
.unk7_7 = 1,
|
||||
@ -412,9 +412,10 @@ void DoMirageTowerCeilingCrumble(void)
|
||||
|
||||
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.
|
||||
if (++data[1] == 1000 || data[0] == 17)
|
||||
if (data[1] == 1000 || data[0] == 17)
|
||||
gTasks[taskId].func = FinishCeilingCrumbleTask;
|
||||
}
|
||||
|
||||
@ -690,7 +691,7 @@ static void DoFossilFallAndSink(u8 taskId)
|
||||
if (gSprites[sUnknown_0203CF0C->spriteId].callback != SpriteCallbackDummy)
|
||||
return;
|
||||
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->frameImageTiles);
|
||||
FREE_AND_SET_NULL(sUnknown_0203CF0C);
|
||||
@ -725,8 +726,8 @@ static void sub_81BF248(struct Sprite *sprite)
|
||||
|
||||
static void sub_81BF2B8(u8* a, u16 b, u8 c, u8 d, u8 e)
|
||||
{
|
||||
u8 r5, r4, r0, r2;
|
||||
u16 var, var2;
|
||||
u8 r0, r5, r4, r2;
|
||||
u8 r2_1, r4_1;
|
||||
u8 b2, c2;
|
||||
|
||||
@ -738,25 +739,23 @@ static void sub_81BF2B8(u8* a, u16 b, u8 c, u8 d, u8 e)
|
||||
|
||||
r4_1 = r4 & 7;
|
||||
r2_1 = r2 & 7;
|
||||
|
||||
gUnknown_030012A8[2] = r4 & 7; //should be r4_1 but that doesn't match
|
||||
gUnknown_030012A8[3] = r2 & 7; //should be r2_1 but that doesn't match
|
||||
gUnknown_030012A8[2] = r4 & 7; //should be using r4_1, but that doesn't match
|
||||
gUnknown_030012A8[3] = r2 & 7; //"
|
||||
|
||||
r0 = r2 / 8;
|
||||
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
|
||||
gUnknown_030012A8[4] = r2 / 8; //should be using r0, but that doesn't match
|
||||
gUnknown_030012A8[5] = r4 / 8; //should be using r5, but that doesn't match
|
||||
|
||||
var = (d / 8) * (r5 * 64) + (r0 * 64);
|
||||
|
||||
gUnknown_030012A8[6] = var;
|
||||
|
||||
var2 = var + ((r4_1 * 8) + r2_1);
|
||||
var2 /= 2;
|
||||
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.
|
||||
gUnknown_030012A8[7] = var + ((r4_1 * 8) + r2_1); //should be using var2 with var2 being divided afterwards, but that doesn't match
|
||||
|
||||
b2 = ((b % 2) ^ 1);
|
||||
c2 = (c << (b2 << 2)) | (15 << (((b2 ^ 1) << 2)));
|
||||
c2 = (c << (b2 << 2)) | 15 << (((b2 ^ 1) << 2));
|
||||
a[var2 + (e * 32)] &= c2;
|
||||
}
|
||||
|
@ -1861,7 +1861,7 @@ u8 GetMonAilment(struct Pokemon *mon)
|
||||
|
||||
static void SetPartyMonsAllowedInMinigame(void)
|
||||
{
|
||||
s16 *ptr;
|
||||
u16 *ptr;
|
||||
|
||||
if (gPartyMenu.menuType == PARTY_MENU_TYPE_MINIGAME)
|
||||
{
|
||||
@ -4953,9 +4953,9 @@ static void Task_DisplayLevelUpStatsPg2(u8 taskId)
|
||||
|
||||
static void DisplayLevelUpStatsPg1(u8 taskId)
|
||||
{
|
||||
u16 *arrayPtr = (u16*)sPartyMenuInternal->data;
|
||||
s16 *arrayPtr = sPartyMenuInternal->data;
|
||||
|
||||
arrayPtr[12] = (u16)CreateLevelUpStatsWindow();
|
||||
arrayPtr[12] = CreateLevelUpStatsWindow();
|
||||
DrawLevelUpWindowPg1(arrayPtr[12], arrayPtr, &arrayPtr[6], TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY);
|
||||
CopyWindowToVram(arrayPtr[12], 2);
|
||||
ScheduleBgCopyTilemapToVram(2);
|
||||
@ -4963,7 +4963,7 @@ static void DisplayLevelUpStatsPg1(u8 taskId)
|
||||
|
||||
static void DisplayLevelUpStatsPg2(u8 taskId)
|
||||
{
|
||||
u16 *arrayPtr = (u16 *)sPartyMenuInternal->data;
|
||||
s16 *arrayPtr = sPartyMenuInternal->data;
|
||||
|
||||
DrawLevelUpWindowPg2(arrayPtr[12], &arrayPtr[6], TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY);
|
||||
CopyWindowToVram(arrayPtr[12], 2);
|
||||
|
@ -327,7 +327,7 @@ void PlayerPC(void)
|
||||
|
||||
static void InitPlayerPCMenu(u8 taskId)
|
||||
{
|
||||
s16 *data;
|
||||
u16 *data;
|
||||
struct WindowTemplate windowTemplate;
|
||||
|
||||
data = gTasks[taskId].data;
|
||||
@ -346,7 +346,7 @@ static void InitPlayerPCMenu(u8 taskId)
|
||||
|
||||
static void PlayerPCProcessMenuInput(u8 taskId)
|
||||
{
|
||||
s16 *data;
|
||||
u16 *data;
|
||||
s8 inputOptionId;
|
||||
|
||||
data = gTasks[taskId].data;
|
||||
@ -435,7 +435,7 @@ static void PlayerPC_TurnOff(u8 taskId)
|
||||
|
||||
static void InitItemStorageMenu(u8 taskId, u8 var)
|
||||
{
|
||||
s16 *data;
|
||||
u16 *data;
|
||||
struct WindowTemplate windowTemplate;
|
||||
|
||||
data = gTasks[taskId].data;
|
||||
@ -548,7 +548,7 @@ static void ItemStorage_Toss(u8 taskId)
|
||||
|
||||
static void ItemStorage_WithdrawToss_Helper(u8 taskId, bool8 toss)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
u16 *data = gTasks[taskId].data;
|
||||
|
||||
data[3] = toss;
|
||||
sub_816B4DC(taskId);
|
||||
@ -581,9 +581,9 @@ static void ItemStorage_SetItemAndMailCount(u8 taskId)
|
||||
|
||||
static void sub_816B4DC(u8 taskId)
|
||||
{
|
||||
u16 *data = (u16 *)gTasks[taskId].data;
|
||||
u16 *data = gTasks[taskId].data;
|
||||
|
||||
ClearStdWindowAndFrameToTransparent((u8)data[4], FALSE);
|
||||
ClearStdWindowAndFrameToTransparent(data[4], FALSE);
|
||||
ClearWindowTilemap(data[4]);
|
||||
RemoveWindow(data[4]);
|
||||
ScheduleBgCopyTilemapToVram(0);
|
||||
@ -1380,7 +1380,7 @@ static void ItemStorage_DoItemToss(u8 taskId)
|
||||
|
||||
data = gTasks[taskId].data;
|
||||
b = (playerPCItemPageInfo.cursorPos + playerPCItemPageInfo.itemsAbove);
|
||||
if (ItemId_GetImportance(gSaveBlock1Ptr->pcItems[b].itemId) == 0)
|
||||
if (!ItemId_GetImportance(gSaveBlock1Ptr->pcItems[b].itemId))
|
||||
{
|
||||
CopyItemName(gSaveBlock1Ptr->pcItems[b].itemId, gStringVar1);
|
||||
ConvertIntToDecimalStringN(gStringVar2, data[2], STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
|
@ -430,7 +430,7 @@ static const struct ListMenuTemplate sPokeblockListMenuTemplate =
|
||||
// code
|
||||
void OpenPokeblockCase(u8 caseId, void (*callback)(void))
|
||||
{
|
||||
sPokeblockMenu = Alloc(sizeof(struct PokeblockMenuStruct));
|
||||
sPokeblockMenu = Alloc(sizeof(*sPokeblockMenu));
|
||||
sPokeblockMenu->caseId = caseId;
|
||||
sPokeblockMenu->callbackOnUse = NULL;
|
||||
sPokeblockMenu->unkTaskId = 0xFF;
|
||||
|
@ -171,16 +171,16 @@ struct PokedexView
|
||||
u16 ownCount;
|
||||
u16 monSpriteIds[MAX_MONS_ON_SCREEN];
|
||||
u16 selectedMonSpriteId;
|
||||
s16 pokeBallRotationStep;
|
||||
s16 pokeBallRotationBackup;
|
||||
u16 pokeBallRotationStep;
|
||||
u16 pokeBallRotationBackup;
|
||||
u8 pokeBallRotation;
|
||||
u8 initialVOffset;
|
||||
u8 scrollTimer;
|
||||
u8 scrollDirection;
|
||||
s16 listVOffset;
|
||||
s16 listMovingVOffset;
|
||||
s16 scrollMonIncrement;
|
||||
s16 maxScrollTimer;
|
||||
u16 scrollMonIncrement;
|
||||
u16 maxScrollTimer;
|
||||
u16 scrollSpeed;
|
||||
u16 unkArr1[4]; // Cleared, never read
|
||||
u8 filler[8];
|
||||
@ -2597,7 +2597,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored)
|
||||
CreateMonListEntry(1, selectedMon, ignored);
|
||||
PlaySE(SE_DEX_SCROLL);
|
||||
}
|
||||
else if (JOY_HELD(DPAD_DOWN) && (selectedMon < sPokedexView->pokemonListCount - 1))
|
||||
else if ((JOY_HELD(DPAD_DOWN)) && (selectedMon < sPokedexView->pokemonListCount - 1))
|
||||
{
|
||||
scrollDir = 2;
|
||||
selectedMon = GetNextPosition(0, selectedMon, 0, sPokedexView->pokemonListCount - 1);
|
||||
@ -2605,7 +2605,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored)
|
||||
CreateMonListEntry(2, selectedMon, ignored);
|
||||
PlaySE(SE_DEX_SCROLL);
|
||||
}
|
||||
else if (JOY_NEW(DPAD_LEFT) && (selectedMon > 0))
|
||||
else if ((JOY_NEW(DPAD_LEFT)) && (selectedMon > 0))
|
||||
{
|
||||
startingPos = selectedMon;
|
||||
|
||||
@ -3399,8 +3399,8 @@ static void Task_HandleInfoScreenInput(u8 taskId)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((JOY_NEW(DPAD_LEFT)
|
||||
|| (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
|
||||
if (((JOY_NEW(DPAD_LEFT))
|
||||
|| ((JOY_NEW(L_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
|
||||
&& sPokedexView->selectedScreen > 0)
|
||||
{
|
||||
sPokedexView->selectedScreen--;
|
||||
@ -3408,8 +3408,8 @@ static void Task_HandleInfoScreenInput(u8 taskId)
|
||||
PlaySE(SE_DEX_PAGE);
|
||||
return;
|
||||
}
|
||||
if ((JOY_NEW(DPAD_RIGHT)
|
||||
|| (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
|
||||
if (((JOY_NEW(DPAD_RIGHT))
|
||||
|| ((JOY_NEW(R_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
|
||||
&& sPokedexView->selectedScreen < CANCEL_SCREEN)
|
||||
{
|
||||
sPokedexView->selectedScreen++;
|
||||
@ -3656,8 +3656,8 @@ static void Task_HandleCryScreenInput(u8 taskId)
|
||||
PlaySE(SE_DEX_PAGE);
|
||||
return;
|
||||
}
|
||||
if (JOY_NEW(DPAD_RIGHT)
|
||||
|| (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
|
||||
if ((JOY_NEW(DPAD_RIGHT))
|
||||
|| ((JOY_NEW(R_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
|
||||
{
|
||||
if (!sPokedexListItem->owned)
|
||||
{
|
||||
@ -4167,13 +4167,12 @@ static void PrintMonHeight(u16 height, u8 left, u8 top)
|
||||
static void PrintMonWeight(u16 weight, u8 left, u8 top)
|
||||
{
|
||||
u8 buffer[16];
|
||||
u8 i;
|
||||
bool8 output;
|
||||
u8 i;
|
||||
u32 lbs = (weight * 100000) / 4536;
|
||||
|
||||
if (lbs % 10u >= 5)
|
||||
lbs += 10;
|
||||
|
||||
i = 0;
|
||||
output = FALSE;
|
||||
|
||||
@ -4228,19 +4227,13 @@ const u8 *GetPokedexCategoryName(u16 dexNum) // unused
|
||||
return gPokedexEntries[dexNum].categoryName;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
HEIGHT,
|
||||
WEIGHT,
|
||||
};
|
||||
|
||||
u16 GetPokedexHeightWeight(u16 dexNum, u8 data)
|
||||
{
|
||||
switch (data)
|
||||
{
|
||||
case HEIGHT:
|
||||
case 0: // height
|
||||
return gPokedexEntries[dexNum].height;
|
||||
case WEIGHT:
|
||||
case 1: // weight
|
||||
return gPokedexEntries[dexNum].weight;
|
||||
default:
|
||||
return 1;
|
||||
@ -5029,7 +5022,7 @@ static void Task_HandleSearchMenuInput(u8 taskId)
|
||||
CopyWindowToVram(0, 2);
|
||||
CopyBgTilemapBufferToVram(3);
|
||||
}
|
||||
if (JOY_NEW(DPAD_RIGHT) && movementMap[gTasks[taskId].tMenuItem][1] != 0xFF)
|
||||
if ((JOY_NEW(DPAD_RIGHT)) && movementMap[gTasks[taskId].tMenuItem][1] != 0xFF)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][1];
|
||||
@ -5115,9 +5108,9 @@ static void Task_SelectSearchMenuItem(u8 taskId)
|
||||
u16 *scrollOffset;
|
||||
|
||||
DrawOrEraseSearchParameterBox(FALSE);
|
||||
menuItem = (u16)gTasks[taskId].tMenuItem;
|
||||
cursorPos = (u16*)&gTasks[taskId].data[sSearchOptions[menuItem].taskDataCursorPos];
|
||||
scrollOffset = (u16*)&gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset];
|
||||
menuItem = gTasks[taskId].tMenuItem;
|
||||
cursorPos = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataCursorPos];
|
||||
scrollOffset = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset];
|
||||
gTasks[taskId].tCursorPos = *cursorPos;
|
||||
gTasks[taskId].tScrollOffset = *scrollOffset;
|
||||
PrintSearchParameterText(taskId);
|
||||
@ -5236,8 +5229,9 @@ static void Task_ExitSearchWaitForFade(u8 taskId)
|
||||
|
||||
void SetSearchRectHighlight(u8 flags, u8 x, u8 y, u8 width)
|
||||
{
|
||||
u16 i, temp; //This would have been better as a pointer but here we are
|
||||
u32 ptr = (u32)GetBgTilemapBuffer(3); //This should be a pointer, but this only matches as a u32.
|
||||
u16 i;
|
||||
u16 temp; //should be a pointer, but does not match as one
|
||||
u32 ptr = (u32)GetBgTilemapBuffer(3); //same as above
|
||||
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
@ -5451,8 +5445,8 @@ static void PrintSearchParameterText(u8 taskId)
|
||||
const struct SearchOptionText *texts = sSearchOptions[gTasks[taskId].tMenuItem].texts;
|
||||
const u16 *cursorPos = &gTasks[taskId].data[sSearchOptions[gTasks[taskId].tMenuItem].taskDataCursorPos];
|
||||
const u16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[gTasks[taskId].tMenuItem].taskDataScrollOffset];
|
||||
|
||||
u16 i, j;
|
||||
u16 i;
|
||||
u16 j;
|
||||
|
||||
ClearSearchParameterBoxText();
|
||||
|
||||
@ -5541,6 +5535,7 @@ static bool8 SearchParamCantScrollUp(u8 taskId)
|
||||
|
||||
if (lastOption > MAX_SEARCH_PARAM_CURSOR_POS && *scrollOffset != 0)
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -5552,6 +5547,7 @@ static bool8 SearchParamCantScrollDown(u8 taskId)
|
||||
|
||||
if (lastOption > MAX_SEARCH_PARAM_CURSOR_POS && *scrollOffset < lastOption - MAX_SEARCH_PARAM_CURSOR_POS)
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ EWRAM_DATA u8 gEnemyPartyCount = 0;
|
||||
EWRAM_DATA struct Pokemon gPlayerParty[PARTY_SIZE] = {0};
|
||||
EWRAM_DATA struct Pokemon gEnemyParty[PARTY_SIZE] = {0};
|
||||
EWRAM_DATA struct SpriteTemplate gMultiuseSpriteTemplate = {0};
|
||||
EWRAM_DATA struct Unknown_806F160_Struct *gUnknown_020249B4[2] = {NULL, NULL};
|
||||
EWRAM_DATA struct Unknown_806F160_Struct *gUnknown_020249B4[2] = {NULL};
|
||||
|
||||
// const rom data
|
||||
#include "data/battle_moves.h"
|
||||
@ -5750,7 +5750,7 @@ u8 GetTrainerEncounterMusicId(u16 trainerOpponentId)
|
||||
u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex)
|
||||
{
|
||||
u16 retVal;
|
||||
// Dont modify HP, Accuracy, or Evasion by nature
|
||||
// Don't modify HP, Accuracy, or Evasion by nature
|
||||
if (statIndex <= STAT_HP || statIndex > NUM_NATURE_STATS)
|
||||
{
|
||||
return n;
|
||||
@ -6811,8 +6811,6 @@ static bool8 ShouldSkipFriendshipChange(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#define MAGIC_NUMBER 0xA3
|
||||
|
||||
static void sub_806F160(struct Unknown_806F160_Struct* structPtr)
|
||||
{
|
||||
u16 i, j;
|
||||
@ -6861,7 +6859,7 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1)
|
||||
structPtr->field_0_0 = 7;
|
||||
structPtr->field_0_1 = 7;
|
||||
structPtr->field_1 = 4;
|
||||
structPtr->size = 1;
|
||||
structPtr->field_3_0 = 1;
|
||||
structPtr->field_3_1 = 2;
|
||||
break;
|
||||
case 0:
|
||||
@ -6869,12 +6867,12 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1)
|
||||
structPtr->field_0_0 = 4;
|
||||
structPtr->field_0_1 = 4;
|
||||
structPtr->field_1 = 4;
|
||||
structPtr->size = 1;
|
||||
structPtr->field_3_0 = 1;
|
||||
structPtr->field_3_1 = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
structPtr->bytes = AllocZeroed(structPtr->size * 0x800 * 4 * structPtr->field_0_0);
|
||||
structPtr->bytes = AllocZeroed(structPtr->field_3_0 * 0x800 * 4 * structPtr->field_0_0);
|
||||
structPtr->byteArrays = AllocZeroed(structPtr->field_0_0 * 32);
|
||||
if (structPtr->bytes == NULL || structPtr->byteArrays == NULL)
|
||||
{
|
||||
@ -6883,7 +6881,7 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1)
|
||||
else
|
||||
{
|
||||
for (i = 0; i < structPtr->field_0_0; i++)
|
||||
structPtr->byteArrays[i] = structPtr->bytes + (structPtr->size * (i << 0xD));
|
||||
structPtr->byteArrays[i] = structPtr->bytes + (structPtr->field_3_0 * (i << 0xD));
|
||||
}
|
||||
|
||||
structPtr->templates = AllocZeroed(sizeof(struct SpriteTemplate) * structPtr->field_0_0);
|
||||
@ -6902,8 +6900,8 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1)
|
||||
case 2:
|
||||
sub_806F1FC(structPtr);
|
||||
break;
|
||||
case 1:
|
||||
case 0:
|
||||
case 1:
|
||||
default:
|
||||
sub_806F160(structPtr);
|
||||
break;
|
||||
@ -6932,7 +6930,7 @@ struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1)
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->magic = MAGIC_NUMBER;
|
||||
structPtr->magic = 0xA3;
|
||||
gUnknown_020249B4[id] = structPtr;
|
||||
}
|
||||
|
||||
@ -6943,12 +6941,12 @@ void sub_806F47C(u8 id)
|
||||
{
|
||||
struct Unknown_806F160_Struct *structPtr;
|
||||
|
||||
id &= 1;
|
||||
id %= 2;
|
||||
structPtr = gUnknown_020249B4[id];
|
||||
if (structPtr == NULL)
|
||||
return;
|
||||
|
||||
if (structPtr->magic != MAGIC_NUMBER)
|
||||
if (structPtr->magic != 0xA3)
|
||||
{
|
||||
memset(structPtr, 0, sizeof(struct Unknown_806F160_Struct));
|
||||
}
|
||||
@ -6972,13 +6970,15 @@ void sub_806F47C(u8 id)
|
||||
u8 *sub_806F4F8(u8 id, u8 arg1)
|
||||
{
|
||||
struct Unknown_806F160_Struct *structPtr = gUnknown_020249B4[id % 2];
|
||||
if (structPtr->magic != MAGIC_NUMBER)
|
||||
if (structPtr->magic != 0xA3)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (arg1 >= structPtr->field_0_0)
|
||||
arg1 = 0;
|
||||
|
||||
return structPtr->byteArrays[arg1];
|
||||
}
|
||||
}
|
||||
|
@ -2883,10 +2883,9 @@ static void sub_8181C2C(struct Sprite *sprite)
|
||||
}
|
||||
else
|
||||
{
|
||||
s32 var = sUnknown_03001240[sprite->data[0]].field_8;
|
||||
|
||||
const s16 var = sUnknown_03001240[sprite->data[0]].field_8;
|
||||
|
||||
sprite->pos2.x = var * ((counter % 128) * 8) / 128 + 8 * -var; //Should be - 8 * var instead of + 8 * -var, but that doesn't match
|
||||
sprite->pos2.x = var * ((counter % 128) * 8) / 128 + 8 * -var;
|
||||
sprite->pos2.y = -(Sin(counter % 128, 8));
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ void StartPokemonJump(u16 partyIndex, MainCallback callback)
|
||||
|
||||
if (gReceivedRemoteLinkPlayers)
|
||||
{
|
||||
gUnknown_02022CFC = Alloc(sizeof(struct PokemonJump1));
|
||||
gUnknown_02022CFC = Alloc(sizeof(*gUnknown_02022CFC));
|
||||
if (gUnknown_02022CFC)
|
||||
{
|
||||
ResetTasks();
|
||||
|
@ -2156,7 +2156,7 @@ static void Cb2_EnterPSS(u8 boxOption)
|
||||
{
|
||||
ResetTasks();
|
||||
sCurrentBoxOption = boxOption;
|
||||
sPSSData = Alloc(sizeof(struct PokemonStorageSystemData));
|
||||
sPSSData = Alloc(sizeof(*sPSSData));
|
||||
if (sPSSData == NULL)
|
||||
{
|
||||
SetMainCallback2(Cb2_ExitPSS);
|
||||
@ -2176,7 +2176,7 @@ static void Cb2_EnterPSS(u8 boxOption)
|
||||
static void Cb2_ReturnToPSS(void)
|
||||
{
|
||||
ResetTasks();
|
||||
sPSSData = Alloc(sizeof(struct PokemonStorageSystemData));
|
||||
sPSSData = Alloc(sizeof(*sPSSData));
|
||||
if (sPSSData == NULL)
|
||||
{
|
||||
SetMainCallback2(Cb2_ExitPSS);
|
||||
|
@ -1504,11 +1504,11 @@ static void Task_HandleInput(u8 taskId)
|
||||
{
|
||||
ChangeSummaryPokemon(taskId, 1);
|
||||
}
|
||||
else if (JOY_NEW(DPAD_LEFT) || GetLRKeysPressed() == MENU_L_PRESSED)
|
||||
else if ((JOY_NEW(DPAD_LEFT)) || GetLRKeysPressed() == MENU_L_PRESSED)
|
||||
{
|
||||
ChangePage(taskId, -1);
|
||||
}
|
||||
else if (JOY_NEW(DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
|
||||
else if ((JOY_NEW(DPAD_RIGHT)) || GetLRKeysPressed() == MENU_R_PRESSED)
|
||||
{
|
||||
ChangePage(taskId, 1);
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ static void Task_RunLoopedTask_LinkMode(u8 taskId)
|
||||
|
||||
void CB2_InitPokeNav(void)
|
||||
{
|
||||
gPokenavResources = Alloc(sizeof(struct PokenavResources));
|
||||
gPokenavResources = Alloc(sizeof(*gPokenavResources));
|
||||
if (gPokenavResources == NULL)
|
||||
{
|
||||
SetMainCallback2(CB2_ReturnToFieldWithOpenMenu);
|
||||
@ -343,7 +343,7 @@ static void CB2_InitPokenavForTutorial(void)
|
||||
if (gPaletteFade.active)
|
||||
return;
|
||||
|
||||
gPokenavResources = Alloc(sizeof(struct PokenavResources));
|
||||
gPokenavResources = Alloc(sizeof(*gPokenavResources));
|
||||
if (gPokenavResources == NULL)
|
||||
{
|
||||
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
|
||||
|
@ -184,25 +184,26 @@ static u32 HandleConditionSearchInput(struct PokenavSub7 *structPtr)
|
||||
{
|
||||
if (JOY_REPEAT(DPAD_UP))
|
||||
return CONDITION_SEARCH_FUNC_MOVE_UP;
|
||||
if (JOY_REPEAT(DPAD_DOWN))
|
||||
else if (JOY_REPEAT(DPAD_DOWN))
|
||||
return CONDITION_SEARCH_FUNC_MOVE_DOWN;
|
||||
if (JOY_NEW(DPAD_LEFT))
|
||||
else if (JOY_NEW(DPAD_LEFT))
|
||||
return CONDITION_SEARCH_FUNC_PAGE_UP;
|
||||
if (JOY_NEW(DPAD_RIGHT))
|
||||
else if (JOY_NEW(DPAD_RIGHT))
|
||||
return CONDITION_SEARCH_FUNC_PAGE_DOWN;
|
||||
if (JOY_NEW(B_BUTTON))
|
||||
else if (JOY_NEW(B_BUTTON))
|
||||
{
|
||||
structPtr->isPartyCondition = 0;
|
||||
structPtr->callback = ReturnToConditionSearchList;
|
||||
return CONDITION_SEARCH_FUNC_EXIT;
|
||||
}
|
||||
if (JOY_NEW(A_BUTTON))
|
||||
else if (JOY_NEW(A_BUTTON))
|
||||
{
|
||||
structPtr->monList->currIndex = GetSelectedPokenavListIndex();
|
||||
structPtr->isPartyCondition = 1;
|
||||
structPtr->callback = OpenConditionGraphFromSearchList;
|
||||
return CONDITION_SEARCH_FUNC_SELECT_MON;
|
||||
}
|
||||
else
|
||||
return CONDITION_SEARCH_FUNC_NONE;
|
||||
}
|
||||
|
||||
|
@ -438,7 +438,6 @@ static u32 LoopedTask_SlideMenuHeaderDown(s32 a0)
|
||||
ChangeBgY(0, 0, 0);
|
||||
return LT_FINISH;
|
||||
}
|
||||
|
||||
return LT_PAUSE;
|
||||
}
|
||||
|
||||
@ -459,11 +458,13 @@ void Pokenav_AllocAndLoadPalettes(const struct SpritePalette *palettes)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
index = (index * 16) + 0x100;
|
||||
CopyPaletteIntoBufferUnfaded(current->data, index, 0x20);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PokenavFillPalette(u32 palIndex, u16 fillValue)
|
||||
{
|
||||
|
@ -712,18 +712,17 @@ static u8 sub_80E7A9C(struct DayCareMail *rmMail)
|
||||
return rmMail->message.itemId;
|
||||
}
|
||||
|
||||
static void ExchangeMail(struct RecordMixingDayCareMail *src, size_t recordSize, u8 (*idxs)[2], u8 which0, u8 which1)
|
||||
static void sub_80E7AA4(struct RecordMixingDayCareMail *src, size_t recordSize, u8 (*idxs)[2], u8 which0, u8 which1)
|
||||
{
|
||||
struct DayCareMail buffer;
|
||||
struct RecordMixingDayCareMail *mail1;
|
||||
struct RecordMixingDayCareMail *mail2;
|
||||
|
||||
mail1 = (void *)src + recordSize * idxs[which0][0];
|
||||
buffer = mail1->mail[idxs[which0][1]];
|
||||
|
||||
memcpy(&buffer, &mail1->mail[idxs[which0][1]], sizeof(struct DayCareMail));
|
||||
mail2 = (void *)src + recordSize * idxs[which1][0];
|
||||
mail1->mail[idxs[which0][1]] = mail2->mail[idxs[which1][1]];
|
||||
mail2->mail[idxs[which1][1]] = buffer;
|
||||
memcpy(&mail1->mail[idxs[which0][1]], &mail2->mail[idxs[which1][1]], sizeof(struct DayCareMail));
|
||||
memcpy(&mail2->mail[idxs[which1][1]], &buffer, sizeof(struct DayCareMail));
|
||||
}
|
||||
|
||||
static void sub_80E7B2C(const u8 *src)
|
||||
@ -865,20 +864,20 @@ static void ReceiveDaycareMailData(struct RecordMixingDayCareMail *src, size_t r
|
||||
}
|
||||
else if (sp1c[i][0] == TRUE && sp1c[i][1] == TRUE)
|
||||
{
|
||||
u8 mail1, mail2;
|
||||
u32 var1, var2;
|
||||
|
||||
sp24[j][0] = i;
|
||||
mail1 = sub_80E7A9C(&_src->mail[0]);
|
||||
mail2 = sub_80E7A9C(&_src->mail[1]);
|
||||
if (!(mail1 || mail2) || (mail1 && mail2)) //Logical (not bitwise) XOR. Should be ((mail1 || mail2) && !(mail1 && mail2)), but that doesn't match.
|
||||
var1 = sub_80E7A9C(&_src->mail[0]);
|
||||
var2 = sub_80E7A9C(&_src->mail[1]);
|
||||
if (!(var1 || var2) || (var1 && var2))
|
||||
{
|
||||
sp24[j][1] = Random2() % 2;
|
||||
}
|
||||
else if (mail1 && !mail2)
|
||||
else if (var1 && !var2)
|
||||
{
|
||||
sp24[j][1] = 0;
|
||||
}
|
||||
else if (!mail1 && mail2)
|
||||
else if (!var1 && var2)
|
||||
{
|
||||
sp24[j][1] = 1;
|
||||
}
|
||||
@ -896,27 +895,27 @@ static void ReceiveDaycareMailData(struct RecordMixingDayCareMail *src, size_t r
|
||||
switch (sp34)
|
||||
{
|
||||
case 2:
|
||||
ExchangeMail(src, recordSize, sp24, 0, 1);
|
||||
sub_80E7AA4(src, recordSize, sp24, 0, 1);
|
||||
break;
|
||||
case 3:
|
||||
which0 = gUnknown_0858CFB8[tableId][0];
|
||||
which1 = gUnknown_0858CFB8[tableId][1];
|
||||
ExchangeMail(src, recordSize, sp24, which0, which1);
|
||||
sub_80E7AA4(src, recordSize, sp24, which0, which1);
|
||||
break;
|
||||
case 4:
|
||||
ptr = sp24;
|
||||
which0 = gUnknown_0858CFBE[tableId][0];
|
||||
which1 = gUnknown_0858CFBE[tableId][1];
|
||||
ExchangeMail(src, recordSize, ptr, which0, which1);
|
||||
sub_80E7AA4(src, recordSize, ptr, which0, which1);
|
||||
which0 = gUnknown_0858CFBE[tableId][2];
|
||||
which1 = gUnknown_0858CFBE[tableId][3];
|
||||
ExchangeMail(src, recordSize, ptr, which0, which1);
|
||||
sub_80E7AA4(src, recordSize, ptr, which0, which1);
|
||||
break;
|
||||
}
|
||||
|
||||
_src = (void *)src + which * recordSize;
|
||||
gSaveBlock1Ptr->daycare.mons[0].mail = _src->mail[0];
|
||||
gSaveBlock1Ptr->daycare.mons[1].mail = _src->mail[1];
|
||||
memcpy(&gSaveBlock1Ptr->daycare.mons[0].mail, &_src->mail[0], sizeof(struct DayCareMail));
|
||||
memcpy(&gSaveBlock1Ptr->daycare.mons[1].mail, &_src->mail[1], sizeof(struct DayCareMail));
|
||||
SeedRng(oldSeed);
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "link.h"
|
||||
#include "constants/game_stat.h"
|
||||
|
||||
static u16 CalculateChecksum(const void *data, u16 size);
|
||||
static u16 CalculateChecksum(void *data, u16 size);
|
||||
static bool8 DoReadFlashWholeSection(u8 sector, struct SaveSection *section);
|
||||
static u8 GetSaveValidStatus(const struct SaveSectionLocation *location);
|
||||
static u8 sub_8152E10(u16 a1, const struct SaveSectionLocation *location);
|
||||
@ -621,7 +621,7 @@ static bool8 DoReadFlashWholeSection(u8 sector, struct SaveSection *section)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static u16 CalculateChecksum(const void *data, u16 size)
|
||||
static u16 CalculateChecksum(void *data, u16 size)
|
||||
{
|
||||
u16 i;
|
||||
u32 checksum = 0;
|
||||
@ -648,7 +648,7 @@ static void UpdateSaveAddresses(void)
|
||||
gRamSaveSectionLocations[i].size = sSaveSectionOffsets[i].size;
|
||||
}
|
||||
|
||||
for (; i <= SECTOR_ID_PKMN_STORAGE_END; i++) //i = SECTOR_ID_PKMN_STORAGE_START; in the initialization clause does not match
|
||||
for (; i <= SECTOR_ID_PKMN_STORAGE_END; i++) //setting i to SECTOR_ID_PKMN_STORAGE_START does not match
|
||||
{
|
||||
gRamSaveSectionLocations[i].data = (void*)(gPokemonStoragePtr) + sSaveSectionOffsets[i].toAdd;
|
||||
gRamSaveSectionLocations[i].size = sSaveSectionOffsets[i].size;
|
||||
|
@ -788,8 +788,8 @@ bool8 ScrCmd_warphole(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 mapGroup = ScriptReadByte(ctx);
|
||||
u8 mapNum = ScriptReadByte(ctx);
|
||||
s16 x;
|
||||
s16 y;
|
||||
u16 x;
|
||||
u16 y;
|
||||
|
||||
PlayerGetDestCoords(&x, &y);
|
||||
if (mapGroup == 0xFF && mapNum == 0xFF)
|
||||
|
@ -26,9 +26,9 @@ void InitScriptContext(struct ScriptContext *ctx, void *cmdTable, void *cmdTable
|
||||
s32 i;
|
||||
|
||||
ctx->mode = 0;
|
||||
ctx->scriptPtr = NULL;
|
||||
ctx->scriptPtr = 0;
|
||||
ctx->stackDepth = 0;
|
||||
ctx->nativePtr = NULL;
|
||||
ctx->nativePtr = 0;
|
||||
ctx->cmdTable = cmdTable;
|
||||
ctx->cmdTableEnd = cmdTableEnd;
|
||||
|
||||
@ -55,7 +55,7 @@ void SetupNativeScript(struct ScriptContext *ctx, bool8 (*ptr)(void))
|
||||
void StopScript(struct ScriptContext *ctx)
|
||||
{
|
||||
ctx->mode = 0;
|
||||
ctx->scriptPtr = NULL;
|
||||
ctx->scriptPtr = 0;
|
||||
}
|
||||
|
||||
bool8 RunScriptCommand(struct ScriptContext *ctx)
|
||||
|
@ -963,7 +963,7 @@ static void HandleRegistryMenuInput(u8 taskId)
|
||||
|
||||
data = gTasks[taskId].data;
|
||||
input = ListMenu_ProcessInput(data[5]);
|
||||
ListMenuGetScrollAndRow(data[5], (u16 *)&data[2], (u16 *)&data[1]);
|
||||
ListMenuGetScrollAndRow(data[5], &data[2], &data[1]);
|
||||
switch (input)
|
||||
{
|
||||
case LIST_NOTHING_CHOSEN:
|
||||
@ -1044,10 +1044,10 @@ void DeleteRegistry_Yes_Callback(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
ClearDialogWindowAndFrame(0, 0);
|
||||
DestroyListMenuTask((u8)data[5], (u16 *)&data[2], (u16 *)&data[1]);
|
||||
DestroyListMenuTask(data[5], &data[2], &data[1]);
|
||||
gSaveBlock1Ptr->secretBases[data[4]].registryStatus = 0;
|
||||
BuildRegistryMenuItems(taskId);
|
||||
sub_812225C((u16 *)&data[2], (u16 *)&data[1], (u16)data[3], (u16)data[0]);
|
||||
sub_812225C(&data[2], &data[1], data[3], data[0]);
|
||||
FinalizeRegistryMenu(taskId);
|
||||
gTasks[taskId].func = HandleRegistryMenuInput;
|
||||
}
|
||||
@ -1061,7 +1061,7 @@ static void DeleteRegistry_No(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
ClearDialogWindowAndFrame(0, 0);
|
||||
DestroyListMenuTask((u8)data[5], (u16 *)&data[2], (u16 *)&data[1]);
|
||||
DestroyListMenuTask(data[5], &data[2], &data[1]);
|
||||
FinalizeRegistryMenu(taskId);
|
||||
gTasks[taskId].func = HandleRegistryMenuInput;
|
||||
}
|
||||
|
@ -252,8 +252,8 @@ struct SlotMachine
|
||||
/*0x0E*/ s16 payout;
|
||||
/*0x10*/ s16 netCoinLoss; // coins lost to machine (but never goes below 0)
|
||||
/*0x12*/ s16 bet;
|
||||
/*0x14*/ s16 reelTimePixelOffset;
|
||||
/*0x16*/ s16 reelTimePosition;
|
||||
/*0x14*/ s16 reeltimePixelOffset;
|
||||
/*0x16*/ s16 reeltimePosition;
|
||||
/*0x18*/ s16 currReel;
|
||||
/*0x1A*/ s16 reelIncrement; // speed of reel
|
||||
/*0x1C*/ s16 reelPixelOffsets[NUM_REELS];
|
||||
@ -584,7 +584,7 @@ static const u16 *const sDigitalDisplay_Pal;
|
||||
static const s16 sInitialReelPositions[NUM_REELS][2];
|
||||
static const u8 sLuckyFlagProbabilities_Top3[][6];
|
||||
static const u8 sLuckyFlagProbabilities_NotTop3[][6];
|
||||
static const u8 sReelTimeProbabilities_UnluckyGame[][17];
|
||||
static const u8 sReeltimeProbabilities_UnluckyGame[][17];
|
||||
static const u8 sReelTimeProbabilities_LuckyGame[][17];
|
||||
static const u8 sSymToMatch[];
|
||||
static const u8 sReelTimeTags[];
|
||||
@ -682,7 +682,7 @@ static const struct WindowTemplate sWindowTemplate_InfoBox =
|
||||
.baseBlock = 1
|
||||
};
|
||||
|
||||
static const u8 sColors_ReelTimeHelp[] = {TEXT_COLOR_LIGHT_GREY, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY};
|
||||
static const u8 sColors_ReeltimeHelp[] = {TEXT_COLOR_LIGHT_GREY, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY};
|
||||
|
||||
static bool8 (*const sSlotActions[])(struct Task *task) =
|
||||
{
|
||||
@ -985,7 +985,7 @@ static void PlaySlotMachine_Internal(u8 slotMachineIndex, MainCallback exitCallb
|
||||
{
|
||||
struct Task *task = &gTasks[CreateTask(SlotMachineDummyTask, 0xFF)];
|
||||
task->data[0] = slotMachineIndex;
|
||||
StoreWordInTwoHalfwords((u16 *)&task->data[1], (intptr_t)exitCallback);
|
||||
StoreWordInTwoHalfwords(&task->data[1], (intptr_t)exitCallback);
|
||||
}
|
||||
|
||||
|
||||
@ -1744,13 +1744,13 @@ static u8 AttemptsAtLuckyFlags_NotTop3(void)
|
||||
|
||||
static u8 GetReelTimeProbability(u8 reelTimeDraw)
|
||||
{
|
||||
if (!sSlotMachine->luckyGame)
|
||||
return sReelTimeProbabilities_UnluckyGame[reelTimeDraw][sSlotMachine->pikaPower];
|
||||
|
||||
if (sSlotMachine->luckyGame == FALSE)
|
||||
return sReeltimeProbabilities_UnluckyGame[reelTimeDraw][sSlotMachine->pikaPower];
|
||||
else
|
||||
return sReelTimeProbabilities_LuckyGame[reelTimeDraw][sSlotMachine->pikaPower];
|
||||
}
|
||||
|
||||
static void GetReelTimeDraw(void)
|
||||
static void GetReeltimeDraw(void)
|
||||
{
|
||||
u8 rval;
|
||||
s16 reelTimeDraw;
|
||||
@ -1773,13 +1773,15 @@ static bool8 ShouldReelTimeMachineExplode(u16 i)
|
||||
u16 rval = Random() & 0xff;
|
||||
if (rval < sReelTimeExplodeProbability[i])
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static u16 SlowReelSpeed(void)
|
||||
{
|
||||
u8 i = 0;
|
||||
u8 rval, value;
|
||||
u8 rval;
|
||||
u8 value;
|
||||
if (sSlotMachine->netCoinLoss >= 300)
|
||||
i = 4;
|
||||
else if (sSlotMachine->netCoinLoss >= 250)
|
||||
@ -1909,6 +1911,7 @@ static bool8 IsFinalTask_RunAwardPayoutActions(void)
|
||||
{
|
||||
if (FindTaskIdByFunc(RunAwardPayoutActions) == TAIL_SENTINEL)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1997,7 +2000,7 @@ static u8 GetTag(u8 reel, s16 offset)
|
||||
|
||||
static u8 GetNearbyReelTimeTag(s16 n)
|
||||
{
|
||||
s16 newPosition = (sSlotMachine->reelTimePosition + n) % 6;
|
||||
s16 newPosition = (sSlotMachine->reeltimePosition + n) % 6;
|
||||
if (newPosition < 0)
|
||||
newPosition += 6;
|
||||
return sReelTimeTags[newPosition];
|
||||
@ -2023,22 +2026,22 @@ s16 AdvanceSlotReelToNextTag(u8 reelIndex, s16 value)
|
||||
return offset;
|
||||
}
|
||||
|
||||
static void AdvanceReelTimeReel(s16 value)
|
||||
static void AdvanceReeltimeReel(s16 value)
|
||||
{
|
||||
sSlotMachine->reelTimePixelOffset += value;
|
||||
sSlotMachine->reelTimePixelOffset %= 120;
|
||||
sSlotMachine->reelTimePosition = 6 - sSlotMachine->reelTimePixelOffset / 20;
|
||||
sSlotMachine->reeltimePixelOffset += value;
|
||||
sSlotMachine->reeltimePixelOffset %= 120;
|
||||
sSlotMachine->reeltimePosition = 6 - sSlotMachine->reeltimePixelOffset / 20;
|
||||
}
|
||||
|
||||
s16 AdvanceReelTimeReelToNextTag(s16 value)
|
||||
s16 AdvanceReeltimeReelToNextTag(s16 value)
|
||||
{
|
||||
s16 offset = sSlotMachine->reelTimePixelOffset % 20;
|
||||
s16 offset = sSlotMachine->reeltimePixelOffset % 20;
|
||||
if (offset != 0)
|
||||
{
|
||||
if (offset < value)
|
||||
value = offset;
|
||||
AdvanceReelTimeReel(value);
|
||||
offset = sSlotMachine->reelTimePixelOffset % 20;
|
||||
AdvanceReeltimeReel(value);
|
||||
offset = sSlotMachine->reeltimePixelOffset % 20;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
@ -3077,8 +3080,8 @@ static void Task_ReelTime(u8 taskId)
|
||||
static void ReelTime_Init(struct Task *task)
|
||||
{
|
||||
sSlotMachine->reelTimeSpinsLeft = 0;
|
||||
sSlotMachine->reelTimePixelOffset = 0;
|
||||
sSlotMachine->reelTimePosition = 0;
|
||||
sSlotMachine->reeltimePixelOffset = 0;
|
||||
sSlotMachine->reeltimePosition = 0;
|
||||
task->tState++;
|
||||
task->data[1] = 0;
|
||||
task->data[2] = 30;
|
||||
@ -3093,7 +3096,7 @@ static void ReelTime_Init(struct Task *task)
|
||||
CreateReelTimeNumberSprites();
|
||||
CreateReelTimeShadowSprites();
|
||||
CreateReelTimeNumberGapSprite();
|
||||
GetReelTimeDraw();
|
||||
GetReeltimeDraw();
|
||||
StopMapMusic();
|
||||
PlayNewMapMusic(MUS_ROULETTE);
|
||||
}
|
||||
@ -3116,12 +3119,12 @@ static void ReelTime_WindowEnter(struct Task *task)
|
||||
task->tState++;
|
||||
task->data[3] = 0;
|
||||
}
|
||||
AdvanceReelTimeReel(task->data[4] >> 8);
|
||||
AdvanceReeltimeReel(task->data[4] >> 8);
|
||||
}
|
||||
|
||||
static void ReelTime_WaitStartPikachu(struct Task *task)
|
||||
{
|
||||
AdvanceReelTimeReel(task->data[4] >> 8);
|
||||
AdvanceReeltimeReel(task->data[4] >> 8);
|
||||
if (++task->data[5] >= 60)
|
||||
{
|
||||
task->tState++;
|
||||
@ -3141,7 +3144,7 @@ static void ReelTime_PikachuSpeedUp1(struct Task *task)
|
||||
memcpy(reelTimeBoltDelays, sReelTimeBoltDelays, sizeof(sReelTimeBoltDelays));
|
||||
memcpy(pikachuAuraFlashDelays, sPikachuAuraFlashDelays, sizeof(sPikachuAuraFlashDelays));
|
||||
|
||||
AdvanceReelTimeReel(task->data[4] >> 8);
|
||||
AdvanceReeltimeReel(task->data[4] >> 8);
|
||||
// gradually slow down the reel
|
||||
task->data[4] -= 4;
|
||||
i = 4 - (task->data[4] >> 8);
|
||||
@ -3159,7 +3162,7 @@ static void ReelTime_PikachuSpeedUp1(struct Task *task)
|
||||
|
||||
static void ReelTime_PikachuSpeedUp2(struct Task *task)
|
||||
{
|
||||
AdvanceReelTimeReel(task->data[4] >> 8);
|
||||
AdvanceReeltimeReel(task->data[4] >> 8);
|
||||
if (++task->data[5] >= 80)
|
||||
{
|
||||
task->tState++;
|
||||
@ -3171,7 +3174,7 @@ static void ReelTime_PikachuSpeedUp2(struct Task *task)
|
||||
|
||||
static void ReelTime_WaitReel(struct Task *task)
|
||||
{
|
||||
AdvanceReelTimeReel(task->data[4] >> 8);
|
||||
AdvanceReeltimeReel(task->data[4] >> 8);
|
||||
task->data[4] = (u8)task->data[4] + 0x80;
|
||||
if (++task->data[5] >= 80)
|
||||
{
|
||||
@ -3182,7 +3185,7 @@ static void ReelTime_WaitReel(struct Task *task)
|
||||
|
||||
static void ReelTime_CheckExplode(struct Task *task)
|
||||
{
|
||||
AdvanceReelTimeReel(task->data[4] >> 8);
|
||||
AdvanceReeltimeReel(task->data[4] >> 8);
|
||||
task->data[4] = (u8)task->data[4] + 0x40;
|
||||
if (++task->data[5] >= 40)
|
||||
{
|
||||
@ -3206,19 +3209,19 @@ static void ReelTime_CheckExplode(struct Task *task)
|
||||
|
||||
static void ReelTime_LandOnOutcome(struct Task *task)
|
||||
{
|
||||
s16 reelTimePixelOffset = sSlotMachine->reelTimePixelOffset % 20;
|
||||
if (reelTimePixelOffset)
|
||||
s16 reeltimePixelOffset = sSlotMachine->reeltimePixelOffset % 20;
|
||||
if (reeltimePixelOffset)
|
||||
{
|
||||
reelTimePixelOffset = AdvanceReelTimeReelToNextTag(task->data[4] >> 8);
|
||||
reeltimePixelOffset = AdvanceReeltimeReelToNextTag(task->data[4] >> 8);
|
||||
task->data[4] = (u8)task->data[4] + 0x40;
|
||||
}
|
||||
else if (GetNearbyReelTimeTag(1) != sSlotMachine->reelTimeDraw)
|
||||
{
|
||||
AdvanceReelTimeReel(task->data[4] >> 8);
|
||||
reelTimePixelOffset = sSlotMachine->reelTimePixelOffset % 20;
|
||||
AdvanceReeltimeReel(task->data[4] >> 8);
|
||||
reeltimePixelOffset = sSlotMachine->reeltimePixelOffset % 20;
|
||||
task->data[4] = (u8)task->data[4] + 0x40;
|
||||
}
|
||||
if (reelTimePixelOffset == 0 && GetNearbyReelTimeTag(1) == sSlotMachine->reelTimeDraw)
|
||||
if (reeltimePixelOffset == 0 && GetNearbyReelTimeTag(1) == sSlotMachine->reelTimeDraw)
|
||||
{
|
||||
task->data[4] = 0; // stop moving
|
||||
task->tState++;
|
||||
@ -3441,7 +3444,7 @@ static void InfoBox_DrawWindow(struct Task *task)
|
||||
|
||||
static void InfoBox_AddText(struct Task *task)
|
||||
{
|
||||
AddTextPrinterParameterized3(1, 1, 2, 5, sColors_ReelTimeHelp, 0, gText_ReelTimeHelp);
|
||||
AddTextPrinterParameterized3(1, 1, 2, 5, sColors_ReeltimeHelp, 0, gText_ReelTimeHelp);
|
||||
CopyWindowToVram(1, 3);
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0));
|
||||
task->tState++;
|
||||
@ -3771,7 +3774,7 @@ static void CreateReelTimeNumberSprites(void)
|
||||
|
||||
static void SpriteCB_ReelTimeNumbers(struct Sprite *sprite)
|
||||
{
|
||||
s16 r0 = (u16)(sSlotMachine->reelTimePixelOffset + sprite->data[7]);
|
||||
s16 r0 = (u16)(sSlotMachine->reeltimePixelOffset + sprite->data[7]);
|
||||
r0 %= 40;
|
||||
sprite->pos1.y = r0 + 59;
|
||||
StartSpriteAnimIfDifferent(sprite, GetNearbyReelTimeTag(r0 / 20));
|
||||
@ -4827,7 +4830,7 @@ static const u8 sLuckyFlagProbabilities_NotTop3[][6] = {
|
||||
{40, 40, 35, 35, 40, 40}
|
||||
};
|
||||
|
||||
static const u8 sReelTimeProbabilities_UnluckyGame[][17] = {
|
||||
static const u8 sReeltimeProbabilities_UnluckyGame[][17] = {
|
||||
{243, 243, 243, 80, 80, 80, 80, 40, 40, 40, 40, 40, 40, 5, 5, 5, 5},
|
||||
{ 5, 5, 5, 150, 150, 150, 150, 130, 130, 130, 130, 130, 130, 100, 100, 100, 5},
|
||||
{ 4, 4, 4, 20, 20, 20, 20, 80, 80, 80, 80, 80, 80, 100, 100, 100, 40},
|
||||
|
@ -462,7 +462,7 @@ static bool32 InitStartMenuStep(void)
|
||||
sInitStartMenuData[0]++;
|
||||
break;
|
||||
case 4:
|
||||
if (PrintStartMenuActions((s8 *)&sInitStartMenuData[1], 2))
|
||||
if (PrintStartMenuActions(&sInitStartMenuData[1], 2))
|
||||
sInitStartMenuData[0]++;
|
||||
break;
|
||||
case 5:
|
||||
|
@ -355,7 +355,7 @@ static void SetUpDataStruct(void)
|
||||
{
|
||||
if (sHillData == NULL)
|
||||
{
|
||||
sHillData = AllocZeroed(sizeof(struct TrHillStruct2));
|
||||
sHillData = AllocZeroed(sizeof(*sHillData));
|
||||
sHillData->floorId = gMapHeader.mapLayoutId - LAYOUT_TRAINER_HILL_1F;
|
||||
CpuCopy32(sDataPerTag[gSaveBlock1Ptr->trainerHill.tag], &sHillData->tag, sizeof(sHillData->tag) + 4 * sizeof(struct TrHillFloor));
|
||||
nullsub_2();
|
||||
|
@ -603,7 +603,7 @@ static void sub_80B44C8(u8 taskId)
|
||||
struct ObjectEvent *objEvent;
|
||||
|
||||
// another objEvent loaded into by loadword?
|
||||
LoadWordFromTwoHalfwords((u16*)&task->data[1], (u32 *)&objEvent);
|
||||
LoadWordFromTwoHalfwords(&task->data[1], (u32 *)&objEvent);
|
||||
if (!task->data[7])
|
||||
{
|
||||
ObjectEventClearHeldMovement(objEvent);
|
||||
@ -624,7 +624,7 @@ static void sub_80B44C8(u8 taskId)
|
||||
|
||||
void sub_80B4578(struct ObjectEvent *var)
|
||||
{
|
||||
StoreWordInTwoHalfwords((u16 *)&gTasks[CreateTask(sub_80B44C8, 0)].data[1], (u32)var);
|
||||
StoreWordInTwoHalfwords(&gTasks[CreateTask(sub_80B44C8, 0)].data[1], (u32)var);
|
||||
}
|
||||
|
||||
void EndTrainerApproach(void)
|
||||
|
@ -3753,7 +3753,7 @@ static void UR_AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str
|
||||
printerTemplate.y = y;
|
||||
printerTemplate.currentX = x;
|
||||
printerTemplate.currentY = y;
|
||||
printerTemplate.style = 0;
|
||||
printerTemplate.unk = 0;
|
||||
|
||||
gTextFlags.useAlternateDownArrow = FALSE;
|
||||
switch (colorIdx)
|
||||
|
@ -2121,7 +2121,7 @@ static void Task_ReceiveChatMessage(u8 taskId)
|
||||
|
||||
static bool8 TryAllocDisplay(void)
|
||||
{
|
||||
sDisplay = Alloc(sizeof(struct UnionRoomChatDisplay));
|
||||
sDisplay = Alloc(sizeof(*sDisplay));
|
||||
if (sDisplay && TryAllocSprites())
|
||||
{
|
||||
ResetBgsAndClearDma3BusyFlags(0);
|
||||
|
@ -118,8 +118,8 @@ static u8 GetLetterTableId(u8 letter)
|
||||
static bool32 TryCalculateWallpaper(u16* backgroundClr, u16 *foregroundClr, u8 *iconId, u8 *patternId, u16 trainerId, u8 *phrase)
|
||||
{
|
||||
s32 i;
|
||||
u8 array[9];
|
||||
u8 charsByTableId[15];
|
||||
ALIGNED(2) u8 array[12];
|
||||
u8 charsByTableId[16];
|
||||
u16 *ptr;
|
||||
|
||||
if (StringLength(phrase) != 15)
|
||||
|
@ -237,7 +237,7 @@ static void PrintHeaderTexts(void)
|
||||
FillWindowPixelBuffer(1, PIXEL_FILL(0));
|
||||
FillWindowPixelBuffer(2, PIXEL_FILL(0));
|
||||
WCSS_AddTextPrinterParameterized(0, 1, sHeaderTexts[0], GetStringCenterAlignXOffset(1, sHeaderTexts[0], 0xC0), 6, COLORMODE_GREEN);
|
||||
for (i = 0; i < (int)ARRAY_COUNT(sHeaderTexts[0]) - 1; i++)
|
||||
for (i = 0; i < (int)ARRAY_COUNT(*sHeaderTexts) - 1; i++)
|
||||
{
|
||||
WCSS_AddTextPrinterParameterized(1, 1, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_WHITE_LGRAY);
|
||||
}
|
||||
@ -362,12 +362,12 @@ static u32 CountPlayersInGroupAndGetActivity(struct UnkStruct_x20 * unk20, u32 *
|
||||
{
|
||||
if (group_players(i) == 0)
|
||||
{
|
||||
k = 0; //Should just be 1 without the increment after the loop ends but that doesn't match.
|
||||
k = 0;
|
||||
for (j = 0; j < RFU_CHILD_MAX; j++)
|
||||
{
|
||||
if (unk20->gname_uname.gname.child_sprite_gender[j] != 0) k++;
|
||||
}
|
||||
k++; //See above comment.
|
||||
k++;
|
||||
groupCounts[group_type(i)] += k;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user