This commit is contained in:
GriffinR
2022-06-03 15:43:21 -04:00
128 changed files with 1530 additions and 1525 deletions
+10 -9
View File
@@ -451,13 +451,6 @@ Replace `<output of nproc>` with the number that the `nproc` command returned.
`nproc` is not available on macOS. The alternative is `sysctl -n hw.ncpu` ([relevant Stack Overflow thread](https://stackoverflow.com/questions/1715580)). `nproc` is not available on macOS. The alternative is `sysctl -n hw.ncpu` ([relevant Stack Overflow thread](https://stackoverflow.com/questions/1715580)).
## Debug info
To build **pokeemerald.elf** with enhanced debug info:
```bash
make DINFO=1
```
## devkitARM's C compiler ## devkitARM's C compiler
This project supports the `arm-none-eabi-gcc` compiler included with devkitARM. If devkitARM (a.k.a. gba-dev) has already been installed as part of the platform-specific instructions, simply run: This project supports the `arm-none-eabi-gcc` compiler included with devkitARM. If devkitARM (a.k.a. gba-dev) has already been installed as part of the platform-specific instructions, simply run:
@@ -534,7 +527,7 @@ devkitARM is now installed.
devkitARM is now installed. devkitARM is now installed.
## Installing devkitARM on Arch Linux ### Installing devkitARM on Arch Linux
1. Follow [devkitPro's instructions](https://devkitpro.org/wiki/devkitPro_pacman#Customising_Existing_Pacman_Install) to configure `pacman` to download devkitPro packages. 1. Follow [devkitPro's instructions](https://devkitpro.org/wiki/devkitPro_pacman#Customising_Existing_Pacman_Install) to configure `pacman` to download devkitPro packages.
2. Install `gba-dev`: run the following command as root. 2. Install `gba-dev`: run the following command as root.
@@ -552,7 +545,7 @@ devkitARM is now installed.
devkitARM is now installed. devkitARM is now installed.
## Other toolchains ### Other toolchains
To build using a toolchain other than devkitARM, override the `TOOLCHAIN` environment variable with the path to your toolchain, which must contain the subdirectory `bin`. To build using a toolchain other than devkitARM, override the `TOOLCHAIN` environment variable with the path to your toolchain, which must contain the subdirectory `bin`.
```bash ```bash
@@ -564,6 +557,14 @@ make TOOLCHAIN="/usr/local/arm-none-eabi"
``` ```
To compile the `modern` target with this toolchain, the subdirectories `lib`, `include`, and `arm-none-eabi` must also be present. To compile the `modern` target with this toolchain, the subdirectories `lib`, `include`, and `arm-none-eabi` must also be present.
### Building with debug info under a modern toolchain
To build **pokeemerald.elf** with debug symbols under a modern toolchain:
```bash
make modern DINFO=1
```
Note that this is not necessary for a non-modern build since those are built with debug symbols by default.
# Useful additional tools # Useful additional tools
* [porymap](https://github.com/huderlem/porymap) for viewing and editing maps * [porymap](https://github.com/huderlem/porymap) for viewing and editing maps
+1 -1
View File
@@ -107,7 +107,7 @@ LIBPATH := -L ../../tools/agbcc/lib
LIB := $(LIBPATH) -lgcc -lc -L../../libagbsyscall -lagbsyscall LIB := $(LIBPATH) -lgcc -lc -L../../libagbsyscall -lagbsyscall
else else
CC1 = $(shell $(PATH_MODERNCC) --print-prog-name=cc1) -quiet CC1 = $(shell $(PATH_MODERNCC) --print-prog-name=cc1) -quiet
override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast -g override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast
ROM := $(MODERN_ROM_NAME) ROM := $(MODERN_ROM_NAME)
OBJ_DIR := $(MODERN_OBJ_DIR_NAME) OBJ_DIR := $(MODERN_OBJ_DIR_NAME)
LIBPATH := -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libnosys.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libc.a))" LIBPATH := -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libnosys.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libc.a))"
+1 -1
View File
@@ -12,7 +12,7 @@ MysteryGiftScript_AlteringCave_:
release release
end end
sText_MysteryGiftAlteringCave:: sText_MysteryGiftAlteringCave:
.string "Thank you for using the MYSTERY\n" .string "Thank you for using the MYSTERY\n"
.string "GIFT System.\p" .string "GIFT System.\p"
.string "There appears to be a rumor about\n" .string "There appears to be a rumor about\n"
+1 -1
View File
@@ -3,7 +3,7 @@ gBirchDexRatingText_AreYouCurious::
.string "Are you curious about how your\n" .string "Are you curious about how your\n"
.string "POKéDEX is coming along?$" .string "POKéDEX is coming along?$"
gBirchDexRatingText_Cancel: gBirchDexRatingText_Cancel::
.string "Hm? Oh, you haven't caught enough\n" .string "Hm? Oh, you haven't caught enough\n"
.string "POKéMON to make it worthwhile.$" .string "POKéMON to make it worthwhile.$"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 B

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 419 B

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 B

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 421 B

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 390 B

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 B

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 467 B

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 B

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 402 B

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 B

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 B

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 441 B

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 B

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 404 B

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 B

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 430 B

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 B

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 B

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 B

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 B

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 419 B

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 B

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 B

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 348 B

After

Width:  |  Height:  |  Size: 231 B

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 394 B

+1 -1
View File
@@ -319,7 +319,7 @@
#define B_WIN_TYPE_NORMAL 0 #define B_WIN_TYPE_NORMAL 0
#define B_WIN_TYPE_ARENA 1 #define B_WIN_TYPE_ARENA 1
// Window Ids for gStandardBattleWindowTemplates / gBattleArenaWindowTemplates // Window Ids for sStandardBattleWindowTemplates / sBattleArenaWindowTemplates
#define B_WIN_MSG 0 #define B_WIN_MSG 0
#define B_WIN_ACTION_PROMPT 1 // "What will {x} do?" #define B_WIN_ACTION_PROMPT 1 // "What will {x} do?"
#define B_WIN_ACTION_MENU 2 // "Fight/Pokémon/Bag/Run" menu #define B_WIN_ACTION_MENU 2 // "Fight/Pokémon/Bag/Run" menu
+1 -1
View File
@@ -1634,7 +1634,7 @@
#define FLAGS_COUNT (DAILY_FLAGS_END + 1) #define FLAGS_COUNT (DAILY_FLAGS_END + 1)
// Special Flags (Stored in EWRAM (gSpecialFlags), not in the SaveBlock) // Special Flags (Stored in EWRAM (sSpecialFlags), not in the SaveBlock)
#define SPECIAL_FLAGS_START 0x4000 #define SPECIAL_FLAGS_START 0x4000
#define FLAG_HIDE_MAP_NAME_POPUP (SPECIAL_FLAGS_START + 0x0) #define FLAG_HIDE_MAP_NAME_POPUP (SPECIAL_FLAGS_START + 0x0)
#define FLAG_DONT_TRANSITION_MUSIC (SPECIAL_FLAGS_START + 0x1) #define FLAG_DONT_TRANSITION_MUSIC (SPECIAL_FLAGS_START + 0x1)
+1 -1
View File
@@ -99,6 +99,7 @@
#define METATILE_PetalburgGym_SlidingDoor_Frame2 0x21A #define METATILE_PetalburgGym_SlidingDoor_Frame2 0x21A
#define METATILE_PetalburgGym_SlidingDoor_Frame3 0x21B #define METATILE_PetalburgGym_SlidingDoor_Frame3 0x21B
#define METATILE_PetalburgGym_SlidingDoor_Frame4 0x21C #define METATILE_PetalburgGym_SlidingDoor_Frame4 0x21C
#define METATILE_PetalburgGym_Door 0x224
// gTileset_MossdeepGym from R/S // gTileset_MossdeepGym from R/S
#define METATILE_RS_MossdeepGym_RedArrow_Right 0x204 #define METATILE_RS_MossdeepGym_RedArrow_Right 0x204
@@ -128,7 +129,6 @@
// gTileset_BattleFrontier // gTileset_BattleFrontier
#define METATILE_BattleFrontier_Door_Elevator 0x20E #define METATILE_BattleFrontier_Door_Elevator 0x20E
#define METATILE_BattleFrontier_Door_Corridor 0x224
#define METATILE_BattleFrontier_Door_MultiCorridor 0x2AD #define METATILE_BattleFrontier_Door_MultiCorridor 0x2AD
#define METATILE_BattleFrontier_CorridorOpenDoor_Top 0x207 #define METATILE_BattleFrontier_CorridorOpenDoor_Top 0x207
#define METATILE_BattleFrontier_CorridorOpenDoor_Bottom 0x20F #define METATILE_BattleFrontier_CorridorOpenDoor_Bottom 0x20F
-1
View File
@@ -324,7 +324,6 @@ extern u16 gSpecialVar_ContestRank;
extern u8 gNumLinkContestPlayers; extern u8 gNumLinkContestPlayers;
extern u8 gHighestRibbonRank; extern u8 gHighestRibbonRank;
extern struct ContestResources *gContestResources; extern struct ContestResources *gContestResources;
extern u8 sContestBgCopyFlags;
extern struct ContestWinner gCurContestWinner; extern struct ContestWinner gCurContestWinner;
extern u8 gCurContestWinnerIsForArtist; extern u8 gCurContestWinnerIsForArtist;
extern u8 gCurContestWinnerSaveIdx; extern u8 gCurContestWinnerSaveIdx;
+4
View File
@@ -135,6 +135,10 @@
#define NUM_FLAG_BYTES ROUND_BITS_TO_BYTES(FLAGS_COUNT) #define NUM_FLAG_BYTES ROUND_BITS_TO_BYTES(FLAGS_COUNT)
#define NUM_ADDITIONAL_PHRASE_BYTES ROUND_BITS_TO_BYTES(NUM_ADDITIONAL_PHRASES) #define NUM_ADDITIONAL_PHRASE_BYTES ROUND_BITS_TO_BYTES(NUM_ADDITIONAL_PHRASES)
// This produces an error at compile-time if expr is zero.
// It looks like file.c:line: size of array `id' is negative
#define STATIC_ASSERT(expr, id) typedef char id[(expr) ? 1 : -1];
struct Coords8 struct Coords8
{ {
s8 x; s8 x;
+2 -2
View File
@@ -212,8 +212,8 @@ struct BaseStats
/* 0x0A */ u16 evYield_Speed:2; /* 0x0A */ u16 evYield_Speed:2;
/* 0x0B */ u16 evYield_SpAttack:2; /* 0x0B */ u16 evYield_SpAttack:2;
/* 0x0B */ u16 evYield_SpDefense:2; /* 0x0B */ u16 evYield_SpDefense:2;
/* 0x0C */ u16 item1; /* 0x0C */ u16 itemCommon;
/* 0x0E */ u16 item2; /* 0x0E */ u16 itemRare;
/* 0x10 */ u8 genderRatio; /* 0x10 */ u8 genderRatio;
/* 0x11 */ u8 eggCycles; /* 0x11 */ u8 eggCycles;
/* 0x12 */ u8 friendship; /* 0x12 */ u8 friendship;
+1 -1
View File
@@ -99,7 +99,7 @@ u8 DoRegionMapInputCallback(void);
bool8 UpdateRegionMapZoom(void); bool8 UpdateRegionMapZoom(void);
void FreeRegionMapIconResources(void); void FreeRegionMapIconResources(void);
u16 GetRegionMapSecIdAt(u16 x, u16 y); u16 GetRegionMapSecIdAt(u16 x, u16 y);
void CreateRegionMapPlayerIcon(u16 x, u16 y); void CreateRegionMapPlayerIcon(u16 tileTag, u16 paletteTag);
void CreateRegionMapCursor(u16 tileTag, u16 paletteTag); void CreateRegionMapCursor(u16 tileTag, u16 paletteTag);
bool32 IsEventIslandMapSecId(u8 mapSecId); bool32 IsEventIslandMapSecId(u8 mapSecId);
u8 *GetMapName(u8 *, u16, u16); u8 *GetMapName(u8 *, u16, u16);
+3
View File
@@ -674,3 +674,6 @@ $(FLDEFFGFXDIR)/secret_power_tree.4bpp: %.4bpp: %.png
$(FLDEFFGFXDIR)/record_mix_lights.4bpp: %.4bpp: %.png $(FLDEFFGFXDIR)/record_mix_lights.4bpp: %.4bpp: %.png
$(GFX) $< $@ -mwidth 4 -mheight 1 $(GFX) $< $@ -mwidth 4 -mheight 1
graphics/door_anims/battle_tower_multi_corridor.4bpp: %.4bpp: %.png
$(GFX) $< $@ -mwidth 2 -mheight 4
+1 -1
View File
@@ -3,7 +3,7 @@
static const char AgbLibFlashVersion[] = "FLASH1M_V103"; static const char AgbLibFlashVersion[] = "FLASH1M_V103";
const struct FlashSetupInfo * const sSetupInfos[] = static const struct FlashSetupInfo * const sSetupInfos[] =
{ {
&MX29L010, &MX29L010,
&LE26FV10N1TS, &LE26FV10N1TS,
+2 -2
View File
@@ -15,7 +15,7 @@ static void AnimOverheatFlame_Step(struct Sprite *);
static void AnimTask_DragonDanceWaver_Step(u8); static void AnimTask_DragonDanceWaver_Step(u8);
static void UpdateDragonDanceScanlineEffect(struct Task *); static void UpdateDragonDanceScanlineEffect(struct Task *);
EWRAM_DATA static u16 gUnusedOverheatData[7] = {0}; EWRAM_DATA static u16 sUnusedOverheatData[7] = {0};
static const union AnimCmd sAnim_OutrageOverheatFire_0[] = static const union AnimCmd sAnim_OutrageOverheatFire_0[] =
{ {
@@ -426,7 +426,7 @@ static void AnimOverheatFlame(struct Sprite *sprite)
sprite->data[3] = gBattleAnimArgs[3]; sprite->data[3] = gBattleAnimArgs[3];
sprite->callback = AnimOverheatFlame_Step; sprite->callback = AnimOverheatFlame_Step;
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
gUnusedOverheatData[i] = sprite->data[i]; sUnusedOverheatData[i] = sprite->data[i];
} }
static void AnimOverheatFlame_Step(struct Sprite *sprite) static void AnimOverheatFlame_Step(struct Sprite *sprite)
+2 -2
View File
@@ -653,9 +653,9 @@ static void AnimTask_SpiteTargetShadow_Step1(u8 taskId)
startLine = 0; startLine = 0;
if (position == 1) if (position == 1)
task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG1HOFS, 1); task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG1HOFS, TRUE);
else else
task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG2HOFS, 1); task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG2HOFS, TRUE);
task->data[15]++; task->data[15]++;
break; break;
+3 -3
View File
@@ -248,7 +248,7 @@ static const struct SubspriteTable sFrozenIceCubeSubspriteTable[] =
{ARRAY_COUNT(sFrozenIceCubeSubsprites), sFrozenIceCubeSubsprites}, {ARRAY_COUNT(sFrozenIceCubeSubsprites), sFrozenIceCubeSubsprites},
}; };
static const struct SpriteTemplate gFrozenIceCubeSpriteTemplate = static const struct SpriteTemplate sFrozenIceCubeSpriteTemplate =
{ {
.tileTag = ANIM_TAG_ICE_CUBE, .tileTag = ANIM_TAG_ICE_CUBE,
.paletteTag = ANIM_TAG_ICE_CUBE, .paletteTag = ANIM_TAG_ICE_CUBE,
@@ -389,7 +389,7 @@ void AnimTask_FrozenIceCube(u8 taskId)
x -= 6; x -= 6;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL); SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16)); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
spriteId = CreateSprite(&gFrozenIceCubeSpriteTemplate, x, y, 4); spriteId = CreateSprite(&sFrozenIceCubeSpriteTemplate, x, y, 4);
if (GetSpriteTileStartByTag(ANIM_TAG_ICE_CUBE) == 0xFFFF) if (GetSpriteTileStartByTag(ANIM_TAG_ICE_CUBE) == 0xFFFF)
gSprites[spriteId].invisible = TRUE; gSprites[spriteId].invisible = TRUE;
SetSubspriteTables(&gSprites[spriteId], sFrozenIceCubeSubspriteTable); SetSubspriteTables(&gSprites[spriteId], sFrozenIceCubeSubspriteTable);
@@ -549,7 +549,7 @@ void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId)
gBattleAnimAttacker = battlerId; gBattleAnimAttacker = battlerId;
gBattleAnimTarget = battlerId; gBattleAnimTarget = battlerId;
LaunchBattleAnimation(gBattleAnims_StatusConditions, statusAnimId, 0); LaunchBattleAnimation(gBattleAnims_StatusConditions, statusAnimId, FALSE);
taskId = CreateTask(Task_DoStatusAnimation, 10); taskId = CreateTask(Task_DoStatusAnimation, 10);
gTasks[taskId].data[0] = battlerId; gTasks[taskId].data[0] = battlerId;
} }
+1 -2
View File
@@ -594,8 +594,7 @@ static void StatsChangeAnimation_Step3(u8 taskId)
if (gTasks[taskId].data[6] == 1) if (gTasks[taskId].data[6] == 1)
gSprites[gTasks[taskId].data[7]].oam.priority++; gSprites[gTasks[taskId].data[7]].oam.priority++;
Free(sAnimStatsChangeData); FREE_AND_SET_NULL(sAnimStatsChangeData);
sAnimStatsChangeData = NULL;
DestroyAnimVisualTask(taskId); DestroyAnimVisualTask(taskId);
break; break;
} }
+4 -4
View File
@@ -159,7 +159,7 @@ const struct BgTemplate gBattleBgTemplates[] =
}, },
}; };
static const struct WindowTemplate gStandardBattleWindowTemplates[] = static const struct WindowTemplate sStandardBattleWindowTemplates[] =
{ {
[B_WIN_MSG] = { [B_WIN_MSG] = {
.bg = 0, .bg = 0,
@@ -380,7 +380,7 @@ static const struct WindowTemplate gStandardBattleWindowTemplates[] =
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };
static const struct WindowTemplate gBattleArenaWindowTemplates[] = static const struct WindowTemplate sBattleArenaWindowTemplates[] =
{ {
[B_WIN_MSG] = { [B_WIN_MSG] = {
.bg = 0, .bg = 0,
@@ -594,8 +594,8 @@ static const struct WindowTemplate gBattleArenaWindowTemplates[] =
const struct WindowTemplate * const gBattleWindowTemplates[] = const struct WindowTemplate * const gBattleWindowTemplates[] =
{ {
[B_WIN_TYPE_NORMAL] = gStandardBattleWindowTemplates, [B_WIN_TYPE_NORMAL] = sStandardBattleWindowTemplates,
[B_WIN_TYPE_ARENA] = gBattleArenaWindowTemplates, [B_WIN_TYPE_ARENA] = sBattleArenaWindowTemplates,
}; };
static const struct BattleBackground sBattleTerrainTable[] = static const struct BattleBackground sBattleTerrainTable[] =
+1 -2
View File
@@ -1131,8 +1131,7 @@ static void CB2_InitSelectScreen(void)
switch (gMain.state) switch (gMain.state)
{ {
case 0: case 0:
if (sFactorySelectMons != NULL) TRY_FREE_AND_SET_NULL(sFactorySelectMons);
FREE_AND_SET_NULL(sFactorySelectMons);
SetHBlankCallback(NULL); SetHBlankCallback(NULL);
SetVBlankCallback(NULL); SetVBlankCallback(NULL);
CpuFill32(0, (void *)VRAM, VRAM_SIZE); CpuFill32(0, (void *)VRAM, VRAM_SIZE);
+3 -3
View File
@@ -590,7 +590,7 @@ void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
if (species == SPECIES_CASTFORM) if (species == SPECIES_CASTFORM)
{ {
paletteOffset = 0x100 + battlerId * 16; paletteOffset = 0x100 + battlerId * 16;
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[CASTFORM_NORMAL]); LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette);
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, 0x20); LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, 0x20);
} }
@@ -653,7 +653,7 @@ void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
if (species == SPECIES_CASTFORM) if (species == SPECIES_CASTFORM)
{ {
paletteOffset = 0x100 + battlerId * 16; paletteOffset = 0x100 + battlerId * 16;
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[CASTFORM_NORMAL]); LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette);
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, 0x20); LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, 0x20);
} }
@@ -973,7 +973,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 castform)
if (targetSpecies == SPECIES_CASTFORM) if (targetSpecies == SPECIES_CASTFORM)
{ {
gSprites[gBattlerSpriteIds[battlerAtk]].anims = gMonFrontAnimsPtrTable[targetSpecies]; gSprites[gBattlerSpriteIds[battlerAtk]].anims = gMonFrontAnimsPtrTable[targetSpecies];
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[CASTFORM_NORMAL]); LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette);
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerDef]], paletteOffset, 32); LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerDef]], paletteOffset, 32);
} }
+3 -6
View File
@@ -1498,8 +1498,7 @@ static void CB2_PreInitMultiBattle(void)
gBattleTypeFlags = *savedBattleTypeFlags; gBattleTypeFlags = *savedBattleTypeFlags;
gMain.savedCallback = *savedCallback; gMain.savedCallback = *savedCallback;
SetMainCallback2(CB2_InitBattleInternal); SetMainCallback2(CB2_InitBattleInternal);
Free(sMultiPartnerPartyBuffer); FREE_AND_SET_NULL(sMultiPartnerPartyBuffer);
sMultiPartnerPartyBuffer = NULL;
} }
} }
else if (gReceivedRemoteLinkPlayers == 0) else if (gReceivedRemoteLinkPlayers == 0)
@@ -1507,8 +1506,7 @@ static void CB2_PreInitMultiBattle(void)
gBattleTypeFlags = *savedBattleTypeFlags; gBattleTypeFlags = *savedBattleTypeFlags;
gMain.savedCallback = *savedCallback; gMain.savedCallback = *savedCallback;
SetMainCallback2(CB2_InitBattleInternal); SetMainCallback2(CB2_InitBattleInternal);
Free(sMultiPartnerPartyBuffer); FREE_AND_SET_NULL(sMultiPartnerPartyBuffer);
sMultiPartnerPartyBuffer = NULL;
} }
break; break;
} }
@@ -1544,8 +1542,7 @@ static void CB2_PreInitIngamePlayerPartnerBattle(void)
gBattleTypeFlags = *savedBattleTypeFlags; gBattleTypeFlags = *savedBattleTypeFlags;
gMain.savedCallback = *savedCallback; gMain.savedCallback = *savedCallback;
SetMainCallback2(CB2_InitBattleInternal); SetMainCallback2(CB2_InitBattleInternal);
Free(sMultiPartnerPartyBuffer); FREE_AND_SET_NULL(sMultiPartnerPartyBuffer);
sMultiPartnerPartyBuffer = NULL;
} }
break; break;
} }
+2 -2
View File
@@ -687,7 +687,7 @@ struct
{ {
u32 facilityClass; u32 facilityClass;
const u8 *const *strings; const u8 *const *strings;
} const sPartnerTrainerTextTables[] = } static const sPartnerTrainerTextTables[] =
{ {
{FACILITY_CLASS_LASS, sPartnerTextsLass}, {FACILITY_CLASS_LASS, sPartnerTextsLass},
{FACILITY_CLASS_YOUNGSTER, sPartnerTextsYoungster}, {FACILITY_CLASS_YOUNGSTER, sPartnerTextsYoungster},
@@ -769,7 +769,7 @@ struct
u8 nature; u8 nature;
u8 evs[NUM_STATS]; u8 evs[NUM_STATS];
u16 moves[MAX_MON_MOVES]; u16 moves[MAX_MON_MOVES];
} const sStevenMons[MULTI_PARTY_SIZE] = } static const sStevenMons[MULTI_PARTY_SIZE] =
{ {
{ {
.species = SPECIES_METANG, .species = SPECIES_METANG,
+1 -1
View File
@@ -1190,7 +1190,7 @@ u8 DoFieldEndTurnEffects(void)
s32 j; s32 j;
for (j = i + 1; j < gBattlersCount; j++) for (j = i + 1; j < gBattlersCount; j++)
{ {
if (GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], 0)) if (GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], FALSE))
SwapTurnOrder(i, j); SwapTurnOrder(i, j);
} }
} }
+2 -2
View File
@@ -1188,9 +1188,9 @@ static void SetBerrySpriteData(struct Sprite* sprite, s16 x, s16 y, s16 bounceSp
#undef sXSpeed #undef sXSpeed
#undef sYDownSpeed #undef sYDownSpeed
static void CreateBerrySprite(u16 a0, u8 playerId) static void CreateBerrySprite(u16 itemId, u8 playerId)
{ {
u8 spriteId = CreateSpinningBerrySprite(a0 + FIRST_BERRY_INDEX - 10, 0, 80, playerId & 1); u8 spriteId = CreateSpinningBerrySprite(ITEM_TO_BERRY(itemId) - 1, 0, 80, playerId & 1);
SetBerrySpriteData(&gSprites[spriteId], SetBerrySpriteData(&gSprites[spriteId],
sBerrySpriteData[playerId][0], sBerrySpriteData[playerId][0],
sBerrySpriteData[playerId][1], sBerrySpriteData[playerId][1],
+3 -3
View File
@@ -2254,7 +2254,7 @@ static u32 Cmd_PrintMessage(struct BerryCrushGame *game, u8 *args)
switch (game->cmdState) switch (game->cmdState)
{ {
case 0: case 0:
DrawDialogueFrame(0, 0); DrawDialogueFrame(0, FALSE);
if (args[1] & F_MSG_EXPAND) if (args[1] & F_MSG_EXPAND)
{ {
StringExpandPlaceholders(gStringVar4, sMessages[args[0]]); StringExpandPlaceholders(gStringVar4, sMessages[args[0]]);
@@ -3241,7 +3241,7 @@ static u32 Cmd_SaveGame(struct BerryCrushGame *game, u8 *args)
case 2: case 2:
if (!IsLinkTaskFinished()) if (!IsLinkTaskFinished())
return 0; return 0;
DrawDialogueFrame(0, 0); DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized2(0, FONT_NORMAL, gText_SavingDontTurnOffPower, 0, 0, 2, 1, 3); AddTextPrinterParameterized2(0, FONT_NORMAL, gText_SavingDontTurnOffPower, 0, 0, 2, 1, 3);
CopyWindowToVram(0, COPYWIN_FULL); CopyWindowToVram(0, COPYWIN_FULL);
CreateTask(Task_LinkFullSave, 0); CreateTask(Task_LinkFullSave, 0);
@@ -3389,7 +3389,7 @@ static u32 Cmd_StopGame(struct BerryCrushGame *game, u8 *args)
switch (game->cmdState) switch (game->cmdState)
{ {
case 0: case 0:
DrawDialogueFrame(0, 0); DrawDialogueFrame(0, FALSE);
if (game->playAgainState == PLAY_AGAIN_NO_BERRIES) if (game->playAgainState == PLAY_AGAIN_NO_BERRIES)
AddTextPrinterParameterized2(0, FONT_NORMAL, sMessages[MSG_NO_BERRIES], game->textSpeed, 0, 2, 1, 3); AddTextPrinterParameterized2(0, FONT_NORMAL, sMessages[MSG_NO_BERRIES], game->textSpeed, 0, 2, 1, 3);
else else
+1 -1
View File
@@ -8,7 +8,7 @@
#include "international_string_util.h" #include "international_string_util.h"
#include "constants/coins.h" #include "constants/coins.h"
EWRAM_DATA u8 sCoinsWindowId = 0; static EWRAM_DATA u8 sCoinsWindowId = 0;
void PrintCoinsString(u32 coinAmount) void PrintCoinsString(u32 coinAmount)
{ {
+13 -13
View File
@@ -352,7 +352,7 @@ EWRAM_DATA u16 gSpecialVar_ContestRank = 0;
EWRAM_DATA u8 gNumLinkContestPlayers = 0; EWRAM_DATA u8 gNumLinkContestPlayers = 0;
EWRAM_DATA u8 gHighestRibbonRank = 0; EWRAM_DATA u8 gHighestRibbonRank = 0;
EWRAM_DATA struct ContestResources *gContestResources = NULL; EWRAM_DATA struct ContestResources *gContestResources = NULL;
EWRAM_DATA u8 sContestBgCopyFlags = 0; static EWRAM_DATA u8 sContestBgCopyFlags = 0;
EWRAM_DATA struct ContestWinner gCurContestWinner = {0}; EWRAM_DATA struct ContestWinner gCurContestWinner = {0};
EWRAM_DATA bool8 gCurContestWinnerIsForArtist = 0; EWRAM_DATA bool8 gCurContestWinnerIsForArtist = 0;
EWRAM_DATA u8 gCurContestWinnerSaveIdx = 0; EWRAM_DATA u8 gCurContestWinnerSaveIdx = 0;
@@ -625,7 +625,7 @@ static const struct SpriteTemplate sSpriteTemplate_ApplauseMeter =
.callback = SpriteCallbackDummy .callback = SpriteCallbackDummy
}; };
const struct OamData sOam_Judge = static const struct OamData sOam_Judge =
{ {
.y = 0, .y = 0,
.affineMode = ST_OAM_AFFINE_OFF, .affineMode = ST_OAM_AFFINE_OFF,
@@ -639,7 +639,7 @@ const struct OamData sOam_Judge =
.paletteNum = 2, .paletteNum = 2,
}; };
const struct SpriteTemplate sSpriteTemplate_Judge = static const struct SpriteTemplate sSpriteTemplate_Judge =
{ {
.tileTag = TAG_JUDGE, .tileTag = TAG_JUDGE,
.paletteTag = TAG_JUDGE, .paletteTag = TAG_JUDGE,
@@ -650,7 +650,7 @@ const struct SpriteTemplate sSpriteTemplate_Judge =
.callback = SpriteCallbackDummy .callback = SpriteCallbackDummy
}; };
const struct CompressedSpriteSheet sSpriteSheet_Judge = static const struct CompressedSpriteSheet sSpriteSheet_Judge =
{ {
.data = gContestJudgeGfx, .data = gContestJudgeGfx,
.size = 0x800, .size = 0x800,
@@ -664,13 +664,13 @@ static const struct CompressedSpriteSheet sSpriteSheet_JudgeSymbols =
.tag = TAG_JUDGE_SYMBOLS_GFX .tag = TAG_JUDGE_SYMBOLS_GFX
}; };
const struct CompressedSpritePalette sSpritePalette_JudgeSymbols = static const struct CompressedSpritePalette sSpritePalette_JudgeSymbols =
{ {
.data = gContestJudgeSymbolsPal, .data = gContestJudgeSymbolsPal,
.tag = TAG_CONTEST_SYMBOLS_PAL .tag = TAG_CONTEST_SYMBOLS_PAL
}; };
const struct SpriteTemplate sSpriteTemplate_JudgeSpeechBubble = static const struct SpriteTemplate sSpriteTemplate_JudgeSpeechBubble =
{ {
.tileTag = TAG_JUDGE_SYMBOLS_GFX, .tileTag = TAG_JUDGE_SYMBOLS_GFX,
.paletteTag = TAG_CONTEST_SYMBOLS_PAL, .paletteTag = TAG_CONTEST_SYMBOLS_PAL,
@@ -876,7 +876,7 @@ static const struct SpritePalette sSpritePalettes_ContestantsTurnBlinkEffect[CON
} }
}; };
const struct OamData sOam_ContestantsTurnBlinkEffect = static const struct OamData sOam_ContestantsTurnBlinkEffect =
{ {
.y = 0, .y = 0,
.affineMode = ST_OAM_AFFINE_DOUBLE, .affineMode = ST_OAM_AFFINE_DOUBLE,
@@ -891,13 +891,13 @@ const struct OamData sOam_ContestantsTurnBlinkEffect =
.affineParam = 0, .affineParam = 0,
}; };
const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_0[] = static const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_0[] =
{ {
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
AFFINEANIMCMD_END AFFINEANIMCMD_END
}; };
const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_1[] = static const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_1[] =
{ {
AFFINEANIMCMD_FRAME(3, 3, 0, 15), AFFINEANIMCMD_FRAME(3, 3, 0, 15),
AFFINEANIMCMD_FRAME(-3, -3, 0, 15), AFFINEANIMCMD_FRAME(-3, -3, 0, 15),
@@ -906,13 +906,13 @@ const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_1[] =
AFFINEANIMCMD_END AFFINEANIMCMD_END
}; };
const union AffineAnimCmd *const sAffineAnims_ContestantsTurnBlinkEffect[] = static const union AffineAnimCmd *const sAffineAnims_ContestantsTurnBlinkEffect[] =
{ {
sAffineAnim_ContestantsTurnBlinkEffect_0, sAffineAnim_ContestantsTurnBlinkEffect_0,
sAffineAnim_ContestantsTurnBlinkEffect_1 sAffineAnim_ContestantsTurnBlinkEffect_1
}; };
const struct SpriteTemplate sSpriteTemplates_ContestantsTurnBlinkEffect[CONTESTANT_COUNT] = static const struct SpriteTemplate sSpriteTemplates_ContestantsTurnBlinkEffect[CONTESTANT_COUNT] =
{ {
{ {
.tileTag = TAG_BLINK_EFFECT_CONTESTANT0, .tileTag = TAG_BLINK_EFFECT_CONTESTANT0,
@@ -952,7 +952,7 @@ const struct SpriteTemplate sSpriteTemplates_ContestantsTurnBlinkEffect[CONTESTA
} }
}; };
static const s8 gContestExcitementTable[CONTEST_CATEGORIES_COUNT][CONTEST_CATEGORIES_COUNT] = static const s8 sContestExcitementTable[CONTEST_CATEGORIES_COUNT][CONTEST_CATEGORIES_COUNT] =
{ {
[CONTEST_CATEGORY_COOL] = { [CONTEST_CATEGORY_COOL] = {
[CONTEST_CATEGORY_COOL] = +1, [CONTEST_CATEGORY_COOL] = +1,
@@ -4744,7 +4744,7 @@ static void UpdateApplauseMeter(void)
s8 Contest_GetMoveExcitement(u16 move) s8 Contest_GetMoveExcitement(u16 move)
{ {
return gContestExcitementTable[gSpecialVar_ContestCategory][gContestMoves[move].contestCategory]; return sContestExcitementTable[gSpecialVar_ContestCategory][gContestMoves[move].contestCategory];
} }
static u8 StartApplauseOverflowAnimation(void) static u8 StartApplauseOverflowAnimation(void)
+27 -19
View File
@@ -77,7 +77,10 @@ enum {
#define TAG_CONFETTI 3017 #define TAG_CONFETTI 3017
#define TAG_WIRELESS_INDICATOR_WINDOW 22222 #define TAG_WIRELESS_INDICATOR_WINDOW 22222
#define MAX_BAR_LENGTH 87 // Length of the score bar on the results screen
#define NUM_BAR_SEGMENTS 11
#define BAR_SEGMENT_LENGTH 8 // Each segment of the results bar is a single tile, so 8 pixels long
#define MAX_BAR_LENGTH (NUM_BAR_SEGMENTS * BAR_SEGMENT_LENGTH)
// Starting x/y for the sliding results screen text box // Starting x/y for the sliding results screen text box
#define TEXT_BOX_X (DISPLAY_WIDTH + 32) #define TEXT_BOX_X (DISPLAY_WIDTH + 32)
@@ -96,7 +99,7 @@ struct ContestResultsInternal
u8 winnerMonSpriteId; u8 winnerMonSpriteId;
bool8 destroyConfetti; bool8 destroyConfetti;
bool8 pointsFlashing; bool8 pointsFlashing;
s16 unkC[CONTESTANT_COUNT]; s16 barLength[CONTESTANT_COUNT];
u8 numBarsUpdating; u8 numBarsUpdating;
}; };
@@ -1748,7 +1751,7 @@ static void CalculateContestantsResultData(void)
if ((*sContestResults->monResults)[i].lostPoints) if ((*sContestResults->monResults)[i].lostPoints)
barLengthRound2 *= -1; barLengthRound2 *= -1;
if (barLengthPreliminary + barLengthRound2 == MAX_BAR_LENGTH + 1) if (barLengthPreliminary + barLengthRound2 == MAX_BAR_LENGTH)
{ {
if (barLengthRound2 > 0) if (barLengthRound2 > 0)
(*sContestResults->monResults)[i].barLengthRound2--; (*sContestResults->monResults)[i].barLengthRound2--;
@@ -1841,47 +1844,52 @@ static void Task_UpdateContestResultBar(u8 taskId)
s16 target = gTasks[taskId].tTarget; s16 target = gTasks[taskId].tTarget;
s16 decreasing = gTasks[taskId].tDecreasing; s16 decreasing = gTasks[taskId].tDecreasing;
// Has the results bar reached the limit?
if (decreasing) if (decreasing)
{ {
if (sContestResults->data->unkC[monId] <= 0) if (sContestResults->data->barLength[monId] <= 0)
minMaxReached = TRUE; minMaxReached = TRUE;
} }
else else
{ {
if (sContestResults->data->unkC[monId] > MAX_BAR_LENGTH) if (sContestResults->data->barLength[monId] >= MAX_BAR_LENGTH)
minMaxReached = TRUE; minMaxReached = TRUE;
} }
if (sContestResults->data->unkC[monId] == target) if (sContestResults->data->barLength[monId] == target)
targetReached = TRUE; targetReached = TRUE;
if (!targetReached) if (!targetReached)
{ {
// Target length has not been reached, update bar length
if (minMaxReached) if (minMaxReached)
sContestResults->data->unkC[monId] = target; sContestResults->data->barLength[monId] = target;
else if (decreasing) else if (decreasing)
sContestResults->data->unkC[monId] = sContestResults->data->unkC[monId] - 1; sContestResults->data->barLength[monId]--;
else else
sContestResults->data->unkC[monId] = sContestResults->data->unkC[monId] + 1; sContestResults->data->barLength[monId]++;
} }
// Update the tiles of the results bar if it's still changing
if (!minMaxReached && !targetReached) if (!minMaxReached && !targetReached)
{ {
u8 var0; u8 tileOffset;
u16 tileNum; u16 tileNum;
for (i = 0; i < 11; i++) for (i = 0; i < NUM_BAR_SEGMENTS; i++)
{ {
if (sContestResults->data->unkC[monId] >= (i + 1) * 8) if (sContestResults->data->barLength[monId] >= (i + 1) * BAR_SEGMENT_LENGTH)
var0 = 8; tileOffset = 8; // Bar segment is full
else if (sContestResults->data->unkC[monId] >= i * 8) else if (sContestResults->data->barLength[monId] >= i * BAR_SEGMENT_LENGTH)
var0 = sContestResults->data->unkC[monId] % 8; tileOffset = sContestResults->data->barLength[monId] % 8; // Bar segment is between full and empty
else else
var0 = 0; tileOffset = 0; // Bar segment is empty
if (var0 < 4) // The first 4 bar segment tiles are not adjacent in the tileset to the
tileNum = 0x504C + var0; // remaining bar segment tiles; choose the base tile number accordingly.
if (tileOffset < 4)
tileNum = 0x504C + tileOffset;
else else
tileNum = 0x5057 + var0; tileNum = 0x5057 + tileOffset;
FillBgTilemapBufferRect_Palette0(2, tileNum, i + 7, monId * 3 + 6, 1, 1); FillBgTilemapBufferRect_Palette0(2, tileNum, i + 7, monId * 3 + 6, 1, 1);
} }
@@ -1272,7 +1272,7 @@ static const union AnimCmd *const sAnimTable_RayquazaSpotlightEffect[] = {
sAnim_RayquazaSpotlightEffect, sAnim_RayquazaSpotlightEffect,
}; };
const struct SpriteFrameImage sPicTable_RayquazaSpotlightEffect[] = { static const struct SpriteFrameImage sPicTable_RayquazaSpotlightEffect[] = {
overworld_frame(gObjectEventPic_Rayquaza, 4, 4, 0), overworld_frame(gObjectEventPic_Rayquaza, 4, 4, 0),
}; };
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -174,10 +174,10 @@ static const struct SpriteTemplate sSpriteTemplate_MenuText =
.callback = SpriteCallbackDummy, .callback = SpriteCallbackDummy,
}; };
static const u16 TradeScreenTextPalette[] = INCBIN_U16("graphics/trade/text.gbapal"); static const u16 sTradeScreenTextPalette[] = INCBIN_U16("graphics/trade/text.gbapal");
static const struct SpritePalette gSpritePalette_TradeScreenText = static const struct SpritePalette sSpritePalette_TradeScreenText =
{ {
.data = TradeScreenTextPalette, .data = sTradeScreenTextPalette,
.tag = PALTAG_MENU_TEXT .tag = PALTAG_MENU_TEXT
}; };
+15 -15
View File
@@ -1,4 +1,4 @@
static const union AnimCmd gAnimCmd_Brendan_1[] = static const union AnimCmd sAnimCmd_Brendan_1[] =
{ {
ANIMCMD_FRAME(0, 24), ANIMCMD_FRAME(0, 24),
ANIMCMD_FRAME(1, 9), ANIMCMD_FRAME(1, 9),
@@ -8,7 +8,7 @@ static const union AnimCmd gAnimCmd_Brendan_1[] =
ANIMCMD_END, ANIMCMD_END,
}; };
static const union AnimCmd gAnimCmd_May_Steven_1[] = static const union AnimCmd sAnimCmd_May_Steven_1[] =
{ {
ANIMCMD_FRAME(0, 24), ANIMCMD_FRAME(0, 24),
ANIMCMD_FRAME(1, 9), ANIMCMD_FRAME(1, 9),
@@ -18,7 +18,7 @@ static const union AnimCmd gAnimCmd_May_Steven_1[] =
ANIMCMD_END, ANIMCMD_END,
}; };
static const union AnimCmd gAnimCmd_Wally_1[] = static const union AnimCmd sAnimCmd_Wally_1[] =
{ {
ANIMCMD_FRAME(0, 24), ANIMCMD_FRAME(0, 24),
ANIMCMD_FRAME(1, 9), ANIMCMD_FRAME(1, 9),
@@ -28,7 +28,7 @@ static const union AnimCmd gAnimCmd_Wally_1[] =
ANIMCMD_END, ANIMCMD_END,
}; };
static const union AnimCmd gAnimCmd_Red_1[] = static const union AnimCmd sAnimCmd_Red_1[] =
{ {
ANIMCMD_FRAME(1, 20), ANIMCMD_FRAME(1, 20),
ANIMCMD_FRAME(2, 6), ANIMCMD_FRAME(2, 6),
@@ -38,7 +38,7 @@ static const union AnimCmd gAnimCmd_Red_1[] =
ANIMCMD_END, ANIMCMD_END,
}; };
static const union AnimCmd gAnimCmd_Leaf_1[] = static const union AnimCmd sAnimCmd_Leaf_1[] =
{ {
ANIMCMD_FRAME(1, 20), ANIMCMD_FRAME(1, 20),
ANIMCMD_FRAME(2, 6), ANIMCMD_FRAME(2, 6),
@@ -48,7 +48,7 @@ static const union AnimCmd gAnimCmd_Leaf_1[] =
ANIMCMD_END, ANIMCMD_END,
}; };
static const union AnimCmd gAnimCmd_RubySapphireBrendan_1[] = static const union AnimCmd sAnimCmd_RubySapphireBrendan_1[] =
{ {
ANIMCMD_FRAME(0, 24), ANIMCMD_FRAME(0, 24),
ANIMCMD_FRAME(1, 9), ANIMCMD_FRAME(1, 9),
@@ -58,7 +58,7 @@ static const union AnimCmd gAnimCmd_RubySapphireBrendan_1[] =
ANIMCMD_END, ANIMCMD_END,
}; };
static const union AnimCmd gAnimCmd_RubySapphireMay_1[] = static const union AnimCmd sAnimCmd_RubySapphireMay_1[] =
{ {
ANIMCMD_FRAME(0, 24), ANIMCMD_FRAME(0, 24),
ANIMCMD_FRAME(1, 9), ANIMCMD_FRAME(1, 9),
@@ -71,49 +71,49 @@ static const union AnimCmd gAnimCmd_RubySapphireMay_1[] =
static const union AnimCmd *const sBackAnims_Brendan[] = static const union AnimCmd *const sBackAnims_Brendan[] =
{ {
sAnim_GeneralFrame3, sAnim_GeneralFrame3,
gAnimCmd_Brendan_1, sAnimCmd_Brendan_1,
}; };
static const union AnimCmd *const sBackAnims_May[] = static const union AnimCmd *const sBackAnims_May[] =
{ {
sAnim_GeneralFrame3, sAnim_GeneralFrame3,
gAnimCmd_May_Steven_1, sAnimCmd_May_Steven_1,
}; };
static const union AnimCmd *const sBackAnims_Red[] = static const union AnimCmd *const sBackAnims_Red[] =
{ {
sAnim_GeneralFrame0, sAnim_GeneralFrame0,
gAnimCmd_Red_1, sAnimCmd_Red_1,
}; };
static const union AnimCmd *const sBackAnims_Leaf[] = static const union AnimCmd *const sBackAnims_Leaf[] =
{ {
sAnim_GeneralFrame0, sAnim_GeneralFrame0,
gAnimCmd_Leaf_1, sAnimCmd_Leaf_1,
}; };
static const union AnimCmd *const sBackAnims_RubySapphireBrendan[] = static const union AnimCmd *const sBackAnims_RubySapphireBrendan[] =
{ {
sAnim_GeneralFrame3, sAnim_GeneralFrame3,
gAnimCmd_RubySapphireBrendan_1, sAnimCmd_RubySapphireBrendan_1,
}; };
static const union AnimCmd *const sBackAnims_RubySapphireMay[] = static const union AnimCmd *const sBackAnims_RubySapphireMay[] =
{ {
sAnim_GeneralFrame3, sAnim_GeneralFrame3,
gAnimCmd_RubySapphireMay_1, sAnimCmd_RubySapphireMay_1,
}; };
static const union AnimCmd *const sBackAnims_Wally[] = static const union AnimCmd *const sBackAnims_Wally[] =
{ {
sAnim_GeneralFrame3, sAnim_GeneralFrame3,
gAnimCmd_Wally_1, sAnimCmd_Wally_1,
}; };
static const union AnimCmd *const sBackAnims_Steven[] = static const union AnimCmd *const sBackAnims_Steven[] =
{ {
sAnim_GeneralFrame3, sAnim_GeneralFrame3,
gAnimCmd_May_Steven_1, sAnimCmd_May_Steven_1,
}; };
const union AnimCmd *const *const gTrainerBackAnimsPtrTable[] = const union AnimCmd *const *const gTrainerBackAnimsPtrTable[] =
+2 -2
View File
@@ -826,7 +826,7 @@ static void ReturnToActionsMenuFromCategories(u8 taskId)
{ {
RemoveDecorationWindow(WINDOW_DECORATION_CATEGORIES); RemoveDecorationWindow(WINDOW_DECORATION_CATEGORIES);
AddDecorationActionsWindow(); AddDecorationActionsWindow();
DrawDialogueFrame(0, 0); DrawDialogueFrame(0, FALSE);
PrintCurMainMenuDescription(); PrintCurMainMenuDescription();
gTasks[taskId].func = HandleDecorationActionsMenuInput; gTasks[taskId].func = HandleDecorationActionsMenuInput;
} }
@@ -2664,7 +2664,7 @@ static void FieldCB_StopPuttingAwayDecorations(void)
u8 taskId; u8 taskId;
FadeInFromBlack(); FadeInFromBlack();
DrawDialogueFrame(0, 1); DrawDialogueFrame(0, TRUE);
InitDecorationActionsWindow(); InitDecorationActionsWindow();
taskId = CreateTask(Task_ReinitializeDecorationMenuHandler, 8); taskId = CreateTask(Task_ReinitializeDecorationMenuHandler, 8);
gTasks[taskId].tState = 0; gTasks[taskId].tState = 0;
+1 -1
View File
@@ -4546,7 +4546,7 @@ struct
{ {
u8 id; u8 id;
void (*func)(void); void (*func)(void);
} const sGfxFuncs[] = } static const sGfxFuncs[] =
{ {
{GFXFUNC_LOAD, LoadGfx}, // Element not used, LoadGfx is passed directly to SetGfxFunc {GFXFUNC_LOAD, LoadGfx}, // Element not used, LoadGfx is passed directly to SetGfxFunc
{GFXFUNC_SHOW_NAMES, ShowNames}, {GFXFUNC_SHOW_NAMES, ShowNames},
+3 -6
View File
@@ -1672,8 +1672,7 @@ static bool8 InitEasyChatScreenStruct(u8 type, u16 *words, u8 displayedPersonTyp
static void FreeEasyChatScreenStruct(void) static void FreeEasyChatScreenStruct(void)
{ {
if (sEasyChatScreen != NULL) TRY_FREE_AND_SET_NULL(sEasyChatScreen);
FREE_AND_SET_NULL(sEasyChatScreen);
} }
// Returns the function ID of the action to take as a result of player's input. // Returns the function ID of the action to take as a result of player's input.
@@ -3075,8 +3074,7 @@ static bool8 LoadEasyChatScreen(void)
static void FreeEasyChatScreenControl(void) static void FreeEasyChatScreenControl(void)
{ {
if (sScreenControl) TRY_FREE_AND_SET_NULL(sScreenControl);
FREE_AND_SET_NULL(sScreenControl);
} }
static void StartEasyChatFunction(u16 funcId) static void StartEasyChatFunction(u16 funcId)
@@ -5573,8 +5571,7 @@ static bool8 InitEasyChatScreenWordData(void)
static void FreeEasyChatScreenWordData(void) static void FreeEasyChatScreenWordData(void)
{ {
if (sWordData) TRY_FREE_AND_SET_NULL(sWordData);
FREE_AND_SET_NULL(sWordData);
} }
static void SetUnlockedEasyChatGroups(void) static void SetUnlockedEasyChatGroups(void)
+2
View File
@@ -15,6 +15,8 @@
#include "constants/items.h" #include "constants/items.h"
#include "constants/trainer_hill.h" #include "constants/trainer_hill.h"
STATIC_ASSERT(sizeof(struct TrainerHillChallenge) <= SECTOR_DATA_SIZE, TrainerHillChallengeFreeSpace);
struct SendRecvMgr struct SendRecvMgr
{ {
bool8 isParent; bool8 isParent;
+3 -3
View File
@@ -30,7 +30,7 @@ EWRAM_DATA u16 gSpecialVar_Facing = 0;
EWRAM_DATA u16 gSpecialVar_MonBoxId = 0; EWRAM_DATA u16 gSpecialVar_MonBoxId = 0;
EWRAM_DATA u16 gSpecialVar_MonBoxPos = 0; EWRAM_DATA u16 gSpecialVar_MonBoxPos = 0;
EWRAM_DATA u16 gSpecialVar_Unused_0x8014 = 0; EWRAM_DATA u16 gSpecialVar_Unused_0x8014 = 0;
EWRAM_DATA static u8 gSpecialFlags[SPECIAL_FLAGS_SIZE] = {0}; EWRAM_DATA static u8 sSpecialFlags[SPECIAL_FLAGS_SIZE] = {0};
extern u16 *const gSpecialVars[]; extern u16 *const gSpecialVars[];
@@ -38,7 +38,7 @@ void InitEventData(void)
{ {
memset(gSaveBlock1Ptr->flags, 0, sizeof(gSaveBlock1Ptr->flags)); memset(gSaveBlock1Ptr->flags, 0, sizeof(gSaveBlock1Ptr->flags));
memset(gSaveBlock1Ptr->vars, 0, sizeof(gSaveBlock1Ptr->vars)); memset(gSaveBlock1Ptr->vars, 0, sizeof(gSaveBlock1Ptr->vars));
memset(gSpecialFlags, 0, sizeof(gSpecialFlags)); memset(sSpecialFlags, 0, sizeof(sSpecialFlags));
} }
void ClearTempFieldEventData(void) void ClearTempFieldEventData(void)
@@ -205,7 +205,7 @@ u8 *GetFlagPointer(u16 id)
else if (id < SPECIAL_FLAGS_START) else if (id < SPECIAL_FLAGS_START)
return &gSaveBlock1Ptr->flags[id / 8]; return &gSaveBlock1Ptr->flags[id / 8];
else else
return &gSpecialFlags[(id - SPECIAL_FLAGS_START) / 8]; return &sSpecialFlags[(id - SPECIAL_FLAGS_START) / 8];
} }
u8 FlagSet(u16 id) u8 FlagSet(u16 id)
+5 -5
View File
@@ -8251,11 +8251,11 @@ static const SpriteStepFunc *const sNpcStepFuncTables[] = {
}; };
static const s16 sStepTimes[] = { static const s16 sStepTimes[] = {
[MOVE_SPEED_NORMAL] = 16, [MOVE_SPEED_NORMAL] = ARRAY_COUNT(sStep1Funcs),
[MOVE_SPEED_FAST_1] = 8, [MOVE_SPEED_FAST_1] = ARRAY_COUNT(sStep2Funcs),
[MOVE_SPEED_FAST_2] = 6, [MOVE_SPEED_FAST_2] = ARRAY_COUNT(sStep3Funcs),
[MOVE_SPEED_FASTER] = 4, [MOVE_SPEED_FASTER] = ARRAY_COUNT(sStep4Funcs),
[MOVE_SPEED_FASTEST] = 2, [MOVE_SPEED_FASTEST] = ARRAY_COUNT(sStep8Funcs),
}; };
static bool8 NpcTakeStep(struct Sprite *sprite) static bool8 NpcTakeStep(struct Sprite *sprite)
+2 -4
View File
@@ -816,8 +816,7 @@ static void Task_EvolutionScene(u8 taskId)
DestroyTask(taskId); DestroyTask(taskId);
FreeMonSpritesGfx(); FreeMonSpritesGfx();
Free(sEvoStructPtr); FREE_AND_SET_NULL(sEvoStructPtr);
sEvoStructPtr = NULL;
FreeAllWindowBuffers(); FreeAllWindowBuffers();
SetMainCallback2(gCB2_AfterEvolution); SetMainCallback2(gCB2_AfterEvolution);
} }
@@ -1223,8 +1222,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
if (!IsTextPrinterActive(0)) if (!IsTextPrinterActive(0))
{ {
DestroyTask(taskId); DestroyTask(taskId);
Free(sEvoStructPtr); FREE_AND_SET_NULL(sEvoStructPtr);
sEvoStructPtr = NULL;
gTextFlags.useAlternateDownArrow = 0; gTextFlags.useAlternateDownArrow = 0;
SetMainCallback2(gCB2_AfterEvolution); SetMainCallback2(gCB2_AfterEvolution);
} }
+2 -2
View File
@@ -212,13 +212,13 @@ void CurrentMapDrawMetatileAt(int x, int y)
} }
} }
void DrawDoorMetatileAt(int x, int y, u16 *arr) void DrawDoorMetatileAt(int x, int y, u16 *tiles)
{ {
int offset = MapPosToBgTilemapOffset(&sFieldCameraOffset, x, y); int offset = MapPosToBgTilemapOffset(&sFieldCameraOffset, x, y);
if (offset >= 0) if (offset >= 0)
{ {
DrawMetatile(METATILE_LAYER_TYPE_COVERED, arr, offset); DrawMetatile(METATILE_LAYER_TYPE_COVERED, tiles, offset);
sFieldCameraOffset.copyBGToVRAM = TRUE; sFieldCameraOffset.copyBGToVRAM = TRUE;
} }
} }
+52 -31
View File
@@ -18,7 +18,7 @@ struct DoorGraphics
u8 sound; u8 sound;
u8 size; u8 size;
const void *tiles; const void *tiles;
const void *palette; const void *palettes;
}; };
struct DoorAnimFrame struct DoorAnimFrame
@@ -74,7 +74,7 @@ static const u8 sDoorAnimTiles_PokemonLeague[] = INCBIN_U8("graphics/door_anims/
static const u16 sDoorNullPalette20[16] = {}; static const u16 sDoorNullPalette20[16] = {};
static const u8 sDoorAnimTiles_Pacifidlog[] = INCBIN_U8("graphics/door_anims/pacifidlog.4bpp"); static const u8 sDoorAnimTiles_Pacifidlog[] = INCBIN_U8("graphics/door_anims/pacifidlog.4bpp");
static const u16 sDoorNullPalette21[16] = {}; static const u16 sDoorNullPalette21[16] = {};
static const u8 sDoorAnimTiles_BattleTowerCorridor[] = INCBIN_U8("graphics/door_anims/battle_tower_corridor.4bpp"); static const u8 sDoorAnimTiles_PetalburgGym[] = INCBIN_U8("graphics/door_anims/petalburg_gym.4bpp");
static const u16 sDoorNullPalette22[16] = {}; static const u16 sDoorNullPalette22[16] = {};
static const u8 sDoorAnimTiles_CyclingRoad[] = INCBIN_U8("graphics/door_anims/cycling_road.4bpp"); static const u8 sDoorAnimTiles_CyclingRoad[] = INCBIN_U8("graphics/door_anims/cycling_road.4bpp");
static const u16 sDoorNullPalette23[16] = {}; static const u16 sDoorNullPalette23[16] = {};
@@ -98,7 +98,7 @@ static const u8 sDoorAnimTiles_BattleTowerOld[] = INCBIN_U8("graphics/door_anims
static const u16 sDoorNullPalette32[16] = {}; static const u16 sDoorNullPalette32[16] = {};
static const u8 sDoorAnimTiles_BattleTowerElevator[] = INCBIN_U8("graphics/door_anims/battle_tower_elevator.4bpp"); static const u8 sDoorAnimTiles_BattleTowerElevator[] = INCBIN_U8("graphics/door_anims/battle_tower_elevator.4bpp");
static const u16 sDoorNullPalette33[16] = {}; static const u16 sDoorNullPalette33[16] = {};
static const u8 sDoorAnimTiles_34[] = INCBIN_U8("graphics/door_anims/unknown.4bpp"); static const u8 sDoorAnimTiles_UnusedBattleFrontier[] = INCBIN_U8("graphics/door_anims/unused_battle_frontier.4bpp");
static const u16 sDoorNullPalette34[16] = {}; static const u16 sDoorNullPalette34[16] = {};
static const u8 sDoorAnimTiles_BattleDome[] = INCBIN_U8("graphics/door_anims/battle_dome.4bpp"); static const u8 sDoorAnimTiles_BattleDome[] = INCBIN_U8("graphics/door_anims/battle_dome.4bpp");
static const u16 sDoorNullPalette35[16] = {}; static const u16 sDoorNullPalette35[16] = {};
@@ -190,7 +190,7 @@ static const u8 sDoorAnimPalettes_Mauville[] = {7, 7, 7, 7, 7, 7, 7, 7};
static const u8 sDoorAnimPalettes_Verdanturf[] = {6, 6, 5, 5, 5, 5, 5, 5}; static const u8 sDoorAnimPalettes_Verdanturf[] = {6, 6, 5, 5, 5, 5, 5, 5};
static const u8 sDoorAnimPalettes_LilycoveWooden[] = {5, 5, 5, 5, 5, 5, 5, 5}; static const u8 sDoorAnimPalettes_LilycoveWooden[] = {5, 5, 5, 5, 5, 5, 5, 5};
static const u8 sDoorAnimPalettes_Contest[] = {1, 1, 1, 1, 1, 1, 1, 1}; static const u8 sDoorAnimPalettes_Contest[] = {1, 1, 1, 1, 1, 1, 1, 1};
static const u8 sDoorAnimPalettes_BattleTowerCorridor[] = {6, 6, 6, 6, 6, 6, 6, 6}; static const u8 sDoorAnimPalettes_PetalburgGym[] = {6, 6, 6, 6, 6, 6, 6, 6};
static const u8 sDoorAnimPalettes_CyclingRoad[] = {7, 7, 7, 7, 7, 7, 7, 7}; static const u8 sDoorAnimPalettes_CyclingRoad[] = {7, 7, 7, 7, 7, 7, 7, 7};
static const u8 sDoorAnimPalettes_LilycoveDeptStore[] = {5, 5, 5, 5, 5, 5, 5, 5}; static const u8 sDoorAnimPalettes_LilycoveDeptStore[] = {5, 5, 5, 5, 5, 5, 5, 5};
static const u8 sDoorAnimPalettes_SafariZone[] = {9, 9, 9, 9, 9, 9, 9, 9}; static const u8 sDoorAnimPalettes_SafariZone[] = {9, 9, 9, 9, 9, 9, 9, 9};
@@ -202,7 +202,7 @@ static const u8 sDoorAnimPalettes_AbandonedShipRoom[] = {7, 7, 7, 7, 7, 7, 7, 7}
static const u8 sDoorAnimPalettes_LilycoveDeptStoreElevator[] = {6, 6, 7, 7, 7, 7, 7, 7}; static const u8 sDoorAnimPalettes_LilycoveDeptStoreElevator[] = {6, 6, 7, 7, 7, 7, 7, 7};
static const u8 sDoorAnimPalettes_BattleTowerOld[] = {9, 9, 9, 9, 9, 9, 9, 9}; static const u8 sDoorAnimPalettes_BattleTowerOld[] = {9, 9, 9, 9, 9, 9, 9, 9};
static const u8 sDoorAnimPalettes_BattleTowerElevator[] = {7, 7, 7, 7, 7, 7, 7, 7}; static const u8 sDoorAnimPalettes_BattleTowerElevator[] = {7, 7, 7, 7, 7, 7, 7, 7};
static const u8 sDoorAnimPalettes_34[] = {9, 9, 9, 9, 9, 9, 9, 9}; static const u8 sDoorAnimPalettes_UnusedBattleFrontier[] = {9, 9, 9, 9, 9, 9, 9, 9};
static const u8 sDoorAnimPalettes_BattleDome[] = {1, 1, 1, 1, 1, 1, 1, 1}; static const u8 sDoorAnimPalettes_BattleDome[] = {1, 1, 1, 1, 1, 1, 1, 1};
static const u8 sDoorAnimPalettes_BattleFactory[] = {9, 9, 9, 9, 9, 9, 9, 9}; static const u8 sDoorAnimPalettes_BattleFactory[] = {9, 9, 9, 9, 9, 9, 9, 9};
static const u8 sDoorAnimPalettes_BattleTower[] = {0, 0, 0, 0, 0, 0, 0, 0}; static const u8 sDoorAnimPalettes_BattleTower[] = {0, 0, 0, 0, 0, 0, 0, 0};
@@ -244,7 +244,7 @@ static const struct DoorGraphics sDoorAnimGraphicsTable[] =
{METATILE_Sootopolis_Door, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_Sootopolis, sDoorAnimPalettes_Sootopolis}, {METATILE_Sootopolis_Door, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_Sootopolis, sDoorAnimPalettes_Sootopolis},
{METATILE_EverGrande_Door_PokemonLeague, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_PokemonLeague, sDoorAnimPalettes_PokemonLeague}, {METATILE_EverGrande_Door_PokemonLeague, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_PokemonLeague, sDoorAnimPalettes_PokemonLeague},
{METATILE_Pacifidlog_Door, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_Pacifidlog, sDoorAnimPalettes_Pacifidlog}, {METATILE_Pacifidlog_Door, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_Pacifidlog, sDoorAnimPalettes_Pacifidlog},
{METATILE_BattleFrontier_Door_Corridor, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_BattleTowerCorridor, sDoorAnimPalettes_BattleTowerCorridor}, {METATILE_PetalburgGym_Door, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_PetalburgGym, sDoorAnimPalettes_PetalburgGym},
{METATILE_Mauville_Door_CyclingRoad, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_CyclingRoad, sDoorAnimPalettes_CyclingRoad}, {METATILE_Mauville_Door_CyclingRoad, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_CyclingRoad, sDoorAnimPalettes_CyclingRoad},
{METATILE_Lilycove_Door_DeptStore, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_LilycoveDeptStore, sDoorAnimPalettes_LilycoveDeptStore}, {METATILE_Lilycove_Door_DeptStore, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_LilycoveDeptStore, sDoorAnimPalettes_LilycoveDeptStore},
{METATILE_Lilycove_Door_SafariZone, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_SafariZone, sDoorAnimPalettes_SafariZone}, {METATILE_Lilycove_Door_SafariZone, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_SafariZone, sDoorAnimPalettes_SafariZone},
@@ -256,7 +256,9 @@ static const struct DoorGraphics sDoorAnimGraphicsTable[] =
{METATILE_Shop_Door_Elevator, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_LilycoveDeptStoreElevator, sDoorAnimPalettes_LilycoveDeptStoreElevator}, {METATILE_Shop_Door_Elevator, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_LilycoveDeptStoreElevator, sDoorAnimPalettes_LilycoveDeptStoreElevator},
{METATILE_Dewford_Door_BattleTower, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleTowerOld, sDoorAnimPalettes_BattleTowerOld}, {METATILE_Dewford_Door_BattleTower, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleTowerOld, sDoorAnimPalettes_BattleTowerOld},
{METATILE_BattleFrontier_Door_Elevator, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleTowerElevator, sDoorAnimPalettes_BattleTowerElevator}, {METATILE_BattleFrontier_Door_Elevator, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleTowerElevator, sDoorAnimPalettes_BattleTowerElevator},
{0x3B0, /* TODO: Missing metatile ID */ DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_34, sDoorAnimPalettes_34}, // The metatile for this door doesn't seem to correspond to a door in any Emerald tileset. Given the surrounding door animations, it was likely cut from the Battle Frontier.
// From the palettes array we know it uses palette 9, and the door's shadow looks correct using either the Battle Tent or Battle Frontier Outside's 9th palette.
{0x3B0, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_UnusedBattleFrontier, sDoorAnimPalettes_UnusedBattleFrontier},
{METATILE_BattleFrontierOutsideWest_Door_BattleDome, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleDome, sDoorAnimPalettes_BattleDome}, {METATILE_BattleFrontierOutsideWest_Door_BattleDome, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleDome, sDoorAnimPalettes_BattleDome},
{METATILE_BattleFrontierOutsideWest_Door_BattleFactory, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleFactory, sDoorAnimPalettes_BattleFactory}, {METATILE_BattleFrontierOutsideWest_Door_BattleFactory, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleFactory, sDoorAnimPalettes_BattleFactory},
{METATILE_BattleFrontierOutsideEast_Door_BattleTower, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleTower, sDoorAnimPalettes_BattleTower}, {METATILE_BattleFrontierOutsideEast_Door_BattleTower, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleTower, sDoorAnimPalettes_BattleTower},
@@ -278,52 +280,71 @@ static const struct DoorGraphics sDoorAnimGraphicsTable[] =
{}, {},
}; };
// NOTE: The tiles of a door's animation must be copied to VRAM because they are not already part of any given tileset.
// This means that if there are any pre-existing tiles in this copied region that are visible when the door
// animation is played they will be overwritten.
#define DOOR_TILE_START_SIZE1 (NUM_TILES_TOTAL - 8)
#define DOOR_TILE_START_SIZE2 (NUM_TILES_TOTAL - 16)
static void CopyDoorTilesToVram(const struct DoorGraphics *gfx, const struct DoorAnimFrame *frame) static void CopyDoorTilesToVram(const struct DoorGraphics *gfx, const struct DoorAnimFrame *frame)
{ {
if (gfx->size == 2) if (gfx->size == 2)
CpuFastSet(gfx->tiles + frame->offset, (void *)(VRAM + 0x7E00), 0x80); CpuFastCopy(gfx->tiles + frame->offset, (void *)(VRAM + TILE_OFFSET_4BPP(DOOR_TILE_START_SIZE2)), 16 * TILE_SIZE_4BPP);
else else
CpuFastSet(gfx->tiles + frame->offset, (void *)(VRAM + 0x7F00), 0x40); CpuFastCopy(gfx->tiles + frame->offset, (void *)(VRAM + TILE_OFFSET_4BPP(DOOR_TILE_START_SIZE1)), 8 * TILE_SIZE_4BPP);
} }
static void door_build_blockdef(u16 *a, u16 b, const u8 *c) static void BuildDoorTiles(u16 *tiles, u16 tileNum, const u8 *paletteNums)
{ {
int i; int i;
u16 unk; u16 tile;
// Only the first 4 tiles of each metatile (bottom layer) actually use the door tiles
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
unk = *(c++) << 12; tile = *(paletteNums++) << 12;
a[i] = unk | (b + i); tiles[i] = tile | (tileNum + i);
} }
// The remaining layers are left as tile 0 (with the same palette)
for (; i < 8; i++) for (; i < 8; i++)
{ {
unk = *(c++) << 12; tile = *(paletteNums++) << 12;
a[i] = unk; tiles[i] = tile;
} }
} }
static void DrawCurrentDoorAnimFrame(const struct DoorGraphics *gfx, u32 x, u32 y, const u8 *pal) static void DrawCurrentDoorAnimFrame(const struct DoorGraphics *gfx, u32 x, u32 y, const u8 *paletteNums)
{ {
u16 arr[24]; u16 tiles[24];
if (gfx->size == 2) if (gfx->size == 2)
{ {
door_build_blockdef(&arr[8], 0x3F0, pal); // Top left metatile
DrawDoorMetatileAt(x, y - 1, &arr[8]); BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 0, &paletteNums[0]);
door_build_blockdef(&arr[8], 0x3F4, pal + 4); DrawDoorMetatileAt(x, y - 1, &tiles[8]);
DrawDoorMetatileAt(x, y, &arr[8]);
door_build_blockdef(&arr[8], 0x3F8, pal); // Bottom left metatile
DrawDoorMetatileAt(x + 1, y - 1, &arr[8]); BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 4, &paletteNums[4]);
door_build_blockdef(&arr[8], 0x3FC, pal + 4); DrawDoorMetatileAt(x, y, &tiles[8]);
DrawDoorMetatileAt(x + 1, y, &arr[8]);
// Top right metatile
BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 8, &paletteNums[0]);
DrawDoorMetatileAt(x + 1, y - 1, &tiles[8]);
// Bottom right metatile
BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 12, &paletteNums[4]);
DrawDoorMetatileAt(x + 1, y, &tiles[8]);
} }
else else
{ {
door_build_blockdef(&arr[0], 0x3F8, pal); // Top metatile
DrawDoorMetatileAt(x, y - 1, &arr[0]); BuildDoorTiles(&tiles[0], DOOR_TILE_START_SIZE1 + 0, &paletteNums[0]);
door_build_blockdef(&arr[0], 0x3FC, pal + 4); DrawDoorMetatileAt(x, y - 1, &tiles[0]);
DrawDoorMetatileAt(x, y, &arr[0]);
// Bottom metatile
BuildDoorTiles(&tiles[0], DOOR_TILE_START_SIZE1 + 4, &paletteNums[4]);
DrawDoorMetatileAt(x, y, &tiles[0]);
} }
} }
@@ -350,9 +371,9 @@ static void DrawDoor(const struct DoorGraphics *gfx, const struct DoorAnimFrame
else else
{ {
CopyDoorTilesToVram(gfx, frame); CopyDoorTilesToVram(gfx, frame);
DrawCurrentDoorAnimFrame(gfx, x, y, gfx->palette); DrawCurrentDoorAnimFrame(gfx, x, y, gfx->palettes);
if (ShouldUseMultiCorridorDoor()) if (ShouldUseMultiCorridorDoor())
DrawCurrentDoorAnimFrame(gfx, gSpecialVar_0x8004 + MAP_OFFSET, gSpecialVar_0x8005 + MAP_OFFSET, gfx->palette); DrawCurrentDoorAnimFrame(gfx, gSpecialVar_0x8004 + MAP_OFFSET, gSpecialVar_0x8005 + MAP_OFFSET, gfx->palettes);
} }
} }
+23 -23
View File
@@ -481,13 +481,13 @@ static const struct Subsprite sSubsprites_HofMonitorBig[] =
static const struct SubspriteTable sSubspriteTable_HofMonitorBig = subsprite_table(sSubsprites_HofMonitorBig); static const struct SubspriteTable sSubspriteTable_HofMonitorBig = subsprite_table(sSubsprites_HofMonitorBig);
const union AnimCmd sAnim_Static[] = static const union AnimCmd sAnim_Static[] =
{ {
ANIMCMD_FRAME(.imageValue = 0, .duration = 1), ANIMCMD_FRAME(.imageValue = 0, .duration = 1),
ANIMCMD_JUMP(0) ANIMCMD_JUMP(0)
}; };
const union AnimCmd sAnim_Flicker[] = static const union AnimCmd sAnim_Flicker[] =
{ {
ANIMCMD_FRAME(.imageValue = 0, .duration = 16), ANIMCMD_FRAME(.imageValue = 0, .duration = 16),
ANIMCMD_FRAME(.imageValue = 1, .duration = 16), ANIMCMD_FRAME(.imageValue = 1, .duration = 16),
@@ -501,7 +501,7 @@ const union AnimCmd sAnim_Flicker[] =
}; };
// Flicker on and off, for the Pokéballs / monitors during the PokéCenter heal effect // Flicker on and off, for the Pokéballs / monitors during the PokéCenter heal effect
const union AnimCmd *const sAnims_Flicker[] = static const union AnimCmd *const sAnims_Flicker[] =
{ {
sAnim_Static, sAnim_Static,
sAnim_Flicker sAnim_Flicker
@@ -556,7 +556,7 @@ static const struct SpriteTemplate sSpriteTemplate_HofMonitorSmall =
.callback = SpriteCB_HallOfFameMonitor .callback = SpriteCB_HallOfFameMonitor
}; };
void (*const sPokecenterHealEffectFuncs[])(struct Task *) = static void (*const sPokecenterHealEffectFuncs[])(struct Task *) =
{ {
PokecenterHealEffect_Init, PokecenterHealEffect_Init,
PokecenterHealEffect_WaitForBallPlacement, PokecenterHealEffect_WaitForBallPlacement,
@@ -564,7 +564,7 @@ void (*const sPokecenterHealEffectFuncs[])(struct Task *) =
PokecenterHealEffect_WaitForSoundAndEnd PokecenterHealEffect_WaitForSoundAndEnd
}; };
void (*const sHallOfFameRecordEffectFuncs[])(struct Task *) = static void (*const sHallOfFameRecordEffectFuncs[])(struct Task *) =
{ {
HallOfFameRecordEffect_Init, HallOfFameRecordEffect_Init,
HallOfFameRecordEffect_WaitForBallPlacement, HallOfFameRecordEffect_WaitForBallPlacement,
@@ -572,7 +572,7 @@ void (*const sHallOfFameRecordEffectFuncs[])(struct Task *) =
HallOfFameRecordEffect_WaitForSoundAndEnd HallOfFameRecordEffect_WaitForSoundAndEnd
}; };
void (*const sPokeballGlowEffectFuncs[])(struct Sprite *) = static void (*const sPokeballGlowEffectFuncs[])(struct Sprite *) =
{ {
PokeballGlowEffect_PlaceBalls, PokeballGlowEffect_PlaceBalls,
PokeballGlowEffect_TryPlaySe, PokeballGlowEffect_TryPlaySe,
@@ -598,7 +598,7 @@ static const u8 sPokeballGlowReds[] = {16, 12, 8, 0};
static const u8 sPokeballGlowGreens[] = {16, 12, 8, 0}; static const u8 sPokeballGlowGreens[] = {16, 12, 8, 0};
static const u8 sPokeballGlowBlues[] = { 0, 0, 0, 0}; static const u8 sPokeballGlowBlues[] = { 0, 0, 0, 0};
bool8 (*const sFallWarpFieldEffectFuncs[])(struct Task *) = static bool8 (*const sFallWarpFieldEffectFuncs[])(struct Task *) =
{ {
FallWarpEffect_Init, FallWarpEffect_Init,
FallWarpEffect_WaitWeather, FallWarpEffect_WaitWeather,
@@ -609,7 +609,7 @@ bool8 (*const sFallWarpFieldEffectFuncs[])(struct Task *) =
FallWarpEffect_End, FallWarpEffect_End,
}; };
bool8 (*const sEscalatorWarpOutFieldEffectFuncs[])(struct Task *) = static bool8 (*const sEscalatorWarpOutFieldEffectFuncs[])(struct Task *) =
{ {
EscalatorWarpOut_Init, EscalatorWarpOut_Init,
EscalatorWarpOut_WaitForPlayer, EscalatorWarpOut_WaitForPlayer,
@@ -619,7 +619,7 @@ bool8 (*const sEscalatorWarpOutFieldEffectFuncs[])(struct Task *) =
EscalatorWarpOut_Down_End, EscalatorWarpOut_Down_End,
}; };
bool8 (*const sEscalatorWarpInFieldEffectFuncs[])(struct Task *) = static bool8 (*const sEscalatorWarpInFieldEffectFuncs[])(struct Task *) =
{ {
EscalatorWarpIn_Init, EscalatorWarpIn_Init,
EscalatorWarpIn_Down_Init, EscalatorWarpIn_Down_Init,
@@ -630,7 +630,7 @@ bool8 (*const sEscalatorWarpInFieldEffectFuncs[])(struct Task *) =
EscalatorWarpIn_End, EscalatorWarpIn_End,
}; };
bool8 (*const sWaterfallFieldEffectFuncs[])(struct Task *, struct ObjectEvent *) = static bool8 (*const sWaterfallFieldEffectFuncs[])(struct Task *, struct ObjectEvent *) =
{ {
WaterfallFieldEffect_Init, WaterfallFieldEffect_Init,
WaterfallFieldEffect_ShowMon, WaterfallFieldEffect_ShowMon,
@@ -639,14 +639,14 @@ bool8 (*const sWaterfallFieldEffectFuncs[])(struct Task *, struct ObjectEvent *)
WaterfallFieldEffect_ContinueRideOrEnd, WaterfallFieldEffect_ContinueRideOrEnd,
}; };
bool8 (*const sDiveFieldEffectFuncs[])(struct Task *) = static bool8 (*const sDiveFieldEffectFuncs[])(struct Task *) =
{ {
DiveFieldEffect_Init, DiveFieldEffect_Init,
DiveFieldEffect_ShowMon, DiveFieldEffect_ShowMon,
DiveFieldEffect_TryWarp, DiveFieldEffect_TryWarp,
}; };
bool8 (*const sLavaridgeGymB1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = static bool8 (*const sLavaridgeGymB1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) =
{ {
LavaridgeGymB1FWarpEffect_Init, LavaridgeGymB1FWarpEffect_Init,
LavaridgeGymB1FWarpEffect_CameraShake, LavaridgeGymB1FWarpEffect_CameraShake,
@@ -656,7 +656,7 @@ bool8 (*const sLavaridgeGymB1FWarpEffectFuncs[])(struct Task *, struct ObjectEve
LavaridgeGymB1FWarpEffect_Warp, LavaridgeGymB1FWarpEffect_Warp,
}; };
bool8 (*const sLavaridgeGymB1FWarpExitEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = static bool8 (*const sLavaridgeGymB1FWarpExitEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) =
{ {
LavaridgeGymB1FWarpExitEffect_Init, LavaridgeGymB1FWarpExitEffect_Init,
LavaridgeGymB1FWarpExitEffect_StartPopOut, LavaridgeGymB1FWarpExitEffect_StartPopOut,
@@ -664,7 +664,7 @@ bool8 (*const sLavaridgeGymB1FWarpExitEffectFuncs[])(struct Task *, struct Objec
LavaridgeGymB1FWarpExitEffect_End, LavaridgeGymB1FWarpExitEffect_End,
}; };
bool8 (*const sLavaridgeGym1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = static bool8 (*const sLavaridgeGym1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) =
{ {
LavaridgeGym1FWarpEffect_Init, LavaridgeGym1FWarpEffect_Init,
LavaridgeGym1FWarpEffect_AshPuff, LavaridgeGym1FWarpEffect_AshPuff,
@@ -673,7 +673,7 @@ bool8 (*const sLavaridgeGym1FWarpEffectFuncs[])(struct Task *, struct ObjectEven
LavaridgeGym1FWarpEffect_Warp, LavaridgeGym1FWarpEffect_Warp,
}; };
void (*const sEscapeRopeWarpOutEffectFuncs[])(struct Task *) = static void (*const sEscapeRopeWarpOutEffectFuncs[])(struct Task *) =
{ {
EscapeRopeWarpOutEffect_Init, EscapeRopeWarpOutEffect_Init,
EscapeRopeWarpOutEffect_Spin, EscapeRopeWarpOutEffect_Spin,
@@ -2277,7 +2277,7 @@ static void EscapeRopeWarpOutEffect_Spin(struct Task *task)
} }
} }
void (*const sEscapeRopeWarpInEffectFuncs[])(struct Task *) = { static void (*const sEscapeRopeWarpInEffectFuncs[])(struct Task *) = {
EscapeRopeWarpInEffect_Init, EscapeRopeWarpInEffect_Init,
EscapeRopeWarpInEffect_Spin EscapeRopeWarpInEffect_Spin
}; };
@@ -2448,7 +2448,7 @@ static void FieldCallback_TeleportWarpIn(void)
CreateTask(Task_TeleportWarpIn, 0); CreateTask(Task_TeleportWarpIn, 0);
} }
void (*const sTeleportWarpInFieldEffectFuncs[])(struct Task *) = { static void (*const sTeleportWarpInFieldEffectFuncs[])(struct Task *) = {
TeleportWarpInFieldEffect_Init, TeleportWarpInFieldEffect_Init,
TeleportWarpInFieldEffect_SpinEnter, TeleportWarpInFieldEffect_SpinEnter,
TeleportWarpInFieldEffect_SpinGround TeleportWarpInFieldEffect_SpinGround
@@ -2582,7 +2582,7 @@ bool8 FldEff_FieldMoveShowMonInit(void)
return FALSE; return FALSE;
} }
void (*const sFieldMoveShowMonOutdoorsEffectFuncs[])(struct Task *) = { static void (*const sFieldMoveShowMonOutdoorsEffectFuncs[])(struct Task *) = {
FieldMoveShowMonOutdoorsEffect_Init, FieldMoveShowMonOutdoorsEffect_Init,
FieldMoveShowMonOutdoorsEffect_LoadGfx, FieldMoveShowMonOutdoorsEffect_LoadGfx,
FieldMoveShowMonOutdoorsEffect_CreateBanner, FieldMoveShowMonOutdoorsEffect_CreateBanner,
@@ -2750,7 +2750,7 @@ static void LoadFieldMoveOutdoorStreaksTilemap(u16 offs)
#define tBgOffset data[4] #define tBgOffset data[4]
#define tMonSpriteId data[15] #define tMonSpriteId data[15]
void (*const sFieldMoveShowMonIndoorsEffectFuncs[])(struct Task *) = { static void (*const sFieldMoveShowMonIndoorsEffectFuncs[])(struct Task *) = {
FieldMoveShowMonIndoorsEffect_Init, FieldMoveShowMonIndoorsEffect_Init,
FieldMoveShowMonIndoorsEffect_LoadGfx, FieldMoveShowMonIndoorsEffect_LoadGfx,
FieldMoveShowMonIndoorsEffect_SlideBannerOn, FieldMoveShowMonIndoorsEffect_SlideBannerOn,
@@ -2978,7 +2978,7 @@ u8 FldEff_UseSurf(void)
return FALSE; return FALSE;
} }
void (*const sSurfFieldEffectFuncs[])(struct Task *) = { static void (*const sSurfFieldEffectFuncs[])(struct Task *) = {
SurfFieldEffect_Init, SurfFieldEffect_Init,
SurfFieldEffect_FieldMovePose, SurfFieldEffect_FieldMovePose,
SurfFieldEffect_ShowMon, SurfFieldEffect_ShowMon,
@@ -3154,7 +3154,7 @@ u8 FldEff_UseFly(void)
return 0; return 0;
} }
void (*const sFlyOutFieldEffectFuncs[])(struct Task *) = { static void (*const sFlyOutFieldEffectFuncs[])(struct Task *) = {
FlyOutFieldEffect_FieldMovePose, FlyOutFieldEffect_FieldMovePose,
FlyOutFieldEffect_ShowMon, FlyOutFieldEffect_ShowMon,
FlyOutFieldEffect_BirdLeaveBall, FlyOutFieldEffect_BirdLeaveBall,
@@ -3444,7 +3444,7 @@ u8 FldEff_FlyIn(void)
return 0; return 0;
} }
void (*const sFlyInFieldEffectFuncs[])(struct Task *) = { static void (*const sFlyInFieldEffectFuncs[])(struct Task *) = {
FlyInFieldEffect_BirdSwoopDown, FlyInFieldEffect_BirdSwoopDown,
FlyInFieldEffect_FlyInWithBird, FlyInFieldEffect_FlyInWithBird,
FlyInFieldEffect_JumpOffBird, FlyInFieldEffect_JumpOffBird,
@@ -3675,7 +3675,7 @@ static void StartEndingDeoxysRockCameraShake(u8 taskId)
#undef tEndDelay #undef tEndDelay
#undef tEnding #undef tEnding
void (*const sDestroyDeoxysRockEffectFuncs[])(s16*, u8) = { static void (*const sDestroyDeoxysRockEffectFuncs[])(s16*, u8) = {
DestroyDeoxysRockEffect_CameraShake, DestroyDeoxysRockEffect_CameraShake,
DestroyDeoxysRockEffect_RockFragments, DestroyDeoxysRockEffect_RockFragments,
DestroyDeoxysRockEffect_WaitAndEnd, DestroyDeoxysRockEffect_WaitAndEnd,
+1 -1
View File
@@ -33,7 +33,7 @@ static void Task_DrawFieldMessage(u8 taskId)
task->tState++; task->tState++;
break; break;
case 1: case 1:
DrawDialogueFrame(0, 1); DrawDialogueFrame(0, TRUE);
task->tState++; task->tState++;
break; break;
case 2: case 2:
+1 -4
View File
@@ -192,10 +192,7 @@ static void FieldUpdateRegionMap(void)
{ {
FreeRegionMapIconResources(); FreeRegionMapIconResources();
SetMainCallback2(sFieldRegionMapHandler->callback); SetMainCallback2(sFieldRegionMapHandler->callback);
if (sFieldRegionMapHandler != NULL) TRY_FREE_AND_SET_NULL(sFieldRegionMapHandler);
{
FREE_AND_SET_NULL(sFieldRegionMapHandler);
}
FreeAllWindowBuffers(); FreeAllWindowBuffers();
} }
break; break;
+1 -1
View File
@@ -53,7 +53,7 @@ static void Task_EnableScriptAfterMusicFade(u8 taskId);
static const u16 sFlashLevelToRadius[] = { 200, 72, 64, 56, 48, 40, 32, 24, 0 }; static const u16 sFlashLevelToRadius[] = { 200, 72, 64, 56, 48, 40, 32, 24, 0 };
const s32 gMaxFlashLevel = ARRAY_COUNT(sFlashLevelToRadius) - 1; const s32 gMaxFlashLevel = ARRAY_COUNT(sFlashLevelToRadius) - 1;
const struct ScanlineEffectParams sFlashEffectParams = static const struct ScanlineEffectParams sFlashEffectParams =
{ {
&REG_WIN0H, &REG_WIN0H,
((DMA_ENABLE | DMA_START_HBLANK | DMA_REPEAT | DMA_DEST_RELOAD) << 16) | 1, ((DMA_ENABLE | DMA_START_HBLANK | DMA_REPEAT | DMA_DEST_RELOAD) << 16) | 1,
+1 -1
View File
@@ -170,7 +170,7 @@ static void Task_Truck3(u8 taskId)
{ {
cameraXpan = sTruckCamera_HorizontalTable[tMoveStep]; cameraXpan = sTruckCamera_HorizontalTable[tMoveStep];
cameraYpan = 0; cameraYpan = 0;
SetCameraPanning(cameraXpan, 0); SetCameraPanning(cameraXpan, cameraYpan);
SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX1_X_OFFSET - cameraXpan, BOX1_Y_OFFSET + cameraYpan); SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX1_X_OFFSET - cameraXpan, BOX1_Y_OFFSET + cameraYpan);
SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX2_X_OFFSET - cameraXpan, BOX2_Y_OFFSET + cameraYpan); SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX2_X_OFFSET - cameraXpan, BOX2_Y_OFFSET + cameraYpan);
SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX3_X_OFFSET - cameraXpan, BOX3_Y_OFFSET + cameraYpan); SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX3_X_OFFSET - cameraXpan, BOX3_Y_OFFSET + cameraYpan);
+1 -1
View File
@@ -72,7 +72,7 @@ static const u8 *sPaletteGammaTypes;
// The drought weather effect uses a precalculated color lookup table. Presumably this // The drought weather effect uses a precalculated color lookup table. Presumably this
// is because the underlying color shift calculation is slow. // is because the underlying color shift calculation is slow.
const u16 sDroughtWeatherColors[][0x1000] = { static const u16 sDroughtWeatherColors[][0x1000] = {
INCBIN_U16("graphics/weather/drought/colors_0.bin"), INCBIN_U16("graphics/weather/drought/colors_0.bin"),
INCBIN_U16("graphics/weather/drought/colors_1.bin"), INCBIN_U16("graphics/weather/drought/colors_1.bin"),
INCBIN_U16("graphics/weather/drought/colors_2.bin"), INCBIN_U16("graphics/weather/drought/colors_2.bin"),
+15 -15
View File
@@ -14,8 +14,8 @@
#include "trig.h" #include "trig.h"
#include "gpu_regs.h" #include "gpu_regs.h"
EWRAM_DATA static u8 gCurrentAbnormalWeather = 0; EWRAM_DATA static u8 sCurrentAbnormalWeather = 0;
EWRAM_DATA static u16 gUnusedWeatherRelated = 0; EWRAM_DATA static u16 sUnusedWeatherRelated = 0;
const u16 gCloudsWeatherPalette[] = INCBIN_U16("graphics/weather/cloud.gbapal"); const u16 gCloudsWeatherPalette[] = INCBIN_U16("graphics/weather/cloud.gbapal");
const u16 gSandstormWeatherPalette[] = INCBIN_U16("graphics/weather/sandstorm.gbapal"); const u16 gSandstormWeatherPalette[] = INCBIN_U16("graphics/weather/sandstorm.gbapal");
@@ -1813,7 +1813,7 @@ static void UpdateFogDiagonalMovement(void)
gWeatherPtr->fogDPosY = gSpriteCoordOffsetY + gWeatherPtr->fogDYOffset; gWeatherPtr->fogDPosY = gSpriteCoordOffsetY + gWeatherPtr->fogDYOffset;
} }
static const struct SpriteSheet gFogDiagonalSpriteSheet = static const struct SpriteSheet sFogDiagonalSpriteSheet =
{ {
.data = gWeatherFogDiagonalTiles, .data = gWeatherFogDiagonalTiles,
.size = sizeof(gWeatherFogDiagonalTiles), .size = sizeof(gWeatherFogDiagonalTiles),
@@ -1868,7 +1868,7 @@ static void CreateFogDiagonalSprites(void)
if (!gWeatherPtr->fogDSpritesCreated) if (!gWeatherPtr->fogDSpritesCreated)
{ {
fogDiagonalSpriteSheet = gFogDiagonalSpriteSheet; fogDiagonalSpriteSheet = sFogDiagonalSpriteSheet;
LoadSpriteSheet(&fogDiagonalSpriteSheet); LoadSpriteSheet(&fogDiagonalSpriteSheet);
for (i = 0; i < NUM_FOG_DIAGONAL_SPRITES; i++) for (i = 0; i < NUM_FOG_DIAGONAL_SPRITES; i++)
{ {
@@ -2427,8 +2427,8 @@ static void UpdateBubbleSprite(struct Sprite *sprite)
// Unused function. // Unused function.
static void UnusedSetCurrentAbnormalWeather(u32 weather, u32 unknown) static void UnusedSetCurrentAbnormalWeather(u32 weather, u32 unknown)
{ {
gCurrentAbnormalWeather = weather; sCurrentAbnormalWeather = weather;
gUnusedWeatherRelated = unknown; sUnusedWeatherRelated = unknown;
} }
#define tState data[0] #define tState data[0]
@@ -2446,7 +2446,7 @@ static void Task_DoAbnormalWeather(u8 taskId)
if (tDelay-- <= 0) if (tDelay-- <= 0)
{ {
SetNextWeather(tWeatherA); SetNextWeather(tWeatherA);
gCurrentAbnormalWeather = tWeatherA; sCurrentAbnormalWeather = tWeatherA;
tDelay = 600; tDelay = 600;
tState++; tState++;
} }
@@ -2455,7 +2455,7 @@ static void Task_DoAbnormalWeather(u8 taskId)
if (tDelay-- <= 0) if (tDelay-- <= 0)
{ {
SetNextWeather(tWeatherB); SetNextWeather(tWeatherB);
gCurrentAbnormalWeather = tWeatherB; sCurrentAbnormalWeather = tWeatherB;
tDelay = 600; tDelay = 600;
tState = 0; tState = 0;
} }
@@ -2469,13 +2469,13 @@ static void CreateAbnormalWeatherTask(void)
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
tDelay = 600; tDelay = 600;
if (gCurrentAbnormalWeather == WEATHER_DOWNPOUR) if (sCurrentAbnormalWeather == WEATHER_DOWNPOUR)
{ {
// Currently Downpour, next will be Drought // Currently Downpour, next will be Drought
tWeatherA = WEATHER_DROUGHT; tWeatherA = WEATHER_DROUGHT;
tWeatherB = WEATHER_DOWNPOUR; tWeatherB = WEATHER_DOWNPOUR;
} }
else if (gCurrentAbnormalWeather == WEATHER_DROUGHT) else if (sCurrentAbnormalWeather == WEATHER_DROUGHT)
{ {
// Currently Drought, next will be Downpour // Currently Drought, next will be Downpour
tWeatherA = WEATHER_DOWNPOUR; tWeatherA = WEATHER_DOWNPOUR;
@@ -2484,7 +2484,7 @@ static void CreateAbnormalWeatherTask(void)
else else
{ {
// Default to starting with Downpour // Default to starting with Downpour
gCurrentAbnormalWeather = WEATHER_DOWNPOUR; sCurrentAbnormalWeather = WEATHER_DOWNPOUR;
tWeatherA = WEATHER_DROUGHT; tWeatherA = WEATHER_DROUGHT;
tWeatherB = WEATHER_DOWNPOUR; tWeatherB = WEATHER_DOWNPOUR;
} }
@@ -2537,13 +2537,13 @@ void DoCurrentWeather(void)
{ {
if (!FuncIsActiveTask(Task_DoAbnormalWeather)) if (!FuncIsActiveTask(Task_DoAbnormalWeather))
CreateAbnormalWeatherTask(); CreateAbnormalWeatherTask();
weather = gCurrentAbnormalWeather; weather = sCurrentAbnormalWeather;
} }
else else
{ {
if (FuncIsActiveTask(Task_DoAbnormalWeather)) if (FuncIsActiveTask(Task_DoAbnormalWeather))
DestroyTask(FindTaskIdByFunc(Task_DoAbnormalWeather)); DestroyTask(FindTaskIdByFunc(Task_DoAbnormalWeather));
gCurrentAbnormalWeather = WEATHER_DOWNPOUR; sCurrentAbnormalWeather = WEATHER_DOWNPOUR;
} }
SetNextWeather(weather); SetNextWeather(weather);
} }
@@ -2556,13 +2556,13 @@ void ResumePausedWeather(void)
{ {
if (!FuncIsActiveTask(Task_DoAbnormalWeather)) if (!FuncIsActiveTask(Task_DoAbnormalWeather))
CreateAbnormalWeatherTask(); CreateAbnormalWeatherTask();
weather = gCurrentAbnormalWeather; weather = sCurrentAbnormalWeather;
} }
else else
{ {
if (FuncIsActiveTask(Task_DoAbnormalWeather)) if (FuncIsActiveTask(Task_DoAbnormalWeather))
DestroyTask(FindTaskIdByFunc(Task_DoAbnormalWeather)); DestroyTask(FindTaskIdByFunc(Task_DoAbnormalWeather));
gCurrentAbnormalWeather = WEATHER_DOWNPOUR; sCurrentAbnormalWeather = WEATHER_DOWNPOUR;
} }
SetCurrentAndNextWeather(weather); SetCurrentAndNextWeather(weather);
} }
+21 -21
View File
@@ -25,10 +25,10 @@ struct ConnectionFlags
u8 east:1; u8 east:1;
}; };
EWRAM_DATA static u16 gBackupMapData[MAX_MAP_DATA_SIZE] = {0}; EWRAM_DATA static u16 sBackupMapData[MAX_MAP_DATA_SIZE] = {0};
EWRAM_DATA struct MapHeader gMapHeader = {0}; EWRAM_DATA struct MapHeader gMapHeader = {0};
EWRAM_DATA struct Camera gCamera = {0}; EWRAM_DATA struct Camera gCamera = {0};
EWRAM_DATA static struct ConnectionFlags gMapConnectionFlags = {0}; EWRAM_DATA static struct ConnectionFlags sMapConnectionFlags = {0};
EWRAM_DATA static u32 sFiller = 0; // without this, the next file won't align properly EWRAM_DATA static u32 sFiller = 0; // without this, the next file won't align properly
struct BackupMapLayout gBackupMapLayout; struct BackupMapLayout gBackupMapLayout;
@@ -87,14 +87,14 @@ void InitMapFromSavedGame(void)
void InitBattlePyramidMap(bool8 setPlayerPosition) void InitBattlePyramidMap(bool8 setPlayerPosition)
{ {
CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData)); CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData));
GenerateBattlePyramidFloorLayout(gBackupMapData, setPlayerPosition); GenerateBattlePyramidFloorLayout(sBackupMapData, setPlayerPosition);
} }
void InitTrainerHillMap(void) void InitTrainerHillMap(void)
{ {
CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData)); CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData));
GenerateTrainerHillFloorLayout(gBackupMapData); GenerateTrainerHillFloorLayout(sBackupMapData);
} }
static void InitMapLayoutData(struct MapHeader *mapHeader) static void InitMapLayoutData(struct MapHeader *mapHeader)
@@ -103,8 +103,8 @@ static void InitMapLayoutData(struct MapHeader *mapHeader)
int width; int width;
int height; int height;
mapLayout = mapHeader->mapLayout; mapLayout = mapHeader->mapLayout;
CpuFastFill16(MAPGRID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData)); CpuFastFill16(MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData));
gBackupMapLayout.map = gBackupMapData; gBackupMapLayout.map = sBackupMapData;
width = mapLayout->width + MAP_OFFSET_W; width = mapLayout->width + MAP_OFFSET_W;
gBackupMapLayout.width = width; gBackupMapLayout.width = width;
height = mapLayout->height + MAP_OFFSET_H; height = mapLayout->height + MAP_OFFSET_H;
@@ -140,7 +140,7 @@ static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader)
{ {
count = mapHeader->connections->count; count = mapHeader->connections->count;
connection = mapHeader->connections->connections; connection = mapHeader->connections->connections;
gMapConnectionFlags = sDummyConnectionFlags; sMapConnectionFlags = sDummyConnectionFlags;
for (i = 0; i < count; i++, connection++) for (i = 0; i < count; i++, connection++)
{ {
struct MapHeader const *cMap = GetMapHeaderFromConnection(connection); struct MapHeader const *cMap = GetMapHeaderFromConnection(connection);
@@ -149,19 +149,19 @@ static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader)
{ {
case CONNECTION_SOUTH: case CONNECTION_SOUTH:
FillSouthConnection(mapHeader, cMap, offset); FillSouthConnection(mapHeader, cMap, offset);
gMapConnectionFlags.south = TRUE; sMapConnectionFlags.south = TRUE;
break; break;
case CONNECTION_NORTH: case CONNECTION_NORTH:
FillNorthConnection(mapHeader, cMap, offset); FillNorthConnection(mapHeader, cMap, offset);
gMapConnectionFlags.north = TRUE; sMapConnectionFlags.north = TRUE;
break; break;
case CONNECTION_WEST: case CONNECTION_WEST:
FillWestConnection(mapHeader, cMap, offset); FillWestConnection(mapHeader, cMap, offset);
gMapConnectionFlags.west = TRUE; sMapConnectionFlags.west = TRUE;
break; break;
case CONNECTION_EAST: case CONNECTION_EAST:
FillEastConnection(mapHeader, cMap, offset); FillEastConnection(mapHeader, cMap, offset);
gMapConnectionFlags.east = TRUE; sMapConnectionFlags.east = TRUE;
break; break;
} }
} }
@@ -436,7 +436,7 @@ void SaveMapView(void)
for (i = y; i < y + MAP_OFFSET_H; i++) for (i = y; i < y + MAP_OFFSET_H; i++)
{ {
for (j = x; j < x + MAP_OFFSET_W; j++) for (j = x; j < x + MAP_OFFSET_W; j++)
*mapView++ = gBackupMapData[width * i + j]; *mapView++ = sBackupMapData[width * i + j];
} }
} }
@@ -491,8 +491,8 @@ static void LoadSavedMapView(void)
for (j = x; j < x + MAP_OFFSET_W; j++) for (j = x; j < x + MAP_OFFSET_W; j++)
{ {
if (!SkipCopyingMetatileFromSavedMap(&gBackupMapData[j + width * i], width, yMode)) if (!SkipCopyingMetatileFromSavedMap(&sBackupMapData[j + width * i], width, yMode))
gBackupMapData[j + width * i] = *mapView; sBackupMapData[j + width * i] = *mapView;
mapView++; mapView++;
} }
} }
@@ -554,7 +554,7 @@ static void MoveMapViewToBackup(u8 direction)
desti = width * (y + y0); desti = width * (y + y0);
srci = (y + r8) * MAP_OFFSET_W + r9; srci = (y + r8) * MAP_OFFSET_W + r9;
src = &mapView[srci + i]; src = &mapView[srci + i];
dest = &gBackupMapData[x0 + desti + j]; dest = &sBackupMapData[x0 + desti + j];
*dest = *src; *dest = *src;
i++; i++;
j++; j++;
@@ -570,28 +570,28 @@ int GetMapBorderIdAt(int x, int y)
if (x >= (gBackupMapLayout.width - (MAP_OFFSET + 1))) if (x >= (gBackupMapLayout.width - (MAP_OFFSET + 1)))
{ {
if (!gMapConnectionFlags.east) if (!sMapConnectionFlags.east)
return CONNECTION_INVALID; return CONNECTION_INVALID;
return CONNECTION_EAST; return CONNECTION_EAST;
} }
else if (x < MAP_OFFSET) else if (x < MAP_OFFSET)
{ {
if (!gMapConnectionFlags.west) if (!sMapConnectionFlags.west)
return CONNECTION_INVALID; return CONNECTION_INVALID;
return CONNECTION_WEST; return CONNECTION_WEST;
} }
else if (y >= (gBackupMapLayout.height - MAP_OFFSET)) else if (y >= (gBackupMapLayout.height - MAP_OFFSET))
{ {
if (!gMapConnectionFlags.south) if (!sMapConnectionFlags.south)
return CONNECTION_INVALID; return CONNECTION_INVALID;
return CONNECTION_SOUTH; return CONNECTION_SOUTH;
} }
else if (y < MAP_OFFSET) else if (y < MAP_OFFSET)
{ {
if (!gMapConnectionFlags.north) if (!sMapConnectionFlags.north)
return CONNECTION_INVALID; return CONNECTION_INVALID;
return CONNECTION_NORTH; return CONNECTION_NORTH;
+11 -15
View File
@@ -52,6 +52,8 @@ struct HallofFameTeam
struct HallofFameMon mon[PARTY_SIZE]; struct HallofFameMon mon[PARTY_SIZE];
}; };
STATIC_ASSERT(sizeof(struct HallofFameTeam) * HALL_OF_FAME_MAX_TEAMS <= SECTOR_DATA_SIZE * NUM_HOF_SECTORS, HallOfFameFreeSpace);
struct HofGfx struct HofGfx
{ {
u16 state; u16 state;
@@ -512,7 +514,7 @@ static void Task_Hof_InitTeamSaveData(u8 taskId)
} }
*lastSavedTeam = *sHofMonPtr; *lastSavedTeam = *sHofMonPtr;
DrawDialogueFrame(0, 0); DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized2(0, FONT_NORMAL, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3); AddTextPrinterParameterized2(0, FONT_NORMAL, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3);
CopyWindowToVram(0, COPYWIN_FULL); CopyWindowToVram(0, COPYWIN_FULL);
gTasks[taskId].func = Task_Hof_TrySaveData; gTasks[taskId].func = Task_Hof_TrySaveData;
@@ -527,10 +529,8 @@ static void Task_Hof_TrySaveData(u8 taskId)
UnsetBgTilemapBuffer(3); UnsetBgTilemapBuffer(3);
FreeAllWindowBuffers(); FreeAllWindowBuffers();
if (sHofGfxPtr != NULL) TRY_FREE_AND_SET_NULL(sHofGfxPtr);
FREE_AND_SET_NULL(sHofGfxPtr); TRY_FREE_AND_SET_NULL(sHofMonPtr);
if (sHofMonPtr != NULL)
FREE_AND_SET_NULL(sHofMonPtr);
DestroyTask(taskId); DestroyTask(taskId);
} }
@@ -722,7 +722,7 @@ static void Task_Hof_WaitAndPrintPlayerInfo(u8 taskId)
{ {
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20);
HallOfFame_PrintPlayerInfo(1, 2); HallOfFame_PrintPlayerInfo(1, 2);
DrawDialogueFrame(0, 0); DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized2(0, FONT_NORMAL, gText_LeagueChamp, 0, NULL, 2, 1, 3); AddTextPrinterParameterized2(0, FONT_NORMAL, gText_LeagueChamp, 0, NULL, 2, 1, 3);
CopyWindowToVram(0, COPYWIN_FULL); CopyWindowToVram(0, COPYWIN_FULL);
gTasks[taskId].func = Task_Hof_ExitOnKeyPressed; gTasks[taskId].func = Task_Hof_ExitOnKeyPressed;
@@ -771,10 +771,8 @@ static void Task_Hof_HandleExit(u8 taskId)
ResetBgsAndClearDma3BusyFlags(0); ResetBgsAndClearDma3BusyFlags(0);
DestroyTask(taskId); DestroyTask(taskId);
if (sHofGfxPtr != NULL) TRY_FREE_AND_SET_NULL(sHofGfxPtr);
FREE_AND_SET_NULL(sHofGfxPtr); TRY_FREE_AND_SET_NULL(sHofMonPtr);
if (sHofMonPtr != NULL)
FREE_AND_SET_NULL(sHofMonPtr);
StartCredits(); StartCredits();
} }
@@ -1079,10 +1077,8 @@ static void Task_HofPC_HandleExit(u8 taskId)
ResetBgsAndClearDma3BusyFlags(0); ResetBgsAndClearDma3BusyFlags(0);
DestroyTask(taskId); DestroyTask(taskId);
if (sHofGfxPtr != NULL) TRY_FREE_AND_SET_NULL(sHofGfxPtr);
FREE_AND_SET_NULL(sHofGfxPtr); TRY_FREE_AND_SET_NULL(sHofMonPtr);
if (sHofMonPtr != NULL)
FREE_AND_SET_NULL(sHofMonPtr);
ReturnFromHallOfFamePC(); ReturnFromHallOfFamePC();
} }
@@ -1091,7 +1087,7 @@ static void Task_HofPC_HandleExit(u8 taskId)
static void Task_HofPC_PrintDataIsCorrupted(u8 taskId) static void Task_HofPC_PrintDataIsCorrupted(u8 taskId)
{ {
HofPCTopBar_Print(gText_AButtonExit, 8, TRUE); HofPCTopBar_Print(gText_AButtonExit, 8, TRUE);
DrawDialogueFrame(0, 0); DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized2(0, FONT_NORMAL, gText_HOFCorrupted, 0, NULL, 2, 1, 3); AddTextPrinterParameterized2(0, FONT_NORMAL, gText_HOFCorrupted, 0, NULL, 2, 1, 3);
CopyWindowToVram(0, COPYWIN_FULL); CopyWindowToVram(0, COPYWIN_FULL);
gTasks[taskId].func = Task_HofPC_ExitOnButtonPress; gTasks[taskId].func = Task_HofPC_ExitOnButtonPress;
+2 -2
View File
@@ -1848,7 +1848,7 @@ static void Task_Scene3_StartGroudon(u8 taskId)
{ {
gTasks[taskId].tState = 0; gTasks[taskId].tState = 0;
gTasks[taskId].func = Task_Scene3_Groudon; gTasks[taskId].func = Task_Scene3_Groudon;
ScanlineEffect_InitWave(0, 160, 4, 4, 1, SCANLINE_EFFECT_REG_BG1HOFS, 0); ScanlineEffect_InitWave(0, 160, 4, 4, 1, SCANLINE_EFFECT_REG_BG1HOFS, FALSE);
} }
#define tScreenX data[1] #define tScreenX data[1]
@@ -2058,7 +2058,7 @@ static void Task_Scene3_LoadKyogre(u8 taskId)
gTasks[taskId].tDelay = 16; gTasks[taskId].tDelay = 16;
gTasks[taskId].tZoom = 256; gTasks[taskId].tZoom = 256;
PanFadeAndZoomScreen(gTasks[taskId].tScreenX, gTasks[taskId].tScreenY, gTasks[taskId].tZoom, 0); PanFadeAndZoomScreen(gTasks[taskId].tScreenX, gTasks[taskId].tScreenY, gTasks[taskId].tZoom, 0);
ScanlineEffect_InitWave(0, 0xA0, 4, 4, 1, SCANLINE_EFFECT_REG_BG1VOFS, 0); ScanlineEffect_InitWave(0, 0xA0, 4, 4, 1, SCANLINE_EFFECT_REG_BG1VOFS, FALSE);
} }
static void Task_Scene3_Kyogre(u8 taskId) static void Task_Scene3_Kyogre(u8 taskId)
+1 -1
View File
@@ -1344,7 +1344,7 @@ static void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, bool16 skipEraseLis
DrawPocketIndicatorSquare(newPocket, TRUE); DrawPocketIndicatorSquare(newPocket, TRUE);
FillBgTilemapBufferRect_Palette0(2, 11, 14, 2, 15, 16); FillBgTilemapBufferRect_Palette0(2, 11, 14, 2, 15, 16);
ScheduleBgCopyTilemapToVram(2); ScheduleBgCopyTilemapToVram(2);
SetBagVisualPocketId(newPocket, 1); SetBagVisualPocketId(newPocket, TRUE);
RemoveBagSprite(ITEMMENUSPRITE_BALL); RemoveBagSprite(ITEMMENUSPRITE_BALL);
AddSwitchPocketRotatingBallSprite(deltaBagPocketId); AddSwitchPocketRotatingBallSprite(deltaBagPocketId);
SetTaskFuncWithFollowupFunc(taskId, Task_SwitchBagPocket, gTasks[taskId].func); SetTaskFuncWithFollowupFunc(taskId, Task_SwitchBagPocket, gTasks[taskId].func);
+8 -8
View File
@@ -35,8 +35,8 @@ static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite);
// static const rom data // static const rom data
static const u16 sRotatingBall_Pal[] = INCBIN_U16("graphics/bag/rotating_ball.gbapal"); static const u16 sRotatingBall_Pal[] = INCBIN_U16("graphics/bag/rotating_ball.gbapal");
static const u8 sRotatingBall_Gfx[] = INCBIN_U8("graphics/bag/rotating_ball.4bpp"); static const u8 sRotatingBall_Gfx[] = INCBIN_U8("graphics/bag/rotating_ball.4bpp");
static const u8 gCherryUnused[] = INCBIN_U8("graphics/unused/cherry.4bpp"); static const u8 sCherryUnused[] = INCBIN_U8("graphics/unused/cherry.4bpp");
static const u16 gCherryUnused_Pal[] = INCBIN_U16("graphics/unused/cherry.gbapal"); static const u16 sCherryUnused_Pal[] = INCBIN_U16("graphics/unused/cherry.gbapal");
static const struct OamData sBagOamData = static const struct OamData sBagOamData =
{ {
@@ -269,7 +269,7 @@ static const struct SpriteFrameImage sBerryPicSpriteImageTable[] =
{&gDecompressionBuffer[0], 0x800}, {&gDecompressionBuffer[0], 0x800},
}; };
static const struct SpriteTemplate gBerryPicSpriteTemplate = static const struct SpriteTemplate sBerryPicSpriteTemplate =
{ {
.tileTag = TAG_NONE, .tileTag = TAG_NONE,
.paletteTag = TAG_BERRY_PIC_PAL, .paletteTag = TAG_BERRY_PIC_PAL,
@@ -308,7 +308,7 @@ static const union AffineAnimCmd *const sBerryPicRotatingAnimCmds[] =
sSpriteAffineAnim_BerryPicRotation2 sSpriteAffineAnim_BerryPicRotation2
}; };
static const struct SpriteTemplate gBerryPicRotatingSpriteTemplate = static const struct SpriteTemplate sBerryPicRotatingSpriteTemplate =
{ {
.tileTag = TAG_NONE, .tileTag = TAG_NONE,
.paletteTag = TAG_BERRY_PIC_PAL, .paletteTag = TAG_BERRY_PIC_PAL,
@@ -404,7 +404,7 @@ static const union AnimCmd *const sBerryCheckCircleSpriteAnimTable[] =
sSpriteAnim_BerryCheckCircle sSpriteAnim_BerryCheckCircle
}; };
static const struct SpriteTemplate gBerryCheckCircleSpriteTemplate = static const struct SpriteTemplate sBerryCheckCircleSpriteTemplate =
{ {
.tileTag = TAG_BERRY_CHECK_CIRCLE_GFX, .tileTag = TAG_BERRY_CHECK_CIRCLE_GFX,
.paletteTag = TAG_BERRY_CHECK_CIRCLE_GFX, .paletteTag = TAG_BERRY_CHECK_CIRCLE_GFX,
@@ -609,7 +609,7 @@ static void LoadBerryGfx(u8 berryId)
u8 CreateBerryTagSprite(u8 id, s16 x, s16 y) u8 CreateBerryTagSprite(u8 id, s16 x, s16 y)
{ {
LoadBerryGfx(id); LoadBerryGfx(id);
return CreateSprite(&gBerryPicSpriteTemplate, x, y, 0); return CreateSprite(&sBerryPicSpriteTemplate, x, y, 0);
} }
void FreeBerryTagSpritePalette(void) void FreeBerryTagSpritePalette(void)
@@ -624,7 +624,7 @@ u8 CreateSpinningBerrySprite(u8 berryId, u8 x, u8 y, bool8 startAffine)
FreeSpritePaletteByTag(TAG_BERRY_PIC_PAL); FreeSpritePaletteByTag(TAG_BERRY_PIC_PAL);
LoadBerryGfx(berryId); LoadBerryGfx(berryId);
spriteId = CreateSprite(&gBerryPicRotatingSpriteTemplate, x, y, 0); spriteId = CreateSprite(&sBerryPicRotatingSpriteTemplate, x, y, 0);
if (startAffine == TRUE) if (startAffine == TRUE)
StartSpriteAffineAnim(&gSprites[spriteId], 1); StartSpriteAffineAnim(&gSprites[spriteId], 1);
@@ -633,5 +633,5 @@ u8 CreateSpinningBerrySprite(u8 berryId, u8 x, u8 y, bool8 startAffine)
u8 CreateBerryFlavorCircleSprite(s16 x) u8 CreateBerryFlavorCircleSprite(s16 x)
{ {
return CreateSprite(&gBerryCheckCircleSpriteTemplate, x, 116, 0); return CreateSprite(&sBerryCheckCircleSpriteTemplate, x, 116, 0);
} }
+8 -8
View File
@@ -336,7 +336,7 @@ static const struct Landmark *const Landmarks_MtChimney_2[] =
NULL, NULL,
}; };
static const struct LandmarkList gLandmarkLists[] = static const struct LandmarkList sLandmarkLists[] =
{ {
{MAPSEC_ROUTE_103, 2, Landmarks_Route103_2}, {MAPSEC_ROUTE_103, 2, Landmarks_Route103_2},
{MAPSEC_ROUTE_104, 0, Landmarks_Route104_0}, {MAPSEC_ROUTE_104, 0, Landmarks_Route104_0},
@@ -420,21 +420,21 @@ static const struct Landmark *const *GetLandmarks(u8 mapSection, u8 id)
{ {
u16 i = 0; u16 i = 0;
for (; gLandmarkLists[i].mapSection != MAPSEC_NONE; i++) for (; sLandmarkLists[i].mapSection != MAPSEC_NONE; i++)
{ {
if (gLandmarkLists[i].mapSection > mapSection) if (sLandmarkLists[i].mapSection > mapSection)
return NULL; return NULL;
if (gLandmarkLists[i].mapSection == mapSection) if (sLandmarkLists[i].mapSection == mapSection)
break; break;
} }
if (gLandmarkLists[i].mapSection == MAPSEC_NONE) if (sLandmarkLists[i].mapSection == MAPSEC_NONE)
return NULL; return NULL;
for (; gLandmarkLists[i].mapSection == mapSection; i++) for (; sLandmarkLists[i].mapSection == mapSection; i++)
{ {
if (gLandmarkLists[i].id == id) if (sLandmarkLists[i].id == id)
return gLandmarkLists[i].landmarks; return sLandmarkLists[i].landmarks;
} }
return NULL; return NULL;
+4 -4
View File
@@ -680,7 +680,7 @@ SoundMainRAM_Unk2:
ldr r1, [r4, o_SoundChannel_wav] ldr r1, [r4, o_SoundChannel_wav]
add r2, r2, r1 add r2, r2, r1
add r2, r2, 0x10 add r2, r2, 0x10
ldr r5, =gDecodingBuffer ldr r5, =sDecodingBuffer
ldr r6, =gDeltaEncodingTable ldr r6, =gDeltaEncodingTable
mov r7, 0x40 mov r7, 0x40
ldrb lr, [r2], 1 ldrb lr, [r2], 1
@@ -701,7 +701,7 @@ _081DD57C:
subs r7, r7, 2 subs r7, r7, 2
bgt _081DD568 bgt _081DD568
_081DD594: _081DD594:
ldr r5, =gDecodingBuffer ldr r5, =sDecodingBuffer
and r0, r3, 0x3F and r0, r3, 0x3F
ldrsb r1, [r5, r0] ldrsb r1, [r5, r0]
pop {r0,r2,r5-r7,pc} pop {r0,r2,r5-r7,pc}
@@ -1911,6 +1911,6 @@ _081DDD90:
.align 2, 0 @ Don't pad with nop. .align 2, 0 @ Don't pad with nop.
.bss .bss
gDecodingBuffer: @ Used as a buffer for audio decoded from compressed DPCM sDecodingBuffer: @ Used as a buffer for audio decoded from compressed DPCM
.space 0x40 .space 0x40
.size gDecodingBuffer, .-gDecodingBuffer .size sDecodingBuffer, .-sDecodingBuffer
+3 -3
View File
@@ -69,7 +69,7 @@ u8 gLinkVSyncDisabled;
u32 IntrMain_Buffer[0x200]; u32 IntrMain_Buffer[0x200];
s8 gPcmDmaCounter; s8 gPcmDmaCounter;
static EWRAM_DATA u16 gTrainerId = 0; static EWRAM_DATA u16 sTrainerId = 0;
//EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL; //EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL;
@@ -201,12 +201,12 @@ void SeedRngAndSetTrainerId(void)
u16 val = REG_TM1CNT_L; u16 val = REG_TM1CNT_L;
SeedRng(val); SeedRng(val);
REG_TM1CNT_H = 0; REG_TM1CNT_H = 0;
gTrainerId = val; sTrainerId = val;
} }
u16 GetGeneratedTrainerIdLower(void) u16 GetGeneratedTrainerIdLower(void)
{ {
return gTrainerId; return sTrainerId;
} }
void EnableVCountIntrAtLine150(void) void EnableVCountIntrAtLine150(void)
+8 -8
View File
@@ -371,7 +371,7 @@ static const struct WindowTemplate sWindowTemplates_MainMenu[] =
DUMMY_WIN_TEMPLATE DUMMY_WIN_TEMPLATE
}; };
static const struct WindowTemplate gNewGameBirchSpeechTextWindows[] = static const struct WindowTemplate sNewGameBirchSpeechTextWindows[] =
{ {
{ {
.bg = 0, .bg = 0,
@@ -457,7 +457,7 @@ static const struct MenuAction sMenuActions_Gender[] = {
{gText_BirchGirl, NULL} {gText_BirchGirl, NULL}
}; };
static const u8 *const gMalePresetNames[] = { static const u8 *const sMalePresetNames[] = {
gText_DefaultNameStu, gText_DefaultNameStu,
gText_DefaultNameMilton, gText_DefaultNameMilton,
gText_DefaultNameTom, gText_DefaultNameTom,
@@ -480,7 +480,7 @@ static const u8 *const gMalePresetNames[] = {
gText_DefaultNameQuincy gText_DefaultNameQuincy
}; };
static const u8 *const gFemalePresetNames[] = { static const u8 *const sFemalePresetNames[] = {
gText_DefaultNameKimmy, gText_DefaultNameKimmy,
gText_DefaultNameTiara, gText_DefaultNameTiara,
gText_DefaultNameBella, gText_DefaultNameBella,
@@ -1325,7 +1325,7 @@ static void Task_NewGameBirchSpeech_WaitForSpriteFadeInWelcome(u8 taskId)
} }
else else
{ {
InitWindows(gNewGameBirchSpeechTextWindows); InitWindows(sNewGameBirchSpeechTextWindows);
LoadMainMenuWindowFrameTiles(0, 0xF3); LoadMainMenuWindowFrameTiles(0, 0xF3);
LoadMessageBoxGfx(0, 0xFC, 0xF0); LoadMessageBoxGfx(0, 0xFC, 0xF0);
NewGameBirchSpeech_ShowDialogueWindow(0, 1); NewGameBirchSpeech_ShowDialogueWindow(0, 1);
@@ -1851,7 +1851,7 @@ static void CB2_NewGameBirchSpeech_ReturnFromNamingScreen(void)
REG_IME = savedIme; REG_IME = savedIme;
SetVBlankCallback(VBlankCB_MainMenu); SetVBlankCallback(VBlankCB_MainMenu);
SetMainCallback2(CB2_MainMenu); SetMainCallback2(CB2_MainMenu);
InitWindows(gNewGameBirchSpeechTextWindows); InitWindows(sNewGameBirchSpeechTextWindows);
LoadMainMenuWindowFrameTiles(0, 0xF3); LoadMainMenuWindowFrameTiles(0, 0xF3);
LoadMessageBoxGfx(0, 0xFC, 0xF0); LoadMessageBoxGfx(0, 0xFC, 0xF0);
PutWindowTilemap(0); PutWindowTilemap(0);
@@ -2087,7 +2087,7 @@ static void NewGameBirchSpeech_StartFadePlatformOut(u8 taskId, u8 delay)
static void NewGameBirchSpeech_ShowGenderMenu(void) static void NewGameBirchSpeech_ShowGenderMenu(void)
{ {
DrawMainMenuWindowBorder(&gNewGameBirchSpeechTextWindows[1], 0xF3); DrawMainMenuWindowBorder(&sNewGameBirchSpeechTextWindows[1], 0xF3);
FillWindowPixelBuffer(1, PIXEL_FILL(1)); FillWindowPixelBuffer(1, PIXEL_FILL(1));
PrintMenuTable(1, ARRAY_COUNT(sMenuActions_Gender), sMenuActions_Gender); PrintMenuTable(1, ARRAY_COUNT(sMenuActions_Gender), sMenuActions_Gender);
InitMenuInUpperLeftCornerNormal(1, ARRAY_COUNT(sMenuActions_Gender), 0); InitMenuInUpperLeftCornerNormal(1, ARRAY_COUNT(sMenuActions_Gender), 0);
@@ -2106,9 +2106,9 @@ static void NewGameBirchSpeech_SetDefaultPlayerName(u8 nameId)
u8 i; u8 i;
if (gSaveBlock2Ptr->playerGender == MALE) if (gSaveBlock2Ptr->playerGender == MALE)
name = gMalePresetNames[nameId]; name = sMalePresetNames[nameId];
else else
name = gFemalePresetNames[nameId]; name = sFemalePresetNames[nameId];
for (i = 0; i < PLAYER_NAME_LENGTH; i++) for (i = 0; i < PLAYER_NAME_LENGTH; i++)
gSaveBlock2Ptr->playerName[i] = name[i]; gSaveBlock2Ptr->playerName[i] = name[i];
gSaveBlock2Ptr->playerName[PLAYER_NAME_LENGTH] = EOS; gSaveBlock2Ptr->playerName[PLAYER_NAME_LENGTH] = EOS;
+19 -19
View File
@@ -176,25 +176,25 @@ static const u8 sRegionMapSectionId_To_PopUpThemeIdMapping[] =
[MAPSEC_TRAINER_HILL - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_MARBLE [MAPSEC_TRAINER_HILL - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_MARBLE
}; };
static const u8 gText_PyramidFloor1[] = _("PYRAMID FLOOR 1"); static const u8 sText_PyramidFloor1[] = _("PYRAMID FLOOR 1");
static const u8 gText_PyramidFloor2[] = _("PYRAMID FLOOR 2"); static const u8 sText_PyramidFloor2[] = _("PYRAMID FLOOR 2");
static const u8 gText_PyramidFloor3[] = _("PYRAMID FLOOR 3"); static const u8 sText_PyramidFloor3[] = _("PYRAMID FLOOR 3");
static const u8 gText_PyramidFloor4[] = _("PYRAMID FLOOR 4"); static const u8 sText_PyramidFloor4[] = _("PYRAMID FLOOR 4");
static const u8 gText_PyramidFloor5[] = _("PYRAMID FLOOR 5"); static const u8 sText_PyramidFloor5[] = _("PYRAMID FLOOR 5");
static const u8 gText_PyramidFloor6[] = _("PYRAMID FLOOR 6"); static const u8 sText_PyramidFloor6[] = _("PYRAMID FLOOR 6");
static const u8 gText_PyramidFloor7[] = _("PYRAMID FLOOR 7"); static const u8 sText_PyramidFloor7[] = _("PYRAMID FLOOR 7");
static const u8 gText_Pyramid[] = _("PYRAMID"); static const u8 sText_Pyramid[] = _("PYRAMID");
static const u8 * const gBattlePyramid_MapHeaderStrings[] = static const u8 * const sBattlePyramid_MapHeaderStrings[] =
{ {
gText_PyramidFloor1, sText_PyramidFloor1,
gText_PyramidFloor2, sText_PyramidFloor2,
gText_PyramidFloor3, sText_PyramidFloor3,
gText_PyramidFloor4, sText_PyramidFloor4,
gText_PyramidFloor5, sText_PyramidFloor5,
gText_PyramidFloor6, sText_PyramidFloor6,
gText_PyramidFloor7, sText_PyramidFloor7,
gText_Pyramid, sText_Pyramid,
}; };
// Unused // Unused
@@ -309,12 +309,12 @@ static void ShowMapNamePopUpWindow(void)
if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP) if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP)
{ {
withoutPrefixPtr = &(mapDisplayHeader[3]); withoutPrefixPtr = &(mapDisplayHeader[3]);
mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[7]; mapDisplayHeaderSource = sBattlePyramid_MapHeaderStrings[7];
} }
else else
{ {
withoutPrefixPtr = &(mapDisplayHeader[3]); withoutPrefixPtr = &(mapDisplayHeader[3]);
mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[gSaveBlock2Ptr->frontier.curChallengeBattleNum]; mapDisplayHeaderSource = sBattlePyramid_MapHeaderStrings[gSaveBlock2Ptr->frontier.curChallengeBattleNum];
} }
StringCopy(withoutPrefixPtr, mapDisplayHeaderSource); StringCopy(withoutPrefixPtr, mapDisplayHeaderSource);
} }
+1 -1
View File
@@ -445,7 +445,7 @@ static void DisableTextPrinters(struct TextPrinterTemplate * printer, u16 render
static void DrawSongTextWindow(const u8 * str) static void DrawSongTextWindow(const u8 * str)
{ {
DrawDialogueFrame(0, 0); DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized(0, FONT_NORMAL, str, 0, 1, 1, DisableTextPrinters); AddTextPrinterParameterized(0, FONT_NORMAL, str, 0, 1, 1, DisableTextPrinters);
gDisableTextPrinters = TRUE; gDisableTextPrinters = TRUE;
CopyWindowToVram(0, COPYWIN_FULL); CopyWindowToVram(0, COPYWIN_FULL);

Some files were not shown because too many files have changed in this diff Show More