mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-29 19:40:35 +00:00
racing:: subscreens used with multiple players
This commit is contained in:
parent
16a5e45c0a
commit
f6226665d0
@ -5689,7 +5689,11 @@ void gamescreen(int _darken) {
|
|||||||
current_display->set_viewport(0);
|
current_display->set_viewport(0);
|
||||||
compute_graphical_distance();
|
compute_graphical_distance();
|
||||||
gamescreen(_darken);
|
gamescreen(_darken);
|
||||||
})) return;
|
})) {
|
||||||
|
current_display->set_projection(0, false);
|
||||||
|
current_display->set_viewport(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if((cmode & sm::MAYDARK) && !current_display->sidescreen) {
|
if((cmode & sm::MAYDARK) && !current_display->sidescreen) {
|
||||||
_darken += 2;
|
_darken += 2;
|
||||||
|
39
racing.cpp
39
racing.cpp
@ -375,9 +375,46 @@ void show() {
|
|||||||
dialog::display();
|
dialog::display();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
vector<display_data> player_displays;
|
||||||
|
bool in_subscreen;
|
||||||
|
|
||||||
void prepare_subscreens() {
|
void prepare_subscreens() {
|
||||||
|
int N = multi::players;
|
||||||
|
if(N > 1) {
|
||||||
|
player_displays.resize(N, *current_display);
|
||||||
|
int qrows[10] = {1, 1, 1, 1, 2, 2, 2, 3, 3, 3};
|
||||||
|
int rows = qrows[N];
|
||||||
|
int cols = (N + rows - 1) / rows;
|
||||||
|
for(int i=0; i<N; i++) {
|
||||||
|
auto& pd = player_displays[i];
|
||||||
|
pd.xmin = (i % cols) * 1. / cols;
|
||||||
|
pd.xmax = ((i % cols) + 1.) / cols;
|
||||||
|
pd.ymin = (i / cols) * 1. / rows;
|
||||||
|
pd.ymax = ((i / cols) + 1.) / rows;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
player_displays.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool subscreen_split(reaction_t what) {
|
||||||
|
using namespace racing;
|
||||||
|
if(in_subscreen) return false;
|
||||||
|
if(!player_displays.empty()) {
|
||||||
|
in_subscreen = true;
|
||||||
|
int& p = current_player;
|
||||||
|
for(p = 0; p < multi::players; p++) {
|
||||||
|
dynamicval<display_data*> c(current_display, &player_displays[p]);
|
||||||
|
what();
|
||||||
|
}
|
||||||
|
in_subscreen = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user