Skip to content

Commit b8a200a

Browse files
author
ruler501
committed
Fixed Multimonitor
1 parent 586e11c commit b8a200a

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

source/src/console.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,9 @@ struct obitlist : consolebuffer<oline>
296296
glPushMatrix();
297297
glLoadIdentity();
298298
glOrtho(0, VIRTW*ts, VIRTH*ts, 0, -1, 1);
299+
int origVIRTW = VIRTW;
300+
glTranslatef((float)ts*VIRTW*(monitors - 2 + (monitors&1))/(2.*monitors), 0., 0.);
301+
VIRTW /= (float)monitors/(float)(2 - (monitors & 1));
299302
int linei = 0, /*consumed = 0,*/ y = ts * VIRTH * .5f;
300303
// every line is 1 line
301304
linei = min(fullconsole ? FADEMAX : maxlines, conlines.length());
@@ -340,6 +343,7 @@ struct obitlist : consolebuffer<oline>
340343
popfont();
341344
}
342345
}
346+
VIRTW = origVIRTW;
343347
glPopMatrix();
344348
}
345349
} obits;

source/src/renderhud.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,10 @@ struct hudmessages : consolebuffer<hudline>
569569
if(!conlines.length()) return;
570570
glPushMatrix();
571571
glLoadIdentity();
572-
glOrtho(0, VIRTW*0.9f, VIRTH*0.9f, 0, -1, 1);
572+
int origVIRTW = VIRTW;
573+
glOrtho(0, origVIRTW*0.9f, VIRTH*0.9f, 0, -1, 1);
574+
glTranslatef((float)0.9f*origVIRTW*(monitors - 2 + (monitors&1))/(2.*monitors), 0., 0.);
575+
VIRTW /= (float)monitors/(float)(2 - (monitors & 1));
573576
int dispmillis = arenaintermission ? 6000 : 3000;
574577
loopi(min(conlines.length(), 3)) if(totalmillis-conlines[i].millis<dispmillis)
575578
{
@@ -578,6 +581,7 @@ struct hudmessages : consolebuffer<hudline>
578581
draw_text(c.line, int(tw > VIRTW*0.9f ? 0 : (VIRTW*0.9f-tw)/2), int(((VIRTH*0.9f)/4*3)+FONTH*i+pow((totalmillis-c.millis)/(float)dispmillis, 4)*VIRTH*0.9f/4.0f));
579582
}
580583
glPopMatrix();
584+
VIRTW = origVIRTW;
581585
}
582586
};
583587

@@ -1350,7 +1354,9 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
13501354
extern void r_accuracy(int h);
13511355
if (!spectating) r_accuracy(commandh);
13521356
if (hud_must_not_override(!hideconsole)) renderconsole();
1357+
VIRTW=origVIRTW;
13531358
if (show_hud_element(!hideobits, 6)) renderobits();
1359+
VIRTW /= (float)monitors/(float)(2 - (monitors & 1));
13541360
formatstring(enginestateinfo)("%d %d %d %d %d", curfps, lod_factor(), nquads, curvert, xtraverts);
13551361
if(showstats)
13561362
{
@@ -1533,7 +1539,10 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
15331539
if(menu) rendermenu();
15341540
else if(command) renderdoc(40, VIRTH, max(commandh*2 - VIRTH, 0));
15351541

1542+
VIRTW = origVIRTW;
15361543
if (hud_must_not_override(!hidehudmsgs)) hudmsgs.render();
1544+
VIRTW /= (float)monitors/(float)(2 - (monitors & 1));
1545+
15371546

15381547
if (!hidespecthud && !menu && focus->state == CS_DEAD && focus->spectatemode <= SM_DEATHCAM)
15391548
{
@@ -1634,12 +1643,11 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
16341643
}
16351644
}
16361645

1637-
VIRTW = origVIRTW;
1638-
16391646
// perk icons
16401647
glLoadIdentity();
1641-
glOrtho(0, VIRTW, VIRTH, 0, -1, 1);
1648+
glOrtho(0, origVIRTW, VIRTH, 0, -1, 1);
16421649
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1650+
glTranslatef((float)VIRTW*(monitors - 2 + (monitors&1))/(2.*monitors), 0., 0.);
16431651

16441652
if (show_hud_element(!hidehudequipment, 6))
16451653
{
@@ -1687,7 +1695,8 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
16871695
streakt[i][j] = textureload(path);
16881696
}
16891697
glLoadIdentity();
1690-
glOrtho(0, VIRTW * streakscale, VIRTH * streakscale, 0, -1, 1);
1698+
glOrtho(0, origVIRTW * streakscale, VIRTH * streakscale, 0, -1, 1);
1699+
glTranslatef((float)streakscale*origVIRTW*(monitors - 2 + (monitors&1))/(2.*monitors), 0., 0.);
16911700
// we have the blend function set by the perk icon
16921701
const int currentstreak = floor(focus->pointstreak / 5.f);
16931702
loopi(11){
@@ -1719,6 +1728,8 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
17191728
draw_textf("%d:\f%d%04.1f", (VIRTW - 620 - 40 - 50) * streakscale, (VIRTH - 50) * streakscale, stotal, stotal ? team_rel_color(focus, spl) : 5, sr / 1000.f);
17201729
}
17211730

1731+
VIRTW = origVIRTW;
1732+
17221733
glDisable(GL_BLEND);
17231734
glDisable(GL_TEXTURE_2D);
17241735
glEnable(GL_DEPTH_TEST);

0 commit comments

Comments
 (0)