[Scummvm-cvs-logs] CVS: scummvm/scumm scumm.h,1.62,1.63 scummvm.cpp,1.72,1.73 gfx.cpp,1.59,1.60
Max Horn
fingolfin at users.sourceforge.net
Sun Nov 10 09:20:02 CET 2002
Update of /cvsroot/scummvm/scummvm/scumm
In directory usw-pr-cvs1:/tmp/cvs-serv24626/scumm
Modified Files:
scumm.h scummvm.cpp gfx.cpp
Log Message:
completly decoupled engine.h/.cpp from simon.h and scumm.h; removed some static variables from drawFlashlight() and made them members of class Scumm instead
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- scumm.h 10 Nov 2002 14:59:15 -0000 1.62
+++ scumm.h 10 Nov 2002 17:19:43 -0000 1.63
@@ -714,6 +714,10 @@
byte _newEffect, _switchRoomEffect2, _switchRoomEffect;
bool _doEffect;
+ struct {
+ int x, y, w, h;
+ byte *buffer;
+ } _flashlight;
uint16 _flashlightXStrips, _flashlightYStrips;
bool _flashlightIsDrawn;
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- scummvm.cpp 10 Nov 2002 14:59:15 -0000 1.72
+++ scummvm.cpp 10 Nov 2002 17:19:43 -0000 1.73
@@ -51,6 +51,26 @@
g_scumm->_doAutosave = true;
}
+Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst)
+{
+ Engine *engine;
+
+ if (detector->_features & GF_OLD_BUNDLE)
+ engine = new Scumm_v2(detector, syst);
+ else if (detector->_features & GF_OLD256)
+ engine = new Scumm_v3(detector, syst);
+ else if (detector->_features & GF_SMALL_HEADER) // this forces loomCD as v4
+ engine = new Scumm_v4(detector, syst);
+ else if (detector->_features & GF_AFTER_V7)
+ engine = new Scumm_v7(detector, syst);
+ else if (detector->_features & GF_AFTER_V6) // this forces SamnmaxCD as v6
+ engine = new Scumm_v6(detector, syst);
+ else
+ engine = new Scumm_v5(detector, syst);
+
+ return engine;
+}
+
void Scumm::initRandSeeds()
{
_randSeed1 = 0xA943DE33;
@@ -265,6 +285,7 @@
_vars[VAR_CURRENT_LIGHTS] = LIGHTMODE_actor_base | LIGHTMODE_actor_color | LIGHTMODE_screen;
_flashlightXStrips = 7;
_flashlightYStrips = 7;
+ _flashlight.buffer = NULL;
}
mouse.x = 104;
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- gfx.cpp 10 Nov 2002 15:42:53 -0000 1.59
+++ gfx.cpp 10 Nov 2002 17:19:43 -0000 1.60
@@ -612,26 +612,23 @@
void Scumm::drawFlashlight()
{
- static byte *flashBuffer = NULL;
- static int flashX, flashY, flashW, flashH;
-
int i, j, offset;
// Remove the flash light first if it was previously drawn
if (_flashlightIsDrawn) {
- updateDirtyRect(0, flashX<<3, (flashX+flashW)<<3, flashY, flashY+flashH, 0x80000000);
+ updateDirtyRect(0, _flashlight.x<<3, (_flashlight.x+_flashlight.w)<<3, _flashlight.y, _flashlight.y+_flashlight.h, 0x80000000);
- if (flashBuffer) {
+ if (_flashlight.buffer) {
- offset = _realWidth - flashW*8;
- i = flashH;
+ offset = _realWidth - _flashlight.w*8;
+ i = _flashlight.h;
do {
- j = flashW*2;
+ j = _flashlight.w*2;
do {
- *(uint32 *)flashBuffer = 0;
- flashBuffer += 4;
+ *(uint32 *)_flashlight.buffer = 0;
+ _flashlight.buffer += 4;
} while (--j);
- flashBuffer += offset;
+ _flashlight.buffer += offset;
} while (--i);
}
@@ -643,50 +640,50 @@
// Calculate the area of the flashlight
Actor *a = a = derefActorSafe(_vars[VAR_EGO], "drawFlashlight");
- flashW = _flashlightXStrips;
- flashH = _flashlightYStrips * 8;
- flashX = a->x/8 - flashW/2 - _screenStartStrip;
- flashY = a->y - flashH/2;
+ _flashlight.w = _flashlightXStrips;
+ _flashlight.h = _flashlightYStrips * 8;
+ _flashlight.x = a->x/8 - _flashlight.w/2 - _screenStartStrip;
+ _flashlight.y = a->y - _flashlight.h/2;
// Clip the flashlight at the borders
- if (flashX < 0)
- flashX = 0;
- else if (flashX > gdi._numStrips - flashW)
- flashX = gdi._numStrips - flashW;
- if (flashY < 0)
- flashY = 0;
- else if (flashY > virtscr[0].height - flashH)
- flashY = virtscr[0].height - flashH;
+ if (_flashlight.x < 0)
+ _flashlight.x = 0;
+ else if (_flashlight.x > gdi._numStrips - _flashlight.w)
+ _flashlight.x = gdi._numStrips - _flashlight.w;
+ if (_flashlight.y < 0)
+ _flashlight.y = 0;
+ else if (_flashlight.y > virtscr[0].height - _flashlight.h)
+ _flashlight.y = virtscr[0].height - _flashlight.h;
// Redraw any actors "under" the flashlight
- for (i = flashX; i < flashX+flashW; i++) {
+ for (i = _flashlight.x; i < _flashlight.x+_flashlight.w; i++) {
gfxUsageBits[_screenStartStrip + i] |= 0x80000000;
virtscr[0].tdirty[i] = 0;
virtscr[0].bdirty[i] = virtscr[0].height;
}
byte *bgbak;
- offset = flashY * _realWidth + virtscr[0].xstart + flashX * 8;
- flashBuffer = virtscr[0].screenPtr + offset;
+ offset = _flashlight.y * _realWidth + virtscr[0].xstart + _flashlight.x * 8;
+ _flashlight.buffer = virtscr[0].screenPtr + offset;
bgbak = getResourceAddress(rtBuffer, 5) + offset;
- blit(flashBuffer, bgbak, flashW*8, flashH);
+ blit(_flashlight.buffer, bgbak, _flashlight.w*8, _flashlight.h);
// Round the corners. To do so, we simply hard-code a set of nicely
// rounded corners.
int corner_data[] = { 8, 6, 4, 3, 2, 2, 1, 1 };
int minrow = 0;
- int maxcol = flashW * 8 - 1;
- int maxrow = (flashH - 1) * _realWidth;
+ int maxcol = _flashlight.w * 8 - 1;
+ int maxrow = (_flashlight.h - 1) * _realWidth;
for (i = 0; i < 8; i++, minrow += _realWidth, maxrow -= _realWidth) {
int d = corner_data[i];
for (j = 0; j < d; j++) {
- flashBuffer[minrow + j] = 0;
- flashBuffer[minrow + maxcol - j] = 0;
- flashBuffer[maxrow + j] = 0;
- flashBuffer[maxrow + maxcol - j] = 0;
+ _flashlight.buffer[minrow + j] = 0;
+ _flashlight.buffer[minrow + maxcol - j] = 0;
+ _flashlight.buffer[maxrow + j] = 0;
+ _flashlight.buffer[maxrow + maxcol - j] = 0;
}
}
More information about the Scummvm-git-logs
mailing list