[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.225,2.226 gfx.h,1.48,1.49 scumm.h,1.314,1.315 scummvm.cpp,2.441,2.442
Max Horn
fingolfin at users.sourceforge.net
Mon Oct 13 05:57:08 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm scummvm.cpp,2.440,2.441
- Next message: [Scummvm-cvs-logs] CVS: scummvm/queen logic.h,1.24,1.25 logic.cpp,1.33,1.34 graphics.h,1.15,1.16 graphics.cpp,1.16,1.17 walk.h,1.5,1.6 walk.cpp,1.6,1.7 structs.h,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv4493
Modified Files:
gfx.cpp gfx.h scumm.h scummvm.cpp
Log Message:
cleanup; got rid of Gdi::_palette_mod in favor of Gdi::_roomPalette
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.225
retrieving revision 2.226
diff -u -d -r2.225 -r2.226
--- gfx.cpp 13 Oct 2003 11:59:48 -0000 2.225
+++ gfx.cpp 13 Oct 2003 12:56:53 -0000 2.226
@@ -191,10 +191,25 @@
};
+#pragma mark -
+
+
static inline uint colorWeight(int red, int green, int blue) {
return 3 * red * red + 6 * green * green + 2 * blue * blue;
}
+
+#pragma mark -
+
+
+Gdi::Gdi(ScummEngine *vm) {
+ memset(this, 0, sizeof(*this));
+ _vm = vm;
+ _roomPalette = vm->_roomPalette;
+ if (vm->_features & GF_AMIGA)
+ _roomPalette += 16;
+}
+
void ScummEngine::getGraphicsPerformance() {
int i;
@@ -284,7 +299,7 @@
}
if (slot != 3) {
- virtscr[slot].setDirtyRange(0, height);
+ vs->setDirtyRange(0, height);
}
}
@@ -1052,7 +1067,7 @@
run = data >> 4;
dither = false;
}
- color = _vm->_roomPalette[data & 0x0f];
+ color = _roomPalette[data & 0x0f];
if (run == 0) {
run = *src++;
}
@@ -1349,9 +1364,9 @@
for (int y = 0; y < height; y++) {
_C64Colors[3] = (_C64ColorMap[y + stripnr * height] & 7);
// Check for room color change in V1 zak
- if (_vm->_roomPalette[0] == 255) {
- _C64Colors[2] = _vm->_roomPalette[2];
- _C64Colors[1] = _vm->_roomPalette[1];
+ if (_roomPalette[0] == 255) {
+ _C64Colors[2] = _roomPalette[2];
+ _C64Colors[1] = _roomPalette[1];
}
charIdx = _C64PicMap[y + stripnr * height] * 8;
@@ -1451,7 +1466,7 @@
run = *src++;
}
for (z = 0; z < run; z++) {
- *(dst + y * _vm->_screenWidth + x) = (z&1) ? _vm->_roomPalette[((color & 0xf) + _palette_mod)] : _vm->_roomPalette[((color >> 4) + _palette_mod)];
+ *(dst + y * _vm->_screenWidth + x) = (z&1) ? _roomPalette[color & 0xf] : _roomPalette[color >> 4];
y++;
if (y >= height) {
@@ -1481,7 +1496,7 @@
}
for (z = 0; z < run; z++) {
- *(dst + y * _vm->_screenWidth + x) = _vm->_roomPalette[(color & 0xf) + _palette_mod];
+ *(dst + y * _vm->_screenWidth + x) = _roomPalette[color & 0xf];
y++;
if (y >= height) {
@@ -1498,11 +1513,6 @@
byte code = *src++;
- if (_vm->_features & GF_AMIGA)
- _palette_mod = 16;
- else
- _palette_mod = 0;
-
bool useOrDecompress = false;
_decomp_shr = code % 10;
_decomp_mask = 0xFF >> (8 - _decomp_shr);
@@ -1770,7 +1780,7 @@
int x = 8;
do {
FILL_BITS;
- *dst++ = _vm->_roomPalette[color + _palette_mod];
+ *dst++ = _roomPalette[color];
againPos:
if (!READ_BIT) {
@@ -1795,7 +1805,7 @@
if (!--height)
return;
}
- *dst++ = _vm->_roomPalette[color + _palette_mod];
+ *dst++ = _roomPalette[color];
} while (--reps);
bits >>= 8;
bits |= (*src++) << (cl - 8);
@@ -1819,7 +1829,7 @@
do {
FILL_BITS;
if (color != _transparentColor)
- *dst = _vm->_roomPalette[color + _palette_mod];
+ *dst = _roomPalette[color];
dst++;
againPos:
@@ -1846,7 +1856,7 @@
return;
}
if (color != _transparentColor)
- *dst = _vm->_roomPalette[color + _palette_mod];
+ *dst = _roomPalette[color];
dst++;
} while (--reps);
bits >>= 8;
@@ -1870,7 +1880,7 @@
int x = 8;
do {
FILL_BITS;
- *dst++ = _vm->_roomPalette[color + _palette_mod];
+ *dst++ = _roomPalette[color];
if (!READ_BIT) {
} else if (!READ_BIT) {
FILL_BITS;
@@ -1901,7 +1911,7 @@
do {
FILL_BITS;
if (color != _transparentColor)
- *dst = _vm->_roomPalette[color + _palette_mod];
+ *dst = _roomPalette[color];
dst++;
if (!READ_BIT) {
} else if (!READ_BIT) {
@@ -1933,7 +1943,7 @@
int h = height;
do {
FILL_BITS;
- *dst = _vm->_roomPalette[color + _palette_mod];
+ *dst = _roomPalette[color];
dst += _vm->_screenWidth;
if (!READ_BIT) {
} else if (!READ_BIT) {
@@ -1966,7 +1976,7 @@
do {
FILL_BITS;
if (color != _transparentColor)
- *dst = _vm->_roomPalette[color + _palette_mod];
+ *dst = _roomPalette[color];
dst += _vm->_screenWidth;
if (!READ_BIT) {
} else if (!READ_BIT) {
@@ -2043,7 +2053,7 @@
byte color = *src++;
do {
- *dst = _vm->_roomPalette[color];
+ *dst = _roomPalette[color];
NEXT_ROW;
} while (--run);
}
@@ -2072,7 +2082,7 @@
color += bits << i;
}
for (i = 0; i < ((c & 3) + 2); i++) {
- *dst = _vm->_roomPalette[run * 16 + color];
+ *dst = _roomPalette[run * 16 + color];
NEXT_ROW;
}
break;
@@ -2084,7 +2094,7 @@
READ_256BIT;
color += bits << j;
}
- *dst = _vm->_roomPalette[run * 16 + color];
+ *dst = _roomPalette[run * 16 + color];
NEXT_ROW;
}
break;
@@ -2113,13 +2123,13 @@
for (;;) {
byte color = *src++;
if (color < numcolors) {
- *dst = _vm->_roomPalette[local_palette[color]];
+ *dst = _roomPalette[local_palette[color]];
NEXT_ROW;
} else {
uint run = color - numcolors + 1;
color = *src++;
do {
- *dst = _vm->_roomPalette[color];
+ *dst = _roomPalette[color];
NEXT_ROW;
} while (--run);
}
@@ -2136,7 +2146,7 @@
do {
int h = height;
do {
- *dst = _vm->_roomPalette[color];
+ *dst = _roomPalette[color];
dst += _vm->_screenWidth;
for (i = 0; i < 3; i++) {
READ_256BIT;
Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- gfx.h 3 Oct 2003 18:33:54 -0000 1.48
+++ gfx.h 13 Oct 2003 12:56:53 -0000 1.49
@@ -110,17 +110,19 @@
class Gdi {
friend class ScummEngine; // Mostly for the code in saveload.cpp ...
-public:
ScummEngine *_vm;
+public:
int _numZBuffer;
int _imgBufOffs[8];
int32 _numStrips;
Common::Rect _mask;
byte _C64Colors[4];
+
+ Gdi(ScummEngine *vm);
protected:
- byte _palette_mod;
+ byte *_roomPalette;
byte _decomp_shr, _decomp_mask;
byte _transparentColor;
uint32 _vertStripNextInc;
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.314
retrieving revision 1.315
diff -u -d -r1.314 -r1.315
--- scumm.h 12 Oct 2003 19:10:16 -0000 1.314
+++ scumm.h 13 Oct 2003 12:56:53 -0000 1.315
@@ -267,11 +267,20 @@
ObjectData *_objs;
ScummDebugger *_debugger;
+ // Core variables
+ byte _gameId;
byte _version;
-
uint32 _features; // Should only be accessed for reading (TODO enforce it compiler-wise with making it private and creating an accessor)
+
void setFeatures (uint32 newFeatures); // Changes the features set. This allows some gamewide stuff to be precalculated/prepared (ie CostumeRenderer)
+ /** Random number generator */
+ Common::RandomSource _rnd;
+
+ /** Graphics manager */
+ Gdi gdi;
+
+ /** Central resource data. */
struct {
byte mode[rtNumTypes];
uint16 num[rtNumTypes];
@@ -357,17 +366,6 @@
protected:
byte _fastMode;
-public:
- /* Random number generation */
- Common::RandomSource _rnd;
-
- /* Core variable definitions */
- byte _gameId;
-
- /* Core class/array definitions */
- Gdi gdi;
-
-protected:
Actor *_actors; // Has _numActors elements
uint16 *_inventory;
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.441
retrieving revision 2.442
diff -u -d -r2.441 -r2.442
--- scummvm.cpp 13 Oct 2003 12:17:26 -0000 2.441
+++ scummvm.cpp 13 Oct 2003 12:56:53 -0000 2.442
@@ -269,14 +269,18 @@
};
ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst)
- : Engine(detector, syst), _pauseDialog(0), _optionsDialog(0), _saveLoadDialog(0) {
+ : Engine(detector, syst),
+ _targetName(detector->_targetName),
+ _gameId(detector->_game.id),
+ _version(detector->_game.version),
+ _features(detector->_game.features),
+ gdi(this), _pauseDialog(0), _optionsDialog(0), _saveLoadDialog(0) {
OSystem::Property prop;
// Init all vars - maybe now we can get rid of our custom new/delete operators?
_imuse = NULL;
_imuseDigital = NULL;
_musicEngine = NULL;
- _features = 0;
_verbs = NULL;
_objs = NULL;
_debugger = NULL;
@@ -295,8 +299,6 @@
_confirmExitDialog = NULL;
_debuggerDialog = NULL;
_fastMode = 0;
- _gameId = 0;
- memset(&gdi, 0, sizeof(Gdi));
_actors = NULL;
_inventory = NULL;
_newNames = NULL;
@@ -587,8 +589,10 @@
// Use g_scumm from error() ONLY
g_scumm = this;
+ // Create debugger
_debugger = new ScummDebugger(this);
+ // Read settings from the detector & config manager
_debugMode = detector->_debugMode;
_debugLevel = ConfMan.getInt("debuglevel");
_dumpScripts = detector->_dumpScripts;
@@ -599,16 +603,12 @@
// differing from the regular version(s) of that game.
_gameName = ConfMan.hasKey("basename") ? ConfMan.get("basename") : detector->_game.gameName;
- _targetName = detector->_targetName;
- _gameId = detector->_game.id;
- _version = detector->_game.version;
- setFeatures(detector->_game.features);
+ _midiDriver = detector->_midi_driver;
_demoMode = ConfMan.getBool("demo_mode");
_noSubtitles = ConfMan.getBool("nosubtitles");
_confirmExit = ConfMan.getBool("confirm_exit");
_defaultTalkDelay = ConfMan.getInt("talkspeed");
- _midiDriver = detector->_midi_driver;
_native_mt32 = ConfMan.getBool("native_mt32");
_language = GameDetector::parseLanguage(ConfMan.get("language"));
memset(&res, 0, sizeof(res));
@@ -629,21 +629,22 @@
_screenHeight = 200;
}
+ // Initialize backend
+ syst->init_size(_screenWidth, _screenHeight);
+ prop.cd_num = ConfMan.getInt("cdrom");
+ if (prop.cd_num >= 0 && (_features & GF_AUDIOTRACKS))
+ syst->property(OSystem::PROP_OPEN_CD, &prop);
+
+ // Setup GDI object
gdi._numStrips = _screenWidth / 8;
_newgui = g_gui;
- _sound = new Sound(this);
+ _sound = new Sound(this);
_sound->_sound_volume_master = ConfMan.getInt("master_volume");
_sound->_sound_volume_sfx = ConfMan.getInt("sfx_volume");
_sound->_sound_volume_music = ConfMan.getInt("music_volume");
- /* Initialize backend */
- syst->init_size(_screenWidth, _screenHeight);
- prop.cd_num = ConfMan.getInt("cdrom");
- if (prop.cd_num >= 0 && (_features & GF_AUDIOTRACKS))
- syst->property(OSystem::PROP_OPEN_CD, &prop);
-
#ifndef __GP32__ //ph0x FIXME, "quick dirty hack"
/* Bind the mixer to the system => mixer will be invoked
* automatically when samples need to be generated */
@@ -751,6 +752,22 @@
fp.close();
}
}
+
+ // Create the charset renderer
+ if (_version <= 2)
+ _charset = new CharsetRendererV2(this);
+ else if (_version == 3)
+ _charset = new CharsetRendererV3(this);
+ else if (_version == 8)
+ _charset = new CharsetRendererNut(this);
+ else
+ _charset = new CharsetRendererClassic(this);
+
+ // Create the costume renderer
+ if (_features & GF_NEW_COSTUMES)
+ _costumeRenderer = new AkosRenderer(this);
+ else
+ _costumeRenderer = new CostumeRenderer(this);
}
ScummEngine::~ScummEngine() {
@@ -806,7 +823,6 @@
#pragma mark -
void ScummEngine::launch() {
- gdi._vm = this;
#ifdef __PALM_OS__
// revert to old value (450000) and make ScummVM works again in some devices with same problem as below.
@@ -889,22 +905,16 @@
_saveLoadFlag = 0;
}
-void ScummEngine::setFeatures (uint32 newFeatures) {
- bool newCostumes = (_features & GF_NEW_COSTUMES) != 0;
- bool newNewCostumes = (newFeatures & GF_NEW_COSTUMES) != 0;
+void ScummEngine::setFeatures(uint32 newFeatures) {
bool amigaPalette = (_features & GF_AMIGA) != 0;
bool newAmigaPalette = (newFeatures & GF_AMIGA) != 0;
- _features = newFeatures;
-
- if (!_costumeRenderer || newCostumes != newNewCostumes) {
- delete _costumeRenderer;
- if (newNewCostumes)
- _costumeRenderer = new AkosRenderer(this);
- else
- _costumeRenderer = new CostumeRenderer(this);
+ if ((_features ^ newFeatures) & ~GF_AMIGA) {
+ error("setFeatures may only be used to toggle GF_AMIGA flag!");
}
+ _features = newFeatures;
+
if ((_features & GF_16COLOR) && amigaPalette != newAmigaPalette) {
if (_features & GF_AMIGA)
setupAmigaPalette();
@@ -952,17 +962,6 @@
_switchRoomEffect = 5;
}
- if (_version <= 2)
- _charset = new CharsetRendererV2(this);
- else if (_version == 3)
- _charset = new CharsetRendererV3(this);
- else if (_version == 8)
- _charset = new CharsetRendererNut(this);
- else
- _charset = new CharsetRendererClassic(this);
-
- memset(_charsetData, 0, sizeof(_charsetData));
-
if (!(_features & GF_SMALL_NAMES) && _version != 8)
loadCharset(1);
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm scummvm.cpp,2.440,2.441
- Next message: [Scummvm-cvs-logs] CVS: scummvm/queen logic.h,1.24,1.25 logic.cpp,1.33,1.34 graphics.h,1.15,1.16 graphics.cpp,1.16,1.17 walk.h,1.5,1.6 walk.cpp,1.6,1.7 structs.h,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list