/* various data */
extern bool m_tandy;
extern int m_v6scale;
-extern int m_gfxScale;
+extern double m_gfxScale_w;
+extern double m_gfxScale_h;
extern ulong m_defaultFore;
extern ulong m_defaultBack;
extern ulong m_colours[11];
/* various data */
bool m_tandy = 0;
int m_v6scale;
-int m_gfxScale = 1;
+double m_gfxScale_w = 1.0;
+double m_gfxScale_h = 1.0;
ulong m_defaultFore;
ulong m_defaultBack;
ulong m_colours[11];
} else {
sf_picture *res = sf_getpic(picture);
if (res) {
- *height = m_gfxScale * res->height;
- *width = m_gfxScale * res->width;
+ *height = m_gfxScale_h * res->height;
+ *width = m_gfxScale_w * res->width;
return 1;
}
}
m_frequency = sf_GetProfileInt("Audio", "Frequency", m_frequency);
m_v6scale = sf_GetProfileInt("Display", "Infocom V6 Scaling", 2);
- m_gfxScale = 1;
+ m_gfxScale_w = 1.0;
+ m_gfxScale_h = 1.0;
m_defaultFore = (sf_GetProfileInt("Display", "Foreground", 0xffffff));
m_defaultBack = (sf_GetProfileInt("Display", "Background", 0x800000));
m_morePrompts =
sf_initvideo(AcWidth, AcHeight, (m_fullscreen != -1));
/* Set the graphics scaling */
- if (sf_IsInfocomV6() || (story_id == BEYOND_ZORK))
- m_gfxScale = m_v6scale;
- else
- m_gfxScale = 1;
+ if (sf_IsInfocomV6() || (story_id == BEYOND_ZORK)) {
+ m_gfxScale_w = (double)m_v6scale;
+ m_gfxScale_h = (double)m_v6scale;
+ } else {
+ m_gfxScale_w = 1.0;
+ m_gfxScale_h = 1.0;
+ }
+ m_gfxScale_w *= (double) AcWidth /640.0;
+ m_gfxScale_h *= (double) AcHeight /400.0;
/* Set the configuration */
if (z_header.version == V3) {
x--;
y--;
- ew = m_gfxScale * pic->width;
- eh = m_gfxScale * pic->height;
+ ew = m_gfxScale_w * pic->width;
+ eh = m_gfxScale_h * pic->height;
/* this takes care of the fact that x, y are really 16 bit values */
if (x & 0x8000)
}
if (x + ew > xmax)
ew = xmax - x;
- ew /= m_gfxScale;
+ ew /= m_gfxScale_w;
if (y < ymin) {
d = ymin - y;
}
if (y + eh > ymax)
eh = ymax - y;
- eh /= m_gfxScale;
+ eh /= m_gfxScale_h;
sf_setclip(ox, oy, ow, oh);
if (!pic->adaptive && ApplyPalette(pic))
sf_flushdisplay();
- for (yy = 0; yy < eh * m_gfxScale; yy++) {
- int ys = yy / m_gfxScale;
- for (xx = 0; xx < ew * m_gfxScale; xx++) {
- int xs = xx / m_gfxScale;
+ for (yy = 0; yy < eh * m_gfxScale_h; yy++) {
+ int ys = yy / m_gfxScale_h;
+ for (xx = 0; xx < ew * m_gfxScale_w; xx++) {
+ int xs = xx / m_gfxScale_w;
int index = pic->pixels[ys * pic->width + xs];
if (index != pic->transparentcolor)
sf_wpixel(x + xx, y + yy,
for (yy = 0; yy < eh; yy++) {
for (xx = 0; xx < ew; xx++) {
dst =
- sbuffer + x + xx * m_gfxScale +
- sbpitch * (y + yy * m_gfxScale);
+ sbuffer + x + (uint32_t)(xx * m_gfxScale_w) +
+ sbpitch * (y + (uint32_t)(yy * m_gfxScale_h));
sval = src[xx];
alpha = (sval >> 24);
if (alpha == 255)
sf_blend((int)
(alpha + (alpha >> 7)),
sval, dst[0]);
- for (iy = 0; iy < m_gfxScale; iy++) {
- for (ix = 0; ix < m_gfxScale; ix++)
+ for (iy = 0; iy < m_gfxScale_h; iy++) {
+ for (ix = 0; ix < m_gfxScale_w; ix++)
dst[ix] = dval;
dst += sbpitch;
}