Allow flag/var counts to be updated alongside values

This commit is contained in:
GriffinR 2020-06-24 17:00:19 -04:00
parent 46f4a4bbf7
commit 06025e887f
35 changed files with 13 additions and 41 deletions

View File

@ -1573,7 +1573,7 @@
#define FLAG_UNUSED_0x91F (SYSTEM_FLAGS + 0xBF) // Unused Flag
// Daily Flags
#define DAILY_FLAGS_START 0x920
#define DAILY_FLAGS_START (FLAG_UNUSED_0x91F + 1)
#define FLAG_UNUSED_0x920 (DAILY_FLAGS_START + 0x0) // Unused Flag
#define FLAG_DAILY_CONTEST_LOBBY_RECEIVED_BERRY (DAILY_FLAGS_START + 0x1)
#define FLAG_DAILY_SECRET_BASE (DAILY_FLAGS_START + 0x2)
@ -1641,6 +1641,8 @@
#define FLAG_UNUSED_0x95F (DAILY_FLAGS_START + 0x3F) // Unused Flag
#define DAILY_FLAGS_END FLAG_UNUSED_0x95F
#define FLAGS_COUNT (DAILY_FLAGS_END + 1)
// Special Flags (Stored in EWRAM (gSpecialFlags), not in the SaveBlock)
#define SPECIAL_FLAGS_START 0x4000
#define FLAG_HIDE_MAP_NAME_POPUP (SPECIAL_FLAGS_START + 0x0)

View File

@ -34,8 +34,6 @@
#define POKEBLOCKS_COUNT 40
#define OBJECT_EVENTS_COUNT 16
#define BERRY_TREES_COUNT 128
#define FLAGS_COUNT 300
#define VARS_COUNT 256
#define MAIL_COUNT 16
#define SECRET_BASES_COUNT 20
#define TV_SHOWS_COUNT 25

View File

@ -859,6 +859,7 @@
// NOTE: Because each Trainer uses a flag to determine when they are defeated, there is only space for 9 additional trainers before trainer flag space overflows
// More space can be made by shifting flags around in constants/flags.h or changing how trainer flags are handled
// MAX_TRAINERS_COUNT can be increased but will take up additional saveblock space
#define TRAINERS_COUNT 855
#define MAX_TRAINERS_COUNT 864

View File

@ -274,6 +274,7 @@
#define VAR_UNUSED_0x40FF 0x40FF // Unused Var
#define VARS_END 0x40FF
#define VARS_COUNT (VARS_END - VARS_START + 1)
#define SPECIAL_VARS_START 0x8000
// special vars

View File

@ -1,9 +1,6 @@
#ifndef GUARD_EVENT_DATA_H
#define GUARD_EVENT_DATA_H
#include "constants/flags.h"
#include "constants/vars.h"
void InitEventData(void);
void ClearTempFieldEventData(void);
void ClearDailyFlags(void);

View File

