diff --git a/src/field_specials.c b/src/field_specials.c index 96eb949e5..27d8c93af 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -193,59 +193,40 @@ static void DetermineCyclingRoadResults(u32 numFrames, u8 numBikeCollisions) result = 0; if (numBikeCollisions == 0) - { result = 5; - } else if (numBikeCollisions < 4) - { result = 4; - } else if (numBikeCollisions < 10) - { result = 3; - } else if (numBikeCollisions < 20) - { result = 2; - } else if (numBikeCollisions < 100) - { result = 1; - } if (numFrames / 60 <= 10) - { result += 5; - } else if (numFrames / 60 <= 15) - { result += 4; - } else if (numFrames / 60 <= 20) - { result += 3; - } else if (numFrames / 60 <= 40) - { result += 2; - } else if (numFrames / 60 < 60) - { result += 1; - } - gSpecialVar_Result = result; } -void FinishCyclingRoadChallenge(void) { +void FinishCyclingRoadChallenge(void) +{ const u32 numFrames = gMain.vblankCounter1 - sBikeCyclingTimer; DetermineCyclingRoadResults(numFrames, gBikeCollisions); RecordCyclingRoadResults(numFrames, gBikeCollisions); } -static void RecordCyclingRoadResults(u32 numFrames, u8 numBikeCollisions) { +static void RecordCyclingRoadResults(u32 numFrames, u8 numBikeCollisions) +{ u16 low = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_L); u16 high = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_H); u32 framesRecord = low + (high << 16); @@ -258,25 +239,23 @@ static void RecordCyclingRoadResults(u32 numFrames, u8 numBikeCollisions) { } } -u16 GetRecordedCyclingRoadResults(void) { +u16 GetRecordedCyclingRoadResults(void) +{ u16 low = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_L); u16 high = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_H); u32 framesRecord = low + (high << 16); if (framesRecord == 0) - { return FALSE; - } DetermineCyclingRoadResults(framesRecord, VarGet(VAR_CYCLING_ROAD_RECORD_COLLISIONS)); return TRUE; } -void UpdateCyclingRoadState(void) { +void UpdateCyclingRoadState(void) +{ if (gLastUsedWarp.mapNum == MAP_NUM(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE) && gLastUsedWarp.mapGroup == MAP_GROUP(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE)) - { return; - } if (VarGet(VAR_CYCLING_CHALLENGE_STATE) == 2 || VarGet(VAR_CYCLING_CHALLENGE_STATE) == 3) { @@ -300,9 +279,8 @@ void ResetSSTidalFlag(void) bool32 CountSSTidalStep(u16 delta) { if (!FlagGet(FLAG_SYS_CRUISE_MODE) || (*GetVarPointer(VAR_CRUISE_STEP_COUNT) += delta) < SS_TIDAL_MAX_STEPS) - { return FALSE; - } + return TRUE; } @@ -311,51 +289,51 @@ u8 GetSSTidalLocation(s8 *mapGroup, s8 *mapNum, s16 *x, s16 *y) u16 *varCruiseStepCount = GetVarPointer(VAR_CRUISE_STEP_COUNT); switch (*GetVarPointer(VAR_SS_TIDAL_STATE)) { - case SS_TIDAL_BOARD_SLATEPORT: - case SS_TIDAL_LAND_SLATEPORT: - return SS_TIDAL_LOCATION_SLATEPORT; - case SS_TIDAL_HALFWAY_LILYCOVE: - case SS_TIDAL_EXIT_CURRENTS_RIGHT: - return SS_TIDAL_LOCATION_ROUTE131; - case SS_TIDAL_LAND_LILYCOVE: - case SS_TIDAL_BOARD_LILYCOVE: - return SS_TIDAL_LOCATION_LILYCOVE; - case SS_TIDAL_DEPART_LILYCOVE: - case SS_TIDAL_EXIT_CURRENTS_LEFT: - return SS_TIDAL_LOCATION_ROUTE124; - case SS_TIDAL_DEPART_SLATEPORT: - if (*varCruiseStepCount < 60) - { - *mapNum = MAP_NUM(ROUTE134); - *x = *varCruiseStepCount + 19; - } - else if (*varCruiseStepCount < 140) - { - *mapNum = MAP_NUM(ROUTE133); - *x = *varCruiseStepCount - 60; - } - else - { - *mapNum = MAP_NUM(ROUTE132); - *x = *varCruiseStepCount - 140; - } - break; - case SS_TIDAL_HALFWAY_SLATEPORT: - if (*varCruiseStepCount < 66) - { - *mapNum = MAP_NUM(ROUTE132); - *x = 65 - *varCruiseStepCount; - } - else if (*varCruiseStepCount < 146) { - *mapNum = MAP_NUM(ROUTE133); - *x = 145 - *varCruiseStepCount; - } - else - { - *mapNum = MAP_NUM(ROUTE134); - *x = 224 - *varCruiseStepCount; - } - break; + case SS_TIDAL_BOARD_SLATEPORT: + case SS_TIDAL_LAND_SLATEPORT: + return SS_TIDAL_LOCATION_SLATEPORT; + case SS_TIDAL_HALFWAY_LILYCOVE: + case SS_TIDAL_EXIT_CURRENTS_RIGHT: + return SS_TIDAL_LOCATION_ROUTE131; + case SS_TIDAL_LAND_LILYCOVE: + case SS_TIDAL_BOARD_LILYCOVE: + return SS_TIDAL_LOCATION_LILYCOVE; + case SS_TIDAL_DEPART_LILYCOVE: + case SS_TIDAL_EXIT_CURRENTS_LEFT: + return SS_TIDAL_LOCATION_ROUTE124; + case SS_TIDAL_DEPART_SLATEPORT: + if (*varCruiseStepCount < 60) + { + *mapNum = MAP_NUM(ROUTE134); + *x = *varCruiseStepCount + 19; + } + else if (*varCruiseStepCount < 140) + { + *mapNum = MAP_NUM(ROUTE133); + *x = *varCruiseStepCount - 60; + } + else + { + *mapNum = MAP_NUM(ROUTE132); + *x = *varCruiseStepCount - 140; + } + break; + case SS_TIDAL_HALFWAY_SLATEPORT: + if (*varCruiseStepCount < 66) + { + *mapNum = MAP_NUM(ROUTE132); + *x = 65 - *varCruiseStepCount; + } + else if (*varCruiseStepCount < 146) { + *mapNum = MAP_NUM(ROUTE133); + *x = 145 - *varCruiseStepCount; + } + else + { + *mapNum = MAP_NUM(ROUTE134); + *x = 224 - *varCruiseStepCount; + } + break; } *mapGroup = MAP_GROUP(ROUTE132); *y = 20; @@ -368,17 +346,15 @@ bool32 ShouldDoWallyCall(void) { switch (gMapHeader.mapType) { - case MAP_TYPE_TOWN: - case MAP_TYPE_CITY: - case MAP_TYPE_ROUTE: - case MAP_TYPE_OCEAN_ROUTE: - if (++(*GetVarPointer(VAR_WALLY_CALL_STEP_COUNTER)) < 250) - { - return FALSE; - } - break; - default: + case MAP_TYPE_TOWN: + case MAP_TYPE_CITY: + case MAP_TYPE_ROUTE: + case MAP_TYPE_OCEAN_ROUTE: + if (++(*GetVarPointer(VAR_WALLY_CALL_STEP_COUNTER)) < 250) return FALSE; + break; + default: + return FALSE; } } else @@ -395,17 +371,17 @@ bool32 ShouldDoScottFortreeCall(void) { switch (gMapHeader.mapType) { - case MAP_TYPE_TOWN: - case MAP_TYPE_CITY: - case MAP_TYPE_ROUTE: - case MAP_TYPE_OCEAN_ROUTE: - if (++(*GetVarPointer(VAR_SCOTT_FORTREE_CALL_STEP_COUNTER)) < 10) - { - return FALSE; - } - break; - default: + case MAP_TYPE_TOWN: + case MAP_TYPE_CITY: + case MAP_TYPE_ROUTE: + case MAP_TYPE_OCEAN_ROUTE: + if (++(*GetVarPointer(VAR_SCOTT_FORTREE_CALL_STEP_COUNTER)) < 10) + { return FALSE; + } + break; + default: + return FALSE; } } else @@ -422,17 +398,17 @@ bool32 ShouldDoScottBattleFrontierCall(void) { switch (gMapHeader.mapType) { - case MAP_TYPE_TOWN: - case MAP_TYPE_CITY: - case MAP_TYPE_ROUTE: - case MAP_TYPE_OCEAN_ROUTE: - if (++(*GetVarPointer(VAR_SCOTT_BF_CALL_STEP_COUNTER)) < 10) - { - return FALSE; - } - break; - default: + case MAP_TYPE_TOWN: + case MAP_TYPE_CITY: + case MAP_TYPE_ROUTE: + case MAP_TYPE_OCEAN_ROUTE: + if (++(*GetVarPointer(VAR_SCOTT_BF_CALL_STEP_COUNTER)) < 10) + { return FALSE; + } + break; + default: + return FALSE; } } else @@ -449,17 +425,17 @@ bool32 ShouldDoRoxanneCall(void) { switch (gMapHeader.mapType) { - case MAP_TYPE_TOWN: - case MAP_TYPE_CITY: - case MAP_TYPE_ROUTE: - case MAP_TYPE_OCEAN_ROUTE: - if (++(*GetVarPointer(VAR_ROXANNE_CALL_STEP_COUNTER)) < 250) - { - return FALSE; - } - break; - default: + case MAP_TYPE_TOWN: + case MAP_TYPE_CITY: + case MAP_TYPE_ROUTE: + case MAP_TYPE_OCEAN_ROUTE: + if (++(*GetVarPointer(VAR_ROXANNE_CALL_STEP_COUNTER)) < 250) + { return FALSE; + } + break; + default: + return FALSE; } } else @@ -476,17 +452,17 @@ bool32 ShouldDoRivalRayquazaCall(void) { switch (gMapHeader.mapType) { - case MAP_TYPE_TOWN: - case MAP_TYPE_CITY: - case MAP_TYPE_ROUTE: - case MAP_TYPE_OCEAN_ROUTE: - if (++(*GetVarPointer(VAR_RIVAL_RAYQUAZA_CALL_STEP_COUNTER)) < 250) - { - return FALSE; - } - break; - default: + case MAP_TYPE_TOWN: + case MAP_TYPE_CITY: + case MAP_TYPE_ROUTE: + case MAP_TYPE_OCEAN_ROUTE: + if (++(*GetVarPointer(VAR_RIVAL_RAYQUAZA_CALL_STEP_COUNTER)) < 250) + { return FALSE; + } + break; + default: + return FALSE; } } else @@ -540,24 +516,24 @@ void SpawnLinkPartnerObjectEvent(void) playerFacingDirection = GetPlayerFacingDirection(); switch (playerFacingDirection) { - case DIR_WEST: - j = 2; - x = gSaveBlock1Ptr->pos.x - 1; - y = gSaveBlock1Ptr->pos.y; - break; - case DIR_NORTH: - j = 1; - x = gSaveBlock1Ptr->pos.x; - y = gSaveBlock1Ptr->pos.y - 1; - break; - case DIR_EAST: - x = gSaveBlock1Ptr->pos.x + 1; - y = gSaveBlock1Ptr->pos.y; - break; - case DIR_SOUTH: - j = 3; - x = gSaveBlock1Ptr->pos.x; - y = gSaveBlock1Ptr->pos.y + 1; + case DIR_WEST: + j = 2; + x = gSaveBlock1Ptr->pos.x - 1; + y = gSaveBlock1Ptr->pos.y; + break; + case DIR_NORTH: + j = 1; + x = gSaveBlock1Ptr->pos.x; + y = gSaveBlock1Ptr->pos.y - 1; + break; + case DIR_EAST: + x = gSaveBlock1Ptr->pos.x + 1; + y = gSaveBlock1Ptr->pos.y; + break; + case DIR_SOUTH: + j = 3; + x = gSaveBlock1Ptr->pos.x; + y = gSaveBlock1Ptr->pos.y + 1; } for (i = 0; i < gSpecialVar_0x8004; i++) { @@ -565,33 +541,31 @@ void SpawnLinkPartnerObjectEvent(void) { switch ((u8)gLinkPlayers[i].version) { - case VERSION_RUBY: - case VERSION_SAPPHIRE: - if (gLinkPlayers[i].gender == 0) - linkSpriteId = OBJ_EVENT_GFX_LINK_RS_BRENDAN; - else - linkSpriteId = OBJ_EVENT_GFX_LINK_RS_MAY; - break; - case VERSION_EMERALD: - if (gLinkPlayers[i].gender == 0) - linkSpriteId = OBJ_EVENT_GFX_RIVAL_BRENDAN_NORMAL; - else - linkSpriteId = OBJ_EVENT_GFX_RIVAL_MAY_NORMAL; - break; - default: - if (gLinkPlayers[i].gender == 0) - linkSpriteId = OBJ_EVENT_GFX_RIVAL_BRENDAN_NORMAL; - else - linkSpriteId = OBJ_EVENT_GFX_RIVAL_MAY_NORMAL; - break; + case VERSION_RUBY: + case VERSION_SAPPHIRE: + if (gLinkPlayers[i].gender == 0) + linkSpriteId = OBJ_EVENT_GFX_LINK_RS_BRENDAN; + else + linkSpriteId = OBJ_EVENT_GFX_LINK_RS_MAY; + break; + case VERSION_EMERALD: + if (gLinkPlayers[i].gender == 0) + linkSpriteId = OBJ_EVENT_GFX_RIVAL_BRENDAN_NORMAL; + else + linkSpriteId = OBJ_EVENT_GFX_RIVAL_MAY_NORMAL; + break; + default: + if (gLinkPlayers[i].gender == 0) + linkSpriteId = OBJ_EVENT_GFX_RIVAL_BRENDAN_NORMAL; + else + linkSpriteId = OBJ_EVENT_GFX_RIVAL_MAY_NORMAL; + break; } SpawnSpecialObjectEventParameterized(linkSpriteId, movementTypes[j], 240 - i, coordOffsets[j][0] + x + MAP_OFFSET, coordOffsets[j][1] + y + MAP_OFFSET, 0); LoadLinkPartnerObjectEventSpritePalette(linkSpriteId, 240 - i, i); j++; if (j == MAX_LINK_PLAYERS) - { j = 0; - } } } } @@ -664,84 +638,84 @@ void MauvilleGymSetDefaultBarriers(void) { switch (MapGridGetMetatileIdAt(x, y)) { - case METATILE_MauvilleGym_GreenBeamH1_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH1_Off); - break; - case METATILE_MauvilleGym_GreenBeamH2_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH2_Off); - break; - case METATILE_MauvilleGym_GreenBeamH3_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH3_Off); - break; - case METATILE_MauvilleGym_GreenBeamH4_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH4_Off); - break; - case METATILE_MauvilleGym_GreenBeamH1_Off: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH1_On); - break; - case METATILE_MauvilleGym_GreenBeamH2_Off: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH2_On); - break; - case METATILE_MauvilleGym_GreenBeamH3_Off: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH3_On | METATILE_COLLISION_MASK); - break; - case METATILE_MauvilleGym_GreenBeamH4_Off: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH4_On | METATILE_COLLISION_MASK); - break; - case METATILE_MauvilleGym_RedBeamH1_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH1_Off); - break; - case METATILE_MauvilleGym_RedBeamH2_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH2_Off); - break; - case METATILE_MauvilleGym_RedBeamH3_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH3_Off); - break; - case METATILE_MauvilleGym_RedBeamH4_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_Off); - break; - case METATILE_MauvilleGym_RedBeamH1_Off: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH1_On); - break; - case METATILE_MauvilleGym_RedBeamH2_Off: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH2_On); - break; - case METATILE_MauvilleGym_RedBeamH3_Off: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH3_On | METATILE_COLLISION_MASK); - break; - case METATILE_MauvilleGym_RedBeamH4_Off: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_On | METATILE_COLLISION_MASK); - break; - case METATILE_MauvilleGym_GreenBeamV1_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_On | METATILE_COLLISION_MASK); - break; - case METATILE_MauvilleGym_GreenBeamV2_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_FloorTile); - break; - case METATILE_MauvilleGym_RedBeamV1_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_Off | METATILE_COLLISION_MASK); - break; - case METATILE_MauvilleGym_RedBeamV2_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_FloorTile); - break; - case METATILE_MauvilleGym_PoleBottom_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamV1_On | METATILE_COLLISION_MASK); - break; - case METATILE_MauvilleGym_FloorTile: - if (MapGridGetMetatileIdAt(x, y - 1) == METATILE_MauvilleGym_GreenBeamV1_On) - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamV2_On | METATILE_COLLISION_MASK); - else - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamV2_On | METATILE_COLLISION_MASK); - break; - case METATILE_MauvilleGym_PoleBottom_Off: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamV1_On | METATILE_COLLISION_MASK); - break; - case METATILE_MauvilleGym_PoleTop_Off: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_On | METATILE_COLLISION_MASK); - break; - case METATILE_MauvilleGym_PoleTop_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_Off); - break; + case METATILE_MauvilleGym_GreenBeamH1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH1_Off); + break; + case METATILE_MauvilleGym_GreenBeamH2_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH2_Off); + break; + case METATILE_MauvilleGym_GreenBeamH3_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH3_Off); + break; + case METATILE_MauvilleGym_GreenBeamH4_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH4_Off); + break; + case METATILE_MauvilleGym_GreenBeamH1_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH1_On); + break; + case METATILE_MauvilleGym_GreenBeamH2_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH2_On); + break; + case METATILE_MauvilleGym_GreenBeamH3_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH3_On | METATILE_COLLISION_MASK); + break; + case METATILE_MauvilleGym_GreenBeamH4_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH4_On | METATILE_COLLISION_MASK); + break; + case METATILE_MauvilleGym_RedBeamH1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH1_Off); + break; + case METATILE_MauvilleGym_RedBeamH2_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH2_Off); + break; + case METATILE_MauvilleGym_RedBeamH3_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH3_Off); + break; + case METATILE_MauvilleGym_RedBeamH4_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_Off); + break; + case METATILE_MauvilleGym_RedBeamH1_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH1_On); + break; + case METATILE_MauvilleGym_RedBeamH2_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH2_On); + break; + case METATILE_MauvilleGym_RedBeamH3_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH3_On | METATILE_COLLISION_MASK); + break; + case METATILE_MauvilleGym_RedBeamH4_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_On | METATILE_COLLISION_MASK); + break; + case METATILE_MauvilleGym_GreenBeamV1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_On | METATILE_COLLISION_MASK); + break; + case METATILE_MauvilleGym_GreenBeamV2_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_FloorTile); + break; + case METATILE_MauvilleGym_RedBeamV1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_Off | METATILE_COLLISION_MASK); + break; + case METATILE_MauvilleGym_RedBeamV2_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_FloorTile); + break; + case METATILE_MauvilleGym_PoleBottom_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamV1_On | METATILE_COLLISION_MASK); + break; + case METATILE_MauvilleGym_FloorTile: + if (MapGridGetMetatileIdAt(x, y - 1) == METATILE_MauvilleGym_GreenBeamV1_On) + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamV2_On | METATILE_COLLISION_MASK); + else + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamV2_On | METATILE_COLLISION_MASK); + break; + case METATILE_MauvilleGym_PoleBottom_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamV1_On | METATILE_COLLISION_MASK); + break; + case METATILE_MauvilleGym_PoleTop_Off: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_On | METATILE_COLLISION_MASK); + break; + case METATILE_MauvilleGym_PoleTop_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_Off); + break; } } } @@ -763,43 +737,43 @@ void MauvilleGymDeactivatePuzzle(void) { switch (MapGridGetMetatileIdAt(x, y)) { - case METATILE_MauvilleGym_GreenBeamH1_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH1_Off); - break; - case METATILE_MauvilleGym_GreenBeamH2_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH2_Off); - break; - case METATILE_MauvilleGym_GreenBeamH3_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH3_Off); - break; - case METATILE_MauvilleGym_GreenBeamH4_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH4_Off); - break; - case METATILE_MauvilleGym_RedBeamH1_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH1_Off); - break; - case METATILE_MauvilleGym_RedBeamH2_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH2_Off); - break; - case METATILE_MauvilleGym_RedBeamH3_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH3_Off); - break; - case METATILE_MauvilleGym_RedBeamH4_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_Off); - break; - case METATILE_MauvilleGym_GreenBeamV1_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_On | METATILE_COLLISION_MASK); - break; - case METATILE_MauvilleGym_RedBeamV1_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_Off | METATILE_COLLISION_MASK); - break; - case METATILE_MauvilleGym_GreenBeamV2_On: - case METATILE_MauvilleGym_RedBeamV2_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_FloorTile); - break; - case METATILE_MauvilleGym_PoleTop_On: - MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_Off); - break; + case METATILE_MauvilleGym_GreenBeamH1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH1_Off); + break; + case METATILE_MauvilleGym_GreenBeamH2_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH2_Off); + break; + case METATILE_MauvilleGym_GreenBeamH3_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH3_Off); + break; + case METATILE_MauvilleGym_GreenBeamH4_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_GreenBeamH4_Off); + break; + case METATILE_MauvilleGym_RedBeamH1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH1_Off); + break; + case METATILE_MauvilleGym_RedBeamH2_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH2_Off); + break; + case METATILE_MauvilleGym_RedBeamH3_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH3_Off); + break; + case METATILE_MauvilleGym_RedBeamH4_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_RedBeamH4_Off); + break; + case METATILE_MauvilleGym_GreenBeamV1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_On | METATILE_COLLISION_MASK); + break; + case METATILE_MauvilleGym_RedBeamV1_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleBottom_Off | METATILE_COLLISION_MASK); + break; + case METATILE_MauvilleGym_GreenBeamV2_On: + case METATILE_MauvilleGym_RedBeamV2_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_FloorTile); + break; + case METATILE_MauvilleGym_PoleTop_On: + MapGridSetMetatileIdAt(x, y, METATILE_MauvilleGym_PoleTop_Off); + break; } } } @@ -849,54 +823,54 @@ static void PetalburgGymSetDoorMetatiles(u8 roomNumber, u16 metatileId) u8 nDoors = 0; switch (roomNumber) { - case 1: - nDoors = 2; - doorCoordsX[0] = 1; - doorCoordsX[1] = 7; - doorCoordsY[0] = 104; - doorCoordsY[1] = 104; - break; - case 2: - nDoors = 2; - doorCoordsX[0] = 1; - doorCoordsX[1] = 7; - doorCoordsY[0] = 78; - doorCoordsY[1] = 78; - break; - case 3: - nDoors = 2; - doorCoordsX[0] = 1; - doorCoordsX[1] = 7; - doorCoordsY[0] = 91; - doorCoordsY[1] = 91; - break; - case 4: - nDoors = 1; - doorCoordsX[0] = 7; - doorCoordsY[0] = 39; - break; - case 5: - nDoors = 2; - doorCoordsX[0] = 1; - doorCoordsX[1] = 7; - doorCoordsY[0] = 52; - doorCoordsY[1] = 52; - break; - case 6: - nDoors = 1; - doorCoordsX[0] = 1; - doorCoordsY[0] = 65; - break; - case 7: - nDoors = 1; - doorCoordsX[0] = 7; - doorCoordsY[0] = 13; - break; - case 8: - nDoors = 1; - doorCoordsX[0] = 1; - doorCoordsY[0] = 26; - break; + case 1: + nDoors = 2; + doorCoordsX[0] = 1; + doorCoordsX[1] = 7; + doorCoordsY[0] = 104; + doorCoordsY[1] = 104; + break; + case 2: + nDoors = 2; + doorCoordsX[0] = 1; + doorCoordsX[1] = 7; + doorCoordsY[0] = 78; + doorCoordsY[1] = 78; + break; + case 3: + nDoors = 2; + doorCoordsX[0] = 1; + doorCoordsX[1] = 7; + doorCoordsY[0] = 91; + doorCoordsY[1] = 91; + break; + case 4: + nDoors = 1; + doorCoordsX[0] = 7; + doorCoordsY[0] = 39; + break; + case 5: + nDoors = 2; + doorCoordsX[0] = 1; + doorCoordsX[1] = 7; + doorCoordsY[0] = 52; + doorCoordsY[1] = 52; + break; + case 6: + nDoors = 1; + doorCoordsX[0] = 1; + doorCoordsY[0] = 65; + break; + case 7: + nDoors = 1; + doorCoordsX[0] = 7; + doorCoordsY[0] = 13; + break; + case 8: + nDoors = 1; + doorCoordsX[0] = 1; + doorCoordsY[0] = 26; + break; } for (i = 0; i < nDoors; i++) { @@ -930,25 +904,17 @@ u8 GetPlayerTrainerIdOnesDigit(void) void GetPlayerBigGuyGirlString(void) { if (gSaveBlock2Ptr->playerGender == MALE) - { StringCopy(gStringVar1, gText_BigGuy); - } else - { StringCopy(gStringVar1, gText_BigGirl); - } } void GetRivalSonDaughterString(void) { if (gSaveBlock2Ptr->playerGender == MALE) - { StringCopy(gStringVar1, gText_Daughter); - } else - { StringCopy(gStringVar1, gText_Son); - } } u8 GetBattleOutcome(void) @@ -983,29 +949,18 @@ u8 GetLeadMonFriendshipScore(void) { struct Pokemon *pokemon = &gPlayerParty[GetLeadMonIndex()]; if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) == MAX_FRIENDSHIP) - { return 6; - } if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 200) - { return 5; - } if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 150) - { return 4; - } if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 100) - { return 3; - } if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 50) - { return 2; - } if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 1) - { return 1; - } + return 0; } @@ -1036,9 +991,7 @@ static void Task_PCTurnOnEffect(u8 taskId) { struct Task *task = &gTasks[taskId]; if (task->data[0] == 0) - { PCTurnOnEffect_0(task); - } } static void PCTurnOnEffect_0(struct Task *task) @@ -1052,26 +1005,24 @@ static void PCTurnOnEffect_0(struct Task *task) playerDirection = GetPlayerFacingDirection(); switch (playerDirection) { - case DIR_NORTH: - dx = 0; - dy = -1; - break; - case DIR_WEST: - dx = -1; - dy = -1; - break; - case DIR_EAST: - dx = 1; - dy = -1; - break; + case DIR_NORTH: + dx = 0; + dy = -1; + break; + case DIR_WEST: + dx = -1; + dy = -1; + break; + case DIR_EAST: + dx = 1; + dy = -1; + break; } PCTurnOnEffect_1(task->data[4], dx, dy); DrawWholeMapView(); task->data[4] ^= 1; if ((++task->data[2]) == 5) - { DestroyTask(task->data[1]); - } } task->data[3]++; } @@ -1082,32 +1033,20 @@ static void PCTurnOnEffect_1(s16 isPcTurnedOn, s8 dx, s8 dy) if (isPcTurnedOn) { if (gSpecialVar_0x8004 == PC_LOCATION_OTHER) - { tileId = METATILE_Building_PC_Off; - } else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE) - { tileId = METATILE_BrendansMaysHouse_BrendanPC_Off; - } else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE) - { tileId = METATILE_BrendansMaysHouse_MayPC_Off; - } } else { if (gSpecialVar_0x8004 == PC_LOCATION_OTHER) - { tileId = METATILE_Building_PC_On; - } else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE) - { tileId = METATILE_BrendansMaysHouse_BrendanPC_On; - } else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE) - { tileId = METATILE_BrendansMaysHouse_MayPC_On; - } } MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | METATILE_COLLISION_MASK); } @@ -1125,31 +1064,25 @@ static void PCTurnOffEffect(void) u8 playerDirection = GetPlayerFacingDirection(); switch (playerDirection) { - case DIR_NORTH: - dx = 0; - dy = -1; - break; - case DIR_WEST: - dx = -1; - dy = -1; - break; - case DIR_EAST: - dx = 1; - dy = -1; - break; + case DIR_NORTH: + dx = 0; + dy = -1; + break; + case DIR_WEST: + dx = -1; + dy = -1; + break; + case DIR_EAST: + dx = 1; + dy = -1; + break; } if (gSpecialVar_0x8004 == 0) - { tileId = METATILE_Building_PC_Off; - } else if (gSpecialVar_0x8004 == 1) - { tileId = METATILE_BrendansMaysHouse_BrendanPC_Off; - } else if (gSpecialVar_0x8004 == 2) - { tileId = METATILE_BrendansMaysHouse_MayPC_Off; - } MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | METATILE_COLLISION_MASK); DrawWholeMapView(); } @@ -1171,9 +1104,7 @@ static void Task_LotteryCornerComputerEffect(u8 taskId) { struct Task *task = &gTasks[taskId]; if (task->data[0] == 0) - { LotteryCornerComputerEffect(task); - } } static void LotteryCornerComputerEffect(struct Task *task) @@ -1194,9 +1125,7 @@ static void LotteryCornerComputerEffect(struct Task *task) DrawWholeMapView(); task->data[4] ^= 1; if ((++task->data[2]) == 5) - { DestroyTask(task->data[1]); - } } task->data[3]++; } @@ -1227,45 +1156,40 @@ void ResetTrickHouseNuggetFlag(void) bool8 CheckLeadMonCool(void) { if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_COOL) < 200) - { return FALSE; - } + return TRUE; } bool8 CheckLeadMonBeauty(void) { if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_BEAUTY) < 200) - { return FALSE; - } + return TRUE; } bool8 CheckLeadMonCute(void) { if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_CUTE) < 200) - { return FALSE; - } + return TRUE; } bool8 CheckLeadMonSmart(void) { if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SMART) < 200) - { return FALSE; - } + return TRUE; } bool8 CheckLeadMonTough(void) { if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_TOUGH) < 200) - { return FALSE; - } + return TRUE; } @@ -1373,9 +1297,8 @@ bool8 FoundAbandonedShipRoom1Key(void) u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_1_KEY; *specVar = flag; if (!FlagGet(flag)) - { return FALSE; - } + return TRUE; } @@ -1385,9 +1308,8 @@ bool8 FoundAbandonedShipRoom2Key(void) u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_2_KEY; *specVar = flag; if (!FlagGet(flag)) - { return FALSE; - } + return TRUE; } @@ -1397,9 +1319,8 @@ bool8 FoundAbandonedShipRoom4Key(void) u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_4_KEY; *specVar = flag; if (!FlagGet(flag)) - { return FALSE; - } + return TRUE; } @@ -1409,9 +1330,8 @@ bool8 FoundAbandonedShipRoom6Key(void) u16 flag = FLAG_HIDDEN_ITEM_ABANDONED_SHIP_RM_6_KEY; *specVar = flag; if (!FlagGet(flag)) - { return FALSE; - } + return TRUE; } @@ -1430,17 +1350,14 @@ void GiveLeadMonEffortRibbon(void) leadMon = &gPlayerParty[GetLeadMonIndex()]; SetMonData(leadMon, MON_DATA_EFFORT_RIBBON, &ribbonSet); if (GetRibbonCount(leadMon) > NUM_CUTIES_RIBBONS) - { TryPutSpotTheCutiesOnAir(leadMon, MON_DATA_EFFORT_RIBBON); - } } bool8 Special_AreLeadMonEVsMaxedOut(void) { if (GetMonEVCount(&gPlayerParty[GetLeadMonIndex()]) >= MAX_TOTAL_EVS) - { return TRUE; - } + return FALSE; } @@ -1491,9 +1408,7 @@ bool8 IsStarterInParty(void) for (i = 0; i < partyCount; i++) { if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) == starter) - { return TRUE; - } } return FALSE; } @@ -1506,9 +1421,8 @@ bool8 ScriptCheckFreePokemonStorageSpace(void) bool8 IsPokerusInParty(void) { if (!CheckPartyPokerus(gPlayerParty, 0x3f)) - { return FALSE; - } + return TRUE; } @@ -1586,9 +1500,7 @@ u8 GetLeadMonIndex(void) for (i = 0; i < partyCount; i++) { if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_EGG && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != 0) - { return i; - } } return 0; } @@ -1608,13 +1520,10 @@ u16 GetDaysUntilPacifidlogTMAvailable(void) { u16 tmReceivedDay = VarGet(VAR_PACIFIDLOG_TM_RECEIVED_DAY); if (gLocalTime.days - tmReceivedDay >= 7) - { return 0; - } else if (gLocalTime.days < 0) - { return 8; - } + return 7 - (gLocalTime.days - tmReceivedDay); } @@ -1675,18 +1584,18 @@ u16 GetMysteryGiftCardStat(void) { switch (gSpecialVar_Result) { - case GET_NUM_STAMPS: - return MysteryGift_GetCardStat(CARD_STAT_NUM_STAMPS); - case GET_MAX_STAMPS: - return MysteryGift_GetCardStat(CARD_STAT_MAX_STAMPS); - case GET_CARD_BATTLES_WON: - return MysteryGift_GetCardStat(CARD_STAT_BATTLES_WON); - case GET_CARD_BATTLES_LOST: // Never occurs - return MysteryGift_GetCardStat(CARD_STAT_BATTLES_LOST); - case GET_CARD_NUM_TRADES: // Never occurs - return MysteryGift_GetCardStat(CARD_STAT_NUM_TRADES); - default: - return 0; + case GET_NUM_STAMPS: + return MysteryGift_GetCardStat(CARD_STAT_NUM_STAMPS); + case GET_MAX_STAMPS: + return MysteryGift_GetCardStat(CARD_STAT_MAX_STAMPS); + case GET_CARD_BATTLES_WON: + return MysteryGift_GetCardStat(CARD_STAT_BATTLES_WON); + case GET_CARD_BATTLES_LOST: // Never occurs + return MysteryGift_GetCardStat(CARD_STAT_BATTLES_LOST); + case GET_CARD_NUM_TRADES: // Never occurs + return MysteryGift_GetCardStat(CARD_STAT_NUM_TRADES); + default: + return 0; } } @@ -1804,27 +1713,27 @@ void SetDeptStoreFloor(void) u8 deptStoreFloor; switch (gSaveBlock1Ptr->dynamicWarp.mapNum) { - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_1F): - deptStoreFloor = DEPT_STORE_FLOORNUM_1F; - break; - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_2F): - deptStoreFloor = DEPT_STORE_FLOORNUM_2F; - break; - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_3F): - deptStoreFloor = DEPT_STORE_FLOORNUM_3F; - break; - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_4F): - deptStoreFloor = DEPT_STORE_FLOORNUM_4F; - break; - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_5F): - deptStoreFloor = DEPT_STORE_FLOORNUM_5F; - break; - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP): - deptStoreFloor = DEPT_STORE_FLOORNUM_ROOFTOP; - break; - default: - deptStoreFloor = DEPT_STORE_FLOORNUM_1F; - break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_1F): + deptStoreFloor = DEPT_STORE_FLOORNUM_1F; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_2F): + deptStoreFloor = DEPT_STORE_FLOORNUM_2F; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_3F): + deptStoreFloor = DEPT_STORE_FLOORNUM_3F; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_4F): + deptStoreFloor = DEPT_STORE_FLOORNUM_4F; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_5F): + deptStoreFloor = DEPT_STORE_FLOORNUM_5F; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP): + deptStoreFloor = DEPT_STORE_FLOORNUM_ROOFTOP; + break; + default: + deptStoreFloor = DEPT_STORE_FLOORNUM_1F; + break; } VarSet(VAR_DEPT_STORE_FLOOR, deptStoreFloor); } @@ -1838,26 +1747,26 @@ u16 GetDeptStoreDefaultFloorChoice(void) { switch (gSaveBlock1Ptr->dynamicWarp.mapNum) { - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_5F): - sLilycoveDeptStore_NeverRead = 0; - sLilycoveDeptStore_DefaultFloorChoice = 0; - break; - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_4F): - sLilycoveDeptStore_NeverRead = 0; - sLilycoveDeptStore_DefaultFloorChoice = 1; - break; - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_3F): - sLilycoveDeptStore_NeverRead = 0; - sLilycoveDeptStore_DefaultFloorChoice = 2; - break; - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_2F): - sLilycoveDeptStore_NeverRead = 0; - sLilycoveDeptStore_DefaultFloorChoice = 3; - break; - case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_1F): - sLilycoveDeptStore_NeverRead = 0; - sLilycoveDeptStore_DefaultFloorChoice = 4; - break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_5F): + sLilycoveDeptStore_NeverRead = 0; + sLilycoveDeptStore_DefaultFloorChoice = 0; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_4F): + sLilycoveDeptStore_NeverRead = 0; + sLilycoveDeptStore_DefaultFloorChoice = 1; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_3F): + sLilycoveDeptStore_NeverRead = 0; + sLilycoveDeptStore_DefaultFloorChoice = 2; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_2F): + sLilycoveDeptStore_NeverRead = 0; + sLilycoveDeptStore_DefaultFloorChoice = 3; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_1F): + sLilycoveDeptStore_NeverRead = 0; + sLilycoveDeptStore_DefaultFloorChoice = 4; + break; } } @@ -1969,22 +1878,24 @@ static void Task_MoveElevatorWindowLights(u8 taskId) if (data[2] == FALSE) { for (y = 0; y < 3; y++) + { for (x = 0; x < 3; x++) MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][data[0] % 3] | METATILE_COLLISION_MASK); + } } // descending else { for (y = 0; y < 3; y++) + { for (x = 0; x < 3; x++) MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][data[0] % 3] | METATILE_COLLISION_MASK); + } } DrawWholeMapView(); data[1] = 0; if (data[0] == data[3]) - { DestroyTask(taskId); - } } data[1]++; } @@ -2004,9 +1915,7 @@ void BufferVarsForIVRater(void) gSpecialVar_0x8005 = 0; for (i = 0; i < NUM_STATS; i++) - { gSpecialVar_0x8005 += ivStorage[i]; - } gSpecialVar_0x8006 = 0; gSpecialVar_0x8007 = ivStorage[STAT_HP]; @@ -2070,9 +1979,8 @@ bool8 UsedPokemonCenterWarp(void) bool32 PlayerNotAtTrainerHillEntrance(void) { if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(TRAINER_HILL_ENTRANCE) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_HILL_ENTRANCE)) - { return FALSE; - } + return TRUE; } @@ -2169,86 +2077,58 @@ void ShowFrontierManiacMessage(void) switch (facility) { - case FRONTIER_MANIAC_TOWER_SINGLES: - case FRONTIER_MANIAC_TOWER_DOUBLES: - case FRONTIER_MANIAC_TOWER_MULTIS: - case FRONTIER_MANIAC_TOWER_LINK: - if (gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50] - >= gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN]) - { - winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50]; - } - else - { - winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN]; - } - break; - case FRONTIER_MANIAC_DOME: - if (gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] - >= gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) - { - winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]; - } - else - { - winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; - } - break; - case FRONTIER_MANIAC_FACTORY: - if (gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] - >= gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) - { - winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]; - } - else - { - winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; - } - break; - case FRONTIER_MANIAC_PALACE: - if (gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] - >= gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) - { - winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]; - } - else - { - winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; - } - break; - case FRONTIER_MANIAC_ARENA: - if (gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_50] - >= gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN]) - { - winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_50]; - } - else - { - winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN]; - } - break; - case FRONTIER_MANIAC_PIKE: - if (gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_50] - >= gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN]) - { - winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_50]; - } - else - { - winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN]; - } - break; - case FRONTIER_MANIAC_PYRAMID: - if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50] - >= gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN]) - { - winStreak = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50]; - } - else - { - winStreak = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN]; - } - break; + case FRONTIER_MANIAC_TOWER_SINGLES: + case FRONTIER_MANIAC_TOWER_DOUBLES: + case FRONTIER_MANIAC_TOWER_MULTIS: + case FRONTIER_MANIAC_TOWER_LINK: + if (gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50] + >= gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN]) + winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50]; + else + winStreak = gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN]; + break; + case FRONTIER_MANIAC_DOME: + if (gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] + >= gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) + winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]; + else + winStreak = gSaveBlock2Ptr->frontier.domeWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; + break; + case FRONTIER_MANIAC_FACTORY: + if (gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] + >= gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) + winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]; + else + winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; + break; + case FRONTIER_MANIAC_PALACE: + if (gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50] + >= gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]) + winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_50]; + else + winStreak = gSaveBlock2Ptr->frontier.palaceWinStreaks[FRONTIER_MODE_SINGLES][FRONTIER_LVL_OPEN]; + break; + case FRONTIER_MANIAC_ARENA: + if (gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_50] + >= gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN]) + winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_50]; + else + winStreak = gSaveBlock2Ptr->frontier.arenaWinStreaks[FRONTIER_LVL_OPEN]; + break; + case FRONTIER_MANIAC_PIKE: + if (gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_50] + >= gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN]) + winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_50]; + else + winStreak = gSaveBlock2Ptr->frontier.pikeWinStreaks[FRONTIER_LVL_OPEN]; + break; + case FRONTIER_MANIAC_PYRAMID: + if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50] + >= gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN]) + winStreak = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50]; + else + winStreak = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN]; + break; } for (i = 0; i < FRONTIER_MANIAC_MESSAGE_COUNT - 1 && sFrontierManiacStreakThresholds[facility][i] < winStreak; i++); @@ -2313,131 +2193,131 @@ void ShowScrollableMultichoice(void) switch (gSpecialVar_0x8004) { - case SCROLL_MULTI_NONE: - task->tMaxItemsOnScreen = 1; - task->tNumItems = 1; - task->tLeft = 1; - task->tTop = 1; - task->tWidth = 1; - task->tHeight = 1; - task->tKeepOpenAfterSelect = FALSE; - task->tTaskId = taskId; - break; - case SCROLL_MULTI_GLASS_WORKSHOP_VENDOR: - task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN - 1; - task->tNumItems = 8; - task->tLeft = 1; - task->tTop = 1; - task->tWidth = 9; - task->tHeight = 10; - task->tKeepOpenAfterSelect = FALSE; - task->tTaskId = taskId; - break; - case SCROLL_MULTI_POKEMON_FAN_CLUB_RATER: - task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; - task->tNumItems = 12; - task->tLeft = 1; - task->tTop = 1; - task->tWidth = 7; - task->tHeight = 12; - task->tKeepOpenAfterSelect = FALSE; - task->tTaskId = taskId; - break; - case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1: - task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; - task->tNumItems = 11; - task->tLeft = 14; - task->tTop = 1; - task->tWidth = 15; - task->tHeight = 12; - task->tKeepOpenAfterSelect = FALSE; - task->tTaskId = taskId; - break; - case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2: - task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; - task->tNumItems = 6; - task->tLeft = 14; - task->tTop = 1; - task->tWidth = 15; - task->tHeight = 12; - task->tKeepOpenAfterSelect = FALSE; - task->tTaskId = taskId; - break; - case SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR: - task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; - task->tNumItems = 7; - task->tLeft = 14; - task->tTop = 1; - task->tWidth = 15; - task->tHeight = 12; - task->tKeepOpenAfterSelect = FALSE; - task->tTaskId = taskId; - break; - case SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR: - task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; - task->tNumItems = 10; - task->tLeft = 14; - task->tTop = 1; - task->tWidth = 15; - task->tHeight = 12; - task->tKeepOpenAfterSelect = FALSE; - task->tTaskId = taskId; - break; - case SCROLL_MULTI_BERRY_POWDER_VENDOR: - task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; - task->tNumItems = 12; - task->tLeft = 15; - task->tTop = 1; - task->tWidth = 14; - task->tHeight = 12; - task->tKeepOpenAfterSelect = FALSE; - task->tTaskId = taskId; - break; - case SCROLL_MULTI_BF_RECEPTIONIST: - task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; - task->tNumItems = 10; - task->tLeft = 17; - task->tTop = 1; - task->tWidth = 11; - task->tHeight = 12; - task->tKeepOpenAfterSelect = FALSE; - task->tTaskId = taskId; - break; - case SCROLL_MULTI_BF_MOVE_TUTOR_1: - case SCROLL_MULTI_BF_MOVE_TUTOR_2: - task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; - task->tNumItems = 11; - task->tLeft = 15; - task->tTop = 1; - task->tWidth = 14; - task->tHeight = 12; - task->tKeepOpenAfterSelect = FALSE; - task->tTaskId = taskId; - break; - case SCROLL_MULTI_SS_TIDAL_DESTINATION: - task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; - task->tNumItems = 7; - task->tLeft = 19; - task->tTop = 1; - task->tWidth = 10; - task->tHeight = 12; - task->tKeepOpenAfterSelect = FALSE; - task->tTaskId = taskId; - break; - case SCROLL_MULTI_BATTLE_TENT_RULES: - task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; - task->tNumItems = 7; - task->tLeft = 17; - task->tTop = 1; - task->tWidth = 12; - task->tHeight = 12; - task->tKeepOpenAfterSelect = FALSE; - task->tTaskId = taskId; - break; - default: - gSpecialVar_Result = MULTI_B_PRESSED; - DestroyTask(taskId); - break; + case SCROLL_MULTI_NONE: + task->tMaxItemsOnScreen = 1; + task->tNumItems = 1; + task->tLeft = 1; + task->tTop = 1; + task->tWidth = 1; + task->tHeight = 1; + task->tKeepOpenAfterSelect = FALSE; + task->tTaskId = taskId; + break; + case SCROLL_MULTI_GLASS_WORKSHOP_VENDOR: + task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN - 1; + task->tNumItems = 8; + task->tLeft = 1; + task->tTop = 1; + task->tWidth = 9; + task->tHeight = 10; + task->tKeepOpenAfterSelect = FALSE; + task->tTaskId = taskId; + break; + case SCROLL_MULTI_POKEMON_FAN_CLUB_RATER: + task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; + task->tNumItems = 12; + task->tLeft = 1; + task->tTop = 1; + task->tWidth = 7; + task->tHeight = 12; + task->tKeepOpenAfterSelect = FALSE; + task->tTaskId = taskId; + break; + case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1: + task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; + task->tNumItems = 11; + task->tLeft = 14; + task->tTop = 1; + task->tWidth = 15; + task->tHeight = 12; + task->tKeepOpenAfterSelect = FALSE; + task->tTaskId = taskId; + break; + case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2: + task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; + task->tNumItems = 6; + task->tLeft = 14; + task->tTop = 1; + task->tWidth = 15; + task->tHeight = 12; + task->tKeepOpenAfterSelect = FALSE; + task->tTaskId = taskId; + break; + case SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR: + task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; + task->tNumItems = 7; + task->tLeft = 14; + task->tTop = 1; + task->tWidth = 15; + task->tHeight = 12; + task->tKeepOpenAfterSelect = FALSE; + task->tTaskId = taskId; + break; + case SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR: + task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; + task->tNumItems = 10; + task->tLeft = 14; + task->tTop = 1; + task->tWidth = 15; + task->tHeight = 12; + task->tKeepOpenAfterSelect = FALSE; + task->tTaskId = taskId; + break; + case SCROLL_MULTI_BERRY_POWDER_VENDOR: + task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; + task->tNumItems = 12; + task->tLeft = 15; + task->tTop = 1; + task->tWidth = 14; + task->tHeight = 12; + task->tKeepOpenAfterSelect = FALSE; + task->tTaskId = taskId; + break; + case SCROLL_MULTI_BF_RECEPTIONIST: + task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; + task->tNumItems = 10; + task->tLeft = 17; + task->tTop = 1; + task->tWidth = 11; + task->tHeight = 12; + task->tKeepOpenAfterSelect = FALSE; + task->tTaskId = taskId; + break; + case SCROLL_MULTI_BF_MOVE_TUTOR_1: + case SCROLL_MULTI_BF_MOVE_TUTOR_2: + task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; + task->tNumItems = 11; + task->tLeft = 15; + task->tTop = 1; + task->tWidth = 14; + task->tHeight = 12; + task->tKeepOpenAfterSelect = FALSE; + task->tTaskId = taskId; + break; + case SCROLL_MULTI_SS_TIDAL_DESTINATION: + task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; + task->tNumItems = 7; + task->tLeft = 19; + task->tTop = 1; + task->tWidth = 10; + task->tHeight = 12; + task->tKeepOpenAfterSelect = FALSE; + task->tTaskId = taskId; + break; + case SCROLL_MULTI_BATTLE_TENT_RULES: + task->tMaxItemsOnScreen = MAX_SCROLL_MULTI_ON_SCREEN; + task->tNumItems = 7; + task->tLeft = 17; + task->tTop = 1; + task->tWidth = 12; + task->tHeight = 12; + task->tKeepOpenAfterSelect = FALSE; + task->tTaskId = taskId; + break; + default: + gSpecialVar_Result = MULTI_B_PRESSED; + DestroyTask(taskId); + break; } } @@ -2627,13 +2507,9 @@ static void Task_ShowScrollableMultichoice(u8 taskId) { int adjustedLeft = MAX_MULTICHOICE_WIDTH + 1 - task->tWidth; if (adjustedLeft < 0) - { task->tLeft = 0; - } else - { task->tLeft = adjustedLeft; - } } template = CreateWindowTemplate(0, task->tLeft, task->tTop, task->tWidth, task->tHeight, 0xF, 0x64); @@ -2713,13 +2589,14 @@ static void ScrollableMultichoice_ProcessInput(u8 taskId) { CloseScrollableMultichoice(taskId); } - // if selected option was the last one (Exit) else if (input == task->tNumItems - 1) { + // if selected option was the last one (Exit) CloseScrollableMultichoice(taskId); } - else // Handle selection while keeping the menu open + else { + // Handle selection while keeping the menu open ScrollableMultichoice_RemoveScrollArrows(taskId); task->func = Task_ScrollableMultichoice_WaitReturnToList; EnableBothScriptContexts(); @@ -2828,13 +2705,9 @@ void SetBattleTowerLinkPlayerGfx(void) for (i = 0; i < 2; i++) { if (gLinkPlayers[i].gender == MALE) - { VarSet(VAR_OBJ_GFX_ID_F - i, OBJ_EVENT_GFX_BRENDAN_NORMAL); - } else - { VarSet(VAR_OBJ_GFX_ID_F - i, OBJ_EVENT_GFX_RIVAL_MAY_NORMAL); - } } } @@ -2871,9 +2744,7 @@ void ShowNatureGirlMessage(void) u8 nature; if (gSpecialVar_0x8004 >= PARTY_SIZE) - { gSpecialVar_0x8004 = 0; - } nature = GetNature(&gPlayerParty[gSpecialVar_0x8004]); ShowFieldMessage(sNatureGirlMessages[nature]); @@ -2957,13 +2828,9 @@ void FrontierGamblerSetWonOrLost(bool8 won) if (sFrontierChallenges[challenge] == FRONTIER_CHALLENGE(frontierFacilityId, battleMode)) { if (won) - { VarSet(VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_WON); - } else - { VarSet(VAR_FRONTIER_GAMBLER_STATE, FRONTIER_GAMBLER_LOST); - } } } } @@ -2979,7 +2846,8 @@ void UpdateBattlePointsWindow(void) void ShowBattlePointsWindow(void) { - static const struct WindowTemplate sBattlePoints_WindowTemplate = { + static const struct WindowTemplate sBattlePoints_WindowTemplate = + { .bg = 0, .tilemapLeft = 1, .tilemapTop = 1, @@ -3024,7 +2892,8 @@ u16 GetFrontierBattlePoints(void) void ShowFrontierExchangeCornerItemIconWindow(void) { - static const struct WindowTemplate sFrontierExchangeCorner_ItemIconWindowTemplate = { + static const struct WindowTemplate sFrontierExchangeCorner_ItemIconWindowTemplate = + { .bg = 0, .tilemapLeft = 2, .tilemapTop = 9, @@ -3056,40 +2925,40 @@ static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection) FillWindowPixelRect(0, PIXEL_FILL(1), 0, 0, 216, 32); switch (menu) { - case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1: - AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_Decor1Descriptions[selection], 0, NULL, 2, 1, 3); - if (sFrontierExchangeCorner_Decor1[selection] == 0xFFFF) - { - ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Decor1[selection]); - } - else - { - FreeSpriteTilesByTag(TAG_ITEM_ICON); - FreeSpritePaletteByTag(TAG_ITEM_ICON); - sScrollableMultichoice_ItemSpriteId = AddDecorationIconObject(sFrontierExchangeCorner_Decor1[selection], 33, 88, 0, TAG_ITEM_ICON, TAG_ITEM_ICON); - } - break; - case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2: - AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_Decor2Descriptions[selection], 0, NULL, 2, 1, 3); - if (sFrontierExchangeCorner_Decor2[selection] == 0xFFFF) - { - ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Decor2[selection]); - } - else - { - FreeSpriteTilesByTag(TAG_ITEM_ICON); - FreeSpritePaletteByTag(TAG_ITEM_ICON); - sScrollableMultichoice_ItemSpriteId = AddDecorationIconObject(sFrontierExchangeCorner_Decor2[selection], 33, 88, 0, TAG_ITEM_ICON, TAG_ITEM_ICON); - } - break; - case SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR: - AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_VitaminsDescriptions[selection], 0, NULL, 2, 1, 3); - ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Vitamins[selection]); - break; - case SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR: - AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_HoldItemsDescriptions[selection], 0, NULL, 2, 1, 3); - ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_HoldItems[selection]); - break; + case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1: + AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_Decor1Descriptions[selection], 0, NULL, 2, 1, 3); + if (sFrontierExchangeCorner_Decor1[selection] == 0xFFFF) + { + ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Decor1[selection]); + } + else + { + FreeSpriteTilesByTag(TAG_ITEM_ICON); + FreeSpritePaletteByTag(TAG_ITEM_ICON); + sScrollableMultichoice_ItemSpriteId = AddDecorationIconObject(sFrontierExchangeCorner_Decor1[selection], 33, 88, 0, TAG_ITEM_ICON, TAG_ITEM_ICON); + } + break; + case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2: + AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_Decor2Descriptions[selection], 0, NULL, 2, 1, 3); + if (sFrontierExchangeCorner_Decor2[selection] == 0xFFFF) + { + ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Decor2[selection]); + } + else + { + FreeSpriteTilesByTag(TAG_ITEM_ICON); + FreeSpritePaletteByTag(TAG_ITEM_ICON); + sScrollableMultichoice_ItemSpriteId = AddDecorationIconObject(sFrontierExchangeCorner_Decor2[selection], 33, 88, 0, TAG_ITEM_ICON, TAG_ITEM_ICON); + } + break; + case SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR: + AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_VitaminsDescriptions[selection], 0, NULL, 2, 1, 3); + ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Vitamins[selection]); + break; + case SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR: + AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_HoldItemsDescriptions[selection], 0, NULL, 2, 1, 3); + ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_HoldItems[selection]); + break; } } } @@ -3114,12 +2983,12 @@ static void HideFrontierExchangeCornerItemIcon(u16 menu, u16 unused) { switch (menu) { - case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1: - case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2: - case SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR: - case SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR: - DestroySpriteAndFreeResources(&gSprites[sScrollableMultichoice_ItemSpriteId]); - break; + case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1: + case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2: + case SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR: + case SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR: + DestroySpriteAndFreeResources(&gSprites[sScrollableMultichoice_ItemSpriteId]); + break; } sScrollableMultichoice_ItemSpriteId = MAX_SPRITES; } @@ -3156,13 +3025,9 @@ static const u16 sBattleFrontier_TutorMoves2[] = void BufferBattleFrontierTutorMoveName(void) { if (gSpecialVar_0x8005 != 0) - { StringCopy(gStringVar1, gMoveNames[sBattleFrontier_TutorMoves2[gSpecialVar_0x8004]]); - } else - { StringCopy(gStringVar1, gMoveNames[sBattleFrontier_TutorMoves1[gSpecialVar_0x8004]]); - } } static void ShowBattleFrontierTutorWindow(u8 menu, u16 selection) @@ -3225,13 +3090,9 @@ static void ShowBattleFrontierTutorMoveDescription(u8 menu, u16 selection) { FillWindowPixelRect(sTutorMoveAndElevatorWindowId, PIXEL_FILL(1), 0, 0, 96, 48); if (menu == SCROLL_MULTI_BF_MOVE_TUTOR_2) - { AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, sBattleFrontier_TutorMoveDescriptions2[selection], 0, 1, 0, NULL); - } else - { AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, sBattleFrontier_TutorMoveDescriptions1[selection], 0, 1, 0, NULL); - } } } @@ -3453,13 +3314,9 @@ void IncrementBirthIslandRockStepCount(void) { var++; if (var > 99) - { VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, 0); - } else - { VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, var); - } } } @@ -3505,18 +3362,14 @@ bool8 IsDestinationBoxFull(void) if (GetBoxMonData(GetBoxedMonPtr(box, i), MON_DATA_SPECIES, 0) == SPECIES_NONE) { if (GetPCBoxToSendMon() != box) - { FlagClear(FLAG_SHOWN_BOX_WAS_FULL_MESSAGE); - } VarSet(VAR_PC_BOX_TO_SEND_MON, box); return ShouldShowBoxWasFullMessage(); } } if (++box == TOTAL_BOXES_COUNT) - { box = 0; - } } while (box != StorageGetCurrentBox()); return FALSE; } @@ -3582,7 +3435,8 @@ bool32 GetAbnormalWeatherMapNameAndType(void) bool8 AbnormalWeatherHasExpired(void) { // Duplicate array. - static const u8 sAbnormalWeatherMapNumbers[] = { + static const u8 sAbnormalWeatherMapNumbers[] = + { MAP_NUM(ROUTE114), MAP_NUM(ROUTE114), MAP_NUM(ROUTE115), @@ -3605,9 +3459,7 @@ bool8 AbnormalWeatherHasExpired(void) u16 abnormalWeather = VarGet(VAR_ABNORMAL_WEATHER_LOCATION); if (abnormalWeather == ABNORMAL_WEATHER_NONE) - { return FALSE; - } if (++steps > 999) { @@ -3616,15 +3468,15 @@ bool8 AbnormalWeatherHasExpired(void) { switch (gSaveBlock1Ptr->location.mapNum) { - case MAP_NUM(UNDERWATER_MARINE_CAVE): - case MAP_NUM(MARINE_CAVE_ENTRANCE): - case MAP_NUM(MARINE_CAVE_END): - case MAP_NUM(TERRA_CAVE_ENTRANCE): - case MAP_NUM(TERRA_CAVE_END): - VarSet(VAR_SHOULD_END_ABNORMAL_WEATHER, 1); - return FALSE; - default: - break; + case MAP_NUM(UNDERWATER_MARINE_CAVE): + case MAP_NUM(MARINE_CAVE_ENTRANCE): + case MAP_NUM(MARINE_CAVE_END): + case MAP_NUM(TERRA_CAVE_ENTRANCE): + case MAP_NUM(TERRA_CAVE_END): + VarSet(VAR_SHOULD_END_ABNORMAL_WEATHER, 1); + return FALSE; + default: + break; } } @@ -3632,14 +3484,14 @@ bool8 AbnormalWeatherHasExpired(void) { switch (gSaveBlock1Ptr->location.mapNum) { - case MAP_NUM(UNDERWATER_ROUTE127): - case MAP_NUM(UNDERWATER_ROUTE129): - case MAP_NUM(UNDERWATER_ROUTE105): - case MAP_NUM(UNDERWATER_ROUTE125): - VarSet(VAR_SHOULD_END_ABNORMAL_WEATHER, 1); - return FALSE; - default: - break; + case MAP_NUM(UNDERWATER_ROUTE127): + case MAP_NUM(UNDERWATER_ROUTE129): + case MAP_NUM(UNDERWATER_ROUTE105): + case MAP_NUM(UNDERWATER_ROUTE125): + VarSet(VAR_SHOULD_END_ABNORMAL_WEATHER, 1); + return FALSE; + default: + break; } } @@ -3691,9 +3543,7 @@ u32 GetMartEmployeeObjectEventId(void) if (gSaveBlock1Ptr->location.mapGroup == sPokeMarts[i][0]) { if (gSaveBlock1Ptr->location.mapNum == sPokeMarts[i][1]) - { return sPokeMarts[i][2]; - } } } return 1; @@ -3748,9 +3598,7 @@ static void Task_LinkRetireStatusWithBattleTowerPartner(u8 taskId) { case 0: if (!FuncIsActiveTask(Task_ReconnectWithLinkPlayers)) - { gTasks[taskId].tState++; - } break; case 1: if (IsLinkTaskFinished() == TRUE) @@ -3781,23 +3629,15 @@ static void Task_LinkRetireStatusWithBattleTowerPartner(u8 taskId) if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_RETIRE && gSpecialVar_0x8005 == BATTLE_TOWER_LINK_RETIRE) - { gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_BOTH_RETIRE; - } else if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_CONTINUE && gSpecialVar_0x8005 == BATTLE_TOWER_LINK_RETIRE) - { gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_MEMBER_RETIRE; - } else if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_RETIRE && gSpecialVar_0x8005 == BATTLE_TOWER_LINK_CONTINUE) - { gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_LEADER_RETIRE; - } else - { gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_CONTINUE; - } } gTasks[taskId].tState++; } @@ -3912,9 +3752,7 @@ static void Task_LoopWingFlapSE(u8 taskId) } if (playCount == gSpecialVar_0x8004 - 1) - { DestroyTask(taskId); - } } #undef playCount @@ -3976,9 +3814,7 @@ void GetBattlePyramidHint(void) void ResetHealLocationFromDewford(void) { if (gSaveBlock1Ptr->lastHealLocation.mapGroup == MAP_GROUP(DEWFORD_TOWN) && gSaveBlock1Ptr->lastHealLocation.mapNum == MAP_NUM(DEWFORD_TOWN)) - { SetLastHealLocationWarp(HEAL_LOCATION_PETALBURG_CITY); - } } bool8 InPokemonCenter(void) @@ -4015,9 +3851,7 @@ bool8 InPokemonCenter(void) for (i = 0; sPokemonCenters[i] != 0xFFFF; i++) { if (sPokemonCenters[i] == map) - { return TRUE; - } } return FALSE; } @@ -4192,9 +4026,7 @@ static u16 PlayerLoseRandomTrainerFan(void) u8 idx = 0; if (GetNumFansOfPlayerInTrainerFanClub() == 1) - { return 0; - } for (i = 0; i < ARRAY_COUNT(sFanClubMemberIds); i++) { @@ -4210,9 +4042,7 @@ static u16 PlayerLoseRandomTrainerFan(void) } if (GET_TRAINER_FAN_CLUB_FLAG(sFanClubMemberIds[idx])) - { FLIP_TRAINER_FAN_CLUB_FLAG(sFanClubMemberIds[idx]); - } return idx; } @@ -4277,32 +4107,32 @@ void BufferFanClubTrainerName(void) u8 whichNPCTrainer = 0; switch (gSpecialVar_0x8004) { - case FANCLUB_MEMBER1: - break; - case FANCLUB_MEMBER2: - break; - case FANCLUB_MEMBER3: - whichLinkTrainer = 0; - whichNPCTrainer = 3; - break; - case FANCLUB_MEMBER4: - whichLinkTrainer = 0; - whichNPCTrainer = 1; - break; - case FANCLUB_MEMBER5: - whichLinkTrainer = 1; - whichNPCTrainer = 0; - break; - case FANCLUB_MEMBER6: - whichLinkTrainer = 0; - whichNPCTrainer = 4; - break; - case FANCLUB_MEMBER7: - whichLinkTrainer = 1; - whichNPCTrainer = 5; - break; - case FANCLUB_MEMBER8: - break; + case FANCLUB_MEMBER1: + break; + case FANCLUB_MEMBER2: + break; + case FANCLUB_MEMBER3: + whichLinkTrainer = 0; + whichNPCTrainer = 3; + break; + case FANCLUB_MEMBER4: + whichLinkTrainer = 0; + whichNPCTrainer = 1; + break; + case FANCLUB_MEMBER5: + whichLinkTrainer = 1; + whichNPCTrainer = 0; + break; + case FANCLUB_MEMBER6: + whichLinkTrainer = 0; + whichNPCTrainer = 4; + break; + case FANCLUB_MEMBER7: + whichLinkTrainer = 1; + whichNPCTrainer = 5; + break; + case FANCLUB_MEMBER8: + break; } BufferFanClubTrainerName_(&gSaveBlock1Ptr->linkBattleRecords, whichLinkTrainer, whichNPCTrainer); } @@ -4314,27 +4144,27 @@ static void BufferFanClubTrainerName_(struct LinkBattleRecords *linkRecords, u8 { switch (whichNPCTrainer) { - case 0: - StringCopy(gStringVar1, gText_Wallace); - break; - case 1: - StringCopy(gStringVar1, gText_Steven); - break; - case 2: - StringCopy(gStringVar1, gText_Brawly); - break; - case 3: - StringCopy(gStringVar1, gText_Winona); - break; - case 4: - StringCopy(gStringVar1, gText_Phoebe); - break; - case 5: - StringCopy(gStringVar1, gText_Glacia); - break; - default: - StringCopy(gStringVar1, gText_Wallace); - break; + case 0: + StringCopy(gStringVar1, gText_Wallace); + break; + case 1: + StringCopy(gStringVar1, gText_Steven); + break; + case 2: + StringCopy(gStringVar1, gText_Brawly); + break; + case 3: + StringCopy(gStringVar1, gText_Winona); + break; + case 4: + StringCopy(gStringVar1, gText_Phoebe); + break; + case 5: + StringCopy(gStringVar1, gText_Glacia); + break; + default: + StringCopy(gStringVar1, gText_Wallace); + break; } } else