diff --git a/docs/formats/EXECUTABLE_LAYOUT.md b/docs/formats/EXECUTABLE_LAYOUT.md index 0991fd5..f59d238 100644 --- a/docs/formats/EXECUTABLE_LAYOUT.md +++ b/docs/formats/EXECUTABLE_LAYOUT.md @@ -250,7 +250,7 @@ declarations change. Game text, resort, image and audio fallbacks belong outside | `CareerSession_DispatchDesktopLayout_RuntimeField2` | `0xa2517` | German-compatible image / runtime field | | `CareerSession_DispatchLeagueTableControl_RuntimeField` | `0xa454d` | German-compatible image / runtime field | | `CareerSession_DispatchLeagueTableControl_RuntimeField2` | `0xbb834` | German-compatible image / runtime field | -| `CareerSession_DispatchLineup_RuntimeField` | `0xa2c30` | German-compatible image / runtime field | +| `LeagueClubCount` | `0xa2c30` | German-compatible image / runtime field | | `CareerSession_DispatchLiveSubstitution_ExecutableField` | `0xa366c` | German-compatible image / runtime field | | `CareerSession_DispatchLiveTactic_RuntimeField` | `0xa20eb` | German-compatible image / runtime field | | `CareerSession_DispatchLiveTactic_RuntimeField2` | `0xa20f3` | German-compatible image / runtime field | @@ -307,12 +307,12 @@ declarations change. Game text, resort, image and audio fallbacks belong outside | `CareerSession_FormatNumber_TextPointer` | `0xa137e` | German-compatible image / runtime field | | `CareerSession_InitializeClubModalRuntime_ExecutableField` | `0xa25c0` | German-compatible image / runtime field | | `CareerSession_InitializeClubModalRuntime_ExecutableFieldUnsigned` | `0xa25c0u` | German-compatible image / runtime field | -| `CareerSession_InstallLeagueSizes_RuntimeField` | `0xa2be9` | German-compatible image / runtime field | -| `CareerSession_InstallLeagueSizes_RuntimeField2` | `0xa2bf2` | German-compatible image / runtime field | -| `CareerSession_InstallLeagueSizes_RuntimeField3` | `0xa2c00` | German-compatible image / runtime field | -| `CareerSession_InstallLeagueSizes_RuntimeField4` | `0xa2c0b` | German-compatible image / runtime field | -| `CareerSession_InstallLeagueSizes_RuntimeField5` | `0xa2c13` | German-compatible image / runtime field | -| `CareerSession_InstallLeagueSizes_RuntimeField6` | `0xa2c34` | German-compatible image / runtime field | +| `LeagueEuropeanPlaces` | `0xa2be9` | German-compatible image / runtime field | +| `LeagueRelegationPlaces` | `0xa2bf2` | German-compatible image / runtime field | +| `LeagueNameSuffixes` | `0xa2c00` | German-compatible image / runtime field | +| `PromotionGroupBelowCounts` | `0xa2c0b` | German-compatible image / runtime field | +| `PromotionGroupBelowLeagues` | `0xa2c13` | German-compatible image / runtime field | +| `NewcomerClubCount` | `0xa2c34` | German-compatible image / runtime field | | `CareerSession_Int32T_TextPointer` | `0xaeffc` | German-compatible image / runtime field | | `CareerSession_Int32T_TextPointer2` | `0xaf21c` | German-compatible image / runtime field | | `CareerSession_Int32T_TextPointer3` | `0xaf228` | German-compatible image / runtime field | @@ -462,7 +462,7 @@ declarations change. Game text, resort, image and audio fallbacks belong outside | `ClubKitSelectorsUnsigned` | `0xbb68bu` | German-compatible image / runtime field | | `ClubPlayerDetail_ClubPlayerDetailFromGame_RuntimeField` | `0xa25bb` | German-compatible image / runtime field | | `ClubPlayerDetail_ClubPlayerDetailFromGame_RuntimeField2` | `0xa25bf` | German-compatible image / runtime field | -| `ClubPlayerDetail_ClubPlayerDetailFromGame_RuntimeField3` | `0xa2c36` | German-compatible image / runtime field | +| `ForeignCupClubCount` | `0xa2c36` | German-compatible image / runtime field | | `ClubPlayerDetail_ClubPlayerDetailFromGame_RuntimeField4` | `0xa364a` | German-compatible image / runtime field | | `ClubPlayerDetail_ClubPlayerDetailRedraw_RuntimeField` | `0xa2c4e` | German-compatible image / runtime field | | `ClubPlayerDetail_ClubPlayerDetailRedraw_RuntimeField2` | `0xa3c9b` | German-compatible image / runtime field | @@ -591,8 +591,8 @@ declarations change. Game text, resort, image and audio fallbacks belong outside | `CupDraw_FormatError_ExecutableField5` | `0xae704` | German-compatible image / runtime field | | `CupDraw_FormatError_ExecutableField6` | `0xae70c` | German-compatible image / runtime field | | `CupDraw_FormatError_RuntimeField` | `0xa2547` | German-compatible image / runtime field | -| `CupDraw_FormatError_RuntimeField2` | `0xb6ea8` | German-compatible image / runtime field | -| `CupDraw_FormatError_RuntimeField3` | `0xb9ad8` | German-compatible image / runtime field | +| `ManagerRecord0Club` | `0xb6ea8` | German-compatible image / runtime field | +| `ManagerRecord4Club` | `0xb9ad8` | German-compatible image / runtime field | | `CupDraw_FormatError_TextPointer` | `0xa1612` | German-compatible image / runtime field | | `CupDraw_FormatError_TextPointer2` | `0xa1619` | German-compatible image / runtime field | | `CupDraw_FormatError_TextPointer3` | `0xa161e` | German-compatible image / runtime field | @@ -893,6 +893,12 @@ declarations change. Game text, resort, image and audio fallbacks belong outside | `EnglishLayoutTranslation256` | `0x6f2ae` | English image adapter | | `EnglishLayoutTranslation257` | `0x6f2d4` | English image adapter | | `EnglishLayoutTranslation258` | `0x6f2e0` | English image adapter | +| `EnglishEnvironmentTileX` | `0x6d230` | English image adapter | +| `EnglishEnvironmentTileY` | `0x6d238` | English image adapter | +| `EnglishEnvironmentYouthColors` | `0x6d240` | English image adapter | +| `EnglishEnvironmentBudgetSteps` | `0x6d244` | English image adapter | +| `EnglishEnvironmentYouthPositionSuffix` | `0x6d24a` | English image adapter | +| `EnglishEnvironmentCostSuffix` | `0x6d24f` | English image adapter | | `EnglishLayoutTranslation259` | `0x6f2fc` | English image adapter | | `EnglishLayoutTranslation26` | `0x6bf2c` | English image adapter | | `EnglishLayoutTranslation260` | `0x6f300` | English image adapter | @@ -1927,6 +1933,8 @@ declarations change. Game text, resort, image and audio fallbacks belong outside | `TransferMarket_Rect_TextPointer3` | `0xae148` | German-compatible image / runtime field | | `TransferMarket_Rect_TextPointer4` | `0xae14c` | German-compatible image / runtime field | | `TransferMarket_Rect_TextPointer5` | `0xae150` | German-compatible image / runtime field | +| `TransferMarket_SearchRows_RuntimeField` | `0xa20fb` | German-compatible image / runtime field | +| `TransferMarket_SearchButton_TextPointer` | `0xae144` | German-compatible image / runtime field | | `TransferMarket_Rect_TextPointer6` | `0xaecac` | German-compatible image / runtime field | | `TransferMarket_Rect_TextPointer7` | `0xaf250` | German-compatible image / runtime field | | `TransferMarket_Render_TextPointer` | `0xaf264` | German-compatible image / runtime field | diff --git a/src/app/app_club.cpp b/src/app/app_club.cpp index 7b54e93..63d3495 100644 --- a/src/app/app_club.cpp +++ b/src/app/app_club.cpp @@ -30,7 +30,7 @@ auto App::club_information_dialog(app::ClubModalServices& services, int team) -> const auto redraw = [&] { std::string error; ClubInfoEntry snapshot; - if (team == kNoTeam || team < season_exe.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField)) { + if (team == kNoTeam || team < season_exe.u16(::bmh::layout::LeagueClubCount)) { snapshot = services.enter_club(team); } auto projection = ui::club_info_from_game(services.state(), team, snapshot, diff --git a/src/app/career_session.cpp b/src/app/career_session.cpp index 7c46742..f15daae 100644 --- a/src/app/career_session.cpp +++ b/src/app/career_session.cpp @@ -497,13 +497,13 @@ static void install_league_sizes(const LeImage& exe) { set_league_groups(first, count); // the promotion ladder (schedule.hpp) for (uint32_t l = 0; l < uint32_t(kLeagueCount); ++l) { - installed_league_system().relegation[l] = exe.u8(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField2 + l); - installed_league_system().europe[l] = exe.u8(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField + l); - installed_league_system().suffix[l] = char(l < 5 ? exe.u8(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField3 + l * 2) : 0); + installed_league_system().relegation[l] = exe.u8(::bmh::layout::LeagueRelegationPlaces + l); + installed_league_system().europe[l] = exe.u8(::bmh::layout::LeagueEuropeanPlaces + l); + installed_league_system().suffix[l] = char(l < 5 ? exe.u8(::bmh::layout::LeagueNameSuffixes + l * 2) : 0); } - for (uint32_t g = 0; g < 8; ++g) installed_league_system().below_first[g] = exe.u8(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField5 + g), installed_league_system().below_count[g] = exe.u8(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField4 + g); - installed_league_system().newcomer_first = exe.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField); - installed_league_system().newcomer_count = exe.u16(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField6); + for (uint32_t g = 0; g < 8; ++g) installed_league_system().below_first[g] = exe.u8(::bmh::layout::PromotionGroupBelowLeagues + g), installed_league_system().below_count[g] = exe.u8(::bmh::layout::PromotionGroupBelowCounts + g); + installed_league_system().newcomer_first = exe.u16(::bmh::layout::LeagueClubCount); + installed_league_system().newcomer_count = exe.u16(::bmh::layout::NewcomerClubCount); // EXE strings the engine posts (messages.hpp) install_message_texts(exe); install_career_rules(exe); diff --git a/src/app/career_session_match.cpp b/src/app/career_session_match.cpp index 7388c7f..50c0d50 100644 --- a/src/app/career_session_match.cpp +++ b/src/app/career_session_match.cpp @@ -1004,7 +1004,7 @@ bool CareerSession::dispatch_pitch(const ui::PitchRequest& request, uint64_t& re } else if (!validate_desk_setting_owner(identity, revision, error, false)) return false; const size_t badge = size_t(request.runtime_club) * 2; const int mode = g_.memory.has(::bmh::layout::GameMode) ? int(g_.memory.u8(::bmh::layout::GameMode)) : int(exe_.u8(::bmh::layout::GameMode)); - if (request.runtime_club >= int(exe_.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField)) || g_.lineups_frozen || + if (request.runtime_club >= int(exe_.u16(::bmh::layout::LeagueClubCount)) || g_.lineups_frozen || mode < 1 || mode > 3 || g_.manager_options[size_t(request.manager_slot) * 5] > 8 || request.indoor != g_.indoor || (!live_context && (lineup_entry_manager_ != request.manager_slot || @@ -1018,7 +1018,7 @@ bool CareerSession::dispatch_pitch(const ui::PitchRequest& request, uint64_t& re return false; } const auto selected_live_opponent = [&](int opponent) { - if (!live_context || opponent < 0 || opponent >= int(exe_.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField))) return false; + if (!live_context || opponent < 0 || opponent >= int(exe_.u16(::bmh::layout::LeagueClubCount))) return false; return std::any_of(live_intervention_->groups.begin(), live_intervention_->groups.end(), [&](const MatchGroup& group) { for (int match = 0; match < group.matches(); ++match) { @@ -1331,13 +1331,13 @@ std::optional CareerSession::prepared_lineup_opponent(int manager_slot, int int(g_.memory.u8(::bmh::layout::ActiveManager)) != manager_slot || g_.manager_teams[size_t(manager_slot)] != runtime_club || runtime_club == kNoTeam || runtime_club < 0 || - runtime_club >= int(exe_.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField)) || g_.manager_of(runtime_club) != manager_slot || + runtime_club >= int(exe_.u16(::bmh::layout::LeagueClubCount)) || g_.manager_of(runtime_club) != manager_slot || size_t(manager_slot) >= source_desk_callargs_.size()) return std::nullopt; const ui::DeskMatchCallargs& source = source_desk_callargs_[size_t(manager_slot)]; const int opponent = source.opponent; - if (opponent < 0 || opponent == runtime_club || opponent >= int(exe_.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField)) || + if (opponent < 0 || opponent == runtime_club || opponent >= int(exe_.u16(::bmh::layout::LeagueClubCount)) || source.competition == 32 || source.competition == 33 || source.competition == 34) return std::nullopt; uint32_t competitions = day_competitions(g_, turn_driver_.calendar_entry); diff --git a/src/app/career_session_statistics.cpp b/src/app/career_session_statistics.cpp index 2016c61..8b41b32 100644 --- a/src/app/career_session_statistics.cpp +++ b/src/app/career_session_statistics.cpp @@ -366,7 +366,7 @@ std::optional CareerSession::open_top_scorers( throw FormatError("top scorers: manager record does not own the active team"); int stable_team = team; if (team == kNoTeam) { - // The live CupDraw_FormatError_RuntimeField3 owner is mirrored by the typed spare manager record 4. + // The live ManagerRecord4Club owner is mirrored by the typed spare manager record 4. const size_t backup = 4 * 0xb0c + 0x290; if (manager != 0 || backup + 2 > g_.manager_records.size()) throw FormatError("top scorers: unsupported national-coach owner"); diff --git a/src/cli/console/windows_info.cpp b/src/cli/console/windows_info.cpp index cd6b15b..dccce06 100644 --- a/src/cli/console/windows_info.cpp +++ b/src/cli/console/windows_info.cpp @@ -133,7 +133,7 @@ void Console::register_info_commands() { if (window_ == "Fixtures" && pairings_) fixtures_action(LeaguePairingsAction::close); std::string error; ClubInfoEntry entry; - if (team < int(exe_.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField))) { // league teams get the entry step (as the app does) + if (team < int(exe_.u16(::bmh::layout::LeagueClubCount))) { // league teams get the entry step (as the app does) const auto prepared = session_->enter_club_information(team, error); if (!prepared) fail("E_RULE", "club information: " + error); entry = *prepared; diff --git a/src/formats/executable_layout.hpp b/src/formats/executable_layout.hpp index 492443b..c5aae17 100644 --- a/src/formats/executable_layout.hpp +++ b/src/formats/executable_layout.hpp @@ -231,7 +231,7 @@ inline constexpr auto CareerSession_DispatchDesktopLayout_RuntimeField = 0xa250e inline constexpr auto CareerSession_DispatchDesktopLayout_RuntimeField2 = 0xa2517; inline constexpr auto CareerSession_DispatchLeagueTableControl_RuntimeField = 0xa454d; inline constexpr auto CareerSession_DispatchLeagueTableControl_RuntimeField2 = 0xbb834; -inline constexpr auto CareerSession_DispatchLineup_RuntimeField = 0xa2c30; +inline constexpr auto LeagueClubCount = 0xa2c30; inline constexpr auto CareerSession_DispatchLiveSubstitution_ExecutableField = 0xa366c; inline constexpr auto CareerSession_DispatchLiveTactic_RuntimeField = 0xa20eb; inline constexpr auto CareerSession_DispatchLiveTactic_RuntimeField2 = 0xa20f3; @@ -288,12 +288,12 @@ inline constexpr auto CareerSession_FormatNumber_ExecutableField2 = 0xa1380; inline constexpr auto CareerSession_FormatNumber_TextPointer = 0xa137e; inline constexpr auto CareerSession_InitializeClubModalRuntime_ExecutableField = 0xa25c0; inline constexpr auto CareerSession_InitializeClubModalRuntime_ExecutableFieldUnsigned = 0xa25c0u; -inline constexpr auto CareerSession_InstallLeagueSizes_RuntimeField = 0xa2be9; -inline constexpr auto CareerSession_InstallLeagueSizes_RuntimeField2 = 0xa2bf2; -inline constexpr auto CareerSession_InstallLeagueSizes_RuntimeField3 = 0xa2c00; -inline constexpr auto CareerSession_InstallLeagueSizes_RuntimeField4 = 0xa2c0b; -inline constexpr auto CareerSession_InstallLeagueSizes_RuntimeField5 = 0xa2c13; -inline constexpr auto CareerSession_InstallLeagueSizes_RuntimeField6 = 0xa2c34; +inline constexpr auto LeagueEuropeanPlaces = 0xa2be9; +inline constexpr auto LeagueRelegationPlaces = 0xa2bf2; +inline constexpr auto LeagueNameSuffixes = 0xa2c00; +inline constexpr auto PromotionGroupBelowCounts = 0xa2c0b; +inline constexpr auto PromotionGroupBelowLeagues = 0xa2c13; +inline constexpr auto NewcomerClubCount = 0xa2c34; inline constexpr auto CareerSession_Int32T_TextPointer = 0xaeffc; inline constexpr auto CareerSession_Int32T_TextPointer2 = 0xaf21c; inline constexpr auto CareerSession_Int32T_TextPointer3 = 0xaf228; @@ -443,7 +443,7 @@ inline constexpr auto ClubKitSelectors = 0xbb68b; inline constexpr auto ClubKitSelectorsUnsigned = 0xbb68bu; inline constexpr auto ClubPlayerDetail_ClubPlayerDetailFromGame_RuntimeField = 0xa25bb; inline constexpr auto ClubPlayerDetail_ClubPlayerDetailFromGame_RuntimeField2 = 0xa25bf; -inline constexpr auto ClubPlayerDetail_ClubPlayerDetailFromGame_RuntimeField3 = 0xa2c36; +inline constexpr auto ForeignCupClubCount = 0xa2c36; inline constexpr auto ClubPlayerDetail_ClubPlayerDetailFromGame_RuntimeField4 = 0xa364a; inline constexpr auto ClubPlayerDetail_ClubPlayerDetailRedraw_RuntimeField = 0xa2c4e; inline constexpr auto ClubPlayerDetail_ClubPlayerDetailRedraw_RuntimeField2 = 0xa3c9b; @@ -572,8 +572,8 @@ inline constexpr auto CupDraw_FormatError_ExecutableField4 = 0xae6dc; inline constexpr auto CupDraw_FormatError_ExecutableField5 = 0xae704; inline constexpr auto CupDraw_FormatError_ExecutableField6 = 0xae70c; inline constexpr auto CupDraw_FormatError_RuntimeField = 0xa2547; -inline constexpr auto CupDraw_FormatError_RuntimeField2 = 0xb6ea8; -inline constexpr auto CupDraw_FormatError_RuntimeField3 = 0xb9ad8; +inline constexpr auto ManagerRecord0Club = 0xb6ea8; +inline constexpr auto ManagerRecord4Club = 0xb9ad8; inline constexpr auto CupDraw_FormatError_TextPointer = 0xa1612; inline constexpr auto CupDraw_FormatError_TextPointer2 = 0xa1619; inline constexpr auto CupDraw_FormatError_TextPointer3 = 0xa161e; diff --git a/src/formats/savestate.cpp b/src/formats/savestate.cpp index e14d6ca..5c7bf0e 100644 --- a/src/formats/savestate.cpp +++ b/src/formats/savestate.cpp @@ -30,8 +30,8 @@ struct BlockDef { // Sizes marked with a Count depend on the master database: // Clubs = CareerSession_DataDirectory_RuntimeField (419) Players = CareerSession_DataDirectory_RuntimeField3 (2574) // N42 = CareerSession_DataDirectory_RuntimeField2 (168) N66 = CareerSession_DataDirectory_RuntimeField4 (3096) -// Teams = CareerSession_DispatchLineup_RuntimeField (138, teams in league play) -// TeamsPlusCups = CareerSession_DispatchLineup_RuntimeField + CareerSession_InstallLeagueSizes_RuntimeField6 (138 + 30) +// Teams = LeagueClubCount (138, teams in league play) +// TeamsPlusCups = LeagueClubCount + NewcomerClubCount (138 + 30) constexpr BlockDef kBlocks[] = { {::bmh::layout::Cup_AdvanceCup_RuntimeField3, false, 1, Count::None, 0, false}, {::bmh::layout::LiveMatchday_FormatError_RuntimeField14, false, 6, Count::None, 0, false}, {::bmh::layout::ManagerRecords, false, 0x373c, Count::None, 0, false}, // 5 manager records of 0xB0C bytes @@ -110,7 +110,7 @@ constexpr BlockDef kBlocks[] = { SaveState::SaveState(const Bytes& stream, const DbCounts& c) : stream_(stream) { // Teams in league play and cup-only teams are not part of DbCounts yet; - // these are the V2.24 values (CareerSession_DispatchLineup_RuntimeField, CareerSession_InstallLeagueSizes_RuntimeField6). + // these are the V2.24 values (LeagueClubCount, NewcomerClubCount). constexpr uint32_t kTeams = 138, kCupTeams = 30; size_t pos = 0; uint32_t last_pointer = 0; diff --git a/src/game/cup.cpp b/src/game/cup.cpp index 9a00986..8d16b6c 100644 --- a/src/game/cup.cpp +++ b/src/game/cup.cpp @@ -443,7 +443,7 @@ void national_tournament_end(GameState& g) { if (coach) book_money(g, 0, -400000, true, true); for (int i = 0; i < 4; i++) { if (teams[i] == kNoTeam && coach) book_money(g, 0, -kPremium[i], true, true); - // (0x8a + 0x1e + 0xbd = 0x165: CareerSession_DispatchLineup_RuntimeField + CareerSession_InstallLeagueSizes_RuntimeField6 + ClubPlayerDetail_ClubPlayerDetailFromGame_RuntimeField3) + // (0x8a + 0x1e + 0xbd = 0x165: LeagueClubCount + NewcomerClubCount + ForeignCupClubCount) if (mem.has(::bmh::layout::Placements)) mem.set8(::bmh::layout::Placements + uint32_t(i), uint8_t((teams[i] - kNoTeam) | 0x80)); } } diff --git a/src/game/desk_actions.cpp b/src/game/desk_actions.cpp index 87e5012..cc38730 100644 --- a/src/game/desk_actions.cpp +++ b/src/game/desk_actions.cpp @@ -101,7 +101,7 @@ int national_opponent_manager(const GameState& g, const NationalFriendlyOwner& o // FindManagerForClub's second lookup: spare manager record 4 represents the // Bundestrainer's own association only for the first human national coach. if (owner.manager == 0 && !g.manager_teams.empty() && g.manager_teams[0] == kNoTeam && - g.memory.has(::bmh::layout::DeskActions_NationalOpponentManager_RuntimeField) && int(g.memory.u16(::bmh::layout::CupDraw_FormatError_RuntimeField3)) == opponent && + g.memory.has(::bmh::layout::DeskActions_NationalOpponentManager_RuntimeField) && int(g.memory.u16(::bmh::layout::ManagerRecord4Club)) == opponent && 5 * kRecordSize <= g.manager_records.size()) return 4; return -1; } diff --git a/src/game/highscore.cpp b/src/game/highscore.cpp index 26ca276..b517d2d 100644 --- a/src/game/highscore.cpp +++ b/src/game/highscore.cpp @@ -86,7 +86,7 @@ HighscoreScore highscore_score(const GameState& g, int manager, HighscoreContext HighscoreScore result; const int team = g.manager_teams.at(size_t(manager)); if (team == kNoTeam) { - // CareerSession_DispatchLineup_RuntimeField+CareerSession_InstallLeagueSizes_RuntimeField6+ClubPlayerDetail_ClubPlayerDetailFromGame_RuntimeField3 == kNoTeam in the supported Original database; + // LeagueClubCount+NewcomerClubCount+ForeignCupClubCount == kNoTeam in the supported Original database; // national honours store (team-kNoTeam)|0x80, so Germany's index is0. for (uint32_t year = 0; year < 20; ++year) for (uint32_t place = 0; place < 4; ++place) { diff --git a/src/game/match.cpp b/src/game/match.cpp index 130ae17..ce27621 100644 --- a/src/game/match.cpp +++ b/src/game/match.cpp @@ -30,7 +30,7 @@ constexpr int8_t kRegionTemperature[48] = {0, -1, 5, 0, 0, 5, 0, -1, -5, -4, constexpr uint8_t kLeagueCrowd[10] = {27, 12, 7, 7, 3, 27, 27, 27, 27, 27}; // First league that counts as a regional league (LeaguePairings_LeaguePairingsConstants_RuntimeField). constexpr int kFirstRegionalLeague = 5; -// Number of cup-only teams before the amateur blocks (CareerSession_InstallLeagueSizes_RuntimeField6). +// Number of cup-only teams before the amateur blocks (NewcomerClubCount). constexpr int kCupTeams = 30; int clamp(int v, int lo, int hi) { return v < lo ? lo : v > hi ? hi : v; } diff --git a/src/game/match_engine.cpp b/src/game/match_engine.cpp index 73fed4e..071a913 100644 --- a/src/game/match_engine.cpp +++ b/src/game/match_engine.cpp @@ -532,7 +532,7 @@ ForcedMatchEvent MatchEngine::event_impl(MatchGroup& g, int m, int s, int minute int opp_team = g.fixtures.at(m * 2 + 1 - s); // MatchEngineRuntimeField11 // Small-squad teams (id >= 90) only half of the time; teams without squads never. The // national team (0x165, squad nominated on the national team days) only while manager - // slot 0 holds it (CupDraw_FormatError_RuntimeField2 == 0x165: a Bundestrainer's match). + // slot 0 holds it (ManagerRecord0Club == 0x165: a Bundestrainer's match). if (!(team < 90 || rand.range(0, 1) == 0)) return result; if (!(team < world_layout().league_teams || team == kNoTeam)) return result; if (team == kNoTeam && (state.manager_teams.empty() || state.manager_teams[0] != kNoTeam)) return result; @@ -854,7 +854,7 @@ void MatchEngine::side(MatchGroup& g, int m, int& s, int minute, int& own_att, i return; } const auto& exe = *reality_rules; - if (team < exe.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField) && opp_team < exe.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField)) { + if (team < exe.u16(::bmh::layout::LeagueClubCount) && opp_team < exe.u16(::bmh::layout::LeagueClubCount)) { const int displacement = (1 - s * 2) * rand.range(21, 45); if (live_ball && button(::bmh::layout::MatchEngine_Side_ExecutableField3) == 0) live_ball({minute, show_group, m, displacement}); diff --git a/src/game/matchday_setup.cpp b/src/game/matchday_setup.cpp index 69fe2e0..9101906 100644 --- a/src/game/matchday_setup.cpp +++ b/src/game/matchday_setup.cpp @@ -40,7 +40,7 @@ constexpr uint8_t kCompetitionClass[24] = {0, 1, 2, 2, 2, 3, 3, 3, 3, 255, 0, 25 // (league_system().group_first / league_system().group_count: schedule.hpp, the calendar groups of the loaded game) // Crowd interest per descriptor type (MatchdaySetupRuntimeField). constexpr uint8_t kTypeInterest[24] = {5, 5, 10, 15, 12, 10, 5, 10, 5, 10, 5, 31, 10, 10, 10, 0, 0, 1, 0, 0, 0, 12, 0, 0}; -// Number of clubs taking part in league play (CareerSession_DispatchLineup_RuntimeField). +// Number of clubs taking part in league play (LeagueClubCount). // Squad slots checked by the driver (CareerRuntimeField). constexpr size_t kSquadSlotCount = 0xb70; diff --git a/src/game/national.cpp b/src/game/national.cpp index 07a3053..cdcb1f9 100644 --- a/src/game/national.cpp +++ b/src/game/national.cpp @@ -205,7 +205,7 @@ void national_coach_take_over(GameState& g, int active_manager, uint16_t source_ set_manager_count(g, 1); swap_manager_slots(g, 4, 0); // SwapManagerSlots(4, 0) uint8_t* coach = &g.manager_records.at(0); - coach[0x290] = uint8_t(kNoTeam & 0xff), coach[0x291] = uint8_t(kNoTeam >> 8); // CupDraw_FormatError_RuntimeField2 = 0x165 + coach[0x290] = uint8_t(kNoTeam & 0xff), coach[0x291] = uint8_t(kNoTeam >> 8); // ManagerRecord0Club = 0x165 coach[0x218] = g.manager_records.at(4 * kManagerRecord + 0x218); // NationalRuntimeField2 = NationalRuntimeField3 g.manager_teams.at(0) = kNoTeam; auto_lineup(g, kNoTeam, 0xe4); // Int2(0x165, 0xe4) diff --git a/src/game/national.hpp b/src/game/national.hpp index 8431a66..143893d 100644 --- a/src/game/national.hpp +++ b/src/game/national.hpp @@ -54,7 +54,7 @@ void national_coach_take_over(GameState& g, int active_manager, uint16_t source_ // NationalCoachHandBack: with CoachActive set the slots change places again, the number of managers // is restored from OriginalManagerCount and CoachActive cleared. void national_coach_hand_back(GameState& g); -// CupDraw_FormatError_RuntimeField2 == 0x165: slot 0 manages the national team. +// ManagerRecord0Club == 0x165: slot 0 manages the national team. bool national_coach_active(const GameState& g); // NationalCoachAfterLoad (saving and loading): the savegame holds the slots swapped back with // CoachActive still 1; afterwards (and so after loading) SwapManagerSlots2 takes over again. diff --git a/src/game/prediction.cpp b/src/game/prediction.cpp index d7c16a1..165e914 100644 --- a/src/game/prediction.cpp +++ b/src/game/prediction.cpp @@ -23,8 +23,8 @@ constexpr size_t kBoard = kTacticsBoardSize; // tactics board of a manager constexpr size_t kBoardSlot = kTacticsBoardSlotSize; // one slot of the board // Static league tables of V2.24 (not part of the savegame): -// (European places per league, CareerSession_InstallLeagueSizes_RuntimeField, are league_system().europe of the loaded game; league 0 uses 4) -// (the relegation places per league, CareerSession_InstallLeagueSizes_RuntimeField2, are league_system().relegation of the loaded game) +// (European places per league, LeagueEuropeanPlaces, are league_system().europe of the loaded game; league 0 uses 4) +// (the relegation places per league, LeagueRelegationPlaces, are league_system().relegation of the loaded game) // Text of a pointer variable of the text table TextPointerTable. } // namespace diff --git a/src/game/reschedule.cpp b/src/game/reschedule.cpp index 408a188..227b892 100644 --- a/src/game/reschedule.cpp +++ b/src/game/reschedule.cpp @@ -89,7 +89,7 @@ int team_replay_on(const GameState& g, int day, int team, int league) { // (bit 15) when it is free (0, 0x4001 or a calendar event 0x1c0), neither it nor its two // neighbours conflict for the club (the neighbours before it may already be marked), the // day after it lies in 0x15 .. 0x11e and it is not in the winter break. The national team -// (manager 0 coaching team 0x165) also checks the club of the Bundestrainer, CupDraw_FormatError_RuntimeField3. +// (manager 0 coaching team 0x165) also checks the club of the Bundestrainer, ManagerRecord4Club. std::vector marked_calendar(const GameState& g, int team) { std::vector cal(kCalendarDays); for (int d = 0; d < kCalendarDays; d++) cal[size_t(d)] = g.memory.u16(kCalendar + uint32_t(d) * 2); @@ -102,7 +102,7 @@ std::vector marked_calendar(const GameState& g, int team) { bool ok = true; for (int i = std::max(0, d - 1); i <= std::min(kCalendarDays - 1, d + 1); i++) { if (day_conflict(g, team, -1, cal[size_t(i)], i)) ok = false; - if (national && day_conflict(g, int16_t(g.memory.u16(::bmh::layout::CupDraw_FormatError_RuntimeField3)), -1, cal[size_t(i)], i)) ok = false; + if (national && day_conflict(g, int16_t(g.memory.u16(::bmh::layout::ManagerRecord4Club)), -1, cal[size_t(i)], i)) ok = false; } if (d + 1 > kLastReplayDay || d + 1 < kFirstDayAfter) ok = false; if (d >= kWinterBreakFirst && d <= kWinterBreakLast) ok = false; diff --git a/src/game/season.cpp b/src/game/season.cpp index 3c87cf0..30ce2bb 100644 --- a/src/game/season.cpp +++ b/src/game/season.cpp @@ -283,8 +283,8 @@ void observe_initial_international_groups(GameState& g, WatcomRandom& rand, int for(const Fixture& fixture:generate_fixtures(schedule_teams,event.round+1,rounds,0)) { for(int position:{fixture.home,fixture.away}) { const int team=mem.u16(teams+uint32_t(position)*2); - const bool manager_national=mem.has(::bmh::layout::CupDraw_FormatError_RuntimeField2)&&mem.has(::bmh::layout::CupDraw_FormatError_RuntimeField3)&& - mem.u16(::bmh::layout::CupDraw_FormatError_RuntimeField2)==kNoTeam&&mem.u16(::bmh::layout::CupDraw_FormatError_RuntimeField3)==team; + const bool manager_national=mem.has(::bmh::layout::ManagerRecord0Club)&&mem.has(::bmh::layout::ManagerRecord4Club)&& + mem.u16(::bmh::layout::ManagerRecord0Club)==kNoTeam&&mem.u16(::bmh::layout::ManagerRecord4Club)==team; const bool human_owned=g.manager_of(team)>=0||manager_national; if(team last; if (s % 2 == 0) { @@ -395,7 +395,7 @@ void european_setup(GameState& g, GameRandom& game, WatcomRandom& rand, const Se void european_fields(GameState& g, GameRandom& game, WatcomRandom& rand) { StaticMemory& mem = g.memory; Entrants en{mem}; - const int pool = world_layout().first_foreign_cup(); // CareerSession_DispatchLineup_RuntimeField + CareerSession_InstallLeagueSizes_RuntimeField6: the first foreign club + const int pool = world_layout().first_foreign_cup(); // LeagueClubCount + NewcomerClubCount: the first foreign club auto pick = [&](int from) { int t; do t = rand.range(from, from + 6); while (en.find(t) != 0); @@ -1359,7 +1359,7 @@ void licence_withdrawals(GameState& g, int league, std::vector& down, for (size_t m = 0; m < g.manager_teams.size(); m++) { const int team = g.manager_teams[m]; if (team < first || team >= first + league_system().sizes[league] || ranks[team - first] <= 5) continue; - static const uint8_t kDownPlaces[kLeagueCount] = {3, 4, 2, 2, 3, 0, 0, 0, 0}; // CareerSession_InstallLeagueSizes_RuntimeField2 + static const uint8_t kDownPlaces[kLeagueCount] = {3, 4, 2, 2, 3, 0, 0, 0, 0}; // LeagueRelegationPlaces if (kDownPlaces[league] == 0) continue; const uint8_t cut = rec8(g, int(m), 0x220); const int32_t total = int32_t(rec8(g, int(m), 0x26f)) * 80000 + (assets(g, int(m), 0xf) - assets(g, int(m), 0x10)); @@ -1417,7 +1417,7 @@ void promotion(GameState& g, GameRandom& game, WatcomRandom& rand, MinuteReport& const uint8_t* kBelowCount = league_system().below_count; // The clubs that refill the lowest league: league_system().newcomer_count clubs from league_system().newcomer_first // (German: the 30 amateur clubs 138-167). The English game draws from its 12 further - // English clubs (ClubName: range(CareerSession_DispatchLineup_RuntimeField, CareerSession_DispatchLineup_RuntimeField + 11)); its later ids have no name. + // English clubs (ClubName: range(LeagueClubCount, LeagueClubCount + 11)); its later ids have no name. // The span ends at the last named club, which keeps the German draws unchanged. // (OpenBMH deviates from the English original here: its extra coin flip per draw is not // ported.) @@ -1509,10 +1509,10 @@ void promotion(GameState& g, GameRandom& game, WatcomRandom& rand, MinuteReport& } // namespace // LeagueName(buf, league): the name of a league (< 5): the texts from Achievements_FormatError_TextPointer3 on - a -// league whose suffix letter (CareerSession_InstallLeagueSizes_RuntimeField3, two bytes per league) is set shares the text of +// league whose suffix letter (LeagueNameSuffixes, two bytes per league) is set shares the text of // the one before when its letter is from 'B' on (LeagueName2) - with " " + the letter. std::string league_name(const GameState& g, int league) { - // CareerSession_InstallLeagueSizes_RuntimeField3 of the loaded game (schedule.hpp: German A/B for the two Regionalligen, + // LeagueNameSuffixes of the loaded game (schedule.hpp: German A/B for the two Regionalligen, // English none - its four divisions are one ladder) const char* kSuffix = league_system().suffix; int index = 0; @@ -1679,7 +1679,7 @@ bool career_season_setup(GameState& g, GameRandom& game, WatcomRandom& rand, Min } // the title holders of the cup entries (+0x22): none yet, the placeholder clubs const uint16_t first_small = 90; // TeamsWithSquads - const uint16_t foreign = uint16_t(world_layout().no_team()); // ClubPlayerDetail_ClubPlayerDetailFromGame_RuntimeField3 + CareerSession_DispatchLineup_RuntimeField + CareerSession_InstallLeagueSizes_RuntimeField6 (0x165) + const uint16_t foreign = uint16_t(world_layout().no_team()); // ForeignCupClubCount + LeagueClubCount + NewcomerClubCount (0x165) mem.set16(::bmh::layout::Season_CareerSeasonSetup_RuntimeField2, foreign); mem.set16(::bmh::layout::Season_CareerSeasonSetup_RuntimeField6, uint16_t(first_small + 7)); mem.set16(::bmh::layout::Season_CareerSeasonSetup_RuntimeField, 7); diff --git a/src/game/sportschau_rating.cpp b/src/game/sportschau_rating.cpp index 6222cf9..cbd1760 100644 --- a/src/game/sportschau_rating.cpp +++ b/src/game/sportschau_rating.cpp @@ -15,7 +15,7 @@ namespace bmh { SportschauRatingTables sportschau_rating_tables(const LeImage& exe) { SportschauRatingTables t; - t.domestic_teams = exe.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField); + t.domestic_teams = exe.u16(::bmh::layout::LeagueClubCount); for (size_t i = 0; i < 4; ++i) { const auto offset = uint32_t(i); t.position_limit[i] = std::bit_cast(exe.u8(::bmh::layout::SportschauRating_SportschauRatingTables_RuntimeField + offset)); diff --git a/src/game/state.hpp b/src/game/state.hpp index 79622ec..308b9b7 100644 --- a/src/game/state.hpp +++ b/src/game/state.hpp @@ -53,7 +53,7 @@ struct GameState { // Block Formations = contents of M3.DAT: formation tables, 2 sets (outdoor, indoor) of // 0xB0 bytes = 8 formations x (11 x positions, 11 y positions). The engine uses 4. std::vector formations; - // Team id managed by each human manager (manager record +0x290, CupDraw_FormatError_RuntimeField2), one entry + // Team id managed by each human manager (manager record +0x290, ManagerRecord0Club), one entry // per human manager (ManagerCount). std::vector manager_teams; bool indoor = false; // OpenBMH deviates from the original: retains designated set-piece selections in the supported manager-record extension. diff --git a/src/game/weekly.cpp b/src/game/weekly.cpp index 49af7ce..69a13c6 100644 --- a/src/game/weekly.cpp +++ b/src/game/weekly.cpp @@ -2710,7 +2710,7 @@ void transfer_list_countdown(GameState& g, GameRandom& game, WatcomRandom& rand, // club as owner 4 while manager 0 runs the national team. return g.manager_of(club) >= 0 || (!g.manager_teams.empty() && g.manager_teams[0] == kNoTeam && mem.has(::bmh::layout::DeskActions_NationalOpponentManager_RuntimeField) && - int(mem.u16(::bmh::layout::CupDraw_FormatError_RuntimeField3)) == club); + int(mem.u16(::bmh::layout::ManagerRecord4Club)) == club); }; bool human_involved = human_participant(seller); for (int bid = 0; bid < 4 && !human_involved; ++bid) { diff --git a/src/game/world_layout.hpp b/src/game/world_layout.hpp index 086c088..e9eaf04 100644 --- a/src/game/world_layout.hpp +++ b/src/game/world_layout.hpp @@ -86,19 +86,19 @@ struct LeagueSystem { uint8_t calendar_bit[kLeagueCount] = {0, 1, 2, 2, 3, 4, 4, 4, 4}; // The promotion ladder (Void / English ClubName): - // - relegation[league]: relegation places (CareerSession_InstallLeagueSizes_RuntimeField2; German 3 4 2 2 3, + // - relegation[league]: relegation places (LeagueRelegationPlaces; German 3 4 2 2 3, // English 4 4 4 4 4), // - below_first[group] .. + below_count[group] - 1: the league(s) a promotion group takes its promoted - // clubs from (CareerSession_InstallLeagueSizes_RuntimeField5 / CareerSession_InstallLeagueSizes_RuntimeField4; + // clubs from (PromotionGroupBelowLeagues / PromotionGroupBelowCounts; // German 1 | 2 | 4 with the two Regionalligen in one group, English 1 | 2 | 3), - // - suffix[league]: the letter after a league's name (CareerSession_InstallLeagueSizes_RuntimeField3, two + // - suffix[league]: the letter after a league's name (LeagueNameSuffixes, two // bytes per league; German A/B for the Regionalligen, English none), // - newcomer_first / newcomer_count: the clubs the lowest league is refilled from - // (CareerSession_DispatchLineup_RuntimeField / CareerSession_InstallLeagueSizes_RuntimeField6; German the 30 + // (LeagueClubCount / NewcomerClubCount; German the 30 // amateur clubs 138-167; the English game draws from its 12 further English clubs 138-149 - its later // ids have no name - so the session counts only named clubs). uint8_t relegation[kLeagueCount] = {3, 4, 2, 2, 3, 0, 0, 0, 0}; - // European places per league for the table prediction (CareerSession_InstallLeagueSizes_RuntimeField; + // European places per league for the table prediction (LeagueEuropeanPlaces; // German 0 3 2 2 4 - league 0 uses 4 in the prediction -, English 0 4 4 4 4) uint8_t europe[kLeagueCount] = {0, 3, 2, 2, 4, 0, 0, 0, 0}; uint8_t below_first[8] = {1, 2, 4, 5, 6, 7, 8, 0}; diff --git a/src/launch/fltd_map.inc b/src/launch/fltd_map.inc index 958f499..147f235 100644 --- a/src/launch/fltd_map.inc +++ b/src/launch/fltd_map.inc @@ -159,10 +159,10 @@ {::bmh::layout::CareerSession_BeginFriendlyOpponentTable_RuntimeField, 9, Kind::copy, ::bmh::layout::EnglishLayoutTranslation257, {}}, {::bmh::layout::LeagueSizes, 1, Kind::copy, ::bmh::layout::EnglishLayoutTranslation258, {}}, {::bmh::layout::LeaguePairings_LeaguePairingsConstants_RuntimeField, 3, Kind::copy, ::bmh::layout::EnglishLayoutTranslation259, {}}, - {::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField, 9, Kind::copy, ::bmh::layout::EnglishLayoutTranslation260, {}}, - {::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField2, 9, Kind::copy, ::bmh::layout::EnglishLayoutTranslation261, {}}, + {::bmh::layout::LeagueEuropeanPlaces, 9, Kind::copy, ::bmh::layout::EnglishLayoutTranslation260, {}}, + {::bmh::layout::LeagueRelegationPlaces, 9, Kind::copy, ::bmh::layout::EnglishLayoutTranslation261, {}}, {::bmh::layout::DeskDrawers_Curve_RuntimeField, 5, Kind::copy, ::bmh::layout::EnglishLayoutTranslation262, {}}, - {::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField3, 2, Kind::copy, ::bmh::layout::EnglishLayoutTranslation264, {}}, + {::bmh::layout::LeagueNameSuffixes, 2, Kind::copy, ::bmh::layout::EnglishLayoutTranslation264, {}}, {::bmh::layout::Manager_FormatError_RuntimeField, 8, Kind::copy, ::bmh::layout::EnglishLayoutTranslation263, {}}, {::bmh::layout::CalendarLeagueCounts, 1, Kind::copy, ::bmh::layout::EnglishLayoutTranslation265, {}}, {::bmh::layout::LeaguePairings_SelectorEvent_RuntimeField, 4, Kind::copy, ::bmh::layout::EnglishLayoutTranslation266, {}}, @@ -171,9 +171,9 @@ {::bmh::layout::GermanLayoutTranslation2, 8, Kind::copy, ::bmh::layout::EnglishLayoutTranslation269, {}}, {::bmh::layout::GermanLayoutTranslation3, 2, Kind::copy, ::bmh::layout::EnglishLayoutTranslation270, {}}, {::bmh::layout::TeamsWithSquads, 2, Kind::copy, ::bmh::layout::EnglishLayoutTranslation271, {}}, - {::bmh::layout::CareerSession_DispatchLineup_RuntimeField, 4, Kind::copy, ::bmh::layout::EnglishLayoutTranslation272, {}}, - {::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField6, 2, Kind::copy, ::bmh::layout::EnglishLayoutTranslation273, {}}, - {::bmh::layout::ClubPlayerDetail_ClubPlayerDetailFromGame_RuntimeField3, 2, Kind::copy, ::bmh::layout::EnglishLayoutTranslation274, {}}, + {::bmh::layout::LeagueClubCount, 4, Kind::copy, ::bmh::layout::EnglishLayoutTranslation272, {}}, + {::bmh::layout::NewcomerClubCount, 2, Kind::copy, ::bmh::layout::EnglishLayoutTranslation273, {}}, + {::bmh::layout::ForeignCupClubCount, 2, Kind::copy, ::bmh::layout::EnglishLayoutTranslation274, {}}, {::bmh::layout::NoTeamSquadStart, 6, Kind::copy, ::bmh::layout::EnglishLayoutTranslation275, {}}, {::bmh::layout::CareerSession_DataDirectory_RuntimeField, 4, Kind::copy, ::bmh::layout::EnglishLayoutTranslation276, {}}, {::bmh::layout::CareerSession_DataDirectory_RuntimeField2, 12, Kind::copy, ::bmh::layout::EnglishLayoutTranslation277, {}}, diff --git a/src/ui/club_info.cpp b/src/ui/club_info.cpp index 6fd5485..5585f35 100644 --- a/src/ui/club_info.cpp +++ b/src/ui/club_info.cpp @@ -65,8 +65,8 @@ ClubInfoProjection club_info_from_game(const GameState& g, int team, out.original_club_name = g.club_name(team); out.gradient_text = g.memory.u8(::bmh::layout::TextGradientDisabled) == 0 && exe.u8(::bmh::layout::TextGradientMode) == 2; out.decorated_background = g.memory.u8(::bmh::layout::PlainBackground) == 0; - out.has_squad = team == kNoTeam || team < exe.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField); - if (team != kNoTeam && team >= exe.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField)) { + out.has_squad = team == kNoTeam || team < exe.u16(::bmh::layout::LeagueClubCount); + if (team != kNoTeam && team >= exe.u16(::bmh::layout::LeagueClubCount)) { out.has_squad = false; out.category = team >= 0 && size_t(team) < g.team_morale.size() ? uint8_t((g.team_morale[size_t(team)] >> 6) & 3) : 0; diff --git a/src/ui/club_player_detail.cpp b/src/ui/club_player_detail.cpp index 7ce0aa3..fb232a0 100644 --- a/src/ui/club_player_detail.cpp +++ b/src/ui/club_player_detail.cpp @@ -46,7 +46,7 @@ ClubPlayerDetailProjection club_player_detail_from_game(const GameState& g, ClubPlayerDetailProjection p;p.redraw=std::move(redraw); const auto& c=p.redraw.context; const int nation=c.attributes.nationality()+((c.bonus&0x80)?32:0); - p.original_nationality_name=g.club_name(exe.u16(::bmh::layout::ClubPlayerDetail_ClubPlayerDetailFromGame_RuntimeField3)+exe.u16(::bmh::layout::NoTeamSquadStart)+nation); + p.original_nationality_name=g.club_name(exe.u16(::bmh::layout::ForeignCupClubCount)+exe.u16(::bmh::layout::NoTeamSquadStart)+nation); for(int i=0;i<2;++i){ const int id=i?c.secondary_club:c.primary_club;if(id<0||id==0xffff)continue; ClubPlayerDetailClub club;club.runtime_team=id;club.original_full_name=g.club_name(id);club.original_short_name=club.original_full_name; diff --git a/src/ui/cup_draw.cpp b/src/ui/cup_draw.cpp index 5cf40a6..0bd2afc 100644 --- a/src/ui/cup_draw.cpp +++ b/src/ui/cup_draw.cpp @@ -144,7 +144,7 @@ CupDrawProjection cup_draw_from_game(const GameState& game,const SeasonCupDrawEv std::string context; if(event.group_stage&&event.phase==SeasonCupDrawPhase::overview) { const bool human_national=game.manager_of(id)>=0|| - (game.memory.has(::bmh::layout::CupDraw_FormatError_RuntimeField2)&&game.memory.has(::bmh::layout::CupDraw_FormatError_RuntimeField3)&&game.memory.u16(::bmh::layout::CupDraw_FormatError_RuntimeField2)==kNoTeam&&game.memory.u16(::bmh::layout::CupDraw_FormatError_RuntimeField3)==id); + (game.memory.has(::bmh::layout::ManagerRecord0Club)&&game.memory.has(::bmh::layout::ManagerRecord4Club)&&game.memory.u16(::bmh::layout::ManagerRecord0Club)==kNoTeam&&game.memory.u16(::bmh::layout::ManagerRecord4Club)==id); if(id>=world_layout().first_foreign_cup()&&!human_national) { if(size_t(id-168)>=game.foreign_strength.size())throw FormatError("cup draw: missing Source foreign-strength byte"); const uint8_t strength=game.foreign_strength[size_t(id-168)]; diff --git a/src/ui/desk_drawers.cpp b/src/ui/desk_drawers.cpp index d02f65d..7e22540 100644 --- a/src/ui/desk_drawers.cpp +++ b/src/ui/desk_drawers.cpp @@ -150,8 +150,8 @@ void DeskDrawerRenderer::curve(Image& target, const DeskState& state, const Desk } const uint32_t league = uint32_t(curve->league); const int teams = exe_.u8(::bmh::layout::LeagueSizes + league); - const int low_cut = exe_.u8(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField + league) + exe_.u8(::bmh::layout::DeskDrawers_Curve_RuntimeField + league); - const int high_cut = teams - exe_.u8(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField2 + league); + const int low_cut = exe_.u8(::bmh::layout::LeagueEuropeanPlaces + league) + exe_.u8(::bmh::layout::DeskDrawers_Curve_RuntimeField + league); + const int high_cut = teams - exe_.u8(::bmh::layout::LeagueRelegationPlaces + league); const int left = item.x + 5, top = item.y + 1, bottom = top + 42; line(target, left, top, left, bottom, 0x6a); line(target, left, bottom, left + 80, bottom, 0x6a); diff --git a/src/ui/desk_state.cpp b/src/ui/desk_state.cpp index a9633fe..0c64a09 100644 --- a/src/ui/desk_state.cpp +++ b/src/ui/desk_state.cpp @@ -127,7 +127,7 @@ void project_drawer_rows(DeskState& d, const LeImage& exe, const Bytes& managers } void project_table_position(DeskState& desk, const GameState& game) { - // SourceDrawerTeam permits league clubs and CupDraw_FormatError_RuntimeField2 (the Source 0x165 + // SourceDrawerTeam permits league clubs and ManagerRecord0Club (the Source 0x165 // national-team slot) through its rank/strength path. const int position = table_position(game, desk.runtime_club); if (position >= 0) desk.table_position = position; @@ -311,7 +311,7 @@ DeskState project(const StaticMemory& memory, const Tables& t, const LeImage& ex uint8_t remaining = 18; for (size_t kind = 6; kind < 13; ++kind) remaining = uint8_t(remaining - t.managers.at(base + 0xc5 + kind)); d.warnings[3] = remaining < 4; - const int max24 = exe.u16(::bmh::layout::TeamsWithSquads), league_teams = exe.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField); + const int max24 = exe.u16(::bmh::layout::TeamsWithSquads), league_teams = exe.u16(::bmh::layout::LeagueClubCount); if (!d.national_team && d.runtime_club >= league_teams) throw FormatError("desk: cup-only squad projection not supported"); const size_t first = d.national_team ? 3072 : size_t(d.runtime_club < max24 ? d.runtime_club * 24 : d.runtime_club * 16 + max24 * 8); const size_t count = d.national_team ? 24 : (d.runtime_club < max24 ? 24 : 16); diff --git a/src/ui/league_table_tests.cpp b/src/ui/league_table_tests.cpp index 1a7b9af..b66cc0f 100644 --- a/src/ui/league_table_tests.cpp +++ b/src/ui/league_table_tests.cpp @@ -42,7 +42,7 @@ std::string original_league_title(const GameState& game, const LeImage& exe, int for (int previous = 0; previous < league; ++previous) if (exe.u8(::bmh::layout::Manager_FormatError_RuntimeField + uint32_t(previous) * 2) < 'B') ++text; std::string name = (*game.texts)[text]; - const uint8_t suffix = exe.u8(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField3 + uint32_t(league) * 2); + const uint8_t suffix = exe.u8(::bmh::layout::LeagueNameSuffixes + uint32_t(league) * 2); if (suffix != 0) { std::string tail = (*game.texts)[size_t((::bmh::layout::Manager_FormatError_TextPointer2 - ::bmh::layout::TextPointerTable) / 4)]; check(!tail.empty(), "Original TEXTD league suffix template is present"); diff --git a/src/ui/lineup.cpp b/src/ui/lineup.cpp index 51acc25..51c8be3 100644 --- a/src/ui/lineup.cpp +++ b/src/ui/lineup.cpp @@ -42,7 +42,7 @@ LineupState project(const StaticMemory& memory, const LeImage& exe, const std::v if (out.manager_slot < 0 || out.manager_slot > 3 || size_t(out.manager_slot) >= teams.size()) throw FormatError("lineup: unsupported active manager"); out.runtime_club = teams.at(out.manager_slot); - const int split = exe.u16(::bmh::layout::TeamsWithSquads), limit = exe.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField); + const int split = exe.u16(::bmh::layout::TeamsWithSquads), limit = exe.u16(::bmh::layout::LeagueClubCount); const bool national = out.runtime_club == kNoTeam && out.manager_slot == 0 && teams.size() == 1 && ((memory.u32(::bmh::layout::CompetitionSelection) & 2) != 0 || (memory.has(::bmh::layout::CoachActive) && memory.u8(::bmh::layout::CoachActive) != 0)); diff --git a/src/ui/manager.cpp b/src/ui/manager.cpp index 63312c0..5adba62 100644 --- a/src/ui/manager.cpp +++ b/src/ui/manager.cpp @@ -81,7 +81,7 @@ ManagerScreen::ManagerScreen(const std::filesystem::path& data, int slot, const context_.club_order.resize(db_.club_names.size()); std::iota(context_.club_order.begin(), context_.club_order.end(), 0); } - if (context_.club_order.size() < size_t(exe_.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField)) + exe_.u16(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField6)) + if (context_.club_order.size() < size_t(exe_.u16(::bmh::layout::LeagueClubCount)) + exe_.u16(::bmh::layout::NewcomerClubCount)) throw FormatError("manager selection: club order does not cover all selectable groups"); std::set unique; for (int id : context_.club_order) @@ -106,7 +106,7 @@ ManagerScreen::ManagerScreen(const std::filesystem::path& data, int slot, const first_[i] = start; last_[i] = start + exe_.u8(::bmh::layout::LeagueSizes + i) - 1; start = last_[i] + 1; leagues_[i] = texts_[text_id]; - if (auto suffix = exe_.u8(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField3 + i * 2)) { + if (auto suffix = exe_.u8(::bmh::layout::LeagueNameSuffixes + i * 2)) { auto tail = texts_[(::bmh::layout::Manager_FormatError_TextPointer2 - ::bmh::layout::TextPointerTable) / 4]; if (tail.empty()) throw FormatError("manager: missing league suffix"); tail.back() = char(suffix); leagues_[i] += tail; @@ -115,8 +115,8 @@ ManagerScreen::ManagerScreen(const std::filesystem::path& data, int slot, const if (last_[i] - first_[i] >= 20) throw FormatError("manager: league exceeds picker grid"); } for(int i=player_league_count(exe_);i<5;++i){last_[i]=first_[i]-1;leagues_[i].clear();} - first_[5] = exe_.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField); last_[5] = first_[5] + 19; - first_[6] = first_[5] + 20; last_[6] = first_[5] + exe_.u16(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField6) - 1; + first_[5] = exe_.u16(::bmh::layout::LeagueClubCount); last_[5] = first_[5] + 19; + first_[6] = first_[5] + 20; last_[6] = first_[5] + exe_.u16(::bmh::layout::NewcomerClubCount) - 1; leagues_[5] = texts_[(::bmh::layout::Manager_FormatError_TextPointer - ::bmh::layout::TextPointerTable) / 4]; leagues_[6] = leagues_[5]; if (leagues_[6].empty()) throw FormatError("manager: missing extra-team label"); leagues_[6].back() = 'B'; diff --git a/src/ui/matchday_results_tests.cpp b/src/ui/matchday_results_tests.cpp index eac7789..9e91a3a 100644 --- a/src/ui/matchday_results_tests.cpp +++ b/src/ui/matchday_results_tests.cpp @@ -46,7 +46,7 @@ std::string title_oracle(const GameState& game, const LeImage& exe, int league) for (int previous = 0; previous < league; ++previous) if (exe.u8(::bmh::layout::Manager_FormatError_RuntimeField + uint32_t(previous) * 2) < 'B') ++slot; std::string title = game.texts->strings.at(slot); - if (const auto suffix = exe.u8(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField3 + uint32_t(league) * 2)) { + if (const auto suffix = exe.u8(::bmh::layout::LeagueNameSuffixes + uint32_t(league) * 2)) { std::string tail = game.texts->strings.at((::bmh::layout::Manager_FormatError_TextPointer2 - ::bmh::layout::TextPointerTable) / 4); tail.back() = char(suffix); title += tail; diff --git a/src/ui/other_games_state.cpp b/src/ui/other_games_state.cpp index 0076b02..6053571 100644 --- a/src/ui/other_games_state.cpp +++ b/src/ui/other_games_state.cpp @@ -178,7 +178,7 @@ uint8_t source_country(const LeImage& exe, int team) { return 0; } } - const int remainder = remaining - int16_t(exe.u16(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField6)); + const int remainder = remaining - int16_t(exe.u16(::bmh::layout::NewcomerClubCount)); if (remainder >= 0) return uint8_t(remainder / 7 - domestic_cutoff + 10); return 0; } diff --git a/src/ui/pitch.cpp b/src/ui/pitch.cpp index b0fcb42..cea31b3 100644 --- a/src/ui/pitch.cpp +++ b/src/ui/pitch.cpp @@ -67,7 +67,7 @@ PitchExtras extras(const StaticMemory& memory,const Bytes& managers,const Bytes& const bool national=e.runtime_club==kNoTeam&&e.manager_slot==0&&count==1&& ((memory.u32(::bmh::layout::CompetitionSelection)&2)!=0|| (memory.has(::bmh::layout::CoachActive)&&memory.u8(::bmh::layout::CoachActive)!=0)); - if(e.runtime_club<0||(e.runtime_club>=exe.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField)&&!national)) + if(e.runtime_club<0||(e.runtime_club>=exe.u16(::bmh::layout::LeagueClubCount)&&!national)) throw FormatError("pitch: unsupported club"); const size_t m=size_t(e.manager_slot)*0xb0c,f=size_t(e.manager_slot)*0x160; if(managers.size()= league_gate) out.flag_index = uint8_t(league - league_gate + 1); break; } - if (league == 8 && region_team >= int(exe.u16(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField6))) - out.flag_index = uint8_t((region_team - int(exe.u16(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField6))) / 7 - league_gate + 10); + if (league == 8 && region_team >= int(exe.u16(::bmh::layout::NewcomerClubCount))) + out.flag_index = uint8_t((region_team - int(exe.u16(::bmh::layout::NewcomerClubCount))) / 7 - league_gate + 10); } } out.source_has_league_panel = team < world_layout().first_foreign_cup(); @@ -426,9 +426,9 @@ Image TeamStatisticsScreen::render() const { uint16_t(projection_.position_history[word_index + 1]) << 8); const int rank_value = (packed >> (5 * (round % 3))) & 0x1f; int kind = 1; - if (rank_value < int(exe_.u8(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField + league)) + int(exe_.u8(::bmh::layout::DeskDrawers_Curve_RuntimeField + league)) || + if (rank_value < int(exe_.u8(::bmh::layout::LeagueEuropeanPlaces + league)) + int(exe_.u8(::bmh::layout::DeskDrawers_Curve_RuntimeField + league)) || (rank_value == 0 && league == 0)) kind = 0; - if (int(exe_.u8(::bmh::layout::LeagueSizes + league)) - int(exe_.u8(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField2 + league)) <= rank_value) kind = 2; + if (int(exe_.u8(::bmh::layout::LeagueSizes + league)) - int(exe_.u8(::bmh::layout::LeagueRelegationPlaces + league)) <= rank_value) kind = 2; for (int series = 0; series < 2; ++series) { const int x = 226 + round * 2 + series; if (x >= 306) continue; diff --git a/src/ui/training.cpp b/src/ui/training.cpp index de35e2f..88c77a3 100644 --- a/src/ui/training.cpp +++ b/src/ui/training.cpp @@ -59,7 +59,7 @@ TrainingState project(const StaticMemory& memory, const Bytes& records, const By if (manager_count < 1 || manager_count > 4 || s.manager_slot >= manager_count || teams.size() != size_t(manager_count)) throw FormatError("training: inconsistent active manager"); s.runtime_club = teams.at(s.manager_slot); - const int max24 = exe.u16(::bmh::layout::TeamsWithSquads), max16 = exe.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField); + const int max24 = exe.u16(::bmh::layout::TeamsWithSquads), max16 = exe.u16(::bmh::layout::LeagueClubCount); if (s.runtime_club < 0 || s.runtime_club >= max16) throw FormatError("training: national/cup-only squad unsupported"); s.squad_capacity = s.runtime_club < max24 ? 24 : 16; const size_t first = size_t(s.runtime_club < max24 ? s.runtime_club * 24 : s.runtime_club * 16 + max24 * 8); diff --git a/tests/bank_app_tests.cpp b/tests/bank_app_tests.cpp index e129fa2..b2b6a16 100644 --- a/tests/bank_app_tests.cpp +++ b/tests/bank_app_tests.cpp @@ -1987,7 +1987,7 @@ int main(int argc, char** argv) { observe_last_week(sparse_bidder, buy_entry, false, true); GameState coach_bidder = human_bidder; - coach_bidder.memory.set16(::bmh::layout::CupDraw_FormatError_RuntimeField3, uint16_t(coach_bidder.manager_teams.at(0))); + coach_bidder.memory.set16(::bmh::layout::ManagerRecord4Club, uint16_t(coach_bidder.manager_teams.at(0))); coach_bidder.manager_teams = {0x165}; observe_last_week(coach_bidder, buy_entry, false, true); diff --git a/tests/highscore_tests.cpp b/tests/highscore_tests.cpp index 279e3ec..b1a3328 100644 --- a/tests/highscore_tests.cpp +++ b/tests/highscore_tests.cpp @@ -52,7 +52,7 @@ void check_original_score(const std::filesystem::path& data, const std::filesyst constexpr uint8_t weights[] = {3,5,4,30,20,10,5,40,30,50}; for (uint32_t k = 0; k < sizeof weights; ++k) require(exe.u8(::bmh::layout::HighscoreRuntimeField + k) == weights[k], "Source score weights changed"); - require(exe.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField) + exe.u16(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField6) + exe.u16(::bmh::layout::ClubPlayerDetail_ClubPlayerDetailFromGame_RuntimeField3) == kNoTeam, + require(exe.u16(::bmh::layout::LeagueClubCount) + exe.u16(::bmh::layout::NewcomerClubCount) + exe.u16(::bmh::layout::ForeignCupClubCount) == kNoTeam, "national honours base changed"); auto g = post7(fixture); const auto before = save_stream(g); diff --git a/tests/national_friendly_actions_tests.cpp b/tests/national_friendly_actions_tests.cpp index 707b0e9..758d822 100644 --- a/tests/national_friendly_actions_tests.cpp +++ b/tests/national_friendly_actions_tests.cpp @@ -42,7 +42,7 @@ GameState fixture() { g.memory.add_block(kPlannerTeams, 30 * 4); g.memory.add_block(kCalendar, 0x16e * 2); g.memory.add_block(::bmh::layout::DaysIntoSeason, 2); - g.memory.add_block(::bmh::layout::CupDraw_FormatError_RuntimeField3, 2); + g.memory.add_block(::bmh::layout::ManagerRecord4Club, 2); g.date = 50; g.season_start = 0; g.level = 1; @@ -219,7 +219,7 @@ void check_stale_and_source_association_payer() { "unowned away side is not charged to the national coach"); GameState home_association = fixture(); - home_association.memory.set16(::bmh::layout::CupDraw_FormatError_RuntimeField3, 0x16c); + home_association.memory.set16(::bmh::layout::ManagerRecord4Club, 0x16c); WatcomRandom home_rand(0xabcdef01); auto home_quote = accepted_quote(home_association, home_rand, 0x16c, true); NationalFriendlyBookingRequest home_request; @@ -237,7 +237,7 @@ void check_stale_and_source_association_payer() { home_game.calls() == home_before.calls(), "opponent refusal changes neither Native nor G"); GameState association = fixture(); - association.memory.set16(::bmh::layout::CupDraw_FormatError_RuntimeField3, 0x16c); + association.memory.set16(::bmh::layout::ManagerRecord4Club, 0x16c); WatcomRandom association_rand(0xabcdef01); auto association_quote = accepted_quote(association, association_rand, 0x16c, false); check(association_quote.terms.opponent_manager == 4 && diff --git a/tests/other_games_projection_tests.cpp b/tests/other_games_projection_tests.cpp index f1b460e..5140918 100644 --- a/tests/other_games_projection_tests.cpp +++ b/tests/other_games_projection_tests.cpp @@ -178,7 +178,7 @@ int main() { constexpr size_t national_backup = 4 * 0xb0c + 0x290; game.manager_records[national_backup] = 200; game.manager_records[national_backup + 1] = 0; - game.memory.set16(::bmh::layout::CupDraw_FormatError_RuntimeField3, 199); // stale raw cache deliberately disagrees with typed slot4. + game.memory.set16(::bmh::layout::ManagerRecord4Club, 199); // stale raw cache deliberately disagrees with typed slot4. game.memory.set16(::bmh::layout::SyntheticCupParticipantsBegin, 200); bool owned_foreign_rejected = false; try { (void)bmh::other_games_from_game(game, db, 0, 0, 0); } diff --git a/tests/team_statistics_source_oracle_tests.cpp b/tests/team_statistics_source_oracle_tests.cpp index e4f2fdc..eadb453 100644 --- a/tests/team_statistics_source_oracle_tests.cpp +++ b/tests/team_statistics_source_oracle_tests.cpp @@ -138,8 +138,8 @@ int main(int argc,char**argv){try{ actual=show(p); const std::array ranks{31,18,0}; for(int n=0;n<3;++n){int rank=ranks[size_t(n)],kind=1; - if(rank managers = {0}) { GameState g; g.memory.add_block(::bmh::layout::ManagerCount, 1); g.memory.set8(::bmh::layout::ManagerCount, uint8_t(managers.size())); - g.memory.add_block(::bmh::layout::CupDraw_FormatError_RuntimeField3, 2); - g.memory.set16(::bmh::layout::CupDraw_FormatError_RuntimeField3, 0); + g.memory.add_block(::bmh::layout::ManagerRecord4Club, 2); + g.memory.set16(::bmh::layout::ManagerRecord4Club, 0); g.manager_teams = std::move(managers); g.club_ids.assign(138, 0); g.club_names = {0}; @@ -127,10 +127,10 @@ void test_manager_and_national_original_club_scope() { managers.rows[1].player == second, "manager scope includes every active manager's club only"); auto national = empty_game({kNoTeam, 1}); - // Source's live ManagerCount/CupDraw_FormatError_RuntimeField3 counterparts can diverge from these loaded + // Source's live ManagerCount/ManagerRecord4Club counterparts can diverge from these loaded // StaticMemory bytes after the typed national-coach handoff. national.memory.set8(::bmh::layout::ManagerCount, 1); - national.memory.set16(::bmh::layout::CupDraw_FormatError_RuntimeField3, 2); + national.memory.set16(::bmh::layout::ManagerRecord4Club, 2); national.manager_records.assign(5 * 0xb0c, 0); national.manager_records[4 * 0xb0c + 0x290] = 0; national.manager_records[4 * 0xb0c + 0x291] = 0; @@ -345,8 +345,8 @@ void test_live_national_takeover_projection(const std::filesystem::path& data) { // Deliberately make the loaded StaticMemory copy disagree with the live // Source global; the native manager-record swap is authoritative. - if (!live.memory.has(::bmh::layout::CupDraw_FormatError_RuntimeField3)) live.memory.add_block(::bmh::layout::CupDraw_FormatError_RuntimeField3, 2); - live.memory.set16(::bmh::layout::CupDraw_FormatError_RuntimeField3, uint16_t((home + 1) % 138)); + if (!live.memory.has(::bmh::layout::ManagerRecord4Club)) live.memory.add_block(::bmh::layout::ManagerRecord4Club, 2); + live.memory.set16(::bmh::layout::ManagerRecord4Club, uint16_t((home + 1) % 138)); const auto native = save_stream(live); const auto w = session->rand(); const auto g = session->game(); const auto page = game::top_scorers_from_game(live, 0, game::TopScorersMetric::goals,