Merge pull request #321 from PikalaxALT/modern_gcc

Get pokefirered_modern to build
This commit is contained in:
PikalaxALT
2020-04-12 10:12:37 -04:00
committed by GitHub
130 changed files with 2465 additions and 1926 deletions
+4
View File
@@ -38,5 +38,9 @@ matrix:
- make -j2 compare_leafgreen
- make -j2 compare_firered_rev1
- make -j2 compare_leafgreen_rev1
- make -j2 modern
- make -j2 leafgreen_modern
- make -j2 firered_rev1_modern
- make -j2 leafgreen_rev1_modern
after_success:
- .travis/calcrom/webhook.sh pokefirered
+80 -14
View File
@@ -1,12 +1,56 @@
include $(DEVKITARM)/base_tools
TOOLCHAIN := $(DEVKITARM)
COMPARE ?= 0
CPP := $(CC) -E
LD := $(DEVKITARM)/bin/arm-none-eabi-ld
ifeq ($(CC),)
HOSTCC := gcc
else
HOSTCC := $(CC)
endif
ifeq ($(CXX),)
HOSTCXX := g++
else
HOSTCXX := $(CXX)
endif
ifneq (,$(wildcard $(TOOLCHAIN)/base_tools))
include $(TOOLCHAIN)/base_tools
else
export PATH := $(TOOLCHAIN)/bin:$(PATH)
PREFIX := arm-none-eabi-
OBJCOPY := $(PREFIX)objcopy
export CC := $(PREFIX)gcc
export AS := $(PREFIX)as
endif
export CPP := $(PREFIX)cpp
export LD := $(PREFIX)ld
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
include config.mk
GCC_VER = $(shell $(CC) -dumpversion)
ifeq ($(MODERN),0)
CC1 := tools/agbcc/bin/agbcc
override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm
LIBPATH := -L ../../tools/agbcc/lib
else
CC1 := $(shell $(CC) --print-prog-name=cc1) -quiet
override CFLAGS += -mthumb -mthumb-interwork -O2 -mtune=arm7tdmi -march=armv4t -mabi=apcs-gnu -fno-toplevel-reorder -fno-aggressive-loop-optimizations -Wno-pointer-to-int-cast
#LIBPATH := -L $(TOOLCHAIN)/lib/gcc/arm-none-eabi/$(GCC_VER)/thumb -L $(TOOLCHAIN)/arm-none-eabi/lib/thumb
LIBPATH := -L ../../tools/agbcc/lib
endif
CPPFLAGS := -iquote include -D$(GAME_VERSION) -DREVISION=$(GAME_REVISION) -D$(GAME_LANGUAGE) -DMODERN=$(MODERN)
ifeq ($(MODERN),0)
CPPFLAGS += -I tools/agbcc -I tools/agbcc/include -nostdinc -undef
endif
SHELL := /bin/bash -o pipefail
ROM := poke$(BUILD_NAME).gba
@@ -28,16 +72,14 @@ DATA_ASM_BUILDDIR = $(OBJ_DIR)/$(DATA_ASM_SUBDIR)
SONG_BUILDDIR = $(OBJ_DIR)/$(SONG_SUBDIR)
MID_BUILDDIR = $(OBJ_DIR)/$(MID_SUBDIR)
ASFLAGS := -mcpu=arm7tdmi --defsym $(GAME_VERSION)=1 --defsym REVISION=$(GAME_REVISION) --defsym $(GAME_LANGUAGE)=1
CC1 := tools/agbcc/bin/agbcc
override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm
CPPFLAGS := -I tools/agbcc -I tools/agbcc/include -iquote include -nostdinc -undef -D$(GAME_VERSION) -DREVISION=$(GAME_REVISION) -D$(GAME_LANGUAGE)
ASFLAGS := -mcpu=arm7tdmi --defsym $(GAME_VERSION)=1 --defsym REVISION=$(GAME_REVISION) --defsym $(GAME_LANGUAGE)=1 --defsym MODERN=$(MODERN)
LDFLAGS = -Map ../../$(MAP)
LIB := -L ../../tools/agbcc/lib -lgcc -lc
LIB := $(LIBPATH) -lgcc -lc
#ifneq ($(MODERN),0)
#LIB += -lsysbase
#endif
SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c
GFX := tools/gbagfx/gbagfx
@@ -96,7 +138,7 @@ TOOLS = $(foreach tool,$(TOOLBASE),tools/$(tool)/$(tool)$(EXE))
ALL_BUILDS := firered firered_rev1 leafgreen leafgreen_rev1
.PHONY: all rom tools clean-tools mostlyclean clean compare tidy berry_fix $(TOOLDIRS) $(ALL_BUILDS) $(ALL_BUILDS:%=compare_%)
.PHONY: all rom tools clean-tools mostlyclean clean compare tidy berry_fix $(TOOLDIRS) $(ALL_BUILDS) $(ALL_BUILDS:%=compare_%) $(ALL_BUILDS:%=%_modern) modern
MAKEFLAGS += --no-print-directory
@@ -162,6 +204,7 @@ sound/%.bin: sound/%.aif ; $(AIF) $< $@
sound/songs/%.s: sound/songs/%.mid
cd $(@D) && ../../$(MID) $(<F)
ifeq ($(MODERN),0)
$(C_BUILDDIR)/agb_flash.o: CFLAGS := -O -mthumb-interwork
$(C_BUILDDIR)/agb_flash_1m.o: CFLAGS := -O -mthumb-interwork
$(C_BUILDDIR)/agb_flash_mx.o: CFLAGS := -O -mthumb-interwork
@@ -176,6 +219,14 @@ $(C_BUILDDIR)/flying.o: CFLAGS += -ffreestanding
$(C_BUILDDIR)/librfu_intr.o: CC1 := tools/agbcc/bin/agbcc_arm
$(C_BUILDDIR)/librfu_intr.o: CFLAGS := -O2 -mthumb-interwork -quiet
else
$(C_BUILDDIR)/berry_crush_2.o: CFLAGS += -Wno-address-of-packed-member
$(C_BUILDDIR)/berry_crush_3.o: CFLAGS += -Wno-address-of-packed-member
$(C_BUILDDIR)/braille_text.o: CFLAGS += -Wno-address-of-packed-member
$(C_BUILDDIR)/text.o: CFLAGS += -Wno-address-of-packed-member
$(C_BUILDDIR)/battle_tower.o: CFLAGS += -Wno-div-by-zero
$(C_BUILDDIR)/librfu_intr.o: override CFLAGS += -marm -mthumb-interwork -O2 -mtune=arm7tdmi -march=armv4t -mabi=apcs-gnu -fno-toplevel-reorder -fno-aggressive-loop-optimizations -Wno-pointer-to-int-cast
endif
ifeq ($(NODEP),1)
$(C_BUILDDIR)/%.o: c_dep :=
@@ -224,11 +275,19 @@ $(OBJ_DIR)/sym_common.ld: sym_common.txt $(C_OBJS) $(wildcard common_syms/*.txt)
$(OBJ_DIR)/sym_ewram.ld: sym_ewram.txt
$(RAMSCRGEN) ewram_data $< ENGLISH > $@
$(OBJ_DIR)/ld_script.ld: ld_script.txt $(OBJ_DIR)/sym_bss.ld $(OBJ_DIR)/sym_common.ld $(OBJ_DIR)/sym_ewram.ld
ifeq ($(MODERN),0)
LD_SCRIPT := ld_script.txt
LD_SCRIPT_DEPS := $(OBJ_DIR)/sym_bss.ld $(OBJ_DIR)/sym_common.ld $(OBJ_DIR)/sym_ewram.ld
else
LD_SCRIPT := ld_script_modern.txt
LD_SCRIPT_DEPS :=
endif
$(OBJ_DIR)/ld_script.ld: $(LD_SCRIPT) $(LD_SCRIPT_DEPS)
cd $(OBJ_DIR) && sed -f ../../ld_script.sed ../../$< | sed "s#tools/#../../tools/#g" > ld_script.ld
$(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS)
cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(LIB)
cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(OBJS_REL) $(LIB)
$(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(GAME_REVISION) --silent
$(ROM): $(ELF)
@@ -244,3 +303,10 @@ compare_firered: ; @$(MAKE) GAME_VERSION=FIRERED COMPARE=1
compare_firered_rev1: ; @$(MAKE) GAME_VERSION=FIRERED GAME_REVISION=1 COMPARE=1
compare_leafgreen: ; @$(MAKE) GAME_VERSION=LEAFGREEN COMPARE=1
compare_leafgreen_rev1: ; @$(MAKE) GAME_VERSION=LEAFGREEN GAME_REVISION=1 COMPARE=1
firered_modern: ; @$(MAKE) GAME_VERSION=FIRERED MODERN=1
firered_rev1_modern: ; @$(MAKE) GAME_VERSION=FIRERED GAME_REVISION=1 MODERN=1
leafgreen_modern: ; @$(MAKE) GAME_VERSION=LEAFGREEN MODERN=1
leafgreen_rev1_modern: ; @$(MAKE) GAME_VERSION=LEAFGREEN GAME_REVISION=1 MODERN=1
modern: ; @$(MAKE) MODERN=1
+1
View File
@@ -1909,6 +1909,7 @@ _081DDD90:
.align 2, 0 @ Don't pad with nop.
.bss
.align 3
gUnknown_030007B8:
.space 0x40
.size gUnknown_030007B8, .-gUnknown_030007B8
+1
View File
@@ -14,6 +14,7 @@
@ To make adding these improvements easier they are commented and tagged with "Improvement in Emerald"
@ Emerald also adds a few entirely new AI commands (mostly to expand Double Battle AI), which are not included
.align 2
gBattleAI_ScriptsTable:: @ 81D9BF4
.4byte AI_CheckBadMove
.4byte AI_CheckViability
+1
View File
@@ -44,6 +44,7 @@ gMovesWithQuietBGM:: @ 81C68EC
.2byte MOVE_GRASS_WHISTLE
.2byte 0xFFFF
.align 2
gBattleAnims_Moves::
.4byte Move_NONE
.4byte Move_POUND
+1
View File
@@ -1,6 +1,7 @@
#ifndef GUARD_BATTLE_H
#define GUARD_BATTLE_H
#include <limits.h>
#include "global.h"
#include "constants/battle.h"
#include "battle_util.h"
+3 -3
View File
@@ -67,11 +67,11 @@ const struct Berry * GetBerryInfo(u8 berryIdx);
extern const struct Berry gBerries[];
struct UnkStruct_0858AB24 {
struct BerryCrushStats {
u8 unk0;
u16 unk1;
u16 powder;
};
extern const struct UnkStruct_0858AB24 gUnknown_83DFC9C[];
extern const struct BerryCrushStats gBerryCrushStats[];
#endif // GUARD_BERRY_H
+102 -74
View File
@@ -1,9 +1,49 @@
#ifndef GUARD_BERRY_CRUSH_H
#define GUARD_BERRY_CRUSH_H
enum {
BCTEXT_AREYOUREADY,
BCTEXT_WAITFOROTHERS,
BCTEXT_GAINEDPOWDER,
BCTEXT_RECORDINGRESULTS,
BCTEXT_ASKPLAYAGAIN,
BCTEXT_CANCEL_NOBERRIES,
BCTEXT_CANCEL_DROPPEDOUT,
BCTEXT_TIMEUP,
BCTEXT_COMMSTANDBY,
};
enum {
BCCMD_BeginNormalPaletteFade = 1,
BCCMD_WaitPaletteFade,
BCCMD_PrintMessage,
BCCMD_InitGfx,
BCCMD_TeardownGfx,
BCCMD_SignalReadyToBegin,
BCCMD_AskPickBerry,
BCCMD_GoToBerryPouch,
BCCMD_WaitForOthersToPickBerries,
BCCMD_DropBerriesIntoCrusher,
BCCMD_DropLid,
BCCMD_Countdown,
BCCMD_PlayGame_Master,
BCCMD_PlayGame_Slave,
BCCMD_FinishGame,
BCCMD_HandleTimeUp,
BCCMD_TabulateResults,
BCCMD_ShowResults,
BCCMD_SaveTheGame,
BCCMD_AskPlayAgain,
BCCMD_CommunicatePlayAgainResponses,
BCCMD_FadeOutToPlayAgain,
BCCMD_PlayAgainFailureMessage,
BCCMD_GracefulExit,
BCCMD_Quit,
};
struct BerryCrushGame_Player
{
u16 unk0;
u16 berryId;
u16 unk2;
union
{
@@ -13,40 +53,26 @@ struct BerryCrushGame_Player
u8 unk14[12];
};
struct __attribute__((packed, aligned(2))) BerryCrushGame_4E
{
u16 unk0;
u16 filler2;
u8 unk4_0:1;
u8 unk4_1:1;
s8 unk5;
u16 unk6;
u16 unk8;
u16 unkA;
u16 unkC;
};
struct __attribute__((packed)) BerryCrushGame_40
{
u8 unk0[2];
u16 unk2[6];
struct BerryCrushGame_4E unkE;
};
struct BerryCrushGame_5C
{
u16 unk00;
u8 unk02_0:1;
u8 unk02_1:1;
u8 unk02_2:1;
u8 pushedAButton:1;
u8 unk02_3:5;
u8 unk03;
s8 unk03;
u16 unk04;
u16 unk06;
u16 unk08;
u16 unk0A;
};
struct __attribute__((packed, aligned(2))) BerryCrushGame_4E
{
u16 unk0;
struct BerryCrushGame_5C data;
};
union BerryCrushGame_68
{
struct BerryCrushGame_68_x
@@ -58,7 +84,9 @@ union BerryCrushGame_68
s16 unk06;
u16 unk08;
u16 unk0A;
u16 unk0C[2][5];
// 0: Number of A presses
// 1: Neatness
u16 stats[2][5];
u8 filler20[16];
} unk00;
u8 unk30[12];
@@ -68,12 +96,12 @@ union BerryCrushGame_68
struct BerryCrushGame_68_y
{
u8 filler00[28];
struct BerryCrushGame_Player unk1C[5];
struct BerryCrushGame_Player players[5];
u8 fillerBC[20];
} as_five_players;
};
struct BerryCrushGame_138_C
struct BerryCrushPlayerSeatCoords
{
u8 unk0;
u8 unk1;
@@ -86,19 +114,19 @@ struct BerryCrushGame_138_C
struct BerryCrushGame_138
{
u8 unk0;
u8 animBerryIdx;
u8 unk1;
u8 unk2;
u8 unk3;
s16 unk4;
s16 unk6;
s16 unk8;
const struct BerryCrushGame_138_C *unkC[5];
struct Sprite *unk20;
struct Sprite *unk24[5];
struct Sprite *unk38[5];
struct Sprite *unk4C[11];
struct Sprite *unk78[2];
s16 minutes;
s16 secondsInt;
s16 secondsFrac;
const struct BerryCrushPlayerSeatCoords * seatCoords[5];
struct Sprite *coreSprite;
struct Sprite *impactSprites[5];
struct Sprite *berrySprites[5];
struct Sprite *sparkleSprites[11];
struct Sprite *timerSprites[2];
u8 unk80;
u8 filler81;
u8 unk82;
@@ -107,23 +135,23 @@ struct BerryCrushGame_138
struct BerryCrushGame
{
MainCallback unk0;
u32 (*unk4)(struct BerryCrushGame *, u8 *);
u8 unk8;
u8 unk9;
u8 unkA;
u8 unkB;
u8 unkC;
MainCallback savedCallback;
u32 (*cmdCallback)(struct BerryCrushGame *, u8 *);
u8 localId;
u8 playerCount;
u8 taskId;
u8 textSpeed;
u8 cmdState;
u8 unkD;
u8 unkE;
u8 unkF;
u8 nextCmd;
u8 afterPalFadeCmd;
u16 unk10;
u16 unk12;
u16 gameState;
u16 unk14;
u16 unk16;
u16 pressingSpeed;
s16 unk18;
s16 unk1A;
int unk1C;
int powder;
s32 unk20;
u8 unk24;
u8 unk25_0:1;
@@ -133,52 +161,52 @@ struct BerryCrushGame
u8 unk25_4:1;
u8 unk25_5:3;
u16 unk26;
u16 unk28;
s16 unk2A;
s16 unk2C;
u16 timer;
s16 depth;
s16 vibration;
s16 unk2E;
s16 unk30;
s16 unk32;
s16 unk34;
u8 unk36[0xA];
struct BerryCrushGame_40 unk40;
struct BerryCrushGame_5C unk5C;
u8 commandParams[10];
u16 sendCmd[7];
u16 recvCmd[7];
struct BerryCrushGame_5C localState;
union BerryCrushGame_68 unk68;
struct BerryCrushGame_138 unk138;
u8 unk1C0[0x1000];
struct BerryCrushGame_138 spritesManager;
u8 bg1Buffer[0x1000];
u8 unk11C0[0x1000];
u8 unk21C0[0x1000];
u8 unk31C0[0x1000];
u8 bg2Buffer[0x1000];
u8 bg3Buffer[0x1000];
};
#define PLAYER_UNK14(game, i) \
#define BERRYCRUSH_PLAYER_NAME(game, i) \
((u8 *)(game) \
+ offsetof(struct BerryCrushGame, unk68) \
+ offsetof(struct BerryCrushGame_68_x, unk30) \
+ sizeof(struct BerryCrushGame_Player) * (i))
struct BerryCrushGame *sub_814B6F0(void);
struct BerryCrushGame *GetBerryCrushGame(void);
void StartBerryCrush(MainCallback callback);
u32 sub_814B6FC(MainCallback callback);
void sub_814B8F0(void);
void sub_814B914(void);
void sub_814B924(void);
void sub_814B930(void);
void sub_814BABC(struct BerryCrushGame *arg0);
void sub_814BB4C(u16, u8, u8 *);
void sub_814D564(u8 *, u32, s32, u32, u32, u32, u32);
u32 ExitBerryCrushWithCallback(MainCallback callback);
void CB2_BerryCrush_GoToBerryPouch(void);
void BerryCrush_SetVBlankCallback(void);
void BerryCrush_UnsetVBlankCallback(void);
void BerryCrush_UpdateSav2Records(void);
void BerryCrush_RunOrScheduleCommand(u16 command, u8 runMode, u8 *params);
void BerryCrush_SetPaletteFadeParams(u8 *params, bool8 communicateAfter, u32 selectedPals, s8 delay, u8 startY, u8 targetY, u16 palette);
int sub_814D9CC(struct BerryCrushGame *arg0);
int sub_814D5C8(void);
int sub_814D888(void);
void sub_814DA24(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1);
void sub_814DC24(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1);
int BerryCrush_InitBgs(void);
int BerryCrush_TeardownBgs(void);
void BerryCrush_CreateBerrySprites(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1);
void BerryCrushFreeBerrySpriteGfx(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1);
void sub_814DC5C(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1);
bool32 sub_814DE50(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1);
bool32 sub_814E644(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1);
void sub_814E80C(struct BerryCrushGame *arg0);
void sub_814DA04(struct BerryCrushGame *arg0);
void sub_814EB04(struct BerryCrushGame_138 *arg0);
void sub_814DB84(struct Sprite * sprite);
void BerryCrush_HideTimerSprites(struct BerryCrushGame_138 *arg0);
void SpriteCB_DropBerryIntoCrusher(struct Sprite * sprite);
void ShowBerryCrushRankings(void);
#endif //GUARD_BERRY_CRUSH_H
+1 -1
View File
@@ -34,7 +34,7 @@ enum
BG_ATTR_MOSAIC = 5,
BG_ATTR_WRAPAROUND = 6,
BG_ATTR_PRIORITY = 7,
BG_ATTR_TEXTORAFFINEMODE = 8,
BG_ATTR_MAPSIZE = 8,
BG_ATTR_BGTYPE = 9,
BG_ATTR_BASETILE = 10
};
+9 -3
View File
@@ -18,14 +18,14 @@
#define GAME_VERSION VERSION_FIRE_RED
#else // Default version seems to be LeafGreen
#define GAME_VERSION VERSION_LEAF_GREEN
#endif
#endif // GAME_VERSION
// rev1 renamed the source folder for reasons
#if REVISION == 0
#define CODE_ROOT "C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/"
#else
#define CODE_ROOT "C:/WORK/POKeFRLG/Src/pm_lgfr_ose/source/"
#endif
#endif // REVISION
#define ABSPATH(x) (CODE_ROOT x)
@@ -33,6 +33,12 @@
#define UNITS_IMPERIAL
#else
#define UNITS_METRIC
#endif
#endif // ENGLISH
// Crashes may occur due to section reordering in the modern build,
// so we force BUGFIX here.
#if MODERN
#define BUGFIX
#endif // MODERN
#endif // GUARD_CONFIG_H
+25 -1
View File
@@ -6,6 +6,14 @@
// Maximum amount of data we will transfer in one operation
#define MAX_DMA_BLOCK_SIZE 0x1000
#define DMA_REQUEST_COPY32 1
#define DMA_REQUEST_FILL32 2
#define DMA_REQUEST_COPY16 3
#define DMA_REQUEST_FILL16 4
#define DMA3_16BIT 0
#define DMA3_32BIT 1
#define Dma3CopyLarge_(src, dest, size, bit) \
{ \
const void *_src = src; \
@@ -48,10 +56,26 @@
#define Dma3FillLarge16_(value, dest, size) Dma3FillLarge_(value, dest, size, 16)
#define Dma3FillLarge32_(value, dest, size) Dma3FillLarge_(value, dest, size, 32)
// Cancel pending DMA3 requests
void ClearDma3Requests(void);
// Handle pending DMA3 requests
void ProcessDma3Requests(void);
// Copy size bytes from src to dest.
// mode takes a DMA3_*BIT macro
// Returns the request index
s16 RequestDma3Copy(const void *src, void *dest, u16 size, u8 mode);
// Fill size bytes at dest with value.
// mode takes a DMA3_*BIT macro
// Returns the request index
s16 RequestDma3Fill(s32 value, void *dest, u16 size, u8 mode);
s16 CheckForSpaceForDma3Request(s16 index);
// index is the return value from RequestDma3*
// if index = -1, will check if any request is pending
// otherwise, checks if the specified request is pending
// Returns -1 if pending, 0 otherwise
s16 WaitDma3Request(s16 index);
#endif // GUARD_DMA3_H
+1 -1
View File
@@ -13,7 +13,7 @@ enum HiddenItemAttr
u8 GetLeadMonIndex(void);
s32 CountDigits(s32 number);
void TV_PrintIntToStringVar(u8, int);
void TV_PrintIntToStringVar(u8 varidx, s32 number);
u16 GetStarterSpecies(void);
void StopPokemonLeagueLightingEffectTask(void);
void nullsub_60(void);
+3 -3
View File
@@ -14,11 +14,11 @@
extern struct BackupMapLayout VMap;
extern const struct MapLayout Route1_Layout;
u32 MapGridGetMetatileIdAt(int, int);
u32 MapGridGetMetatileIdAt(s32, s32);
u32 MapGridGetMetatileBehaviorAt(s16, s16);
u8 MapGridGetMetatileLayerTypeAt(s16 x, s16 y);
void MapGridSetMetatileIdAt(int, int, u16);
void MapGridSetMetatileEntryAt(int, int, u16);
void MapGridSetMetatileIdAt(s32, s32, u16);
void MapGridSetMetatileEntryAt(s32, s32, u16);
u8 MapGridGetZCoordAt(s32 x, s32 y);
void GetCameraCoords(u16*, u16*);
bool8 MapGridIsImpassableAt(s32, s32);
+6
View File
@@ -14,6 +14,12 @@
#define EWRAM_DATA __attribute__((section("ewram_data")))
#endif
#if MODERN
#define NOINLINE __attribute__((noinline))
#else
#define NOINLINE
#endif
#define ALIGNED(n) __attribute__((aligned(n)))
#define SOUND_INFO_PTR (*(struct SoundInfo **)0x3007FF0)
+5
View File
@@ -35,6 +35,10 @@ void AGBAssert(const char *pFile, int nLine, const char *pExpression, int nStopP
// for matching purposes
#if MODERN
#define AGB_ASSERT_EX(exp, file, line) AGB_ASSERT(exp)
#define AGB_WARNING_EX(exp, file, line) AGB_WARNING(exp)
#else
#ifdef NDEBUG
#define AGB_ASSERT_EX(exp, file, line)
#else
@@ -46,5 +50,6 @@ void AGBAssert(const char *pFile, int nLine, const char *pExpression, int nStopP
#else
#define AGB_WARNING_EX(exp, file, line) (exp) ? ((void*)0) : AGBAssert(file, line, #exp, 0);
#endif
#endif
#endif // GUARD_GBA_ISAGBPRINT_H
+4
View File
@@ -50,6 +50,10 @@
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) >= (b) ? (a) : (b))
#if MODERN
#define abs(x) (((x) < 0) ? -(x) : (x))
#endif
// There are many quirks in the source code which have overarching behavioral differences from
// a number of other files. For example, diploma.c seems to declare rodata before each use while
// other files declare out of order and must be at the beginning. There are also a number of
+2 -2
View File
@@ -1,7 +1,7 @@
#ifndef GUARD_ITEM_PC_H
#define GUARD_ITEM_PC_H
void ItemPc_Init(u8 a0, MainCallback callback);
void ItemPc_SetInitializedFlag(u8);
void ItemPc_Init(u8 kind, MainCallback callback);
void ItemPc_SetInitializedFlag(bool8 flag);
#endif //GUARD_ITEM_PC_H
+6 -6
View File
@@ -1,11 +1,11 @@
#ifndef GUARD_MATH_UTIL_H
#define GUARD_MATH_UTIL_H
s16 sub_80D8B90(s16 y);
s16 sub_80D8AA0(s16 x, s16 y);
s32 sub_80D8B68(s32 x, s32 y);
s32 sub_80D8AE0(s32 x, s32 y);
s16 sub_80D8B40(u8 s, s16 x, s16 y);
s16 sub_80D8ABC(u8 s, s16 x, s16 y);
s16 MathUtil_Inv16(s16 y);
s16 MathUtil_Mul16(s16 x, s16 y);
s32 MathUtil_Div32(s32 x, s32 y);
s32 MathUtil_Mul32(s32 x, s32 y);
s16 MathUtil_Div16Shift(u8 s, s16 x, s16 y);
s16 MathUtil_Mul16Shift(u8 s, s16 x, s16 y);
#endif //GUARD_MATH_UTIL_H
+1 -1
View File
@@ -21,7 +21,7 @@ bool8 MenuHelpers_LinkSomething(void);
void SetVBlankHBlankCallbacksToNull(void);
void ResetAllBgsCoordinatesAndBgCntRegs(void);
u8 GetDialogBoxFontId(void);
bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1);
bool8 AdjustQuantityAccordingToDPadInput(s16 *quantity_p, u16 qmax);
void DisplayMessageAndContinueTask(u8 taskId, u8 windowId, u16 tileNum, u8 paletteNum, u8 fontId, u8 textSpeed, const u8 *string, void *taskFunc);
void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 fontId, u8 left, u8 top, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo);
u8 GetLRKeysState(void);
+1 -1
View File
@@ -28,6 +28,6 @@ void TeardownMonMarkingsMenu(void);
bool8 MonMarkingsHandleInput(void);
struct Sprite * CreateMonMarkingSprite_SelectCombo(u16 tileTag, u16 paletteTag, const u16 *palette);
struct Sprite * CreateMonMarkingSprite_AllOff(u16 tileTag, u16 paletteTag, const u16 *palette);
void sub_80BEBD0(u8 markings, void * dest);
void RequestDma3LoadMonMarking(u8 markings, void * dest);
#endif //GUARD_MON_MARKINGS_H
+5 -5
View File
@@ -71,8 +71,8 @@ void Overworld_SetObjEventTemplateMovementType(u8, u8);
void SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void SetDynamicWarp(int unused, s8 mapGroup, s8 mapNum, s8 warpId);
void SetDynamicWarpWithCoords(int unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void SetDynamicWarp(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId);
void SetDynamicWarpWithCoords(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void SetFixedHoleWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void SetEscapeWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
@@ -158,7 +158,7 @@ void ResetGameStats(void);
void Overworld_CreditsMainCB(void);
bool32 Overworld_DoScrollSceneForCredits(u8 *, const struct CreditsOverworldCmd *, u8);
bool32 sub_8058318(void);
bool32 IsSendingKeysOverCable(void);
void CB2_ReturnToFieldWithOpenMenu(void);
void CB2_WhiteOut(void);
@@ -170,8 +170,8 @@ void SetContinueGameWarpToHealLocation(u8 loc);
void UpdateAmbientCry(s16 *state, u16 *delayCounter);
void SetWarpDestinationToHealLocation(u8 a0);
bool32 sub_80582E0(void);
bool32 sub_8058274(void);
bool32 Overworld_SendKeysToLinkIsRunning(void);
bool32 Overworld_RecvKeysFromLinkIsRunning(void);
void OverworldWhiteOutGetMoneyLoss(void);
u8 GetCurrentMapBattleScene(void);
void Overworld_ResetStateAfterFly(void);
+2 -2
View File
@@ -335,9 +335,9 @@ struct PokemonStorageSystemData
/* 0d88 */ bool8 (*monPlaceChangeFunc)(void);
/* 0d8c */ u8 monPlaceChangeState;
/* 0d8d */ u8 field_D91;
/* 0d90 */ struct Sprite *field_D94;
/* 0d90 */ struct Sprite *monMarkingSprite;
/* 0d94 */ struct Sprite *field_D98[2];
/* 0d9c */ u16 *field_DA0;
/* 0d9c */ u16 *monMarkingSpriteTileStart;
/* 0da0 */ struct PokemonMarkMenu field_DA4;
/* 1e58 */ struct UnkPSSStruct_2002370 field_1E5C;
/* 20a0 */ struct Pokemon movingMon;
+1 -1
View File
@@ -114,6 +114,6 @@ bool8 sub_80DA4A0(void);
u8 Save_LoadGameData(u8 saveType);
u32 TryCopySpecialSaveSection(u8 sector, u8* dst);
u32 TryWriteSpecialSaveSection(u8 sector, u8* src);
void sub_80DA634(u8 taskId);
void Task_SaveGame_UpdatedLinkRecords(u8 taskId);
#endif // GUARD_SAVE_H
+9 -9
View File
@@ -1149,15 +1149,15 @@ extern const u8 gUnknown_841DF99[];
extern const u8 gUnknown_841DFA0[];
// berry_crush
extern const u8 gUnknown_841CE3C[];
extern const u8 gUnknown_841CE78[];
extern const u8 gUnknown_841CEA8[];
extern const u8 gUnknown_841CF14[];
extern const u8 gUnknown_841CF50[];
extern const u8 gUnknown_841CF70[];
extern const u8 gUnknown_841CFA0[];
extern const u8 gUnknown_841CFD4[];
extern const u8 gUnknown_841D008[];
extern const u8 gText_BerryCrush_AreYouReady[];
extern const u8 gText_BerryCrush_WaitForOthersToChooseBerry[];
extern const u8 gText_BerryCrush_GainedXUnitsOfPowder[];
extern const u8 gText_BerryCrush_RecordingGameResults[];
extern const u8 gText_BerryCrush_WantToPlayAgain[];
extern const u8 gText_BerryCrush_NoBerries[];
extern const u8 gText_BerryCrush_MemberDroppedOut[];
extern const u8 gText_BerryCrush_TimeUp[];
extern const u8 gText_BerryCrush_CommunicationStandby[];
extern const u8 gText_1_ClrLtGryShdwBlk_Dynamic0[];
extern const u8 gText_1_Dynamic0[];
extern const u8 gText_SpaceTimes[];
+1 -1
View File
@@ -33,7 +33,7 @@ void SwitchTaskToFollowupFunc(u8 taskId);
bool8 FuncIsActiveTask(TaskFunc func);
u8 FindTaskIdByFunc(TaskFunc func);
u8 GetTaskCount(void);
void SetWordTaskArg(u8 taskId, u8 dataElem, u32 value);
void SetWordTaskArg(u8 taskId, u8 dataElem, unsigned long value);
u32 GetWordTaskArg(u8 taskId, u8 dataElem);
#endif // GUARD_TASK_H
+2 -2
View File
@@ -9,8 +9,8 @@ extern const u8 gMiscBlank_Gfx[]; // unused in Emerald
extern const u32 gBitTable[];
u8 CreateInvisibleSpriteWithCallback(void (*)(struct Sprite *));
void StoreWordInTwoHalfwords(u16 *, u32);
void LoadWordFromTwoHalfwords(u16 *, u32 *);
void StoreWordInTwoHalfwords(u16 *, unsigned);
void LoadWordFromTwoHalfwords(u16 *, unsigned *);
int CountTrailingZeroBits(u32 value);
u16 CalcCRC16(const u8 *data, u32 length);
u16 CalcCRC16WithTable(const u8 *data, u32 length);
+1 -1
View File
@@ -6,7 +6,7 @@
void Task_VsSeeker_0(u8 taskId);
void ClearRematchStateByTrainerId(void);
void ClearRematchStateOfLastTalked(void);
int GetRematchTrainerId(u16 a0);
int GetRematchTrainerId(u16 trainerId);
bool8 UpdateVsSeekerStepCounter(void);
void MapResetTrainerRematches(u16 mapGroup, u16 mapNum);
+8 -2
View File
@@ -54,8 +54,15 @@ u16 AddWindow(const struct WindowTemplate *template);
int AddWindowWithoutTileMap(const struct WindowTemplate *template);
void RemoveWindow(u8 windowId);
void FreeAllWindowBuffers(void);
// Mode parameter for funcs below
#define COPYWIN_MAP 1
#define COPYWIN_GFX 2
#define COPYWIN_BOTH 3
void CopyWindowToVram(u8 windowId, u8 mode);
void CopyWindowRectToVram(u32 windowId, u32 mode, u32 x, u32 y, u32 w, u32 h);
void CopyWindowToVram8Bit(u8 windowId, u8 mode);
void PutWindowTilemap(u8 windowId);
void PutWindowRectTilemapOverridePalette(u8 windowId, u8 x, u8 y, u8 width, u8 height, u8 palette);
void ClearWindowTilemap(u8 windowId);
@@ -73,7 +80,6 @@ u16 AddWindow8Bit(const struct WindowTemplate *template);
void FillWindowPixelBuffer8Bit(u8 windowId, u8 fillValue);
void FillWindowPixelRect8Bit(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height);
void BlitBitmapRectToWindow4BitTo8Bit(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 paletteNum);
void CopyWindowToVram8Bit(u8 windowId, u8 mode);
extern void *gWindowBgTilemapBuffers[];
extern struct Window gWindows[];
+92
View File
@@ -0,0 +1,92 @@
gNumMusicPlayers = 4;
gMaxLines = 0;
SECTIONS {
. = 0x2000000;
ewram (NOLOAD) :
ALIGN(4)
{
gHeap = .;
. = 0x1C000;
*(ewram_data);
/* pokemon_summary_screen.o */
. = ALIGN(4);
gUnknown_203B140 = .; . += 0x4;
gUnknown_203B144 = .; . += 0x4;
gUnknown_203B148 = .; . += 0x10;
gUnknown_203B158 = .; . += 0x4;
gUnknown_203B15C = .; . += 0x4;
gUnknown_203B160 = .; . += 0x4;
gUnknown_203B164 = .; . += 0x4;
gUnknown_203B168 = .; . += 0x4;
gLastViewedMonIndex = .; . += 0x1;
gUnknown_203B16D = .; . += 0x1;
gUnknown_203B16E = .; . += 0x2;
gUnknown_203B170 = .; . += 0x4;
. = 0x40000;
}
. = 0x3000000;
iwram (NOLOAD) :
ALIGN(4)
{
/* .bss starts at 0x3000000 */
*(.bss*);
/* .bss.code starts at 0x3001AA8 */
src/m4a.o(.bss.code);
/* COMMON starts at 0x30022A8 */
*(COMMON);
end = .;
. = 0x8000;
}
. = 0x8000000;
.text :
ALIGN(4)
{
asm/crt0.o(.text);
*(.text*);
} =0
script_data :
ALIGN(4)
{
*(script_data);
} =0
.data :
ALIGN(4)
{
*(.data*);
} =0
.rodata :
ALIGN(4)
{
*(.rodata*);
} =0
/* DWARF 2 sections */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_info 0 : { *(.debug_info) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* Discard everything not specifically mentioned above. */
/DISCARD/ :
{
*(*);
}
}
+5 -5
View File
@@ -2257,8 +2257,8 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2)
if (!toBG_2)
{
RequestDma3Fill(0, (void*)(BG_SCREEN_ADDR(8)), 0x2000, 1);
RequestDma3Fill(0, (void*)(BG_SCREEN_ADDR(28)), 0x1000, 1);
RequestDma3Fill(0, (void*)(BG_SCREEN_ADDR(8)), 0x2000, DMA3_32BIT);
RequestDma3Fill(0, (void*)(BG_SCREEN_ADDR(28)), 0x1000, DMA3_32BIT);
sub_80752A0(&animBg);
CpuFill16(toBG_2, animBg.bgTiles, 0x1000);
CpuFill16(toBG_2, animBg.bgTilemap, 0x800);
@@ -2282,8 +2282,8 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2)
}
else
{
RequestDma3Fill(0, (void*)(BG_SCREEN_ADDR(12)), 0x2000, 1);
RequestDma3Fill(0, (void*)(BG_SCREEN_ADDR(30)), 0x1000, 1);
RequestDma3Fill(0, (void*)(BG_SCREEN_ADDR(12)), 0x2000, DMA3_32BIT);
RequestDma3Fill(0, (void*)(BG_SCREEN_ADDR(30)), 0x1000, DMA3_32BIT);
sub_80752C8(&animBg, 2);
CpuFill16(0, animBg.bgTiles + 0x1000, 0x1000);
CpuFill16(0, animBg.bgTilemap + 0x400, 0x800);
@@ -2840,7 +2840,7 @@ s8 BattleAnimAdjustPanning2(s8 pan)
return pan;
}
s16 KeepPanInRange(s16 panArg, int oldPan)
s16 KeepPanInRange(s16 panArg, s32 oldPan)
{
s16 pan = panArg;
+7 -7
View File
@@ -1532,7 +1532,7 @@ void AnimAirWaveProjectile(struct Sprite *sprite)
{
sprite->data[0] = 8;
task->data[5] = 4;
a = sub_80D8B90(0x1000);
a = MathUtil_Inv16(0x1000);
sprite->pos1.x += sprite->pos2.x;
sprite->pos1.y += sprite->pos2.y;
sprite->pos2.y = 0;
@@ -1551,8 +1551,8 @@ void AnimAirWaveProjectile(struct Sprite *sprite)
sprite->data[1] = 0;
sprite->data[6] = 0;
sprite->data[5] = 0;
sprite->data[3] = sub_80D8AA0(sub_80D8AA0(b, a), sub_80D8B90(0x1C0));
sprite->data[4] = sub_80D8AA0(sub_80D8AA0(c, a), sub_80D8B90(0x1C0));
sprite->data[3] = MathUtil_Mul16(MathUtil_Mul16(b, a), MathUtil_Inv16(0x1C0));
sprite->data[4] = MathUtil_Mul16(MathUtil_Mul16(c, a), MathUtil_Inv16(0x1C0));
sprite->callback = AnimAirWaveProjectile_Step1;
}
}
@@ -1643,18 +1643,18 @@ void AnimTask_AirCutterProjectile(u8 taskId)
else
xDiff = attackerX - targetX;
gTasks[taskId].data[5] = sub_80D8AA0(xDiff, sub_80D8B90(gBattleAnimArgs[2] & ~1));
gTasks[taskId].data[6] = sub_80D8AA0(gTasks[taskId].data[5], 0x80);
gTasks[taskId].data[5] = MathUtil_Mul16(xDiff, MathUtil_Inv16(gBattleAnimArgs[2] & ~1));
gTasks[taskId].data[6] = MathUtil_Mul16(gTasks[taskId].data[5], 0x80);
gTasks[taskId].data[7] = gBattleAnimArgs[2];
if (targetY >= attackerY)
{
yDiff = targetY - attackerY;
gTasks[taskId].data[8] = sub_80D8AA0(yDiff, sub_80D8B90(gTasks[taskId].data[5])) & ~1;
gTasks[taskId].data[8] = MathUtil_Mul16(yDiff, MathUtil_Inv16(gTasks[taskId].data[5])) & ~1;
}
else
{
yDiff = attackerY - targetY;
gTasks[taskId].data[8] = sub_80D8AA0(yDiff, sub_80D8B90(gTasks[taskId].data[5])) | 1;
gTasks[taskId].data[8] = MathUtil_Mul16(yDiff, MathUtil_Inv16(gTasks[taskId].data[5])) | 1;
}
gTasks[taskId].data[3] = gBattleAnimArgs[3];
+1
View File
@@ -4,6 +4,7 @@
#include "task.h"
#include "trig.h"
#undef abs
#define abs(x) ((x) < 0 ? -(x) : (x))
static void AnimTask_ShakeMonStep(u8 taskId);
+1 -1
View File
@@ -2027,7 +2027,7 @@ void sub_80F15C8(u8 taskId)
break;
case 2:
spriteId = gBattlerSpriteIds[gBattleAnimAttacker];
RequestDma3Fill(0, (void *)OBJ_VRAM0 + gSprites[spriteId].oam.tileNum * TILE_SIZE_4BPP, 0x800, 1);
RequestDma3Fill(0, (void *)OBJ_VRAM0 + gSprites[spriteId].oam.tileNum * TILE_SIZE_4BPP, 0x800, DMA3_32BIT);
ClearBehindSubstituteBit(gBattleAnimAttacker);
DestroyAnimVisualTask(taskId);
break;
+1 -1
View File
@@ -796,7 +796,7 @@ static void sub_802F610(void)
{
if (gWirelessCommType == 0)
{
if (gReceivedRemoteLinkPlayers == 0)
if (!gReceivedRemoteLinkPlayers)
{
m4aSongNumStop(SE_HINSI);
gMain.inBattle = 0;
+1
View File
@@ -16,6 +16,7 @@
destWidth - w; \
})
#undef abs
#define abs(a) ((a) < 0 ? -(a) : (a))
#define Q_24_8(n) ((s32)((n) * 256))
+5 -5
View File
@@ -935,7 +935,7 @@ static void CB2_HandleStartBattle(void)
case 1:
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
{
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
if (IsLinkTaskFinished())
{
@@ -1107,7 +1107,7 @@ static void CB2_PreInitMultiBattle(void)
switch (gBattleCommunication[MULTIUSE_STATE])
{
case 0:
if (gReceivedRemoteLinkPlayers != 0 && IsLinkTaskFinished())
if (gReceivedRemoteLinkPlayers && IsLinkTaskFinished())
{
sub_80108C4();
SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_184, sizeof(gMultiPartnerParty));
@@ -1153,7 +1153,7 @@ static void CB2_PreInitMultiBattle(void)
SetMainCallback2(CB2_InitBattleInternal);
}
}
else if (gReceivedRemoteLinkPlayers == 0)
else if (!gReceivedRemoteLinkPlayers)
{
gBattleTypeFlags = *savedBattleTypeFlags;
gMain.savedCallback = *savedCallback;
@@ -1190,7 +1190,7 @@ static void CB2_HandleStartMultiBattle(void)
LoadWirelessStatusIndicatorSpriteGfx();
break;
case 1:
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
if (IsLinkTaskFinished())
{
@@ -3843,7 +3843,7 @@ static void ReturnFromBattleToOverworld(void)
RandomlyGivePartyPokerus(gPlayerParty);
PartySpreadPokerus(gPlayerParty);
}
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) || gReceivedRemoteLinkPlayers == 0)
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) || !gReceivedRemoteLinkPlayers)
{
gSpecialVar_Result = gBattleOutcome;
gMain.inBattle = FALSE;
+1 -1
View File
@@ -2453,7 +2453,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId) {
if (!(textFlags & 0x80))
{
PutWindowTilemap(windowId);
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
}
+2 -2
View File
@@ -198,7 +198,7 @@ static void ClearWindowCommitAndRemove(u8 windowId)
{
FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
ClearWindowTilemap(windowId);
CopyWindowToVram(windowId, 2);
CopyWindowToVram(windowId, COPYWIN_GFX);
RemoveWindow(windowId);
}
@@ -557,7 +557,7 @@ static void PrintBattleRecords(void)
static void CommitWindow(u8 windowId)
{
PutWindowTilemap(windowId);
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
static void LoadFrameGfxOnBg(u8 bg)
+7 -7
View File
@@ -5764,7 +5764,7 @@ static void atk6C_drawlvlupbox(void)
case 4:
DrawLevelUpWindow1();
PutWindowTilemap(12);
CopyWindowToVram(12, 3);
CopyWindowToVram(12, COPYWIN_BOTH);
++gBattleScripting.atk6C_state;
break;
case 5:
@@ -5780,7 +5780,7 @@ static void atk6C_drawlvlupbox(void)
{
PlaySE(SE_SELECT);
DrawLevelUpWindow2();
CopyWindowToVram(12, 2);
CopyWindowToVram(12, COPYWIN_GFX);
++gBattleScripting.atk6C_state;
}
break;
@@ -5796,9 +5796,9 @@ static void atk6C_drawlvlupbox(void)
if (!sub_8026648())
{
ClearWindowTilemap(13);
CopyWindowToVram(13, 1);
CopyWindowToVram(13, COPYWIN_MAP);
ClearWindowTilemap(12);
CopyWindowToVram(12, 1);
CopyWindowToVram(12, COPYWIN_MAP);
SetBgAttribute(2, BG_ATTR_PRIORITY, 2);
ShowBg(2);
gBattleScripting.atk6C_state = 10;
@@ -5840,7 +5840,7 @@ static void sub_8026480(void)
LoadPalette(gUnknown_82506D0, 0x60, 0x20);
CopyToWindowPixelBuffer(13, gUnknown_82506F0, 0, 0);
PutWindowTilemap(13);
CopyWindowToVram(13, 3);
CopyWindowToVram(13, COPYWIN_BOTH);
PutMonIconOnLvlUpBox();
}
@@ -5909,8 +5909,8 @@ static void PutLevelAndGenderOnLvlUpBox(void)
}
printerTemplate.y = 10;
printerTemplate.currentY = 10;
AddTextPrinter(&printerTemplate, 0xFF, NULL);
CopyWindowToVram(13, 2);
AddTextPrinter(&printerTemplate, TEXT_SPEED_FF, NULL);
CopyWindowToVram(13, COPYWIN_GFX);
}
static bool8 sub_8026648(void)
+5 -7
View File
@@ -1109,12 +1109,10 @@ static void SpriteCB_BT_Phase2SlidingPokeballs(struct Sprite *sprite)
if (posX != sprite->data[2])
{
u32 var;
u16 *ptr;
sprite->data[2] = posX;
var = (((GetGpuReg(REG_OFFSET_BG0CNT) >> 8) & 0x1F) << 11);
ptr = (u16 *)(VRAM + var);
ptr = (u16 *)BG_SCREEN_ADDR((GetGpuReg(REG_OFFSET_BG0CNT) >> 8) & 0x1F);
SOME_VRAM_STORE(ptr, posY - 2, posX, 0xF001);
SOME_VRAM_STORE(ptr, posY - 1, posX, 0xF001);
SOME_VRAM_STORE(ptr, posY - 0, posX, 0xF001);
@@ -3512,7 +3510,7 @@ static void BT_GetBg0TilesetBase(u16 **tilesetPtr)
u16 charBase;
charBase = GetGpuReg(REG_OFFSET_BG0CNT) >> 2;
charBase <<= 0xE;
charBase <<= 14;
*tilesetPtr = (u16 *)(VRAM + charBase);
}
@@ -3522,8 +3520,8 @@ static void BT_GetBg0TilemapAndTilesetBase(u16 **tilemapPtr, u16 **tilesetPtr)
screenBase = (GetGpuReg(REG_OFFSET_BG0CNT) >> 8) & 0x1F;
charBase = GetGpuReg(REG_OFFSET_BG0CNT) >> 2;
screenBase <<= 0xB;
charBase <<= 0xE;
screenBase <<= 11;
charBase <<= 14;
*tilemapPtr = (u16 *)(VRAM + screenBase);
*tilesetPtr = (u16 *)(VRAM + charBase);
}
@@ -3546,7 +3544,7 @@ static void BT_GenerateCircle(s16 *buffer, s16 x, s16 y, s16 radius)
s16 i;
memset(buffer, 0xA, 320);
// 64 iterations because we only want to cover [0, π/2) discretely.
// 64 iterations because we only want to cover [0, π/2) discretely.
for (i = 0; i < 64; ++i)
{
s16 sinResult, cosResult, leftX, topY, bottomY, nextTopY, nextBottomY, winVal;
+1 -1
View File
@@ -867,7 +867,7 @@ const struct Berry gBerries[] = {
};
const struct UnkStruct_0858AB24 gUnknown_83DFC9C[] = {
const struct BerryCrushStats gBerryCrushStats[] = {
{ 50, 20},
{ 50, 20},
{ 50, 20},
+79 -77
View File
@@ -13,28 +13,29 @@
#include "constants/songs.h"
#include "constants/items.h"
static EWRAM_DATA struct BerryCrushGame *gUnknown_203F3DC = NULL;
static EWRAM_DATA struct BerryCrushGame *sBerryCrushGamePtr = NULL;
static void sub_814B860(void);
static void sub_814BA6C(void);
static void sub_814BA80(void);
static void sub_814BA98(u8 taskId);
static void BerryCrush_InitPlayerNamesAndTextSpeed(struct BerryCrushGame *game);
static void CB2_ReturnToBerryCrushGameFromBerryPouch(void);
static void VBlankCB_BerryCrush(void);
static void CB2_BerryCrush(void);
static void Task_RunBerryCrushGame(u8 taskId);
struct BerryCrushGame *sub_814B6F0(void)
struct BerryCrushGame *GetBerryCrushGame(void)
{
return gUnknown_203F3DC;
return sBerryCrushGamePtr;
}
u32 sub_814B6FC(MainCallback callback)
u32 ExitBerryCrushWithCallback(MainCallback callback)
{
if (!gUnknown_203F3DC)
if (sBerryCrushGamePtr == NULL)
return 2;
if (!callback)
callback = gUnknown_203F3DC->unk0;
if (callback == NULL)
callback = sBerryCrushGamePtr->savedCallback;
DestroyTask(gUnknown_203F3DC->unkA);
FREE_AND_SET_NULL(gUnknown_203F3DC);
DestroyTask(sBerryCrushGamePtr->taskId);
FREE_AND_SET_NULL(sBerryCrushGamePtr);
SetMainCallback2(callback);
if (callback == CB2_ReturnToField)
{
@@ -70,8 +71,8 @@ void StartBerryCrush(MainCallback callback)
return;
}
gUnknown_203F3DC = AllocZeroed(sizeof(*gUnknown_203F3DC));
if (!gUnknown_203F3DC)
sBerryCrushGamePtr = AllocZeroed(sizeof(*sBerryCrushGamePtr));
if (!sBerryCrushGamePtr)
{
SetMainCallback2(callback);
Rfu.linkman_param[0] = 0;
@@ -80,109 +81,110 @@ void StartBerryCrush(MainCallback callback)
return;
}
gUnknown_203F3DC->unk0 = callback;
gUnknown_203F3DC->unk8 = multiplayerId;
gUnknown_203F3DC->unk9 = playerCount;
sub_814BABC(gUnknown_203F3DC);
gUnknown_203F3DC->unk12 = 1;
gUnknown_203F3DC->unkE = 1;
gUnknown_203F3DC->unkF = 6;
sub_814D564(gUnknown_203F3DC->unk36, 1, -1, 0, 16, 0, 0);
sub_814BB4C(4, 1, gUnknown_203F3DC->unk36);
SetMainCallback2(sub_814BA80);
gUnknown_203F3DC->unkA = CreateTask(sub_814BA98, 8);
sBerryCrushGamePtr->savedCallback = callback;
sBerryCrushGamePtr->localId = multiplayerId;
sBerryCrushGamePtr->playerCount = playerCount;
BerryCrush_InitPlayerNamesAndTextSpeed(sBerryCrushGamePtr);
sBerryCrushGamePtr->gameState = 1;
sBerryCrushGamePtr->nextCmd = BCCMD_BeginNormalPaletteFade;
sBerryCrushGamePtr->afterPalFadeCmd = BCCMD_SignalReadyToBegin;
BerryCrush_SetPaletteFadeParams(sBerryCrushGamePtr->commandParams, TRUE, 0xFFFFFFFF, 0, 16, 0, RGB_BLACK);
BerryCrush_RunOrScheduleCommand(BCCMD_InitGfx, 1, sBerryCrushGamePtr->commandParams);
SetMainCallback2(CB2_BerryCrush);
sBerryCrushGamePtr->taskId = CreateTask(Task_RunBerryCrushGame, 8);
}
static void sub_814B860(void)
static void CB2_ReturnToBerryCrushGameFromBerryPouch(void)
{
if (gSpecialVar_ItemId < FIRST_BERRY_INDEX || gSpecialVar_ItemId > LAST_BERRY_INDEX + 1)
gSpecialVar_ItemId = ITEM_CHERI_BERRY;
else
RemoveBagItem(gSpecialVar_ItemId, 1);
gUnknown_203F3DC->unk68.as_four_players.others[gUnknown_203F3DC->unk8].unk0 = gSpecialVar_ItemId - FIRST_BERRY_INDEX;
gUnknown_203F3DC->unkE = 1;
gUnknown_203F3DC->unkF = 9;
sub_814D564(gUnknown_203F3DC->unk36, 0, -1, 0, 16, 0, 0);
sub_814BB4C(4, 1, gUnknown_203F3DC->unk36);
gUnknown_203F3DC->unkA = CreateTask(sub_814BA98, 8);
SetMainCallback2(sub_814BA80);
sBerryCrushGamePtr->unk68.as_four_players.others[sBerryCrushGamePtr->localId].berryId = gSpecialVar_ItemId - FIRST_BERRY_INDEX;
sBerryCrushGamePtr->nextCmd = BCCMD_BeginNormalPaletteFade;
sBerryCrushGamePtr->afterPalFadeCmd = BCCMD_WaitForOthersToPickBerries;
BerryCrush_SetPaletteFadeParams(sBerryCrushGamePtr->commandParams, FALSE, 0xFFFFFFFF, 0, 16, 0, RGB_BLACK);
BerryCrush_RunOrScheduleCommand(BCCMD_InitGfx, 1, sBerryCrushGamePtr->commandParams);
sBerryCrushGamePtr->taskId = CreateTask(Task_RunBerryCrushGame, 8);
SetMainCallback2(CB2_BerryCrush);
}
void sub_814B8F0(void)
void CB2_BerryCrush_GoToBerryPouch(void)
{
DestroyTask(gUnknown_203F3DC->unkA);
InitBerryPouch(BERRYPOUCH_FROMBERRYCRUSH, sub_814B860, FALSE);
DestroyTask(sBerryCrushGamePtr->taskId);
InitBerryPouch(BERRYPOUCH_FROMBERRYCRUSH, CB2_ReturnToBerryCrushGameFromBerryPouch, FALSE);
}
void sub_814B914(void)
void BerryCrush_SetVBlankCallback(void)
{
SetVBlankCallback(sub_814BA6C);
SetVBlankCallback(VBlankCB_BerryCrush);
}
void sub_814B924(void)
void BerryCrush_UnsetVBlankCallback(void)
{
SetVBlankCallback(NULL);
}
void sub_814B930(void)
void BerryCrush_UpdateSav2Records(void)
{
u32 var0, var1;
var0 = gUnknown_203F3DC->unk68.as_four_players.unk00.unk04;
// unk0A / (unk04 / 60)
var0 = sBerryCrushGamePtr->unk68.as_four_players.unk00.unk04;
var0 <<= 8;
var0 = sub_80D8B68(var0, 60 << 8);
var1 = gUnknown_203F3DC->unk68.as_four_players.unk00.unk0A;
var0 = MathUtil_Div32(var0, 60 << 8);
var1 = sBerryCrushGamePtr->unk68.as_four_players.unk00.unk0A;
var1 <<= 8;
var1 = sub_80D8B68(var1, var0) & 0xFFFF;
gUnknown_203F3DC->unk16 = var1;
switch (gUnknown_203F3DC->unk9)
var1 = MathUtil_Div32(var1, var0) & 0xFFFF;
sBerryCrushGamePtr->pressingSpeed = var1;
switch (sBerryCrushGamePtr->playerCount)
{
case 2:
if (gUnknown_203F3DC->unk16 > gSaveBlock2Ptr->berryCrush.berryCrushResults[0])
if (sBerryCrushGamePtr->pressingSpeed > gSaveBlock2Ptr->berryCrush.berryCrushResults[0])
{
gUnknown_203F3DC->unk25_1 = 1;
gSaveBlock2Ptr->berryCrush.berryCrushResults[0] = gUnknown_203F3DC->unk16;
sBerryCrushGamePtr->unk25_1 = 1;
gSaveBlock2Ptr->berryCrush.berryCrushResults[0] = sBerryCrushGamePtr->pressingSpeed;
}
break;
case 3:
if (gUnknown_203F3DC->unk16 > gSaveBlock2Ptr->berryCrush.berryCrushResults[1])
if (sBerryCrushGamePtr->pressingSpeed > gSaveBlock2Ptr->berryCrush.berryCrushResults[1])
{
gUnknown_203F3DC->unk25_1 = 1;
gSaveBlock2Ptr->berryCrush.berryCrushResults[1] = gUnknown_203F3DC->unk16;
sBerryCrushGamePtr->unk25_1 = 1;
gSaveBlock2Ptr->berryCrush.berryCrushResults[1] = sBerryCrushGamePtr->pressingSpeed;
}
break;
case 4:
if (gUnknown_203F3DC->unk16 > gSaveBlock2Ptr->berryCrush.berryCrushResults[2])
if (sBerryCrushGamePtr->pressingSpeed > gSaveBlock2Ptr->berryCrush.berryCrushResults[2])
{
gUnknown_203F3DC->unk25_1 = 1;
gSaveBlock2Ptr->berryCrush.berryCrushResults[2] = gUnknown_203F3DC->unk16;
sBerryCrushGamePtr->unk25_1 = 1;
gSaveBlock2Ptr->berryCrush.berryCrushResults[2] = sBerryCrushGamePtr->pressingSpeed;
}
break;
case 5:
if (gUnknown_203F3DC->unk16 > gSaveBlock2Ptr->berryCrush.berryCrushResults[3])
if (sBerryCrushGamePtr->pressingSpeed > gSaveBlock2Ptr->berryCrush.berryCrushResults[3])
{
gUnknown_203F3DC->unk25_1 = 1;
gSaveBlock2Ptr->berryCrush.berryCrushResults[3] = gUnknown_203F3DC->unk16;
sBerryCrushGamePtr->unk25_1 = 1;
gSaveBlock2Ptr->berryCrush.berryCrushResults[3] = sBerryCrushGamePtr->pressingSpeed;
}
break;
}
gUnknown_203F3DC->unk1C = gUnknown_203F3DC->unk68.as_four_players.unk00.unk00;
if (GiveBerryPowder(gUnknown_203F3DC->unk1C))
sBerryCrushGamePtr->powder = sBerryCrushGamePtr->unk68.as_four_players.unk00.unk00;
if (GiveBerryPowder(sBerryCrushGamePtr->powder))
return;
gUnknown_203F3DC->unk25_0 = 1;
sBerryCrushGamePtr->unk25_0 = 1;
}
static void sub_814BA6C(void)
static void VBlankCB_BerryCrush(void)
{
TransferPlttBuffer();
LoadOam();
ProcessSpriteCopyRequests();
}
static void sub_814BA80(void)
static void CB2_BerryCrush(void)
{
RunTasks();
RunTextPrinters();
@@ -190,39 +192,39 @@ static void sub_814BA80(void)
BuildOamBuffer();
}
static void sub_814BA98(u8 taskId)
static void Task_RunBerryCrushGame(u8 taskId)
{
if (gUnknown_203F3DC->unk4)
gUnknown_203F3DC->unk4(gUnknown_203F3DC, gUnknown_203F3DC->unk36);
if (sBerryCrushGamePtr->cmdCallback != NULL)
sBerryCrushGamePtr->cmdCallback(sBerryCrushGamePtr, sBerryCrushGamePtr->commandParams);
sub_814D9CC(gUnknown_203F3DC);
sub_814D9CC(sBerryCrushGamePtr);
}
void sub_814BABC(struct BerryCrushGame *arg0)
void BerryCrush_InitPlayerNamesAndTextSpeed(struct BerryCrushGame *game)
{
u8 i;
for (i = 0; i < arg0->unk9; i++)
for (i = 0; i < game->playerCount; i++)
{
StringCopy(PLAYER_UNK14(arg0, i), gLinkPlayers[i].name);
arg0->unk68.as_five_players.unk1C[i].unk14[PLAYER_NAME_LENGTH] = EOS;
StringCopy(BERRYCRUSH_PLAYER_NAME(game, i), gLinkPlayers[i].name);
game->unk68.as_five_players.players[i].unk14[PLAYER_NAME_LENGTH] = EOS;
}
for (; i < 5; i++)
{
memset(PLAYER_UNK14(arg0, i), 1, PLAYER_NAME_LENGTH);
arg0->unk68.as_five_players.unk1C[i].unk14[PLAYER_NAME_LENGTH] = EOS;
memset(BERRYCRUSH_PLAYER_NAME(game, i), 1, PLAYER_NAME_LENGTH);
game->unk68.as_five_players.players[i].unk14[PLAYER_NAME_LENGTH] = EOS;
}
switch (gSaveBlock2Ptr->optionsTextSpeed)
{
case OPTIONS_TEXT_SPEED_SLOW:
arg0->unkB = 8;
game->textSpeed = 8;
break;
case OPTIONS_TEXT_SPEED_MID:
arg0->unkB = 4;
game->textSpeed = 4;
break;
case OPTIONS_TEXT_SPEED_FAST:
arg0->unkB = 1;
game->textSpeed = 1;
break;
}
}
+678 -717
View File
File diff suppressed because it is too large Load Diff
+379 -375
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -744,7 +744,7 @@ static void BerryPouchSetArrowCursorAt(u8 y, u8 colorIdx)
width = GetMenuCursorDimensionByFont(2, 0);
height = GetMenuCursorDimensionByFont(2, 1);
FillWindowPixelRect(0, 0, 1, y, width, height);
CopyWindowToVram(0, 2);
CopyWindowToVram(0, COPYWIN_GFX);
}
else
{
+4 -4
View File
@@ -180,7 +180,7 @@ u8 LoadBgVram(u8 bg, const void *src, u16 size, u16 destOffset, u8 mode)
offset = destOffset + offset;
cursor = RequestDma3Copy(src, (void*)(offset + BG_VRAM), size, 0);
cursor = RequestDma3Copy(src, (void*)(offset + BG_VRAM), size, DMA3_16BIT);
if (cursor == -1)
{
@@ -472,7 +472,7 @@ u16 Unused_LoadBgPalette(u8 bg, const void *src, u16 size, u16 destOffset)
if (IsInvalidBg32(bg) == FALSE)
{
paletteOffset = (sGpuBgConfigs2[bg].basePalette * 0x20) + (destOffset * 2);
cursor = RequestDma3Copy(src, (void*)(paletteOffset + BG_PLTT), size, 0);
cursor = RequestDma3Copy(src, (void*)(paletteOffset + BG_PLTT), size, DMA3_16BIT);
if (cursor == -1)
{
@@ -500,7 +500,7 @@ bool8 IsDma3ManagerBusyWithBgCopy(void)
if ((sDmaBusyBitfield[div] & (1 << mod)))
{
s8 reqSpace = CheckForSpaceForDma3Request(i);
s8 reqSpace = WaitDma3Request(i);
if (reqSpace == -1)
return TRUE;
sDmaBusyBitfield[div] &= ~(1 << mod);
@@ -567,7 +567,7 @@ u16 GetBgAttribute(u8 bg, u8 attributeId)
return GetBgControlAttribute(bg, BG_CTRL_ATTR_MOSAIC);
case BG_ATTR_WRAPAROUND:
return GetBgControlAttribute(bg, BG_CTRL_ATTR_WRAPAROUND);
case BG_ATTR_TEXTORAFFINEMODE:
case BG_ATTR_MAPSIZE:
switch (GetBgType(bg))
{
case 0:
+1 -1
View File
@@ -175,7 +175,7 @@ u16 Font6Func(struct TextPrinter *textPrinter)
ScrollWindow(textPrinter->printerTemplate.windowId, 0, gUnknown_846FB08[gSaveBlock2Ptr->optionsTextSpeed], PIXEL_FILL(textPrinter->printerTemplate.bgColor));
textPrinter->scrollDistance -= gUnknown_846FB08[gSaveBlock2Ptr->optionsTextSpeed];
}
CopyWindowToVram(textPrinter->printerTemplate.windowId, 2);
CopyWindowToVram(textPrinter->printerTemplate.windowId, COPYWIN_GFX);
}
else
{
+2 -2
View File
@@ -80,13 +80,13 @@ static void PrintNewCountOnLinkPlayerCountDisplayWindow(u16 windowId, s32 num)
SetStdWindowBorderStyle(windowId, FALSE);
StringExpandPlaceholders(gStringVar4, gUnknown_841DF82);
AddTextPrinterParameterized(windowId, 2, gStringVar4, 0, 0, TEXT_SPEED_FF, NULL);
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
static void DestroyLinkPlayerCountDisplayWindow(u16 windowId)
{
ClearStdWindowAndFrame(windowId, FALSE);
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
static void UpdateLinkPlayerCountDisplay(u8 taskId, u8 num)
+2 -2
View File
@@ -107,7 +107,7 @@ static void Task_DrawClearSaveDataScreen(u8 taskId)
case 4:
DrawStdFrameWithCustomTileAndPalette(1, TRUE, 0x001, 0xF);
AddTextPrinterParameterized4(1, 2, 0, 3, 1, 1, sTextColor, 0, gUnknown_841B69E);
CopyWindowToVram(1, 2);
CopyWindowToVram(1, COPYWIN_GFX);
break;
case 5:
CreateYesNoMenu(&sWindowTemplates[0], 2, 0, 2, 0x001, 0xF, 1);
@@ -139,7 +139,7 @@ static void Task_HandleYesNoMenu(u8 taskId)
PlaySE(SE_SELECT);
FillWindowPixelBuffer(1, PIXEL_FILL(1));
AddTextPrinterParameterized4(1, 2, 0, 3, 1, 1, sTextColor, 0, gUnknown_841B6B9);
CopyWindowToVram(1, 3);
CopyWindowToVram(1, COPYWIN_BOTH);
ClearSaveData();
break;
case MENU_NOTHING_CHOSEN:
+5 -5
View File
@@ -761,7 +761,7 @@ static void CreateCreditsWindow(void)
sCreditsMgr->windowId = AddWindow(&sCreditsWindowTemplate);
FillWindowPixelBuffer(sCreditsMgr->windowId, PIXEL_FILL(0));
PutWindowTilemap(sCreditsMgr->windowId);
CopyWindowToVram(sCreditsMgr->windowId, 3);
CopyWindowToVram(sCreditsMgr->windowId, COPYWIN_BOTH);
sCreditsMgr->windowIsActive = TRUE;
}
@@ -931,7 +931,7 @@ static s32 RollCredits(void)
sCreditsMgr->mainseqno = CREDITSSCENE_PRINT_DELAY;
return sCreditsMgr->canSpeedThrough;
case CREDITSSCENE_PRINT_DELAY:
CopyWindowToVram(sCreditsMgr->windowId, 2);
CopyWindowToVram(sCreditsMgr->windowId, COPYWIN_GFX);
sCreditsMgr->timer = sCreditsScript[sCreditsMgr->scrcmdidx].duration;
sCreditsMgr->scrcmdidx++;
BeginNormalPaletteFade(0x00008000, 0, 16, 0, RGB_BLACK);
@@ -1781,9 +1781,9 @@ static void LoadCreditsMonPic(u8 whichMon)
CopyToWindowPixelBuffer(2, (const void *)sWindow2Map_Pikachu, 0, 0);
break;
}
CopyWindowToVram(0, 2);
CopyWindowToVram(1, 2);
CopyWindowToVram(2, 2);
CopyWindowToVram(0, COPYWIN_GFX);
CopyWindowToVram(1, COPYWIN_GFX);
CopyWindowToVram(2, COPYWIN_GFX);
}
static u16 GetCreditsMonSpecies(u8 whichMon)
+3 -3
View File
@@ -70,7 +70,7 @@ static void CreateRandomEggShardSprite(void);
static void CreateEggShardSprite(u8 x, u8 y, s16 data1, s16 data2, s16 data3, u8 spriteAnimIndex);
// IWRAM bss
static IWRAM_DATA struct EggHatchData *sEggHatchData;
static struct EggHatchData *sEggHatchData;
// RAM buffers used to assist with BuildEggMoveset()
EWRAM_DATA static u16 sHatchedEggLevelUpMoves[EGG_LVL_UP_MOVES_ARRAY_COUNT] = {0};
@@ -1540,7 +1540,7 @@ void ShowDaycareLevelMenu(void)
menuTemplate.windowId = windowId;
listMenuTaskId = ListMenuInit(&menuTemplate, 0, 0);
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
daycareMenuTaskId = CreateTask(Task_HandleDaycareLevelMenuInput, 3);
gTasks[daycareMenuTaskId].tMenuListTaskId = listMenuTaskId;
@@ -1935,7 +1935,7 @@ static void CB2_EggHatch_1(void)
PlayFanfare(MUS_FANFA5);
sEggHatchData->CB2_state++;
PutWindowTilemap(sEggHatchData->windowId);
CopyWindowToVram(sEggHatchData->windowId, 3);
CopyWindowToVram(sEggHatchData->windowId, COPYWIN_BOTH);
break;
case 6:
if (IsFanfareTaskInactive())
+9 -14
View File
@@ -3,12 +3,7 @@
#define MAX_DMA_REQUESTS 128
#define DMA_REQUEST_COPY32 1
#define DMA_REQUEST_FILL32 2
#define DMA_REQUEST_COPY16 3
#define DMA_REQUEST_FILL16 4
static /*IWRAM_DATA*/ struct {
static struct {
/* 0x00 */ const u8 *src;
/* 0x04 */ u8 *dest;
/* 0x08 */ u16 size;
@@ -26,7 +21,7 @@ void ClearDma3Requests(void)
gDma3ManagerLocked = TRUE;
gDma3RequestCursor = 0;
for(i = 0; i < (u8)ARRAY_COUNT(gDma3Requests); i++)
for(i = 0; i < (u8)NELEMS(gDma3Requests); i++)
{
gDma3Requests[i].size = 0;
gDma3Requests[i].src = 0;
@@ -108,10 +103,10 @@ s16 RequestDma3Copy(const void *src, void *dest, u16 size, u8 mode)
gDma3Requests[cursor].dest = dest;
gDma3Requests[cursor].size = size;
if(mode == 1)
gDma3Requests[cursor].mode = mode;
if(mode == DMA3_32BIT)
gDma3Requests[cursor].mode = DMA_REQUEST_COPY32;
else
gDma3Requests[cursor].mode = 3;
gDma3Requests[cursor].mode = DMA_REQUEST_COPY16;
gDma3ManagerLocked = FALSE;
return (s16)cursor;
@@ -146,10 +141,10 @@ s16 RequestDma3Fill(s32 value, void *dest, u16 size, u8 mode)
gDma3Requests[cursor].mode = mode;
gDma3Requests[cursor].value = value;
if(mode == 1)
gDma3Requests[cursor].mode = 2;
if(mode == DMA3_32BIT)
gDma3Requests[cursor].mode = DMA_REQUEST_FILL32;
else
gDma3Requests[cursor].mode = 4;
gDma3Requests[cursor].mode = DMA_REQUEST_FILL16;
gDma3ManagerLocked = FALSE;
return (s16)cursor;
@@ -167,7 +162,7 @@ s16 RequestDma3Fill(s32 value, void *dest, u16 size, u8 mode)
return -1;
}
s16 CheckForSpaceForDma3Request(s16 index)
s16 WaitDma3Request(s16 index)
{
int current = 0;
+2 -2
View File
@@ -2342,7 +2342,7 @@ static void Task_ShowDodrioBerryPickingRecords(u8 taskId)
case 0:
data[1] = AddWindow(&sUnknown_84755E0);
sub_81538D0(data[1]);
CopyWindowToVram(data[1], 3);
CopyWindowToVram(data[1], COPYWIN_BOTH);
data[0]++;
break;
case 1:
@@ -2353,7 +2353,7 @@ static void Task_ShowDodrioBerryPickingRecords(u8 taskId)
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
rbox_fill_rectangle(data[1]);
CopyWindowToVram(data[1], 1);
CopyWindowToVram(data[1], COPYWIN_MAP);
data[0]++;
}
break;
+15 -15
View File
@@ -1055,7 +1055,7 @@ static void sub_8154B34(void)
colorsId = 2;
name = sub_81533C4(id);
AddTextPrinterParameterized3(gUnknown_203F440->unk3008[i], 0, left, 1, sTextColorTable[colorsId], -1, name);
CopyWindowToVram(gUnknown_203F440->unk3008[i], 2);
CopyWindowToVram(gUnknown_203F440->unk3008[i], COPYWIN_GFX);
window.baseBlock += 0xE;
sub_8154868(&window);
}
@@ -1199,8 +1199,8 @@ static void sub_8154F80(void)
AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], 0, sp0C, sUnknown_8478EA8[j] - width, sUnknown_8478EB0[i], -1, NULL);
}
}
CopyWindowToVram(gUnknown_203F440->unk3008[0], 2);
CopyWindowToVram(gUnknown_203F440->unk3008[1], 2);
CopyWindowToVram(gUnknown_203F440->unk3008[0], COPYWIN_GFX);
CopyWindowToVram(gUnknown_203F440->unk3008[1], COPYWIN_GFX);
gUnknown_203F440->state++;
break;
case 3:
@@ -1232,8 +1232,8 @@ static void sub_8154F80(void)
break;
case 6:
sub_8154D9C(playersCount);
CopyWindowToVram(gUnknown_203F440->unk3008[0], 2);
CopyWindowToVram(gUnknown_203F440->unk3008[1], 2);
CopyWindowToVram(gUnknown_203F440->unk3008[0], COPYWIN_GFX);
CopyWindowToVram(gUnknown_203F440->unk3008[1], COPYWIN_GFX);
gUnknown_203F440->state++;
break;
case 7:
@@ -1291,8 +1291,8 @@ static void sub_8154F80(void)
DynamicPlaceholderTextUtil_ExpandPlaceholders(sp0C, gText_FilledStorageSpace);
AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], 0, sp0C, 8, 40, -1, NULL);
}
CopyWindowToVram(gUnknown_203F440->unk3008[0], 2);
CopyWindowToVram(gUnknown_203F440->unk3008[1], 2);
CopyWindowToVram(gUnknown_203F440->unk3008[0], COPYWIN_GFX);
CopyWindowToVram(gUnknown_203F440->unk3008[1], COPYWIN_GFX);
gUnknown_203F440->state++;
break;
case 10:
@@ -1349,8 +1349,8 @@ static void sub_81556E0(void)
AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], 2, gText_Yes, 8, 2, -1, NULL);
AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], 2, gText_No, 8, 16, -1, NULL);
AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], 2, gText_SelectorArrow2, 0, 2, -1, NULL);
CopyWindowToVram(gUnknown_203F440->unk3008[0], 2);
CopyWindowToVram(gUnknown_203F440->unk3008[1], 2);
CopyWindowToVram(gUnknown_203F440->unk3008[0], COPYWIN_GFX);
CopyWindowToVram(gUnknown_203F440->unk3008[1], COPYWIN_GFX);
gUnknown_203F440->state++;
break;
case 2:
@@ -1370,7 +1370,7 @@ static void sub_81556E0(void)
AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], 2, gText_Yes, 8, 2, -1, NULL);
AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], 2, gText_No, 8, 16, -1, NULL);
AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], 2, gText_SelectorArrow2, 0, y == 1 ? 2 : 16, -1, NULL);
CopyWindowToVram(gUnknown_203F440->unk3008[1], 3);
CopyWindowToVram(gUnknown_203F440->unk3008[1], COPYWIN_BOTH);
// Increment state only if A or B button have been pressed.
if (JOY_NEW(A_BUTTON))
{
@@ -1425,18 +1425,18 @@ static void sub_8155A78(void)
gUnknown_203F440->state++;
break;
case 1:
CopyWindowToVram(0, 3);
CopyWindowToVram(0, COPYWIN_BOTH);
gUnknown_203F440->state++;
break;
case 2:
if (!IsDma3ManagerBusyWithBgCopy())
{
CreateTask(sub_80DA634, 0);
CreateTask(Task_SaveGame_UpdatedLinkRecords, 0);
gUnknown_203F440->state++;
}
break;
case 3:
if (!FuncIsActiveTask(sub_80DA634))
if (!FuncIsActiveTask(Task_SaveGame_UpdatedLinkRecords))
gUnknown_203F440->state++;
break;
default:
@@ -1460,7 +1460,7 @@ static void sub_8155B4C(void)
case 1:
FillWindowPixelBuffer(gUnknown_203F440->unk3008[0], PIXEL_FILL(1));
AddTextPrinterParameterized(gUnknown_203F440->unk3008[0], 2, gText_CommunicationStandby3, 0, 6, -1, NULL);
CopyWindowToVram(gUnknown_203F440->unk3008[0], 2);
CopyWindowToVram(gUnknown_203F440->unk3008[0], COPYWIN_GFX);
gUnknown_203F440->state++;
break;
case 2:
@@ -1500,7 +1500,7 @@ static void sub_8155C80(void)
case 1:
FillWindowPixelBuffer(gUnknown_203F440->unk3008[0], PIXEL_FILL(1));
AddTextPrinterParameterized(gUnknown_203F440->unk3008[0], 2, gText_SomeoneDroppedOut, 0, 6, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_203F440->unk3008[0], 2);
CopyWindowToVram(gUnknown_203F440->unk3008[0], COPYWIN_GFX);
gUnknown_203F440->state++;
break;
case 2:
+6 -6
View File
@@ -1323,7 +1323,7 @@ static void PrintTitleText(void)
FillWindowPixelBuffer(0, PIXEL_FILL(0));
EC_AddTextPrinterParameterized2(0, 1, titleText, xOffset, 0, TEXT_SPEED_FF, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY);
PutWindowTilemap(0);
CopyWindowToVram(0, 3);
CopyWindowToVram(0, COPYWIN_BOTH);
}
static void EC_AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16))
@@ -1379,7 +1379,7 @@ static void PrintECInterfaceTextById(u8 direction)
if (text2)
EC_AddTextPrinterParameterized(1, 1, text2, 0, 16, TEXT_SPEED_FF, NULL);
CopyWindowToVram(1, 3);
CopyWindowToVram(1, COPYWIN_BOTH);
}
static void EC_CreateYesNoMenuWithInitialCursorPos(u8 initialCursorPos)
@@ -1454,7 +1454,7 @@ static void PrintECFields(void)
EC_AddTextPrinterParameterized(sEasyChatGraphicsResources->windowId, 1, sEasyChatGraphicsResources->ecPrintBuffer, 0, i * 16, TEXT_SPEED_FF, NULL);
}
CopyWindowToVram(sEasyChatGraphicsResources->windowId, 3);
CopyWindowToVram(sEasyChatGraphicsResources->windowId, COPYWIN_BOTH);
}
static void DrawECFrameInTilemapBuffer(u16 *tilemap)
@@ -1537,7 +1537,7 @@ static void PrintECMenuById(u32 id)
break;
}
CopyWindowToVram(2, 2);
CopyWindowToVram(2, COPYWIN_GFX);
}
static void PrintECGroupOrAlphaMenu(void)
@@ -1659,7 +1659,7 @@ static void PrintECRowsWin2(u8 row, u8 remrow)
}
CopyWindowToVram(2, 2);
CopyWindowToVram(2, COPYWIN_GFX);
}
static void ClearECRowsWin2(u8 row, u8 remrow)
@@ -1690,7 +1690,7 @@ static void ClearECRowsWin2(u8 row, u8 remrow)
static void ClearWin2AndCopyToVram(void)
{
FillWindowPixelBuffer(2, PIXEL_FILL(1));
CopyWindowToVram(2, 2);
CopyWindowToVram(2, COPYWIN_GFX);
}
static void StartWin2FrameAnim(int animNo)
+3 -3
View File
@@ -792,7 +792,7 @@ static void Setup_DrawMsgAndListBoxes(void)
static void FC_PutWindowTilemapAndCopyWindowToVramMode3(u8 windowId)
{
PutWindowTilemap(windowId);
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
static bool8 SetMessageSelectorIconObjMode(u8 spriteId, u8 objMode)
@@ -853,7 +853,7 @@ static void FC_DestroyWindow(u8 windowId)
{
FillWindowPixelBuffer(windowId, 0);
ClearWindowTilemap(windowId);
CopyWindowToVram(windowId, 2);
CopyWindowToVram(windowId, COPYWIN_GFX);
RemoveWindow(windowId);
}
@@ -1376,7 +1376,7 @@ static u8 FC_PopulateListMenu(void)
static void FC_PutWindowTilemapAndCopyWindowToVramMode3_2(u8 windowId)
{
PutWindowTilemap(windowId);
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
static void FC_CreateScrollIndicatorArrowPair(void)
+1 -1
View File
@@ -470,7 +470,7 @@ bool8 FieldIsDoorAnimationRunning(void)
return FuncIsActiveTask(Task_AnimateDoor);
}
u16 GetDoorSoundEffect(x, y)
u16 GetDoorSoundEffect(int x, int y)
{
if (GetDoorSoundType(sDoorGraphics, x, y) == DOOR_SOUND_NORMAL)
return MUS_W_DOOR;
+1 -1
View File
@@ -668,7 +668,7 @@ static void Task_ReturnFromLinkRoomWarp(u8 taskId)
}
break;
case 2:
if (gReceivedRemoteLinkPlayers == 0)
if (!gReceivedRemoteLinkPlayers)
{
WarpIntoMap();
SetMainCallback2(CB2_LoadMap);
+2 -2
View File
@@ -396,7 +396,7 @@ static void Task_RushInjuredPokemonToCenter(u8 taskId)
Menu_LoadStdPalAt(0xF0);
FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
PutWindowTilemap(windowId);
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
loc = GetHealLocation(1);
if (gSaveBlock1Ptr->lastHealLocation.mapGroup == loc->group
&& gSaveBlock1Ptr->lastHealLocation.mapNum == loc->map
@@ -425,7 +425,7 @@ static void Task_RushInjuredPokemonToCenter(u8 taskId)
case 5:
windowId = gTasks[taskId].data[1];
ClearWindowTilemap(windowId);
CopyWindowToVram(windowId, 1);
CopyWindowToVram(windowId, COPYWIN_MAP);
RemoveWindow(windowId);
palette_bg_faded_fill_black();
FadeInFromBlack();
+3 -3
View File
@@ -1104,7 +1104,7 @@ void DrawElevatorCurrentFloorWindow(void)
strwidth = GetStringWidth(2, floorname, 0);
AddTextPrinterParameterized(sElevatorCurrentFloorWindowId, 2, floorname, 56 - strwidth, 16, 0xFF, NULL);
PutWindowTilemap(sElevatorCurrentFloorWindowId);
CopyWindowToVram(sElevatorCurrentFloorWindowId, 3);
CopyWindowToVram(sElevatorCurrentFloorWindowId, COPYWIN_BOTH);
}
}
@@ -1365,7 +1365,7 @@ static void Task_CreateScriptListMenu(u8 taskId)
Task_CreateMenuRemoveScrollIndicatorArrowPair(taskId);
task->data[14] = ListMenuInit(&sFieldSpecialsListMenuTemplate, task->data[7], task->data[8]);
PutWindowTilemap(task->data[13]);
CopyWindowToVram(task->data[13], 3);
CopyWindowToVram(task->data[13], COPYWIN_BOTH);
gTasks[taskId].func = Task_ListMenuHandleInput;
}
@@ -1448,7 +1448,7 @@ static void Task_DestroyListMenu(u8 taskId)
ClearStdWindowAndFrameToTransparent(task->data[13], TRUE);
FillWindowPixelBuffer(task->data[13], PIXEL_FILL(0));
ClearWindowTilemap(task->data[13]);
CopyWindowToVram(task->data[13], 2);
CopyWindowToVram(task->data[13], COPYWIN_GFX);
RemoveWindow(task->data[13]);
DestroyTask(taskId);
EnableBothScriptContexts();
+1 -1
View File
@@ -436,7 +436,7 @@ static void Task_MapPreviewScreen_0(u8 taskId)
if (!MapPreview_IsGfxLoadFinished())
{
data[4] = MapPreview_CreateMapNameWindow(data[3]);
CopyWindowToVram(data[4], 3);
CopyWindowToVram(data[4], COPYWIN_BOTH);
data[0]++;
}
break;
+7 -7
View File
@@ -456,7 +456,7 @@ static void Task_Hof_InitTeamSaveData(u8 taskId)
DrawDialogueFrame(0, 0);
AddTextPrinterParameterized2(0, 2, gText_SavingDontTurnOffThePower2, 0, NULL, 2, 1, 3);
CopyWindowToVram(0, 3);
CopyWindowToVram(0, COPYWIN_BOTH);
gTasks[taskId].func = Task_Hof_TrySaveData;
}
@@ -594,7 +594,7 @@ static void Task_Hof_ApplauseAndConfetti(u8 taskId)
}
BeginNormalPaletteFade(sSelectedPaletteIndices, 0, 12, 12, HALL_OF_FAME_BG_PAL);
FillWindowPixelBuffer(0, PIXEL_FILL(0));
CopyWindowToVram(0, 3);
CopyWindowToVram(0, COPYWIN_BOTH);
gTasks[taskId].data[3] = 7;
gTasks[taskId].func = Task_Hof_WaitBorderFadeAway;
}
@@ -642,7 +642,7 @@ static void Task_Hof_WaitAndPrintPlayerInfo(u8 taskId)
HallOfFame_PrintPlayerInfo(1, 2);
DrawDialogueFrame(0, 0);
AddTextPrinterParameterized2(0, 2, gText_LeagueChamp, 0, NULL, 2, 1, 3);
CopyWindowToVram(0, 3);
CopyWindowToVram(0, COPYWIN_BOTH);
gTasks[taskId].func = Task_Hof_ExitOnKeyPressed;
}
}
@@ -972,7 +972,7 @@ static void Task_HofPC_PrintDataIsCorrupted(u8 taskId)
TopBarWindowPrintString(gText_ABUTTONExit, 8, TRUE);
DrawDialogueFrame(0, 0);
AddTextPrinterParameterized2(0, 2, gText_HOFCorrupted, 0, NULL, 2, 1, 3);
CopyWindowToVram(0, 3);
CopyWindowToVram(0, COPYWIN_BOTH);
gTasks[taskId].func = Task_HofPC_ExitOnButtonPress;
}
@@ -988,7 +988,7 @@ static void HallOfFame_PrintWelcomeText(u8 not, u8 used)
FillWindowPixelBuffer(0, PIXEL_FILL(0));
PutWindowTilemap(0);
AddTextPrinterParameterized3(0, 2, x, 1, sTextColors[0], 0, gText_WelcomeToHOF);
CopyWindowToVram(0, 3);
CopyWindowToVram(0, COPYWIN_BOTH);
}
static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u8 unused2)
@@ -1075,7 +1075,7 @@ static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u
AddTextPrinterParameterized3(0, 2, 0x60, 0x11, sTextColors[0], 0, text);
}
CopyWindowToVram(0, 3);
CopyWindowToVram(0, COPYWIN_BOTH);
}
static void HallOfFame_PrintPlayerInfo(u8 unused1, u8 unused2)
@@ -1118,7 +1118,7 @@ static void HallOfFame_PrintPlayerInfo(u8 unused1, u8 unused2)
AddTextPrinterParameterized3(1, 2, textWidth - 36, 32, sTextColors[1], 0, text);
CopyWindowToVram(1, 3);
CopyWindowToVram(1, COPYWIN_BOTH);
}
static void ClearVramOamPltt_LoadHofPal(void)
+6 -6
View File
@@ -74,9 +74,9 @@ u8 RunHelpSystemCallback(void)
sVideoState.state = 2;
break;
case 2:
RequestDma3Fill(0, (void *)BG_CHAR_ADDR(3), BG_CHAR_SIZE, 0);
RequestDma3Copy(sPals, (void *)PLTT, sizeof(sPals), 0);
RequestDma3Copy(sTiles, gDecompressionBuffer + 0x3EE0, sizeof(sTiles), 0);
RequestDma3Fill(0, (void *)BG_CHAR_ADDR(3), BG_CHAR_SIZE, DMA3_16BIT);
RequestDma3Copy(sPals, (void *)PLTT, sizeof(sPals), DMA3_16BIT);
RequestDma3Copy(sTiles, gDecompressionBuffer + 0x3EE0, sizeof(sTiles), DMA3_16BIT);
sVideoState.state = 3;
break;
case 3:
@@ -160,7 +160,7 @@ void SaveMapGPURegs(void)
void SaveMapTiles(void)
{
RequestDma3Copy((void *)BG_CHAR_ADDR(3), sMapTilesBackup, BG_CHAR_SIZE, 0);
RequestDma3Copy((void *)BG_CHAR_ADDR(3), sMapTilesBackup, BG_CHAR_SIZE, DMA3_16BIT);
}
void SaveMapTextColors(void)
@@ -189,7 +189,7 @@ void RestoreGPURegs(void)
void RestoreMapTiles(void)
{
RequestDma3Copy(sMapTilesBackup, (void *)BG_CHAR_ADDR(3), BG_CHAR_SIZE, 0);
RequestDma3Copy(sMapTilesBackup, (void *)BG_CHAR_ADDR(3), BG_CHAR_SIZE, DMA3_16BIT);
}
void RestoreMapTextColors(void)
@@ -203,7 +203,7 @@ void RestoreMapTextColors(void)
void CommitTilemap(void)
{
RequestDma3Copy(gDecompressionBuffer, (void *)BG_CHAR_ADDR(3), BG_CHAR_SIZE, 0);
RequestDma3Copy(gDecompressionBuffer, (void *)BG_CHAR_ADDR(3), BG_CHAR_SIZE, DMA3_16BIT);
}
void HS_DrawBgTilemapRect(u16 baseTile, u8 left, u8 top, u8 width, u8 height, u16 increment)
+1 -1
View File
@@ -1880,7 +1880,7 @@ bool8 HelpSystem_UpdateHasntSeenIntro(void)
bool8 sub_812B45C(void)
{
if (gReceivedRemoteLinkPlayers == 1)
if (gReceivedRemoteLinkPlayers == TRUE)
return FALSE;
return TRUE;
}
+384 -86
View File
@@ -47,18 +47,18 @@ static EWRAM_DATA u16 gUnknown_203AB06 = 0;
static EWRAM_DATA u16 gUnknown_203AB08 = 0;
static EWRAM_DATA u16 gUnknown_203AB0A = 0;
static EWRAM_DATA u16 gUnknown_203AB0C = 0;
static EWRAM_DATA u16 gUnknown_203AB0E = 0;
static EWRAM_DATA u16 gUnknown_203AB10 = 0;
static EWRAM_DATA u16 gUnknown_203AB12 = 0;
static EWRAM_DATA u16 gUnknown_203AB14 = 0;
static EWRAM_DATA u16 gUnknown_203AB16 = 0;
static EWRAM_DATA u16 gUnknown_203AB18 = 0;
static EWRAM_DATA u16 gUnknown_203AB1A = 0;
static EWRAM_DATA u16 gUnknown_203AB1C = 0;
static EWRAM_DATA u16 gUnknown_203AB1E = 0;
static EWRAM_DATA u16 gUnknown_203AB20 = 0;
static EWRAM_DATA u16 gUnknown_203AB22 = 0;
static EWRAM_DATA u16 gUnknown_203AB24 = 0;
static EWRAM_DATA u16 sLargeStarXSpeed = 0;
static EWRAM_DATA u16 sLargeStarYSpeed = 0;
static EWRAM_DATA u16 sTrailingSparklesXmodMask = 0;
static EWRAM_DATA u16 sUnusedVarRelatedToGameFreakStars = 0;
static EWRAM_DATA u16 sTrailingSparklesSpawnRate = 0;
static EWRAM_DATA u16 sTrailingSparklesFlickerStartTime = 0;
static EWRAM_DATA u16 sTrailingSparklesDestroySpriteTime = 0;
static EWRAM_DATA u16 sTrailingSparklesGravityShift = 0;
static EWRAM_DATA u16 sTrailingSparklesXspeed = 0;
static EWRAM_DATA u16 sTrailingSparklesYspeed = 0;
static EWRAM_DATA u16 sTrailingSparklesXprecision = 0;
static EWRAM_DATA u16 sTrailingSparklesYprecision = 0;
static void CB2_SetUpIntro(void);
static void CB2_Intro(void);
@@ -181,30 +181,111 @@ static const u32 sSpriteTiles_GengarSwipe[] = INCBIN_U32("graphics/intro/unk_840
static const u32 sSpriteTiles_NidorinoRecoilDust[] = INCBIN_U32("graphics/intro/unk_840BAE0.4bpp.lz");
static const struct BgTemplate sBgTemplates_GameFreakScene[] = {
{ 3, 3, 31, 0, 0, 3, 0x000 },
{ 2, 3, 30, 0, 0, 2, 0x010 }
{
.bg = 3,
.charBaseIndex = 3,
.mapBaseIndex = 31,
.screenSize = 0,
.paletteMode = 0,
.priority = 3,
.baseTile = 0x000
}, {
.bg = 2,
.charBaseIndex = 3,
.mapBaseIndex = 30,
.screenSize = 0,
.paletteMode = 0,
.priority = 2,
.baseTile = 0x010
}
};
static const struct BgTemplate sBgTemplates_FightScene1[] = {
{ 0, 0, 28, 2, 0, 0, 0x000 },
{ 1, 1, 30, 2, 0, 0, 0x000 }
{
.bg = 0,
.charBaseIndex = 0,
.mapBaseIndex = 28,
.screenSize = 2,
.paletteMode = 0,
.priority = 0,
.baseTile = 0x000
}, {
.bg = 1,
.charBaseIndex = 1,
.mapBaseIndex = 30,
.screenSize = 2,
.paletteMode = 0,
.priority = 0,
.baseTile = 0x000
}
};
static const struct BgTemplate sBgTemplates_FightScene2[] = {
{ 3, 1, 30, 2, 0, 3, 0x000 },
{ 0, 0, 29, 0, 0, 0, 0x000 },
{ 2, 3, 27, 0, 0, 2, 0x000 },
{ 1, 2, 28, 0, 0, 1, 0x000 }
{
.bg = 3,
.charBaseIndex = 1,
.mapBaseIndex = 30,
.screenSize = 2,
.paletteMode = 0,
.priority = 3,
.baseTile = 0x000
}, {
.bg = 0,
.charBaseIndex = 0,
.mapBaseIndex = 29,
.screenSize = 0,
.paletteMode = 0,
.priority = 0,
.baseTile = 0x000
}, {
.bg = 2,
.charBaseIndex = 3,
.mapBaseIndex = 27,
.screenSize = 0,
.paletteMode = 0,
.priority = 2,
.baseTile = 0x000
}, {
.bg = 1,
.charBaseIndex = 2,
.mapBaseIndex = 28,
.screenSize = 0,
.paletteMode = 0,
.priority = 1,
.baseTile = 0x000
}
};
static const struct BgTemplate sBgTemplates_FightScene3[] = {
{ 1, 0, 29, 0, 0, 1, 0x000 },
{ 0, 1, 30, 2, 0, 0, 0x000 }
{
.bg = 1,
.charBaseIndex = 0,
.mapBaseIndex = 29,
.screenSize = 0,
.paletteMode = 0,
.priority = 1,
.baseTile = 0x000
}, {
.bg = 0,
.charBaseIndex = 1,
.mapBaseIndex = 30,
.screenSize = 2,
.paletteMode = 0,
.priority = 0,
.baseTile = 0x000
}
};
static const struct WindowTemplate sWindowTemplate[] = {
{ 2, 6, 4, 18, 9, 0xD, 0x000 },
DUMMY_WIN_TEMPLATE
{
.bg = 2,
.tilemapLeft = 6,
.tilemapTop = 4,
.width = 18,
.height = 9,
.paletteNum = 0xD,
.baseBlock = 0x000
}, DUMMY_WIN_TEMPLATE
};
static const u8 sGengarBackSpritePos2UpdateMods[][2] = {
@@ -241,9 +322,31 @@ static const struct Coords16 sTrailingSparkleCoords[] = {
{0x0098, 0x0056}
};
static const struct OamData gOamData_840BC2C = { .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = FALSE, .bpp = ST_OAM_4BPP, .shape = ST_OAM_SQUARE, .matrixNum = 0, .size = ST_OAM_SIZE_1, .tileNum = 0x000, .priority = 2, .paletteNum = 0 };
static const struct OamData gOamData_840BC2C = {
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = ST_OAM_SQUARE,
.matrixNum = 0,
.size = ST_OAM_SIZE_1,
.tileNum = 0x000,
.priority = 2,
.paletteNum = 0
};
static const struct OamData gOamData_840BC34 = { .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = FALSE, .bpp = ST_OAM_4BPP, .shape = ST_OAM_SQUARE, .matrixNum = 0, .size = ST_OAM_SIZE_0, .tileNum = 0x000, .priority = 2, .paletteNum = 0 };
static const struct OamData gOamData_840BC34 = {
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = ST_OAM_SQUARE,
.matrixNum = 0,
.size = ST_OAM_SIZE_0,
.tileNum = 0x000,
.priority = 2,
.paletteNum = 0
};
static const union AnimCmd gAnimCmd_840BC3C[] = {
ANIMCMD_FRAME(0, 4),
@@ -266,11 +369,38 @@ static const union AnimCmd *const gAnimCmdTable_840BC64[] = {
gAnimCmd_840BC50
};
static const struct SpriteTemplate sSpriteTemplate_LargeStar = {0, 0, &gOamData_840BC2C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCB_LargeStar};
static const struct SpriteTemplate sSpriteTemplate_LargeStar = {
.tileTag = 0,
.paletteTag = 0,
.oam = &gOamData_840BC2C,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_LargeStar
};
static const struct SpriteTemplate sSpriteTemplate_TrailingSparkles = {1, 1, &gOamData_840BC34, gAnimCmdTable_840BC64, NULL, gDummySpriteAffineAnimTable, SpriteCB_TrailingSparkles};
static const struct SpriteTemplate sSpriteTemplate_TrailingSparkles = {
.tileTag = 1,
.paletteTag = 1,
.oam = &gOamData_840BC34,
.anims = gAnimCmdTable_840BC64,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_TrailingSparkles
};
static const struct OamData gOamData_840BC9C = { .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = FALSE, .bpp = ST_OAM_4BPP, .shape = ST_OAM_SQUARE, .matrixNum = 0, .size = ST_OAM_SIZE_2, .tileNum = 0x000, .priority = 2, .paletteNum = 0 };
static const struct OamData gOamData_840BC9C = {
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = ST_OAM_SQUARE,
.matrixNum = 0,
.size = ST_OAM_SIZE_2,
.tileNum = 0x000,
.priority = 2,
.paletteNum = 0
};
static const union AnimCmd gAnimCmd_840BCA4[] = {
ANIMCMD_FRAME(0, 8),
@@ -284,17 +414,74 @@ static const union AnimCmd *const gAnimCmdTable_840BCB8[] = {
gAnimCmd_840BCA4
};
static const struct SpriteTemplate sSpriteTemplate_RevealGameFreakTextSparkles = {2, 1, &gOamData_840BC9C, gAnimCmdTable_840BCB8, NULL, gDummySpriteAffineAnimTable, SpriteCB_RevealGameFreakTextSparkles};
static const struct SpriteTemplate sSpriteTemplate_RevealGameFreakTextSparkles = {
.tileTag = 2,
.paletteTag = 1,
.oam = &gOamData_840BC9C,
.anims = gAnimCmdTable_840BCB8,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_RevealGameFreakTextSparkles
};
static const struct OamData gOamData_840BCD4 = { .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, .mosaic = FALSE, .bpp = ST_OAM_4BPP, .shape = ST_OAM_V_RECTANGLE, .matrixNum = 0, .size = ST_OAM_SIZE_3, .tileNum = 0x000, .priority = 3, .paletteNum = 0 };
static const struct OamData gOamData_840BCD4 = {
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_BLEND,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = ST_OAM_V_RECTANGLE,
.matrixNum = 0,
.size = ST_OAM_SIZE_3,
.tileNum = 0x000,
.priority = 3,
.paletteNum = 0
};
static const struct SpriteTemplate sSpriteTemplate_GameFreakLogoArt = {3, 3, &gOamData_840BCD4, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy};
static const struct SpriteTemplate sSpriteTemplate_GameFreakLogoArt = {
.tileTag = 3,
.paletteTag = 3,
.oam = &gOamData_840BCD4,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static const struct OamData gOamData_840BCF4 = { .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, .mosaic = FALSE, .bpp = ST_OAM_4BPP, .shape = ST_OAM_H_RECTANGLE, .matrixNum = 0, .size = ST_OAM_SIZE_1, .tileNum = 0x000, .priority = 3, .paletteNum = 0 };
static const struct OamData gOamData_840BCF4 = {
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_BLEND,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = ST_OAM_H_RECTANGLE,
.matrixNum = 0,
.size = ST_OAM_SIZE_1,
.tileNum = 0x000,
.priority = 3,
.paletteNum = 0
};
static const struct SpriteTemplate sSpriteTemplate_PresentsText = {4, 3, &gOamData_840BCF4, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy};
static const struct SpriteTemplate sSpriteTemplate_PresentsText = {
.tileTag = 4,
.paletteTag = 3,
.oam = &gOamData_840BCF4,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static const struct OamData gOamData_840BD14 = { .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = FALSE, .bpp = ST_OAM_4BPP, .shape = ST_OAM_SQUARE, .matrixNum = 0, .size = ST_OAM_SIZE_3, .tileNum = 0x000, .priority = 1, .paletteNum = 0 };
static const struct OamData gOamData_840BD14 = {
.affineMode = ST_OAM_AFFINE_DOUBLE,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = ST_OAM_SQUARE,
.matrixNum = 0,
.size = ST_OAM_SIZE_3,
.tileNum = 0x000,
.priority = 1,
.paletteNum = 0
};
static const union AnimCmd gAnimCmd_840BD1C[] = {
ANIMCMD_FRAME(0, 1),
@@ -345,15 +532,61 @@ static const union AffineAnimCmd *const sAffineAnimTable_NidorinoAnim[] = {
gAffineAnimCmd_840BD68
};
static const struct SpriteTemplate sSpriteTemplate_NidorinoAnim = {5, 7, &gOamData_840BD14, sAnimTable_NidorinoAnim, NULL, sAffineAnimTable_NidorinoAnim, SpriteCallbackDummy};
static const struct SpriteTemplate sSpriteTemplate_NidorinoAnim = {
.tileTag = 5,
.paletteTag = 7,
.oam = &gOamData_840BD14,
.anims = sAnimTable_NidorinoAnim,
.images = NULL,
.affineAnims = sAffineAnimTable_NidorinoAnim,
.callback = SpriteCallbackDummy
};
static const struct OamData gOamData_840BDA0 = { .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = FALSE, .bpp = ST_OAM_4BPP, .shape = ST_OAM_SQUARE, .matrixNum = 0, .size = ST_OAM_SIZE_3, .tileNum = 0x000, .priority = 1, .paletteNum = 0 };
static const struct OamData gOamData_840BDA0 = {
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = ST_OAM_SQUARE,
.matrixNum = 0,
.size = ST_OAM_SIZE_3,
.tileNum = 0x000,
.priority = 1,
.paletteNum = 0
};
static const struct SpriteTemplate sSpriteTemplate_NidorinoStatic = {7, 7, &gOamData_840BDA0, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy};
static const struct SpriteTemplate sSpriteTemplate_NidorinoStatic = {
.tileTag = 7,
.paletteTag = 7,
.oam = &gOamData_840BDA0,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static const struct SpriteTemplate sSpriteTemplate_GengarStatic = {6, 6, &gOamData_840BDA0, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy};
static const struct SpriteTemplate sSpriteTemplate_GengarStatic = {
.tileTag = 6,
.paletteTag = 6,
.oam = &gOamData_840BDA0,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static const struct OamData gOamData_840BDD8 = { .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = FALSE, .bpp = ST_OAM_4BPP, .shape = ST_OAM_H_RECTANGLE, .matrixNum = 0, .size = ST_OAM_SIZE_3, .tileNum = 0x000, .priority = 0, .paletteNum = 0 };
static const struct OamData gOamData_840BDD8 = {
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = ST_OAM_H_RECTANGLE,
.matrixNum = 0,
.size = ST_OAM_SIZE_3,
.tileNum = 0x000,
.priority = 0,
.paletteNum = 0
};
static const union AnimCmd gAnimCmds_840BDE0[] = {
ANIMCMD_FRAME(0, 0),
@@ -371,9 +604,28 @@ static const union AnimCmd *const gAnimCmdTable_840BDF4[] = {
gAnimCmds_840BDE8
};
static const struct SpriteTemplate sSpriteTemplate_Grass = {8, 8, &gOamData_840BDD8, gAnimCmdTable_840BDF4, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy};
static const struct SpriteTemplate sSpriteTemplate_Grass = {
.tileTag = 8,
.paletteTag = 8,
.oam = &gOamData_840BDD8,
.anims = gAnimCmdTable_840BDF4,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static const struct OamData gOamData_840BE14 = { .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = FALSE, .bpp = ST_OAM_4BPP, .shape = ST_OAM_SQUARE, .matrixNum = 0, .size = ST_OAM_SIZE_3, .tileNum = 0x000, .priority = 1, .paletteNum = 0 };
static const struct OamData gOamData_840BE14 = {
.affineMode = ST_OAM_AFFINE_DOUBLE,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = ST_OAM_SQUARE,
.matrixNum = 0,
.size = ST_OAM_SIZE_3,
.tileNum = 0x000,
.priority = 1,
.paletteNum = 0
};
static const union AnimCmd gAnimCmd_840BE1C[] = {
ANIMCMD_FRAME(0, 0),
@@ -402,9 +654,28 @@ static const union AnimCmd *const gAnimCmdTable_840BE3C[] = {
gAnimCmd_840BE34
};
static const struct SpriteTemplate sSpriteTemplate_GengarBack = {9, 6, &gOamData_840BE14, gAnimCmdTable_840BE3C, NULL, sAffineAnimTable_NidorinoAnim, SpriteCallbackDummy};
static const struct SpriteTemplate sSpriteTemplate_GengarBack = {
.tileTag = 9,
.paletteTag = 6,
.oam = &gOamData_840BE14,
.anims = gAnimCmdTable_840BE3C,
.images = NULL,
.affineAnims = sAffineAnimTable_NidorinoAnim,
.callback = SpriteCallbackDummy
};
static const struct OamData gOamData_840BE64 = { .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = FALSE, .bpp = ST_OAM_4BPP, .shape = ST_OAM_V_RECTANGLE, .matrixNum = 0, .size = ST_OAM_SIZE_3, .tileNum = 0x000, .priority = 1, .paletteNum = 0 };
static const struct OamData gOamData_840BE64 = {
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = ST_OAM_V_RECTANGLE,
.matrixNum = 0,
.size = ST_OAM_SIZE_3,
.tileNum = 0x000,
.priority = 1,
.paletteNum = 0
};
static const union AnimCmd gAnimCmd_840BE6C[] = {
ANIMCMD_FRAME(0, 8),
@@ -423,9 +694,28 @@ static const union AnimCmd *const gAnimCmdTable_840BE84[] = {
gAnimCmd_840BE78
};
static const struct SpriteTemplate sSpriteTemplate_GengarSwipe = {10, 10, &gOamData_840BE64, gAnimCmdTable_840BE84, NULL, gDummySpriteAffineAnimTable, SpriteCB_GengarSwipe};
static const struct SpriteTemplate sSpriteTemplate_GengarSwipe = {
.tileTag = 10,
.paletteTag = 10,
.oam = &gOamData_840BE64,
.anims = gAnimCmdTable_840BE84,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_GengarSwipe
};
static const struct OamData gOamData_840BEA4 = { .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = FALSE, .bpp = ST_OAM_4BPP, .shape = ST_OAM_SQUARE, .matrixNum = 0, .size = ST_OAM_SIZE_1, .tileNum = 0x000, .priority = 1, .paletteNum = 0 };
static const struct OamData gOamData_840BEA4 = {
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = ST_OAM_SQUARE,
.matrixNum = 0,
.size = ST_OAM_SIZE_1,
.tileNum = 0x000,
.priority = 1,
.paletteNum = 0
};
static const union AnimCmd gAnimCmd_840BEAC[] = {
ANIMCMD_FRAME(0, 10),
@@ -439,7 +729,15 @@ static const union AnimCmd *const gAnimCmdTable_840BEC0[] = {
gAnimCmd_840BEAC
};
static const struct SpriteTemplate sSpriteTemplate_NidorinoRecoilDust = {11, 11, &gOamData_840BEA4, gAnimCmdTable_840BEC0, NULL, gDummySpriteAffineAnimTable, SpriteCB_NidorinoRecoilDust};
static const struct SpriteTemplate sSpriteTemplate_NidorinoRecoilDust = {
.tileTag = 11,
.paletteTag = 11,
.oam = &gOamData_840BEA4,
.anims = gAnimCmdTable_840BEC0,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_NidorinoRecoilDust
};
static const struct CompressedSpriteSheet sFightSceneSpriteSheets[] = {
{sSpriteTiles_GengarStatic, 0x0800, 6},
@@ -694,7 +992,7 @@ static void IntroCB_Init(struct IntroSequenceData * this)
FillWindowPixelBuffer(0, PIXEL_FILL(0));
BlitBitmapToWindow(0, this->gamefreakTextBitmap, 0, 40, 144, 16);
PutWindowTilemap(0);
CopyWindowToVram(0, 3);
CopyWindowToVram(0, COPYWIN_BOTH);
this->state++;
break;
case 1:
@@ -820,7 +1118,7 @@ static void IntroCB_GameFreakScene_CreateGameFreakLogo(struct IntroSequenceData
{
BlitBitmapToWindow(0, this->gamefreakLogoArtSpriteTiles, 0x38, 0x06, 0x20, 0x40);
BlitBitmapToWindow(0, this->gamefreakTextBitmap, 0x00, 0x28, 0x90, 0x10);
CopyWindowToVram(0, 2);
CopyWindowToVram(0, COPYWIN_GFX);
this->state++;
}
break;
@@ -1473,58 +1771,58 @@ static void GameFreakScene_LoadGfxCreateStar(void)
{
int i;
u8 spriteId;
static EWRAM_DATA u32 gUnknown_203AB28 = 0;
static EWRAM_DATA u32 sTrailingSparklesRngSeed = 0;
for (i = 0; i < NELEMS(sSpriteSheets_GameFreakScene); i++)
{
LoadCompressedSpriteSheet(&sSpriteSheets_GameFreakScene[i]);
}
LoadSpritePalettes(sSpritePalettes_GameFreakScene);
gUnknown_203AB0E = 0x60;
gUnknown_203AB10 = 0x10;
gUnknown_203AB12 = 0x07;
gUnknown_203AB14 = 0x05;
gUnknown_203AB16 = 0x08;
gUnknown_203AB18 = 0x5A;
gUnknown_203AB1A = 0x78;
gUnknown_203AB1E = 0x01;
gUnknown_203AB20 = 0x01;
gUnknown_203AB22 = 0x05;
gUnknown_203AB24 = 0x05;
if (gUnknown_203AB28 == 0)
gUnknown_203AB28 = 354128453;
sLargeStarXSpeed = 0x60;
sLargeStarYSpeed = 0x10;
sTrailingSparklesXmodMask = 0x07;
sUnusedVarRelatedToGameFreakStars = 5;
sTrailingSparklesSpawnRate = 8;
sTrailingSparklesFlickerStartTime = 90;
sTrailingSparklesDestroySpriteTime = 120;
sTrailingSparklesXspeed = 1;
sTrailingSparklesYspeed = 1;
sTrailingSparklesXprecision = 5;
sTrailingSparklesYprecision = 5;
if (sTrailingSparklesRngSeed == 0)
sTrailingSparklesRngSeed = 354128453;
spriteId = CreateSprite(&sSpriteTemplate_LargeStar, 0xF8, 0x37, 0);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].data[0] = 0xF80;
gSprites[spriteId].data[1] = 0x370;
gSprites[spriteId].data[2] = gUnknown_203AB0E;
gSprites[spriteId].data[3] = gUnknown_203AB10;
StoreWordInTwoHalfwords((u16 *)&gSprites[spriteId].data[6], gUnknown_203AB28);
gSprites[spriteId].data[2] = sLargeStarXSpeed;
gSprites[spriteId].data[3] = sLargeStarYSpeed;
StoreWordInTwoHalfwords((u16 *)&gSprites[spriteId].data[6], sTrailingSparklesRngSeed);
}
}
static void GameFreakScene_TrailingSparklesGen(s16 x, s16 y, u16 a2)
{
static EWRAM_DATA s16 gUnknown_203AB2C = 0;
static EWRAM_DATA s16 sYmod = 0;
u8 spriteId;
s16 r4 = (a2 & gUnknown_203AB12) + 2;
s16 r2 = gUnknown_203AB2C;
gUnknown_203AB2C++;
if (gUnknown_203AB2C > 3)
gUnknown_203AB2C = -3;
x += r4;
y += r2;
s16 xMod = (a2 & sTrailingSparklesXmodMask) + 2;
s16 yMod = sYmod;
sYmod++;
if (sYmod > 3)
sYmod = -3;
x += xMod;
y += yMod;
if (x >= 1 && x <= 0xEF)
{
spriteId = CreateSprite(&sSpriteTemplate_TrailingSparkles, x, y, 1);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].data[0] = x << gUnknown_203AB22;
gSprites[spriteId].data[1] = y << gUnknown_203AB24;
gSprites[spriteId].data[2] = gUnknown_203AB1E * r4;
gSprites[spriteId].data[3] = gUnknown_203AB20 * r2;
gSprites[spriteId].data[0] = x << sTrailingSparklesXprecision;
gSprites[spriteId].data[1] = y << sTrailingSparklesYprecision;
gSprites[spriteId].data[2] = sTrailingSparklesXspeed * xMod;
gSprites[spriteId].data[3] = sTrailingSparklesYspeed * yMod;
}
}
}
@@ -1747,7 +2045,7 @@ static void Task_FightScene3_Bg0Scroll(u8 taskId)
static void SpriteCB_LargeStar(struct Sprite * sprite)
{
u32 v;
unsigned v;
sprite->data[0] -= sprite->data[2];
sprite->data[1] += sprite->data[3];
sprite->data[4] += 48;
@@ -1755,7 +2053,7 @@ static void SpriteCB_LargeStar(struct Sprite * sprite)
sprite->pos1.y = sprite->data[1] >> 4;
sprite->pos2.y = gSineTable[(sprite->data[4] >> 4) + 0x40] >> 5;
sprite->data[5]++;
if (sprite->data[5] % gUnknown_203AB16)
if (sprite->data[5] % sTrailingSparklesSpawnRate)
{
LoadWordFromTwoHalfwords(&sprite->data[6], &v);
v = v * 1103515245 + 24691;
@@ -1776,14 +2074,14 @@ static void SpriteCB_TrailingSparkles(struct Sprite * sprite)
sprite->data[4]++;
sprite->data[5] += sprite->data[4];
sprite->data[7]++;
sprite->pos1.x = (u16)sprite->data[0] >> gUnknown_203AB22;
sprite->pos1.y = sprite->data[1] >> gUnknown_203AB24;
if (gUnknown_203AB1C && sprite->data[3] < 0)
sprite->pos2.y = sprite->data[5] >> gUnknown_203AB1C;
if (sprite->data[7] > gUnknown_203AB18)
sprite->pos1.x = (u16)sprite->data[0] >> sTrailingSparklesXprecision;
sprite->pos1.y = sprite->data[1] >> sTrailingSparklesYprecision;
if (sTrailingSparklesGravityShift && sprite->data[3] < 0)
sprite->pos2.y = sprite->data[5] >> sTrailingSparklesGravityShift;
if (sprite->data[7] > sTrailingSparklesFlickerStartTime)
{
sprite->invisible = !sprite->invisible;
if (sprite->data[7] > gUnknown_203AB1A)
if (sprite->data[7] > sTrailingSparklesDestroySpriteTime)
DestroySprite(sprite);
}
if (sprite->pos1.y + sprite->pos2.y < 0 || sprite->pos1.y + sprite->pos2.y > 160)
+8 -8
View File
@@ -1596,7 +1596,7 @@ static void Task_ItemMenuAction_ToggleSelect(u8 taskId)
DestroyListMenuTask(data[0], &gBagMenuState.cursorPos[gBagMenuState.pocket], &gBagMenuState.itemsAbove[gBagMenuState.pocket]);
Bag_BuildListMenuTemplate(gBagMenuState.pocket);
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, gBagMenuState.cursorPos[gBagMenuState.pocket], gBagMenuState.itemsAbove[gBagMenuState.pocket]);
CopyWindowToVram(0, 1);
CopyWindowToVram(0, COPYWIN_MAP);
Task_ItemMenuAction_Cancel(taskId);
}
@@ -1608,7 +1608,7 @@ static void Task_ItemMenuAction_Give(u8 taskId)
HideBagWindow(6);
PutWindowTilemap(0);
PutWindowTilemap(1);
CopyWindowToVram(0, 1);
CopyWindowToVram(0, COPYWIN_MAP);
if (!CanWriteMailHere(itemId))
DisplayItemMessageInBag(taskId, 2, gText_CantWriteMailHere, Task_WaitAButtonAndCloseContextMenu);
else if (!itemid_is_unique(itemId))
@@ -1694,7 +1694,7 @@ static void Task_ItemMenuAction_BattleUse(u8 taskId)
HideBagWindow(6);
PutWindowTilemap(0);
PutWindowTilemap(1);
CopyWindowToVram(0, 1);
CopyWindowToVram(0, COPYWIN_MAP);
ItemId_GetBattleFunc(gSpecialVar_ItemId)(taskId);
}
}
@@ -2131,7 +2131,7 @@ static void Task_Bag_OldManTutorial(u8 taskId)
HideBagWindow(6);
PutWindowTilemap(0);
PutWindowTilemap(1);
CopyWindowToVram(0, 1);
CopyWindowToVram(0, COPYWIN_MAP);
DestroyListMenuTask(data[0], NULL, NULL);
RestorePlayerBag();
Bag_BeginCloseWin0Animation();
@@ -2242,7 +2242,7 @@ static void Task_Bag_TeachyTvRegister(u8 taskId)
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, gBagMenuState.cursorPos[gBagMenuState.pocket], gBagMenuState.itemsAbove[gBagMenuState.pocket]);
Bag_FillMessageBoxWithPalette(0);
bag_menu_print_cursor_(data[0], 1);
CopyWindowToVram(0, 1);
CopyWindowToVram(0, COPYWIN_MAP);
break;
case 510:
case 612:
@@ -2305,7 +2305,7 @@ static void Task_Bag_TeachyTvCatching(u8 taskId)
HideBagWindow(6);
PutWindowTilemap(0);
PutWindowTilemap(1);
CopyWindowToVram(0, 1);
CopyWindowToVram(0, COPYWIN_MAP);
DestroyListMenuTask(data[0], NULL, NULL);
RestorePlayerBag();
Bag_BeginCloseWin0Animation();
@@ -2347,7 +2347,7 @@ static void Task_Bag_TeachyTvStatus(u8 taskId)
HideBagWindow(6);
PutWindowTilemap(0);
PutWindowTilemap(1);
CopyWindowToVram(0, 1);
CopyWindowToVram(0, COPYWIN_MAP);
DestroyListMenuTask(data[0], NULL, NULL);
RestorePlayerBag();
gItemUseCB = ItemUseCB_MedicineStep;
@@ -2388,7 +2388,7 @@ static void Task_Bag_TeachyTvTMs(u8 taskId)
HideBagWindow(6);
PutWindowTilemap(0);
PutWindowTilemap(1);
CopyWindowToVram(0, 1);
CopyWindowToVram(0, COPYWIN_MAP);
DestroyListMenuTask(data[0], NULL, NULL);
RestorePlayerBag();
sBagMenuDisplay->exitCB = Pokedude_InitTMCase;
+22 -22
View File
@@ -120,14 +120,14 @@ static const struct MenuAction sItemPcSubmenuOptions[] = {
{gFameCheckerText_Cancel, {.void_u8 = Task_ItemPcCancel}}
};
static const u8 gUnknown_8453F8C[][3] = {
{0, 1, 2},
{0, 2, 3},
{0, 3, 2},
{0, 10, 2}
static const u8 sTextColors[][3] = {
{TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY},
{TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY},
{TEXT_COLOR_TRANSPARENT, TEXT_COLOR_LIGHT_GREY, TEXT_COLOR_DARK_GREY},
{TEXT_COLOR_TRANSPARENT, TEXT_DYNAMIC_COLOR_1, TEXT_COLOR_DARK_GREY}
};
static const struct WindowTemplate gUnknown_8453F98[] = {
static const struct WindowTemplate sWindowTemplates[] = {
{
.bg = 0,
.tilemapLeft = 0x07,
@@ -179,7 +179,7 @@ static const struct WindowTemplate gUnknown_8453F98[] = {
}, DUMMY_WIN_TEMPLATE
};
static const struct WindowTemplate gUnknown_8453FD0[] = {
static const struct WindowTemplate sSubwindowTemplates[] = {
{
.bg = 0,
.tilemapLeft = 0x06,
@@ -207,11 +207,11 @@ static const struct WindowTemplate gUnknown_8453FD0[] = {
}
};
void ItemPc_Init(u8 a0, MainCallback callback)
void ItemPc_Init(u8 kind, MainCallback callback)
{
u8 i;
if (a0 >= 2)
if (kind >= 2)
{
SetMainCallback2(callback);
return;
@@ -221,7 +221,7 @@ void ItemPc_Init(u8 a0, MainCallback callback)
SetMainCallback2(callback);
return;
}
if (a0 != 1)
if (kind != 1)
{
sListMenuState.savedCallback = callback;
sListMenuState.scroll = sListMenuState.row = 0;
@@ -373,7 +373,7 @@ static bool8 ItemPc_DoGfxSetup(void)
else
{
BeginPCScreenEffect_TurnOn(0, 0, 0);
ItemPc_SetInitializedFlag(1);
ItemPc_SetInitializedFlag(TRUE);
PlaySE(SE_PC_LOGIN);
}
gMain.state++;
@@ -702,15 +702,15 @@ static void ItemPc_SetScrollPosition(void)
}
}
static void ItemPc_SetMessageWindowPalette(int a0)
static void ItemPc_SetMessageWindowPalette(int palIdx)
{
SetBgTilemapPalette(1, 0, 14, 30, 6, a0 + 1);
SetBgTilemapPalette(1, 0, 14, 30, 6, palIdx + 1);
ScheduleBgCopyTilemapToVram(1);
}
void ItemPc_SetInitializedFlag(u8 a0)
void ItemPc_SetInitializedFlag(bool8 flag)
{
sListMenuState.initialized = a0;
sListMenuState.initialized = flag;
}
static void Task_ItemPcMain(u8 taskId)
@@ -740,7 +740,7 @@ static void Task_ItemPcMain(u8 taskId)
break;
case -2:
PlaySE(SE_SELECT);
ItemPc_SetInitializedFlag(0);
ItemPc_SetInitializedFlag(FALSE);
gTasks[taskId].func = Task_ItemPcTurnOff1;
break;
default:
@@ -965,9 +965,9 @@ static void ItemPc_WithdrawMultipleInitWindow(u16 slotId)
ScheduleBgCopyTilemapToVram(0);
}
static void sub_810E670(s16 quantity)
static void UpdateWithdrawQuantityDisplay(s16 quantity)
{
FillWindowPixelRect(3, 0x11, 10, 10, 28, 12);
FillWindowPixelRect(3, PIXEL_FILL(1), 10, 10, 28, 12);
ConvertIntToDecimalStringN(gStringVar1, quantity, STR_CONV_MODE_LEADING_ZEROS, 3);
StringExpandPlaceholders(gStringVar4, gText_TimesStrVar1);
ItemPc_AddTextPrinterParameterized(3, 0, gStringVar4, 8, 10, 1, 0, 0, 1);
@@ -978,7 +978,7 @@ static void Task_ItemPcHandleWithdrawMultiple(u8 taskId)
s16 * data = gTasks[taskId].data;
if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE)
sub_810E670(data[8]);
UpdateWithdrawQuantityDisplay(data[8]);
else if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
@@ -1067,7 +1067,7 @@ static void ItemPc_InitWindows(void)
{
u8 i;
InitWindows(gUnknown_8453F98);
InitWindows(sWindowTemplates);
DeactivateAllTextPrinters();
TextWindow_SetUserSelectedFrame(0, 0x3C0, 0xE0);
TextWindow_SetStdFrame0_WithPal(0, 0x3A3, 0xC0);
@@ -1106,7 +1106,7 @@ static void unused_ItemPc_AddTextPrinterParameterized(u8 windowId, const u8 * st
static void ItemPc_AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, u8 speed, u8 colorIdx)
{
AddTextPrinterParameterized4(windowId, fontId, x, y, letterSpacing, lineSpacing, gUnknown_8453F8C[colorIdx], speed, str);
AddTextPrinterParameterized4(windowId, fontId, x, y, letterSpacing, lineSpacing, sTextColors[colorIdx], speed, str);
}
static void ItemPc_SetBorderStyleOnWindow(u8 windowId)
@@ -1118,7 +1118,7 @@ static u8 ItemPc_GetOrCreateSubwindow(u8 idx)
{
if (sSubmenuWindowIds[idx] == 0xFF)
{
sSubmenuWindowIds[idx] = AddWindow(&gUnknown_8453FD0[idx]);
sSubmenuWindowIds[idx] = AddWindow(&sSubwindowTemplates[idx]);
DrawStdFrameWithCustomTileAndPalette(sSubmenuWindowIds[idx], TRUE, 0x3A3, 0x0C);
}
+12 -12
View File
@@ -594,7 +594,7 @@ static void PrintTeachWhichMoveToStrVar1(bool8 onInit)
StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToMon);
PrintTextOnWindow(7, gStringVar4, 0, 2, 0, 2);
PutWindowTilemap(7);
CopyWindowToVram(7, 3);
CopyWindowToVram(7, COPYWIN_BOTH);
}
}
@@ -714,7 +714,7 @@ static void MoveRelearnerMenuHandleInput(void)
static void MoveLearnerInitListMenu(void)
{
sMoveRelearner->listMenuTaskId = ListMenuInit(&gMultiuseListMenuTemplate, sMoveRelearner->listMenuScrollPos, sMoveRelearner->listMenuScrollRow);
CopyWindowToVram(6, 1);
CopyWindowToVram(6, COPYWIN_MAP);
}
static void PrintMoveInfo(u16 move)
@@ -760,8 +760,8 @@ static void LoadMoveInfoUI(void)
PutWindowTilemap(5);
PutWindowTilemap(2);
PutWindowTilemap(7);
CopyWindowToVram(0, 2);
CopyWindowToVram(1, 2);
CopyWindowToVram(0, COPYWIN_GFX);
CopyWindowToVram(1, COPYWIN_GFX);
}
static void PrintMoveInfoHandleCancel_CopyToVram(void)
@@ -776,15 +776,15 @@ static void PrintMoveInfoHandleCancel_CopyToVram(void)
for (i = 2; i < 6; i++)
{
FillWindowPixelBuffer(i, PIXEL_FILL(0));
CopyWindowToVram(i, 2);
CopyWindowToVram(i, COPYWIN_GFX);
}
}
CopyWindowToVram(3, 2);
CopyWindowToVram(4, 2);
CopyWindowToVram(2, 2);
CopyWindowToVram(2, 2);
CopyWindowToVram(5, 2);
CopyWindowToVram(7, 3);
CopyWindowToVram(3, COPYWIN_GFX);
CopyWindowToVram(4, COPYWIN_GFX);
CopyWindowToVram(2, COPYWIN_GFX);
CopyWindowToVram(2, COPYWIN_GFX);
CopyWindowToVram(5, COPYWIN_GFX);
CopyWindowToVram(7, COPYWIN_BOTH);
}
static void MoveRelearnerMenu_MoveCursorFunc(s32 itemIndex, bool8 onInit, struct ListMenu *list)
@@ -803,7 +803,7 @@ static s8 YesNoMenuProcessInput(void)
if (input != -2)
{
PutWindowTilemap(6);
CopyWindowToVram(6, 1);
CopyWindowToVram(6, COPYWIN_MAP);
}
return input;
}
+10 -10
View File
@@ -380,7 +380,7 @@ void OpenLink(void)
{
sub_80F86F4();
}
gReceivedRemoteLinkPlayers = 0;
gReceivedRemoteLinkPlayers = FALSE;
for (i = 0; i < MAX_LINK_PLAYERS; i++)
{
gRemoteLinkPlayersNotReceived[i] = TRUE;
@@ -515,9 +515,9 @@ void HandleReceiveRemoteLinkPlayer(u8 who)
{
count += gRemoteLinkPlayersNotReceived[i];
}
if (count == 0 && gReceivedRemoteLinkPlayers == 0)
if (count == 0 && !gReceivedRemoteLinkPlayers)
{
gReceivedRemoteLinkPlayers = 1;
gReceivedRemoteLinkPlayers = TRUE;
}
}
@@ -1513,7 +1513,7 @@ void sub_800AE1C(void)
PutWindowTilemap(0);
PutWindowTilemap(2);
CopyWindowToVram(0, 0);
CopyWindowToVram(2, 3);
CopyWindowToVram(2, COPYWIN_BOTH);
ShowBg(0);
ShowBg(1);
}
@@ -1526,7 +1526,7 @@ void sub_800AED0(void)
PutWindowTilemap(1);
PutWindowTilemap(2);
CopyWindowToVram(1, 0);
CopyWindowToVram(2, 3);
CopyWindowToVram(2, COPYWIN_BOTH);
ShowBg(0);
}
@@ -1656,7 +1656,7 @@ bool8 HandleLinkConnection(void)
{
gLinkStatus = LinkMain1(&gShouldAdvanceLinkState, gSendCmd, gRecvCmds);
LinkMain2(&gMain.heldKeys);
if ((gLinkStatus & LINK_STAT_RECEIVED_NOTHING) && sub_8058318() == TRUE)
if ((gLinkStatus & LINK_STAT_RECEIVED_NOTHING) && IsSendingKeysOverCable() == TRUE)
{
return TRUE;
}
@@ -1665,7 +1665,7 @@ bool8 HandleLinkConnection(void)
{
r4 = LinkRfuMain1();
r5 = LinkRfuMain2();
if (sub_8058318() == TRUE)
if (IsSendingKeysOverCable() == TRUE)
{
if (r4 == TRUE || IsRfuRecvQueueEmpty() || r5)
{
@@ -1678,7 +1678,7 @@ bool8 HandleLinkConnection(void)
void SetWirelessCommType1(void)
{
if (gReceivedRemoteLinkPlayers == 0)
if (!gReceivedRemoteLinkPlayers)
{
gWirelessCommType = 1;
}
@@ -1686,7 +1686,7 @@ void SetWirelessCommType1(void)
static void SetWirelessCommType0(void)
{
if (gReceivedRemoteLinkPlayers == 0)
if (!gReceivedRemoteLinkPlayers)
{
gWirelessCommType = 0;
}
@@ -1694,7 +1694,7 @@ static void SetWirelessCommType0(void)
void SetWirelessCommType0_UnusedCopy(void)
{
if (gReceivedRemoteLinkPlayers == 0)
if (!gReceivedRemoteLinkPlayers)
{
gWirelessCommType = 0;
}
+9 -9
View File
@@ -45,7 +45,7 @@ static void RfuFunc_SendNextBlock(void);
static void RfuFunc_SendLastBlock(void);
static void CallRfuFunc(void);
static void sub_80FA738(void);
static int sub_80FA788(void);
static s32 sub_80FA788(void);
static void sub_80FA834(u8 taskId);
static void sub_80FA9D0(u16 a0);
static void ValidateAndReceivePokemonSioInfo(void * a0);
@@ -712,7 +712,7 @@ static bool32 sub_80F911C(void)
if (!lman.acceptSlot_flag)
{
LinkRfu_Shutdown();
gReceivedRemoteLinkPlayers = 0;
gReceivedRemoteLinkPlayers = FALSE;
return FALSE;
}
}
@@ -985,7 +985,7 @@ static void RfuHandleReceiveCommand(u8 unused)
switch (gRecvCmds[i][0] & 0xff00)
{
case RFU_COMMAND_0x7800:
if (Rfu.parent_child == MODE_CHILD && gReceivedRemoteLinkPlayers != 0)
if (Rfu.parent_child == MODE_CHILD && gReceivedRemoteLinkPlayers)
return;
// fallthrough
case RFU_COMMAND_0x7700:
@@ -1017,7 +1017,7 @@ static void RfuHandleReceiveCommand(u8 unused)
{
Rfu.cmd_8800_recvbuf[i].receiving = 2;
Rfu_SetBlockReceivedFlag(i);
if (GetHostRFUtgtGname()->activity == (ACTIVITY_CHAT | IN_UNION_ROOM) && gReceivedRemoteLinkPlayers != 0 && Rfu.parent_child == MODE_CHILD)
if (GetHostRFUtgtGname()->activity == (ACTIVITY_CHAT | IN_UNION_ROOM) && gReceivedRemoteLinkPlayers && Rfu.parent_child == MODE_CHILD)
ValidateAndReceivePokemonSioInfo(gBlockRecvBuffer);
}
}
@@ -1035,11 +1035,11 @@ static void RfuHandleReceiveCommand(u8 unused)
case RFU_COMMAND_0xed00:
if (Rfu.parent_child == MODE_CHILD)
{
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
if (gRecvCmds[i][1] & gRfuLinkStatus->connSlotFlag)
{
gReceivedRemoteLinkPlayers = 0;
gReceivedRemoteLinkPlayers = FALSE;
rfu_LMAN_requestChangeAgbClockMaster();
Rfu.unk_ce4 = gRecvCmds[i][2];
}
@@ -1283,7 +1283,7 @@ static void RfuFunc_End5F00_PowerDownRfu(void)
{
rfu_clearAllSlot();
rfu_LMAN_powerDownRFU();
gReceivedRemoteLinkPlayers = 0;
gReceivedRemoteLinkPlayers = FALSE;
Rfu.isShuttingDown = TRUE;
Rfu.RfuFunc = NULL;
}
@@ -1682,7 +1682,7 @@ static void sub_80FA834(u8 taskId)
break;
case 6:
DestroyTask(taskId);
gReceivedRemoteLinkPlayers = 1;
gReceivedRemoteLinkPlayers = TRUE;
Rfu.unk_ce8 = FALSE;
rfu_LMAN_setLinkRecovery(1, 600);
if (Rfu.unionRoomChatters)
@@ -1836,7 +1836,7 @@ static void sub_80FACF0(u8 taskId)
{
ReceiveRfuLinkPlayers((const struct SioInfo *)gBlockRecvBuffer);
ResetBlockReceivedFlag(0);
gReceivedRemoteLinkPlayers = 1;
gReceivedRemoteLinkPlayers = TRUE;
DestroyTask(taskId);
}
break;
+7 -7
View File
@@ -122,7 +122,7 @@ s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const str
gMultiuseListMenuTemplate = *listMenuTemplate;
gMultiuseListMenuTemplate.windowId = sMysteryGiftLinkMenu.windowId;
sMysteryGiftLinkMenu.listTaskId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0);
CopyWindowToVram(sMysteryGiftLinkMenu.windowId, 1);
CopyWindowToVram(sMysteryGiftLinkMenu.windowId, COPYWIN_MAP);
sMysteryGiftLinkMenu.state = 1;
break;
case 1:
@@ -155,7 +155,7 @@ s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const str
break;
}
}
CopyWindowToVram(sMysteryGiftLinkMenu.windowId, 1);
CopyWindowToVram(sMysteryGiftLinkMenu.windowId, COPYWIN_MAP);
}
break;
case 2:
@@ -171,7 +171,7 @@ u8 ListMenuInit(const struct ListMenuTemplate *listMenuTemplate, u16 cursorPos,
{
u8 taskId = ListMenuInitInternal(listMenuTemplate, cursorPos, itemsAbove);
PutWindowTilemap(listMenuTemplate->windowId);
CopyWindowToVram(listMenuTemplate->windowId, 2);
CopyWindowToVram(listMenuTemplate->windowId, COPYWIN_GFX);
return taskId;
}
@@ -182,7 +182,7 @@ u8 ListMenuInitInRect(const struct ListMenuTemplate *listMenuTemplate, const str
for (i = 0; rect[i].palNum != 0xFF; i++)
PutWindowRectTilemapOverridePalette(listMenuTemplate->windowId, rect[i].x, rect[i].y, rect[i].width, rect[i].height, rect[i].palNum);
CopyWindowToVram(listMenuTemplate->windowId, 2);
CopyWindowToVram(listMenuTemplate->windowId, COPYWIN_GFX);
return taskId;
}
@@ -266,7 +266,7 @@ void RedrawListMenu(u8 listTaskId)
FillWindowPixelBuffer(list->template.windowId, PIXEL_FILL(list->template.fillValue));
ListMenuPrintEntries(list, list->cursorPos, 0, list->template.maxShowed);
ListMenuDrawCursor(list);
CopyWindowToVram(list->template.windowId, 2);
CopyWindowToVram(list->template.windowId, COPYWIN_GFX);
}
static void ChangeListMenuPals(u8 listTaskId, u8 cursorPal, u8 fillValue, u8 cursorShadowPal)
@@ -611,7 +611,7 @@ static bool8 ListMenuChangeSelection(struct ListMenu *list, bool8 updateCursorAn
ListMenuErasePrintedCursor(list, oldSelectedRow);
ListMenuDrawCursor(list);
ListMenuCallSelectionChangedCallback(list, FALSE);
CopyWindowToVram(list->template.windowId, 2);
CopyWindowToVram(list->template.windowId, COPYWIN_GFX);
break;
case 2:
case 3:
@@ -619,7 +619,7 @@ static bool8 ListMenuChangeSelection(struct ListMenu *list, bool8 updateCursorAn
ListMenuScroll(list, cursorCount, movingDown);
ListMenuDrawCursor(list);
ListMenuCallSelectionChangedCallback(list, FALSE);
CopyWindowToVram(list->template.windowId, 2);
CopyWindowToVram(list->template.windowId, COPYWIN_GFX);
break;
}
}
+2 -2
View File
@@ -677,8 +677,8 @@ static void AddMailMessagePrinters(void)
width = GetStringWidth(1, gText_From, 0);
AddTextPrinterParameterized3(1, 1, sMailViewResources->nameX, sMailViewResources->messageLayout->nameY, sTextColor, 0, gText_From);
AddTextPrinterParameterized3(1, 1, sMailViewResources->nameX + width, sMailViewResources->messageLayout->nameY, sTextColor, 0, sMailViewResources->authorNameBuffer);
CopyWindowToVram(0, 3);
CopyWindowToVram(1, 3);
CopyWindowToVram(0, COPYWIN_BOTH);
CopyWindowToVram(1, COPYWIN_BOTH);
}
static void VBlankCB_ShowMail(void)
+43 -9
View File
@@ -28,11 +28,15 @@ const u8 gGameVersion = GAME_VERSION;
const u8 gGameLanguage = GAME_LANGUAGE;
#if MODERN
const char BuildDateTime[] = __DATE__ " " __TIME__;
#else
#if REVISION == 0
const char BuildDateTime[] = "2004 04 26 11:20";
#else
const char BuildDateTime[] = "2004 07 20 09:30";
#endif
#endif //REVISION
#endif //MODERN
const IntrFunc gIntrTableTemplate[] =
{
@@ -84,7 +88,37 @@ void EnableVCountIntrAtLine150(void);
void AgbMain()
{
#if MODERN
// Modern compilers are liberal with the stack on entry to this function,
// so RegisterRamReset may crash if it resets IWRAM.
RegisterRamReset(RESET_ALL & ~RESET_IWRAM);
asm("mov\tr1, #0xC0\n"
"\tlsl\tr1, r1, #0x12\n"
"\tmov\tr2, #0xFC\n"
"\tlsl\tr2, r2, #0x7\n"
"\tadd\tr2, r1, r2\n"
"\tmov\tr0, #0\n"
"\tmov\tr3, r0\n"
"\tmov\tr4, r0\n"
"\tmov\tr5, r0\n"
".LCU%=:\n"
"\tstmia\tr1!, {r0, r3, r4, r5}\n"
"\tstmia\tr1!, {r0, r3, r4, r5}\n"
"\tstmia\tr1!, {r0, r3, r4, r5}\n"
"\tstmia\tr1!, {r0, r3, r4, r5}\n"
"\tstmia\tr1!, {r0, r3, r4, r5}\n"
"\tstmia\tr1!, {r0, r3, r4, r5}\n"
"\tstmia\tr1!, {r0, r3, r4, r5}\n"
"\tstmia\tr1!, {r0, r3, r4, r5}\n"
"\tcmp\tr1, r2\n"
"\tbcc\t.LCU%=\n"
:
:
: "r0", "r1", "r2", "r3", "r4", "r5", "memory"
);
#else
RegisterRamReset(RESET_ALL);
#endif //MODERN
*(vu16 *)BG_PLTT = RGB_WHITE;
InitGpuRegManager();
REG_WAITCNT = WAITCNT_PREFETCH_ENABLE | WAITCNT_WS0_S_1 | WAITCNT_WS0_N_3;
@@ -98,7 +132,7 @@ void AgbMain()
InitMapMusic();
ClearDma3Requests();
ResetBgs();
InitHeap(gHeap, 0x1C000);
InitHeap(gHeap, HEAP_SIZE);
SetDefaultFontsPointer();
gSoftResetDisabled = FALSE;
@@ -128,7 +162,7 @@ void AgbMain()
DoSoftReset();
}
if (sub_80582E0() == 1)
if (Overworld_SendKeysToLinkIsRunning() == TRUE)
{
gLinkTransferringData = TRUE;
UpdateLinkAndCallCallbacks();
@@ -139,7 +173,7 @@ void AgbMain()
gLinkTransferringData = FALSE;
UpdateLinkAndCallCallbacks();
if (sub_8058274() == 1)
if (Overworld_RecvKeysFromLinkIsRunning() == 1)
{
gMain.newKeys = 0;
ClearSpriteCopyRequests();
@@ -259,16 +293,16 @@ static void ReadKeys(void)
gMain.heldKeys = gMain.heldKeysRaw;
// Remap L to A if the L=A option is enabled.
if (gSaveBlock2Ptr->optionsButtonMode == 2)
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
{
if (gMain.newKeys & L_BUTTON)
if (JOY_NEW(L_BUTTON))
gMain.newKeys |= A_BUTTON;
if (gMain.heldKeys & L_BUTTON)
if (JOY_HELD(L_BUTTON))
gMain.heldKeys |= A_BUTTON;
}
if (gMain.newKeys & gMain.watchedKeysMask)
if (JOY_NEW(gMain.watchedKeysMask))
gMain.watchedKeysPressed = TRUE;
}
@@ -289,7 +323,7 @@ void InitIntrHandlers(void)
REG_IME = 1;
EnableInterrupts(0x1);
EnableInterrupts(INTR_FLAG_VBLANK);
}
void SetVBlankCallback(IntrCallback callback)
+13 -13
View File
@@ -352,7 +352,7 @@ static void Task_PrintMainMenuText(u8 taskId)
AddTextPrinterParameterized3(MAIN_MENU_WINDOW_NEWGAME_ONLY, 2, 2, 2, sTextColor1, -1, gText_NewGame);
MainMenu_DrawWindow(&sWindowTemplate[MAIN_MENU_WINDOW_NEWGAME_ONLY]);
PutWindowTilemap(MAIN_MENU_WINDOW_NEWGAME_ONLY);
CopyWindowToVram(MAIN_MENU_WINDOW_NEWGAME_ONLY, 3);
CopyWindowToVram(MAIN_MENU_WINDOW_NEWGAME_ONLY, COPYWIN_BOTH);
break;
case MAIN_MENU_CONTINUE:
FillWindowPixelBuffer(MAIN_MENU_WINDOW_CONTINUE, PIXEL_FILL(10));
@@ -364,8 +364,8 @@ static void Task_PrintMainMenuText(u8 taskId)
MainMenu_DrawWindow(&sWindowTemplate[MAIN_MENU_WINDOW_NEWGAME]);
PutWindowTilemap(MAIN_MENU_WINDOW_CONTINUE);
PutWindowTilemap(MAIN_MENU_WINDOW_NEWGAME);
CopyWindowToVram(MAIN_MENU_WINDOW_CONTINUE, 2);
CopyWindowToVram(MAIN_MENU_WINDOW_NEWGAME, 3);
CopyWindowToVram(MAIN_MENU_WINDOW_CONTINUE, COPYWIN_GFX);
CopyWindowToVram(MAIN_MENU_WINDOW_NEWGAME, COPYWIN_BOTH);
break;
case MAIN_MENU_MYSTERYGIFT:
FillWindowPixelBuffer(MAIN_MENU_WINDOW_CONTINUE, PIXEL_FILL(10));
@@ -382,9 +382,9 @@ static void Task_PrintMainMenuText(u8 taskId)
PutWindowTilemap(MAIN_MENU_WINDOW_CONTINUE);
PutWindowTilemap(MAIN_MENU_WINDOW_NEWGAME);
PutWindowTilemap(MAIN_MENU_WINDOW_MYSTERYGIFT);
CopyWindowToVram(MAIN_MENU_WINDOW_CONTINUE, 2);
CopyWindowToVram(MAIN_MENU_WINDOW_NEWGAME, 2);
CopyWindowToVram(MAIN_MENU_WINDOW_MYSTERYGIFT, 3);
CopyWindowToVram(MAIN_MENU_WINDOW_CONTINUE, COPYWIN_GFX);
CopyWindowToVram(MAIN_MENU_WINDOW_NEWGAME, COPYWIN_GFX);
CopyWindowToVram(MAIN_MENU_WINDOW_MYSTERYGIFT, COPYWIN_BOTH);
break;
}
gTasks[taskId].func = Task_WaitDma3AndFadeIn;
@@ -392,7 +392,7 @@ static void Task_PrintMainMenuText(u8 taskId)
static void Task_WaitDma3AndFadeIn(u8 taskId)
{
if (CheckForSpaceForDma3Request(-1) != -1)
if (WaitDma3Request(-1) != -1)
{
gTasks[taskId].func = Task_UpdateVisualSelection;
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0xFFFF);
@@ -534,7 +534,7 @@ static void Task_ReturnToTileScreen(u8 taskId)
static void MoveWindowByMenuTypeAndCursorPos(u8 menuType, u8 cursorPos)
{
u16 win0vTop, win0vBot;
SetGpuReg(REG_OFFSET_WIN0H, 0x12DE);
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(18, 222));
switch (menuType)
{
default:
@@ -578,8 +578,8 @@ static bool8 HandleMenuInput(u8 taskId)
{
PlaySE(SE_SELECT);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
SetGpuReg(REG_OFFSET_WIN0H, 0xF0);
SetGpuReg(REG_OFFSET_WIN0V, 0xA0);
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, 240));
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, 160));
gTasks[taskId].func = Task_ReturnToTileScreen;
}
else if (JOY_NEW(DPAD_UP) && gTasks[taskId].tCursorPos > 0)
@@ -602,9 +602,9 @@ static void PrintMessageOnWindow4(const u8 *str)
MainMenu_DrawWindow(&sWindowTemplate[4]);
AddTextPrinterParameterized3(MAIN_MENU_WINDOW_ERROR, 2, 0, 2, sTextColor1, 2, str);
PutWindowTilemap(MAIN_MENU_WINDOW_ERROR);
CopyWindowToVram(MAIN_MENU_WINDOW_ERROR, 2);
SetGpuReg(REG_OFFSET_WIN0H, 0x13DD);
SetGpuReg(REG_OFFSET_WIN0V, 0x739D);
CopyWindowToVram(MAIN_MENU_WINDOW_ERROR, COPYWIN_GFX);
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE( 19, 221));
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(115, 157));
}
static void PrintContinueStats(void)
+3 -3
View File
@@ -84,7 +84,7 @@ static void Task_MapNamePopup(u8 taskId)
if (task->tReshow)
{
MapNamePopupPrintMapNameOnWindow(task->tWindowId);
CopyWindowToVram(task->tWindowId, 2);
CopyWindowToVram(task->tWindowId, COPYWIN_GFX);
task->tState = 1;
task->tReshow = FALSE;
}
@@ -100,7 +100,7 @@ static void Task_MapNamePopup(u8 taskId)
if (task->tWindowExists && !task->tWindowCleared)
{
rbox_fill_rectangle(task->tWindowId);
CopyWindowToVram(task->tWindowId, 1);
CopyWindowToVram(task->tWindowId, COPYWIN_MAP);
task->tWindowCleared = TRUE;
}
task->tState = 7;
@@ -183,7 +183,7 @@ static u16 MapNamePopupCreateWindow(bool32 palintoFadedBuffer)
DrawTextBorderOuter(windowId, r6, 0xD);
PutWindowTilemap(windowId);
MapNamePopupPrintMapNameOnWindow(windowId);
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
return windowId;
}
+1 -1
View File
@@ -479,7 +479,7 @@ static void Task_RunMapPreviewScreenForest(u8 taskId)
case 0:
if (!MapPreview_IsGfxLoadFinished() && !IsDma3ManagerBusyWithBgCopy())
{
CopyWindowToVram(data[11], 3);
CopyWindowToVram(data[11], COPYWIN_BOTH);
data[0]++;
}
break;
+9 -9
View File
@@ -1,6 +1,6 @@
#include "global.h"
s16 sub_80D8AA0(s16 x, s16 y)
s16 MathUtil_Mul16(s16 x, s16 y)
{
s32 result;
@@ -10,7 +10,7 @@ s16 sub_80D8AA0(s16 x, s16 y)
return result;
}
s16 sub_80D8ABC(u8 s, s16 x, s16 y)
s16 MathUtil_Mul16Shift(u8 s, s16 x, s16 y)
{
s32 result;
@@ -20,7 +20,7 @@ s16 sub_80D8ABC(u8 s, s16 x, s16 y)
return result;
}
s32 sub_80D8AE0(s32 x, s32 y)
s32 MathUtil_Mul32(s32 x, s32 y)
{
s64 result;
@@ -30,7 +30,7 @@ s32 sub_80D8AE0(s32 x, s32 y)
return result;
}
s16 sub_80D8B1C(s16 x, s16 y)
s16 MathUtil_Div16(s16 x, s16 y)
{
if (y == 0)
{
@@ -39,7 +39,7 @@ s16 sub_80D8B1C(s16 x, s16 y)
return (x << 8) / y;
}
s16 sub_80D8B40(u8 s, s16 x, s16 y)
s16 MathUtil_Div16Shift(u8 s, s16 x, s16 y)
{
if (y == 0)
{
@@ -48,7 +48,7 @@ s16 sub_80D8B40(u8 s, s16 x, s16 y)
return (x << s) / y;
}
s32 sub_80D8B68(s32 x, s32 y)
s32 MathUtil_Div32(s32 x, s32 y)
{
s64 _x;
@@ -61,7 +61,7 @@ s32 sub_80D8B68(s32 x, s32 y)
return _x / y;
}
s16 sub_80D8B90(s16 y)
s16 MathUtil_Inv16(s16 y)
{
s32 x;
@@ -69,7 +69,7 @@ s16 sub_80D8B90(s16 y)
return x / y;
}
s16 sub_80D8BA8(u8 s, s16 y)
s16 MathUtil_Inv16Shift(u8 s, s16 y)
{
s32 x;
@@ -77,7 +77,7 @@ s16 sub_80D8BA8(u8 s, s16 y)
return x / y;
}
s32 sub_80D8BC8(s32 y)
s32 MathUtil_Inv32(s32 y)
{
s64 x;
+16 -16
View File
@@ -44,7 +44,7 @@ void DrawDialogFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
// not used
@@ -56,7 +56,7 @@ static void DrawDialogFrameWithCustomTile(u8 windowId, bool8 copyToVram, u16 til
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
static void WindowFunc_DrawDialogFrameWithCustomTileAndPalette(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
@@ -96,7 +96,7 @@ void ClearDialogWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram)
FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
ClearWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
static void WindowFunc_ClearDialogWindowAndFrameNullPalette(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
@@ -112,7 +112,7 @@ void DrawStdFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 bas
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
// not used
@@ -124,7 +124,7 @@ static void DrawStdFrameWithCustomTile(u8 windowId, bool8 copyToVram, u16 baseTi
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
static void WindowFunc_DrawStdFrameWithCustomTileAndPalette(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
@@ -145,7 +145,7 @@ void ClearStdWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram)
FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
ClearWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
static void WindowFunc_ClearStdWindowAndFrameToTransparent(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
@@ -195,7 +195,7 @@ void TopBarWindowPrintString(const u8 *string, u8 unused, bool8 copyToVram)
width = GetStringWidth(0, string, 0);
AddTextPrinterParameterized3(sTopBarWindowId, 0, -20 - width, 1, gUnknown_8456618, 0, string);
if (copyToVram)
CopyWindowToVram(sTopBarWindowId, 3);
CopyWindowToVram(sTopBarWindowId, COPYWIN_BOTH);
}
}
@@ -228,7 +228,7 @@ void TopBarWindowPrintTwoStrings(const u8 *string, const u8 *string2, bool8 fgCo
}
AddTextPrinterParameterized4(sTopBarWindowId, 1, 4, 1, 0, 0, color, 0, string);
if (copyToVram)
CopyWindowToVram(sTopBarWindowId, 3);
CopyWindowToVram(sTopBarWindowId, COPYWIN_BOTH);
}
}
@@ -236,7 +236,7 @@ void TopBarWindowPrintTwoStrings(const u8 *string, const u8 *string2, bool8 fgCo
static void CopyTopBarWindowToVram(void)
{
if (sTopBarWindowId != 0xFF)
CopyWindowToVram(sTopBarWindowId, 3);
CopyWindowToVram(sTopBarWindowId, COPYWIN_BOTH);
}
void ClearTopBarWindow(void)
@@ -244,7 +244,7 @@ void ClearTopBarWindow(void)
if (sTopBarWindowId != 0xFF)
{
FillWindowPixelBuffer(sTopBarWindowId, PIXEL_FILL(15));
CopyWindowToVram(sTopBarWindowId, 3);
CopyWindowToVram(sTopBarWindowId, COPYWIN_BOTH);
}
}
@@ -254,7 +254,7 @@ void DestroyTopBarWindow(void)
{
FillWindowPixelBuffer(sTopBarWindowId, PIXEL_FILL(0));
ClearWindowTilemap(sTopBarWindowId);
CopyWindowToVram(sTopBarWindowId, 3);
CopyWindowToVram(sTopBarWindowId, COPYWIN_BOTH);
RemoveWindow(sTopBarWindowId);
sTopBarWindowId = 0xFF;
}
@@ -457,7 +457,7 @@ void PrintTextArray(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 i
for (i = 0; i < itemCount; i++)
AddTextPrinterParameterized(windowId, fontId, strs[i].text, left, (lineHeight * i) + top, 0xFF, NULL);
CopyWindowToVram(windowId, 2);
CopyWindowToVram(windowId, COPYWIN_GFX);
}
void MultichoiceList_PrintItems(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, u8 letterSpacing, u8 lineSpacing)
@@ -466,7 +466,7 @@ void MultichoiceList_PrintItems(u8 windowId, u8 fontId, u8 left, u8 top, u8 line
for (i = 0; i < itemCount; i++)
AddTextPrinterParameterized5(windowId, fontId, strs[i].text, left, (lineHeight * i) + top, 0xFF, NULL, letterSpacing, lineSpacing);
CopyWindowToVram(windowId, 2);
CopyWindowToVram(windowId, COPYWIN_GFX);
}
void UnionRoomAndTradeMenuPrintOptions(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const struct MenuAction *strs)
@@ -498,7 +498,7 @@ void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 l
printer.currentY = printer.y;
AddTextPrinter(&printer, 0xFF, NULL);
}
CopyWindowToVram(windowId, 2);
CopyWindowToVram(windowId, COPYWIN_GFX);
}
// not used
@@ -583,7 +583,7 @@ void MultichoiceGrid_PrintItems(u8 windowId, u8 fontId, u8 itemWidth, u8 itemHei
for (i = 0; i < rows; ++i)
for (j = 0; j < cols; ++j)
AddTextPrinterParameterized(windowId, fontId, strs[i * cols + j].text, itemWidth * j + width, yOffset + itemHeight * i, 0xFF, 0);
CopyWindowToVram(windowId, 2);
CopyWindowToVram(windowId, COPYWIN_GFX);
}
//not used
@@ -598,7 +598,7 @@ static void MultichoiceGrid_PrintItemsCustomOrder(u8 windowId, u8 fontId, u8 ite
for (i = 0; i < rows; ++i)
for (j = 0; j < cols; ++j)
AddTextPrinterParameterized(windowId, fontId, strs[orderArray[i * cols + j]].text, itemWidth * j + width, itemHeight * i, 0xFF, 0);
CopyWindowToVram(windowId, 2);
CopyWindowToVram(windowId, COPYWIN_GFX);
}
static u8 MultichoiceGrid_InitCursorInternal(u8 windowId, u8 fontId, u8 left, u8 top, u8 optionWidth, u8 cursorHeight, u8 cols, u8 rows, u8 numChoices, u8 cursorPos)
+18 -18
View File
@@ -169,17 +169,17 @@ void ResetAllBgsCoordinatesAndBgCntRegs(void)
ChangeBgY(3, 0, 0);
}
bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
bool8 AdjustQuantityAccordingToDPadInput(s16 *quantity_p, u16 qmax)
{
s16 valBefore = (*arg0);
s16 valBefore = (*quantity_p);
if (JOY_REPT(DPAD_ANY) == DPAD_UP)
{
(*arg0)++;
if ((*arg0) > arg1)
(*arg0) = 1;
(*quantity_p)++;
if ((*quantity_p) > qmax)
(*quantity_p) = 1;
if ((*arg0) == valBefore)
if ((*quantity_p) == valBefore)
{
return FALSE;
}
@@ -191,10 +191,10 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
}
else if (JOY_REPT(DPAD_ANY) == DPAD_DOWN)
{
(*arg0)--;
if ((*arg0) <= 0)
(*arg0) = arg1;
if ((*arg0) == valBefore)
(*quantity_p)--;
if ((*quantity_p) <= 0)
(*quantity_p) = qmax;
if ((*quantity_p) == valBefore)
{
return FALSE;
}
@@ -206,10 +206,10 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
}
else if (JOY_REPT(DPAD_ANY) == DPAD_RIGHT)
{
(*arg0) += 10;
if ((*arg0) > arg1)
(*arg0) = arg1;
if ((*arg0) == valBefore)
(*quantity_p) += 10;
if ((*quantity_p) > qmax)
(*quantity_p) = qmax;
if ((*quantity_p) == valBefore)
{
return FALSE;
}
@@ -221,10 +221,10 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
}
else if (JOY_REPT(DPAD_ANY) == DPAD_LEFT)
{
(*arg0) -= 10;
if ((*arg0) <= 0)
(*arg0) = 1;
if ((*arg0) == valBefore)
(*quantity_p) -= 10;
if ((*quantity_p) <= 0)
(*quantity_p) = 1;
if ((*quantity_p) == valBefore)
{
return FALSE;
}
+1 -1
View File
@@ -397,7 +397,7 @@ static void sub_8145D18(u8 whichWindow)
}
break;
}
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
static void sub_8146060(void)
+2 -2
View File
@@ -326,8 +326,8 @@ static void sub_8146A30(void)
{
AddTextPrinterParameterized3(sWork->windowIds[1], 3, 0, 16 * i + 2, sTextPals[sWork->bgSpec->textPal2], 0, sWork->messages[i]);
}
CopyWindowToVram(sWork->windowIds[0], 3);
CopyWindowToVram(sWork->windowIds[1], 3);
CopyWindowToVram(sWork->windowIds[0], COPYWIN_BOTH);
CopyWindowToVram(sWork->windowIds[1], COPYWIN_BOTH);
}
static void sub_8146B58(void)
+2 -2
View File
@@ -507,8 +507,8 @@ static struct Sprite * CreateMonMarkingSprite(u16 tileTag, u16 paletteTag, const
return NULL;
}
void sub_80BEBD0(u8 markings, void * dest)
void RequestDma3LoadMonMarking(u8 markings, void * dest)
{
RequestDma3Copy(&sMonMarkingsTiles[64 * markings], dest, 0x80, 1);
RequestDma3Copy(&sMonMarkingsTiles[64 * markings], dest, 0x80, DMA3_32BIT);
}
+1 -1
View File
@@ -131,6 +131,6 @@ void DrawMoneyBox(int amount, u8 x, u8 y)
void HideMoneyBox(void)
{
ClearStdWindowAndFrameToTransparent(sMoneyBoxWindowId, FALSE);
CopyWindowToVram(sMoneyBoxWindowId, 2);
CopyWindowToVram(sMoneyBoxWindowId, COPYWIN_GFX);
RemoveWindow(sMoneyBoxWindowId);
}
+2 -2
View File
@@ -1,7 +1,7 @@
#include "global.h"
#include "multiboot.h"
static IWRAM_DATA u16 MultiBoot_required_data[MULTIBOOT_NCHILD];
static u16 MultiBoot_required_data[MULTIBOOT_NCHILD];
static int MultiBootSend(struct MultiBootParam *mp, u16 data);
static int MultiBootHandShake(struct MultiBootParam *mp);
@@ -390,7 +390,7 @@ static int MultiBootHandShake(struct MultiBootParam *mp)
#undef must_data
}
static void MultiBootWaitCycles(u32 cycles)
static NOINLINE void MultiBootWaitCycles(u32 cycles)
{
asm("mov r2, pc");
asm("lsr r2, #24");
+12 -12
View File
@@ -478,7 +478,7 @@ void PrintMysteryGiftOrEReaderTopMenu(bool8 mg_or_ereader, bool32 usePickOkCance
AddTextPrinterParameterized4(0, 2, 2, 2, 0, 0, sMG_Ereader_TextColor_1, 0, gJPText_MysteryGift);
AddTextPrinterParameterized4(0, 0, 0x78, 2, 0, 0, sMG_Ereader_TextColor_1, 0, gJPText_DecideStop);
}
CopyWindowToVram(0, 2);
CopyWindowToVram(0, COPYWIN_GFX);
PutWindowTilemap(0);
}
@@ -530,14 +530,14 @@ void AddTextPrinterToWindow1(const u8 *str)
AddTextPrinterParameterized4(1, 2, 0, 2, 0, 2, sMG_Ereader_TextColor_2, 0, gStringVar4);
DrawTextBorderOuter(1, 0x001, 0xF);
PutWindowTilemap(1);
CopyWindowToVram(1, 3);
CopyWindowToVram(1, COPYWIN_BOTH);
}
void ClearTextWindow(void)
{
rbox_fill_rectangle(1);
ClearWindowTilemap(1);
CopyWindowToVram(1, 1);
CopyWindowToVram(1, COPYWIN_MAP);
}
bool32 MG_PrintTextOnWindow1AndWaitButton(u8 *textState, const u8 *str)
@@ -645,7 +645,7 @@ u32 MysteryGift_HandleThreeOptionMenu(u8 * unused0, u16 * unused1, u8 whichMenu)
if (response != -1)
{
ClearWindowTilemap(2);
CopyWindowToVram(2, 1);
CopyWindowToVram(2, COPYWIN_MAP);
}
return response;
}
@@ -670,7 +670,7 @@ s8 mevent_message_print_and_prompt_yes_no(u8 * textState, u16 * windowId, bool8
FillWindowPixelBuffer(*windowId, 0x11);
AddTextPrinterParameterized4(*windowId, 2, 0, 2, 0, 2, sMG_Ereader_TextColor_2, 0, gStringVar4);
DrawTextBorderOuter(*windowId, 0x001, 0x0F);
CopyWindowToVram(*windowId, 2);
CopyWindowToVram(*windowId, COPYWIN_GFX);
PutWindowTilemap(*windowId);
(*textState)++;
break;
@@ -694,7 +694,7 @@ s8 mevent_message_print_and_prompt_yes_no(u8 * textState, u16 * windowId, bool8
*textState = 0;
rbox_fill_rectangle(*windowId);
ClearWindowTilemap(*windowId);
CopyWindowToVram(*windowId, 1);
CopyWindowToVram(*windowId, COPYWIN_MAP);
RemoveWindow(*windowId);
return input;
}
@@ -703,7 +703,7 @@ s8 mevent_message_print_and_prompt_yes_no(u8 * textState, u16 * windowId, bool8
*textState = 0;
rbox_fill_rectangle(*windowId);
ClearWindowTilemap(*windowId);
CopyWindowToVram(*windowId, 1);
CopyWindowToVram(*windowId, COPYWIN_MAP);
RemoveWindow(*windowId);
return -1;
}
@@ -731,7 +731,7 @@ s32 HandleMysteryGiftListMenu(u8 * textState, u16 * windowId, bool32 cannotToss,
FillWindowPixelBuffer(*windowId, 0x11);
AddTextPrinterParameterized4(*windowId, 2, 0, 2, 0, 2, sMG_Ereader_TextColor_2, 0, gStringVar4);
DrawTextBorderOuter(*windowId, 0x001, 0x0F);
CopyWindowToVram(*windowId, 2);
CopyWindowToVram(*windowId, COPYWIN_GFX);
PutWindowTilemap(*windowId);
(*textState)++;
break;
@@ -764,7 +764,7 @@ s32 HandleMysteryGiftListMenu(u8 * textState, u16 * windowId, bool32 cannotToss,
*textState = 0;
rbox_fill_rectangle(*windowId);
ClearWindowTilemap(*windowId);
CopyWindowToVram(*windowId, 1);
CopyWindowToVram(*windowId, COPYWIN_MAP);
RemoveWindow(*windowId);
return input;
}
@@ -773,7 +773,7 @@ s32 HandleMysteryGiftListMenu(u8 * textState, u16 * windowId, bool32 cannotToss,
*textState = 0;
rbox_fill_rectangle(*windowId);
ClearWindowTilemap(*windowId);
CopyWindowToVram(*windowId, 1);
CopyWindowToVram(*windowId, COPYWIN_MAP);
RemoveWindow(*windowId);
return -2;
}
@@ -1252,7 +1252,7 @@ void task00_mystery_gift(u8 taskId)
data->state = 6;
break;
case 6:
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
ClearScreenInBg0(TRUE);
data->state = 7;
@@ -1600,7 +1600,7 @@ void task00_mystery_gift(u8 taskId)
}
break;
case 30:
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
ClearScreenInBg0(1);
data->state = 31;
+3 -3
View File
@@ -708,7 +708,7 @@ static void pokemon_transfer_to_pc_with_message(void)
DrawDialogueFrame(0, FALSE);
gTextFlags.canABSpeedUpPrint = TRUE;
AddTextPrinterParameterized2(0, 2, gStringVar4, GetTextSpeedSetting(), NULL, TEXT_COLOR_DARK_GREY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GREY);
CopyWindowToVram(0, 3);
CopyWindowToVram(0, COPYWIN_BOTH);
}
static bool8 sub_809E1D4(void)
@@ -1804,7 +1804,7 @@ static void PrintBufferCharactersOnScreen(void)
}
CallAddGenderIconFunc();
CopyWindowToVram(sNamingScreenData->windows[2], 2);
CopyWindowToVram(sNamingScreenData->windows[2], COPYWIN_GFX);
PutWindowTilemap(sNamingScreenData->windows[2]);
}
@@ -1887,7 +1887,7 @@ static void sub_809FAE4(void)
FillWindowPixelBuffer(sNamingScreenData->windows[4], PIXEL_FILL(15));
AddTextPrinterParameterized3(sNamingScreenData->windows[4], 0, 236 - strwidth, 0, color, 0, gText_MoveOkBack);
PutWindowTilemap(sNamingScreenData->windows[4]);
CopyWindowToVram(sNamingScreenData->windows[4], 3);
CopyWindowToVram(sNamingScreenData->windows[4], COPYWIN_BOTH);
}
static void sub_809FB70(void)
+6 -6
View File
@@ -299,7 +299,7 @@ void DecompressAndLoadBgGfxUsingHeap2(u8 bgId, const void *src, u32 size, u16 of
static void TaskFreeBufAfterCopyingTileDataToVram(u8 taskId)
{
if (!CheckForSpaceForDma3Request(gTasks[taskId].data[0]))
if (!WaitDma3Request(gTasks[taskId].data[0]))
{
Free((void *)GetWordTaskArg(taskId, 1));
DestroyTask(taskId);
@@ -471,7 +471,7 @@ void DrawDialogueFrame(u8 windowId, bool8 copyToVram)
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
void DrawStdWindowFrame(u8 windowId, bool8 copyToVram)
@@ -480,7 +480,7 @@ void DrawStdWindowFrame(u8 windowId, bool8 copyToVram)
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
void ClearDialogWindowAndFrame(u8 windowId, bool8 copyToVram)
@@ -489,7 +489,7 @@ void ClearDialogWindowAndFrame(u8 windowId, bool8 copyToVram)
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
ClearWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
if (gQuestLogState == QL_STATE_PLAYBACK)
CommitQuestLogWindow1();
}
@@ -500,7 +500,7 @@ void ClearStdWindowAndFrame(u8 windowId, bool8 copyToVram)
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
ClearWindowTilemap(windowId);
if (copyToVram == TRUE)
CopyWindowToVram(windowId, 3);
CopyWindowToVram(windowId, COPYWIN_BOTH);
}
static void WindowFunc_DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
@@ -644,7 +644,7 @@ void DisplayItemMessageOnField(u8 taskId, u8 textSpeed, const u8 *string, TaskFu
{
LoadStdWindowFrameGfx();
DisplayMessageAndContinueTask(taskId, 0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM, textSpeed, GetTextSpeedSetting(), string, callback);
CopyWindowToVram(0, 3);
CopyWindowToVram(0, COPYWIN_BOTH);
}
void DisplayYesNoMenuDefaultYes(void)
+11 -11
View File
@@ -584,7 +584,7 @@ static void CreateHelpDocsPage1(void)
PutWindowTilemap(sOakSpeechResources->unk_0014[0]);
FillWindowPixelBuffer(sOakSpeechResources->unk_0014[0], 0x00);
AddTextPrinterParameterized4(sOakSpeechResources->unk_0014[0], 2, 2, 0, 1, 1, sTextColor_HelpSystem, 0, gNewGame_HelpDocs1);
CopyWindowToVram(sOakSpeechResources->unk_0014[0], 3);
CopyWindowToVram(sOakSpeechResources->unk_0014[0], COPYWIN_BOTH);
FillBgTilemapBufferRect_Palette0(1, 0x3000, 1, 3, 5, 16);
CopyBgTilemapBufferToVram(1);
}
@@ -606,7 +606,7 @@ static void Task_OakSpeech4(u8 taskId)
PutWindowTilemap(sOakSpeechResources->unk_0014[i]);
FillWindowPixelBuffer(sOakSpeechResources->unk_0014[i], 0x00);
AddTextPrinterParameterized4(sOakSpeechResources->unk_0014[i], 2, 6, 0, 1, 1, sTextColor_HelpSystem, 0, sHelpDocsPtrs[i + r7 * 3]);
CopyWindowToVram(sOakSpeechResources->unk_0014[i], 3);
CopyWindowToVram(sOakSpeechResources->unk_0014[i], COPYWIN_BOTH);
}
if (sOakSpeechResources->unk_0012 == 1)
@@ -675,7 +675,7 @@ static void Task_OakSpeech3(u8 taskId)
{
FillWindowPixelBuffer(sOakSpeechResources->unk_0014[i], 0x00);
ClearWindowTilemap(sOakSpeechResources->unk_0014[i]);
CopyWindowToVram(sOakSpeechResources->unk_0014[i], 3);
CopyWindowToVram(sOakSpeechResources->unk_0014[i], COPYWIN_BOTH);
RemoveWindow(sOakSpeechResources->unk_0014[i]);
sOakSpeechResources->unk_0014[i] = 0;
}
@@ -699,7 +699,7 @@ static void Task_OakSpeech5(u8 taskId)
{
FillWindowPixelBuffer(sOakSpeechResources->unk_0014[i], 0x00);
ClearWindowTilemap(sOakSpeechResources->unk_0014[i]);
CopyWindowToVram(sOakSpeechResources->unk_0014[i], 3);
CopyWindowToVram(sOakSpeechResources->unk_0014[i], COPYWIN_BOTH);
RemoveWindow(sOakSpeechResources->unk_0014[i]);
sOakSpeechResources->unk_0014[i] = 0;
}
@@ -733,7 +733,7 @@ static void Task_OakSpeech6(u8 taskId)
data[14] = AddWindow(&sNewGameAdventureIntroWindowTemplates[0]);
PutWindowTilemap(data[14]);
FillWindowPixelBuffer(data[14], 0x00);
CopyWindowToVram(data[14], 3);
CopyWindowToVram(data[14], COPYWIN_BOTH);
sOakSpeechResources->unk_0012 = 0;
gMain.state = 0;
data[15] = 16;
@@ -856,7 +856,7 @@ static void Task_OakSpeech8(u8 taskId)
DestroyTopBarWindow();
FillWindowPixelBuffer(data[14], 0x00);
ClearWindowTilemap(data[14]);
CopyWindowToVram(data[14], 3);
CopyWindowToVram(data[14], COPYWIN_BOTH);
RemoveWindow(data[14]);
data[14] = 0;
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20);
@@ -902,7 +902,7 @@ static void Task_OakSpeech9(u8 taskId)
{ \
AddTextPrinterParameterized2(0, 4, str, speed, NULL, 2, 1, 3); \
} \
CopyWindowToVram(0, 3); \
CopyWindowToVram(0, COPYWIN_BOTH); \
})
static void Task_OakSpeech10(u8 taskId)
@@ -1072,7 +1072,7 @@ static void Task_OakSpeech19(u8 taskId)
sOakSpeechResources->textColor[2] = 3;
AddTextPrinterParameterized3(gTasks[taskId].data[13], 2, 8, 17, sOakSpeechResources->textColor, 0, gText_Girl);
Menu_InitCursor(gTasks[taskId].data[13], 2, 0, 1, GetFontAttribute(2, 1) + 2, 2, 0);
CopyWindowToVram(gTasks[taskId].data[13], 3);
CopyWindowToVram(gTasks[taskId].data[13], COPYWIN_BOTH);
gTasks[taskId].func = Task_OakSpeech20;
}
}
@@ -1419,8 +1419,8 @@ static void Task_OakSpeech39(u8 taskId)
PlaySE(SE_TK_WARPIN);
r0 = data[2];
data[2] -= 32;
x = sub_80D8B90(r0 - 8);
y = sub_80D8B90(data[2] - 16);
x = MathUtil_Inv16(r0 - 8);
y = MathUtil_Inv16(data[2] - 16);
SetBgAffine(2, 0x7800, 0x5400, 0x78, 0x54, x, y, 0);
if (data[2] <= 96)
{
@@ -1869,7 +1869,7 @@ static void PrintNameChoiceOptions(u8 taskId, u8 state)
AddTextPrinterParameterized(data[13], 2, textPtrs[i], 8, 16 * (i + 1) + 1, 0, NULL);
}
Menu_InitCursor(data[13], 2, 0, 1, 16, 5, 0);
CopyWindowToVram(data[13], 3);
CopyWindowToVram(data[13], COPYWIN_BOTH);
}
static void GetDefaultName(u8 arg0, u8 namePick)
+3 -3
View File
@@ -318,7 +318,7 @@ static void OptionMenu_PickSwitchCancel(void)
FillWindowPixelBuffer(2, PIXEL_FILL(15));
AddTextPrinterParameterized3(2, 0, x, 0, sOptionMenuPickSwitchCancelTextColor, 0, gText_PickSwitchCancel);
PutWindowTilemap(2);
CopyWindowToVram(2, 3);
CopyWindowToVram(2, COPYWIN_BOTH);
}
static void OptionMenu_ResetSpriteData(void)
@@ -500,7 +500,7 @@ static void BufferOptionMenuString(u8 selection)
break;
}
PutWindowTilemap(1);
CopyWindowToVram(1, 3);
CopyWindowToVram(1, COPYWIN_BOTH);
}
static void CloseAndSaveOptionMenu(u8 taskId)
@@ -524,7 +524,7 @@ static void PrintOptionMenuHeader(void)
FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized(WIN_TEXT_OPTION, 2, gText_MenuOption, 8, 1, TEXT_SPEED_FF, NULL);
PutWindowTilemap(0);
CopyWindowToVram(0, 3);
CopyWindowToVram(0, COPYWIN_BOTH);
}
static void DrawOptionMenuBg(void)
+7 -7
View File
@@ -3192,7 +3192,7 @@ bool32 Overworld_LinkRecvQueueLengthMoreThan2(void)
return sReceivingFromLink;
}
bool32 sub_8058274(void)
bool32 Overworld_RecvKeysFromLinkIsRunning(void)
{
u8 temp;
@@ -3218,7 +3218,7 @@ bool32 sub_8058274(void)
return FALSE;
}
bool32 sub_80582E0(void)
bool32 Overworld_SendKeysToLinkIsRunning(void)
{
if (GetLinkSendQueueLength() < 2)
return FALSE;
@@ -3232,7 +3232,7 @@ bool32 sub_80582E0(void)
return FALSE;
}
bool32 sub_8058318(void)
bool32 IsSendingKeysOverCable(void)
{
if (gWirelessCommType != 0)
return FALSE;
@@ -3298,17 +3298,17 @@ static void InitLinkPlayerObjectEventPos(struct ObjectEvent *objEvent, s16 x, s1
ObjectEventUpdateZCoord(objEvent);
}
static void sub_8058488(u8 linkPlayerId, u8 a2)
static void SetLinkPlayerObjectRange(u8 linkPlayerId, u8 range)
{
if (gLinkPlayerObjectEvents[linkPlayerId].active)
{
u8 objEventId = gLinkPlayerObjectEvents[linkPlayerId].objEventId;
struct ObjectEvent *objEvent = &gObjectEvents[objEventId];
objEvent->range.as_byte = a2;
objEvent->range.as_byte = range;
}
}
static void sub_80584B8(u8 linkPlayerId)
static void DestroyLinkPlayerOBject(u8 linkPlayerId)
{
struct LinkPlayerObjectEvent *linkPlayerObjEvent = &gLinkPlayerObjectEvents[linkPlayerId];
u8 objEventId = linkPlayerObjEvent->objEventId;
@@ -3349,7 +3349,7 @@ static u8 GetLinkPlayerElevation(u8 linkPlayerId)
return objEvent->currentElevation;
}
static s32 sub_8058590(u8 linkPlayerId)
static s32 GetLinkPlayerObjectStepTimer(u8 linkPlayerId)
{
u8 objEventId = gLinkPlayerObjectEvents[linkPlayerId].objEventId;
struct ObjectEvent *objEvent = &gObjectEvents[objEventId];
+7 -7
View File
@@ -731,7 +731,7 @@ static void RenderPartyMenuBox(u8 slot)
{
DisplayPartyPokemonDataForMultiBattle(slot);
LoadPartyBoxPalette(&sPartyMenuBoxes[slot], PARTY_PAL_MULTI_ALT);
CopyWindowToVram(sPartyMenuBoxes[slot].windowId, 2);
CopyWindowToVram(sPartyMenuBoxes[slot].windowId, COPYWIN_GFX);
PutWindowTilemap(sPartyMenuBoxes[slot].windowId);
ScheduleBgCopyTilemapToVram(2);
}
@@ -740,7 +740,7 @@ static void RenderPartyMenuBox(u8 slot)
if (GetMonData(&gPlayerParty[slot], MON_DATA_SPECIES) == SPECIES_NONE)
{
DrawEmptySlot(sPartyMenuBoxes[slot].windowId);
CopyWindowToVram(sPartyMenuBoxes[slot].windowId, 2);
CopyWindowToVram(sPartyMenuBoxes[slot].windowId, COPYWIN_GFX);
}
else
{
@@ -2159,7 +2159,7 @@ static void CreateCancelConfirmWindows(bool8 chooseHalf)
FillWindowPixelBuffer(confirmWindowId, PIXEL_FILL(0));
AddTextPrinterParameterized4(confirmWindowId, 0, (48 - GetStringWidth(0, gMenuText_Confirm, 0)) / 2u, 1, 0, 0, sFontColorTable[0], -1, gMenuText_Confirm);
PutWindowTilemap(confirmWindowId);
CopyWindowToVram(confirmWindowId, 2);
CopyWindowToVram(confirmWindowId, COPYWIN_GFX);
cancelWindowId = AddWindow(&sMultiCancelButtonWindowTemplate);
offset = 0;
}
@@ -2181,7 +2181,7 @@ static void CreateCancelConfirmWindows(bool8 chooseHalf)
AddTextPrinterParameterized3(cancelWindowId, 0, offset, 1, sFontColorTable[0], -1, gOtherText_Exit);
}
PutWindowTilemap(cancelWindowId);
CopyWindowToVram(cancelWindowId, 2);
CopyWindowToVram(cancelWindowId, COPYWIN_GFX);
ScheduleBgCopyTilemapToVram(0);
}
}
@@ -2467,7 +2467,7 @@ static void DisplayPartyPokemonHPBar(u16 hp, u16 maxhp, struct PartyMenuBox *men
FillWindowPixelRect(menuBox->windowId, 0x0D, menuBox->infoRects->dimensions[20] + hpFraction, menuBox->infoRects->dimensions[21], menuBox->infoRects->dimensions[22] - hpFraction, 1);
FillWindowPixelRect(menuBox->windowId, 0x02, menuBox->infoRects->dimensions[20] + hpFraction, menuBox->infoRects->dimensions[21] + 1, menuBox->infoRects->dimensions[22] - hpFraction, 2);
}
CopyWindowToVram(menuBox->windowId, 2);
CopyWindowToVram(menuBox->windowId, COPYWIN_GFX);
}
static void DisplayPartyPokemonDescriptionText(u8 stringId, struct PartyMenuBox *menuBox, u8 c)
@@ -5132,7 +5132,7 @@ static void DisplayLevelUpStatsPg1(u8 taskId)
arrayPtr[12] = CreateLevelUpStatsWindow();
DrawLevelUpWindowPg1(arrayPtr[12], arrayPtr, &arrayPtr[6], 1, 2, 3);
CopyWindowToVram(arrayPtr[12], 2);
CopyWindowToVram(arrayPtr[12], COPYWIN_GFX);
ScheduleBgCopyTilemapToVram(2);
}
@@ -5141,7 +5141,7 @@ static void DisplayLevelUpStatsPg2(u8 taskId)
s16 *arrayPtr = sPartyMenuInternal->data;
DrawLevelUpWindowPg2(arrayPtr[12], &arrayPtr[6], 1, 2, 3);
CopyWindowToVram(arrayPtr[12], 2);
CopyWindowToVram(arrayPtr[12], COPYWIN_GFX);
ScheduleBgCopyTilemapToVram(2);
}
+1 -1
View File
@@ -1,6 +1,6 @@
#include "play_time.h"
static IWRAM_DATA u8 sPlayTimeCounterState;
static u8 sPlayTimeCounterState;
enum
{
+2 -2
View File
@@ -392,7 +392,7 @@ static void Task_WithdrawItem_WaitFadeAndGoToItemStorage(u8 taskId)
static void Task_WithdrawItemBeginFade(u8 taskId)
{
gTasks[taskId].func = Task_WithdrawItem_WaitFadeAndGoToItemStorage;
ItemPc_SetInitializedFlag(0);
ItemPc_SetInitializedFlag(FALSE);
FadeScreen(FADE_TO_BLACK, 0);
}
@@ -401,7 +401,7 @@ static void Task_PlayerPcCancel(u8 taskId)
s16 *data = gTasks[taskId].data;
ClearStdWindowAndFrameToTransparent(tWindowId, FALSE);
ClearWindowTilemap(tWindowId);
CopyWindowToVram(tWindowId, 1);
CopyWindowToVram(tWindowId, COPYWIN_MAP);
RemoveWindow(tWindowId);
Task_ReturnToTopMenu(taskId);
}
+12 -12
View File
@@ -516,11 +516,11 @@ void sub_8102C28(void)
FillWindowPixelBuffer(1, PIXEL_FILL(15));
sub_8104C2C(gUnknown_8415DB8);
PutWindowTilemap(0);
CopyWindowToVram(0, 2);
CopyWindowToVram(0, COPYWIN_GFX);
PutWindowTilemap(1);
CopyWindowToVram(1, 2);
CopyWindowToVram(1, COPYWIN_GFX);
PutWindowTilemap(gUnknown_203ACF0->field_16);
CopyWindowToVram(gUnknown_203ACF0->field_16, 2);
CopyWindowToVram(gUnknown_203ACF0->field_16, COPYWIN_GFX);
}
void sub_8102EC0(s32 itemIndex, bool8 onInit, struct ListMenu *list)
@@ -538,7 +538,7 @@ void sub_8102EC0(s32 itemIndex, bool8 onInit, struct ListMenu *list)
LoadPalette(gUnknown_84520F4[itemIndex].pal, 0x10, 0x20);
}
PutWindowTilemap(gUnknown_203ACF0->field_15);
CopyWindowToVram(gUnknown_203ACF0->field_15, 2);
CopyWindowToVram(gUnknown_203ACF0->field_15, COPYWIN_GFX);
}
void sub_8102F48(u8 windowId, s32 itemId, u8 y)
@@ -631,8 +631,8 @@ void sub_810317C(void)
sub_8106E78(gUnknown_8415F3D, 1);
FillWindowPixelBuffer(1, PIXEL_FILL(15));
sub_8104C2C(gText_PickOKExit);
CopyWindowToVram(0, 2);
CopyWindowToVram(1, 2);
CopyWindowToVram(0, COPYWIN_GFX);
CopyWindowToVram(1, COPYWIN_GFX);
}
void sub_8103238(u8 taskId)
@@ -717,8 +717,8 @@ void sub_810345C(void)
sub_8106E78(gUnknown_8415F4A, 1);
FillWindowPixelBuffer(1, PIXEL_FILL(15));
sub_8104C2C(gText_PickOKExit);
CopyWindowToVram(0, 2);
CopyWindowToVram(1, 2);
CopyWindowToVram(0, COPYWIN_GFX);
CopyWindowToVram(1, COPYWIN_GFX);
}
u16 sub_8103518(u8 a0)
@@ -1841,7 +1841,7 @@ bool8 sub_8104C64(u16 a0, u8 a1, u8 a2)
FillWindowPixelBuffer(gUnknown_203ACF0->field_20[a1], PIXEL_FILL(0));
sub_81049FC(gUnknown_203ACF0->field_20[a1], a0, a1 * 16 + 16);
PutWindowTilemap(gUnknown_203ACF0->field_20[a1]);
CopyWindowToVram(gUnknown_203ACF0->field_20[a1], 2);
CopyWindowToVram(gUnknown_203ACF0->field_20[a1], COPYWIN_GFX);
}
else
PutWindowTilemap(gUnknown_203ACF0->field_20[a1]);
@@ -1861,7 +1861,7 @@ bool8 sub_8104C64(u16 a0, u8 a1, u8 a2)
if (sub_8104AB0(a0, FLAG_GET_CAUGHT, TRUE))
BlitBitmapRectToWindow(gUnknown_203ACF0->field_24[a1], gUnknown_8443600, 0, 0, 8, 8, 2, 3, 8, 8);
PutWindowTilemap(gUnknown_203ACF0->field_24[a1]);
CopyWindowToVram(gUnknown_203ACF0->field_24[a1], 2);
CopyWindowToVram(gUnknown_203ACF0->field_24[a1], COPYWIN_GFX);
}
}
else
@@ -1906,11 +1906,11 @@ bool8 sub_8104F0C(bool8 a0)
sub_8106E78(gDexCategoryNamePtrs[gUnknown_203ACF0->field_28], 0);
sub_8104EC0(0, sub_8106AF8(gUnknown_203ACF0->field_2B), sub_8106AF8(gUnknown_203ACF0->field_2A - 1), 160, 2);
}
CopyWindowToVram(0, 2);
CopyWindowToVram(0, COPYWIN_GFX);
FillWindowPixelBuffer(1, PIXEL_FILL(15));
if (!a0)
sub_8104C2C(gUnknown_8415F6C);
CopyWindowToVram(1, 2);
CopyWindowToVram(1, COPYWIN_GFX);
if (gUnknown_203ACF0->field_18[0] != 0xFFFF)
sub_8104C64(gUnknown_203ACF0->field_18[0], 0, gUnknown_203ACF0->field_2C);
if (gUnknown_203ACF0->field_18[1] != 0xFFFF)
+1 -1
View File
@@ -234,7 +234,7 @@ static void sub_8147A34(u8 taskId)
u16 packet[6];
s16 *data = gTasks[taskId].data;
if (gReceivedRemoteLinkPlayers != 0)
if (gReceivedRemoteLinkPlayers)
{
if (gRecvCmds[0][1] == 0x7FFF)
data[11] = gRecvCmds[0][2];
+2 -2
View File
@@ -1003,12 +1003,12 @@ static bool32 sub_814881C(void)
case 2:
if (sub_8149804())
{
CreateTask(sub_80DA634, 6);
CreateTask(Task_SaveGame_UpdatedLinkRecords, 6);
gUnknown_203F3D4->unk8++;
}
break;
case 3:
if (!FuncIsActiveTask(sub_80DA634))
if (!FuncIsActiveTask(Task_SaveGame_UpdatedLinkRecords))
{
sub_814A6CC();
gUnknown_203F3D4->unk8++;
+9 -9
View File
@@ -337,7 +337,7 @@ static void sub_814A0C8(void)
case 0:
gUnknown_203F3D8->unk12 = sub_814A754(1, 8, 20, 2);
AddTextPrinterParameterized(gUnknown_203F3D8->unk12, 2, gText_WantToPlayAgain2, 0, 2, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_203F3D8->unk12, 2);
CopyWindowToVram(gUnknown_203F3D8->unk12, COPYWIN_GFX);
gUnknown_203F3D8->unk4++;
break;
case 1:
@@ -364,7 +364,7 @@ static void sub_814A174(void)
case 0:
gUnknown_203F3D8->unk12 = sub_814A754(2, 7, 26, 4);
AddTextPrinterParameterized(gUnknown_203F3D8->unk12, 2, gText_SavingDontTurnOffPower, 0, 2, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_203F3D8->unk12, 2);
CopyWindowToVram(gUnknown_203F3D8->unk12, COPYWIN_GFX);
gUnknown_203F3D8->unk4++;
break;
case 1:
@@ -407,7 +407,7 @@ static void sub_814A264(void)
case 0:
gUnknown_203F3D8->unk12 = sub_814A754(2, 8, 22, 4);
AddTextPrinterParameterized(gUnknown_203F3D8->unk12, 2, gText_SomeoneDroppedOut2, 0, 2, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_203F3D8->unk12, 2);
CopyWindowToVram(gUnknown_203F3D8->unk12, COPYWIN_GFX);
gUnknown_203F3D8->unk4++;
break;
case 1:
@@ -433,7 +433,7 @@ static void sub_814A308(void)
case 0:
gUnknown_203F3D8->unk12 = sub_814A754(7, 10, 16, 2);
AddTextPrinterParameterized(gUnknown_203F3D8->unk12, 2, gText_CommunicationStandby4, 0, 2, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_203F3D8->unk12, 2);
CopyWindowToVram(gUnknown_203F3D8->unk12, COPYWIN_GFX);
gUnknown_203F3D8->unk4++;
break;
case 1:
@@ -526,7 +526,7 @@ void sub_814A468(u16 itemId, u16 quantity)
DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_203F3D8->strBuff, gText_AwesomeWonF701F700);
gUnknown_203F3D8->unk12 = sub_814A754(4, 8, 22, 4);
AddTextPrinterParameterized(gUnknown_203F3D8->unk12, 2, gUnknown_203F3D8->strBuff, 0, 2, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_203F3D8->unk12, 2);
CopyWindowToVram(gUnknown_203F3D8->unk12, COPYWIN_GFX);
gUnknown_203F3D8->unk14 = MUS_FANFA1;
gUnknown_203F3D8->unkD = 0;
}
@@ -539,7 +539,7 @@ void sub_814A53C(u16 itemId)
DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_203F3D8->strBuff, gText_FilledStorageSpace2);
gUnknown_203F3D8->unk12 = sub_814A754(4, 8, 22, 4);
AddTextPrinterParameterized(gUnknown_203F3D8->unk12, 2, gUnknown_203F3D8->strBuff, 0, 2, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_203F3D8->unk12, 2);
CopyWindowToVram(gUnknown_203F3D8->unk12, COPYWIN_GFX);
gUnknown_203F3D8->unk14 = 0;
gUnknown_203F3D8->unkD = 0;
}
@@ -552,7 +552,7 @@ void sub_814A5B4(u16 itemId)
DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_203F3D8->strBuff, gText_CantHoldMore);
gUnknown_203F3D8->unk12 = sub_814A754(4, 9, 22, 2);
AddTextPrinterParameterized(gUnknown_203F3D8->unk12, 2, gUnknown_203F3D8->strBuff, 0, 2, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_203F3D8->unk12, 2);
CopyWindowToVram(gUnknown_203F3D8->unk12, COPYWIN_GFX);
gUnknown_203F3D8->unk14 = 0;
gUnknown_203F3D8->unkD = 0;
}
@@ -596,7 +596,7 @@ void sub_814A6CC(void)
if (gUnknown_203F3D8->unk12 != 0xFF)
{
rbox_fill_rectangle(gUnknown_203F3D8->unk12);
CopyWindowToVram(gUnknown_203F3D8->unk12, 1);
CopyWindowToVram(gUnknown_203F3D8->unk12, COPYWIN_MAP);
gUnknown_203F3D8->unkD = 0;
}
}
@@ -857,7 +857,7 @@ static void sub_814AB98(int multiplayerId, u8 clr1, u8 clr2, u8 clr3)
x = 64 - GetStringWidth(0, sub_81499E0(multiplayerId), -1);
x /= 2;
AddTextPrinterParameterized3(gUnknown_203F3D8->unk1C[multiplayerId], 0, x, 2, colors, -1, sub_81499E0(multiplayerId));
CopyWindowToVram(gUnknown_203F3D8->unk1C[multiplayerId], 2);
CopyWindowToVram(gUnknown_203F3D8->unk1C[multiplayerId], COPYWIN_GFX);
}
static void sub_814AC30(bool32 arg0)
+2 -2
View File
@@ -76,7 +76,7 @@ static void Task_ShowPokemonJumpRecords(u8 taskId)
case 0:
data[1] = AddWindow(&gUnknown_846E2CC);
sub_814B5C4(data[1]);
CopyWindowToVram(data[1], 3);
CopyWindowToVram(data[1], COPYWIN_BOTH);
data[0]++;
break;
case 1:
@@ -87,7 +87,7 @@ static void Task_ShowPokemonJumpRecords(u8 taskId)
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
rbox_fill_rectangle(data[1]);
CopyWindowToVram(data[1], 1);
CopyWindowToVram(data[1], COPYWIN_MAP);
data[0]++;
}
break;
+7 -7
View File
@@ -336,12 +336,12 @@ void InitPokemonSpecialAnimScene(struct PokemonSpecialAnimScene * buffer, u16 an
ChangeBgY(3, 0, 0);
SetBgTilemapBuffer(0, buffer->field_0914);
SetBgTilemapBuffer(3, buffer->field_1914);
RequestDma3Fill(0, (void *)BG_VRAM, 0x20, TRUE);
RequestDma3Fill(0, (void *)BG_VRAM, 0x20, DMA3_32BIT);
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 32, 32);
LoadBgGfxByAnimType(animType);
FillWindowPixelBuffer(0, PIXEL_FILL(0));
TextWindow_SetUserSelectedFrame(0, 0x000, 0xe0);
CopyWindowToVram(0, 3);
CopyWindowToVram(0, COPYWIN_BOTH);
ShowBg(0);
ShowBg(3);
HideBg(1);
@@ -370,14 +370,14 @@ void PSA_ShowMessageWindow(void)
PutWindowTilemap(0);
FillWindowPixelBuffer(0, PIXEL_FILL(1));
DrawTextBorderOuter(0, 0x001, 0xE);
CopyWindowToVram(0, 3);
CopyWindowToVram(0, COPYWIN_BOTH);
}
void PSA_HideMessageWindow(void)
{
ClearWindowTilemap(0);
ClearStdWindowAndFrameToTransparent(0, FALSE);
CopyWindowToVram(0, 1);
CopyWindowToVram(0, COPYWIN_MAP);
}
void PSA_PrintMessage(u8 messageId)
@@ -448,7 +448,7 @@ void PSA_PrintMessage(u8 messageId)
void PSA_AfterPoof_ClearMessageWindow(void)
{
FillWindowPixelBuffer(0, PIXEL_FILL(1));
CopyWindowToVram(0, 2);
CopyWindowToVram(0, COPYWIN_GFX);
}
bool8 PSA_IsMessagePrintTaskActive(void)
@@ -612,12 +612,12 @@ UNUSED void PSA_DrawLevelUpWindowPg1(u16 *statsBefore, u16 *statsAfter)
DrawTextBorderOuter(1, 0x001, 0xE);
DrawLevelUpWindowPg1(1, statsBefore, statsAfter, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY);
PutWindowTilemap(1);
CopyWindowToVram(1, 3);
CopyWindowToVram(1, COPYWIN_BOTH);
}
UNUSED void PSA_DrawLevelUpWindowPg2(u16 *currStats)
{
DrawLevelUpWindowPg2(1, currStats, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY);
CopyWindowToVram(1, 2);
CopyWindowToVram(1, COPYWIN_GFX);
}
UNUSED bool8 PSA_IsCopyingLevelUpWindowToVram(void)
+2 -2
View File
@@ -247,8 +247,8 @@ static void Task_PokemonStorageSystemPC(u8 taskId)
DrawDialogueFrame(0, 0);
FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 2, sUnknown_83CDA20[task->data[1]].desc, TEXT_SPEED_FF, NULL, TEXT_COLOR_DARK_GREY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GREY);
CopyWindowToVram(0, 3);
CopyWindowToVram(task->data[15], 3);
CopyWindowToVram(0, COPYWIN_BOTH);
CopyWindowToVram(task->data[15], COPYWIN_BOTH);
task->data[0]++;
break;
case 1:

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