[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.204,1.205 camera.cpp,2.22,2.23 charset.h,2.24,2.25 gfx.cpp,2.259,2.260 gfx.h,1.58,1.59 saveload.cpp,1.135,1.136 script_v6.cpp,1.249,1.250 scumm.h,1.353,1.354 scummvm.cpp,2.538,2.539 string.cpp,1.183,1.184
Max Horn
fingolfin at users.sourceforge.net
Thu Jan 8 13:23:05 CET 2004
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm dialogs.cpp,1.100,1.101 dialogs.h,1.36,1.37 player_v1.cpp,1.19,1.20 player_v2.cpp,2.45,2.46 player_v2.h,2.26,2.27 player_v2a.cpp,2.19,2.20 player_v2a.h,2.8,2.9 player_v3a.cpp,1.18,1.19 player_v3a.h,1.17,1.18 script.cpp,1.142,1.143 scumm.h,1.352,1.353 scummvm.cpp,2.537,2.538 sound.cpp,1.310,1.311 sound.h,1.61,1.62
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.260,2.261
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv9025
Modified Files:
actor.cpp camera.cpp charset.h gfx.cpp gfx.h saveload.cpp
script_v6.cpp scumm.h scummvm.cpp string.cpp
Log Message:
move the charset mask to the charset renderer class; some other related changes
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.204
retrieving revision 1.205
diff -u -d -r1.204 -r1.205
--- actor.cpp 8 Jan 2004 15:07:44 -0000 1.204
+++ actor.cpp 8 Jan 2004 21:21:40 -0000 1.205
@@ -1190,7 +1190,7 @@
VAR(VAR_TALK_ACTOR) = 0xFF;
}
_keepText = false;
- restoreCharsetBg();
+ _charset->restoreCharsetBg();
}
void ScummEngine::clearMsgQueue() {
Index: camera.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/camera.cpp,v
retrieving revision 2.22
retrieving revision 2.23
diff -u -d -r2.22 -r2.23
--- camera.cpp 6 Jan 2004 13:28:19 -0000 2.22
+++ camera.cpp 8 Jan 2004 21:21:40 -0000 2.23
@@ -347,12 +347,12 @@
// When talking to Rusty for first time
// When sleeping in straw at Blacksmith's Guild.
if ((_gameId == GID_LOOM256 || _gameId == GID_PASS) && dx)
- gdi._mask.left -= 8;
+ _charset->_mask.left -= 8;
else if (dx || dy) {
- gdi._mask.left -= dx;
- gdi._mask.right -= dx;
- gdi._mask.top -= dy;
- gdi._mask.bottom -= dy;
+ _charset->_mask.left -= dx;
+ _charset->_mask.right -= dx;
+ _charset->_mask.top -= dy;
+ _charset->_mask.bottom -= dy;
}
}
}
Index: charset.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.h,v
retrieving revision 2.24
retrieving revision 2.25
diff -u -d -r2.24 -r2.25
--- charset.h 8 Jan 2004 17:41:11 -0000 2.24
+++ charset.h 8 Jan 2004 21:21:40 -0000 2.25
@@ -32,6 +32,13 @@
class CharsetRenderer {
public:
+
+ /**
+ * Charset mask - rectangle covering the parts of the screen which are
+ * currently (partially) masked.
+ */
+ Common::Rect _mask;
+
Common::Rect _str;
int _nextLeft, _nextTop;
@@ -61,6 +68,10 @@
public:
CharsetRenderer(ScummEngine *vm);
virtual ~CharsetRenderer() {}
+
+ void restoreCharsetBg();
+ void clearCharsetMask();
+ bool hasCharsetMask(int left, int top, int right, int bottom);
virtual void printChar(int chr) = 0;
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.259
retrieving revision 2.260
diff -u -d -r2.259 -r2.260
--- gfx.cpp 8 Jan 2004 03:24:41 -0000 2.259
+++ gfx.cpp 8 Jan 2004 21:21:40 -0000 2.260
@@ -542,20 +542,6 @@
&virtscr[0], s, 0, _roomWidth, virtscr[0].height, s, num, 0, _roomStrips);
}
-void ScummEngine::restoreCharsetBg() {
- if (_charset->_hasMask) {
- restoreBG(gdi._mask);
- _charset->_hasMask = false;
- gdi._mask.top = gdi._mask.left = 32767;
- gdi._mask.right = gdi._mask.bottom = 0;
- _charset->_str.left = -1;
- _charset->_left = -1;
- }
-
- _charset->_nextLeft = _string[0].xpos;
- _charset->_nextTop = _string[0].ypos;
-}
-
void ScummEngine::restoreBG(Common::Rect rect, byte backColor) {
VirtScreen *vs;
int topline, height, width;
@@ -589,7 +575,7 @@
width = rect.width();
// Check whether lights are turned on or not
- lightsOn = (_features & GF_NEW_OPCODES) || (vs->number != kMainVirtScreen) || (VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_screen);
+ lightsOn = isLightOn();
if (vs->hasTwoBuffers && _currentRoom != 0 && lightsOn ) {
blit(backbuff, vs->backBuf + offset, width, height);
@@ -621,16 +607,30 @@
}
}
-void Gdi::clearCharsetMask() {
- memset(_vm->getResourceAddress(rtBuffer, 9), 0, _imgBufOffs[1]);
+void CharsetRenderer::restoreCharsetBg() {
+ if (_hasMask) {
+ _vm->restoreBG(_mask);
+ _hasMask = false;
+ _mask.top = _mask.left = 32767;
+ _mask.right = _mask.bottom = 0;
+ _str.left = -1;
+ _left = -1;
+ }
+
+ _nextLeft = _vm->_string[0].xpos;
+ _nextTop = _vm->_string[0].ypos;
+}
+
+void CharsetRenderer::clearCharsetMask() {
+ memset(_vm->getResourceAddress(rtBuffer, 9), 0, _vm->gdi._imgBufOffs[1]);
_mask.top = _mask.left = 32767;
_mask.right = _mask.bottom = 0;
}
-bool ScummEngine::hasCharsetMask(int left, int top, int right, int bottom) {
+bool CharsetRenderer::hasCharsetMask(int left, int top, int right, int bottom) {
Common::Rect rect(left, top, right, bottom);
- return _charset->_hasMask && rect.intersects(gdi._mask);
+ return _hasMask && rect.intersects(_mask);
}
byte *ScummEngine::getMaskBuffer(int x, int y, int z) {
@@ -814,6 +814,10 @@
_flashlight.isDrawn = true;
}
+bool ScummEngine::isLightOn() const {
+ return (VAR_CURRENT_LIGHTS == 0xFF) || (VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_screen);
+}
+
#pragma mark -
#pragma mark --- Image drawing ---
#pragma mark -
@@ -841,7 +845,7 @@
bool useOrDecompress = false;
// Check whether lights are turned on or not
- lightsOn = (_vm->_features & GF_NEW_OPCODES) || (vs->number != kMainVirtScreen) || (_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_screen);
+ lightsOn = _vm->isLightOn();
CHECK_HEAP;
if (_vm->_features & GF_SMALL_HEADER)
@@ -1077,7 +1081,7 @@
CHECK_HEAP;
if (vs->hasTwoBuffers) {
- if (_vm->hasCharsetMask(sx * 8, y, (sx + 1) * 8, bottom)) {
+ if (_vm->_charset->hasCharsetMask(sx * 8, y, (sx + 1) * 8, bottom)) {
if (flag & dbClear || !lightsOn)
clear8ColWithMasking(backbuff_ptr, height, mask_ptr);
else
@@ -1213,8 +1217,8 @@
numLinesToProcess = bottom - top;
if (numLinesToProcess) {
- if ((_vm->_features & GF_NEW_OPCODES) || (_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_screen)) {
- if (_vm->hasCharsetMask(strip * 8, top, (strip + 1) * 8, bottom))
+ if (_vm->isLightOn()) {
+ if (_vm->_charset->hasCharsetMask(strip * 8, top, (strip + 1) * 8, bottom))
draw8ColWithMasking(backbuff_ptr, bgbak_ptr, numLinesToProcess, mask_ptr);
else
draw8Col(backbuff_ptr, bgbak_ptr, numLinesToProcess);
Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- gfx.h 8 Jan 2004 03:10:16 -0000 1.58
+++ gfx.h 8 Jan 2004 21:21:40 -0000 1.59
@@ -213,7 +213,6 @@
int _numZBuffer;
int _imgBufOffs[8];
int32 _numStrips;
- Common::Rect _mask;
byte _C64Colors[4];
Gdi(ScummEngine *vm);
@@ -266,7 +265,6 @@
void drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height,
int stripnr, int numstrip, byte flag, StripTable *table = 0);
StripTable *generateStripTable(const byte *src, int width, int height, StripTable *table);
- void clearCharsetMask();
void disableZBuffer() { _zbufferDisabled = true; }
void enableZBuffer() { _zbufferDisabled = false; }
Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- saveload.cpp 8 Jan 2004 17:30:36 -0000 1.135
+++ saveload.cpp 8 Jan 2004 21:21:40 -0000 1.136
@@ -216,8 +216,8 @@
_completeScreenRedraw = true;
// Reset charset mask
- gdi._mask.top = gdi._mask.left = 32767;
- gdi._mask.right = gdi._mask.bottom = 0;
+ _charset->_mask.top = _charset->_mask.left = 32767;
+ _charset->_mask.right = _charset->_mask.bottom = 0;
_charset->_hasMask = false;
// With version 22, we replaced the scale items with scale slots. So when
Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.249
retrieving revision 1.250
diff -u -d -r1.249 -r1.250
--- script_v6.cpp 7 Jan 2004 06:08:54 -0000 1.249
+++ script_v6.cpp 8 Jan 2004 21:21:40 -0000 1.250
@@ -2619,7 +2619,7 @@
createSpecialPalette(args[1], args[2], args[3], args[4], args[5], 0, 256);
break;
case 110:
- gdi.clearCharsetMask();
+ _charset->clearCharsetMask();
break;
case 111:
a = derefActor(args[1], "o6_kernelSetFunctions: 111");
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.353
retrieving revision 1.354
diff -u -d -r1.353 -r1.354
--- scumm.h 8 Jan 2004 20:37:25 -0000 1.353
+++ scumm.h 8 Jan 2004 21:21:40 -0000 1.354
@@ -246,6 +246,8 @@
friend class ScummDebugger;
friend class SmushPlayer;
friend class Insane;
+ friend class CharsetRenderer;
+
void errorString(const char *buf_input, char *buf_output);
public:
/* Put often used variables at the top.
@@ -371,6 +373,13 @@
}
return _scummVars[var];
}
+ int32 scummVar(byte var, const char *varName, const char *file, int line) const
+ {
+ if (var == 0xFF) {
+ warning("Illegal access to variable %s in file %s, line %d", varName, file, line);
+ }
+ return _scummVars[var];
+ }
protected:
int16 _varwatch;
@@ -765,6 +774,8 @@
uint32 _CLUT_offs;
uint32 _IM00_offs, _PALS_offs;
+ StripTable *_roomStrips;
+
//ender: fullscreen
bool _fullRedraw, _BgNeedsRedraw, _verbRedraw;
bool _screenEffectFlag, _completeScreenRedraw;
@@ -787,8 +798,10 @@
bool isDrawn;
} _flashlight;
- StripTable *_roomStrips;
-
+public:
+ bool isLightOn() const;
+
+protected:
void initScreens(int b, int h);
void initVirtScreen(VirtScreenNumber slot, int number, int top, int width, int height, bool twobufs, bool scrollable);
void initBGBuffers(int height);
@@ -1005,7 +1018,9 @@
bool areBoxesNeighbours(int i, int j);
/* String class */
+public:
CharsetRenderer *_charset;
+protected:
byte _charsetColor;
public:
byte _charsetColorMap[16];
@@ -1018,10 +1033,7 @@
protected:
void initCharset(int charset);
- void restoreCharsetBg();
-public:
- bool hasCharsetMask(int left, int top, int right, int bottom);
-protected:
+
void CHARSET_1();
void drawString(int a);
const byte *addMessageToStack(const byte *msg);
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.538
retrieving revision 2.539
diff -u -d -r2.538 -r2.539
--- scummvm.cpp 8 Jan 2004 20:37:25 -0000 2.538
+++ scummvm.cpp 8 Jan 2004 21:21:40 -0000 2.539
@@ -1086,7 +1086,7 @@
virtscr[0].xstart = 0;
- if (!(_features & GF_NEW_OPCODES)) {
+ if (VAR_CURRENT_LIGHTS != 0xFF) {
// Setup light
_flashlight.xStrips = 7;
_flashlight.yStrips = 7;
@@ -1222,7 +1222,7 @@
VAR(39) = 320;
}
- if (!(_features & GF_NEW_OPCODES)) {
+ if (VAR_CURRENT_LIGHTS != 0xFF) {
// Setup light
VAR(VAR_CURRENT_LIGHTS) = LIGHTMODE_actor_base | LIGHTMODE_actor_color | LIGHTMODE_screen;
}
@@ -1426,7 +1426,7 @@
if (_completeScreenRedraw) {
_completeScreenRedraw = false;
- gdi.clearCharsetMask();
+ _charset->clearCharsetMask();
_charset->_hasMask = false;
// HACK as in game save stuff isn't supported currently
@@ -1499,7 +1499,7 @@
setActorRedrawFlags();
resetActorBgs();
- if (!(_features & GF_NEW_OPCODES) &&
+ if (VAR_CURRENT_LIGHTS != 0xFF &&
!(VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_screen) &&
VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_flashlight) {
drawFlashlight();
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -d -r1.183 -r1.184
--- string.cpp 8 Jan 2004 17:30:36 -0000 1.183
+++ string.cpp 8 Jan 2004 21:21:40 -0000 1.184
@@ -160,7 +160,7 @@
_charsetColorMap[i] = _charsetData[_charset->getCurID()][i];
if (_keepText) {
- _charset->_str = gdi._mask;
+ _charset->_str = _charset->_mask;
}
if (_talkDelay)
@@ -198,14 +198,14 @@
if (!_keepText) {
if (_version <= 3 && _gameId != GID_LOOM) {
_charset->_hasMask = true;
- gdi._mask.left = _string[0].xpos;
- gdi._mask.top = _string[0].ypos;
- gdi._mask.bottom = _string[0].ypos + 8;
- gdi._mask.right = _screenWidth;
+ _charset->_mask.left = _string[0].xpos;
+ _charset->_mask.top = _string[0].ypos;
+ _charset->_mask.bottom = _string[0].ypos + 8;
+ _charset->_mask.right = _screenWidth;
if (_string[0].ypos <= 16) // If we are cleaning the text line, clean 2 lines.
- gdi._mask.bottom = 16;
+ _charset->_mask.bottom = 16;
}
- restoreCharsetBg();
+ _charset->restoreCharsetBg();
}
t = _charset->_right - _string[0].xpos - 1;
@@ -353,7 +353,7 @@
_charsetBufPos = buffer - _charsetBuffer;
_charset->_hasMask = (_charset->_str.left != -1);
- gdi._mask = _charset->_str;
+ _charset->_mask = _charset->_str;
}
void ScummEngine::drawString(int a) {
@@ -483,7 +483,7 @@
if (_version >= 7) {
_charset->_hasMask = true;
- gdi._mask.extend(_charset->_str);
+ _charset->_mask.extend(_charset->_str);
}
}
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm dialogs.cpp,1.100,1.101 dialogs.h,1.36,1.37 player_v1.cpp,1.19,1.20 player_v2.cpp,2.45,2.46 player_v2.h,2.26,2.27 player_v2a.cpp,2.19,2.20 player_v2a.h,2.8,2.9 player_v3a.cpp,1.18,1.19 player_v3a.h,1.17,1.18 script.cpp,1.142,1.143 scumm.h,1.352,1.353 scummvm.cpp,2.537,2.538 sound.cpp,1.310,1.311 sound.h,1.61,1.62
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.260,2.261
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list