diff --git a/asm/macros/scrcmd.inc b/asm/macros/scrcmd.inc index 17a9908fae..3648bc40b3 100644 --- a/asm/macros/scrcmd.inc +++ b/asm/macros/scrcmd.inc @@ -1,5 +1,6 @@ .include "macros/movement.inc" .include "consts/badges.inc" + .include "consts/catching_show.inc" .include "consts/game_records.inc" .include "consts/items.inc" .include "consts/journal.inc" @@ -3250,10 +3251,10 @@ .short 597 .endm - .macro ScrCmd_256 arg0, arg1 + .macro CalcCatchingShowPoints pointsCategory, destVarID .short 598 - .short \arg0 - .short \arg1 + .short \pointsCategory + .short \destVarID .endm .macro ScrCmd_257 @@ -3370,9 +3371,9 @@ .short \arg0 .endm - .macro ScrCmd_26E arg0 + .macro GetGBACartridgeVersion destVarID .short 622 - .short \arg0 + .short \destVarID .endm .macro ScrCmd_26F diff --git a/consts/catching_show.json b/consts/catching_show.json new file mode 100644 index 0000000000..7562d99103 --- /dev/null +++ b/consts/catching_show.json @@ -0,0 +1,13 @@ +{ + "definitions": { + "@CatchingShowPointsCategory": { + "type": "enum", + "values": [ + "CATCHING_SHOW_CATCHING_POINTS", + "CATCHING_SHOW_TIME_POINTS", + "CATCHING_SHOW_TYPE_POINTS", + "CATCHING_SHOW_TOTAL_POINTS" + ] + } + } +} diff --git a/consts/game_records.json b/consts/game_records.json index 319f7b107a..afe6a2f442 100644 --- a/consts/game_records.json +++ b/consts/game_records.json @@ -174,7 +174,7 @@ "TRAINER_SCORE_EVENT_UNK_14", "TRAINER_SCORE_EVENT_UNK_15", "TRAINER_SCORE_EVENT_UNK_16", - "TRAINER_SCORE_EVENT_UNK_17", + "TRAINER_SCORE_EVENT_FINISHED_CATCHING_SHOW", "TRAINER_SCORE_EVENT_UNK_18", "TRAINER_SCORE_EVENT_UNK_19", "TRAINER_SCORE_EVENT_UNK_20", diff --git a/consts/meson.build b/consts/meson.build index 3208eb44ce..45a34107e8 100644 --- a/consts/meson.build +++ b/consts/meson.build @@ -4,6 +4,7 @@ consts_manifest_basenames = [ 'battle', 'battle_subscripts', 'btlcmd', + 'catching_show', 'game_records', 'gender', 'items', diff --git a/include/catching_show.h b/include/catching_show.h new file mode 100644 index 0000000000..2d9fb96d33 --- /dev/null +++ b/include/catching_show.h @@ -0,0 +1,38 @@ +#ifndef POKEPLATINUM_CATCHING_SHOW_H +#define POKEPLATINUM_CATCHING_SHOW_H + +#include "field/field_system_decl.h" + +#include "field_battle_data_transfer.h" + +#define CATCHING_SHOW_MONS 6 + +typedef struct CatchingShowPokemon { + u16 species; + u8 area; + u8 rarity; + u16 catchingPoints; + u8 type1; + u8 type2; +} CatchingShowPokemon; + +typedef struct CatchingShow { + CatchingShowPokemon pokemon[CATCHING_SHOW_MONS]; + u8 caughtMonsOrder[CATCHING_SHOW_MONS]; + int steps; + int currentEncounterIndex; + s64 startTime; + int timePoints; +} CatchingShow; + +void CatchingShow_Start(FieldSystem *fieldSystem); +void CatchingShow_End(FieldSystem *fieldSystem); +BOOL CatchingShow_CheckWildEncounter(FieldSystem *fieldSystem, int playerX, int playerY); +FieldBattleDTO *CatchingShow_GetBattleDTO(FieldSystem *fieldSystem); +void CatchingShow_UpdateBattleResult(FieldSystem *fieldSystem, FieldBattleDTO *dto); +int CatchingShow_GetParkBallCount(FieldSystem *fieldSystem); +int CatchingShow_CalcCatchingPoints(FieldSystem *fieldSystem); +int CatchingShow_GetTimePoints(FieldSystem *fieldSystem); +int CatchingShow_GetTypePoints(FieldSystem *fieldSystem); + +#endif // POKEPLATINUM_CATCHING_SHOW_H diff --git a/include/core_sys.h b/include/core_sys.h index 68823ff51a..e867946a39 100644 --- a/include/core_sys.h +++ b/include/core_sys.h @@ -49,7 +49,7 @@ typedef struct CoreSys { u16 touchHeld; u8 unk_64; u8 unk_65; - u8 unk_66; + u8 gbaCartridgeVersion; u8 inhibitSleep; u8 inhibitReset; u8 padding_69[3]; diff --git a/include/struct_decls/struct_020564B4_decl.h b/include/struct_decls/struct_020564B4_decl.h deleted file mode 100644 index c59459fe00..0000000000 --- a/include/struct_decls/struct_020564B4_decl.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_020564B4_DECL_H -#define POKEPLATINUM_STRUCT_020564B4_DECL_H - -typedef struct UnkStruct_020564B4_t UnkStruct_020564B4; - -#endif // POKEPLATINUM_STRUCT_020564B4_DECL_H diff --git a/include/unk_02017728.h b/include/unk_02017728.h index ca0b43068a..904f4fffbc 100644 --- a/include/unk_02017728.h +++ b/include/unk_02017728.h @@ -13,7 +13,7 @@ void *ReadFileToHeap(int heapID, const char *filename); void ReadFileToBuffer(const char *filename, void **buf); void sub_02017ACC(void); void InitKeypadAndTouchpad(void); -void sub_02017B70(int param0); +void SetGBACartridgeVersion(int version); void SleepLock(u8 param0); void SleepUnlock(u8 param0); void ReadKeypadAndTouchpad(void); diff --git a/include/unk_0204C500.h b/include/unk_0204C500.h index 6f8db0d795..38b3785b74 100644 --- a/include/unk_0204C500.h +++ b/include/unk_0204C500.h @@ -6,6 +6,6 @@ BOOL ScrCmd_253(ScriptContext *param0); BOOL ScrCmd_254(ScriptContext *param0); BOOL ScrCmd_255(ScriptContext *param0); -BOOL ScrCmd_256(ScriptContext *param0); +BOOL ScrCmd_CalcCatchingShowPoints(ScriptContext *ctx); #endif // POKEPLATINUM_UNK_0204C500_H diff --git a/include/unk_020562F8.h b/include/unk_020562F8.h deleted file mode 100644 index 394e1b0cef..0000000000 --- a/include/unk_020562F8.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef POKEPLATINUM_UNK_020562F8_H -#define POKEPLATINUM_UNK_020562F8_H - -#include "field/field_system_decl.h" - -#include "field_battle_data_transfer.h" - -void sub_020562F8(FieldSystem *fieldSystem); -void sub_02056328(FieldSystem *fieldSystem); -BOOL sub_02056374(FieldSystem *fieldSystem, int param1, int param2); -FieldBattleDTO *sub_0205639C(FieldSystem *fieldSystem); -void sub_020563AC(FieldSystem *fieldSystem, FieldBattleDTO *param1); -int sub_020563BC(FieldSystem *fieldSystem); -int sub_020563D0(FieldSystem *fieldSystem); -int sub_020563E0(FieldSystem *fieldSystem); -int sub_020563F0(FieldSystem *fieldSystem); - -#endif // POKEPLATINUM_UNK_020562F8_H diff --git a/platinum.us/main.lsf b/platinum.us/main.lsf index 02923a4ffa..bc91520794 100644 --- a/platinum.us/main.lsf +++ b/platinum.us/main.lsf @@ -232,7 +232,7 @@ Static main Object main.nef.p/src_field_transition.c.o Object main.nef.p/src_unk_020559DC.c.o Object main.nef.p/src_unk_02055C50.c.o - Object main.nef.p/src_unk_020562F8.c.o + Object main.nef.p/src_catching_show.c.o Object main.nef.p/src_poketch_data.c.o Object main.nef.p/src_unk_02056B30.c.o Object main.nef.p/src_unk_020573FC.c.o diff --git a/res/field/scripts/scripts_pal_park_lobby.s b/res/field/scripts/scripts_pal_park_lobby.s index b4ae5519cf..e27db40495 100644 --- a/res/field/scripts/scripts_pal_park_lobby.s +++ b/res/field/scripts/scripts_pal_park_lobby.s @@ -213,16 +213,16 @@ _02F8: SetVar 0x40F3, 0 ApplyMovement 0xFF, _03EC WaitMovement - ScrCmd_256 0, 0x800C + CalcCatchingShowPoints CATCHING_SHOW_CATCHING_POINTS, 0x800C BufferNumber 0, 0x800C - ScrCmd_256 1, 0x800C + CalcCatchingShowPoints CATCHING_SHOW_TIME_POINTS, 0x800C BufferNumber 1, 0x800C - ScrCmd_256 2, 0x800C + CalcCatchingShowPoints CATCHING_SHOW_TYPE_POINTS, 0x800C BufferNumber 2, 0x800C - ScrCmd_256 3, 0x800C + CalcCatchingShowPoints CATCHING_SHOW_TOTAL_POINTS, 0x800C BufferNumber 3, 0x800C Message 38 - ScrCmd_256 3, 0x800C + CalcCatchingShowPoints CATCHING_SHOW_TOTAL_POINTS, 0x800C GoToIfGt 0x800C, 0x40E0, _035B Message 40 Call _07BE @@ -231,7 +231,7 @@ _02F8: _035B: Message 39 Call _07BE - ScrCmd_256 3, 0x40E0 + CalcCatchingShowPoints CATCHING_SHOW_TOTAL_POINTS, 0x40E0 GoTo _0370 _0370: @@ -507,7 +507,7 @@ _0662: LockAll FacePlayer GoToIfEq 0x4009, 1, _06CF - ScrCmd_26E 0x800C + GetGBACartridgeVersion 0x800C GoToIfEq 0x800C, 4, _06DA GoToIfEq 0x800C, 5, _0706 GoToIfEq 0x800C, 1, _0732 @@ -587,7 +587,7 @@ _07AE: End _07BE: - ScrCmd_256 3, 0x800C + CalcCatchingShowPoints CATCHING_SHOW_TOTAL_POINTS, 0x800C CallIfLt 0x800C, 0xBB8, _07FA CallIfLt 0x800C, 0xCE4, _0870 CallIfLt 0x800C, 0xDAC, _08BF diff --git a/src/catching_show.c b/src/catching_show.c new file mode 100644 index 0000000000..cc254078b5 --- /dev/null +++ b/src/catching_show.c @@ -0,0 +1,337 @@ +#include "catching_show.h" + +#include +#include + +#include "constants/battle.h" +#include "constants/species.h" +#include "consts/game_records.h" + +#include "struct_decls/struct_02024440_decl.h" + +#include "field/field_system.h" +#include "savedata/save_table.h" + +#include "field_battle_data_transfer.h" +#include "game_records.h" +#include "heap.h" +#include "inlines.h" +#include "map_tile_behavior.h" +#include "narc.h" +#include "pokemon.h" +#include "rtc.h" +#include "unk_0202EEC0.h" +#include "unk_02054D00.h" + +#define POINTS_LOST_PER_SECOND 2 +#define WEIGHT_NO_ENCOUNTER 20 +#define DISTINCT_TYPE_BONUS 50 +#define DIFFERENT_TYPE_BONUS 200 +#define MAX_TIME_SECONDS 1000 + +enum PAL_PARK_AREA { + PAL_PARK_AREA_NONE = 0, + PAL_PARK_AREA_LAND_NORTH_WEST, + PAL_PARK_AREA_LAND_NORTH_EAST, + PAL_PARK_AREA_LAND_SOUTH_WEST, + PAL_PARK_AREA_LAND_SOUTH_EAST, + PAL_PARK_AREA_WATER_NORTH_WEST, + PAL_PARK_AREA_WATER_NORTH_EAST, + PAL_PARK_AREA_WATER_SOUTH_WEST, + PAL_PARK_AREA_WATER_SOUTH_EAST, +}; + +static void InitEncounterData(FieldSystem *fieldSystem, CatchingShow *catchingShow); +static void UpdateBattleResultInternal(FieldSystem *fieldSystem, FieldBattleDTO *dto, CatchingShow *catchingShow); +static BOOL TryStartEncounter(FieldSystem *fieldSystem, CatchingShow *catchingShow, int playerX, int playerY); +static FieldBattleDTO *SetupBattleDTO(FieldSystem *fieldSystem, CatchingShow *catchingShow); +static int NumMonsCaptured(CatchingShow *catchingShow); +static void ResetStepCount(CatchingShow *catchingShow); +static BOOL IsStepCountZero(CatchingShow *catchingShow); +static u32 CalculateTypePoints(CatchingShow *catchingShow); +static u32 CalcCatchingPoints(CatchingShow *catchingShow); +static u32 GetTimePoints(CatchingShow *catchingShow); + +static CatchingShow sCatchingShow; + +void CatchingShow_Start(FieldSystem *fieldSystem) +{ + CatchingShow *catchingShow = &sCatchingShow; + + MI_CpuClearFast(catchingShow, sizeof(CatchingShow)); + + InitEncounterData(fieldSystem, catchingShow); + ResetStepCount(catchingShow); + + catchingShow->startTime = GetTimestamp(); +} + +void CatchingShow_End(FieldSystem *fieldSystem) +{ + CatchingShow *catchingShow = &sCatchingShow; + GameRecords *records = SaveData_GetGameRecordsPtr(fieldSystem->saveData); + s64 endTime = GetTimestamp(); + s64 elapsedTime = TimeElapsed(catchingShow->startTime, endTime); + + if (elapsedTime < MAX_TIME_SECONDS) { + catchingShow->timePoints = ((MAX_TIME_SECONDS - elapsedTime) * POINTS_LOST_PER_SECOND); + } else { + catchingShow->timePoints = 0; + } + + GameRecords_IncrementTrainerScore(records, TRAINER_SCORE_EVENT_FINISHED_CATCHING_SHOW); +} + +BOOL CatchingShow_CheckWildEncounter(FieldSystem *fieldSystem, int playerX, int playerY) +{ + if (IsStepCountZero(&sCatchingShow) == TRUE) { + return TryStartEncounter(fieldSystem, &sCatchingShow, playerX, playerY); + } else { + return FALSE; + } +} + +FieldBattleDTO *CatchingShow_GetBattleDTO(FieldSystem *fieldSystem) +{ + return SetupBattleDTO(fieldSystem, &sCatchingShow); +} + +void CatchingShow_UpdateBattleResult(FieldSystem *fieldSystem, FieldBattleDTO *dto) +{ + UpdateBattleResultInternal(fieldSystem, dto, &sCatchingShow); +} + +int CatchingShow_GetParkBallCount(FieldSystem *fieldSystem) +{ + return CATCHING_SHOW_MONS - NumMonsCaptured(&sCatchingShow); +} + +int CatchingShow_CalcCatchingPoints(FieldSystem *fieldSystem) +{ + return CalcCatchingPoints(&sCatchingShow); +} + +int CatchingShow_GetTimePoints(FieldSystem *fieldSystem) +{ + return GetTimePoints(&sCatchingShow); +} + +int CatchingShow_GetTypePoints(FieldSystem *fieldSystem) +{ + return CalculateTypePoints(&sCatchingShow); +} + +static void sub_02056400(u32 species, u8 *param1) +{ + GF_ASSERT(0 < species && species <= NATIONAL_DEX_COUNT); + + int v0 = (species - 1) * 6; + + NARC_ReadFromMemberByIndexPair(param1, NARC_INDEX_ARC__PPARK, 0, v0, sizeof(u8) * 6); +} + +static void InitEncounterData(FieldSystem *fieldSystem, CatchingShow *catchingShow) +{ + int i; + u8 v1[8]; + u16 monSpecies; + PalParkTransfer *v4 = SaveData_PalParkTransfer(fieldSystem->saveData); + Pokemon *mon = Pokemon_New(HEAP_ID_FIELD); + + for (i = 0; i < CATCHING_SHOW_MONS; i++) { + catchingShow->caughtMonsOrder[i] = 0; + sub_0202F000(v4, i, mon); + + monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + + catchingShow->pokemon[i].species = monSpecies; + sub_02056400(monSpecies, v1); + + if (v1[0] != 0) { + catchingShow->pokemon[i].area = v1[0]; + } else { + catchingShow->pokemon[i].area = PAL_PARK_AREA_WATER_NORTH_WEST - 1 + v1[1]; + } + + catchingShow->pokemon[i].rarity = v1[3]; + catchingShow->pokemon[i].catchingPoints = v1[2]; + catchingShow->pokemon[i].type1 = Pokemon_GetValue(mon, MON_DATA_TYPE_1, NULL); + catchingShow->pokemon[i].type2 = Pokemon_GetValue(mon, MON_DATA_TYPE_2, NULL); + } + + Heap_FreeToHeap(mon); +} + +static int NumMonsCaptured(CatchingShow *catchingShow) +{ + int i; + int numMonsCaptured = 0; + + for (i = 0; i < CATCHING_SHOW_MONS; i++) { + if (catchingShow->caughtMonsOrder[i] != 0) { + numMonsCaptured++; + } + } + + return numMonsCaptured; +} + +static void ResetStepCount(CatchingShow *catchingShow) +{ + catchingShow->steps = inline_020564D0(10) + 5; +} + +static BOOL IsStepCountZero(CatchingShow *catchingShow) +{ + catchingShow->steps--; + + if (catchingShow->steps == 0) { + ResetStepCount(catchingShow); + return TRUE; + } + + return FALSE; +} + +static int GetEncounterArea(FieldSystem *fieldSystem, int playerX, int playerY) +{ + u16 tileBehavior = FieldSystem_GetTileBehavior(fieldSystem, playerX, playerY); + int area = (playerX < 32) ? 0 : 1; + area += (playerY < 32) ? 0 : 2; + + if (TileBehavior_IsTallGrass(tileBehavior)) { + return PAL_PARK_AREA_LAND_NORTH_WEST + area; + } else if (TileBehavior_IsSurfable(tileBehavior)) { + return PAL_PARK_AREA_WATER_NORTH_WEST + area; + } + + return PAL_PARK_AREA_NONE; +} + +static BOOL TryStartEncounter(FieldSystem *fieldSystem, CatchingShow *catchingShow, int playerX, int playerY) +{ + int i; + int encounterChance, totalRarity = 0; + int area = GetEncounterArea(fieldSystem, playerX, playerY); + + if (area == PAL_PARK_AREA_NONE) { + return FALSE; + } + + for (i = 0; i < CATCHING_SHOW_MONS; i++) { + if (catchingShow->caughtMonsOrder[i] == 0 && catchingShow->pokemon[i].area == area) { + totalRarity += catchingShow->pokemon[i].rarity; + } + } + + if (totalRarity == 0) { + return FALSE; + } + + encounterChance = inline_020564D0(totalRarity + WEIGHT_NO_ENCOUNTER); + + if (encounterChance < WEIGHT_NO_ENCOUNTER) { + return FALSE; + } + + encounterChance -= WEIGHT_NO_ENCOUNTER; + + for (i = 0; i < CATCHING_SHOW_MONS; i++) { + if (catchingShow->caughtMonsOrder[i] == 0 && catchingShow->pokemon[i].area == area) { + if (encounterChance < catchingShow->pokemon[i].rarity) { + catchingShow->currentEncounterIndex = i; + return TRUE; + } else { + encounterChance -= catchingShow->pokemon[i].rarity; + } + } + } + + GF_ASSERT(FALSE); + return FALSE; +} + +static void UpdateBattleResultInternal(FieldSystem *fieldSystem, FieldBattleDTO *dto, CatchingShow *catchingShow) +{ + switch (dto->resultMask) { + case BATTLE_RESULT_CAPTURED_MON: + catchingShow->caughtMonsOrder[catchingShow->currentEncounterIndex] = NumMonsCaptured(catchingShow) + 1; + break; + case BATTLE_RESULT_PLAYER_FLED: + break; + default: + GF_ASSERT(FALSE); + } +} + +static FieldBattleDTO *SetupBattleDTO(FieldSystem *fieldSystem, CatchingShow *catchingShow) +{ + Pokemon *mon = Pokemon_New(HEAP_ID_FIELD_TASK); + PalParkTransfer *v2 = SaveData_PalParkTransfer(fieldSystem->saveData); + int parkBallCount = CatchingShow_GetParkBallCount(fieldSystem); + FieldBattleDTO *dto = FieldBattleDTO_NewPalPark(HEAP_ID_FIELDMAP, parkBallCount); + + FieldBattleDTO_Init(dto, fieldSystem); + sub_0202F000(v2, catchingShow->currentEncounterIndex, mon); + FieldBattleDTO_AddPokemonToBattler(dto, mon, BATTLER_ENEMY_SLOT_1); + Heap_FreeToHeap(mon); + + return dto; +} + +static u32 CalcCatchingPoints(CatchingShow *catchingShow) +{ + int i; + u32 totalCatchingPoints = 0; + + for (i = 0; i < CATCHING_SHOW_MONS; i++) { + totalCatchingPoints += catchingShow->pokemon[i].catchingPoints; + } + + return totalCatchingPoints; +} + +static u32 CalculateTypePoints(CatchingShow *catchingShow) +{ + int i, j; + int prevMonType1, prevMonType2, currMonType1, currMonType2; + u32 distinctTypeTracker = 0; + u32 totalTypePoints = 0; + + for (i = 1; i < CATCHING_SHOW_MONS + 1; i++) { + for (j = 0; j < CATCHING_SHOW_MONS; j++) { + if (catchingShow->caughtMonsOrder[j] == i) { + currMonType1 = catchingShow->pokemon[j].type1; + currMonType2 = catchingShow->pokemon[j].type2; + + if (i != 1 + && prevMonType1 != currMonType1 + && prevMonType1 != currMonType2 + && prevMonType2 != currMonType1 + && prevMonType2 != currMonType2) { + totalTypePoints += DIFFERENT_TYPE_BONUS; + } + + prevMonType1 = currMonType1; + prevMonType2 = currMonType2; + distinctTypeTracker |= (1 << prevMonType1); + distinctTypeTracker |= (1 << prevMonType2); + + break; + } + } + } + + for (; distinctTypeTracker != 0; distinctTypeTracker >>= 1) { + if (distinctTypeTracker & 1) { + totalTypePoints += DISTINCT_TYPE_BONUS; + } + } + + return totalTypePoints; +} + +static u32 GetTimePoints(CatchingShow *catchingShow) +{ + return catchingShow->timePoints; +} diff --git a/src/encounter.c b/src/encounter.c index a69f082a1f..1a0b746b92 100644 --- a/src/encounter.c +++ b/src/encounter.c @@ -20,6 +20,7 @@ #include "overlay006/ov6_02246034.h" #include "savedata/save_table.h" +#include "catching_show.h" #include "communication_information.h" #include "enc_effects.h" #include "enums.h" @@ -46,7 +47,6 @@ #include "unk_0202F1D4.h" #include "unk_0203D1B8.h" #include "unk_020528D0.h" -#include "unk_020562F8.h" #include "unk_0206AFE0.h" #include "unk_0206CCB0.h" #include "unk_020797C8.h" @@ -618,7 +618,7 @@ static BOOL FieldTask_PalParkEncounter(FieldTask *task) case 3: UpdateFieldSystemFromDTO(encounter->dto, fieldSystem); - sub_020563AC(fieldSystem, encounter->dto); + CatchingShow_UpdateBattleResult(fieldSystem, encounter->dto); UpdateGameRecords(fieldSystem, encounter->dto); (*state)++; break; @@ -637,7 +637,7 @@ static BOOL FieldTask_PalParkEncounter(FieldTask *task) case 6: FreeEncounter(encounter); - if (sub_020563BC(fieldSystem) == 0) { + if (CatchingShow_GetParkBallCount(fieldSystem) == 0) { ScriptManager_Change(task, 3, NULL); return FALSE; } else { diff --git a/src/field_menu.c b/src/field_menu.c index 5f41c335f2..a01c4d614f 100644 --- a/src/field_menu.c +++ b/src/field_menu.c @@ -35,6 +35,7 @@ #include "bag.h" #include "bg_window.h" +#include "catching_show.h" #include "cell_actor.h" #include "field_overworld_state.h" #include "field_system.h" @@ -77,7 +78,6 @@ #include "unk_0203D1B8.h" #include "unk_020553DC.h" #include "unk_020559DC.h" -#include "unk_020562F8.h" #include "unk_0205B33C.h" #include "unk_0205C22C.h" #include "unk_0205F180.h" @@ -691,9 +691,9 @@ static void sub_0203B094(FieldTask *taskMan) StringTemplate_SetNumber(v3, 0, *v7, 2, 0, 1); } else { - int v8 = sub_020563BC(fieldSystem); + int parkBallCount = CatchingShow_GetParkBallCount(fieldSystem); - StringTemplate_SetNumber(v3, 0, v8, 2, 0, 1); + StringTemplate_SetNumber(v3, 0, parkBallCount, 2, 0, 1); } StringTemplate_Format(v3, v4, v5); diff --git a/src/game_records.c b/src/game_records.c index ea26ec9442..c865f7d2a0 100644 --- a/src/game_records.c +++ b/src/game_records.c @@ -273,7 +273,7 @@ static const u16 sTrainerScoreIncrements[MAX_TRAINER_SCORE_EVENTS] = { [TRAINER_SCORE_EVENT_UNK_14] = 7, [TRAINER_SCORE_EVENT_UNK_15] = 7, [TRAINER_SCORE_EVENT_UNK_16] = 10, - [TRAINER_SCORE_EVENT_UNK_17] = 10, + [TRAINER_SCORE_EVENT_FINISHED_CATCHING_SHOW] = 10, [TRAINER_SCORE_EVENT_UNK_18] = 11, [TRAINER_SCORE_EVENT_UNK_19] = 11, [TRAINER_SCORE_EVENT_UNK_20] = 11, diff --git a/src/main.c b/src/main.c index 5e55ec2f1b..c59effecf2 100644 --- a/src/main.c +++ b/src/main.c @@ -71,7 +71,7 @@ void NitroMain(void) InitGraphics(); InitKeypadAndTouchpad(); - sub_02017B70(0); + SetGBACartridgeVersion(NULL); PM_GetBackLight(&sSavedBacklightState, NULL); sub_0202419C(); InitRTC(); @@ -339,7 +339,7 @@ void HandleConsoleFold(void) sleep_again: trigger = PM_TRIGGER_COVER_OPEN | PM_TRIGGER_CARD; - if (gCoreSys.unk_66 && !gIgnoreCartridgeForWake) { + if (gCoreSys.gbaCartridgeVersion && !gIgnoreCartridgeForWake) { trigger |= PM_TRIGGER_CARTRIDGE; } diff --git a/src/meson.build b/src/meson.build index 48bae14f15..7df5287087 100644 --- a/src/meson.build +++ b/src/meson.build @@ -220,7 +220,7 @@ pokeplatinum_c = files( 'field_transition.c', 'unk_020559DC.c', 'unk_02055C50.c', - 'unk_020562F8.c', + 'catching_show.c', 'poketch_data.c', 'unk_02056B30.c', 'unk_020573FC.c', diff --git a/src/overlay005/field_control.c b/src/overlay005/field_control.c index 608138404e..b4201a296d 100644 --- a/src/overlay005/field_control.c +++ b/src/overlay005/field_control.c @@ -29,6 +29,7 @@ #include "overlay009/ov9_02249960.h" #include "overlay023/ov23_02241F74.h" +#include "catching_show.h" #include "comm_player_manager.h" #include "communication_information.h" #include "communication_system.h" @@ -60,7 +61,6 @@ #include "unk_0203C954.h" #include "unk_02054884.h" #include "unk_02054D00.h" -#include "unk_020562F8.h" #include "unk_02056B30.h" #include "unk_0205A0D8.h" #include "unk_0205B33C.h" @@ -548,8 +548,8 @@ static BOOL Field_CheckWildEncounter(FieldSystem *fieldSystem) Field_GetPlayerPos(fieldSystem, &playerX, &playerZ); if (SystemFlag_CheckInPalPark(SaveData_GetVarsFlags(fieldSystem->saveData)) == TRUE) { - if (sub_02056374(fieldSystem, playerX, playerZ) == TRUE) { - Encounter_NewVsPalParkTransfer(fieldSystem, sub_0205639C(fieldSystem)); + if (CatchingShow_CheckWildEncounter(fieldSystem, playerX, playerZ) == TRUE) { + Encounter_NewVsPalParkTransfer(fieldSystem, CatchingShow_GetBattleDTO(fieldSystem)); return TRUE; } else { return FALSE; diff --git a/src/overlay006/ov6_022477B8.c b/src/overlay006/ov6_022477B8.c index bac84c29dc..01d82181ab 100644 --- a/src/overlay006/ov6_022477B8.c +++ b/src/overlay006/ov6_022477B8.c @@ -13,24 +13,24 @@ void WildEncounters_ReplaceDualSlotEncounters(const WildEncounters *encounterDat return; } - switch (gCoreSys.unk_66) { - case 1: + switch (gCoreSys.gbaCartridgeVersion) { + case SAPPHIRE: (*param2) = encounterData->dualSlotSapphireEncounters[0]; (*param3) = encounterData->dualSlotSapphireEncounters[1]; break; - case 2: + case RUBY: (*param2) = encounterData->dualSlotRubyEncounters[0]; (*param3) = encounterData->dualSlotRubyEncounters[1]; break; - case 3: + case EMERALD: (*param2) = encounterData->dualSlotEmeraldEncouters[0]; (*param3) = encounterData->dualSlotEmeraldEncouters[1]; break; - case 4: + case FIRERED: (*param2) = encounterData->dualSlotFireredEncounters[0]; (*param3) = encounterData->dualSlotFireredEncounters[1]; break; - case 5: + case LEAFGREEN: (*param2) = encounterData->dualSlotLeafgreenEncounters[0]; (*param3) = encounterData->dualSlotLeafgreenEncounters[1]; break; diff --git a/src/overlay097/ov97_0222AE60.c b/src/overlay097/ov97_0222AE60.c index dcc776053e..5f67a91f89 100644 --- a/src/overlay097/ov97_0222AE60.c +++ b/src/overlay097/ov97_0222AE60.c @@ -235,7 +235,7 @@ static void ov97_0222AF1C(UnkStruct_0222AE60 *param0) break; } - sub_02017B70(v0); + SetGBACartridgeVersion(v0); if (PokedexData_IsNationalDexObtained(param0->unk_08) == FALSE) { return; diff --git a/src/overlay097/ov97_0222D30C.c b/src/overlay097/ov97_0222D30C.c index 124b4da21e..fc69e22955 100644 --- a/src/overlay097/ov97_0222D30C.c +++ b/src/overlay097/ov97_0222D30C.c @@ -1096,7 +1096,7 @@ static int ov97_0222E2DC(OverlayManager *param0, int *param1) if (ov97_02237624()) { v0->unk_1638 = 2; - sub_02017B70(gGameVersion); + SetGBACartridgeVersion(gGameVersion); ov97_02238400(1); } @@ -2445,7 +2445,7 @@ static int ov97_022301BC(OverlayManager *param0, int *param1) Heap_Destroy(86); if (v0->unk_1638 == 2) { - sub_02017B70(0); + SetGBACartridgeVersion(NULL); } ov97_02238400(0); diff --git a/src/overlay097/ov97_02233B18.c b/src/overlay097/ov97_02233B18.c index 1e6114eab4..63d1fc3440 100644 --- a/src/overlay097/ov97_02233B18.c +++ b/src/overlay097/ov97_02233B18.c @@ -704,7 +704,7 @@ static void ov97_022343A8(UnkStruct_ov97_02234A2C *param0) v1 = ov97_02234124(param0, param0->unk_E8E4, v0); v2 = ov97_02234148(param0, param0->unk_E8E4, v0); v5 = ov97_0223416C(param0, param0->unk_E8E4, v0); - v3 = gCoreSys.unk_66; + v3 = gCoreSys.gbaCartridgeVersion; v4 = GBASpeciesToDSFormId(ov97_02236DD0(v1), v5, v3); ov97_022342E4(v1, v2, v4, v0, param0->unk_20C[v0].unk_00, v6, v7); @@ -1471,7 +1471,7 @@ static void ov97_02234F88(UnkStruct_ov97_02234A2C *param0) v1 = ov97_02234124(param0, param0->unk_42C[v0].unk_08, param0->unk_42C[v0].unk_04); v2 = ov97_02234148(param0, param0->unk_42C[v0].unk_08, param0->unk_42C[v0].unk_04); v4 = ov97_0223416C(param0, param0->unk_42C[v0].unk_08, param0->unk_42C[v0].unk_04); - v3 = gCoreSys.unk_66; + v3 = gCoreSys.gbaCartridgeVersion; ov97_02234278(v1, v2, v4, v3, v0, param0->unk_478[v0]); } diff --git a/src/overlay097/ov97_02236380.c b/src/overlay097/ov97_02236380.c index 810948f205..3260185e0b 100644 --- a/src/overlay097/ov97_02236380.c +++ b/src/overlay097/ov97_02236380.c @@ -1566,19 +1566,19 @@ void BoxMonGBAToBoxMon(BoxPokemonGBA *param0, BoxPokemon *param1) } if (BoxPokemon_GetValue(param1, MON_DATA_SPECIES, NULL) == SPECIES_DEOXYS) { - switch (gCoreSys.unk_66) { + switch (gCoreSys.gbaCartridgeVersion) { default: - case 2: - case 1: + case RUBY: + case SAPPHIRE: v1 = 0; break; - case 4: + case FIRERED: v1 = 1; break; - case 5: + case LEAFGREEN: v1 = 2; break; - case 3: + case EMERALD: v1 = 3; break; } diff --git a/src/scrcmd.c b/src/scrcmd.c index bce6c79989..130f7b828f 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -649,7 +649,7 @@ static BOOL ScrCmd_269(ScriptContext *ctx); static BOOL ScrCmd_26A(ScriptContext *ctx); static BOOL ScrCmd_26B(ScriptContext *ctx); static BOOL ScrCmd_26C(ScriptContext *ctx); -static BOOL ScrCmd_26E(ScriptContext *ctx); +static BOOL ScrCmd_GetGBACartridgeVersion(ScriptContext *ctx); static BOOL ScrCmd_270(ScriptContext *ctx); static BOOL ScrCmd_273(ScriptContext *ctx); static BOOL ScrCmd_275(ScriptContext *ctx); @@ -1364,7 +1364,7 @@ const ScrCmdFunc Unk_020EAC58[] = { ScrCmd_253, ScrCmd_254, ScrCmd_255, - ScrCmd_256, + ScrCmd_CalcCatchingShowPoints, ScrCmd_257, ScrCmd_258, ScrCmd_259, @@ -1388,7 +1388,7 @@ const ScrCmdFunc Unk_020EAC58[] = { ScrCmd_26B, ScrCmd_26C, ScrCmd_26D, - ScrCmd_26E, + ScrCmd_GetGBACartridgeVersion, ScrCmd_26F, ScrCmd_270, ScrCmd_271, @@ -7061,12 +7061,12 @@ static BOOL ScrCmd_26C(ScriptContext *ctx) return 0; } -static BOOL ScrCmd_26E(ScriptContext *ctx) +static BOOL ScrCmd_GetGBACartridgeVersion(ScriptContext *ctx) { - u16 *v0 = ScriptContext_GetVarPointer(ctx); + u16 *destVar = ScriptContext_GetVarPointer(ctx); - *v0 = gCoreSys.unk_66; - return 1; + *destVar = gCoreSys.gbaCartridgeVersion; + return TRUE; } static BOOL ScrCmd_26F(ScriptContext *ctx) diff --git a/src/unk_02017728.c b/src/unk_02017728.c index 8927d17fd1..549b08c9d1 100644 --- a/src/unk_02017728.c +++ b/src/unk_02017728.c @@ -298,9 +298,9 @@ void InitKeypadAndTouchpad(void) } } -void sub_02017B70(int param0) +void SetGBACartridgeVersion(int version) { - gCoreSys.unk_66 = param0; + gCoreSys.gbaCartridgeVersion = version; } void SleepLock(u8 param0) diff --git a/src/unk_0204C500.c b/src/unk_0204C500.c index 68d807f2f9..2423665cc2 100644 --- a/src/unk_0204C500.c +++ b/src/unk_0204C500.c @@ -3,12 +3,15 @@ #include #include +#include "consts/catching_show.h" + #include "struct_decls/pokedexdata_decl.h" #include "struct_decls/struct_02024440_decl.h" #include "struct_decls/struct_020797DC_decl.h" #include "savedata/save_table.h" +#include "catching_show.h" #include "field_script_context.h" #include "heap.h" #include "inlines.h" @@ -19,7 +22,6 @@ #include "trainer_info.h" #include "unk_0202EEC0.h" #include "unk_0202F180.h" -#include "unk_020562F8.h" #include "unk_020797C8.h" #include "unk_02092494.h" #include "vars_flags.h" @@ -31,10 +33,10 @@ BOOL ScrCmd_253(ScriptContext *param0) if (v1 == 0) { SystemFlag_SetInPalPark(v0); - sub_020562F8(param0->fieldSystem); + CatchingShow_Start(param0->fieldSystem); } else if (v1 == 1) { SystemFlag_ClearInPalPark(v0); - sub_02056328(param0->fieldSystem); + CatchingShow_End(param0->fieldSystem); } else { GF_ASSERT(0); } @@ -82,25 +84,25 @@ BOOL ScrCmd_255(ScriptContext *param0) return 0; } -BOOL ScrCmd_256(ScriptContext *param0) +BOOL ScrCmd_CalcCatchingShowPoints(ScriptContext *ctx) { - u16 v0 = ScriptContext_GetVar(param0); - u16 *v1 = ScriptContext_GetVarPointer(param0); + u16 pointsCategory = ScriptContext_GetVar(ctx); + u16 *destVar = ScriptContext_GetVarPointer(ctx); - switch (v0) { - case 0: - *v1 = sub_020563D0(param0->fieldSystem); + switch (pointsCategory) { + case CATCHING_SHOW_CATCHING_POINTS: + *destVar = CatchingShow_CalcCatchingPoints(ctx->fieldSystem); break; - case 1: - *v1 = sub_020563E0(param0->fieldSystem); + case CATCHING_SHOW_TIME_POINTS: + *destVar = CatchingShow_GetTimePoints(ctx->fieldSystem); break; - case 2: - *v1 = sub_020563F0(param0->fieldSystem); + case CATCHING_SHOW_TYPE_POINTS: + *destVar = CatchingShow_GetTypePoints(ctx->fieldSystem); break; - case 3: - *v1 = sub_020563D0(param0->fieldSystem) + sub_020563F0(param0->fieldSystem) + sub_020563E0(param0->fieldSystem); + case CATCHING_SHOW_TOTAL_POINTS: + *destVar = CatchingShow_CalcCatchingPoints(ctx->fieldSystem) + CatchingShow_GetTypePoints(ctx->fieldSystem) + CatchingShow_GetTimePoints(ctx->fieldSystem); break; } - return 0; + return FALSE; } diff --git a/src/unk_020562F8.c b/src/unk_020562F8.c deleted file mode 100644 index 2a08d6b9f3..0000000000 --- a/src/unk_020562F8.c +++ /dev/null @@ -1,343 +0,0 @@ -#include "unk_020562F8.h" - -#include -#include - -#include "constants/battle.h" -#include "constants/species.h" -#include "consts/game_records.h" - -#include "struct_decls/struct_02024440_decl.h" -#include "struct_decls/struct_020564B4_decl.h" - -#include "field/field_system.h" -#include "savedata/save_table.h" - -#include "field_battle_data_transfer.h" -#include "game_records.h" -#include "heap.h" -#include "inlines.h" -#include "map_tile_behavior.h" -#include "narc.h" -#include "pokemon.h" -#include "rtc.h" -#include "unk_0202EEC0.h" -#include "unk_02054D00.h" - -typedef struct { - u16 unk_00; - u8 unk_02; - u8 unk_03; - u16 unk_04; - u8 unk_06; - u8 unk_07; -} UnkStruct_020564B4_sub1; - -struct UnkStruct_020564B4_t { - UnkStruct_020564B4_sub1 unk_00[6]; - u8 unk_30[6]; - int unk_38; - int unk_3C; - s64 unk_40; - int unk_48; -}; - -static void sub_0205642C(FieldSystem *fieldSystem, UnkStruct_020564B4 *param1); -static void sub_02056624(FieldSystem *fieldSystem, FieldBattleDTO *param1, UnkStruct_020564B4 *param2); -static BOOL sub_02056554(FieldSystem *fieldSystem, UnkStruct_020564B4 *param1, int param2, int param3); -static FieldBattleDTO *sub_0205664C(FieldSystem *fieldSystem, UnkStruct_020564B4 *param1); -static sub_020564B4(UnkStruct_020564B4 *param0); -static void sub_020564D0(UnkStruct_020564B4 *param0); -static BOOL sub_020564F4(UnkStruct_020564B4 *param0); -static u32 sub_020566AC(UnkStruct_020564B4 *param0); -static u32 sub_02056698(UnkStruct_020564B4 *param0); -static u32 sub_0205671C(UnkStruct_020564B4 *param0); - -static UnkStruct_020564B4 Unk_021C07FC; - -void sub_020562F8(FieldSystem *fieldSystem) -{ - int v0; - UnkStruct_020564B4 *v1 = &Unk_021C07FC; - - MI_CpuClearFast(v1, sizeof(UnkStruct_020564B4)); - - sub_0205642C(fieldSystem, v1); - sub_020564D0(v1); - - v1->unk_40 = GetTimestamp(); -} - -void sub_02056328(FieldSystem *fieldSystem) -{ - UnkStruct_020564B4 *v0 = &Unk_021C07FC; - GameRecords *v1 = SaveData_GetGameRecordsPtr(fieldSystem->saveData); - s64 v2 = GetTimestamp(); - s64 v3 = TimeElapsed(v0->unk_40, v2); - - if (v3 < 1000) { - v0->unk_48 = ((1000 - v3) * 2); - } else { - v0->unk_48 = 0; - } - - GameRecords_IncrementTrainerScore(v1, TRAINER_SCORE_EVENT_UNK_17); -} - -BOOL sub_02056374(FieldSystem *fieldSystem, int param1, int param2) -{ - if (sub_020564F4(&Unk_021C07FC) == 1) { - return sub_02056554(fieldSystem, &Unk_021C07FC, param1, param2); - } else { - return 0; - } -} - -FieldBattleDTO *sub_0205639C(FieldSystem *fieldSystem) -{ - return sub_0205664C(fieldSystem, &Unk_021C07FC); -} - -void sub_020563AC(FieldSystem *fieldSystem, FieldBattleDTO *param1) -{ - sub_02056624(fieldSystem, param1, &Unk_021C07FC); -} - -int sub_020563BC(FieldSystem *fieldSystem) -{ - return 6 - sub_020564B4(&Unk_021C07FC); -} - -int sub_020563D0(FieldSystem *fieldSystem) -{ - return sub_02056698(&Unk_021C07FC); -} - -int sub_020563E0(FieldSystem *fieldSystem) -{ - return sub_0205671C(&Unk_021C07FC); -} - -int sub_020563F0(FieldSystem *fieldSystem) -{ - return sub_020566AC(&Unk_021C07FC); -} - -static void sub_02056400(u32 param0, u8 *param1) -{ - int v0; - - GF_ASSERT(0 < param0 && param0 <= NATIONAL_DEX_COUNT); - v0 = (param0 - 1) * 6; - - NARC_ReadFromMemberByIndexPair(param1, NARC_INDEX_ARC__PPARK, 0, v0, sizeof(u8) * 6); -} - -static void sub_0205642C(FieldSystem *fieldSystem, UnkStruct_020564B4 *param1) -{ - int v0; - u8 v1[8]; - u16 v2; - Pokemon *v3; - PalParkTransfer *v4; - - v4 = SaveData_PalParkTransfer(fieldSystem->saveData); - v3 = Pokemon_New(4); - - for (v0 = 0; v0 < 6; v0++) { - param1->unk_30[v0] = 0; - sub_0202F000(v4, v0, v3); - - v2 = Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL); - - param1->unk_00[v0].unk_00 = v2; - sub_02056400(v2, v1); - - if (v1[0] != 0) { - param1->unk_00[v0].unk_02 = v1[0]; - } else { - param1->unk_00[v0].unk_02 = 5 - 1 + v1[1]; - } - - param1->unk_00[v0].unk_03 = v1[3]; - param1->unk_00[v0].unk_04 = v1[2]; - param1->unk_00[v0].unk_06 = Pokemon_GetValue(v3, MON_DATA_TYPE_1, NULL); - param1->unk_00[v0].unk_07 = Pokemon_GetValue(v3, MON_DATA_TYPE_2, NULL); - } - - Heap_FreeToHeap(v3); -} - -static int sub_020564B4(UnkStruct_020564B4 *param0) -{ - int v0; - int v1 = 0; - - for (v0 = 0; v0 < 6; v0++) { - if (param0->unk_30[v0] != 0) { - v1++; - } - } - - return v1; -} - -static void sub_020564D0(UnkStruct_020564B4 *param0) -{ - param0->unk_38 = inline_020564D0(10) + 5; -} - -static BOOL sub_020564F4(UnkStruct_020564B4 *param0) -{ - param0->unk_38--; - - if (param0->unk_38 == 0) { - sub_020564D0(param0); - return 1; - } - - return 0; -} - -static int sub_0205650C(FieldSystem *fieldSystem, int param1, int param2) -{ - u16 v0 = FieldSystem_GetTileBehavior(fieldSystem, param1, param2); - int v1; - - v1 = (param1 < 32) ? 0 : 1; - v1 += (param2 < 32) ? 0 : 2; - - if (TileBehavior_IsTallGrass(v0)) { - return 1 + v1; - } else if (TileBehavior_IsSurfable(v0)) { - return 5 + v1; - } - - return 0; -} - -static BOOL sub_02056554(FieldSystem *fieldSystem, UnkStruct_020564B4 *param1, int param2, int param3) -{ - int v0; - int v1, v2 = 0; - int v3 = sub_0205650C(fieldSystem, param2, param3); - - if (v3 == 0) { - return 0; - } - - for (v0 = 0; v0 < 6; v0++) { - if ((param1->unk_30[v0] == 0) && (param1->unk_00[v0].unk_02 == v3)) { - v2 += param1->unk_00[v0].unk_03; - } - } - - if (v2 == 0) { - return 0; - } - - v1 = inline_020564D0(v2 + 20); - - if (v1 < 20) { - return 0; - } - - v1 -= 20; - - for (v0 = 0; v0 < 6; v0++) { - if ((param1->unk_30[v0] == 0) && (param1->unk_00[v0].unk_02 == v3)) { - if (v1 < param1->unk_00[v0].unk_03) { - param1->unk_3C = v0; - return 1; - } else { - v1 -= param1->unk_00[v0].unk_03; - } - } - } - - GF_ASSERT(0); - return 0; -} - -static void sub_02056624(FieldSystem *fieldSystem, FieldBattleDTO *param1, UnkStruct_020564B4 *param2) -{ - switch (param1->resultMask) { - case BATTLE_RESULT_CAPTURED_MON: - param2->unk_30[param2->unk_3C] = sub_020564B4(param2) + 1; - break; - case BATTLE_RESULT_PLAYER_FLED: - break; - default: - GF_ASSERT(0); - } -} - -static FieldBattleDTO *sub_0205664C(FieldSystem *fieldSystem, UnkStruct_020564B4 *param1) -{ - FieldBattleDTO *v0; - Pokemon *v1 = Pokemon_New(32); - PalParkTransfer *v2 = SaveData_PalParkTransfer(fieldSystem->saveData); - int v3 = sub_020563BC(fieldSystem); - - v0 = FieldBattleDTO_NewPalPark(11, v3); - - FieldBattleDTO_Init(v0, fieldSystem); - sub_0202F000(v2, param1->unk_3C, v1); - FieldBattleDTO_AddPokemonToBattler(v0, v1, 1); - Heap_FreeToHeap(v1); - - return v0; -} - -static u32 sub_02056698(UnkStruct_020564B4 *param0) -{ - int v0; - u32 v1 = 0; - - for (v0 = 0; v0 < 6; v0++) { - v1 += param0->unk_00[v0].unk_04; - } - - return v1; -} - -static u32 sub_020566AC(UnkStruct_020564B4 *param0) -{ - int v0, v1; - int v2, v3, v4, v5; - u32 v6 = 0; - u32 v7 = 0; - - for (v0 = 1; v0 < 6 + 1; v0++) { - for (v1 = 0; v1 < 6; v1++) { - if (param0->unk_30[v1] == v0) { - v4 = param0->unk_00[v1].unk_06; - v5 = param0->unk_00[v1].unk_07; - - if ((v0 != 1) && (v2 != v4) && (v2 != v5) && (v3 != v4) && (v3 != v5)) { - v7 += 200; - } - - v2 = v4; - v3 = v5; - v6 |= (1 << v2); - v6 |= (1 << v3); - - break; - } - } - } - - for (; v6 != 0; v6 >>= 1) { - if (v6 & 1) { - v7 += 50; - } - } - - return v7; -} - -static u32 sub_0205671C(UnkStruct_020564B4 *param0) -{ - return param0->unk_48; -}