From 03a98c72bc435bf92e535de26f21ce0c06df6dd9 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 2 Sep 2022 19:29:35 -0400 Subject: [PATCH 1/9] Sync fieldmap --- include/fieldmap.h | 2 +- include/global.fieldmap.h | 10 +++++----- src/fieldmap.c | 13 +++++++------ src/item_use.c | 2 +- src/scrcmd.c | 8 ++++---- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/include/fieldmap.h b/include/fieldmap.h index 7caadfcaa..2f7eaba66 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -47,7 +47,7 @@ void CopySecondaryTilesetToVramUsingHeap(struct MapLayout const *mapLayout); void CopyPrimaryTilesetToVram(const struct MapLayout *); void CopySecondaryTilesetToVram(const struct MapLayout *); struct MapHeader const *const GetMapHeaderFromConnection(struct MapConnection *connection); -struct MapConnection *GetConnectionAtCoords(s16 x, s16 y); +struct MapConnection *GetMapConnectionAtPos(s16 x, s16 y); void MapGridSetMetatileImpassabilityAt(int x, int y, bool32 impassable); // field_region_map.c diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 974fa3382..2be44a5f3 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -4,9 +4,9 @@ // Masks/shifts for blocks in the map grid // Map grid blocks consist of a 10 bit metatile id, a 2 bit collision value, and a 4 bit elevation value // This is the data stored in each data/layouts/*/map.bin file -#define MAPGRID_METATILE_ID_MASK 0x03FF // Bits 1-10 -#define MAPGRID_COLLISION_MASK 0x0C00 // Bits 11-12 -#define MAPGRID_ELEVATION_MASK 0xF000 // Bits 13-16 +#define MAPGRID_METATILE_ID_MASK 0x03FF // Bits 0-9 +#define MAPGRID_COLLISION_MASK 0x0C00 // Bits 10-11 +#define MAPGRID_ELEVATION_MASK 0xF000 // Bits 12-15 #define MAPGRID_COLLISION_SHIFT 10 #define MAPGRID_ELEVATION_SHIFT 12 @@ -16,8 +16,8 @@ // Masks/shifts for metatile attributes // Metatile attributes consist of an 8 bit behavior value, 4 unused bits, and a 4 bit layer type value // This is the data stored in each data/tilesets/*/*/metatile_attributes.bin file -#define METATILE_ATTR_BEHAVIOR_MASK 0x00FF // Bits 1-8 -#define METATILE_ATTR_LAYER_MASK 0xF000 // Bits 13-16 +#define METATILE_ATTR_BEHAVIOR_MASK 0x00FF // Bits 0-7 +#define METATILE_ATTR_LAYER_MASK 0xF000 // Bits 12-15 #define METATILE_ATTR_LAYER_SHIFT 12 enum { diff --git a/src/fieldmap.c b/src/fieldmap.c index 2b981dc6e..8dfa23bf3 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -753,7 +753,7 @@ static int IsPosInConnectingMap(struct MapConnection *connection, int x, int y) return FALSE; } -struct MapConnection *GetConnectionAtCoords(s16 x, s16 y) +struct MapConnection *GetMapConnectionAtPos(s16 x, s16 y) { int count; struct MapConnection *connection; @@ -860,12 +860,13 @@ static void CopyTilesetToVramUsingHeap(struct Tileset const *tileset, u16 numTil } } -static void FieldmapPaletteDummy(u16 offset, u16 size) +// Below two are dummied functions from FRLG, used to tint the overworld palettes for the Quest Log +static void ApplyGlobalTintToPaletteEntries(u16 offset, u16 size) { } -static void FieldmapUnkDummy(void) +static void ApplyGlobalTintToPaletteSlot(void) { } @@ -880,17 +881,17 @@ void LoadTilesetPalette(struct Tileset const *tileset, u16 destOffset, u16 size) { LoadPalette(&black, destOffset, 2); LoadPalette(((u16 *)tileset->palettes) + 1, destOffset + 1, size - 2); - FieldmapPaletteDummy(destOffset + 1, (size - 2) >> 1); + ApplyGlobalTintToPaletteEntries(destOffset + 1, (size - 2) >> 1); } else if (tileset->isSecondary == TRUE) { LoadPalette(((u16 *)tileset->palettes) + (NUM_PALS_IN_PRIMARY * 16), destOffset, size); - FieldmapPaletteDummy(destOffset, size >> 1); + ApplyGlobalTintToPaletteEntries(destOffset, size >> 1); } else { LoadCompressedPalette((u32 *)tileset->palettes, destOffset, size); - FieldmapPaletteDummy(destOffset, size >> 1); + ApplyGlobalTintToPaletteEntries(destOffset, size >> 1); } } } diff --git a/src/item_use.c b/src/item_use.c index e5c78d091..41e888496 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -456,7 +456,7 @@ static void CheckForHiddenItemsInMapConnection(u8 taskId) || var2 > y || y >= height) { - struct MapConnection *conn = GetConnectionAtCoords(x, y); + struct MapConnection *conn = GetMapConnectionAtPos(x, y); if (conn && IsHiddenItemPresentInConnection(conn, x, y) == TRUE) SetDistanceOfClosestHiddenItem(taskId, x - playerX, y - playerY); } diff --git a/src/scrcmd.c b/src/scrcmd.c index 6ca02019d..3d67c69e5 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -2038,15 +2038,15 @@ bool8 ScrCmd_setmetatile(struct ScriptContext *ctx) { u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - u16 tileId = VarGet(ScriptReadHalfword(ctx)); - u16 isImpassable = VarGet(ScriptReadHalfword(ctx)); + u16 metatileId = VarGet(ScriptReadHalfword(ctx)); + bool16 isImpassable = VarGet(ScriptReadHalfword(ctx)); x += MAP_OFFSET; y += MAP_OFFSET; if (!isImpassable) - MapGridSetMetatileIdAt(x, y, tileId); + MapGridSetMetatileIdAt(x, y, metatileId); else - MapGridSetMetatileIdAt(x, y, tileId | MAPGRID_COLLISION_MASK); + MapGridSetMetatileIdAt(x, y, metatileId | MAPGRID_COLLISION_MASK); return FALSE; } From 7f1c4720a246702c97ef04f7191648ccac587232 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 2 Sep 2022 19:36:46 -0400 Subject: [PATCH 2/9] Update arguments for ApplyGlobalTintToPaletteSlot --- src/fieldmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fieldmap.c b/src/fieldmap.c index 8dfa23bf3..149084d35 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -866,7 +866,7 @@ static void ApplyGlobalTintToPaletteEntries(u16 offset, u16 size) } -static void ApplyGlobalTintToPaletteSlot(void) +static void ApplyGlobalTintToPaletteSlot(u8 slot, u8 count) { } From 8b7230c3c456f23cc87b3581f641688e41e82987 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 2 Sep 2022 19:41:28 -0400 Subject: [PATCH 3/9] CpuFastFill -> CpuFastFill16 in fieldmap --- src/fieldmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fieldmap.c b/src/fieldmap.c index 149084d35..bcd2d1019 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -87,13 +87,13 @@ void InitMapFromSavedGame(void) void InitBattlePyramidMap(bool8 setPlayerPosition) { - CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData)); + CpuFastFill16(MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData)); GenerateBattlePyramidFloorLayout(sBackupMapData, setPlayerPosition); } void InitTrainerHillMap(void) { - CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData)); + CpuFastFill16(MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData)); GenerateTrainerHillFloorLayout(sBackupMapData); } From 61752a4977eb90826593cec40848efe1212529f0 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 11 Sep 2022 13:35:58 -0400 Subject: [PATCH 4/9] Added parenthesis to GET_SHINY_VALUE --- include/pokemon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pokemon.h b/include/pokemon.h index 63c5c74eb..e48618328 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -363,7 +363,7 @@ struct Evolution | (((personality) & 0x00000003) >> 0) \ ) % NUM_UNOWN_FORMS) -#define GET_SHINY_VALUE(otId, personality)HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality) +#define GET_SHINY_VALUE(otId, personality) (HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality)) extern u8 gPlayerPartyCount; extern struct Pokemon gPlayerParty[PARTY_SIZE]; From 65108c319265a7a5f232e0fa6af61d091823ad45 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 11 Sep 2022 14:14:49 -0400 Subject: [PATCH 5/9] Cleaned trailing whitespace --- INSTALL.md | 6 +- Makefile | 4 +- asm/macros/battle_ai_script.inc | 26 ++--- asm/macros/battle_anim_script.inc | 6 +- asm/macros/battle_script.inc | 100 +++++++++--------- asm/macros/event.inc | 10 +- data/battle_ai_scripts.s | 2 +- data/battle_scripts_1.s | 6 +- data/scripts/new_game.inc | 2 +- data/scripts/roulette.inc | 2 +- docs/legacy_WSL1_INSTALL.md | 4 +- gflib/text.c | 4 +- graphics_file_rules.mk | 20 ++-- include/battle.h | 2 +- include/global.h | 2 +- include/link_rfu.h | 6 +- include/pokenav.h | 2 +- include/union_room.h | 4 +- src/battle_anim_mons.c | 4 +- src/battle_script_commands.c | 2 +- src/battle_tent.c | 2 +- src/battle_transition.c | 24 ++--- src/data/field_effects/field_effect_objects.h | 2 +- src/decoration.c | 4 +- src/ereader_screen.c | 6 +- src/event_object_movement.c | 2 +- src/field_tasks.c | 18 ++-- src/link_rfu_2.c | 10 +- src/link_rfu_3.c | 2 +- src/metatile_behavior.c | 2 +- src/mystery_gift.c | 8 +- src/mystery_gift_menu.c | 2 +- src/mystery_gift_view.c | 18 ++-- src/pokedex_area_screen.c | 6 +- src/pokemon.c | 10 +- src/pokemon_summary_screen.c | 4 +- src/pokenav_menu_handler_gfx.c | 2 +- src/record_mixing.c | 4 +- src/roamer.c | 6 +- src/rom_header.s | 2 +- src/save.c | 2 +- src/script.c | 6 +- src/slot_machine.c | 20 ++-- src/sound.c | 2 +- src/trade.c | 2 +- src/tv.c | 8 +- src/union_room_player_avatar.c | 2 +- src/walda_phrase.c | 2 +- src/wild_encounter.c | 4 +- src/wonder_news.c | 2 +- sym_common.txt | 10 +- 51 files changed, 204 insertions(+), 204 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 2759124be..5f2a1f05f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -106,7 +106,7 @@ cd /mnt/c/Users//Desktop/decomps > Note 2: If the path has spaces, then the path must be wrapped with quotations, e.g. `cd "/mnt/c/users//Desktop/decomp folder"`. > Note 3: Windows path names are case-insensitive so adhering to capitalization isn't needed - + If this works, then proceed to [Installation](#installation). Otherwise, ask for help on Discord or IRC (see [README.md](README.md)), or continue reading below for [Windows instructions using msys2](#windows-msys2). @@ -216,7 +216,7 @@ Note that the directory **must exist** in Windows. If you want to store pokeemer > Note 1: If the path has spaces, then the path must be wrapped with quotations, e.g. `cd "c:/users//Desktop/decomp folder"`. > Note 2: Windows path names are case-insensitive so adhering to capitalization isn't needed - + If this works, then proceed to [Installation](#installation). Otherwise, ask for help on Discord or IRC (see [README.md](README.md)). ## macOS @@ -539,7 +539,7 @@ devkitARM is now installed. devkitARM is now installed. ### Installing devkitARM on Arch Linux - + 1. Follow [devkitPro's instructions](https://devkitpro.org/wiki/devkitPro_pacman#Customising_Existing_Pacman_Install) to configure `pacman` to download devkitPro packages. 2. Install `gba-dev`: run the following command as root. diff --git a/Makefile b/Makefile index c36cc8e93..88303e7f3 100644 --- a/Makefile +++ b/Makefile @@ -254,7 +254,7 @@ tidynonmodern: tidymodern: rm -f $(MODERN_ROM_NAME) $(MODERN_ELF_NAME) $(MODERN_MAP_NAME) rm -rf $(MODERN_OBJ_DIR_NAME) - + ifneq ($(MODERN),0) $(C_BUILDDIR)/berry_crush.o: override CFLAGS += -Wno-address-of-packed-member endif @@ -410,7 +410,7 @@ 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 := +LD_SCRIPT_DEPS := endif $(OBJ_DIR)/ld_script.ld: $(LD_SCRIPT) $(LD_SCRIPT_DEPS) diff --git a/asm/macros/battle_ai_script.inc b/asm/macros/battle_ai_script.inc index 5341e5a43..78c8131f6 100644 --- a/asm/macros/battle_ai_script.inc +++ b/asm/macros/battle_ai_script.inc @@ -550,38 +550,38 @@ .2byte \param1 .4byte \param2 .endm - + @ useful script macros .macro get_curr_move_type get_type AI_TYPE_MOVE .endm - + .macro get_user_type1 get_type AI_TYPE1_USER .endm - + .macro get_user_type2 get_type AI_TYPE2_USER .endm - + .macro get_target_type1 get_type AI_TYPE1_TARGET .endm - + .macro get_target_type2 get_type AI_TYPE2_TARGET .endm - + .macro if_ability battler:req, ability:req, ptr:req check_ability \battler, \ability if_equal 1, \ptr .endm - + .macro if_no_ability battler:req, ability:req, ptr:req check_ability \battler, \ability if_equal 0, \ptr .endm - + .macro if_type battler:req, type:req, ptr:req is_of_type \battler, \type if_equal 1, \ptr @@ -591,20 +591,20 @@ is_of_type \battler, \type if_equal 0, \ptr .endm - + .macro if_target_faster ptr:req if_user_goes 1, \ptr .endm - + .macro if_user_faster ptr:req if_user_goes 0, \ptr .endm - + .macro if_double_battle ptr:req is_double_battle if_equal 1, \ptr .endm - + .macro if_not_double_battle ptr:req is_double_battle if_equal 0, \ptr @@ -613,7 +613,7 @@ .macro if_any_move_disabled battler:req, ptr:req if_any_move_disabled_or_encored \battler, 0, \ptr .endm - + .macro if_any_move_encored battler:req, ptr:req if_any_move_disabled_or_encored \battler, 1, \ptr .endm diff --git a/asm/macros/battle_anim_script.inc b/asm/macros/battle_anim_script.inc index 15c48c39f..67632e988 100644 --- a/asm/macros/battle_anim_script.inc +++ b/asm/macros/battle_anim_script.inc @@ -270,16 +270,16 @@ .macro stopsound .byte 0x2f .endm - + @ useful macros .macro jumpreteq value:req, ptr:req jumpargeq ARG_RET_ID, \value, \ptr .endm - + .macro jumprettrue ptr:req jumpreteq TRUE, \ptr .endm - + .macro jumpretfalse ptr:req jumpreteq FALSE, \ptr .endm diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 0a44f6075..ccb887327 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -410,33 +410,33 @@ .byte \endMode .byte \endState .endm - + @ Help macros for 5 uses of moveend command - + @ All cases .macro moveendall setbyte sMOVEEND_STATE, 0 moveend 0, 0 .endm - + @ Chosen case .macro moveendcase case:req setbyte sMOVEEND_STATE, \case moveend 1, 0 .endm - + @ All cases from (inclusive) .macro moveendfrom from:req setbyte sMOVEEND_STATE, \from moveend 0, 0 .endm - + @ All cases from 0 to (not inclusive) .macro moveendto to:req setbyte sMOVEEND_STATE, 0 moveend 2, \to .endm - + @ Cases from (inclusive) to (not inclusive) .macro moveendfromto from:req, to:req setbyte sMOVEEND_STATE, \from @@ -1252,165 +1252,165 @@ .byte 0xf8 .byte \position .endm - + @ various command changed to more readable macros .macro cancelmultiturnmoves battler:req various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES .endm - + .macro setmagiccoattarget battler:req various \battler, VARIOUS_SET_MAGIC_COAT_TARGET .endm - + .macro getifcantrunfrombattle battler:req various \battler, VARIOUS_IS_RUNNING_IMPOSSIBLE .endm - + .macro getmovetarget battler:req various \battler, VARIOUS_GET_MOVE_TARGET .endm - + .macro getbattlerfainted battler:req various \battler, VARIOUS_GET_BATTLER_FAINTED .endm - + .macro resetintimidatetracebits battler:req various \battler, VARIOUS_RESET_INTIMIDATE_TRACE_BITS .endm - + .macro updatechoicemoveonlvlup battler:req various \battler, VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP .endm - + .macro resetplayerfainted various BS_ATTACKER, VARIOUS_RESET_PLAYER_FAINTED .endm - + .macro palaceflavortext battler:req various \battler, VARIOUS_PALACE_FLAVOR_TEXT .endm - + .macro arenajudgmentwindow various BS_ATTACKER, VARIOUS_ARENA_JUDGMENT_WINDOW .endm - + .macro arenaopponentmonlost various BS_ATTACKER, VARIOUS_ARENA_OPPONENT_MON_LOST .endm - + .macro arenaplayermonlost various BS_ATTACKER, VARIOUS_ARENA_PLAYER_MON_LOST .endm - + .macro arenabothmonlost various BS_ATTACKER, VARIOUS_ARENA_BOTH_MONS_LOST .endm - + .macro forfeityesnobox battler:req various \battler, VARIOUS_EMIT_YESNOBOX .endm - + .macro arenadrawreftextbox various BS_ATTACKER, VARIOUS_DRAW_ARENA_REF_TEXT_BOX .endm - + .macro arenaerasereftextbox various BS_ATTACKER, VARIOUS_ERASE_ARENA_REF_TEXT_BOX .endm - + .macro arenajudgmentstring id:req various \id, VARIOUS_ARENA_JUDGMENT_STRING .endm - + .macro arenawaitmessage id:req various \id, VARIOUS_ARENA_WAIT_STRING .endm - + .macro waitcry battler:req various \battler, VARIOUS_WAIT_CRY .endm - + .macro returnopponentmon1toball battler:req various \battler, VARIOUS_RETURN_OPPONENT_MON1 .endm - + .macro returnopponentmon2toball battler:req various \battler, VARIOUS_RETURN_OPPONENT_MON2 .endm - + .macro volumedown various BS_ATTACKER, VARIOUS_VOLUME_DOWN .endm - + .macro volumeup various BS_ATTACKER, VARIOUS_VOLUME_UP .endm - + .macro setalreadystatusedmoveattempt battler:req various \battler, VARIOUS_SET_ALREADY_STATUS_MOVE_ATTEMPT .endm - + .macro palacetryescapestatus battler:req various \battler, VARIOUS_PALACE_TRY_ESCAPE_STATUS .endm - + .macro setoutcomeonteleport battler:req various \battler, VARIOUS_SET_TELEPORT_OUTCOME .endm - + .macro playtrainerdefeatbgm battler:req various \battler, VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC .endm - + @ helpful macros .macro setstatchanger stat:req, stages:req, down:req setbyte sSTATCHANGER, \stat | \stages << 4 | \down << 7 .endm - + .macro setmoveeffect effect:req setbyte cEFFECT_CHOOSER, \effect .endm - + .macro chosenstatus1animation battler:req, status:req chosenstatusanimation \battler, 0x0, \status .endm - + .macro chosenstatus2animation battler:req, status:req chosenstatusanimation \battler, 0x1, \status .endm - + .macro sethword dst:req, value:req setbyte \dst, (\value) & 0xFF setbyte \dst + 1, ((\value) >> 8) & 0xFF .endm - + .macro setword dst:req, value:req setbyte \dst, (\value) & 0xFF setbyte \dst + 1, ((\value) >> 8) & 0xFF setbyte \dst + 2, ((\value) >> 16) & 0xFF setbyte \dst + 3, ((\value) >> 24) & 0xFF .endm - + .macro copybyte dst:req, src:req copyarray \dst, \src, 0x1 .endm - + .macro copyhword dst:req, src:req copyarray \dst, \src, 0x2 .endm - + .macro copyword dst:req, src:req copyarray \dst, \src, 0x4 .endm - + .macro jumpifbytenotequal byte1:req, byte2:req, jumpptr:req jumpifarraynotequal \byte1, \byte2, 0x1, \jumpptr .endm - + .macro jumpifbyteequal byte1:req, byte2:req, jumpptr:req jumpifarrayequal \byte1, \byte2, 0x1, \jumpptr .endm - + .macro jumpifmove move:req, jumpptr:req jumpifhalfword CMP_EQUAL, gCurrentMove, \move, \jumpptr .endm @@ -1418,23 +1418,23 @@ .macro jumpifnotmove move:req, jumpptr:req jumpifhalfword CMP_NOT_EQUAL, gCurrentMove, \move, \jumpptr .endm - + .macro jumpifstatus3 battler:req, status:req, jumpptr:req jumpifstatus3condition \battler, \status, FALSE, \jumpptr .endm - + .macro jumpifnostatus3 battler:req, status:req, jumpptr:req jumpifstatus3condition \battler, \status, TRUE, \jumpptr .endm - + .macro jumpifmovehadnoeffect jumpptr:req jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_NO_EFFECT, \jumpptr .endm - + .macro jumpifbattletype flags:req, jumpptr:req jumpifword CMP_COMMON_BITS, gBattleTypeFlags, \flags, \jumpptr .endm - + .macro jumpifnotbattletype flags:req, jumpptr:req jumpifword CMP_NO_COMMON_BITS, gBattleTypeFlags, \flags, \jumpptr .endm diff --git a/asm/macros/event.inc b/asm/macros/event.inc index cea21aeb2..77916efe1 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -276,7 +276,7 @@ .2byte SPECIAL_\function .endm - @ Blocks script execution until a command or C code manually unblocks it. Generally used with specific + @ Blocks script execution until a command or C code manually unblocks it. Generally used with specific @ commands and specials. Calling ScriptContext_Enable for instance will allow execution to continue. .macro waitstate .byte 0x27 @@ -985,7 +985,7 @@ .endm @ Gives the player a Pokémon of the specified species and level, holding the specified item. The trailing 0s are unused parameters. - @ VAR_RESULT will be set to MON_GIVEN_TO_PARTY, MON_GIVEN_TO_PC, or MON_CANT_GIVE depending on the outcome. + @ VAR_RESULT will be set to MON_GIVEN_TO_PARTY, MON_GIVEN_TO_PC, or MON_CANT_GIVE depending on the outcome. .macro givemon species:req, level:req, item=ITEM_NONE .byte 0x79 .2byte \species @@ -997,7 +997,7 @@ .endm @ Gives the player an Egg of the specified species. - @ VAR_RESULT will be set to MON_GIVEN_TO_PARTY, MON_GIVEN_TO_PC, or MON_CANT_GIVE depending on the outcome. + @ VAR_RESULT will be set to MON_GIVEN_TO_PARTY, MON_GIVEN_TO_PC, or MON_CANT_GIVE depending on the outcome. .macro giveegg species:req .byte 0x7a .2byte \species @@ -1415,7 +1415,7 @@ .2byte \out .endm - @ Gives 'count' coins to the player, up to a total of MAX_COINS. + @ Gives 'count' coins to the player, up to a total of MAX_COINS. @ If the player already has MAX_COINS then VAR_RESULT is set to TRUE, otherwise it is set to FALSE. .macro addcoins count:req .byte 0xb4 @@ -1887,7 +1887,7 @@ @ Gives 'amount' of the specified 'item' to the player and prints a message with fanfare. @ If the player doesn't have space for all the items then as many are added as possible, the - @ message indicates there is no room, and VAR_RESULT is set to FALSE. + @ message indicates there is no room, and VAR_RESULT is set to FALSE. @ Otherwise VAR_RESULT is set to TRUE, and the message indicates they have received the item(s). .macro giveitem item:req, amount=1 setorcopyvar VAR_0x8000, \item diff --git a/data/battle_ai_scripts.s b/data/battle_ai_scripts.s index c776c2532..df6cf1b6f 100644 --- a/data/battle_ai_scripts.s +++ b/data/battle_ai_scripts.s @@ -1909,7 +1909,7 @@ AI_CV_Protect4: if_random_less_than 128, AI_CV_Protect_End score -1 goto AI_CV_Protect_End - + AI_CV_Protect3: get_last_used_bank_move AI_TARGET get_move_effect_from_result diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 39cdafcee..7e99911b1 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -15,7 +15,7 @@ .include "constants/constants.inc" .section script_data, "aw", %progbits - + .align 2 gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectHit @ EFFECT_HIT @@ -2826,7 +2826,7 @@ BattleScript_GiveExp:: setbyte sGIVEEXP_STATE, 0 getexp BS_TARGET end2 - + BattleScript_HandleFaintedMon:: checkteamslost BattleScript_LinkHandleFaintedMonMultiple jumpifbyte CMP_NOT_EQUAL, gBattleOutcome, 0, BattleScript_FaintedMonEnd @@ -4046,7 +4046,7 @@ BattleScript_IntimidatePrevented: printstring STRINGID_PREVENTEDFROMWORKING waitmessage B_WAIT_TIME_LONG goto BattleScript_IntimidateActivatesLoopIncrement - + BattleScript_DroughtActivates:: pause B_WAIT_TIME_SHORT printstring STRINGID_PKMNSXINTENSIFIEDSUN diff --git a/data/scripts/new_game.inc b/data/scripts/new_game.inc index 7c5c3fc7d..e9c8dd8d5 100644 --- a/data/scripts/new_game.inc +++ b/data/scripts/new_game.inc @@ -38,7 +38,7 @@ EventScript_ResetAllBerries:: setberrytree BERRY_TREE_ROUTE_117_WEPEAR_3, ITEM_TO_BERRY(ITEM_WEPEAR_BERRY), BERRY_STAGE_BERRIES setberrytree BERRY_TREE_ROUTE_117_WEPEAR_2, ITEM_TO_BERRY(ITEM_WEPEAR_BERRY), BERRY_STAGE_BERRIES setberrytree BERRY_TREE_ROUTE_117_WEPEAR_1, ITEM_TO_BERRY(ITEM_WEPEAR_BERRY), BERRY_STAGE_BERRIES - + @ Route 112 setberrytree BERRY_TREE_ROUTE_112_RAWST_2, ITEM_TO_BERRY(ITEM_RAWST_BERRY), BERRY_STAGE_BERRIES setberrytree BERRY_TREE_ROUTE_112_PECHA_2, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES diff --git a/data/scripts/roulette.inc b/data/scripts/roulette.inc index 7163a449a..fcb09bef2 100644 --- a/data/scripts/roulette.inc +++ b/data/scripts/roulette.inc @@ -22,7 +22,7 @@ Roulette_EventScript_Play:: special PlayRoulette waitstate end - + Roulette_Text_PlayMinimumWagerIsX:: .string "The minimum wager at this table\n" .string "is {STR_VAR_1}. Do you want to play?$" diff --git a/docs/legacy_WSL1_INSTALL.md b/docs/legacy_WSL1_INSTALL.md index b9840d1c8..7d40960f3 100644 --- a/docs/legacy_WSL1_INSTALL.md +++ b/docs/legacy_WSL1_INSTALL.md @@ -17,8 +17,8 @@ cd /mnt/c/Users//Downloads ``` - > Note 1: The Windows C:\ drive is called /mnt/c/ in WSL. - > Note 2: If the path has spaces, then the path must be wrapped with quotations, e.g. `cd "/mnt/c/users//Downloads folder"`. + > Note 1: The Windows C:\ drive is called /mnt/c/ in WSL. + > Note 2: If the path has spaces, then the path must be wrapped with quotations, e.g. `cd "/mnt/c/users//Downloads folder"`. > Note 3: Windows path names are case-insensitive so adhering to capitalization isn't needed 4. Once the directory has been changed to the folder containing the devkitPro pacman package, run the following commands to install devkitARM. diff --git a/gflib/text.c b/gflib/text.c index c7efdccce..e7a7d5957 100644 --- a/gflib/text.c +++ b/gflib/text.c @@ -73,7 +73,7 @@ static const u8 sDarkDownArrowTiles[] = INCBIN_U8("graphics/fonts/down_arrow_alt static const u8 sUnusedFRLGBlankedDownArrow[] = INCBIN_U8("graphics/fonts/unused_frlg_blanked_down_arrow.4bpp"); static const u8 sUnusedFRLGDownArrow[] = INCBIN_U8("graphics/fonts/unused_frlg_down_arrow.4bpp"); static const u8 sDownArrowYCoords[] = { 0, 1, 2, 1 }; -static const u8 sWindowVerticalScrollSpeeds[] = { +static const u8 sWindowVerticalScrollSpeeds[] = { [OPTIONS_TEXT_SPEED_SLOW] = 1, [OPTIONS_TEXT_SPEED_MID] = 2, [OPTIONS_TEXT_SPEED_FAST] = 4, @@ -299,7 +299,7 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi else { sTempTextPrinter.textSpeed = 0; - + // Render all text (up to limit) at once for (j = 0; j < 0x400; ++j) { diff --git a/graphics_file_rules.mk b/graphics_file_rules.mk index 742f7d1b8..6f4d1e422 100644 --- a/graphics_file_rules.mk +++ b/graphics_file_rules.mk @@ -93,35 +93,35 @@ $(TILESETGFXDIR)/secondary/sootopolis/tiles.4bpp: %.4bpp: %.png SOOTOPOLISANIMDIR := $(TILESETGFXDIR)/secondary/sootopolis/anim $(SOOTOPOLISANIMDIR)/stormy_water/0.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/0_kyogre.4bpp \ - $(SOOTOPOLISANIMDIR)/stormy_water/0_groudon.4bpp + $(SOOTOPOLISANIMDIR)/stormy_water/0_groudon.4bpp @cat $^ >$@ $(SOOTOPOLISANIMDIR)/stormy_water/1.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/1_kyogre.4bpp \ - $(SOOTOPOLISANIMDIR)/stormy_water/1_groudon.4bpp + $(SOOTOPOLISANIMDIR)/stormy_water/1_groudon.4bpp @cat $^ >$@ $(SOOTOPOLISANIMDIR)/stormy_water/2.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/2_kyogre.4bpp \ - $(SOOTOPOLISANIMDIR)/stormy_water/2_groudon.4bpp + $(SOOTOPOLISANIMDIR)/stormy_water/2_groudon.4bpp @cat $^ >$@ $(SOOTOPOLISANIMDIR)/stormy_water/3.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/3_kyogre.4bpp \ - $(SOOTOPOLISANIMDIR)/stormy_water/3_groudon.4bpp + $(SOOTOPOLISANIMDIR)/stormy_water/3_groudon.4bpp @cat $^ >$@ $(SOOTOPOLISANIMDIR)/stormy_water/4.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/4_kyogre.4bpp \ - $(SOOTOPOLISANIMDIR)/stormy_water/4_groudon.4bpp + $(SOOTOPOLISANIMDIR)/stormy_water/4_groudon.4bpp @cat $^ >$@ $(SOOTOPOLISANIMDIR)/stormy_water/5.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/5_kyogre.4bpp \ - $(SOOTOPOLISANIMDIR)/stormy_water/5_groudon.4bpp + $(SOOTOPOLISANIMDIR)/stormy_water/5_groudon.4bpp @cat $^ >$@ $(SOOTOPOLISANIMDIR)/stormy_water/6.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/6_kyogre.4bpp \ - $(SOOTOPOLISANIMDIR)/stormy_water/6_groudon.4bpp + $(SOOTOPOLISANIMDIR)/stormy_water/6_groudon.4bpp @cat $^ >$@ $(SOOTOPOLISANIMDIR)/stormy_water/7.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/7_kyogre.4bpp \ - $(SOOTOPOLISANIMDIR)/stormy_water/7_groudon.4bpp + $(SOOTOPOLISANIMDIR)/stormy_water/7_groudon.4bpp @cat $^ >$@ $(TILESETGFXDIR)/secondary/battle_frontier_outside_west/tiles.4bpp: %.4bpp: %.png @@ -671,7 +671,7 @@ $(OBJEVENTGFXDIR)/pics/effects/unknown_4F6D38/0.4bpp: %.4bpp: %.png $(INTERFACEGFXDIR)/selector_outline.4bpp: %.4bpp: %.png $(GFX) $< $@ -num_tiles 8 -Wnum_tiles - + $(BATTRANSGFXDIR)/frontier_logo_center.4bpp: %.4bpp: %.png $(GFX) $< $@ -num_tiles 43 -Wnum_tiles @@ -699,7 +699,7 @@ $(PKNAVGFXDIR)/header.4bpp: %.4bpp: %.png $(PKNAVGFXDIR)/device_outline.4bpp: %.4bpp: %.png $(GFX) $< $@ -num_tiles 53 -Wnum_tiles - + $(PKNAVGFXDIR)/match_call/ui.4bpp: %.4bpp: %.png $(GFX) $< $@ -num_tiles 13 -Wnum_tiles diff --git a/include/battle.h b/include/battle.h index 5cc552185..e779dee3d 100644 --- a/include/battle.h +++ b/include/battle.h @@ -473,7 +473,7 @@ struct BattleStruct #define SET_STATCHANGER(statId, stage, goesDown)(gBattleScripting.statChanger = (statId) + (stage << 4) + (goesDown << 7)) -// NOTE: The members of this struct have hard-coded offsets +// NOTE: The members of this struct have hard-coded offsets // in include/constants/battle_script_commands.h struct BattleScripting { diff --git a/include/global.h b/include/global.h index b1fd21d8b..6e2cfa9b8 100644 --- a/include/global.h +++ b/include/global.h @@ -878,7 +878,7 @@ struct MysteryGiftSave struct WonderCardMetadata cardMetadata; u16 questionnaireWords[NUM_QUESTIONNAIRE_WORDS]; struct WonderNewsMetadata newsMetadata; - u32 trainerIds[2][5]; // Saved ids for 10 trainers, 5 each for battles and trades + u32 trainerIds[2][5]; // Saved ids for 10 trainers, 5 each for battles and trades }; // 0x36C 0x3598 // For external event data storage. The majority of these may have never been used. diff --git a/include/link_rfu.h b/include/link_rfu.h index 673b19ff9..1e434e830 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -97,12 +97,12 @@ struct RfuGameCompatibilityData // wireless play (the kind the Pokémon games use) the gname data can be used for // anything the developers want. This struct is what GF decided to use it for. // It can be up to 13 bytes in size (RFU_GAME_NAME_LENGTH). -// The player's name is sent separately as the username ("uname"), and does not +// The player's name is sent separately as the username ("uname"), and does not // use a struct (gHostRfuUsername). struct __attribute__((packed, aligned(2))) RfuGameData { struct RfuGameCompatibilityData compatibility; - u8 partnerInfo[RFU_CHILD_MAX]; + u8 partnerInfo[RFU_CHILD_MAX]; u16 tradeSpecies:10; u16 tradeType:6; u8 activity:7; @@ -118,7 +118,7 @@ struct __attribute__((packed, aligned(2))) RfuGameData // Bits 0-2 are a shortened trainerId // Bit 3 is the player's gender // Bits 4-6 are unknown/unused -// Bit 7 is an 'active' flag +// Bit 7 is an 'active' flag #define PINFO_TID_MASK 0x7 #define PINFO_GENDER_SHIFT 3 #define PINFO_ACTIVE_FLAG (1 << 7) diff --git a/include/pokenav.h b/include/pokenav.h index 959998383..c6a8bb253 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -116,7 +116,7 @@ enum #define POKENAV_MENU_IDS_START 100000 enum { - POKENAV_MAIN_MENU = POKENAV_MENU_IDS_START, // The main menu where the player selects Hoenn Map/Condition/Match Call/Ribbons + POKENAV_MAIN_MENU = POKENAV_MENU_IDS_START, // The main menu where the player selects Hoenn Map/Condition/Match Call/Ribbons POKENAV_MAIN_MENU_CURSOR_ON_MAP, POKENAV_CONDITION_MENU, // The first Condition screen where the player selects Party or Search POKENAV_CONDITION_SEARCH_MENU, // The Condition search menu where the player selects a search parameter diff --git a/include/union_room.h b/include/union_room.h index acff4b592..514a15985 100644 --- a/include/union_room.h +++ b/include/union_room.h @@ -7,7 +7,7 @@ // In the Union Room the player is only ever connected to ≤ 4 other players. // However, there can be up to MAX_UNION_ROOM_LEADERS (8) object events to -// represent leaders of recently discovered link groups, and each of those groups +// represent leaders of recently discovered link groups, and each of those groups // may have up to MAX_RFU_PLAYERS (5) players in it including the leader. // These players are represented on-screen by NPC sprites drawn around the leader. // Thus there can be 40 sprites of other players on-screen, in 8 groups of 5. @@ -16,7 +16,7 @@ // The maximum number of recently connected players that can be tracked. // Note that this is significantly less than NUM_UNION_ROOM_SPRITES, i.e. not // every player that can be shown in the Union Room can be tracked at once. -// Information such as a group member's gender can instead be read from partnerInfo +// Information such as a group member's gender can instead be read from partnerInfo // of the leader's RfuGameData by tracking at least all of the group leaders. #define MAX_RFU_PLAYER_LIST_SIZE 16 diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index 25817c074..a5d4659a9 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -495,7 +495,7 @@ static void TranslateSpriteInLissajousCurve(struct Sprite *sprite) sprite->y2 = Cos(sprite->sCirclePosY, sprite->sAmplitude); sprite->sCirclePosX += sprite->sCircleSpeedX; sprite->sCirclePosY += sprite->sCircleSpeedY; - + if (sprite->sCirclePosX >= 0x100) sprite->sCirclePosX -= 0x100; else if (sprite->sCirclePosX < 0) @@ -2429,7 +2429,7 @@ void AnimTask_AttackerPunchWithTrace(u8 taskId) dest = (task->tPaletteNum + 16) * 16; src = (gSprites[task->tBattlerSpriteId].oam.paletteNum + 0x10) * 0x10; - + // Set trace's priority based on battler's subpriority task->tPriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker); if (task->tPriority == 20 || task->tPriority == 40) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d2235027c..fb5a7649a 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6368,7 +6368,7 @@ static void Cmd_various(void) break; case VARIOUS_ARENA_JUDGMENT_WINDOW: i = BattleArena_ShowJudgmentWindow(&gBattleCommunication[0]); - + // BattleArena_ShowJudgmentWindow's last state was an intermediate step. // Return without advancing the current instruction so that it will be called again. if (i == ARENA_RESULT_RUNNING) diff --git a/src/battle_tent.c b/src/battle_tent.c index dba9e6e8a..e51ac38a5 100644 --- a/src/battle_tent.c +++ b/src/battle_tent.c @@ -390,7 +390,7 @@ static void GenerateOpponentMons(void) while (i != FRONTIER_PARTY_SIZE) { sRandMonId = monSet[Random() % numMons]; - + // Ensure none of the opponent's pokemon are the same as the potential rental pokemon for the player for (j = 0; j < (int)ARRAY_COUNT(gSaveBlock2Ptr->frontier.rentalMons); j++) { diff --git a/src/battle_transition.c b/src/battle_transition.c index bc289efa7..3675421ee 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -2434,7 +2434,7 @@ static bool8 Mugshot_WaitStartPlayerSlide(struct Task *task) { sTransitionData->BG0HOFS_Lower -= 8; sTransitionData->BG0HOFS_Upper += 8; - + // Start player's slide in once the opponent is finished if (IsTrainerPicSlideDone(task->tOpponentSpriteId)) { @@ -2770,7 +2770,7 @@ static bool8 Slice_Main(struct Task *task) { u16 *storeLoc1 = &gScanlineEffectRegBuffers[0][i]; u16 *storeLoc2 = &gScanlineEffectRegBuffers[0][i + DISPLAY_HEIGHT]; - + // Alternate rows if (i % 2) { @@ -3251,7 +3251,7 @@ static bool8 RectangularSpiral_Main(struct Task *task) // The line moved to a new position, draw the tile. done = FALSE; position = sRectangularSpiralLines[j].position; - + // Invert position for the two lines that start at the bottom. if ((j % 2) == 1) position = 637 - position; @@ -3281,7 +3281,7 @@ static bool8 RectangularSpiral_End(struct Task *task) static bool16 UpdateRectangularSpiralLine(const s16 * const *moveDataTable, struct RectangularSpiralLine *line) { const s16 *moveData = moveDataTable[line->state]; - + // Has spiral finished? // Note that most move data arrays endsin SPIRAL_END but it is // only ever reached on the final array of spiraling outward. @@ -3294,9 +3294,9 @@ static bool16 UpdateRectangularSpiralLine(const s16 * const *moveDataTable, stru sDebug_RectangularSpiralData = moveData[2]; sDebug_RectangularSpiralData = moveData[3]; - // Note that for the two lines originating at the bottom the + // Note that for the two lines originating at the bottom the // position is inverted, so the directions are flipped. - // i.e. position += 1 is right for the top lines and left + // i.e. position += 1 is right for the top lines and left // for their inverted partners on the bottom. switch (moveData[0]) { @@ -4170,13 +4170,13 @@ static void InitBlackWipe(s16 *data, s16 startX, s16 startY, s16 endX, s16 endY, static bool8 UpdateBlackWipe(s16 *data, bool8 xExact, bool8 yExact) { u8 numFinished; - + if (tWipeXDist > tWipeYDist) { // X has further to move, move it first tWipeCurrX += tWipeXMove; - // If it has been far enough since Y's + // If it has been far enough since Y's // last move then move it too tWipeTemp += tWipeYDist; if (tWipeTemp > tWipeXDist) @@ -4190,7 +4190,7 @@ static bool8 UpdateBlackWipe(s16 *data, bool8 xExact, bool8 yExact) // Y has further to move, move it first tWipeCurrY += tWipeYMove; - // If it has been far enough since X's + // If it has been far enough since X's // last move then move it too tWipeTemp += tWipeXDist; if (tWipeTemp > tWipeYDist) @@ -4201,9 +4201,9 @@ static bool8 UpdateBlackWipe(s16 *data, bool8 xExact, bool8 yExact) } numFinished = 0; - + // Has X coord reached end? - if ((tWipeXMove > 0 && tWipeCurrX >= tWipeEndX) + if ((tWipeXMove > 0 && tWipeCurrX >= tWipeEndX) || (tWipeXMove < 0 && tWipeCurrX <= tWipeEndX)) { numFinished++; @@ -4212,7 +4212,7 @@ static bool8 UpdateBlackWipe(s16 *data, bool8 xExact, bool8 yExact) } // Has Y coord reached end? - if ((tWipeYMove > 0 && tWipeCurrY >= tWipeEndY) + if ((tWipeYMove > 0 && tWipeCurrY >= tWipeEndY) || (tWipeYMove < 0 && tWipeCurrY <= tWipeEndY)) { numFinished++; diff --git a/src/data/field_effects/field_effect_objects.h b/src/data/field_effects/field_effect_objects.h index 938b6bfc5..d19adf6f0 100755 --- a/src/data/field_effects/field_effect_objects.h +++ b/src/data/field_effects/field_effect_objects.h @@ -1147,7 +1147,7 @@ static const union AnimCmd *const sAnimTable_AshPuff[] = sAnim_AshPuff, }; -const struct SpriteTemplate gFieldEffectObjectTemplate_AshPuff = +const struct SpriteTemplate gFieldEffectObjectTemplate_AshPuff = { .tileTag = TAG_NONE, .paletteTag = FLDEFF_PAL_TAG_ASH, diff --git a/src/decoration.c b/src/decoration.c index cc740f189..c5c7c02c3 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -1211,7 +1211,7 @@ static void ShowDecorationOnMap_(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, { x = mapX + i; attributes = GetMetatileAttributesById(NUM_TILES_IN_PRIMARY + gDecorations[decoration].tiles[j * decWidth + i]); - if (MetatileBehavior_IsSecretBaseImpassable(attributes & METATILE_ATTR_BEHAVIOR_MASK) == TRUE + if (MetatileBehavior_IsSecretBaseImpassable(attributes & METATILE_ATTR_BEHAVIOR_MASK) == TRUE || (gDecorations[decoration].permission != DECORPERM_PASS_FLOOR && (attributes >> METATILE_ATTR_LAYER_SHIFT) != METATILE_LAYER_TYPE_NORMAL)) impassableFlag = MAPGRID_COLLISION_MASK; else @@ -1482,7 +1482,7 @@ static bool8 IsSecretBaseTrainerSpot(u8 behaviorAt, u16 layerType) // Can't place decoration where the player was standing when they interacted with the PC static bool8 IsntInitialPosition(u8 taskId, s16 x, s16 y, u16 layerType) { - if (x == gTasks[taskId].tInitialX + MAP_OFFSET + if (x == gTasks[taskId].tInitialX + MAP_OFFSET && y == gTasks[taskId].tInitialY + MAP_OFFSET && layerType != METATILE_LAYER_TYPE_NORMAL) return FALSE; diff --git a/src/ereader_screen.c b/src/ereader_screen.c index 3baff84a8..b6bf7133a 100755 --- a/src/ereader_screen.c +++ b/src/ereader_screen.c @@ -112,7 +112,7 @@ static bool32 ValidateEReaderConnection(void) REG_IME = 0; *(u64 *)handshakes = *(u64 *)gLink.handshakeBuffer; REG_IME = backupIME; - + // Validate that we are player 1, the EReader is player 2, // and that players 3 and 4 are empty. if (handshakes[0] == SLAVE_HANDSHAKE && handshakes[1] == EREADER_HANDSHAKE @@ -154,8 +154,8 @@ enum { static u32 TryReceiveCard(u8 *state, u16 *timer) { - if (*state >= RECV_STATE_EXCHANGE - && *state <= RECV_STATE_WAIT_DISCONNECT + if (*state >= RECV_STATE_EXCHANGE + && *state <= RECV_STATE_WAIT_DISCONNECT && HasLinkErrorOccurred()) { // Return error status if an error occurs diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 87249af01..a63eeb22b 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -2623,7 +2623,7 @@ bool8 ObjectEventIsTrainerAndCloseToPlayer(struct ObjectEvent *objectEvent) minY = objY - objectEvent->trainerRange_berryTreeId; maxX = objX + objectEvent->trainerRange_berryTreeId; maxY = objY + objectEvent->trainerRange_berryTreeId; - if (minX > playerX || maxX < playerX + if (minX > playerX || maxX < playerX || minY > playerY || maxY < playerY) return FALSE; diff --git a/src/field_tasks.c b/src/field_tasks.c index 099014a4d..dec5cba80 100644 --- a/src/field_tasks.c +++ b/src/field_tasks.c @@ -251,7 +251,7 @@ static const struct PacifidlogMetatileOffsets *GetPacifidlogBridgeMetatileOffset static void TrySetPacifidlogBridgeMetatiles(const struct PacifidlogMetatileOffsets *offsets, s16 x, s16 y, bool32 redrawMap) { offsets = GetPacifidlogBridgeMetatileOffsets(offsets, MapGridGetMetatileBehaviorAt(x, y)); - + // If offsets is NULL, position is not a log (don't set it) if (offsets) { @@ -301,7 +301,7 @@ static bool32 ShouldRaisePacifidlogLogs(s16 newX, s16 newY, s16 oldX, s16 oldY) } else if (MetatileBehavior_IsPacifidlogHorizontalLogLeft(oldBehavior)) { - // Still on same one if moved from left to right + // Still on same one if moved from left to right if (newX > oldX) return FALSE; } @@ -340,13 +340,13 @@ static bool32 ShouldSinkPacifidlogLogs(s16 newX, s16 newY, s16 oldX, s16 oldY) } else if (MetatileBehavior_IsPacifidlogHorizontalLogLeft(newBehavior)) { - // Still on same one if moved from right to left + // Still on same one if moved from right to left if (newX < oldX) return FALSE; } else if (MetatileBehavior_IsPacifidlogHorizontalLogRight(newBehavior)) { - // Still on same one if moved from left to right + // Still on same one if moved from left to right if (newX > oldX) return FALSE; } @@ -371,7 +371,7 @@ static void PacifidlogBridgePerStepCallback(u8 taskId) case 0: tPrevX = x; tPrevY = y; - + // If player is already standing on a log when the callback // is set then immediately set it to submerged TrySetLogBridgeFullySubmerged(x, y, TRUE); @@ -424,7 +424,7 @@ static void PacifidlogBridgePerStepCallback(u8 taskId) { // If player's current position is a log submerge it fully. TrySetLogBridgeFullySubmerged(x, y, TRUE); - + // Player's previous position is not the other end of a log // they're standing on, try to raise their previous position. if (tToRaiseX != -1 && tToRaiseY != -1) @@ -499,7 +499,7 @@ static void FortreeBridgePerStepCallback(u8 taskId) case 0: tPrevX = x; tPrevY = y; - + // If player is already on bridge when callback is set then lower it immediately. if (MetatileBehavior_IsFortreeBridge(MapGridGetMetatileBehaviorAt(x, y))) { @@ -518,7 +518,7 @@ static void FortreeBridgePerStepCallback(u8 taskId) isFortreeBridgeCur = MetatileBehavior_IsFortreeBridge(MapGridGetMetatileBehaviorAt(x, y)); isFortreeBridgePrev = MetatileBehavior_IsFortreeBridge(MapGridGetMetatileBehaviorAt(prevX, prevY)); - + // Make sure player isn't below bridge elevation = PlayerGetElevation(); onBridgeElevation = FALSE; @@ -672,7 +672,7 @@ static void SootopolisGymIcePerStepCallback(u8 taskId) // End if player hasn't moved if (x == tPrevX && y == tPrevY) return; - + tPrevX = x; tPrevY = y; tileBehavior = MapGridGetMetatileBehaviorAt(x, y); diff --git a/src/link_rfu_2.c b/src/link_rfu_2.c index 437cec2fd..4730c74fd 100644 --- a/src/link_rfu_2.c +++ b/src/link_rfu_2.c @@ -61,7 +61,7 @@ struct SioInfo u8 filler[92]; }; -// Struct is mostly empty, presumably because usage of +// Struct is mostly empty, presumably because usage of // its fields was largely removed before release struct RfuDebug { @@ -1643,7 +1643,7 @@ bool32 RfuTryDisconnectLeavingChildren(void) { u8 childrenLeaving = 0; s32 i; - + // Check all children, get those waiting to be disconnected for (i = 0; i < RFU_CHILD_MAX; i++) { @@ -2123,7 +2123,7 @@ void SetUnionRoomChatPlayerData(u32 numPlayers) // Only trainerId is shifted by the number of children, so the active flag and gender // are only ever set for the first child partnerInfo |= ((PINFO_ACTIVE_FLAG - | ((gLinkPlayers[gRfu.linkPlayerIdx[i]].gender & 1) << PINFO_GENDER_SHIFT) + | ((gLinkPlayers[gRfu.linkPlayerIdx[i]].gender & 1) << PINFO_GENDER_SHIFT) | (gLinkPlayers[gRfu.linkPlayerIdx[i]].trainerId & PINFO_TID_MASK)) << (numConnectedChildren * 8)); numConnectedChildren++; if (numConnectedChildren == numPlayers - 1) @@ -2477,7 +2477,7 @@ static void LinkManagerCB_UnionRoom(u8 msg, u8 paramCount) rfu_LMAN_stopManager(FALSE); } - if (gRfuLinkStatus->parentChild == MODE_NEUTRAL + if (gRfuLinkStatus->parentChild == MODE_NEUTRAL && !lman.pcswitch_flag && FuncIsActiveTask(Task_UnionRoomListen) == TRUE) gRfu.state = RFUSTATE_UR_CONNECT; @@ -2816,7 +2816,7 @@ static bool32 IsPartnerActivityIncompatible(s16 activity, struct RfuGameData *pa } else if (activity == (ACTIVITY_TRADE | IN_UNION_ROOM)) { - // Verify that the trade offered hasn't changed + // Verify that the trade offered hasn't changed struct RfuGameData *original = &gRfu.parent; if (original->tradeSpecies == SPECIES_EGG) { diff --git a/src/link_rfu_3.c b/src/link_rfu_3.c index 1e1fe5b34..0825daea2 100644 --- a/src/link_rfu_3.c +++ b/src/link_rfu_3.c @@ -824,7 +824,7 @@ void UpdateWirelessStatusIndicatorSprite(void) struct Sprite *sprite = &gSprites[gWirelessStatusIndicatorSpriteId]; u8 signalStrength = RFU_LINK_ICON_LEVEL4_MAX; u8 i = 0; - + // Get weakest signal strength if (gRfuLinkStatus->parentChild == MODE_PARENT) { diff --git a/src/metatile_behavior.c b/src/metatile_behavior.c index 72d3ac632..e35a5b29a 100644 --- a/src/metatile_behavior.c +++ b/src/metatile_behavior.c @@ -795,7 +795,7 @@ u8 MetatileBehavior_GetBridgeType(u8 metatileBehavior) && metatileBehavior <= MB_BRIDGE_OVER_POND_HIGH) return metatileBehavior - MB_BRIDGE_OVER_OCEAN; - if (metatileBehavior >= MB_BRIDGE_OVER_POND_MED_EDGE_1 + if (metatileBehavior >= MB_BRIDGE_OVER_POND_MED_EDGE_1 && metatileBehavior <= MB_BRIDGE_OVER_POND_MED_EDGE_2) return BRIDGE_TYPE_POND_MED; diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 72fc2b377..c4e63bfbb 100755 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -171,8 +171,8 @@ static bool32 ValidateWonderCard(const struct WonderCard *card) return FALSE; if (card->type >= CARD_TYPE_COUNT) return FALSE; - if (!(card->sendType == SEND_TYPE_DISALLOWED - || card->sendType == SEND_TYPE_ALLOWED + if (!(card->sendType == SEND_TYPE_DISALLOWED + || card->sendType == SEND_TYPE_ALLOWED || card->sendType == SEND_TYPE_ALLOWED_ALWAYS)) return FALSE; if (card->bgType >= NUM_WONDER_BGS) @@ -429,7 +429,7 @@ u32 MysteryGift_CompareCardFlags(const u16 *flagId, const struct MysteryGiftLink u32 MysteryGift_CheckStamps(const u16 *stamp, const struct MysteryGiftLinkGameData *data, const void *unused) { int stampsMissing = data->maxStamps - GetNumStampsInMetadata(&data->cardMetadata, data->maxStamps); - + // Has full stamp card? if (stampsMissing == 0) return 1; @@ -598,7 +598,7 @@ void MysteryGift_TryIncrementStat(u32 stat, u32 trainerId) switch (stat) { case CARD_STAT_NUM_TRADES: - IncrementCardStatForNewTrainer(CARD_STAT_NUM_TRADES, + IncrementCardStatForNewTrainer(CARD_STAT_NUM_TRADES, trainerId, gSaveBlock1Ptr->mysteryGift.trainerIds[1], ARRAY_COUNT(gSaveBlock1Ptr->mysteryGift.trainerIds[1])); diff --git a/src/mystery_gift_menu.c b/src/mystery_gift_menu.c index 92e544a27..9e4796bb2 100644 --- a/src/mystery_gift_menu.c +++ b/src/mystery_gift_menu.c @@ -1240,7 +1240,7 @@ static void Task_MysteryGift(u8 taskId) } else if (gSpecialVar_Result == LINKUP_FAILED) { - // Link failed, return to link start menu + // Link failed, return to link start menu ClearScreenInBg0(TRUE); data->state = MG_STATE_SOURCE_PROMPT; } diff --git a/src/mystery_gift_view.c b/src/mystery_gift_view.c index 384e8ef74..b059b183c 100644 --- a/src/mystery_gift_view.c +++ b/src/mystery_gift_view.c @@ -340,7 +340,7 @@ static void BufferCardText(void) if (sWonderCardData->card.idNumber > 999999) sWonderCardData->card.idNumber = 999999; ConvertIntToDecimalStringN(sWonderCardData->idNumberText, sWonderCardData->card.idNumber, STR_CONV_MODE_LEFT_ALIGN, 6); - + // Copy body text for (i = 0; i < WONDER_CARD_BODY_TEXT_LINES; i++) { @@ -364,12 +364,12 @@ static void BufferCardText(void) break; case CARD_TYPE_LINK_STAT: sWonderCardData->giftText[0] = EOS; - + // Load stats stats[0] = sWonderCardData->cardMetadata.battlesWon < MAX_WONDER_CARD_STAT ? sWonderCardData->cardMetadata.battlesWon : MAX_WONDER_CARD_STAT; stats[1] = sWonderCardData->cardMetadata.battlesLost < MAX_WONDER_CARD_STAT ? sWonderCardData->cardMetadata.battlesLost : MAX_WONDER_CARD_STAT; stats[2] = sWonderCardData->cardMetadata.numTrades < MAX_WONDER_CARD_STAT ? sWonderCardData->cardMetadata.numTrades : MAX_WONDER_CARD_STAT; - + // Init stat text arrays for (i = 0; i < ARRAY_COUNT(sWonderCardData->statTextData); i++) { @@ -446,7 +446,7 @@ static void DrawCardWindow(u8 whichWindow) sCard_FooterTextOffsets[sWonderCardData->card.type], sCard_TextColorTable[sWonderCardData->gfx->footerTextPal], 0, sWonderCardData->footerLine1Text); - + // Print footer line 2 if (sWonderCardData->card.type != CARD_TYPE_LINK_STAT) { @@ -486,7 +486,7 @@ static void CreateCardSprites(void) { u8 i = 0; sWonderCardData->monIconSpriteId = SPRITE_NONE; - + // Create icon sprite if (sWonderCardData->cardMetadata.iconSpecies != SPECIES_NONE) { @@ -505,7 +505,7 @@ static void CreateCardSprites(void) sWonderCardData->stampSpriteIds[i][1] = SPRITE_NONE; sWonderCardData->stampSpriteIds[i][0] = CreateSprite(&sSpriteTemplate_StampShadow, 216 - 32 * i, 144, 8); if (sWonderCardData->cardMetadata.stampData[STAMP_SPECIES][i] != SPECIES_NONE) - sWonderCardData->stampSpriteIds[i][1] = CreateMonIconNoPersonality(GetIconSpeciesNoPersonality(sWonderCardData->cardMetadata.stampData[STAMP_SPECIES][i]), + sWonderCardData->stampSpriteIds[i][1] = CreateMonIconNoPersonality(GetIconSpeciesNoPersonality(sWonderCardData->cardMetadata.stampData[STAMP_SPECIES][i]), SpriteCallbackDummy, 216 - 32 * i, 136, 0, 0); @@ -520,7 +520,7 @@ static void DestroyCardSprites(void) // Destroy icon sprite if (sWonderCardData->monIconSpriteId != SPRITE_NONE) FreeAndDestroyMonIconSprite(&gSprites[sWonderCardData->monIconSpriteId]); - + // Destroy stamp sprites if (sWonderCardData->card.maxStamps != 0 && sWonderCardData->card.type == CARD_TYPE_STAMP) { @@ -865,7 +865,7 @@ u32 WonderNews_GetInput(u16 input) static void BufferNewsText(void) { u8 i = 0; - + // Copy title text memcpy(sWonderNewsData->titleText, sWonderNewsData->news.titleText, WONDER_NEWS_TEXT_LENGTH); sWonderNewsData->titleText[WONDER_NEWS_TEXT_LENGTH] = EOS; @@ -896,7 +896,7 @@ static void DrawNewsWindows(void) if (x < 0) x = 0; AddTextPrinterParameterized3(sWonderNewsData->windowIds[NEWS_WIN_TITLE], FONT_SHORT_COPY_1, x, 6, sNews_TextColorTable[sWonderNewsData->gfx->titleTextPal], 0, sWonderNewsData->titleText); - + // Print body text for (; i < WONDER_NEWS_BODY_TEXT_LINES; i++) AddTextPrinterParameterized3(sWonderNewsData->windowIds[NEWS_WIN_BODY], FONT_SHORT_COPY_1, 0, diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c index dde86f155..01cbacb44 100755 --- a/src/pokedex_area_screen.c +++ b/src/pokedex_area_screen.c @@ -560,7 +560,7 @@ static void DoAreaGlow(void) if (sPokedexAreaScreen->markerTimer > 12) { sPokedexAreaScreen->markerTimer = 0; - + // Flash the marker // With a max of 4, the marker will disappear twice sPokedexAreaScreen->markerFlashCounter++; @@ -737,7 +737,7 @@ static void CreateAreaMarkerSprites(void) static void DestroyAreaScreenSprites(void) { u16 i; - + // Destroy area marker sprites FreeSpriteTilesByTag(TAG_AREA_MARKER); FreeSpritePaletteByTag(TAG_AREA_MARKER); @@ -772,7 +772,7 @@ static void CreateAreaUnknownSprites(void) if (sPokedexAreaScreen->numOverworldAreas || sPokedexAreaScreen->numSpecialAreas) { - // The current species is present on the map, don't create any "Area Unknown" sprites + // The current species is present on the map, don't create any "Area Unknown" sprites for (i = 0; i < ARRAY_COUNT(sPokedexAreaScreen->areaUnknownSprites); i++) sPokedexAreaScreen->areaUnknownSprites[i] = NULL; } diff --git a/src/pokemon.c b/src/pokemon.c index e16bc64a6..b65f97bd8 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1848,7 +1848,7 @@ static const u8 sMonAnimationDelayTable[NUM_SPECIES - 1] = #define PP_UP_SHIFTS_INV(val) (u8)~(val), (u8)~((val) << 2), (u8)~((val) << 4), (u8)~((val) << 6) // PP Up bonuses are stored for a Pokémon as a single byte. -// There are 2 bits (a value 0-3) for each move slot that +// There are 2 bits (a value 0-3) for each move slot that // represent how many PP Ups have been applied. // The following arrays take a move slot id and return: // gPPUpGetMask - A mask to get the number of PP Ups applied to that move slot @@ -3119,7 +3119,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de spAttack = attacker->spAttack; spDefense = defender->spDefense; - // Get attacker hold item info + // Get attacker hold item info if (attacker->item == ITEM_ENIGMA_BERRY) { attackerHoldEffect = gEnigmaBerries[battlerIdAtk].holdEffect; @@ -5204,7 +5204,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov case 4: // ITEM5_PP_MAX dataUnsigned = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2); temp2 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex); - + // Check if 3 PP Ups have been applied already, and that the move has a total PP of at least 5 (excludes Sketch) if (dataUnsigned < 3 && temp2 >= 5) { @@ -6918,7 +6918,7 @@ static bool8 ShouldSkipFriendshipChange(void) // Only the 'default' mode (MON_SPR_GFX_MODE_NORMAL) is used, which is set // up to allocate 4 sprites using the battler sprite templates (gBattlerSpriteTemplates). // MON_SPR_GFX_MODE_BATTLE is identical but never used. -// MON_SPR_GFX_MODE_FULL_PARTY is set up to allocate 7 sprites (party + trainer?) +// MON_SPR_GFX_MODE_FULL_PARTY is set up to allocate 7 sprites (party + trainer?) // using a generic 64x64 template, and is also never used. // Between the unnecessarily large sizes below, a mistake allocating the spritePointers @@ -6980,7 +6980,7 @@ struct MonSpritesGfxManager *CreateMonSpritesGfxManager(u8 managerId, u8 mode) gfx->dataSize = 1; gfx->mode = MON_SPR_GFX_MODE_FULL_PARTY; break; - // case MON_SPR_GFX_MODE_BATTLE: + // case MON_SPR_GFX_MODE_BATTLE: case MON_SPR_GFX_MODE_NORMAL: default: gfx->numSprites = MAX_BATTLERS_COUNT; diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index aa55e42c7..74e1da2cc 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3879,7 +3879,7 @@ static u8 LoadMonGfxAndSprite(struct Pokemon *mon, s16 *state) summary->species2, summary->pid); else - HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], + HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT], summary->species2, summary->pid); @@ -3891,7 +3891,7 @@ static u8 LoadMonGfxAndSprite(struct Pokemon *mon, s16 *state) if (sMonSummaryScreen->monList.mons == gPlayerParty || sMonSummaryScreen->mode == SUMMARY_MODE_BOX || sMonSummaryScreen->unk40EF == TRUE) HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT], - summary->species2, + summary->species2, summary->pid); else HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[summary->species2], diff --git a/src/pokenav_menu_handler_gfx.c b/src/pokenav_menu_handler_gfx.c index bc55fa751..ec8d67cbe 100644 --- a/src/pokenav_menu_handler_gfx.c +++ b/src/pokenav_menu_handler_gfx.c @@ -904,7 +904,7 @@ static void StartOptionAnimations_Enter(void) // Not selected, set default position x = OPTION_DEFAULT_X; } - + // Slide new options in StartOptionSlide(gfx->iconSprites[i], OPTION_EXIT_X, x, 12); SetOptionInvisibility(gfx->iconSprites[i], FALSE); diff --git a/src/record_mixing.c b/src/record_mixing.c index b03d7be2f..c899db25e 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -879,7 +879,7 @@ static void ReceiveDaycareMailData(struct RecordMixingDaycareMail *records, size for (i = 0; i < linkPlayerCount; i++) { mixMail = (void *)records + i * recordSize; - + // Count number of players that have at least // one daycare Pokémon with no held item if (canHoldItem[i][0] == TRUE || canHoldItem[i][1] == TRUE) @@ -945,7 +945,7 @@ static void ReceiveDaycareMailData(struct RecordMixingDaycareMail *records, size case 4: // 4 players can swap, select which 2 pairings will swap ptr = idxs; - + // Swap pair 1 playerSlot1 = sDaycareMailSwapIds_4Player[tableId][0]; playerSlot2 = sDaycareMailSwapIds_4Player[tableId][1]; diff --git a/src/roamer.c b/src/roamer.c index c17ec490c..e9dc72a99 100644 --- a/src/roamer.c +++ b/src/roamer.c @@ -127,7 +127,7 @@ void UpdateLocationHistoryForRoamer(void) void RoamerMoveToOtherLocationSet(void) { u8 mapNum = 0; - + if (!ROAMER->active) return; @@ -170,8 +170,8 @@ void RoamerMove(void) // Choose a new map (excluding the first) within this set // Also exclude a map if the roamer was there 2 moves ago mapNum = sRoamerLocations[locSet][(Random() % (NUM_LOCATIONS_PER_SET - 1)) + 1]; - if (!(sLocationHistory[2][MAP_GRP] == ROAMER_MAP_GROUP - && sLocationHistory[2][MAP_NUM] == mapNum) + if (!(sLocationHistory[2][MAP_GRP] == ROAMER_MAP_GROUP + && sLocationHistory[2][MAP_NUM] == mapNum) && mapNum != MAP_NUM(UNDEFINED)) break; } diff --git a/src/rom_header.s b/src/rom_header.s index c5fa5ddf4..75edcebd8 100644 --- a/src/rom_header.s +++ b/src/rom_header.s @@ -1,5 +1,5 @@ @ Note: ROM header data is empty space here. -@ It's populated by gbafix using data provided in the Makefile. +@ It's populated by gbafix using data provided in the Makefile. .global Start Start: diff --git a/src/save.c b/src/save.c index e7c91580e..765fb045c 100644 --- a/src/save.c +++ b/src/save.c @@ -913,7 +913,7 @@ u16 GetSaveBlocksPointersBaseOffset(void) for (i = 0; i < NUM_SECTORS_PER_SLOT; i++) { ReadFlashSector(i + slotOffset, gReadWriteSector); - + // Base offset for SaveBlock2 is calculated using the trainer id if (gReadWriteSector->id == SECTOR_ID_SAVEBLOCK2) return sector->data[offsetof(struct SaveBlock2, playerTrainerId[0])] + diff --git a/src/script.c b/src/script.c index 484f8e966..c252c95f0 100644 --- a/src/script.c +++ b/src/script.c @@ -213,9 +213,9 @@ void ScriptContext_Init(void) sGlobalScriptContextStatus = CONTEXT_SHUTDOWN; } -// Runs the script until the script makes a wait* call, then returns true if -// there's more script to run, or false if the script has hit the end. -// This function also returns false if the context is finished +// Runs the script until the script makes a wait* call, then returns true if +// there's more script to run, or false if the script has hit the end. +// This function also returns false if the context is finished // or waiting (after a call to _Stop) bool8 ScriptContext_RunScript(void) { diff --git a/src/slot_machine.c b/src/slot_machine.c index dd2622e2b..3b82afde1 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -1880,7 +1880,7 @@ static u8 TrySelectBias_Regular(void) { s16 rval = Random() & 0xff; s16 value = sBiasProbabilities_Regular[whichBias][sSlotMachine->machineId]; - + // Boost odds of BIAS_POWER if it's a lucky game. if (whichBias == 0 && sSlotMachine->luckyGame == TRUE) { @@ -3668,7 +3668,7 @@ static void ReelTime_CheckExplode(struct Task *task) if (sSlotMachine->reelTimeDraw) { if (sSlotMachine->reelTimeSpinsLeft <= task->tExplodeChecks) - task->tState++; // RT_TASK_LAND + task->tState++; // RT_TASK_LAND } else if (task->tExplodeChecks > 3) { @@ -5309,7 +5309,7 @@ static const u8 sSpecialDrawOdds[NUM_SLOT_MACHINE_IDS][MAX_BET] = { }; static const u8 sBiasProbabilities_Special[][NUM_SLOT_MACHINE_IDS] = { - { + { // Probabilities for BIAS_STRAIGHT_7 [SLOT_MACHINE_UNLUCKIEST] = 25, [SLOT_MACHINE_UNLUCKIER] = 25, @@ -5318,7 +5318,7 @@ static const u8 sBiasProbabilities_Special[][NUM_SLOT_MACHINE_IDS] = { [SLOT_MACHINE_LUCKIER] = 40, [SLOT_MACHINE_LUCKIEST] = 50 }, - { + { // Probabilities for BIAS_REELTIME [SLOT_MACHINE_UNLUCKIEST] = 25, [SLOT_MACHINE_UNLUCKIER] = 25, @@ -5327,7 +5327,7 @@ static const u8 sBiasProbabilities_Special[][NUM_SLOT_MACHINE_IDS] = { [SLOT_MACHINE_LUCKIER] = 35, [SLOT_MACHINE_LUCKIEST] = 35 }, - { + { // Probabilities for BIAS_MIXED_7 [SLOT_MACHINE_UNLUCKIEST] = 25, [SLOT_MACHINE_UNLUCKIER] = 25, @@ -5339,7 +5339,7 @@ static const u8 sBiasProbabilities_Special[][NUM_SLOT_MACHINE_IDS] = { }; static const u8 sBiasProbabilities_Regular[][NUM_SLOT_MACHINE_IDS] = { - { + { // Probabilities for BIAS_POWER [SLOT_MACHINE_UNLUCKIEST] = 20, [SLOT_MACHINE_UNLUCKIER] = 25, @@ -5348,7 +5348,7 @@ static const u8 sBiasProbabilities_Regular[][NUM_SLOT_MACHINE_IDS] = { [SLOT_MACHINE_LUCKIER] = 25, [SLOT_MACHINE_LUCKIEST] = 25 }, - { + { // Probabilities for BIAS_AZURILL [SLOT_MACHINE_UNLUCKIEST] = 12, [SLOT_MACHINE_UNLUCKIER] = 15, @@ -5357,7 +5357,7 @@ static const u8 sBiasProbabilities_Regular[][NUM_SLOT_MACHINE_IDS] = { [SLOT_MACHINE_LUCKIER] = 19, [SLOT_MACHINE_LUCKIEST] = 22 }, - { + { // Probabilities for BIAS_LOTAD [SLOT_MACHINE_UNLUCKIEST] = 25, [SLOT_MACHINE_UNLUCKIER] = 25, @@ -5366,7 +5366,7 @@ static const u8 sBiasProbabilities_Regular[][NUM_SLOT_MACHINE_IDS] = { [SLOT_MACHINE_LUCKIER] = 30, [SLOT_MACHINE_LUCKIEST] = 40 }, - { + { // Probabilities for BIAS_CHERRY [SLOT_MACHINE_UNLUCKIEST] = 25, [SLOT_MACHINE_UNLUCKIER] = 25, @@ -5375,7 +5375,7 @@ static const u8 sBiasProbabilities_Regular[][NUM_SLOT_MACHINE_IDS] = { [SLOT_MACHINE_LUCKIER] = 15, [SLOT_MACHINE_LUCKIEST] = 15 }, - { + { // Probabilities for BIAS_REPLAY [SLOT_MACHINE_UNLUCKIEST] = 40, [SLOT_MACHINE_UNLUCKIER] = 40, diff --git a/src/sound.c b/src/sound.c index aa6fb32ee..15ebee831 100644 --- a/src/sound.c +++ b/src/sound.c @@ -377,7 +377,7 @@ void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode) u8 table; species--; - + // Set default values // May be overridden depending on mode. length = 140; diff --git a/src/trade.c b/src/trade.c index e24051e04..ba18e8d32 100644 --- a/src/trade.c +++ b/src/trade.c @@ -2465,7 +2465,7 @@ int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct Rf else { // Player's Pokémon must be of the type the partner requested - if (gBaseStats[playerSpecies2].type1 != requestedType + if (gBaseStats[playerSpecies2].type1 != requestedType && gBaseStats[playerSpecies2].type2 != requestedType) return UR_TRADE_MSG_NOT_MON_PARTNER_WANTS; } diff --git a/src/tv.c b/src/tv.c index 2f3d17ee2..0c394acf7 100644 --- a/src/tv.c +++ b/src/tv.c @@ -2058,7 +2058,7 @@ static void SecretBaseVisit_CalculatePartyData(TVShow *show) { sTV_SecretBaseVisitMonsTemp[numPokemon].level = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); sTV_SecretBaseVisitMonsTemp[numPokemon].species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES); - + // Check all the Pokémon's moves, then randomly select one to save numMoves = 0; move = GetMonData(&gPlayerParty[i], MON_DATA_MOVE1); @@ -2093,7 +2093,7 @@ static void SecretBaseVisit_CalculatePartyData(TVShow *show) for (i = 0, sum = 0; i < numPokemon; i++) sum += sTV_SecretBaseVisitMonsTemp[i].level; - // Using the data calculated above, save the data to talk about on the show + // Using the data calculated above, save the data to talk about on the show // (average level, and one randomly selected species / move) show->secretBaseVisit.avgLevel = sum / numPokemon; j = Random() % numPokemon; @@ -2643,7 +2643,7 @@ void DoPokeNews(void) // News event is upcoming, make comment about countdown to event u16 dayCountdown = gSaveBlock1Ptr->pokeNews[i].dayCountdown; ConvertIntToDecimalStringN(gStringVar1, dayCountdown, STR_CONV_MODE_LEFT_ALIGN, 1); - + // Mark as inactive so the countdown TV airing doesn't repeat // Will be flagged as "upcoming" again by UpdatePokeNewsCountdown gSaveBlock1Ptr->pokeNews[i].state = POKENEWS_STATE_INACTIVE; @@ -2848,7 +2848,7 @@ static bool8 IsRecordMixShowAlreadySpawned(u8 kind, bool8 delete) static void SortPurchasesByQuantity(void) { u8 i, j; - + for (i = 0; i < SMARTSHOPPER_NUM_ITEMS - 1; i++) { for (j = i + 1; j < SMARTSHOPPER_NUM_ITEMS; j++) diff --git a/src/union_room_player_avatar.c b/src/union_room_player_avatar.c index beff4440d..86a0f1a44 100644 --- a/src/union_room_player_avatar.c +++ b/src/union_room_player_avatar.c @@ -569,7 +569,7 @@ bool32 TryInteractWithUnionRoomMember(struct RfuPlayerList *list, s16 *memberIdP for (memberId = 0; memberId < MAX_RFU_PLAYERS; memberId++) { s32 id = UR_PLAYER_SPRITE_ID(i, memberId); - + // Is the player in front of a group member position? if (x != sUnionRoomPlayerCoords[i][0] + sUnionRoomGroupOffsets[memberId][0] + 7) continue; diff --git a/src/walda_phrase.c b/src/walda_phrase.c index 025f900e5..e5556b53e 100644 --- a/src/walda_phrase.c +++ b/src/walda_phrase.c @@ -174,7 +174,7 @@ static bool32 TryCalculateWallpaper(u16 *backgroundClr, u16 *foregroundClr, u8 * if (GetWallpaperDataBits(data, 0, 3) != GetWallpaperDataBits(charsByTableId, TO_BIT_OFFSET(WALDA_PHRASE_LENGTH - 1) + 2, 3)) return FALSE; - // Perform some relatively arbitrary changes to the wallpaper data using the last byte (KEY) + // Perform some relatively arbitrary changes to the wallpaper data using the last byte (KEY) RotateWallpaperDataLeft(data, NUM_WALLPAPER_DATA_BYTES, 21); RotateWallpaperDataLeft(data, NUM_WALLPAPER_DATA_BYTES - 1, KEY & 0xF); MaskWallpaperData(data, NUM_WALLPAPER_DATA_BYTES - 1, KEY >> 4); diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 4f9697753..01161e6cc 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -64,7 +64,7 @@ static const struct WildPokemon sWildFeebas = {20, 25, SPECIES_FEEBAS}; static const u16 sRoute119WaterTileData[] = { -//yMin, yMax, numSpots in previous sections +//yMin, yMax, numSpots in previous sections 0, 45, 0, 46, 91, NUM_FISHING_SPOTS_1, 92, 139, NUM_FISHING_SPOTS_1 + NUM_FISHING_SPOTS_2, @@ -142,7 +142,7 @@ static bool8 CheckFeebas(void) feebasSpots[i] = FeebasRandom() % NUM_FISHING_SPOTS; if (feebasSpots[i] == 0) feebasSpots[i] = NUM_FISHING_SPOTS; - + // < 1 below is a pointless check, it will never be TRUE. // >= 4 to skip fishing spots 1-3, because these are inaccessible // spots at the top of the map, at (9,7), (7,13), and (15,16). diff --git a/src/wonder_news.c b/src/wonder_news.c index ec93d293e..e083575d9 100644 --- a/src/wonder_news.c +++ b/src/wonder_news.c @@ -76,7 +76,7 @@ u16 RetrieveWonderNewsVal(void) struct WonderNewsMetadata *data = GetSavedWonderNewsMetadata(); u16 newsVal; - // Checks if Mystery Event is enabled, not Mystery Gift? + // Checks if Mystery Event is enabled, not Mystery Gift? if (!IsMysteryEventEnabled() || !ValidateSavedWonderNews()) return 0; diff --git a/sym_common.txt b/sym_common.txt index 407b183a7..7eebcac74 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -53,9 +53,9 @@ gReservedSpritePaletteCount: .include "tv.o" .include "mauville_old_man.o" .include "image_processing_effects.o" - + .space 0x4 - + .include "contest_painting.o" .include "field_specials.o" .include "evolution_scene.o" @@ -66,12 +66,12 @@ gReservedSpritePaletteCount: .include "battle_anim_throw.o" .include "battle_factory_screen.o" .include "apprentice.o" - + .space 0x8 - + .include "list_menu.o" .include "party_menu.o" - + .space 0x44 .include "ereader_screen.o" From 5eb931225082972b013964c1a160989b7d69bd69 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Mon, 12 Sep 2022 21:14:15 -0300 Subject: [PATCH 6/9] Added missing labels in headers --- gflib/text.h | 1 - include/event_object_movement.h | 99 ++++++++++++++++----------------- include/field_effect.h | 2 +- include/field_player_avatar.h | 2 +- include/link.h | 2 +- include/menu.h | 2 +- include/palette.h | 22 ++++---- 7 files changed, 64 insertions(+), 66 deletions(-) diff --git a/gflib/text.h b/gflib/text.h index c07817290..a88cb990e 100644 --- a/gflib/text.h +++ b/gflib/text.h @@ -148,7 +148,6 @@ void RestoreTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor); void DecompressGlyphTile(const void *src_, void *dest_); void CopyGlyphToWindow(struct TextPrinter *x); void ClearTextSpan(struct TextPrinter *textPrinter, u32 width); -u8 GetMenuCursorDimensionByFont(u8, u8); void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter); void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter); diff --git a/include/event_object_movement.h b/include/event_object_movement.h index 22cef4921..aad161553 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -77,55 +77,55 @@ extern const struct SpriteFrameImage *const gBerryTreePicTablePointers[]; extern const u8 *const gBerryTreePaletteSlotTablePointers[]; void ResetObjectEvents(void); -u8 GetMoveDirectionAnimNum(u8); -u8 GetObjectEventIdByLocalIdAndMap(u8, u8, u8); -bool8 TryGetObjectEventIdByLocalIdAndMap(u8, u8, u8, u8 *); -u8 GetObjectEventIdByXY(s16, s16); -void SetObjectEventDirection(struct ObjectEvent *, u8); +u8 GetMoveDirectionAnimNum(u8 direction); +u8 GetObjectEventIdByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroupId); +bool8 TryGetObjectEventIdByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroupId, u8 *objectEventId); +u8 GetObjectEventIdByXY(s16 x, s16 y); +void SetObjectEventDirection(struct ObjectEvent *objectEvent, u8 direction); u8 GetFirstInactiveObjectEventId(void); -void RemoveObjectEventByLocalIdAndMap(u8, u8, u8); -void LoadPlayerObjectReflectionPalette(u16, u8); -void LoadSpecialObjectReflectionPalette(u16, u8); -void TryMoveObjectEventToMapCoords(u8, u8, u8, s16, s16); -void PatchObjectPalette(u16, u8); -void SpawnObjectEventsOnReturnToField(s16, s16); +void RemoveObjectEventByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup); +void LoadPlayerObjectReflectionPalette(u16 tag, u8 slot); +void LoadSpecialObjectReflectionPalette(u16 tag, u8 slot); +void TryMoveObjectEventToMapCoords(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y); +void PatchObjectPalette(u16 paletteTag, u8 paletteSlot); +void SpawnObjectEventsOnReturnToField(s16 x, s16 y); void OverrideSecretBaseDecorationSpriteScript(u8 localId, u8 mapNum, u8 mapGroup, u8 decorCat); -void GetMapCoordsFromSpritePos(s16, s16, s16 *, s16 *); -u8 GetFaceDirectionAnimNum(u8); -void SetSpritePosToOffsetMapCoords(s16 *, s16 *, s16, s16); +void GetMapCoordsFromSpritePos(s16 x, s16 y, s16 *destX, s16 *destY); +u8 GetFaceDirectionAnimNum(u8 direction); +void SetSpritePosToOffsetMapCoords(s16 *x, s16 *y, s16 dx, s16 dy); void ObjectEventClearHeldMovement(struct ObjectEvent *); void ObjectEventClearHeldMovementIfActive(struct ObjectEvent *); -void TrySpawnObjectEvents(s16, s16); +void TrySpawnObjectEvents(s16 cameraX, s16 cameraY); u8 CreateObjectGraphicsSprite(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subpriority); -u8 TrySpawnObjectEvent(u8, u8, u8); +u8 TrySpawnObjectEvent(u8 localId, u8 mapNum, u8 mapGroup); u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 elevation); u8 SpawnSpecialObjectEvent(struct ObjectEventTemplate *); -void SetSpritePosToMapCoords(s16, s16, s16 *, s16 *); +void SetSpritePosToMapCoords(s16 mapX, s16 mapY, s16 *destX, s16 *destY); void CameraObjectReset1(void); void ObjectEventSetGraphicsId(struct ObjectEvent *, u8 graphicsId); -void ObjectEventTurn(struct ObjectEvent *, u8); -void ObjectEventTurnByLocalIdAndMap(u8, u8, u8, u8); +void ObjectEventTurn(struct ObjectEvent *, u8 direction); +void ObjectEventTurnByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, u8 direction); const struct ObjectEventGraphicsInfo *GetObjectEventGraphicsInfo(u8 graphicsId); -void SetObjectInvisibility(u8, u8, u8, bool8); +void SetObjectInvisibility(u8 localId, u8 mapNum, u8 mapGroup, bool8 invisible); void FreeAndReserveObjectSpritePalettes(void); void SetObjectEventSpritePosByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y); -void ResetObjectSubpriority(u8, u8, u8); -void SetObjectSubpriority(u8, u8, u8, u8); -void AllowObjectAtPosTriggerGroundEffects(s16, s16); +void ResetObjectSubpriority(u8 localId, u8 mapNum, u8 mapGroup); +void SetObjectSubpriority(u8 localId, u8 mapNum, u8 mapGroup, u8 subpriority); +void AllowObjectAtPosTriggerGroundEffects(s16 x, s16 y); void ObjectEventGetLocalIdAndMap(struct ObjectEvent *objectEvent, void *localId, void *mapNum, void *mapGroup); -void ShiftObjectEventCoords(struct ObjectEvent *, s16, s16); -void MoveObjectEventToMapCoords(struct ObjectEvent *, s16, s16); -void TryOverrideObjectEventTemplateCoords(u8, u8, u8); +void ShiftObjectEventCoords(struct ObjectEvent *, s16 x, s16 y); +void MoveObjectEventToMapCoords(struct ObjectEvent *, s16 x, s16 y); +void TryOverrideObjectEventTemplateCoords(u8 localId, u8 mapNum, u8 mapGroup); void InitObjectEventPalettes(u8 palSlot); void UpdateObjectEventCurrentMovement(struct ObjectEvent *, struct Sprite *, bool8(struct ObjectEvent *, struct Sprite *)); -u8 ObjectEventFaceOppositeDirection(struct ObjectEvent *, u8); -u8 GetOppositeDirection(u8); +u8 ObjectEventFaceOppositeDirection(struct ObjectEvent *, u8 direction); +u8 GetOppositeDirection(u8 direction); u8 GetWalkInPlaceFasterMovementAction(u32); u8 GetWalkInPlaceFastMovementAction(u32); u8 GetWalkInPlaceNormalMovementAction(u32); u8 GetWalkInPlaceSlowMovementAction(u32); -u8 GetCollisionAtCoords(struct ObjectEvent *, s16, s16, u32); -void MoveCoords(u8, s16 *, s16 *); +u8 GetCollisionAtCoords(struct ObjectEvent *, s16 x, s16 y, u32 dir); +void MoveCoords(u8 direction, s16 *x, s16 *y); bool8 ObjectEventIsHeldMovementActive(struct ObjectEvent *); u8 ObjectEventClearHeldMovementIfFinished(struct ObjectEvent *); u8 GetObjectEventIdByPosition(u16 x, u16 y, u8 elevation); @@ -168,22 +168,22 @@ u8 AddCameraObject(u8 linkedSpriteId); void UpdateObjectEventsForCameraUpdate(s16 x, s16 y); u8 GetWalkSlowMovementAction(u32); u8 GetJumpMovementAction(u32); -u8 ElevationToPriority(u8); +u8 ElevationToPriority(u8 elevation); void ObjectEventUpdateElevation(struct ObjectEvent *objEvent); -void SetObjectSubpriorityByElevation(u8, struct Sprite *, u8); +void SetObjectSubpriorityByElevation(u8 elevation, struct Sprite *, u8 subpriority); void UnfreezeObjectEvent(struct ObjectEvent *); u8 FindLockedObjectEventIndex(struct ObjectEvent *); -void SetAndStartSpriteAnim(struct Sprite *, u8, u8); +void SetAndStartSpriteAnim(struct Sprite *, u8 animNum, u8 animCmdIndex); bool8 SpriteAnimEnded(struct Sprite *); void UnfreezeObjectEvents(void); void FreezeObjectEventsExceptOne(u8 objectEventId); void FreezeObjectEventsExceptTwo(u8 objectEventId1, u8 objectEventId2); void FreezeObjectEvents(void); bool8 FreezeObjectEvent(struct ObjectEvent *objectEvent); -u8 GetMoveDirectionFastAnimNum(u8); -u8 GetMoveDirectionFasterAnimNum(u8); -u8 GetMoveDirectionFastestAnimNum(u8); -u8 GetLedgeJumpDirection(s16, s16, u8); +u8 GetMoveDirectionFastAnimNum(u8 direction); +u8 GetMoveDirectionFasterAnimNum(u8 direction); +u8 GetMoveDirectionFastestAnimNum(u8 direction); +u8 GetLedgeJumpDirection(s16 x, s16 y, u8 direction); void CameraObjectSetFollowedSpriteId(u8 objectId); u16 GetObjectPaletteTag(u8 palSlot); void UpdateObjectEventSpriteInvisibility(struct Sprite *sprite, bool8 invisible); @@ -192,7 +192,7 @@ s16 GetFigure8YOffset(s16 idx); void CameraObjectReset2(void); u8 GetObjectEventBerryTreeId(u8 objectEventId); void SetBerryTreeJustPicked(u8 mapId, u8 mapNumber, u8 mapGroup); -bool8 IsBerryTreeSparkling(u8, u8, u8); +bool8 IsBerryTreeSparkling(u8 localId, u8 mapNum, u8 mapGroup); void MovementType_None(struct Sprite *); void MovementType_LookAround(struct Sprite *); @@ -250,7 +250,6 @@ void MovementType_RunInPlace(struct Sprite *); void MovementType_Invisible(struct Sprite *); void MovementType_WalkSlowlyInPlace(struct Sprite *); u8 GetSlideMovementAction(u32); -u8 GetJumpInPlaceMovementAction(u32); u8 GetJumpMovementAction(u32); u8 GetJump2MovementAction(u32); u8 CreateCopySpriteAt(struct Sprite *sprite, s16 x, s16 y, u8 subpriority); @@ -262,17 +261,17 @@ u8 MovementType_WanderAround_Step3(struct ObjectEvent *, struct Sprite *); u8 MovementType_WanderAround_Step4(struct ObjectEvent *, struct Sprite *); u8 MovementType_WanderAround_Step5(struct ObjectEvent *, struct Sprite *); u8 MovementType_WanderAround_Step6(struct ObjectEvent *, struct Sprite *); -u8 GetVectorDirection(s16, s16, s16, s16); -u8 GetLimitedVectorDirection_SouthNorth(s16, s16, s16, s16); -u8 GetLimitedVectorDirection_WestEast(s16, s16, s16, s16); -u8 GetLimitedVectorDirection_WestNorth(s16, s16, s16, s16); -u8 GetLimitedVectorDirection_EastNorth(s16, s16, s16, s16); -u8 GetLimitedVectorDirection_WestSouth(s16, s16, s16, s16); -u8 GetLimitedVectorDirection_EastSouth(s16, s16, s16, s16); -u8 GetLimitedVectorDirection_SouthNorthWest(s16, s16, s16, s16); -u8 GetLimitedVectorDirection_SouthNorthEast(s16, s16, s16, s16); -u8 GetLimitedVectorDirection_NorthWestEast(s16, s16, s16, s16); -u8 GetLimitedVectorDirection_SouthWestEast(s16, s16, s16, s16); +u8 GetVectorDirection(s16 dx, s16 dy, s16 absdx, s16 absdy); +u8 GetLimitedVectorDirection_SouthNorth(s16 dx, s16 dy, s16 absdx, s16 absdy); +u8 GetLimitedVectorDirection_WestEast(s16 dx, s16 dy, s16 absdx, s16 absdy); +u8 GetLimitedVectorDirection_WestNorth(s16 dx, s16 dy, s16 absdx, s16 absdy); +u8 GetLimitedVectorDirection_EastNorth(s16 dx, s16 dy, s16 absdx, s16 absdy); +u8 GetLimitedVectorDirection_WestSouth(s16 dx, s16 dy, s16 absdx, s16 absdy); +u8 GetLimitedVectorDirection_EastSouth(s16 dx, s16 dy, s16 absdx, s16 absdy); +u8 GetLimitedVectorDirection_SouthNorthWest(s16 dx, s16 dy, s16 absdx, s16 absdy); +u8 GetLimitedVectorDirection_SouthNorthEast(s16 dx, s16 dy, s16 absdx, s16 absdy); +u8 GetLimitedVectorDirection_NorthWestEast(s16 dx, s16 dy, s16 absdx, s16 absdy); +u8 GetLimitedVectorDirection_SouthWestEast(s16 dx, s16 dy, s16 absdx, s16 absdy); u8 MovementType_LookAround_Step0(struct ObjectEvent *, struct Sprite *); u8 MovementType_LookAround_Step1(struct ObjectEvent *, struct Sprite *); u8 MovementType_LookAround_Step2(struct ObjectEvent *, struct Sprite *); diff --git a/include/field_effect.h b/include/field_effect.h index b35a8c869..4cde29e8a 100644 --- a/include/field_effect.h +++ b/include/field_effect.h @@ -18,7 +18,7 @@ void FieldEffectStop(struct Sprite *sprite, u8 id); u8 CreateTrainerSprite(u8 trainerSpriteID, s16 x, s16 y, u8 subpriority, u8 *buffer); void FldEff_TeleportWarpOut(void); void FieldEffectActiveListRemove(u8 id); -void MultiplyInvertedPaletteRGBComponents(u16, u8, u8, u8); +void MultiplyInvertedPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b); void FieldEffectActiveListAdd(u8 id); void FieldEffectScript_LoadTiles(u8 **script); void FieldEffectScript_LoadFadedPalette(u8 **script); diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h index 2bf2df269..39fc886af 100644 --- a/include/field_player_avatar.h +++ b/include/field_player_avatar.h @@ -38,7 +38,7 @@ void PlayerFreeze(void); void StopPlayerAvatar(void); void SetSpinStartFacingDir(u8); void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr); -u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8, u8); +u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8 state, u8 gender); void SetPlayerAvatarFieldMove(void); u8 GetPlayerAvatarGraphicsIdByCurrentState(void); void SetPlayerAvatarStateMask(u8 flags); diff --git a/include/link.h b/include/link.h index 120c25784..7fa5e3fae 100644 --- a/include/link.h +++ b/include/link.h @@ -284,7 +284,7 @@ void SerialCB(void); bool32 InUnionRoom(void); void LoadWirelessStatusIndicatorSpriteGfx(void); bool8 IsLinkTaskFinished(void); -void CreateWirelessStatusIndicatorSprite(u8, u8); +void CreateWirelessStatusIndicatorSprite(u8 x, u8 y); void SetLinkStandbyCallback(void); void SetWirelessCommType1(void); void CheckShouldAdvanceLinkState(void); diff --git a/include/menu.h b/include/menu.h index 43b564da2..0b0a42423 100644 --- a/include/menu.h +++ b/include/menu.h @@ -92,7 +92,7 @@ void PrintMenuActionGrid(u8 windowId, u8 fontId, u8 left, u8 top, u8 optionWidth u8 InitMenuActionGrid(u8 windowId, u8 optionWidth, u8 columns, u8 rows, u8 initialCursorPos); u8 ChangeMenuGridCursorPosition(s8 deltaX, s8 deltaY); u8 GetStartMenuWindowId(void); -void ListMenuLoadStdPalAt(u8, u8); +void ListMenuLoadStdPalAt(u8 palOffset, u8 palId); u8 Menu_MoveCursor(s8 cursorDelta); u8 Menu_MoveCursorNoWrapAround(s8 cursorDelta); void DrawStdWindowFrame(u8 windowId, bool8 CopyToVram); diff --git a/include/palette.h b/include/palette.h index 81a1e1cae..736fde96b 100644 --- a/include/palette.h +++ b/include/palette.h @@ -52,22 +52,22 @@ extern u8 gPaletteDecompressionBuffer[]; extern u16 gPlttBufferUnfaded[PLTT_BUFFER_SIZE]; extern u16 gPlttBufferFaded[PLTT_BUFFER_SIZE]; -void LoadCompressedPalette(const u32 *, u16, u16); -void LoadPalette(const void *, u16, u16); -void FillPalette(u16, u16, u16); +void LoadCompressedPalette(const u32 *src, u16 offset, u16 size); +void LoadPalette(const void *src, u16 offset, u16 size); +void FillPalette(u16 value, u16 offset, u16 size); void TransferPlttBuffer(void); u8 UpdatePaletteFade(void); void ResetPaletteFade(void); -bool8 BeginNormalPaletteFade(u32, s8, u8, u8, u16); -void PaletteStruct_ResetById(u16); +bool8 BeginNormalPaletteFade(u32 selectedPalettes, s8 delay, u8 startY, u8 targetY, u16 blendColor); +void PaletteStruct_ResetById(u16 id); void ResetPaletteFadeControl(void); -void InvertPlttBuffer(u32); -void TintPlttBuffer(u32, s8, s8, s8); -void UnfadePlttBuffer(u32); -void BeginFastPaletteFade(u8); -void BeginHardwarePaletteFade(u8, u8, u8, u8, u8); +void InvertPlttBuffer(u32 selectedPalettes); +void TintPlttBuffer(u32 selectedPalettes, s8 r, s8 g, s8 b); +void UnfadePlttBuffer(u32 selectedPalettes); +void BeginFastPaletteFade(u8 submode); +void BeginHardwarePaletteFade(u8 blendCnt, u8 delay, u8 y, u8 targetY, u8 shouldResetBlendRegisters); void BlendPalettes(u32 selectedPalettes, u8 coeff, u16 color); -void BlendPalettesUnfaded(u32, u8, u16); +void BlendPalettesUnfaded(u32 selectedPalettes, u8 coeff, u16 color); void BlendPalettesGradually(u32 selectedPalettes, s8 delay, u8 coeff, u8 coeffTarget, u16 color, u8 priority, u8 id); void TintPalette_GrayScale(u16 *palette, u16 count); void TintPalette_GrayScale2(u16 *palette, u16 count); From 222362e8045e653115cf4e4759c1a25732cea899 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 12 Sep 2022 21:26:22 -0300 Subject: [PATCH 7/9] Fixed Raquaza typo --- data/maps/SkyPillar_Top/map.json | 2 +- data/maps/SkyPillar_Top/scripts.inc | 2 +- include/constants/vars.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/maps/SkyPillar_Top/map.json b/data/maps/SkyPillar_Top/map.json index a980c6b07..2fee12106 100644 --- a/data/maps/SkyPillar_Top/map.json +++ b/data/maps/SkyPillar_Top/map.json @@ -56,7 +56,7 @@ "x": 14, "y": 9, "elevation": 3, - "var": "VAR_SKY_PILLAR_RAQUAZA_CRY_DONE", + "var": "VAR_SKY_PILLAR_RAYQUAZA_CRY_DONE", "var_value": "0", "script": "SkyPillar_Top_EventScript_AwakenRayquaza" } diff --git a/data/maps/SkyPillar_Top/scripts.inc b/data/maps/SkyPillar_Top/scripts.inc index 7b65d9e25..19cd7e4f4 100644 --- a/data/maps/SkyPillar_Top/scripts.inc +++ b/data/maps/SkyPillar_Top/scripts.inc @@ -128,7 +128,7 @@ SkyPillar_Top_EventScript_AwakenRayquaza:: special RemoveCameraObject setvar VAR_SOOTOPOLIS_CITY_STATE, 5 setvar VAR_SKY_PILLAR_STATE, 1 - setvar VAR_SKY_PILLAR_RAQUAZA_CRY_DONE, 1 + setvar VAR_SKY_PILLAR_RAYQUAZA_CRY_DONE, 1 releaseall end diff --git a/include/constants/vars.h b/include/constants/vars.h index 8128b6f32..dbcb658ff 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -231,7 +231,7 @@ #define VAR_SS_TIDAL_SCOTT_STATE 0x40D4 // Always equal to FLAG_MET_SCOTT_ON_SS_TIDAL #define VAR_ROAMER_POKEMON 0x40D5 // 0 = Latias, 1 = Latios #define VAR_TRAINER_HILL_IS_ACTIVE 0x40D6 -#define VAR_SKY_PILLAR_RAQUAZA_CRY_DONE 0x40D7 +#define VAR_SKY_PILLAR_RAYQUAZA_CRY_DONE 0x40D7 #define VAR_SOOTOPOLIS_WALLACE_STATE 0x40D8 #define VAR_HAS_TALKED_TO_SEAFLOOR_CAVERN_ENTRANCE_GRUNT 0x40D9 #define VAR_REGISTER_BIRCH_STATE 0x40DA From cb83a0920318b2e98782a9a10a098b8441a99913 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 12 Sep 2022 21:27:53 -0300 Subject: [PATCH 8/9] Fixed vars alignment --- include/constants/vars.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/constants/vars.h b/include/constants/vars.h index dbcb658ff..019585d66 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -231,7 +231,7 @@ #define VAR_SS_TIDAL_SCOTT_STATE 0x40D4 // Always equal to FLAG_MET_SCOTT_ON_SS_TIDAL #define VAR_ROAMER_POKEMON 0x40D5 // 0 = Latias, 1 = Latios #define VAR_TRAINER_HILL_IS_ACTIVE 0x40D6 -#define VAR_SKY_PILLAR_RAYQUAZA_CRY_DONE 0x40D7 +#define VAR_SKY_PILLAR_RAYQUAZA_CRY_DONE 0x40D7 #define VAR_SOOTOPOLIS_WALLACE_STATE 0x40D8 #define VAR_HAS_TALKED_TO_SEAFLOOR_CAVERN_ENTRANCE_GRUNT 0x40D9 #define VAR_REGISTER_BIRCH_STATE 0x40DA From 14c6d8b91a49d214d3da2bba2b90e4cb9d811587 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 12 Sep 2022 21:32:42 -0300 Subject: [PATCH 9/9] Fixed alignment for the value of vars 0x4020 to 0x40FF --- include/constants/vars.h | 450 +++++++++++++++++++-------------------- 1 file changed, 225 insertions(+), 225 deletions(-) diff --git a/include/constants/vars.h b/include/constants/vars.h index 019585d66..bd988c789 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -46,235 +46,235 @@ #define VAR_OBJ_GFX_ID_F 0x401F // general purpose vars -#define VAR_RECYCLE_GOODS 0x4020 -#define VAR_REPEL_STEP_COUNT 0x4021 -#define VAR_ICE_STEP_COUNT 0x4022 -#define VAR_STARTER_MON 0x4023 // 0=Treecko, 1=Torchic, 2=Mudkip -#define VAR_MIRAGE_RND_H 0x4024 -#define VAR_MIRAGE_RND_L 0x4025 -#define VAR_SECRET_BASE_MAP 0x4026 -#define VAR_CYCLING_ROAD_RECORD_COLLISIONS 0x4027 -#define VAR_CYCLING_ROAD_RECORD_TIME_L 0x4028 -#define VAR_CYCLING_ROAD_RECORD_TIME_H 0x4029 -#define VAR_FRIENDSHIP_STEP_COUNTER 0x402A -#define VAR_POISON_STEP_COUNTER 0x402B -#define VAR_RESET_RTC_ENABLE 0x402C -#define VAR_ENIGMA_BERRY_AVAILABLE 0x402D -#define VAR_WONDER_NEWS_COUNTER 0x402E +#define VAR_RECYCLE_GOODS 0x4020 +#define VAR_REPEL_STEP_COUNT 0x4021 +#define VAR_ICE_STEP_COUNT 0x4022 +#define VAR_STARTER_MON 0x4023 // 0=Treecko, 1=Torchic, 2=Mudkip +#define VAR_MIRAGE_RND_H 0x4024 +#define VAR_MIRAGE_RND_L 0x4025 +#define VAR_SECRET_BASE_MAP 0x4026 +#define VAR_CYCLING_ROAD_RECORD_COLLISIONS 0x4027 +#define VAR_CYCLING_ROAD_RECORD_TIME_L 0x4028 +#define VAR_CYCLING_ROAD_RECORD_TIME_H 0x4029 +#define VAR_FRIENDSHIP_STEP_COUNTER 0x402A +#define VAR_POISON_STEP_COUNTER 0x402B +#define VAR_RESET_RTC_ENABLE 0x402C +#define VAR_ENIGMA_BERRY_AVAILABLE 0x402D +#define VAR_WONDER_NEWS_COUNTER 0x402E -#define VAR_FRONTIER_MANIAC_FACILITY 0x402F -#define VAR_FRONTIER_GAMBLER_CHALLENGE 0x4030 -#define VAR_FRONTIER_GAMBLER_SET_CHALLENGE 0x4031 -#define VAR_FRONTIER_GAMBLER_AMOUNT_BET 0x4032 -#define VAR_FRONTIER_GAMBLER_STATE 0x4033 +#define VAR_FRONTIER_MANIAC_FACILITY 0x402F +#define VAR_FRONTIER_GAMBLER_CHALLENGE 0x4030 +#define VAR_FRONTIER_GAMBLER_SET_CHALLENGE 0x4031 +#define VAR_FRONTIER_GAMBLER_AMOUNT_BET 0x4032 +#define VAR_FRONTIER_GAMBLER_STATE 0x4033 -#define VAR_DEOXYS_ROCK_STEP_COUNT 0x4034 -#define VAR_DEOXYS_ROCK_LEVEL 0x4035 -#define VAR_PC_BOX_TO_SEND_MON 0x4036 -#define VAR_ABNORMAL_WEATHER_LOCATION 0x4037 -#define VAR_ABNORMAL_WEATHER_STEP_COUNTER 0x4038 -#define VAR_SHOULD_END_ABNORMAL_WEATHER 0x4039 -#define VAR_FARAWAY_ISLAND_STEP_COUNTER 0x403A -#define VAR_REGICE_STEPS_1 0x403B -#define VAR_REGICE_STEPS_2 0x403C -#define VAR_REGICE_STEPS_3 0x403D -#define VAR_ALTERING_CAVE_WILD_SET 0x403E -#define VAR_DISTRIBUTE_EON_TICKET 0x403F // This var is read and written, but is always zero. The only way to obtain the Eon Ticket in Emerald is via Record Mixing -#define VAR_DAYS 0x4040 -#define VAR_FANCLUB_FAN_COUNTER 0x4041 -#define VAR_FANCLUB_LOSE_FAN_TIMER 0x4042 -#define VAR_DEPT_STORE_FLOOR 0x4043 -#define VAR_TRICK_HOUSE_LEVEL 0x4044 -#define VAR_POKELOT_PRIZE_ITEM 0x4045 -#define VAR_NATIONAL_DEX 0x4046 -#define VAR_SEEDOT_SIZE_RECORD 0x4047 -#define VAR_ASH_GATHER_COUNT 0x4048 -#define VAR_BIRCH_STATE 0x4049 -#define VAR_CRUISE_STEP_COUNT 0x404A -#define VAR_POKELOT_RND1 0x404B -#define VAR_POKELOT_RND2 0x404C -#define VAR_POKELOT_PRIZE_PLACE 0x404D -#define VAR_UNUSED_0x404E 0x404E // Unused Var -#define VAR_LOTAD_SIZE_RECORD 0x404F -#define VAR_LITTLEROOT_TOWN_STATE 0x4050 -#define VAR_OLDALE_TOWN_STATE 0x4051 -#define VAR_DEWFORD_TOWN_STATE 0x4052 // Unused Var -#define VAR_LAVARIDGE_TOWN_STATE 0x4053 -#define VAR_CURRENT_SECRET_BASE 0x4054 // was probably allocated for VAR_FALLARBOR_TOWN_STATE at one point -#define VAR_VERDANTURF_TOWN_STATE 0x4055 // Unused Var -#define VAR_PACIFIDLOG_TOWN_STATE 0x4056 // Unused Var -#define VAR_PETALBURG_CITY_STATE 0x4057 -#define VAR_SLATEPORT_CITY_STATE 0x4058 -#define VAR_MAUVILLE_CITY_STATE 0x4059 // Unused Var -#define VAR_RUSTBORO_CITY_STATE 0x405A -#define VAR_FORTREE_CITY_STATE 0x405B // Unused Var -#define VAR_LILYCOVE_CITY_STATE 0x405C // Unused Var -#define VAR_MOSSDEEP_CITY_STATE 0x405D -#define VAR_SOOTOPOLIS_CITY_STATE 0x405E -#define VAR_EVER_GRANDE_CITY_STATE 0x405F // Unused Var -#define VAR_ROUTE101_STATE 0x4060 -#define VAR_ROUTE102_STATE 0x4061 // Unused Var -#define VAR_ROUTE103_STATE 0x4062 // Unused Var -#define VAR_ROUTE104_STATE 0x4063 -#define VAR_ROUTE105_STATE 0x4064 // Unused Var -#define VAR_ROUTE106_STATE 0x4065 // Unused Var -#define VAR_ROUTE107_STATE 0x4066 // Unused Var -#define VAR_ROUTE108_STATE 0x4067 // Unused Var -#define VAR_ROUTE109_STATE 0x4068 // Unused Var -#define VAR_ROUTE110_STATE 0x4069 -#define VAR_ROUTE111_STATE 0x406A // Unused Var -#define VAR_ROUTE112_STATE 0x406B // Unused Var -#define VAR_ROUTE113_STATE 0x406C // Unused Var -#define VAR_ROUTE114_STATE 0x406D // Unused Var -#define VAR_ROUTE115_STATE 0x406E // Unused Var -#define VAR_ROUTE116_STATE 0x406F -#define VAR_ROUTE117_STATE 0x4070 // Unused Var -#define VAR_ROUTE118_STATE 0x4071 -#define VAR_ROUTE119_STATE 0x4072 -#define VAR_ROUTE120_STATE 0x4073 // Unused Var -#define VAR_ROUTE121_STATE 0x4074 -#define VAR_ROUTE122_STATE 0x4075 // Unused Var -#define VAR_ROUTE123_STATE 0x4076 // Unused Var -#define VAR_ROUTE124_STATE 0x4077 // Unused Var -#define VAR_ROUTE125_STATE 0x4078 // Unused Var -#define VAR_ROUTE126_STATE 0x4079 // Unused Var -#define VAR_ROUTE127_STATE 0x407A // Unused Var -#define VAR_ROUTE128_STATE 0x407B -#define VAR_ROUTE129_STATE 0x407C // Unused Var -#define VAR_ROUTE130_STATE 0x407D // Unused Var -#define VAR_ROUTE131_STATE 0x407E // Unused Var -#define VAR_ROUTE132_STATE 0x407F // Unused Var -#define VAR_ROUTE133_STATE 0x4080 // Unused Var -#define VAR_ROUTE134_STATE 0x4081 // Unused Var -#define VAR_LITTLEROOT_HOUSES_STATE_MAY 0x4082 -#define VAR_UNUSED_0x4083 0x4083 // Unused Var -#define VAR_BIRCH_LAB_STATE 0x4084 -#define VAR_PETALBURG_GYM_STATE 0x4085 // 0-1: Wally tutorial, 2-6: 0-4 badges, 7: Defeated Norman, 8: Rematch Norman -#define VAR_CONTEST_HALL_STATE 0x4086 -#define VAR_CABLE_CLUB_STATE 0x4087 -#define VAR_CONTEST_TYPE 0x4088 -#define VAR_SECRET_BASE_INITIALIZED 0x4089 -#define VAR_CONTEST_PRIZE_PICKUP 0x408A -#define VAR_UNUSED_0x408B 0x408B // Unused Var -#define VAR_LITTLEROOT_HOUSES_STATE_BRENDAN 0x408C -#define VAR_LITTLEROOT_RIVAL_STATE 0x408D -#define VAR_BOARD_BRINEY_BOAT_STATE 0x408E -#define VAR_DEVON_CORP_3F_STATE 0x408F -#define VAR_BRINEY_HOUSE_STATE 0x4090 -#define VAR_UNUSED_0x4091 0x4091 // Unused Var -#define VAR_LITTLEROOT_INTRO_STATE 0x4092 -#define VAR_MAUVILLE_GYM_STATE 0x4093 -#define VAR_LILYCOVE_MUSEUM_2F_STATE 0x4094 -#define VAR_LILYCOVE_FAN_CLUB_STATE 0x4095 -#define VAR_BRINEY_LOCATION 0x4096 -#define VAR_INIT_SECRET_BASE 0x4097 -#define VAR_PETALBURG_WOODS_STATE 0x4098 -#define VAR_LILYCOVE_CONTEST_LOBBY_STATE 0x4099 -#define VAR_RUSTURF_TUNNEL_STATE 0x409A -#define VAR_UNUSED_0x409B 0x409B // Unused Var -#define VAR_ELITE_4_STATE 0x409C -#define VAR_UNUSED_0x409D 0x409D // Unused Var -#define VAR_MOSSDEEP_SPACE_CENTER_STAIR_GUARD_STATE 0x409E -#define VAR_MOSSDEEP_SPACE_CENTER_STATE 0x409F -#define VAR_SLATEPORT_HARBOR_STATE 0x40A0 -#define VAR_UNUSED_0x40A1 0x40A1 // Unused var -#define VAR_SEAFLOOR_CAVERN_STATE 0x40A2 -#define VAR_CABLE_CAR_STATION_STATE 0x40A3 -#define VAR_SAFARI_ZONE_STATE 0x40A4 // 0: In or out of SZ, 1: Player exiting SZ, 2: Player entering SZ -#define VAR_TRICK_HOUSE_BEING_WATCHED_STATE 0x40A5 -#define VAR_TRICK_HOUSE_FOUND_TRICK_MASTER 0x40A6 -#define VAR_TRICK_HOUSE_ENTRANCE_STATE 0x40A7 -#define VAR_UNUSED_0x40A8 0x40A8 // Unused Var -#define VAR_CYCLING_CHALLENGE_STATE 0x40A9 -#define VAR_SLATEPORT_MUSEUM_1F_STATE 0x40AA -#define VAR_TRICK_HOUSE_PUZZLE_1_STATE 0x40AB -#define VAR_TRICK_HOUSE_PUZZLE_2_STATE 0x40AC -#define VAR_TRICK_HOUSE_PUZZLE_3_STATE 0x40AD -#define VAR_TRICK_HOUSE_PUZZLE_4_STATE 0x40AE -#define VAR_TRICK_HOUSE_PUZZLE_5_STATE 0x40AF -#define VAR_TRICK_HOUSE_PUZZLE_6_STATE 0x40B0 -#define VAR_TRICK_HOUSE_PUZZLE_7_STATE 0x40B1 -#define VAR_TRICK_HOUSE_PUZZLE_8_STATE 0x40B2 -#define VAR_WEATHER_INSTITUTE_STATE 0x40B3 -#define VAR_SS_TIDAL_STATE 0x40B4 -#define VAR_TRICK_HOUSE_ENTER_FROM_CORRIDOR 0x40B5 -#define VAR_TRICK_HOUSE_PUZZLE_7_STATE_2 0x40B6 // Leftover from RS, never set -#define VAR_SLATEPORT_FAN_CLUB_STATE 0x40B7 -#define VAR_UNUSED_0x40B8 0x40B8 // Unused Var -#define VAR_MT_PYRE_STATE 0x40B9 -#define VAR_NEW_MAUVILLE_STATE 0x40BA -#define VAR_UNUSED_0x40BB 0x40BB // Unused Var -#define VAR_BRAVO_TRAINER_BATTLE_TOWER_ON 0x40BC -#define VAR_JAGGED_PASS_ASH_WEATHER 0x40BD -#define VAR_GLASS_WORKSHOP_STATE 0x40BE -#define VAR_METEOR_FALLS_STATE 0x40BF -#define VAR_SOOTOPOLIS_MYSTERY_EVENTS_STATE 0x40C0 -#define VAR_TRICK_HOUSE_PRIZE_PICKUP 0x40C1 -#define VAR_PACIFIDLOG_TM_RECEIVED_DAY 0x40C2 -#define VAR_VICTORY_ROAD_1F_STATE 0x40C3 -#define VAR_FOSSIL_RESURRECTION_STATE 0x40C4 -#define VAR_WHICH_FOSSIL_REVIVED 0x40C5 -#define VAR_STEVENS_HOUSE_STATE 0x40C6 -#define VAR_OLDALE_RIVAL_STATE 0x40C7 -#define VAR_JAGGED_PASS_STATE 0x40C8 -#define VAR_SCOTT_PETALBURG_ENCOUNTER 0x40C9 -#define VAR_SKY_PILLAR_STATE 0x40CA -#define VAR_MIRAGE_TOWER_STATE 0x40CB -#define VAR_FOSSIL_MANIAC_STATE 0x40CC -#define VAR_CABLE_CLUB_TUTORIAL_STATE 0x40CD -#define VAR_FRONTIER_BATTLE_MODE 0x40CE -#define VAR_FRONTIER_FACILITY 0x40CF -#define VAR_HAS_ENTERED_BATTLE_FRONTIER 0x40D0 // Var is used like a flag. -#define VAR_SCOTT_STATE 0x40D1 -#define VAR_SLATEPORT_OUTSIDE_MUSEUM_STATE 0x40D2 -#define VAR_DEX_UPGRADE_JOHTO_STARTER_STATE 0x40D3 -#define VAR_SS_TIDAL_SCOTT_STATE 0x40D4 // Always equal to FLAG_MET_SCOTT_ON_SS_TIDAL -#define VAR_ROAMER_POKEMON 0x40D5 // 0 = Latias, 1 = Latios -#define VAR_TRAINER_HILL_IS_ACTIVE 0x40D6 -#define VAR_SKY_PILLAR_RAYQUAZA_CRY_DONE 0x40D7 -#define VAR_SOOTOPOLIS_WALLACE_STATE 0x40D8 +#define VAR_DEOXYS_ROCK_STEP_COUNT 0x4034 +#define VAR_DEOXYS_ROCK_LEVEL 0x4035 +#define VAR_PC_BOX_TO_SEND_MON 0x4036 +#define VAR_ABNORMAL_WEATHER_LOCATION 0x4037 +#define VAR_ABNORMAL_WEATHER_STEP_COUNTER 0x4038 +#define VAR_SHOULD_END_ABNORMAL_WEATHER 0x4039 +#define VAR_FARAWAY_ISLAND_STEP_COUNTER 0x403A +#define VAR_REGICE_STEPS_1 0x403B +#define VAR_REGICE_STEPS_2 0x403C +#define VAR_REGICE_STEPS_3 0x403D +#define VAR_ALTERING_CAVE_WILD_SET 0x403E +#define VAR_DISTRIBUTE_EON_TICKET 0x403F // This var is read and written, but is always zero. The only way to obtain the Eon Ticket in Emerald is via Record Mixing +#define VAR_DAYS 0x4040 +#define VAR_FANCLUB_FAN_COUNTER 0x4041 +#define VAR_FANCLUB_LOSE_FAN_TIMER 0x4042 +#define VAR_DEPT_STORE_FLOOR 0x4043 +#define VAR_TRICK_HOUSE_LEVEL 0x4044 +#define VAR_POKELOT_PRIZE_ITEM 0x4045 +#define VAR_NATIONAL_DEX 0x4046 +#define VAR_SEEDOT_SIZE_RECORD 0x4047 +#define VAR_ASH_GATHER_COUNT 0x4048 +#define VAR_BIRCH_STATE 0x4049 +#define VAR_CRUISE_STEP_COUNT 0x404A +#define VAR_POKELOT_RND1 0x404B +#define VAR_POKELOT_RND2 0x404C +#define VAR_POKELOT_PRIZE_PLACE 0x404D +#define VAR_UNUSED_0x404E 0x404E // Unused Var +#define VAR_LOTAD_SIZE_RECORD 0x404F +#define VAR_LITTLEROOT_TOWN_STATE 0x4050 +#define VAR_OLDALE_TOWN_STATE 0x4051 +#define VAR_DEWFORD_TOWN_STATE 0x4052 // Unused Var +#define VAR_LAVARIDGE_TOWN_STATE 0x4053 +#define VAR_CURRENT_SECRET_BASE 0x4054 // was probably allocated for VAR_FALLARBOR_TOWN_STATE at one point +#define VAR_VERDANTURF_TOWN_STATE 0x4055 // Unused Var +#define VAR_PACIFIDLOG_TOWN_STATE 0x4056 // Unused Var +#define VAR_PETALBURG_CITY_STATE 0x4057 +#define VAR_SLATEPORT_CITY_STATE 0x4058 +#define VAR_MAUVILLE_CITY_STATE 0x4059 // Unused Var +#define VAR_RUSTBORO_CITY_STATE 0x405A +#define VAR_FORTREE_CITY_STATE 0x405B // Unused Var +#define VAR_LILYCOVE_CITY_STATE 0x405C // Unused Var +#define VAR_MOSSDEEP_CITY_STATE 0x405D +#define VAR_SOOTOPOLIS_CITY_STATE 0x405E +#define VAR_EVER_GRANDE_CITY_STATE 0x405F // Unused Var +#define VAR_ROUTE101_STATE 0x4060 +#define VAR_ROUTE102_STATE 0x4061 // Unused Var +#define VAR_ROUTE103_STATE 0x4062 // Unused Var +#define VAR_ROUTE104_STATE 0x4063 +#define VAR_ROUTE105_STATE 0x4064 // Unused Var +#define VAR_ROUTE106_STATE 0x4065 // Unused Var +#define VAR_ROUTE107_STATE 0x4066 // Unused Var +#define VAR_ROUTE108_STATE 0x4067 // Unused Var +#define VAR_ROUTE109_STATE 0x4068 // Unused Var +#define VAR_ROUTE110_STATE 0x4069 +#define VAR_ROUTE111_STATE 0x406A // Unused Var +#define VAR_ROUTE112_STATE 0x406B // Unused Var +#define VAR_ROUTE113_STATE 0x406C // Unused Var +#define VAR_ROUTE114_STATE 0x406D // Unused Var +#define VAR_ROUTE115_STATE 0x406E // Unused Var +#define VAR_ROUTE116_STATE 0x406F +#define VAR_ROUTE117_STATE 0x4070 // Unused Var +#define VAR_ROUTE118_STATE 0x4071 +#define VAR_ROUTE119_STATE 0x4072 +#define VAR_ROUTE120_STATE 0x4073 // Unused Var +#define VAR_ROUTE121_STATE 0x4074 +#define VAR_ROUTE122_STATE 0x4075 // Unused Var +#define VAR_ROUTE123_STATE 0x4076 // Unused Var +#define VAR_ROUTE124_STATE 0x4077 // Unused Var +#define VAR_ROUTE125_STATE 0x4078 // Unused Var +#define VAR_ROUTE126_STATE 0x4079 // Unused Var +#define VAR_ROUTE127_STATE 0x407A // Unused Var +#define VAR_ROUTE128_STATE 0x407B +#define VAR_ROUTE129_STATE 0x407C // Unused Var +#define VAR_ROUTE130_STATE 0x407D // Unused Var +#define VAR_ROUTE131_STATE 0x407E // Unused Var +#define VAR_ROUTE132_STATE 0x407F // Unused Var +#define VAR_ROUTE133_STATE 0x4080 // Unused Var +#define VAR_ROUTE134_STATE 0x4081 // Unused Var +#define VAR_LITTLEROOT_HOUSES_STATE_MAY 0x4082 +#define VAR_UNUSED_0x4083 0x4083 // Unused Var +#define VAR_BIRCH_LAB_STATE 0x4084 +#define VAR_PETALBURG_GYM_STATE 0x4085 // 0-1: Wally tutorial, 2-6: 0-4 badges, 7: Defeated Norman, 8: Rematch Norman +#define VAR_CONTEST_HALL_STATE 0x4086 +#define VAR_CABLE_CLUB_STATE 0x4087 +#define VAR_CONTEST_TYPE 0x4088 +#define VAR_SECRET_BASE_INITIALIZED 0x4089 +#define VAR_CONTEST_PRIZE_PICKUP 0x408A +#define VAR_UNUSED_0x408B 0x408B // Unused Var +#define VAR_LITTLEROOT_HOUSES_STATE_BRENDAN 0x408C +#define VAR_LITTLEROOT_RIVAL_STATE 0x408D +#define VAR_BOARD_BRINEY_BOAT_STATE 0x408E +#define VAR_DEVON_CORP_3F_STATE 0x408F +#define VAR_BRINEY_HOUSE_STATE 0x4090 +#define VAR_UNUSED_0x4091 0x4091 // Unused Var +#define VAR_LITTLEROOT_INTRO_STATE 0x4092 +#define VAR_MAUVILLE_GYM_STATE 0x4093 +#define VAR_LILYCOVE_MUSEUM_2F_STATE 0x4094 +#define VAR_LILYCOVE_FAN_CLUB_STATE 0x4095 +#define VAR_BRINEY_LOCATION 0x4096 +#define VAR_INIT_SECRET_BASE 0x4097 +#define VAR_PETALBURG_WOODS_STATE 0x4098 +#define VAR_LILYCOVE_CONTEST_LOBBY_STATE 0x4099 +#define VAR_RUSTURF_TUNNEL_STATE 0x409A +#define VAR_UNUSED_0x409B 0x409B // Unused Var +#define VAR_ELITE_4_STATE 0x409C +#define VAR_UNUSED_0x409D 0x409D // Unused Var +#define VAR_MOSSDEEP_SPACE_CENTER_STAIR_GUARD_STATE 0x409E +#define VAR_MOSSDEEP_SPACE_CENTER_STATE 0x409F +#define VAR_SLATEPORT_HARBOR_STATE 0x40A0 +#define VAR_UNUSED_0x40A1 0x40A1 // Unused var +#define VAR_SEAFLOOR_CAVERN_STATE 0x40A2 +#define VAR_CABLE_CAR_STATION_STATE 0x40A3 +#define VAR_SAFARI_ZONE_STATE 0x40A4 // 0: In or out of SZ, 1: Player exiting SZ, 2: Player entering SZ +#define VAR_TRICK_HOUSE_BEING_WATCHED_STATE 0x40A5 +#define VAR_TRICK_HOUSE_FOUND_TRICK_MASTER 0x40A6 +#define VAR_TRICK_HOUSE_ENTRANCE_STATE 0x40A7 +#define VAR_UNUSED_0x40A8 0x40A8 // Unused Var +#define VAR_CYCLING_CHALLENGE_STATE 0x40A9 +#define VAR_SLATEPORT_MUSEUM_1F_STATE 0x40AA +#define VAR_TRICK_HOUSE_PUZZLE_1_STATE 0x40AB +#define VAR_TRICK_HOUSE_PUZZLE_2_STATE 0x40AC +#define VAR_TRICK_HOUSE_PUZZLE_3_STATE 0x40AD +#define VAR_TRICK_HOUSE_PUZZLE_4_STATE 0x40AE +#define VAR_TRICK_HOUSE_PUZZLE_5_STATE 0x40AF +#define VAR_TRICK_HOUSE_PUZZLE_6_STATE 0x40B0 +#define VAR_TRICK_HOUSE_PUZZLE_7_STATE 0x40B1 +#define VAR_TRICK_HOUSE_PUZZLE_8_STATE 0x40B2 +#define VAR_WEATHER_INSTITUTE_STATE 0x40B3 +#define VAR_SS_TIDAL_STATE 0x40B4 +#define VAR_TRICK_HOUSE_ENTER_FROM_CORRIDOR 0x40B5 +#define VAR_TRICK_HOUSE_PUZZLE_7_STATE_2 0x40B6 // Leftover from RS, never set +#define VAR_SLATEPORT_FAN_CLUB_STATE 0x40B7 +#define VAR_UNUSED_0x40B8 0x40B8 // Unused Var +#define VAR_MT_PYRE_STATE 0x40B9 +#define VAR_NEW_MAUVILLE_STATE 0x40BA +#define VAR_UNUSED_0x40BB 0x40BB // Unused Var +#define VAR_BRAVO_TRAINER_BATTLE_TOWER_ON 0x40BC +#define VAR_JAGGED_PASS_ASH_WEATHER 0x40BD +#define VAR_GLASS_WORKSHOP_STATE 0x40BE +#define VAR_METEOR_FALLS_STATE 0x40BF +#define VAR_SOOTOPOLIS_MYSTERY_EVENTS_STATE 0x40C0 +#define VAR_TRICK_HOUSE_PRIZE_PICKUP 0x40C1 +#define VAR_PACIFIDLOG_TM_RECEIVED_DAY 0x40C2 +#define VAR_VICTORY_ROAD_1F_STATE 0x40C3 +#define VAR_FOSSIL_RESURRECTION_STATE 0x40C4 +#define VAR_WHICH_FOSSIL_REVIVED 0x40C5 +#define VAR_STEVENS_HOUSE_STATE 0x40C6 +#define VAR_OLDALE_RIVAL_STATE 0x40C7 +#define VAR_JAGGED_PASS_STATE 0x40C8 +#define VAR_SCOTT_PETALBURG_ENCOUNTER 0x40C9 +#define VAR_SKY_PILLAR_STATE 0x40CA +#define VAR_MIRAGE_TOWER_STATE 0x40CB +#define VAR_FOSSIL_MANIAC_STATE 0x40CC +#define VAR_CABLE_CLUB_TUTORIAL_STATE 0x40CD +#define VAR_FRONTIER_BATTLE_MODE 0x40CE +#define VAR_FRONTIER_FACILITY 0x40CF +#define VAR_HAS_ENTERED_BATTLE_FRONTIER 0x40D0 // Var is used like a flag. +#define VAR_SCOTT_STATE 0x40D1 +#define VAR_SLATEPORT_OUTSIDE_MUSEUM_STATE 0x40D2 +#define VAR_DEX_UPGRADE_JOHTO_STARTER_STATE 0x40D3 +#define VAR_SS_TIDAL_SCOTT_STATE 0x40D4 // Always equal to FLAG_MET_SCOTT_ON_SS_TIDAL +#define VAR_ROAMER_POKEMON 0x40D5 // 0 = Latias, 1 = Latios +#define VAR_TRAINER_HILL_IS_ACTIVE 0x40D6 +#define VAR_SKY_PILLAR_RAYQUAZA_CRY_DONE 0x40D7 +#define VAR_SOOTOPOLIS_WALLACE_STATE 0x40D8 #define VAR_HAS_TALKED_TO_SEAFLOOR_CAVERN_ENTRANCE_GRUNT 0x40D9 -#define VAR_REGISTER_BIRCH_STATE 0x40DA -#define VAR_UNUSED_0x40DB 0x40DB // Unused Var -#define VAR_UNUSED_0x40DC 0x40DC // Unused Var -#define VAR_GIFT_PICHU_SLOT 0x40DD -#define VAR_GIFT_UNUSED_1 0x40DE // Var is written to, but never read -#define VAR_GIFT_UNUSED_2 0x40DF // Var is written to, but never read -#define VAR_GIFT_UNUSED_3 0x40E0 // Var is written to, but never read -#define VAR_GIFT_UNUSED_4 0x40E1 // Var is written to, but never read -#define VAR_GIFT_UNUSED_5 0x40E2 // Var is written to, but never read -#define VAR_GIFT_UNUSED_6 0x40E3 // Var is written to, but never read -#define VAR_GIFT_UNUSED_7 0x40E4 // var is written to, but never read -#define VAR_UNUSED_0x40E5 0x40E5 // Unused Var -#define VAR_DAILY_SLOTS 0x40E6 -#define VAR_DAILY_WILDS 0x40E7 -#define VAR_DAILY_BLENDER 0x40E8 -#define VAR_DAILY_PLANTED_BERRIES 0x40E9 -#define VAR_DAILY_PICKED_BERRIES 0x40EA -#define VAR_DAILY_ROULETTE 0x40EB -#define VAR_SECRET_BASE_STEP_COUNTER 0x40EC // Used by Secret Base TV programs -#define VAR_SECRET_BASE_LAST_ITEM_USED 0x40ED // Used by Secret Base TV programs -#define VAR_SECRET_BASE_LOW_TV_FLAGS 0x40EE // Used by Secret Base TV programs -#define VAR_SECRET_BASE_HIGH_TV_FLAGS 0x40EF // Used by Secret Base TV programs -#define VAR_SECRET_BASE_IS_NOT_LOCAL 0x40F0 // Set to TRUE while in another player's secret base. -#define VAR_DAILY_BP 0x40F1 -#define VAR_WALLY_CALL_STEP_COUNTER 0x40F2 -#define VAR_SCOTT_FORTREE_CALL_STEP_COUNTER 0x40F3 -#define VAR_ROXANNE_CALL_STEP_COUNTER 0x40F4 -#define VAR_SCOTT_BF_CALL_STEP_COUNTER 0x40F5 -#define VAR_RIVAL_RAYQUAZA_CALL_STEP_COUNTER 0x40F6 -#define VAR_UNUSED_0x40F7 0x40F7 // Unused Var -#define VAR_UNUSED_0x40F8 0x40F8 // Unused Var -#define VAR_UNUSED_0x40F9 0x40F9 // Unused Var -#define VAR_UNUSED_0x40FA 0x40FA // Unused Var -#define VAR_UNUSED_0x40FB 0x40FB // Unused Var -#define VAR_UNUSED_0x40FC 0x40FC // Unused Var -#define VAR_UNUSED_0x40FD 0x40FD // Unused Var -#define VAR_UNUSED_0x40FE 0x40FE // Unused Var -#define VAR_UNUSED_0x40FF 0x40FF // Unused Var +#define VAR_REGISTER_BIRCH_STATE 0x40DA +#define VAR_UNUSED_0x40DB 0x40DB // Unused Var +#define VAR_UNUSED_0x40DC 0x40DC // Unused Var +#define VAR_GIFT_PICHU_SLOT 0x40DD +#define VAR_GIFT_UNUSED_1 0x40DE // Var is written to, but never read +#define VAR_GIFT_UNUSED_2 0x40DF // Var is written to, but never read +#define VAR_GIFT_UNUSED_3 0x40E0 // Var is written to, but never read +#define VAR_GIFT_UNUSED_4 0x40E1 // Var is written to, but never read +#define VAR_GIFT_UNUSED_5 0x40E2 // Var is written to, but never read +#define VAR_GIFT_UNUSED_6 0x40E3 // Var is written to, but never read +#define VAR_GIFT_UNUSED_7 0x40E4 // var is written to, but never read +#define VAR_UNUSED_0x40E5 0x40E5 // Unused Var +#define VAR_DAILY_SLOTS 0x40E6 +#define VAR_DAILY_WILDS 0x40E7 +#define VAR_DAILY_BLENDER 0x40E8 +#define VAR_DAILY_PLANTED_BERRIES 0x40E9 +#define VAR_DAILY_PICKED_BERRIES 0x40EA +#define VAR_DAILY_ROULETTE 0x40EB +#define VAR_SECRET_BASE_STEP_COUNTER 0x40EC // Used by Secret Base TV programs +#define VAR_SECRET_BASE_LAST_ITEM_USED 0x40ED // Used by Secret Base TV programs +#define VAR_SECRET_BASE_LOW_TV_FLAGS 0x40EE // Used by Secret Base TV programs +#define VAR_SECRET_BASE_HIGH_TV_FLAGS 0x40EF // Used by Secret Base TV programs +#define VAR_SECRET_BASE_IS_NOT_LOCAL 0x40F0 // Set to TRUE while in another player's secret base. +#define VAR_DAILY_BP 0x40F1 +#define VAR_WALLY_CALL_STEP_COUNTER 0x40F2 +#define VAR_SCOTT_FORTREE_CALL_STEP_COUNTER 0x40F3 +#define VAR_ROXANNE_CALL_STEP_COUNTER 0x40F4 +#define VAR_SCOTT_BF_CALL_STEP_COUNTER 0x40F5 +#define VAR_RIVAL_RAYQUAZA_CALL_STEP_COUNTER 0x40F6 +#define VAR_UNUSED_0x40F7 0x40F7 // Unused Var +#define VAR_UNUSED_0x40F8 0x40F8 // Unused Var +#define VAR_UNUSED_0x40F9 0x40F9 // Unused Var +#define VAR_UNUSED_0x40FA 0x40FA // Unused Var +#define VAR_UNUSED_0x40FB 0x40FB // Unused Var +#define VAR_UNUSED_0x40FC 0x40FC // Unused Var +#define VAR_UNUSED_0x40FD 0x40FD // Unused Var +#define VAR_UNUSED_0x40FE 0x40FE // Unused Var +#define VAR_UNUSED_0x40FF 0x40FF // Unused Var -#define VARS_END 0x40FF -#define VARS_COUNT (VARS_END - VARS_START + 1) +#define VARS_END 0x40FF +#define VARS_COUNT (VARS_END - VARS_START + 1) #define SPECIAL_VARS_START 0x8000 // special vars