@ -6,6 +6,8 @@
#include "config.h" // we need to define config before gba headers as print stuff needs the functions nulled before defines.
#include "gba/gba.h"
#include "constants/global.h"
#include "constants/flags.h"
#include "constants/vars.h"
// Prevent cross-jump optimization.
#define BLOCK_CROSS_JUMP asm("");
@ -109,6 +111,11 @@
f; \
})
#define ROUND_BITS_TO_BYTES(numBits)(((numBits) / 8) + (((numBits) % 8) ? 1 : 0))
#define DEX_FLAGS_NO (ROUND_BITS_TO_BYTES(POKEMON_SLOTS_NUMBER))
#define NUM_FLAG_BYTES (ROUND_BITS_TO_BYTES(FLAGS_COUNT))
struct Coords8
{
s8 x;
@ -153,8 +160,6 @@ struct Time
/*0x04*/ s8 seconds;
};
#define DEX_FLAGS_NO ((POKEMON_SLOTS_NUMBER / 8) + ((POKEMON_SLOTS_NUMBER % 8) ? 1 : 0))
struct Pokedex
{
/*0x00*/ u8 order;
@ -923,7 +928,7 @@ struct SaveBlock1
/*0x9CA*/ u8 trainerRematches[MAX_REMATCH_ENTRIES];
/*0xA30*/ struct ObjectEvent objectEvents[OBJECT_EVENTS_COUNT];
/*0xC70*/ struct ObjectEventTemplate objectEventTemplates[OBJECT_EVENT_TEMPLATES_COUNT];
/*0x1270*/ u8 flags[FLAGS_COUNT];
/*0x1270*/ u8 flags[NUM_FLAG_BYTES];
/*0x139C*/ u16 vars[VARS_COUNT];
/*0x159C*/ u32 gameStats[NUM_GAME_STATS];
/*0x169C*/ struct BerryTree berryTrees[BERRY_TREES_COUNT];

View File

@ -7,7 +7,6 @@
#include "metatile_behavior.h"
#include "overworld.h"
#include "sound.h"
#include "constants/flags.h"
#include "constants/map_types.h"
#include "constants/songs.h"

View File

@ -6,7 +6,6 @@
#include "sound.h"
#include "task.h"
#include "constants/field_effects.h"
#include "constants/flags.h"
#include "constants/maps.h"
#include "constants/songs.h"
#include "constants/species.h"

View File

@ -7,7 +7,6 @@
#include "constants/moves.h"
#include "constants/songs.h"
#include "constants/species.h"
#include "constants/flags.h"
#include "battle.h"
#include "battle_anim.h"
#include "contest.h"

View File

@ -40,7 +40,6 @@
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/tv.h"
#include "constants/vars.h"
#include "contest.h"
struct ContestLinkUnk0

View File

@ -6,7 +6,6 @@
#include "pokemon.h"
#include "random.h"
#include "task.h"
#include "constants/flags.h"
static void sub_80FC5C0(u8);
static void sub_80FC5DC(u8);

View File

@ -20,7 +20,6 @@
#include "trig.h"
#include "graphics.h"
#include "pokedex.h"
#include "constants/vars.h"
#include "event_data.h"
#include "random.h"
#include "constants/species.h"

View File

@ -29,7 +29,6 @@
#include "window.h"
#include "constants/easy_chat.h"
#include "constants/event_objects.h"
#include "constants/flags.h"
#include "constants/lilycove_lady.h"
#include "constants/mauville_old_man.h"
#include "constants/songs.h"

View File

@ -6,10 +6,8 @@
#include "metatile_behavior.h"
#include "sprite.h"
#include "constants/event_objects.h"
#include "constants/flags.h"
#include "constants/maps.h"
#include "constants/metatile_behaviors.h"
#include "constants/vars.h"
static u8 sub_81D4890(u8);
static bool8 sub_81D4C14(struct ObjectEvent*, u8);

View File

@ -5,7 +5,6 @@
#include "fieldmap.h"
#include "metatile_behavior.h"
#include "task.h"
#include "constants/flags.h"
#include "constants/maps.h"
#include "constants/songs.h"
#include "constants/metatile_labels.h"

View File

@ -25,7 +25,6 @@
#include "constants/event_objects.h"
#include "constants/event_object_movement.h"
#include "constants/field_effects.h"
#include "constants/flags.h"
#include "constants/maps.h"
#include "constants/moves.h"
#include "constants/songs.h"

View File

@ -17,7 +17,6 @@
#include "constants/event_object_movement.h"
#include "constants/field_specials.h"
#include "constants/songs.h"
#include "constants/vars.h"
#include "constants/metatile_labels.h"
#define SECONDS(value) ((signed) (60.0 * value + 0.5))

View File

@ -63,7 +63,6 @@
#include "constants/species.h"
#include "constants/moves.h"
#include "constants/party_menu.h"
#include "constants/vars.h"
#include "constants/battle_frontier.h"
#include "constants/weather.h"
#include "constants/metatile_labels.h"

View File

@ -19,7 +19,6 @@
#include "constants/field_tasks.h"
#include "constants/items.h"
#include "constants/songs.h"
#include "constants/vars.h"
#include "constants/metatile_labels.h"
struct PacifidlogMetatileOffsets

View File

@ -23,7 +23,6 @@
#include "constants/metatile_labels.h"
#include "constants/songs.h"
#include "constants/tv.h"
#include "constants/vars.h"
EWRAM_DATA struct MapPosition gPlayerFacingPosition = {0};

View File

@ -1,5 +1,4 @@
#include "global.h"
#include "constants/flags.h"
#include "random.h"
#include "event_data.h"
#include "battle_setup.h"

View File

@ -38,11 +38,9 @@
#include "text.h"
#include "constants/event_bg.h"
#include "constants/event_objects.h"
#include "constants/flags.h"
#include "constants/item_effects.h"
#include "constants/items.h"
#include "constants/songs.h"
#include "constants/vars.h"
static void SetUpItemUseCallback(u8 taskId);
static void FieldCB_UseItemOnField(void);

View File

@ -1,7 +1,6 @@
#include "global.h"
#include "trainer_pokemon_sprites.h"
#include "bg.h"
#include "constants/flags.h"
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/species.h"

View File

@ -3,7 +3,6 @@
#include "constants/songs.h"
#include "constants/easy_chat.h"
#include "constants/event_objects.h"
#include "constants/vars.h"
#include "mauville_old_man.h"
#include "event_data.h"
#include "string_util.h"

View File

@ -18,7 +18,6 @@
#include "task.h"
#include "text_window.h"
#include "window.h"
#include "constants/flags.h"
#include "constants/songs.h"
#define DLG_WINDOW_PALETTE_NUM 15

View File

@ -14,7 +14,6 @@
#include "sprite.h"
#include "task.h"
#include "window.h"
#include "constants/flags.h"
#include "constants/maps.h"
#include "constants/rgb.h"
#include "constants/songs.h"

View File

@ -13,7 +13,6 @@
#include "field_player_avatar.h"
#include "event_object_movement.h"
#include "event_data.h"
#include "constants/vars.h"
#include "constants/songs.h"
#include "pokemon_storage_system.h"
#include "graphics.h"

View File

@ -67,7 +67,6 @@
#include "constants/battle_frontier.h"
#include "constants/easy_chat.h"
#include "constants/field_effects.h"
#include "constants/flags.h"
#include "constants/item_effects.h"
#include "constants/items.h"
#include "constants/maps.h"
@ -76,7 +75,6 @@
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/species.h"
#include "constants/vars.h"
#define PARTY_PAL_SELECTED (1 << 0)
#define PARTY_PAL_FAINTED (1 << 1)

View File

@ -21,7 +21,6 @@
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/species.h"
#include "constants/vars.h"
#define AREA_SCREEN_WIDTH 32
#define AREA_SCREEN_HEIGHT 20

View File

@ -12,7 +12,6 @@
#include "sound.h"
#include "string_util.h"
#include "strings.h"
#include "constants/flags.h"
#include "constants/songs.h"
struct Pokenav3Struct

View File

@ -8,7 +8,6 @@
#include "script_pokemon_util_80F87D8.h"
#include "tv.h"
#include "constants/heal_locations.h"
#include "constants/flags.h"
#include "constants/tv.h"
int GameClear(void)

View File

@ -9,7 +9,6 @@
#include "trig.h"
#include "constants/maps.h"
#include "overworld.h"
#include "constants/flags.h"
#include "event_data.h"
#include "secret_base.h"
#include "string_util.h"

View File

@ -30,7 +30,6 @@
#include "constants/items.h"
#include "constants/species.h"
#include "constants/tv.h"
#include "constants/vars.h"
#include "constants/battle_frontier.h"
extern const u16 gObjectEventPalette8[];

View File

@ -27,7 +27,6 @@
#include "trainer_pokemon_sprites.h"
#include "script_pokemon_util_80F87D8.h"
#include "constants/songs.h"
#include "constants/flags.h"
#include "constants/game_stat.h"
#include "constants/battle_frontier.h"
#include "constants/rgb.h"

View File

@ -8,7 +8,6 @@
#include "union_room.h"
#include "constants/event_objects.h"
#include "constants/event_object_movement.h"
#include "constants/flags.h"
EWRAM_DATA struct UnkStruct_8019BA8 * gUnknown_02022C64 = NULL;
EWRAM_DATA u32 gUnknown_02022C68 = 0;