diff options
author | Diegoisawesome <Diegoisawesome@users.noreply.github.com> | 2019-01-05 14:55:41 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-05 14:55:41 -0600 |
commit | 37d7348e01e1d9afb79b5eb10ec28af948bbaf1e (patch) | |
tree | 6fdc1e1e4ad49d5239d94650bc4b3f7ffe8ee4eb /src | |
parent | cbf7d6cee59e7aa2cdef6b9e89fa62fbeb4a07c5 (diff) | |
parent | aeaf390706c90c464f132dc5173587361aabb8d0 (diff) |
Merge pull request #505 from Slawter666/secret-base
Use constants in secret_base.c
Diffstat (limited to 'src')
-rw-r--r--[-rwxr-xr-x] | src/contest_link_80F57C4.c | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | src/contest_link_80FC4F4.c | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | src/contest_link_81D9DE4.c | 0 | ||||
-rw-r--r-- | src/secret_base.c | 132 |
4 files changed, 67 insertions, 65 deletions
diff --git a/src/contest_link_80F57C4.c b/src/contest_link_80F57C4.c index 721a4f870..721a4f870 100755..100644 --- a/src/contest_link_80F57C4.c +++ b/src/contest_link_80F57C4.c diff --git a/src/contest_link_80FC4F4.c b/src/contest_link_80FC4F4.c index f582626f8..f582626f8 100755..100644 --- a/src/contest_link_80FC4F4.c +++ b/src/contest_link_80FC4F4.c diff --git a/src/contest_link_81D9DE4.c b/src/contest_link_81D9DE4.c index 4b56c9c38..4b56c9c38 100755..100644 --- a/src/contest_link_81D9DE4.c +++ b/src/contest_link_81D9DE4.c diff --git a/src/secret_base.c b/src/secret_base.c index ebc01b333..de5fae077 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -1,44 +1,46 @@ #include "global.h" -#include "constants/bg_event_constants.h" -#include "constants/decorations.h" #include "alloc.h" -#include "main.h" -#include "task.h" -#include "palette.h" -#include "window.h" -#include "list_menu.h" -#include "menu.h" -#include "menu_helpers.h" -#include "constants/maps.h" -#include "constants/songs.h" -#include "constants/species.h" -#include "sound.h" -#include "overworld.h" -#include "fieldmap.h" +#include "battle.h" +#include "battle_setup.h" +#include "decoration.h" +#include "event_data.h" +#include "event_object_movement.h" +#include "event_scripts.h" #include "field_camera.h" -#include "field_specials.h" +#include "field_effect.h" #include "field_player_avatar.h" #include "field_screen_effect.h" +#include "field_specials.h" #include "field_weather.h" -#include "event_object_movement.h" -#include "field_effect.h" +#include "fieldmap.h" #include "fldeff.h" #include "fldeff_misc.h" -#include "metatile_behavior.h" +#include "international_string_util.h" +#include "link.h" +#include "list_menu.h" +#include "main.h" #include "map_name_popup.h" -#include "string_util.h" +#include "menu.h" +#include "menu_helpers.h" +#include "metatile_behavior.h" +#include "overworld.h" +#include "palette.h" #include "script.h" -#include "event_scripts.h" +#include "secret_base.h" +#include "sound.h" +#include "string_util.h" #include "strings.h" -#include "international_string_util.h" -#include "event_data.h" -#include "battle.h" -#include "battle_setup.h" -#include "decoration.h" -#include "link.h" +#include "task.h" #include "tv.h" -#include "secret_base.h" +#include "window.h" +#include "constants/bg_event_constants.h" +#include "constants/decorations.h" +#include "constants/maps.h" #include "constants/map_types.h" +#include "constants/metatile_behaviors.h" +#include "constants/secret_bases.h" +#include "constants/songs.h" +#include "constants/species.h" #include "constants/trainers.h" extern void mapldr_default(void); @@ -166,7 +168,7 @@ void ResetSecretBases(void) { u16 i; - for (i = 0; i < 20; i ++) + for (i = 0; i < SECRET_BASES_COUNT; i ++) { ClearSecretBase(&gSaveBlock1Ptr->secretBases[i]); } @@ -182,7 +184,7 @@ void sub_80E8B6C(void) u16 i; gSpecialVar_Result = FALSE; - for (i = 0; i < 20; i ++) + for (i = 0; i < SECRET_BASES_COUNT; i ++) { if (sCurSecretBaseId != gSaveBlock1Ptr->secretBases[i].secretBaseId) { @@ -214,29 +216,29 @@ u8 sub_80E8BF8(void) GetXYCoordsOneStepInFrontOfPlayer(&x, &y); behavior = MapGridGetMetatileBehaviorAt(x, y) & 0xFFF; - if (behavior == 0x90 || behavior == 0x91) + if (behavior == MB_SECRET_BASE_SPOT_RED_CAVE || behavior == MB_SECRET_BASE_SPOT_RED_CAVE_OPEN) { - return 1; + return SECRET_BASE_RED_CAVE; } - if (behavior == 0x92 || behavior == 0x93) + if (behavior == MB_SECRET_BASE_SPOT_BROWN_CAVE || behavior == MB_SECRET_BASE_SPOT_BROWN_CAVE_OPEN) { - return 2; + return SECRET_BASE_BROWN_CAVE; } - if (behavior == 0x9a || behavior == 0x9b) + if (behavior == MB_SECRET_BASE_SPOT_BLUE_CAVE || behavior == MB_SECRET_BASE_SPOT_BLUE_CAVE_OPEN) { - return 3; + return SECRET_BASE_BLUE_CAVE; } - if (behavior == 0x94 || behavior == 0x95) + if (behavior == MB_SECRET_BASE_SPOT_YELLOW_CAVE || behavior == MB_SECRET_BASE_SPOT_YELLOW_CAVE_OPEN) { - return 4; + return SECRET_BASE_YELLOW_CAVE; } - if (behavior == 0x96 || behavior == 0x97 || behavior == 0x9c || behavior == 0x9d) + if (behavior == MB_SECRET_BASE_SPOT_TREE_LEFT || behavior == MB_SECRET_BASE_SPOT_TREE_LEFT_OPEN || behavior == MB_SECRET_BASE_SPOT_TREE_RIGHT || behavior == MB_SECRET_BASE_SPOT_TREE_RIGHT_OPEN) { - return 5; + return SECRET_BASE_TREE; } - if (behavior == 0x98 || behavior == 0x99) + if (behavior == MB_SECRET_BASE_SPOT_SHRUB || behavior == MB_SECRET_BASE_SPOT_SHRUB_OPEN) { - return 6; + return SECRET_BASE_SHRUB; } return 0; } @@ -339,7 +341,7 @@ void sub_80E8EE0(struct MapEvents const *events) { if (events->bgEvents[bgEventIndex].kind == BG_EVENT_SECRET_BASE) { - for (j = 0; j < 20; j ++) + for (j = 0; j < SECRET_BASES_COUNT; j ++) { if (gSaveBlock1Ptr->secretBases[j].secretBaseId == events->bgEvents[bgEventIndex].bgUnion.secretBaseId) { @@ -583,7 +585,7 @@ void sub_80E9578(void) for (objectEventIdx = 0; objectEventIdx < gMapHeader.events->eventObjectCount; objectEventIdx ++) { flagId = gMapHeader.events->eventObjects[objectEventIdx].flagId; - if (flagId >= 0xAE && flagId <= 0xBB) + if (flagId >= FLAG_DECORATION_1 && flagId <= FLAG_DECORATION_14) { RemoveEventObjectByLocalIdAndMap(gMapHeader.events->eventObjects[objectEventIdx].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); FlagSet(flagId); @@ -816,7 +818,7 @@ u8 sub_80E9BA8(void) s16 i; sum = 0; - for (i = 1; i < 20; i ++) + for (i = 1; i < SECRET_BASES_COUNT; i ++) { if (sub_80E9878(i) == TRUE) { @@ -845,7 +847,7 @@ void sub_80E9BDC(void) void sub_80E9C2C(void) { gSaveBlock1Ptr->secretBases[VarGet(VAR_CURRENT_SECRET_BASE)].sbr_field_1_6 ^= 1; - FlagSet(0x10C); + FlagSet(FLAG_DECORATION_16); } void sub_80E9C74(void) @@ -890,7 +892,7 @@ void game_continue(u8 taskId) data = gTasks[taskId].data; count = 0; - for (i = 1; i < 20; i ++) + for (i = 1; i < SECRET_BASES_COUNT; i ++) { if (sub_80E9878(i)) { @@ -1158,13 +1160,13 @@ void sub_80EA354(void) u8 i; secretBaseRecordId = VarGet(VAR_CURRENT_SECRET_BASE); - if (!FlagGet(0x922)) + if (!FlagGet(FLAG_DAILY_SECRET_BASE)) { - for (i = 0; i < 20; i ++) + for (i = 0; i < SECRET_BASES_COUNT; i ++) { gSaveBlock1Ptr->secretBases[i].sbr_field_1_5 = FALSE; } - FlagSet(0x922); + FlagSet(FLAG_DAILY_SECRET_BASE); } gSpecialVar_0x8004 = sub_80EA20C(secretBaseRecordId); gSpecialVar_Result = gSaveBlock1Ptr->secretBases[secretBaseRecordId].sbr_field_1_5; @@ -1377,7 +1379,7 @@ s16 sub_80EA990(u8 secretBaseRecordId) { s16 i; - for (i = 0; i < 20; i ++) + for (i = 0; i < SECRET_BASES_COUNT; i ++) { if (gSaveBlock1Ptr->secretBases[i].secretBaseId == secretBaseRecordId) { @@ -1391,7 +1393,7 @@ u8 sub_80EA9D8(void) { s16 i; - for (i = 1; i < 20; i ++) + for (i = 1; i < SECRET_BASES_COUNT; i ++) { if (gSaveBlock1Ptr->secretBases[i].secretBaseId == 0) { @@ -1405,7 +1407,7 @@ u8 sub_80EAA18(void) { s16 i; - for (i = 1; i < 20; i ++) + for (i = 1; i < SECRET_BASES_COUNT; i ++) { if (gSaveBlock1Ptr->secretBases[i].sbr_field_1_6 == 0 && gSaveBlock1Ptr->secretBases[i].sbr_field_1_0 == 0) { @@ -1467,7 +1469,7 @@ void sub_80EAAF4(void) secretBases = gSaveBlock1Ptr->secretBases; for (i = 1; i < 19; i ++) { - for (j = i + 1; j < 20; j ++) + for (j = i + 1; j < SECRET_BASES_COUNT; j ++) { if ((secretBases[i].sbr_field_1_6 == 0 && secretBases[j].sbr_field_1_6 == 1) || (secretBases[i].sbr_field_1_6 == 2 && secretBases[j].sbr_field_1_6 != 2)) { @@ -1483,7 +1485,7 @@ void sub_80EABA4(struct SecretBaseRecordMixer *mixer, u8 b) { u16 i; - for (i = 1; i < 20; i ++) + for (i = 1; i < SECRET_BASES_COUNT; i ++) { if (mixer->records[i].sbr_field_1_6 == b) { @@ -1523,7 +1525,7 @@ void DeleteFirstOldBaseFromPlayerInRecordMixingFriendsRecords(struct SecretBaseR u8 i; u8 sbFlags = 0x0; - for (i = 0; i < 20; i ++) + for (i = 0; i < SECRET_BASES_COUNT; i ++) { if (!(sbFlags & 0x1)) // 001 { @@ -1563,7 +1565,7 @@ bool8 sub_80EAD14(struct SecretBaseRecord *base, struct SecretBaseRecord *secret { u8 i; - for (i = 0; i < 20; i ++) + for (i = 0; i < SECRET_BASES_COUNT; i ++) { if (secretBases[i].secretBaseId != 0) { @@ -1596,7 +1598,7 @@ void sub_80EAD94(struct SecretBaseRecord *basesA, struct SecretBaseRecord *bases { u8 i; - for (i = 1; i < 20; i ++) + for (i = 1; i < SECRET_BASES_COUNT; i ++) { if (basesA[i].secretBaseId) { @@ -1613,7 +1615,7 @@ void sub_80EAD94(struct SecretBaseRecord *basesA, struct SecretBaseRecord *bases } } } - for (i = 0; i < 20; i ++) + for (i = 0; i < SECRET_BASES_COUNT; i ++) { if (basesB[i].secretBaseId) { @@ -1624,7 +1626,7 @@ void sub_80EAD94(struct SecretBaseRecord *basesA, struct SecretBaseRecord *bases } } } - for (i = 0; i < 20; i ++) + for (i = 0; i < SECRET_BASES_COUNT; i ++) { if (basesC[i].secretBaseId) { @@ -1651,7 +1653,7 @@ void sub_80EAEB4(struct SecretBaseRecordMixer *mixers) { u16 i; - for (i = 0; i < 20; i ++) + for (i = 0; i < SECRET_BASES_COUNT; i ++) { sub_80EAE90(&mixers[0].records[i], mixers[0].version, mixers[0].language); sub_80EAE90(&mixers[1].records[i], mixers[1].version, mixers[1].language); @@ -1680,7 +1682,7 @@ void ReceiveSecretBasesData(void *records, size_t recordSize, u8 linkIdx) struct SecretBaseRecordMixer mixers[3]; u16 i; - if (FlagGet(0x60)) + if (FlagGet(FLAG_RECEIVED_SECRET_POWER)) { switch (GetLinkPlayerCount()) { @@ -1740,7 +1742,7 @@ void ReceiveSecretBasesData(void *records, size_t recordSize, u8 linkIdx) break; } sub_80EAEF4(mixers); - for (i = 1; i < 20; i ++) + for (i = 1; i < SECRET_BASES_COUNT; i ++) { if (gSaveBlock1Ptr->secretBases[i].sbr_field_1_0 == 1) { @@ -1749,7 +1751,7 @@ void ReceiveSecretBasesData(void *records, size_t recordSize, u8 linkIdx) } } sub_80EAAF4(); - for (i = 1; i < 20; i ++) + for (i = 1; i < SECRET_BASES_COUNT; i ++) { if (gSaveBlock1Ptr->secretBases[i].sbr_field_1_6 == 2) { @@ -1767,7 +1769,7 @@ void sub_80EB18C(struct SecretBaseRecord *bases) { u32 i; - for (i = 0; i < 20; i ++) + for (i = 0; i < SECRET_BASES_COUNT; i ++) { if (bases[i].language == LANGUAGE_JAPANESE) { |