Fix settings switches, training skill bars, editor placement and pointer

- Settings: every unlocked switch is stored, as in the original; the
  whitelist of cells with a consumer is gone (J9, O3, ... no longer
  refused). Locks and 0/1 / numeric limits still apply.
- Training: the seven skill bars show the player row under the pointer
  (FUN_00049399).
- Line-up: the field stays editable inside the set-piece editor while no
  taker kind is chosen.
- Pointer: the original 11x11 bitmap is the default pointer on every
  page, not only on the pitch page.

Refs #57, #59, #60, #62.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-11-04 19:44:46 +01:00
1 parent 04ff3b7656
commit af634ae8ff
10 files changed
+113 -67

No files matched your search

+1 -1
View File
@@ -46,7 +46,7 @@ FlowResult StartupFlow::move_action(int x, int y) {
: contracts_ && !player_card_ ? contracts_->move(x, y)
: matchday_results_ || in_readonly_view() || friendly_match_ ? false
: player_card_ ? false : pitch_ ? pitch_->move(x, y)
: lineup_ ? lineup_->move(x, y) : training_camp_ ? training_camp_->move(x, y)
: lineup_ ? lineup_->move(x, y) : training_ ? training_->move(x, y) : training_camp_ ? training_camp_->move(x, y)
: toto_ ? toto_->move(x, y)
: bank_ || stadium_ ? false
: !desktop_ && manager_ && !pending_ && !awaiting_context_ && manager_->move(x, y);
+4 -1
View File
@@ -657,8 +657,11 @@ PitchRequest PitchScreen::click(int x,int y,bool right){
r.set_piece_selector=shooter_selection_;r.expected_set_piece_value=extras_.set_piece_takers[size_t(shooter_selection_-2)];
pending_=r;return r;
}
if(!selected_)return {};
}
return {};
// OpenBMH extension: the field stays editable inside the editor. A click picks a taker
// only while a taker kind is chosen; otherwise (or with a player already marked for a
// move) the placement below works as on the normal page.
}
if(extras_.mode!=1&&order_panel_open_&&x>=243&&x<=315&&y>=179&&y<=226){
if(!selected_||*selected_>=11){rejection_="Für Anweisungen muss ein Startspieler markiert sein.";return {};}
+7
View File
@@ -169,6 +169,13 @@ int main(int argc,char**argv){try{
selector_copy.acknowledge(selected_lineup,selected);
check(selector_copy.state_json().find("\"shooter_selection\":1")!=std::string::npos,
"accepted taker write returns the original selector to neutral mode 1");
{
// the field stays editable inside the editor while no taker kind is chosen
const auto neutral_frame=selector_copy.render().pixels;
selector_copy.click(20,31);
check(selector_copy.render().pixels!=neutral_frame,
"inside the editor a click marks a player for placement when no taker kind is chosen");
}
auto automatic=selector_copy.click(260,215);
check(automatic.kind==PitchRequestKind::auto_set_piece_takers&&
automatic.expected_set_piece_values[0]==1&&automatic.expected_display_word==0x018b,
+28 -1
View File
@@ -250,7 +250,16 @@ Image TrainingScreen::render() const {
}
rect(out, 190, 222, 66, 6, 0x44);
text(out, 190, 220, texts_[(::bmh::layout::Training_Render_TextPointer4 - ::bmh::layout::TextPointerTable) / 4], 0x51, -1, false);
for (int i = 0; i < 7; ++i) copy(out, skill_atlas_, 256, 32, 190 + i * 10, 222, 16, 5, 0);
// FUN_00049399: seven bars, one per skill (two bits each of the player's skill word); each
// takes the atlas tile of its level 0-3, all empty while no player's row is under the pointer.
const auto hovered = hovered_row_ ? std::find_if(state_.players.begin(), state_.players.end(),
[&](const auto& p) { return p.row == *hovered_row_; })
: state_.players.end();
for (int i = 0; i < 7; ++i) {
const int level = hovered == state_.players.end() ? 0 : int(hovered->skills >> (2 * i) & 3);
const int sx = 256 + level * 16; // KB/2 is 314 wide: the last tile may be cut short
copy(out, skill_atlas_, sx, 32, 190 + i * 10, 222, std::min(16, skill_atlas_.width - sx), 5, 0);
}
// Int6: four original table-driven groups, transparent index DesktopRuntimeField=0.
for (int group = 0; group < 4; ++group) {
const int count = group == 3 ? int(state_.players.size()) : exe_.u8(::bmh::layout::Training_Click_RuntimeField7 + group);
@@ -347,6 +356,24 @@ TrainingRequest TrainingScreen::click(int x, int y, bool right) {
}
return {};
}
bool TrainingScreen::move(int x, int y) {
if (pending_) return false;
// The player group (3) of the click table: its box selects the row exactly as a click does.
std::optional<int> row;
const int count = int(state_.players.size());
const int bx = exe_.u16(::bmh::layout::Training_Click_RuntimeField + 3 * 2), by = exe_.u8(::bmh::layout::Training_Click_RuntimeField3 + 3);
const int dx = exe_.u8(::bmh::layout::Training_Click_RuntimeField8 + 3), dy = exe_.u8(::bmh::layout::Training_Click_RuntimeField9 + 3);
const int ball_dx = exe_.u8(::bmh::layout::Training_Click_RuntimeField5 + 3), ball_dy = exe_.u8(::bmh::layout::Training_Click_RuntimeField6 + 3);
if (x >= bx - 14 && y >= by && x < bx + count * dx + 3 * ball_dx && y < by + count * dy + 3 * ball_dy) {
const int index = dx ? (x - bx) / dx : (y - by) / dy;
if (index >= 0 && index < count &&
std::any_of(state_.players.begin(), state_.players.end(), [&](const auto& p) { return p.row == index; }))
row = index;
}
const bool changed = row != hovered_row_;
hovered_row_ = row;
return changed;
}
TrainingRequest TrainingScreen::key(std::string_view key) {
if (!pending_ && (key == "ESC" || key == "ESCAPE" || key == "BACKSPACE")) close_requested_ = true;
return {};
+4
View File
@@ -54,6 +54,9 @@ public:
Image render() const;
TrainingRequest click(int x, int y, bool right = false);
TrainingRequest key(std::string_view key);
// Original FUN_00049399: while the pointer rests on a player's row of the training list, the
// seven skill bars (T S S P Z F E) at the bottom show that player's skills; leaving it clears them.
bool move(int x, int y);
// Opening an uninitialized original screen invokes Initialize. This
// explicit request must be serviced by an engine adapter, never by render().
TrainingRequest initialize();
@@ -73,6 +76,7 @@ private:
std::optional<TrainingRequest> pending_;
bool close_requested_ = false;
std::string last_rejection_;
std::optional<int> hovered_row_;
void text(Image&, int x, int baseline, std::string_view, uint8_t color, int right = -1, bool shadow = true) const;
void sprite_text(Image&, int x, int baseline, std::string_view, int font) const;
void button(Image&, int x, int y, int width, int height, std::string_view, bool active) const;
+10
View File
@@ -66,6 +66,16 @@ int main(int argc, char** argv) {
"projection may not change original game tables");
TrainingScreen screen(data, s); const auto frame = screen.render().pixels;
check(frame == screen.render().pixels, "repeat rendering is deterministic and pure");
{
// FUN_00049399: the seven skill bars follow the player row under the pointer
const int bx = exe.u16(::bmh::layout::Training_Click_RuntimeField + 6), by = exe.u8(::bmh::layout::Training_Click_RuntimeField3 + 3);
const int dy = exe.u8(::bmh::layout::Training_Click_RuntimeField9 + 3);
TrainingScreen hover(data, s);
check(!hover.move(0, 0) && hover.render().pixels == frame, "a pointer off the list changes nothing");
check(hover.move(bx + 1, by + dy + 1) && hover.render().pixels != frame,
"the skill bars show the player row under the pointer");
check(hover.move(0, 0) && hover.render().pixels == frame, "the bars are empty again when the pointer leaves");
}
check(screen.click(175, 26).kind == TrainingRequestKind::none, "condition+technique cannot exceed four balls");
auto r = screen.click(155, 26);
check(r.kind == TrainingRequestKind::set_area && r.index == 0 && r.value == 1 && r.manager_slot == 1 &&