Update DiceModalGame with a restricted board view and interactive dice challenge
This commit is contained in:
@@ -117,34 +117,43 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_board_perimeter(LowLevelRenderer* renderer, int width, int height, Player* players, int players_count, int currentPlayerPos = -1, int observer_idx = -1) {
|
||||
static void draw_board_perimeter(LowLevelRenderer* renderer, int width, int height, Player* players, int players_count, int currentPlayerPos = -1, int observer_idx = -1, int limit_start = -1, int limit_end = -1) {
|
||||
int cw = width / 7; // Corner width
|
||||
int ch = height / 7; // Corner height
|
||||
int rw = (width - 2 * cw) / 9; // Regular tile width
|
||||
int rh = (height - 2 * ch) / 9; // Regular tile height
|
||||
|
||||
auto should_draw = [&](int index) {
|
||||
if (limit_start == -1 || limit_end == -1) return true;
|
||||
if (limit_start <= limit_end) {
|
||||
return index >= limit_start && index <= limit_end;
|
||||
} else {
|
||||
return index >= limit_start || index <= limit_end;
|
||||
}
|
||||
};
|
||||
|
||||
// --- Bottom Row: 0 to 10 (Right to Left) ---
|
||||
draw_tile(renderer, width - cw, height - ch, cw, ch, 0, true, players, players_count, 0, currentPlayerPos, observer_idx); // GO
|
||||
if (should_draw(0)) draw_tile(renderer, width - cw, height - ch, cw, ch, 0, true, players, players_count, 0, currentPlayerPos, observer_idx); // GO
|
||||
for (int i = 1; i < 10; ++i) {
|
||||
draw_tile(renderer, width - cw - i * rw, height - ch, rw, ch, i, false, players, players_count, 0, currentPlayerPos, observer_idx);
|
||||
if (should_draw(i)) draw_tile(renderer, width - cw - i * rw, height - ch, rw, ch, i, false, players, players_count, 0, currentPlayerPos, observer_idx);
|
||||
}
|
||||
draw_tile(renderer, 0, height - ch, cw, ch, 10, true, players, players_count, 1, currentPlayerPos, observer_idx); // JAIL
|
||||
if (should_draw(10)) draw_tile(renderer, 0, height - ch, cw, ch, 10, true, players, players_count, 1, currentPlayerPos, observer_idx); // JAIL
|
||||
|
||||
// --- Left Column: 11 to 19 (Bottom to Top) ---
|
||||
for (int i = 11; i < 20; ++i) {
|
||||
draw_tile(renderer, 0, height - ch - (i - 10) * rh, cw, rh, i, false, players, players_count, 1, currentPlayerPos, observer_idx);
|
||||
if (should_draw(i)) draw_tile(renderer, 0, height - ch - (i - 10) * rh, cw, rh, i, false, players, players_count, 1, currentPlayerPos, observer_idx);
|
||||
}
|
||||
|
||||
// --- Top Row: 20 to 30 (Left to Right) ---
|
||||
draw_tile(renderer, 0, 0, cw, ch, 20, true, players, players_count, 2, currentPlayerPos, observer_idx); // FREE PARKING
|
||||
if (should_draw(20)) draw_tile(renderer, 0, 0, cw, ch, 20, true, players, players_count, 2, currentPlayerPos, observer_idx); // FREE PARKING
|
||||
for (int i = 21; i < 30; ++i) {
|
||||
draw_tile(renderer, cw + (i - 21) * rw, 0, rw, ch, i, false, players, players_count, 2, currentPlayerPos, observer_idx);
|
||||
if (should_draw(i)) draw_tile(renderer, cw + (i - 21) * rw, 0, rw, ch, i, false, players, players_count, 2, currentPlayerPos, observer_idx);
|
||||
}
|
||||
draw_tile(renderer, width - cw, 0, cw, ch, 30, true, players, players_count, 3, currentPlayerPos, observer_idx); // GO TO JAIL
|
||||
if (should_draw(30)) draw_tile(renderer, width - cw, 0, cw, ch, 30, true, players, players_count, 3, currentPlayerPos, observer_idx); // GO TO JAIL
|
||||
|
||||
// --- Right Column: 31 to 39 (Top to Bottom) ---
|
||||
for (int i = 31; i < 40; ++i) {
|
||||
draw_tile(renderer, width - cw, ch + (i - 31) * rh, cw, rh, i, false, players, players_count, 3, currentPlayerPos, observer_idx);
|
||||
if (should_draw(i)) draw_tile(renderer, width - cw, ch + (i - 31) * rh, cw, rh, i, false, players, players_count, 3, currentPlayerPos, observer_idx);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user