[Scummvm-cvs-logs] CVS: scummvm gfx.cpp,1.85,1.86 scumm.h,1.154,1.155 scummvm.cpp,1.141,1.142 sdl.cpp,1.113,1.114 verbs.cpp,1.24,1.25
James Brown
ender at users.sourceforge.net
Tue May 7 11:45:02 CEST 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv13867
Modified Files:
gfx.cpp scumm.h scummvm.cpp sdl.cpp verbs.cpp
Log Message:
Beginning of support for multiple resolutions.
Makes Zak256 inventory scrolling work.
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gfx.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- gfx.cpp 5 May 2002 18:46:04 -0000 1.85
+++ gfx.cpp 7 May 2002 18:44:34 -0000 1.86
@@ -28,22 +28,22 @@
int i;
for (i = 10; i != 0; i--) {
- initScreens(0, 0, 320, 200);
+ initScreens(0, 0, _realWidth, _realHeight); //ender
}
_vars[VAR_PERFORMANCE_1] = 0; //_scummTimer;
for (i = 10; i != 0; i--) {
- setDirtyRange(0, 0, 200);
+ setDirtyRange(0, 0, _realHeight); //ender
drawDirtyScreenParts();
}
_vars[VAR_PERFORMANCE_2] = 0; //_scummTimer;
if (_gameId == GID_DIG)
- initScreens(0, 0, 320, 200);
+ initScreens(0, 0, _realWidth, _realHeight);
else
- initScreens(0, 16, 320, 144);
+ initScreens(0, 16, _realWidth, 144);
}
void Scumm::initScreens(int a, int b, int w, int h)
@@ -56,11 +56,11 @@
}
if (!getResourceAddress(rtBuffer, 4)) {
- initVirtScreen(3, 0, 80, 320, 13, false, false);
+ initVirtScreen(3, 0, 80, _realWidth, 13, false, false);
}
- initVirtScreen(0, 0, b, 320, h - b, true, true);
- initVirtScreen(1, 0, 0, 320, b, false, false);
- initVirtScreen(2, 0, h, 320, 200 - h, false, false);
+ initVirtScreen(0, 0, b, _realWidth, h - b, true, true);
+ initVirtScreen(1, 0, 0, _realWidth, b, false, false);
+ initVirtScreen(2, 0, h, _realWidth, _realHeight - h, false, false); //ender
_screenB = b;
_screenH = h;
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -d -r1.154 -r1.155
--- scumm.h 5 May 2002 20:04:25 -0000 1.154
+++ scumm.h 7 May 2002 18:44:34 -0000 1.155
@@ -931,7 +931,8 @@
/* Should be in Verb class */
- uint16 _verbMouseOver;
+ uint16 _verbMouseOver;
+ int _inventoryOffset;
void redrawVerbs();
void checkExecVerbs();
void verbMouseOver(int verb);
@@ -1129,7 +1130,7 @@
/* Should be in Graphics class? */
uint16 _screenB, _screenH;
- int _scrHeight, _scrWidth;
+ int _scrHeight, _scrWidth, _realHeight, _realWidth;
VirtScreen virtscr[4]; // Virtual screen areas
CameraData camera; // 'Camera' - viewport
ColorCycle _colorCycle[16]; // Palette cycles
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -d -r1.141 -r1.142
--- scummvm.cpp 6 May 2002 15:32:32 -0000 1.141
+++ scummvm.cpp 7 May 2002 18:44:34 -0000 1.142
@@ -876,7 +876,7 @@
} else if (_lastKeyHit == 93) { // ], eg volume down
_sound_volume_master+=5;
if (_sound_volume_master > 128)
- _sound_volume_master = 128;
+ _sound_volume_master = 128;
_imuse->set_master_volume(_sound_volume_master);
} else if (_lastKeyHit == 45) { // -, eg text speed down
_defaultTalkDelay+=5;
@@ -905,12 +905,12 @@
if (mouse.x < 0)
mouse.x = 0;
- if (mouse.x > 319)
- mouse.x = 319;
+ if (mouse.x > _realWidth-1)
+ mouse.x = _realWidth-1;
if (mouse.y < 0)
mouse.y = 0;
- if (mouse.y > 199)
- mouse.y = 199;
+ if (mouse.y > _realHeight-1)
+ mouse.y = _realHeight-1;
if (_leftBtnPressed & msClicked && _rightBtnPressed & msClicked) {
_mouseButStat = 0;
@@ -1372,8 +1372,17 @@
scumm->_system = syst;
+
+ if (detector->_gameId == GID_ZAK256) { // FmTowns is 320x240
+ scumm->_realWidth = 320;
+ scumm->_realHeight = 240;
+ } else {
+ scumm->_realWidth = 320;
+ scumm->_realHeight = 200;
+ }
+
/* This initializes SDL */
- syst->init_size(320,200);
+ syst->init_size(scumm->_realWidth, scumm->_realHeight);
prop.cd_num = detector->_cdrom;
syst->property(OSystem::PROP_OPEN_CD, &prop);
Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl.cpp,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- sdl.cpp 4 May 2002 09:55:10 -0000 1.113
+++ sdl.cpp 7 May 2002 18:44:34 -0000 1.114
@@ -127,15 +127,16 @@
enum {
NUM_DIRTY_RECT = 100,
- SCREEN_WIDTH = 320,
- SCREEN_HEIGHT = 200,
- CKSUM_NUM = (SCREEN_WIDTH*SCREEN_HEIGHT/(8*8)),
+ //SCREEN_WIDTH = 320,
+ //SCREEN_HEIGHT = 240,
+ //CKSUM_NUM = (SCREEN_WIDTH*SCREEN_HEIGHT/(8*8)),
MAX_MOUSE_W = 40,
MAX_MOUSE_H = 40,
MAX_SCALING = 3,
};
+ int SCREEN_WIDTH, SCREEN_HEIGHT, CKSUM_NUM;
SDL_Rect *dirty_rect_list;
int num_dirty_rects;
uint32 *dirty_checksums;
@@ -302,15 +303,15 @@
break;
}
- sdl_screen = SDL_CreateRGBSurface(SDL_SWSURFACE, 320, 200, 8, 0, 0, 0, 0);
+ sdl_screen = SDL_CreateRGBSurface(SDL_SWSURFACE, SCREEN_WIDTH, SCREEN_HEIGHT, 8, 0, 0, 0, 0);
if (sdl_screen == NULL)
error("sdl_screen failed failed");
if (_sai_func) {
- uint16 *tmp_screen = (uint16*)calloc((320+3)*(200+3),sizeof(uint16));
+ uint16 *tmp_screen = (uint16*)calloc((SCREEN_WIDTH+3)*(SCREEN_HEIGHT+3),sizeof(uint16));
_mode_flags = DF_FORCE_FULL_ON_PALETTE | DF_WANT_RECT_OPTIM | DF_2xSAI | DF_SEPARATE_TEMPSCREEN | DF_UPDATE_EXPAND_1_PIXEL;
- sdl_hwscreen = SDL_SetVideoMode(320 * scaling, 200 * scaling, 16,
+ sdl_hwscreen = SDL_SetVideoMode(SCREEN_WIDTH * scaling, SCREEN_HEIGHT * scaling, 16,
_full_screen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
);
if (sdl_hwscreen == NULL)
@@ -322,7 +323,7 @@
else
Init_2xSaI(565);
sdl_tmpscreen = SDL_CreateRGBSurfaceFrom(tmp_screen,
- 320 + 3, 200 + 3, 16, (320 + 3)*2,
+ SCREEN_WIDTH + 3, SCREEN_HEIGHT + 3, 16, (SCREEN_WIDTH + 3)*2,
sdl_hwscreen->format->Rmask,
sdl_hwscreen->format->Gmask,
sdl_hwscreen->format->Bmask,
@@ -347,7 +348,7 @@
_mode_flags = DF_WANT_RECT_OPTIM;
- sdl_hwscreen = SDL_SetVideoMode(320 * scaling, 200 * scaling, 8,
+ sdl_hwscreen = SDL_SetVideoMode(SCREEN_WIDTH * scaling, SCREEN_HEIGHT * scaling, 8,
_full_screen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
);
if (sdl_hwscreen == NULL)
@@ -373,9 +374,12 @@
}
void OSystem_SDL::init_size(uint w, uint h) {
- if (w != SCREEN_WIDTH && h != SCREEN_HEIGHT)
- error("320x200 is the only game resolution supported");
+ //if (w != SCREEN_WIDTH && h != SCREEN_HEIGHT)
+ // error("320x200 is the only game resolution supported");
+ SCREEN_WIDTH = w;
+ SCREEN_HEIGHT = h;
+ CKSUM_NUM = (SCREEN_WIDTH*SCREEN_HEIGHT/(8*8));
/* allocate palette, it needs to be persistent across
* driver changes, so i'll alloc it here */
_cur_pal = (SDL_Color*)calloc(sizeof(SDL_Color), 256);
@@ -417,10 +421,10 @@
if (SDL_LockSurface(sdl_screen) == -1)
error("SDL_LockSurface failed: %s.\n", SDL_GetError());
- byte *dst = (byte *)sdl_screen->pixels + y * 320 + x;
+ byte *dst = (byte *)sdl_screen->pixels + y * SCREEN_WIDTH + x;
do {
memcpy(dst, buf, w);
- dst += 320;
+ dst += SCREEN_WIDTH;
buf += pitch;
} while (--h);
@@ -463,14 +467,14 @@
#define DOLINE(x) a ^= ((uint32*)buf)[0+(x)*(SCREEN_WIDTH/4)]; b ^= ((uint32*)buf)[1+(x)*(SCREEN_WIDTH/4)]
void OSystem_SDL::mk_checksums(const byte *buf) {
uint32 *sums = dirty_checksums;
- uint x,y;
+ int x,y;
/* the 8x8 blocks in buf are enumerated starting in the top left corner and
* reading each line at a time from left to right */
for(y=0; y!=SCREEN_HEIGHT/8; y++,buf+=SCREEN_WIDTH*(8-1))
for(x=0; x!=SCREEN_WIDTH/8; x++,buf+=8) {
- uint32 a = x;
- uint32 b = y;
+ int32 a = x;
+ int32 b = y;
DOLINE(0); ROL(a,13); ROL(b,11);
DOLINE(2); ROL(a,13); ROL(b,11);
@@ -508,7 +512,7 @@
and add all dirty rectangles to a list. try to combine small rectangles
into bigger ones in a simple way */
if (!force_full) {
- uint x,y,w;
+ int x,y,w;
uint32 *ck = dirty_checksums;
for(y=0; y!=SCREEN_HEIGHT/8; y++) {
@@ -827,7 +831,7 @@
if (SDL_LockSurface(sdl_screen) == -1)
error("SDL_LockSurface failed: %s.\n", SDL_GetError());
- memcpy(buf, sdl_screen->pixels, 320*200);
+ memcpy(buf, sdl_screen->pixels, SCREEN_WIDTH*SCREEN_HEIGHT);
SDL_UnlockSurface(sdl_screen);
}
@@ -838,7 +842,7 @@
* then draw that to the new screen right after it's setup.
*/
- byte *bak_mem = (byte*)malloc(320*200);
+ byte *bak_mem = (byte*)malloc(SCREEN_WIDTH*SCREEN_HEIGHT);
get_320x200_image(bak_mem);
@@ -851,7 +855,7 @@
SDL_SetColors(sdl_palscreen, _cur_pal, 0, 256);
/* blit image */
- OSystem_SDL::copy_rect(bak_mem, 320, 0, 0, 320, 200);
+ OSystem_SDL::copy_rect(bak_mem, SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
free(bak_mem);
OSystem_SDL::update_screen();
@@ -937,12 +941,12 @@
_ms_old.x = xdraw;
_ms_old.y = ydraw;
- dst = (byte *)sdl_screen->pixels + ydraw * 320 + xdraw;
+ dst = (byte *)sdl_screen->pixels + ydraw * SCREEN_WIDTH + xdraw;
- for (y = 0; y < h; y++, dst += 320, bak += MAX_MOUSE_W, buf += w) {
- if ((uint) (ydraw + y) < 200) {
+ for (y = 0; y < h; y++, dst += SCREEN_WIDTH, bak += MAX_MOUSE_W, buf += w) {
+ if ((ydraw + y) < SCREEN_HEIGHT) {
for (x = 0; x < w; x++) {
- if ((uint) (xdraw + x) < 320) {
+ if ((xdraw + x) < SCREEN_WIDTH) {
bak[x] = dst[x];
if ((color = buf[x]) != 0xFF) {
dst[x] = color;
@@ -972,12 +976,12 @@
const int old_mouse_h = _ms_old.h;
int x,y;
- dst = (byte *)sdl_screen->pixels + old_mouse_y * 320 + old_mouse_x;
+ dst = (byte *)sdl_screen->pixels + old_mouse_y * SCREEN_WIDTH + old_mouse_x;
- for (y = 0; y < old_mouse_h; y++, bak += MAX_MOUSE_W, dst += 320) {
- if ((uint) (old_mouse_y + y) < 200) {
+ for (y = 0; y < old_mouse_h; y++, bak += MAX_MOUSE_W, dst += SCREEN_WIDTH) {
+ if ((old_mouse_y + y) < SCREEN_HEIGHT) {
for (x = 0; x < old_mouse_w; x++) {
- if ((uint) (old_mouse_x + x) < 320) {
+ if ((old_mouse_x + x) < SCREEN_WIDTH) {
dst[x] = bak[x];
}
}
Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/verbs.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- verbs.cpp 11 Apr 2002 17:19:15 -0000 1.24
+++ verbs.cpp 7 May 2002 18:44:34 -0000 1.25
@@ -63,6 +63,12 @@
runInputScript(2, 0, code);
} else {
over = checkMouseOver(mouse.x, mouse.y);
+
+ // FIXME For the future: Indy3 and under inv scrolling
+ /*
+ if (over >= 31 && over <= 36)
+ over += _inventoryOffset;
+ */
runInputScript(1, over != 0 ? _verbs[over].verbid : 0, code);
}
}
@@ -137,6 +143,12 @@
string[4].color = color;
if (vs->curmode == 2)
string[4].color = vs->dimcolor;
+
+ // FIXME For the future: Indy3 and under inv scrolling
+ /*
+ if (vrb >= 31 && vrb <= 36)
+ vrb += _inventoryOffset;
+ */
_messagePtr = getResourceAddress(rtVerb, vrb);
assert(_messagePtr);
More information about the Scummvm-git-logs
mailing list