Make screensize independent on screen resolution

This commit is contained in:
nukeykt 2019-10-29 23:17:15 +09:00 committed by Christoph Oelckers
parent eea4fa80f1
commit 308f36d0e8
4 changed files with 17 additions and 37 deletions

View file

@ -752,14 +752,15 @@ int MyGetStringWidth(const char *str)
void UpdateScreenSize()
{
int v0 = ydim * screensize / xdim;
int y1 = ((ydim >> 1) - (v0 >> 1));
int xsize = xdim - scale(screensize*16, xdim, 320);
int ysize = scale(ydim, xsize, xdim);
int y1 = ((ydim >> 1) - (ysize >> 1));
MySetView(
(xdim >> 1) - (screensize >> 1),
(xdim >> 1) - (xsize >> 1),
y1,
(xdim >> 1) - (screensize >> 1) + screensize - 1,
(y1 + v0 - 1));
(xdim >> 1) - (xsize >> 1) + xsize - 1,
(y1 + ysize - 1));
RefreshStatus();
}
@ -894,14 +895,7 @@ void CheckKeys()
if (BUTTON(gamefunc_Enlarge_Screen))
{
if (bHiRes) {
eax = 32;
}
else {
eax = 16;
}
if (screensize == xdim)
if (screensize == 0)
{
if (!bFullScreen)
{
@ -911,9 +905,9 @@ void CheckKeys()
}
else
{
screensize += eax;
if (screensize > xdim) {
screensize = xdim;
screensize--;
if (screensize < 0) {
screensize = 0;
}
UpdateScreenSize();
@ -955,19 +949,14 @@ void CheckKeys()
if (BUTTON(gamefunc_Shrink_Screen))
{
if (bHiRes)
eax = 32;
else
eax = 16;
if (bFullScreen)
{
bFullScreen = kFalse;
}
else
{
if ((screensize - eax) > (xdim >> 2))
screensize -= eax;
if ((screensize + 1) < 15)
screensize++;
}
UpdateScreenSize();

View file

@ -1229,12 +1229,8 @@ int myloadconfig()
fread(&nGamma, sizeof(nGamma), 1, fp);
fread(&lMouseSens, sizeof(lMouseSens), 1, fp);
if (bHiRes) {
screensize *= 2;
}
if (screensize > xdim || screensize < xdim >> 2) {
screensize = xdim;
if (screensize < 0 || screensize > 15) {
screensize = 0;
}
fclose(fp);
@ -1262,11 +1258,6 @@ int mysaveconfig()
short nSize = screensize;
if (bHiRes)
{
nSize = screensize / 2;
}
fwrite(&nSize, sizeof(nSize), 1, fp);
fwrite(&bFullScreen, sizeof(bFullScreen), 1, fp);
fwrite(&nGamma, sizeof(nGamma), 1, fp);

View file

@ -473,7 +473,7 @@ void MoveStatus()
message_timer -= 4;
if (message_timer <= 0)
{
if (screensize < xdim) {
if (screensize > 0) {
textpages = numpages;
}
@ -644,7 +644,7 @@ void StatusMessage(int messageTime, const char *fmt, ...)
vsprintf(message_text, fmt, args);
if (screensize < xdim) {
if (screensize > 0) {
textpages = numpages;
}
}

View file

@ -62,7 +62,7 @@ short nEnemyPal = 0;
void InitView()
{
screensize = (short)xdim;
screensize = 0;
#ifdef USE_OPENGL
polymostcenterhoriz = 92;
#endif