summaryrefslogtreecommitdiff
path: root/src/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/link.c2
-rw-r--r--src/engine/save.c6
-rw-r--r--src/engine/save_failed_screen.c4
-rw-r--r--src/engine/sprite.c11
-rw-r--r--src/engine/string_util.c34
-rw-r--r--src/engine/text.c230
-rw-r--r--src/engine/tileset_anim.c46
-rw-r--r--src/engine/trade.c88
8 files changed, 212 insertions, 209 deletions
diff --git a/src/engine/link.c b/src/engine/link.c
index 850201ccb..7f7e48083 100644
--- a/src/engine/link.c
+++ b/src/engine/link.c
@@ -954,7 +954,7 @@ static u16 LinkTestCalcBlockChecksum(void *data, u16 size)
static void PrintHexDigit(u8 tileNum, u8 x, u8 y)
{
- u16 *tilemap = (u16 *)BG_SCREEN_ADDR(gLinkTestBGInfo.screenBaseBlock);
+ u16 *tilemap = BG_SCREEN_ADDR(gLinkTestBGInfo.screenBaseBlock);
tilemap[(32 * y) + x] = (gLinkTestBGInfo.paletteNum << 12) | (tileNum + 1);
}
diff --git a/src/engine/save.c b/src/engine/save.c
index eae3f4470..5ea949cae 100644
--- a/src/engine/save.c
+++ b/src/engine/save.c
@@ -282,7 +282,7 @@ u8 sub_81255B8(u16 a1, const struct SaveSectionLocation *location)
for (i = 0; i < sizeof(struct UnkSaveSection); i++)
{
- if (ProgramFlashByte(sector, i, ((u8 *)gFastSaveSection)[i]))
+ if (ProgramFlashByte(sector, i, gFastSaveSection->data[i]))
{
status = 0xFF;
break;
@@ -402,7 +402,7 @@ u8 sub_81258BC(u16 a1, const struct SaveSectionLocation *location)
{
u16 j;
for (j = 0; j < location[id].size; j++)
- ((u8 *)location[id].data)[j] = gFastSaveSection->data[j];
+ location[id].data[j] = gFastSaveSection->data[j];
}
}
@@ -774,7 +774,7 @@ u8 unref_sub_8125FF0(u8 *data, u16 size)
for (i = 0; i < size; i++)
section->data[i] = data[i];
- gLastSaveSectorStatus = ProgramFlashSectorAndVerifyNBytes(gFlashSectors[0], (u8 *)section, sizeof(struct SaveSection));
+ gLastSaveSectorStatus = ProgramFlashSectorAndVerifyNBytes(gFlashSectors[0], section, sizeof(struct SaveSection));
if (gLastSaveSectorStatus)
return 0xFF;
diff --git a/src/engine/save_failed_screen.c b/src/engine/save_failed_screen.c
index b91e8b5bf..17bda237e 100644
--- a/src/engine/save_failed_screen.c
+++ b/src/engine/save_failed_screen.c
@@ -267,10 +267,10 @@ static void VBlankCB_UpdateClockGraphics(void)
static bool8 VerifySectorWipe(u16 sector)
{
- u32 *ptr = (u32 *)unk_2000000;
+ u32 *ptr = (u32 *)&unk_2000000;
u16 i;
- ReadFlash(sector, 0, (u8 *)ptr, 4096);
+ ReadFlash(sector, 0, ptr, 4096);
for (i = 0; i < 0x400; i++, ptr++)
if (*ptr)
diff --git a/src/engine/sprite.c b/src/engine/sprite.c
index 5d394502a..34ca3802d 100644
--- a/src/engine/sprite.c
+++ b/src/engine/sprite.c
@@ -833,13 +833,13 @@ static void RequestSpriteFrameImageCopy(u16 index, u16 tileNum, const struct Spr
if (gSpriteCopyRequestCount < MAX_SPRITE_COPY_REQUESTS)
{
gSpriteCopyRequests[gSpriteCopyRequestCount].src = images[index].data;
- gSpriteCopyRequests[gSpriteCopyRequestCount].dest = (u8 *)OBJ_VRAM0 + TILE_SIZE_4BPP * tileNum;
+ gSpriteCopyRequests[gSpriteCopyRequestCount].dest = OBJ_VRAM0 + TILE_SIZE_4BPP * tileNum;
gSpriteCopyRequests[gSpriteCopyRequestCount].size = images[index].size;
gSpriteCopyRequestCount++;
}
}
-void RequestSpriteCopy(const u8 *src, u8 *dest, u16 size)
+void RequestSpriteCopy(const void *src, u8 *dest, u16 size)
{
if (gSpriteCopyRequestCount < MAX_SPRITE_COPY_REQUESTS)
{
@@ -850,6 +850,7 @@ void RequestSpriteCopy(const u8 *src, u8 *dest, u16 size)
}
}
+// these two functions are unused.
void CopyFromSprites(u8 *dest)
{
u32 i;
@@ -1479,7 +1480,7 @@ u16 LoadSpriteSheet(const struct SpriteSheet *sheet)
else
{
AllocSpriteTileRange(sheet->tag, (u16)tileStart, sheet->size / TILE_SIZE_4BPP);
- CpuCopy16(sheet->data, (u8 *)OBJ_VRAM0 + TILE_SIZE_4BPP * tileStart, sheet->size);
+ CpuCopy16(sheet->data, OBJ_VRAM0 + TILE_SIZE_4BPP * tileStart, sheet->size);
return (u16)tileStart;
}
}
@@ -1517,7 +1518,7 @@ void LoadTilesForSpriteSheet(const struct SpriteSheet *sheet)
{
const u8 *data = sheet->data;
u16 tileStart = GetSpriteTileStartByTag(sheet->tag);
- CpuCopy16(data, (u8 *)OBJ_VRAM0 + TILE_SIZE_4BPP * tileStart, sheet->size);
+ CpuCopy16(data, OBJ_VRAM0 + TILE_SIZE_4BPP * tileStart, sheet->size);
}
void LoadTilesForSpriteSheets(struct SpriteSheet *sheets)
@@ -1603,7 +1604,7 @@ void RequestSpriteSheetCopy(const struct SpriteSheet *sheet)
{
const u8 *data = sheet->data;
u16 tileStart = GetSpriteTileStartByTag(sheet->tag);
- RequestSpriteCopy(data, (u8 *)OBJ_VRAM0 + tileStart * TILE_SIZE_4BPP, sheet->size);
+ RequestSpriteCopy(data, OBJ_VRAM0 + tileStart * TILE_SIZE_4BPP, sheet->size);
}
u16 LoadSpriteSheetDeferred(const struct SpriteSheet *sheet)
diff --git a/src/engine/string_util.c b/src/engine/string_util.c
index 9686256a1..7316f533a 100644
--- a/src/engine/string_util.c
+++ b/src/engine/string_util.c
@@ -376,7 +376,7 @@ u8 *StringExpandPlaceholders(u8 *dest, const u8 *src)
{
u8 c = *src++;
u8 placeholderId;
- u8 *expandedString;
+ const u8 *expandedString;
u8 length;
switch (c)
@@ -432,45 +432,45 @@ u8 *StringBraille(u8 *dest, const u8 *src)
}
}
-static u8 *ExpandPlaceholder_UnknownStringVar(void)
+static const u8 *ExpandPlaceholder_UnknownStringVar(void)
{
return gUnknownStringVar;
}
-static u8 *ExpandPlaceholder_PlayerName(void)
+static const u8 *ExpandPlaceholder_PlayerName(void)
{
return gSaveBlock2.playerName;
}
-static u8 *ExpandPlaceholder_StringVar1(void)
+static const u8 *ExpandPlaceholder_StringVar1(void)
{
return gStringVar1;
}
-static u8 *ExpandPlaceholder_StringVar2(void)
+static const u8 *ExpandPlaceholder_StringVar2(void)
{
return gStringVar2;
}
-static u8 *ExpandPlaceholder_StringVar3(void)
+static const u8 *ExpandPlaceholder_StringVar3(void)
{
return gStringVar3;
}
-static u8 *ExpandPlaceholder_KunChan(void)
+static const u8 *ExpandPlaceholder_KunChan(void)
{
if (gSaveBlock2.playerGender == MALE)
- return (u8 *) gExpandedPlaceholder_Kun;
+ return gExpandedPlaceholder_Kun;
else
- return (u8 *) gExpandedPlaceholder_Chan;
+ return gExpandedPlaceholder_Chan;
}
-static u8 *ExpandPlaceholder_RivalName(void)
+static const u8 *ExpandPlaceholder_RivalName(void)
{
if (gSaveBlock2.playerGender == MALE)
- return (u8 *) gExpandedPlaceholder_May;
+ return gExpandedPlaceholder_May;
else
- return (u8 *) gExpandedPlaceholder_Brendan;
+ return gExpandedPlaceholder_Brendan;
}
#define VERSION_DEPENDENT_PLACEHOLDER_LIST \
@@ -484,19 +484,19 @@ static u8 *ExpandPlaceholder_RivalName(void)
#ifdef SAPPHIRE
#define X(ph, r, s) \
-static u8 *ExpandPlaceholder_##ph(void) { return (u8 *) gExpandedPlaceholder_##s; }
+static const u8 *ExpandPlaceholder_##ph(void) { return gExpandedPlaceholder_##s; }
VERSION_DEPENDENT_PLACEHOLDER_LIST
#else
#define X(ph, r, s) \
-static u8 *ExpandPlaceholder_##ph(void) { return (u8 *) gExpandedPlaceholder_##r; }
+static const u8 *ExpandPlaceholder_##ph(void) { return gExpandedPlaceholder_##r; }
VERSION_DEPENDENT_PLACEHOLDER_LIST
#endif
#undef X
-u8 *GetExpandedPlaceholder(u32 id)
+const u8 *GetExpandedPlaceholder(u32 id)
{
- typedef u8 *(*ExpandPlaceholderFunc)(void);
+ typedef const u8 *(*ExpandPlaceholderFunc)(void);
static const ExpandPlaceholderFunc funcs[] =
{
@@ -517,7 +517,7 @@ u8 *GetExpandedPlaceholder(u32 id)
};
if (id >= ARRAY_COUNT(funcs))
- return (u8 *) gExpandedPlaceholder_Empty;
+ return gExpandedPlaceholder_Empty;
else
return funcs[id]();
}
diff --git a/src/engine/text.c b/src/engine/text.c
index 87903608f..1d1d31383 100644
--- a/src/engine/text.c
+++ b/src/engine/text.c
@@ -396,6 +396,8 @@ extern const u32 gFont4LatinGlyphs[];
extern const u32 gFont3JapaneseGlyphs[];
extern const u32 gFont4JapaneseGlyphs[];
+// Getting rid of the u8 recasting will make the ROM no longer match due to
+// a const being required to pass the elements directly to the rodata structs.
static const struct Font sFonts[] =
{
// Japanese fonts
@@ -405,15 +407,15 @@ static const struct Font sFonts[] =
{ 4, (u8 *)gFont3JapaneseGlyphs, 64, 512 },
{ 1, (u8 *)gFont4JapaneseGlyphs, 32, 0 },
{ 2, (u8 *)gFont4JapaneseGlyphs, 32, 0 },
- { 3, (u8 *)sBrailleGlyphs, 8, 0 },
+ { 3, (u8 *)sBrailleGlyphs, 8, 0 },
// Latin
- { 0, (u8 *)sFont0LatinGlyphs, 16, 8 },
- { 1, (u8 *)sFont1LatinGlyphs, 8, 0 },
- { 2, (u8 *)sFont1LatinGlyphs, 8, 0 },
- { 0, (u8 *)gFont3LatinGlyphs, 64, 32 },
- { 1, (u8 *)gFont4LatinGlyphs, 32, 0 },
- { 2, (u8 *)gFont4LatinGlyphs, 32, 0 },
- { 3, (u8 *)sBrailleGlyphs, 8, 0 },
+ { 0, (u8 *)sFont0LatinGlyphs, 16, 8 },
+ { 1, (u8 *)sFont1LatinGlyphs, 8, 0 },
+ { 2, (u8 *)sFont1LatinGlyphs, 8, 0 },
+ { 0, (u8 *)gFont3LatinGlyphs, 64, 32 },
+ { 1, (u8 *)gFont4LatinGlyphs, 32, 0 },
+ { 2, (u8 *)gFont4LatinGlyphs, 32, 0 },
+ { 3, (u8 *)sBrailleGlyphs, 8, 0 },
};
static const u8 sTextSpeedDelays[] = { 6, 3, 1 }; // slow, mid, fast
@@ -492,8 +494,8 @@ const struct WindowConfig gWindowConfig_81E6C3C =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(31), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(31), // tilemap
};
const struct WindowConfig gWindowConfig_81E6C58 =
@@ -513,8 +515,8 @@ const struct WindowConfig gWindowConfig_81E6C58 =
0, // tilemap top coordinate
26, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(24), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(24), // tilemap
};
const struct WindowConfig gWindowConfig_81E6C74 =
@@ -534,7 +536,7 @@ const struct WindowConfig gWindowConfig_81E6C74 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)OBJ_VRAM0, // tile data
+ OBJ_VRAM0, // tile data
NULL, // tilemap
};
@@ -555,8 +557,8 @@ const struct WindowConfig gWindowConfig_81E6C90 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(1), // tile data
- (u16 *)BG_SCREEN_ADDR(30), // tilemap
+ BG_CHAR_ADDR(1), // tile data
+ BG_SCREEN_ADDR(30), // tilemap
};
const struct WindowConfig gWindowConfig_81E6CAC =
@@ -597,8 +599,8 @@ const struct WindowConfig gWindowConfig_81E6CC8 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(15), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(15), // tilemap
};
const struct WindowConfig gWindowConfig_81E6CE4 =
@@ -618,8 +620,8 @@ const struct WindowConfig gWindowConfig_81E6CE4 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(31), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(31), // tilemap
};
const struct WindowConfig gWindowConfig_81E6D00 =
@@ -639,8 +641,8 @@ const struct WindowConfig gWindowConfig_81E6D00 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(31), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(31), // tilemap
};
const struct WindowConfig gWindowConfig_81E6D1C =
@@ -660,8 +662,8 @@ const struct WindowConfig gWindowConfig_81E6D1C =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(31), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(31), // tilemap
};
const struct WindowConfig gWindowConfig_81E6D38 =
@@ -702,8 +704,8 @@ const struct WindowConfig gWindowConfig_81E6D54 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(3), // tile data
- (u16 *)BG_SCREEN_ADDR(15), // tilemap
+ BG_CHAR_ADDR(3), // tile data
+ BG_SCREEN_ADDR(15), // tilemap
};
const struct WindowConfig gWindowConfig_81E6D70 =
@@ -723,8 +725,8 @@ const struct WindowConfig gWindowConfig_81E6D70 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(3), // tile data
- (u16 *)BG_SCREEN_ADDR(15), // tilemap
+ BG_CHAR_ADDR(3), // tile data
+ BG_SCREEN_ADDR(15), // tilemap
};
const struct WindowConfig gWindowConfig_81E6D8C =
@@ -744,8 +746,8 @@ const struct WindowConfig gWindowConfig_81E6D8C =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(14), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(14), // tilemap
};
const struct WindowConfig gWindowConfig_81E6DA8 =
@@ -765,8 +767,8 @@ const struct WindowConfig gWindowConfig_81E6DA8 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(11), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(11), // tilemap
};
const struct WindowConfig WindowConfig_TrainerCard_Back_Values =
@@ -786,8 +788,8 @@ const struct WindowConfig WindowConfig_TrainerCard_Back_Values =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(30), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(30), // tilemap
};
const struct WindowConfig WindowConfig_TrainerCard_Back_Labels =
@@ -807,8 +809,8 @@ const struct WindowConfig WindowConfig_TrainerCard_Back_Labels =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(30), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(30), // tilemap
};
const struct WindowConfig gWindowConfig_81E6DFC =
@@ -828,8 +830,8 @@ const struct WindowConfig gWindowConfig_81E6DFC =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(31), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(31), // tilemap
};
const struct WindowConfig gWindowConfig_81E6E18 =
@@ -849,8 +851,8 @@ const struct WindowConfig gWindowConfig_81E6E18 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(31), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(31), // tilemap
};
const struct WindowConfig gWindowConfig_81E6E34 =
@@ -870,8 +872,8 @@ const struct WindowConfig gWindowConfig_81E6E34 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(31), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(31), // tilemap
};
const struct WindowConfig gWindowConfig_81E6E50 =
@@ -891,8 +893,8 @@ const struct WindowConfig gWindowConfig_81E6E50 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(28), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(28), // tilemap
};
const struct WindowConfig gWindowConfig_81E6E6C =
@@ -912,8 +914,8 @@ const struct WindowConfig gWindowConfig_81E6E6C =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(30), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(30), // tilemap
};
const struct WindowConfig gWindowConfig_81E6E88 =
@@ -933,8 +935,8 @@ const struct WindowConfig gWindowConfig_81E6E88 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(31), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(31), // tilemap
};
const struct WindowConfig gWindowConfig_81E6EA4 =
@@ -954,8 +956,8 @@ const struct WindowConfig gWindowConfig_81E6EA4 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(28), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(28), // tilemap
};
const struct WindowConfig gWindowConfig_81E6EC0 =
@@ -975,8 +977,8 @@ const struct WindowConfig gWindowConfig_81E6EC0 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(29), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(29), // tilemap
};
const struct WindowConfig gWindowConfig_81E6EDC =
@@ -996,8 +998,8 @@ const struct WindowConfig gWindowConfig_81E6EDC =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(28), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(28), // tilemap
};
const struct WindowConfig gWindowConfig_81E6EF8 =
@@ -1017,8 +1019,8 @@ const struct WindowConfig gWindowConfig_81E6EF8 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(29), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(29), // tilemap
};
const struct WindowConfig gWindowConfig_81E6F14 =
@@ -1038,8 +1040,8 @@ const struct WindowConfig gWindowConfig_81E6F14 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(28), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(28), // tilemap
};
const struct WindowConfig gWindowConfig_81E6F30 =
@@ -1059,8 +1061,8 @@ const struct WindowConfig gWindowConfig_81E6F30 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(29), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(29), // tilemap
};
const struct WindowConfig gWindowConfig_81E6F4C =
@@ -1080,8 +1082,8 @@ const struct WindowConfig gWindowConfig_81E6F4C =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(30), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(30), // tilemap
};
const struct WindowConfig gWindowConfig_81E6F68 =
@@ -1101,8 +1103,8 @@ const struct WindowConfig gWindowConfig_81E6F68 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(13), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(13), // tilemap
};
const struct WindowConfig gWindowConfig_81E6F84 =
@@ -1122,8 +1124,8 @@ const struct WindowConfig gWindowConfig_81E6F84 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(31), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(31), // tilemap
};
const struct WindowConfig gWindowConfig_81E6FA0 =
@@ -1143,8 +1145,8 @@ const struct WindowConfig gWindowConfig_81E6FA0 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(24), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(24), // tilemap
};
const struct WindowConfig gWindowConfig_81E6FBC =
@@ -1164,8 +1166,8 @@ const struct WindowConfig gWindowConfig_81E6FBC =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(30), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(30), // tilemap
};
const struct WindowConfig gWindowConfig_81E6FD8 =
@@ -1185,8 +1187,8 @@ const struct WindowConfig gWindowConfig_81E6FD8 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(24), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(24), // tilemap
};
const struct WindowConfig gWindowConfig_81E6FF4 =
@@ -1206,8 +1208,8 @@ const struct WindowConfig gWindowConfig_81E6FF4 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(24), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(24), // tilemap
};
const struct WindowConfig gWindowConfig_81E7010 =
@@ -1227,8 +1229,8 @@ const struct WindowConfig gWindowConfig_81E7010 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(30), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(30), // tilemap
};
const struct WindowConfig gWindowConfig_81E702C =
@@ -1248,8 +1250,8 @@ const struct WindowConfig gWindowConfig_81E702C =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(15), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(15), // tilemap
};
const struct WindowConfig gWindowConfig_81E7048 =
@@ -1269,8 +1271,8 @@ const struct WindowConfig gWindowConfig_81E7048 =
0, // tilemap top coordinate
16, // width
32, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(14), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(14), // tilemap
};
const struct WindowConfig gWindowConfig_81E7064 =
@@ -1290,8 +1292,8 @@ const struct WindowConfig gWindowConfig_81E7064 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(14), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(14), // tilemap
};
const struct WindowConfig gWindowConfig_81E7080 =
@@ -1311,8 +1313,8 @@ const struct WindowConfig gWindowConfig_81E7080 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(30), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(30), // tilemap
};
const struct WindowConfig gWindowConfig_81E709C =
@@ -1332,8 +1334,8 @@ const struct WindowConfig gWindowConfig_81E709C =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(31), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(31), // tilemap
};
const struct WindowConfig gWindowConfig_81E70B8 =
@@ -1353,8 +1355,8 @@ const struct WindowConfig gWindowConfig_81E70B8 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(30), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(30), // tilemap
};
const struct WindowConfig gWindowConfig_81E70D4 =
@@ -1374,8 +1376,8 @@ const struct WindowConfig gWindowConfig_81E70D4 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(30), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(30), // tilemap
};
const struct WindowConfig gWindowConfig_81E70F0 =
@@ -1416,8 +1418,8 @@ const struct WindowConfig gWindowConfig_81E710C =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(31), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(31), // tilemap
};
const struct WindowConfig gWindowConfig_81E7128 =
@@ -1437,8 +1439,8 @@ const struct WindowConfig gWindowConfig_81E7128 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(31), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(31), // tilemap
};
const struct WindowConfig gWindowConfig_81E7144 =
@@ -1458,8 +1460,8 @@ const struct WindowConfig gWindowConfig_81E7144 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(31), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(31), // tilemap
};
const struct WindowConfig gWindowConfig_81E7160 =
@@ -1479,8 +1481,8 @@ const struct WindowConfig gWindowConfig_81E7160 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(1), // tile data
- (u16 *)BG_SCREEN_ADDR(10), // tilemap
+ BG_CHAR_ADDR(1), // tile data
+ BG_SCREEN_ADDR(10), // tilemap
};
const struct WindowConfig gWindowConfig_81E717C =
@@ -1500,8 +1502,8 @@ const struct WindowConfig gWindowConfig_81E717C =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(3), // tile data
- (u16 *)BG_SCREEN_ADDR(31), // tilemap
+ BG_CHAR_ADDR(3), // tile data
+ BG_SCREEN_ADDR(31), // tilemap
};
const struct WindowConfig gWindowConfig_81E7198 =
@@ -1521,8 +1523,8 @@ const struct WindowConfig gWindowConfig_81E7198 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(15), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(15), // tilemap
};
const struct WindowConfig gWindowConfig_81E71B4 =
@@ -1542,8 +1544,8 @@ const struct WindowConfig gWindowConfig_81E71B4 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(15), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(15), // tilemap
};
const struct WindowConfig gWindowConfig_81E71D0 =
@@ -1563,8 +1565,8 @@ const struct WindowConfig gWindowConfig_81E71D0 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(1), // tile data
- (u16 *)BG_SCREEN_ADDR(28), // tilemap
+ BG_CHAR_ADDR(1), // tile data
+ BG_SCREEN_ADDR(28), // tilemap
};
const struct WindowConfig gWindowConfig_81E71EC =
@@ -1584,8 +1586,8 @@ const struct WindowConfig gWindowConfig_81E71EC =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(1), // tile data
- (u16 *)BG_SCREEN_ADDR(30), // tilemap
+ BG_CHAR_ADDR(1), // tile data
+ BG_SCREEN_ADDR(30), // tilemap
};
const struct WindowConfig gWindowConfig_81E7208 =
@@ -1605,8 +1607,8 @@ const struct WindowConfig gWindowConfig_81E7208 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(28), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(28), // tilemap
};
const struct WindowConfig gWindowConfig_81E7224 =
@@ -1626,8 +1628,8 @@ const struct WindowConfig gWindowConfig_81E7224 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(0), // tile data
- (u16 *)BG_SCREEN_ADDR(31), // tilemap
+ BG_CHAR_ADDR(0), // tile data
+ BG_SCREEN_ADDR(31), // tilemap
};
const struct WindowConfig gWindowConfig_81E7240 =
@@ -1647,8 +1649,8 @@ const struct WindowConfig gWindowConfig_81E7240 =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)BG_CHAR_ADDR(2), // tile data
- (u16 *)BG_SCREEN_ADDR(30), // tilemap
+ BG_CHAR_ADDR(2), // tile data
+ BG_SCREEN_ADDR(30), // tilemap
};
const struct WindowConfig gWindowConfig_81E725C =
@@ -1668,7 +1670,7 @@ const struct WindowConfig gWindowConfig_81E725C =
0, // tilemap top coordinate
30, // width
20, // height
- (u8 *)OBJ_VRAM0, // tile data
+ OBJ_VRAM0, // tile data
NULL, // tilemap
};
diff --git a/src/engine/tileset_anim.c b/src/engine/tileset_anim.c
index 34685381d..f892e5e9a 100644
--- a/src/engine/tileset_anim.c
+++ b/src/engine/tileset_anim.c
@@ -32,8 +32,8 @@ extern u8 *gTilesetAnimTable_BikeShop[];
struct Dma
{
- u8 *src;
- u8 *dest;
+ void *src;
+ void *dest;
u16 size;
};
@@ -95,7 +95,7 @@ static void ClearTilesetAnimDmas(void)
CpuFill32(0, &gTilesetAnimDmas, sizeof(gTilesetAnimDmas));
}
-static void QueueTilesetAnimDma(u8 *src, u8 *dest, u16 size)
+static void QueueTilesetAnimDma(void *src, void *dest, u16 size)
{
if (gNumTilesetAnimDmas < 20)
{
@@ -217,28 +217,28 @@ static void sub_8073070(u16 a1)
{
int v1;
v1 = a1 % 4;
- QueueTilesetAnimDma(gTilesetAnimTable_General_0[v1], (u8 *)(BG_VRAM + 0x3f80), 0x80);
+ QueueTilesetAnimDma(gTilesetAnimTable_General_0[v1], BG_TILE_ADDR(127), 0x80);
}
static void sub_8073098(u16 a1)
{
u8 v1;
v1 = a1 % 8;
- QueueTilesetAnimDma(gTilesetAnimTable_General_1[v1], (u8 *)(BG_VRAM + 0x3600), 0x3c0);
+ QueueTilesetAnimDma(gTilesetAnimTable_General_1[v1], BG_TILE_ADDR(108), 0x3c0);
}
static void sub_80730C0(u16 a1)
{
int v1;
v1 = a1 % 8;
- QueueTilesetAnimDma(gTilesetAnimTable_General_2[v1], (u8 *)(BG_VRAM + 0x3a00), 0x140);
+ QueueTilesetAnimDma(gTilesetAnimTable_General_2[v1], BG_TILE_ADDR(116), 0x140);
}
static void sub_80730E8(u16 a1)
{
int v1;
v1 = a1 % 4;
- QueueTilesetAnimDma(gTilesetAnimTable_General_3[v1], (u8 *)(BG_VRAM + 0x3e00), 0xc0);
+ QueueTilesetAnimDma(gTilesetAnimTable_General_3[v1], BG_TILE_ADDR(124), 0xc0);
}
void TilesetCB_Petalburg(void)
@@ -454,37 +454,37 @@ static void sub_807361C(u16 a1)
{
int v1;
v1 = a1 % 4;
- QueueTilesetAnimDma(gTilesetAnimTable_General_4[v1], (u8 *)(BG_VRAM + 0x3c00), 0x140);
+ QueueTilesetAnimDma(gTilesetAnimTable_General_4[v1], BG_TILE_ADDR(120), 0x140);
}
static void sub_8073644(u8 a1)
{
u8 v1;
v1 = a1 % 4;
- QueueTilesetAnimDma(gTilesetAnimTable_Lavaridge[v1], (u8 *)(BG_VRAM + 0x6400), 0x80);
+ QueueTilesetAnimDma(gTilesetAnimTable_Lavaridge[v1], BG_TILE_ADDR(200), 0x80);
v1 = (a1 + 2) % 4;
- QueueTilesetAnimDma(gTilesetAnimTable_Lavaridge[v1], (u8 *)(BG_VRAM + 0x6480), 0x80);
+ QueueTilesetAnimDma(gTilesetAnimTable_Lavaridge[v1], BG_TILE_ADDR(201), 0x80);
}
static void sub_807368C(u8 a1)
{
int v1;
v1 = a1 % 4;
- QueueTilesetAnimDma(gTilesetAnimTable_Pacifidlog_0[v1], (u8 *)(BG_VRAM + 0x7a00), 0x3c0);
+ QueueTilesetAnimDma(gTilesetAnimTable_Pacifidlog_0[v1], BG_TILE_ADDR(244), 0x3c0);
}
static void sub_80736B4(u8 a1)
{
int v1;
v1 = a1 % 4;
- QueueTilesetAnimDma(gTilesetAnimTable_Underwater[v1], (u8 *)(BG_VRAM + 0x7e00), 0x80);
+ QueueTilesetAnimDma(gTilesetAnimTable_Underwater[v1], BG_TILE_ADDR(252), 0x80);
}
static void sub_80736DC(u8 a1)
{
int v1;
v1 = a1 % 8;
- QueueTilesetAnimDma(gTilesetAnimTable_Pacifidlog_1[v1], (u8 *)(BG_VRAM + 0x7e00), 0x100);
+ QueueTilesetAnimDma(gTilesetAnimTable_Pacifidlog_1[v1], BG_TILE_ADDR(252), 0x100);
}
static void sub_8073704(u16 a1, u8 a2)
@@ -521,14 +521,14 @@ static void sub_80737E0(u16 a1)
{
int v1;
v1 = a1 % 2;
- QueueTilesetAnimDma(gTilesetAnimTable_Rustboro_1[v1], (u8 *)(BG_VRAM + 0x7800), 0x80);
+ QueueTilesetAnimDma(gTilesetAnimTable_Rustboro_1[v1], BG_TILE_ADDR(240), 0x80);
}
static void sub_8073808(u16 a1)
{
int v1;
v1 = a1 % 4;
- QueueTilesetAnimDma(gTilesetAnimTable_Cave[v1], (u8 *)(BG_VRAM + 0x5400), 0x80);
+ QueueTilesetAnimDma(gTilesetAnimTable_Cave[v1], BG_TILE_ADDR(168), 0x80);
}
static void sub_8073830(u16 a1, u8 a2)
@@ -543,7 +543,7 @@ static void sub_8073868(u16 a1)
{
int v1;
v1 = a1 % 4;
- QueueTilesetAnimDma(gTilesetAnimTable_Cave[v1], (u8 *)(BG_VRAM + 0x7400), 0x80);
+ QueueTilesetAnimDma(gTilesetAnimTable_Cave[v1], BG_TILE_ADDR(232), 0x80);
}
static void sub_8073890(u16 a1)
@@ -590,41 +590,41 @@ static void sub_8073904(u16 a1)
{
int v1;
v1 = a1 % 2;
- QueueTilesetAnimDma(gTilesetAnimTable_Building[v1], (u8 *)(BG_VRAM + 0x3e00), 0x80);
+ QueueTilesetAnimDma(gTilesetAnimTable_Building[v1], BG_TILE_ADDR(124), 0x80);
}
static void sub_807392C(u16 a1)
{
int v1;
v1 = a1 % 3;
- QueueTilesetAnimDma(gTilesetAnimTable_SootopolisGym_0[v1], (u8 *)(BG_VRAM + 0x7e00), 0x180);
- QueueTilesetAnimDma(gTilesetAnimTable_SootopolisGym_1[v1], (u8 *)(BG_VRAM + 0x7a00), 0x280);
+ QueueTilesetAnimDma(gTilesetAnimTable_SootopolisGym_0[v1], BG_TILE_ADDR(252), 0x180);
+ QueueTilesetAnimDma(gTilesetAnimTable_SootopolisGym_1[v1], BG_TILE_ADDR(244), 0x280);
}
static void sub_8073974(u16 a1)
{
int v1;
v1 = a1 % 4;
- QueueTilesetAnimDma(gTilesetAnimTable_EliteFour_0[v1], (u8 *)(BG_VRAM + 0x7f00), 0x20);
+ QueueTilesetAnimDma(gTilesetAnimTable_EliteFour_0[v1], BG_TILE_ADDR(254), 0x20);
}
static void sub_807399C(u16 a1)
{
int v1;
v1 = a1 % 2;
- QueueTilesetAnimDma(gTilesetAnimTable_EliteFour_1[v1], (u8 *)(BG_VRAM + 0x7c00), 0x80);
+ QueueTilesetAnimDma(gTilesetAnimTable_EliteFour_1[v1], BG_TILE_ADDR(248), 0x80);
}
static void sub_80739C4(u16 a1)
{
int v1;
v1 = a1 % 2;
- QueueTilesetAnimDma(gTilesetAnimTable_MauvilleGym[v1], (u8 *)(BG_VRAM + 0x5200), 0x200);
+ QueueTilesetAnimDma(gTilesetAnimTable_MauvilleGym[v1], BG_TILE_ADDR(164), 0x200);
}
static void sub_80739EC(u16 a1)
{
int v1;
v1 = a1 % 2;
- QueueTilesetAnimDma(gTilesetAnimTable_BikeShop[v1], (u8 *)(BG_VRAM + 0x7e00), 0x120);
+ QueueTilesetAnimDma(gTilesetAnimTable_BikeShop[v1], BG_TILE_ADDR(252), 0x120);
}
diff --git a/src/engine/trade.c b/src/engine/trade.c
index 905e9ff0c..8fad94be8 100644
--- a/src/engine/trade.c
+++ b/src/engine/trade.c
@@ -112,7 +112,6 @@ struct TradeEwramSubstruct {
/*0x0087*/ u8 unk_0087;
/*0x0088*/ u8 filler_0088[2];
/*0x008a*/ u8 unk_008a;
- /*0x008b*/ u8 unk_008b;
/*0x008c*/ u16 linkData[20];
/*0x00b4*/ u8 unk_00b4;
/*0x00b5*/ u8 unk_00b5[11];
@@ -1088,7 +1087,7 @@ static void sub_8047EC0(void)
ResetSpriteData();
FreeAllSpritePalettes();
ResetTasks();
- sub_804A964(&gUnknown_03004824->unk_00c8, (void *)BG_SCREEN_ADDR(5));
+ sub_804A964(&gUnknown_03004824->unk_00c8, BG_SCREEN_ADDR(5));
SetVBlankCallback(sub_80489F4);
InitMenuWindow(&gWindowConfig_81E6CE4);
SetUpWindowConfig(&gWindowConfig_81E6F84);
@@ -1268,7 +1267,7 @@ static void sub_80484F4(void)
ResetSpriteData();
FreeAllSpritePalettes();
ResetTasks();
- sub_804A964(&gUnknown_03004824->unk_00c8, (void *)BG_SCREEN_ADDR(5));
+ sub_804A964(&gUnknown_03004824->unk_00c8, BG_SCREEN_ADDR(5));
SetVBlankCallback(sub_80489F4);
InitMenuWindow(&gWindowConfig_81E6CE4);
SetUpWindowConfig(&gWindowConfig_81E6F84);
@@ -1484,12 +1483,12 @@ static void sub_8048B0C(u8 a0)
}
for (i = 0; i < 0x400; i ++)
gUnknown_03004824->unk_00c8.unk_12[i] = gUnknown_08EA15C8[i];
- dest = (u16 *)BG_SCREEN_ADDR(6);
+ dest = BG_SCREEN_ADDR(6);
DmaCopy16(3, gTradeStripesBG2Tilemap, dest, 0x800);
break;
case 1:
src = gTradeStripesBG3Tilemap;
- dest = (u16 *)BG_SCREEN_ADDR(7);
+ dest = BG_SCREEN_ADDR(7);
DmaCopy16(3, src, dest, 0x800);
sub_804A6DC(0);
sub_804A6DC(1);
@@ -1706,8 +1705,11 @@ static void sub_8048C70(void)
static void nullsub_5(u8 a0, u8 a1) {}
-static void sub_8048D24(u8 *dest, const u8 *src, u32 size)
+// why not just use memcpy?
+static void Trade_Memcpy(void *dataDest, void *dataSrc, u32 size)
{
+ u8 *dest = dataDest;
+ u8 *src = dataSrc;
int i;
for (i = 0; i < size; i ++) dest[i] = src[i];
}
@@ -1724,7 +1726,7 @@ static bool8 sub_8048D44(void)
switch (gUnknown_03004824->unk_0075)
{
case 0:
- sub_8048D24(gBlockSendBuffer, (const u8 *)&gPlayerParty[0], 2 * sizeof(struct Pokemon));
+ Trade_Memcpy(gBlockSendBuffer, &gPlayerParty[0], 2 * sizeof(struct Pokemon));
gUnknown_03004824->unk_0075 ++;
break;
case 1:
@@ -1751,13 +1753,13 @@ static bool8 sub_8048D44(void)
case 3:
if (GetBlockReceivedStatus() == 3)
{
- sub_8048D24((u8 *)&gEnemyParty[0], (const u8 *)gBlockRecvBuffer[mpId ^ 1], 2 * sizeof(struct Pokemon));
+ Trade_Memcpy(&gEnemyParty[0], gBlockRecvBuffer[mpId ^ 1], 2 * sizeof(struct Pokemon));
ResetBlockReceivedFlags();
gUnknown_03004824->unk_0075 ++;
}
break;
case 4:
- sub_8048D24(gBlockSendBuffer, (const u8 *)&gPlayerParty[2], 2 * sizeof(struct Pokemon));
+ Trade_Memcpy(gBlockSendBuffer, &gPlayerParty[2], 2 * sizeof(struct Pokemon));
gUnknown_03004824->unk_0075 ++;
break;
case 5:
@@ -1770,13 +1772,13 @@ static bool8 sub_8048D44(void)
case 6:
if (GetBlockReceivedStatus() == 3)
{
- sub_8048D24((u8 *)&gEnemyParty[2], (const u8 *)gBlockRecvBuffer[mpId ^ 1], 2 * sizeof(struct Pokemon));
+ Trade_Memcpy(&gEnemyParty[2], gBlockRecvBuffer[mpId ^ 1], 2 * sizeof(struct Pokemon));
ResetBlockReceivedFlags();
gUnknown_03004824->unk_0075 ++;
}
break;
case 7:
- sub_8048D24(gBlockSendBuffer, (const u8 *)&gPlayerParty[4], 2 * sizeof(struct Pokemon));
+ Trade_Memcpy(gBlockSendBuffer, &gPlayerParty[4], 2 * sizeof(struct Pokemon));
gUnknown_03004824->unk_0075 ++;
break;
case 8:
@@ -1789,13 +1791,13 @@ static bool8 sub_8048D44(void)
case 9:
if (GetBlockReceivedStatus() == 3)
{
- sub_8048D24((u8 *)&gEnemyParty[4], (const u8 *)gBlockRecvBuffer[mpId ^ 1], 2 * sizeof(struct Pokemon));
+ Trade_Memcpy(&gEnemyParty[4], gBlockRecvBuffer[mpId ^ 1], 2 * sizeof(struct Pokemon));
ResetBlockReceivedFlags();
gUnknown_03004824->unk_0075 ++;
}
break;
case 10:
- sub_8048D24(gBlockSendBuffer, (const u8 *)&gSaveBlock1.mail[0], 6 * sizeof(struct MailStruct) + 4);
+ Trade_Memcpy(gBlockSendBuffer, &gSaveBlock1.mail[0], 6 * sizeof(struct MailStruct) + 4);
gUnknown_03004824->unk_0075 ++;
break;
case 11:
@@ -1808,13 +1810,13 @@ static bool8 sub_8048D44(void)
case 12:
if (GetBlockReceivedStatus() == 3)
{
- sub_8048D24((u8 *)&gUnknown_02029700[0], (const u8 *)gBlockRecvBuffer[mpId ^ 1], 6 * sizeof(struct MailStruct));
+ Trade_Memcpy(&gUnknown_02029700[0], gBlockRecvBuffer[mpId ^ 1], 6 * sizeof(struct MailStruct));
ResetBlockReceivedFlags();
gUnknown_03004824->unk_0075 ++;
}
break;
case 13:
- sub_8048D24(gBlockSendBuffer, (const u8 *)gSaveBlock1.giftRibbons, 11);
+ Trade_Memcpy(gBlockSendBuffer, gSaveBlock1.giftRibbons, 11);
gUnknown_03004824->unk_0075 ++;
break;
case 14:
@@ -1827,7 +1829,7 @@ static bool8 sub_8048D44(void)
case 15:
if (GetBlockReceivedStatus() == 3)
{
- sub_8048D24((u8 *)gUnknown_03004824->unk_00b5, (const u8 *)gBlockRecvBuffer[mpId ^ 1], 11);
+ Trade_Memcpy(gUnknown_03004824->unk_00b5, gBlockRecvBuffer[mpId ^ 1], 11);
ResetBlockReceivedFlags();
gUnknown_03004824->unk_0075 ++;
}
@@ -1853,7 +1855,7 @@ static void sub_8049088(void)
{
u8 string[28];
StringCopy(string, gTradeText_TradeOkayPrompt);
- sub_804ACD8(string, (u8 *)BG_CHAR_ADDR(4) + gUnknown_03004824->unk_007e * 32, 20);
+ sub_804ACD8(string, BG_CHAR_ADDR(4) + gUnknown_03004824->unk_007e * 32, 20);
}
static void sub_80490BC(u8 mpId, u8 a1)
@@ -1915,7 +1917,7 @@ static void sub_80491E4(u8 mpId, u8 status)
gUnknown_03004824->unk_007b = 8;
break;
case 0xdddd:
- gUnknown_03004824->unk_008a = ((u8 *)gBlockRecvBuffer[0])[1 * sizeof(u16)] + 6;
+ gUnknown_03004824->unk_008a = gBlockRecvBuffer[0][1] + 6;
sub_8049E9C(gUnknown_03004824->tradeMenuCursorPosition);
sub_8049E9C(gUnknown_03004824->unk_008a);
gUnknown_03004824->unk_007b = 7;
@@ -2111,7 +2113,7 @@ static void sub_8049680(void)
DrawTextWindow(&gUnknown_03004824->window, 24, 14, 29, 19);
InitYesNoMenu(24, 14, 4);
gUnknown_03004824->unk_007b = 4;
- sub_804ACD8(gUnknown_0820C14C[4], (u8 *)(BG_CHAR_ADDR(4) + 32 * gUnknown_03004824->unk_007e), 20);
+ sub_804ACD8(gUnknown_0820C14C[4], BG_CHAR_ADDR(4) + 32 * gUnknown_03004824->unk_007e, 20);
}
}
if (gMain.newKeys & R_BUTTON)
@@ -2130,7 +2132,7 @@ static void sub_8049804(void)
sub_804A80C();
gUnknown_03004824->unk_007b = 0;
gSprites[gUnknown_03004824->tradeMenuCursorSpriteIdx].invisible = FALSE;
- sub_804ACD8(gUnknown_0820C14C[1], (u8 *)(BG_CHAR_ADDR(4) + 32 * gUnknown_03004824->unk_007e), 20);
+ sub_804ACD8(gUnknown_0820C14C[1], BG_CHAR_ADDR(4) + 32 * gUnknown_03004824->unk_007e, 20);
}
static void sub_8049860(void)
@@ -2498,7 +2500,7 @@ static void sub_8049ED4(u8 a0)
gUnknown_03004824->unk_0080[a0] ++;
break;
case 4:
- sub_804ACD8(gUnknown_0820C14C[5], (u8 *)(BG_CHAR_ADDR(4) + 32 * gUnknown_03004824->unk_007e), 20);
+ sub_804ACD8(gUnknown_0820C14C[5], BG_CHAR_ADDR(4) + 32 * gUnknown_03004824->unk_007e, 20);
sub_804A51C(a0, whichPokemon, gUnknown_0820C3D1[a0][0] + 4, gUnknown_0820C3D1[a0][1] + 1, gUnknown_0820C3D1[a0][0], gUnknown_0820C3D1[a0][1]);
gUnknown_03004824->unk_0080[a0] ++;
break;
@@ -3362,7 +3364,7 @@ static void sub_804A840(u8 whichParty)
sub_804A740(1);
sub_804A938(&gUnknown_03004824->unk_00c8);
}
- sub_804ACD8(gUnknown_0820C14C[1], (u8 *)(BG_CHAR_ADDR(4) + 32 * gUnknown_03004824->unk_007e), 20);
+ sub_804ACD8(gUnknown_0820C14C[1], BG_CHAR_ADDR(4) + 32 * gUnknown_03004824->unk_007e, 20);
gUnknown_03004824->unk_0080[whichParty] = 0;
}
@@ -4037,7 +4039,7 @@ static void sub_804B41C(void)
gMain.state ++;
LZDecompressVram(gUnknown_08D00000, (void *)VRAM);
CpuCopy16(gUnknown_08D00524, ewram, 0x1000);
- DmaCopy16Defvars(3, ewram, (void *)BG_SCREEN_ADDR(5), 0x500);
+ DmaCopy16Defvars(3, ewram, BG_SCREEN_ADDR(5), 0x500);
LoadCompressedPalette(gUnknown_08D004E0, 0, 32);
gUnknown_03004828->unk_00b6 = 0;
gUnknown_03004828->unk_00c4 = 0;
@@ -4678,8 +4680,8 @@ static void sub_804BBE8(u8 a0)
{
case 0:
LoadPalette(gUnknown_0820C9F8, 0x10, 0xa0);
- DmaCopyLarge16(3, gUnknown_0820CA98, (void *)BG_CHAR_ADDR(1), 0x1300, 0x1000);
- DmaCopy16Defvars(3, gUnknown_0820F798, (void *)BG_SCREEN_ADDR(18), 0x1000);
+ DmaCopyLarge16(3, gUnknown_0820CA98, BG_CHAR_ADDR(1), 0x1300, 0x1000);
+ DmaCopy16Defvars(3, gUnknown_0820F798, BG_SCREEN_ADDR(18), 0x1000);
gUnknown_03004828->bg2vofs = 0;
gUnknown_03004828->bg2hofs = 0xb4;
REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_BG2_ON | DISPCNT_OBJ_ON;
@@ -4691,15 +4693,15 @@ static void sub_804BBE8(u8 a0)
REG_BG1VOFS = 0x15c;
REG_BG1CNT = BGCNT_PRIORITY(2) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(5) | BGCNT_TXT256x512;
- DmaCopy16Defvars(3, gUnknown_08210798, (void *)BG_SCREEN_ADDR(5), 0x1000);
- DmaCopyLarge16(3, gUnknown_0820CA98, (void *)BG_CHAR_ADDR(0), 0x1300, 0x1000);
+ DmaCopy16Defvars(3, gUnknown_08210798, BG_SCREEN_ADDR(5), 0x1000);
+ DmaCopyLarge16(3, gUnknown_0820CA98, BG_CHAR_ADDR(0), 0x1300, 0x1000);
REG_DISPCNT = DISPCNT_MODE_1 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG1_ON | DISPCNT_OBJ_ON;
break;
case 2:
gUnknown_03004828->bg1vofs = 0;
gUnknown_03004828->bg1hofs = 0;
REG_DISPCNT = DISPCNT_MODE_1 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG1_ON | DISPCNT_OBJ_ON;
- DmaCopy16Defvars(3, gUnknown_08211798, (void *)BG_SCREEN_ADDR(5), 0x800);
+ DmaCopy16Defvars(3, gUnknown_08211798, BG_SCREEN_ADDR(5), 0x800);
break;
case 3:
REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG1_ON | DISPCNT_OBJ_ON;
@@ -4708,8 +4710,8 @@ static void sub_804BBE8(u8 a0)
gUnknown_03004828->unk_010c = 0x78;
gUnknown_03004828->unk_010e = -0x46;
gUnknown_03004828->unk_011c = 0;
- DmaCopyLarge16(3, gUnknown_0820DD98, (void *)BG_CHAR_ADDR(1), 0x1a00, 0x1000);
- DmaCopy16Defvars(3, gUnknown_08211F98, (void *)BG_SCREEN_ADDR(18), 0x100);
+ DmaCopyLarge16(3, gUnknown_0820DD98, BG_CHAR_ADDR(1), 0x1a00, 0x1000);
+ DmaCopy16Defvars(3, gUnknown_08211F98, BG_SCREEN_ADDR(18), 0x100);
break;
case 4:
REG_DISPCNT = DISPCNT_MODE_1 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG2_ON | DISPCNT_OBJ_ON;
@@ -4719,20 +4721,20 @@ static void sub_804BBE8(u8 a0)
gUnknown_03004828->unk_0118 = 0x20;
gUnknown_03004828->unk_011a = 0x400;
gUnknown_03004828->unk_011c = 0;
- DmaCopyLarge16(3, gUnknown_08213738, (void *)BG_CHAR_ADDR(1), 0x2040, 0x1000);
- DmaCopy16Defvars(3, gUnknown_08215778, (void *)BG_SCREEN_ADDR(18), 0x100);
+ DmaCopyLarge16(3, gUnknown_08213738, BG_CHAR_ADDR(1), 0x2040, 0x1000);
+ DmaCopy16Defvars(3, gUnknown_08215778, BG_SCREEN_ADDR(18), 0x100);
break;
case 5:
gUnknown_03004828->bg1vofs = 0;
gUnknown_03004828->bg1hofs = 0;
REG_BG1CNT = BGCNT_PRIORITY(2) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(5);
- LZDecompressVram(gUnknown_08D00000, (void *)BG_CHAR_ADDR(0));
+ LZDecompressVram(gUnknown_08D00000, BG_CHAR_ADDR(0));
CpuCopy16(gUnknown_08D00524, buffer = (u16 *)ewram, 0x1000);
LoadCompressedPalette(gUnknown_08D004E0, 0x70, 0x20);
FillPalette(0, 0, 2);
for (i = 0; i < 0x280; i ++)
buffer[i] |= 0x7000;
- DmaCopy16Defvars(3, ewram, (void *)BG_SCREEN_ADDR(5), 0x500);
+ DmaCopy16Defvars(3, ewram, BG_SCREEN_ADDR(5), 0x500);
MenuZeroFillWindowRect(2, 15, 27, 18);
break;
case 6:
@@ -4745,16 +4747,16 @@ static void sub_804BBE8(u8 a0)
gUnknown_03004828->unk_010c = 0x78;
gUnknown_03004828->unk_010e = 0x50;
gUnknown_03004828->unk_011c = 0;
- DmaCopyLarge16(3, gUnknown_08213738, (void *)BG_CHAR_ADDR(1), 0x2040, 0x1000);
- DmaCopy16Defvars(3, gUnknown_08215778, (void *)BG_SCREEN_ADDR(18), 0x100);
+ DmaCopyLarge16(3, gUnknown_08213738, BG_CHAR_ADDR(1), 0x2040, 0x1000);
+ DmaCopy16Defvars(3, gUnknown_08215778, BG_SCREEN_ADDR(18), 0x100);
break;
case 7:
gUnknown_03004828->bg2vofs = 0;
gUnknown_03004828->bg2hofs = 0;
REG_BG2CNT = BGCNT_PRIORITY(2) | BGCNT_CHARBASE(1) | BGCNT_SCREENBASE(18) | BGCNT_TXT512x256;
LoadPalette(gUnknown_0820C9F8, 0x10, 0xa0);
- DmaCopyLarge16(3, gUnknown_0820CA98, (void *)BG_CHAR_ADDR(1), 0x1300, 0x1000);
- DmaCopy16Defvars(3, gUnknown_0820F798, (void *)BG_SCREEN_ADDR(18), 0x1000);
+ DmaCopyLarge16(3, gUnknown_0820CA98, BG_CHAR_ADDR(1), 0x1300, 0x1000);
+ DmaCopy16Defvars(3, gUnknown_0820F798, BG_SCREEN_ADDR(18), 0x1000);
break;
}
}
@@ -5416,7 +5418,6 @@ static void sub_804D948(u8 whichPlayerMon, u8 whichInGameTrade)
struct MailStruct mail;
u8 metLocation = 0xFE;
u8 isMail;
- u8 *item;
struct Pokemon *pokemon = &gEnemyParty[0];
CreateMon(pokemon, inGameTrade->species, level, 32, TRUE, inGameTrade->personality, TRUE, inGameTrade->otId);
@@ -5447,12 +5448,11 @@ static void sub_804D948(u8 whichPlayerMon, u8 whichInGameTrade)
sub_804DAD4(&mail, inGameTrade);
gUnknown_02029700[0] = mail;
SetMonData(pokemon, MON_DATA_MAIL, &isMail);
- SetMonData(pokemon, MON_DATA_HELD_ITEM, (u8 *)&inGameTrade->heldItem);
+ SetMonData(pokemon, MON_DATA_HELD_ITEM, &inGameTrade->heldItem);
}
else
{
- item = (u8 *)&inGameTrade->heldItem;
- SetMonData(pokemon, MON_DATA_HELD_ITEM, item);
+ SetMonData(pokemon, MON_DATA_HELD_ITEM, &inGameTrade->heldItem);
}
}
CalculateMonStats(&gEnemyParty[0]);
@@ -5705,10 +5705,10 @@ void sub_804E22C(void)
{
const u16 *src;
u16 *dest;
- LZDecompressVram(gUnknown_08D00000, (u8 *)VRAM);
+ LZDecompressVram(gUnknown_08D00000, (void *)VRAM);
CpuCopy16(gUnknown_08D00524, ewram, 0x1000);
src = (const u16 *)ewram;
- dest = (u16 *)(BG_SCREEN_ADDR(5));
+ dest = BG_SCREEN_ADDR(5);
DmaCopy16(3, src, dest, 0x500)
LoadCompressedPalette(gUnknown_08D004E0, 0, 32);
REG_BG1CNT = BGCNT_PRIORITY(2) | BGCNT_SCREENBASE(5);