[Scummvm-cvs-logs] SF.net SVN: scummvm: [21277] scummvm/trunk/engines/scumm
kirben at users.sourceforge.net
kirben at users.sourceforge.net
Tue Mar 14 04:07:05 CET 2006
Revision: 21277
Author: kirben
Date: 2006-03-14 04:06:37 -0800 (Tue, 14 Mar 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=21277&view=rev
Log Message:
-----------
Avoid all scumm var conflicts in C64 maniac
Modified Paths:
--------------
scummvm/trunk/engines/scumm/camera.cpp
scummvm/trunk/engines/scumm/costume.cpp
scummvm/trunk/engines/scumm/gfx.cpp
scummvm/trunk/engines/scumm/intern.h
scummvm/trunk/engines/scumm/room.cpp
scummvm/trunk/engines/scumm/script_c64.cpp
scummvm/trunk/engines/scumm/scumm.cpp
scummvm/trunk/engines/scumm/scumm.h
scummvm/trunk/engines/scumm/vars.cpp
Modified: scummvm/trunk/engines/scumm/camera.cpp
===================================================================
--- scummvm/trunk/engines/scumm/camera.cpp 2006-03-14 10:35:01 UTC (rev 21276)
+++ scummvm/trunk/engines/scumm/camera.cpp 2006-03-14 12:06:37 UTC (rev 21277)
@@ -43,10 +43,10 @@
}
camera._dest.x = pos_x;
- if (camera._cur.x < VAR(VAR_CAMERA_MIN_X))
+ if (VAR_CAMERA_MIN_X != 0xFF && camera._cur.x < VAR(VAR_CAMERA_MIN_X))
camera._cur.x = (short) VAR(VAR_CAMERA_MIN_X);
- if (camera._cur.x > VAR(VAR_CAMERA_MAX_X))
+ if (VAR_CAMERA_MAX_X != 0xFF && camera._cur.x > VAR(VAR_CAMERA_MAX_X))
camera._cur.x = (short) VAR(VAR_CAMERA_MAX_X);
if (VAR_SCROLL_SCRIPT != 0xFF && VAR(VAR_SCROLL_SCRIPT)) {
@@ -106,7 +106,7 @@
camera._cur.x &= 0xFFF8;
- if (camera._cur.x < VAR(VAR_CAMERA_MIN_X)) {
+ if (VAR_CAMERA_MIN_X != 0xFF && camera._cur.x < VAR(VAR_CAMERA_MIN_X)) {
if (VAR_CAMERA_FAST_X != 0xFF && VAR(VAR_CAMERA_FAST_X))
camera._cur.x = (short) VAR(VAR_CAMERA_MIN_X);
else
@@ -115,7 +115,7 @@
return;
}
- if (camera._cur.x > VAR(VAR_CAMERA_MAX_X)) {
+ if (VAR_CAMERA_MAX_X != 0xFF && camera._cur.x > VAR(VAR_CAMERA_MAX_X)) {
if (VAR_CAMERA_FAST_X != 0xFF && VAR(VAR_CAMERA_FAST_X))
camera._cur.x = (short) VAR(VAR_CAMERA_MAX_X);
else
@@ -146,10 +146,10 @@
camera._dest.x = a->_pos.x;
}
- if (camera._dest.x < VAR(VAR_CAMERA_MIN_X))
+ if (VAR_CAMERA_MIN_X != 0xFF && camera._dest.x < VAR(VAR_CAMERA_MIN_X))
camera._dest.x = (short) VAR(VAR_CAMERA_MIN_X);
- if (camera._dest.x > VAR(VAR_CAMERA_MAX_X))
+ if (VAR_CAMERA_MAX_X != 0xFF && camera._dest.x > VAR(VAR_CAMERA_MAX_X))
camera._dest.x = (short) VAR(VAR_CAMERA_MAX_X);
if (VAR_CAMERA_FAST_X != 0xFF && VAR(VAR_CAMERA_FAST_X)) {
Modified: scummvm/trunk/engines/scumm/costume.cpp
===================================================================
--- scummvm/trunk/engines/scumm/costume.cpp 2006-03-14 10:35:01 UTC (rev 21276)
+++ scummvm/trunk/engines/scumm/costume.cpp 2006-03-14 12:06:37 UTC (rev 21277)
@@ -354,7 +354,7 @@
// Set up the palette data
byte palette[4] = { 0, 0, 0, 0 };
- if (!(_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_actor_color)) {
+ if (!(_vm->getCurrentLights() & LIGHTMODE_actor_color)) {
palette[2] = 11;
palette[3] = 11;
} else if (_vm->_game.id == GID_MANIAC) {
@@ -614,7 +614,7 @@
if (cost.curpos[limb] == 0xFFFF)
return 0;
- if (_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_actor_base)
+ if (_vm->getCurrentLights() & LIGHTMODE_actor_base)
palette = _vm->_NESPalette[1];
else
palette = darkpalette;
@@ -837,7 +837,7 @@
if (_loaded._format == 0x57) {
memcpy(_palette, palette, 13);
} else if (_vm->_game.features & GF_OLD_BUNDLE) {
- if ((_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_actor_color)) {
+ if ((_vm->getCurrentLights() & LIGHTMODE_actor_color)) {
memcpy(_palette, palette, 16);
} else {
memset(_palette, 8, 16);
@@ -845,7 +845,7 @@
}
_palette[_loaded._palette[0]] = _palette[0];
} else {
- if ((_vm->VAR_CURRENT_LIGHTS == 0xFF) || (_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_actor_color)) {
+ if (_vm->_game.version >= 6 || (_vm->getCurrentLights() & LIGHTMODE_actor_color)) {
for (i = 0; i < _loaded._numColors; i++) {
color = palette[i];
if (color == 255)
@@ -1019,7 +1019,7 @@
// Set up the palette data
byte palette[4] = { 0, 0, 0, 0 };
- if (!(_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_actor_color)) {
+ if (!(_vm->getCurrentLights() & LIGHTMODE_actor_color)) {
palette[2] = 11;
palette[3] = 11;
} else {
Modified: scummvm/trunk/engines/scumm/gfx.cpp
===================================================================
--- scummvm/trunk/engines/scumm/gfx.cpp 2006-03-14 10:35:01 UTC (rev 21276)
+++ scummvm/trunk/engines/scumm/gfx.cpp 2006-03-14 12:06:37 UTC (rev 21277)
@@ -1170,8 +1170,17 @@
_flashlight.isDrawn = true;
}
+// C64 Maniac doesn't have a ScummVar for VAR_CURRENT_LIGHTS, and just uses
+// an internal variable. Emulate this to prevent overwriting script vars...
+int ScummEngine::getCurrentLights() const {
+ if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64)
+ return _currentLights;
+ else
+ return VAR(VAR_CURRENT_LIGHTS);
+}
+
bool ScummEngine::isLightOn() const {
- return (VAR_CURRENT_LIGHTS == 0xFF) || (VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_screen);
+ return (VAR_CURRENT_LIGHTS == 0xFF) || (getCurrentLights() & LIGHTMODE_screen);
}
void ScummEngine::setShake(int mode) {
Modified: scummvm/trunk/engines/scumm/intern.h
===================================================================
--- scummvm/trunk/engines/scumm/intern.h 2006-03-14 10:35:01 UTC (rev 21276)
+++ scummvm/trunk/engines/scumm/intern.h 2006-03-14 12:06:37 UTC (rev 21277)
@@ -469,6 +469,8 @@
void o_print_c64();
void o_unlockRoom();
void o_unlockSound();
+ void o_cutscene();
+ void o_endCutscene();
void o_beginOverride();
void o_isEqual();
void o_isGreater();
Modified: scummvm/trunk/engines/scumm/room.cpp
===================================================================
--- scummvm/trunk/engines/scumm/room.cpp 2006-03-14 10:35:01 UTC (rev 21276)
+++ scummvm/trunk/engines/scumm/room.cpp 2006-03-14 12:06:37 UTC (rev 21277)
@@ -156,8 +156,10 @@
VAR(VAR_ROOM_HEIGHT) = _roomHeight;
}
- VAR(VAR_CAMERA_MIN_X) = _screenWidth / 2;
- VAR(VAR_CAMERA_MAX_X) = _roomWidth - (_screenWidth / 2);
+ if (VAR_CAMERA_MIN_X != 0xFF)
+ VAR(VAR_CAMERA_MIN_X) = _screenWidth / 2;
+ if (VAR_CAMERA_MAX_X != 0xFF)
+ VAR(VAR_CAMERA_MAX_X) = _roomWidth - (_screenWidth / 2);
if (_game.features & GF_NEW_CAMERA) {
VAR(VAR_CAMERA_MIN_Y) = _screenHeight / 2;
Modified: scummvm/trunk/engines/scumm/script_c64.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_c64.cpp 2006-03-14 10:35:01 UTC (rev 21276)
+++ scummvm/trunk/engines/scumm/script_c64.cpp 2006-03-14 12:06:37 UTC (rev 21277)
@@ -116,7 +116,7 @@
OPCODE(o2_walkActorTo),
OPCODE(o2_ifState02),
/* 40 */
- OPCODE(o2_cutscene),
+ OPCODE(o_cutscene),
OPCODE(o2_putActor),
OPCODE(o2_startScript),
OPCODE(o_doSentence),
@@ -276,7 +276,7 @@
OPCODE(o2_walkActorTo),
OPCODE(o2_ifNotState02),
/* C0 */
- OPCODE(o2_endCutscene),
+ OPCODE(o_endCutscene),
OPCODE(o2_putActor),
OPCODE(o2_startScript),
OPCODE(o_doSentence),
@@ -699,11 +699,11 @@
// 1 Flashlight
// 2 Lighted area
if (a == 2)
- VAR(VAR_CURRENT_LIGHTS) = 11;
+ _currentLights = 11;
else if (a == 1)
- VAR(VAR_CURRENT_LIGHTS) = 4;
+ _currentLights = 4;
else
- VAR(VAR_CURRENT_LIGHTS) = 0;
+ _currentLights = 0;
_fullRedraw = true;
}
@@ -886,6 +886,39 @@
setResult(closest_obj);
}
+void ScummEngine_c64::o_cutscene() {
+ vm.cutSceneData[0] = _userState | (_userPut ? 16 : 0);
+ vm.cutSceneData[2] = _currentRoom;
+ vm.cutSceneData[3] = camera._mode;
+
+ // Hide inventory, freeze scripts, hide cursor
+ setUserState(15);
+
+ _sentenceNum = 0;
+ stopScript(SENTENCE_SCRIPT);
+ resetSentence();
+
+ vm.cutScenePtr[0] = 0;
+}
+
+void ScummEngine_c64::o_endCutscene() {
+ vm.cutSceneStackPointer = 0;
+
+ VAR(VAR_OVERRIDE) = 0;
+ vm.cutSceneScript[0] = 0;
+ vm.cutScenePtr[0] = 0;
+
+ // Reset user state to values before cutscene
+ setUserState(vm.cutSceneData[0] | 7);
+
+ camera._mode = (byte) vm.cutSceneData[3];
+ if (camera._mode == kFollowActorCameraMode) {
+ actorFollowCamera(VAR(VAR_EGO));
+ } else if (vm.cutSceneData[2] != _currentRoom) {
+ startScene(vm.cutSceneData[2], 0, 0);
+ }
+}
+
void ScummEngine_c64::o_beginOverride() {
const int idx = vm.cutSceneStackPointer;
assert(0 <= idx && idx < 5);
Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp 2006-03-14 10:35:01 UTC (rev 21276)
+++ scummvm/trunk/engines/scumm/scumm.cpp 2006-03-14 12:06:37 UTC (rev 21277)
@@ -636,6 +636,7 @@
_scrollBuffer = NULL;
_doEffect = false;
+ _currentLights = 0;
memset(&_flashlight, 0, sizeof(_flashlight));
_bompActorPalettePtr = NULL;
_shakeEnabled = false;
@@ -1454,7 +1455,7 @@
virtscr[0].xstart = 0;
- if (VAR_CURRENT_LIGHTS != 0xFF) {
+ if (_game.version <= 5) {
// Setup light
_flashlight.xStrips = 7;
_flashlight.yStrips = 7;
@@ -2059,9 +2060,9 @@
setActorRedrawFlags();
resetActorBgs();
- if (VAR_CURRENT_LIGHTS != 0xFF &&
- !(VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_screen) &&
- VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_flashlight) {
+ if (_game.version <= 5 &&
+ !(getCurrentLights() & LIGHTMODE_screen) &&
+ getCurrentLights() & LIGHTMODE_flashlight) {
drawFlashlight();
setActorRedrawFlags();
}
@@ -2128,7 +2129,7 @@
if (VAR_TIMER != 0xFF)
VAR(VAR_TIMER) = 0;
- return VAR(VAR_TIMER_NEXT);
+ return (VAR_TIMER_NEXT != 0xFF) ? VAR(VAR_TIMER_NEXT) : 4;
}
Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h 2006-03-14 10:35:01 UTC (rev 21276)
+++ scummvm/trunk/engines/scumm/scumm.h 2006-03-14 12:06:37 UTC (rev 21277)
@@ -1007,6 +1007,9 @@
public:
bool isLightOn() const;
+ byte _currentLights;
+ int getCurrentLights() const;
+
protected:
void initScreens(int b, int h);
void initVirtScreen(VirtScreenNumber slot, int top, int width, int height, bool twobufs, bool scrollable);
Modified: scummvm/trunk/engines/scumm/vars.cpp
===================================================================
--- scummvm/trunk/engines/scumm/vars.cpp 2006-03-14 10:35:01 UTC (rev 21276)
+++ scummvm/trunk/engines/scumm/vars.cpp 2006-03-14 12:06:37 UTC (rev 21277)
@@ -118,13 +118,6 @@
//VAR_IS_SOUND_RUNNING = 8;
//VAR_ACTIVE_VERB = 9;
VAR_CHARCOUNT = 10;
-
- // FIXME: Should be removed
- VAR_CURRENT_LIGHTS = 256;
- VAR_CURSORSTATE = 257;
- VAR_CAMERA_MIN_X = 258;
- VAR_CAMERA_MAX_X = 259;
- VAR_TIMER_NEXT = 260;
}
void ScummEngine_v2::setupScummVars() {
@@ -551,6 +544,9 @@
_activeVerb = 13;
VAR(VAR_EGO) = 3;
+
+ // Setup light
+ _currentLights = LIGHTMODE_actor_base | LIGHTMODE_actor_color | LIGHTMODE_screen;
}
void ScummEngine_v2::initScummVars() {
@@ -567,10 +563,8 @@
if (_game.version >= 4 && _game.version <= 5)
VAR(VAR_V5_TALK_STRING_Y) = -0x50;
- if (VAR_CURRENT_LIGHTS != 0xFF) {
- // Setup light
- VAR(VAR_CURRENT_LIGHTS) = LIGHTMODE_actor_base | LIGHTMODE_actor_color | LIGHTMODE_screen;
- }
+ // Setup light
+ VAR(VAR_CURRENT_LIGHTS) = LIGHTMODE_actor_base | LIGHTMODE_actor_color | LIGHTMODE_screen;
if (_game.id == GID_MONKEY)
_scummVars[74] = 1225;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list