Use the common 3.7 environment model and source-language contract tabs (by Codex)

This commit is contained in:
Codex committed 2026-11-02 23:15:49 +01:00
1 parent 249bdca1a8
commit 048f617395
11 files changed
+72 -17

No files matched your search

+1 -1
View File
@@ -396,7 +396,7 @@ Image ContractsScreen::render() const {
}
const auto selected = std::find_if(state_.players.begin(), state_.players.end(),
[&](const auto& p) { return p.row == state_.selected_row; });
static constexpr std::array<std::string_view, 4> tabs{"DATEN-A", "DATEN-B", "GEHALT", "TEAM-PRÄMIEN"};
const std::array<std::string,4> tabs{original_to_utf8(texts_[117]),original_to_utf8(texts_[118]),original_to_utf8(texts_[119]),original_to_utf8(texts_[120])};
for (int i = 0; i < (state_.mode_three?4:3); ++i) {
const int x = i * 60 + 2, w = i == 3 ? 71 : 51;
if(i!=tab_) {fill(out,x+2,225,w,2,0x40);fill(out,x+w,217,2,10,0x40);}
+17
View File
@@ -1,6 +1,9 @@
// SPDX-License-Identifier: GPL-3.0-only
#include "ui/contracts.hpp"
#include "ui/source_notice_test_helpers.hpp"
#include "ui/manager.hpp"
#include "formats/executable_layout.hpp"
#include "formats/textd.hpp"
#include <stdexcept>
@@ -23,6 +26,20 @@ int main(int argc, char** argv) {
state.club_name = "UNIT FOOTBALL CLUB";
state.players.push_back({0, 150, "TORWART", 25, 0, 8, 180000});
state.players.push_back({1, 151, "STÜRMER", 21, 3, 14, 90000});
{
auto language_state=state;language_state.mode_three=true;
ContractsScreen language(argv[1],language_state);const auto frame=language.render();
const auto data=std::filesystem::path(argv[1]);const auto exe=bmh::load_le(asset_path(data,"BMH.exe"));
const auto texts=bmh::load_textd(asset_path(data,"TEXTD.BLK"));SpriteFont source_font(data);
for(int tab=0;tab<4;++tab) {
const auto caption=original_to_utf8(texts[size_t(117+tab)]);const int width=tab==3?71:51;
const int x=tab*60+2+(tab==2?2:0),y=215+(tab==2?2:0);
bmh::Image expected(320,240,0xfd);
source_font.draw(expected,x+width/2-source_font.text_width(caption)/2,y+7,caption,exe.u8(bmh::layout::Advertising_Button_RuntimeField+(tab==2)));
size_t ink=0;for(size_t pixel=0;pixel<expected.pixels.size();++pixel)if(expected.pixels[pixel]!=0xfd){check(frame.pixels[pixel]==expected.pixels[pixel],"contract tab does not render its authoritative source-language caption");++ink;}
check(ink>10,"source-language contract tab oracle contains no glyphs");
}
}
auto blocked_state = state;
blocked_state.players[0].offer_blocked = true;
ContractsScreen blocked(argv[1], blocked_state);
+2
View File
@@ -157,6 +157,8 @@ EnvironmentScreen::EnvironmentScreen(const std::filesystem::path& data, Environm
background_.height != 240 || tiles_.width != 306 || tiles_.height != 111 ||
panel_.width <= 0 || texts_.strings.size() != TEXT_COUNT)
throw FormatError("environment: unsupported owner or Original assets");
for(int item=0;item<kEnvironmentItems;++item){const int x=exe_.u8(layout::Environment_FormatError_RuntimeField+item),y=exe_.u8(layout::Environment_FormatError_RuntimeField2+item);
if(x<9||x+0x36>=320||y<10||y+0x31+(item<3?6:0)>=240)throw FormatError("environment: tile geometry outside Original screen");}
}
void EnvironmentScreen::text(Image& out, int x, int baseline, std::string_view value,