aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Brown2003-01-26 06:17:25 +0000
committerJames Brown2003-01-26 06:17:25 +0000
commita0b77e7389686d38cf938136e729a5d6fa2dd8be (patch)
tree0a116455d8361189b9bdfb49f49ec49d5de6d2a7
parent5956e5ee183917efa250ce792d54243399a3aadb (diff)
downloadscummvm-rg350-a0b77e7389686d38cf938136e729a5d6fa2dd8be.tar.gz
scummvm-rg350-a0b77e7389686d38cf938136e729a5d6fa2dd8be.tar.bz2
scummvm-rg350-a0b77e7389686d38cf938136e729a5d6fa2dd8be.zip
LCA03 sync: Modified version of the untrap patch, debugger
savegame/loadgame changes, attempts at making the ComI save/load screen (F1) work. The savegame part of the screen does not work due to a crash, the load part SHOULD... but something resets the saveload flags before they are processed (help! :) svn-id: r6545
-rw-r--r--scumm/actor.h2
-rw-r--r--scumm/debugger.cpp22
-rw-r--r--scumm/intern.h1
-rw-r--r--scumm/resource.cpp2
-rw-r--r--scumm/script_v8.cpp54
-rw-r--r--scumm/scummvm.cpp4
6 files changed, 62 insertions, 23 deletions
diff --git a/scumm/actor.h b/scumm/actor.h
index 684ba86d9a..e866984017 100644
--- a/scumm/actor.h
+++ b/scumm/actor.h
@@ -127,9 +127,9 @@ protected:
void setBox(int box);
int updateActorDirection(bool is_walking);
- void adjustActorPos();
public:
+ void adjustActorPos();
AdjustBoxResult adjustXYToBeInBox(int dstX, int dstY, int pathfrom);
void setDirection(int direction);
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp
index 9423a23272..169df89cbb 100644
--- a/scumm/debugger.cpp
+++ b/scumm/debugger.cpp
@@ -284,25 +284,25 @@ bool ScummDebugger::Cmd_LoadGame(int argc, const char **argv) {
_s->_saveLoadCompatible = false;
_detach_now = true;
- } else {
- Debug_Printf("Syntax: savegame <slotnum>\n");
+ return false;
}
- return false;
+
+ Debug_Printf("Syntax: loadgame <slotnum>\n");
+ return true;
}
bool ScummDebugger::Cmd_SaveGame(int argc, const char **argv) {
- if (argc > 1) {
+ if (argc > 2) {
int slot = atoi(argv[1]);
-
+
+ strcpy(_s->_saveLoadName, argv[2]);
_s->_saveLoadSlot = slot;
_s->_saveLoadFlag = 1;
_s->_saveLoadCompatible = false;
-
- _detach_now = true;
- } else {
- Debug_Printf("Syntax: savegame <slotnum>\n");
- }
- return false;
+ } else
+ Debug_Printf("Syntax: savegame <slotnum> <name>\n");
+
+ return true;
}
bool ScummDebugger::Cmd_Actor(int argc, const char **argv) {
diff --git a/scumm/intern.h b/scumm/intern.h
index e0d765aaa1..8bd4b05a92 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -416,6 +416,7 @@ protected:
void o8_blastText();
void o8_cursorCommand();
+ void o8_createBoxMatrix();
void o8_resourceRoutines();
void o8_roomOps();
void o8_actorOps();
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index cd1ad982d4..7614ad8d9b 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -1143,7 +1143,7 @@ byte *Scumm::getStringAddress(int i)
{
byte *b = getResourceAddress(rtString, i);
if (!b)
- return b;
+ return NULL;
if (_features & GF_NEW_OPCODES)
return ((ArrayHeader *)b)->data;
diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp
index c87f674f41..f520342031 100644
--- a/scumm/script_v8.cpp
+++ b/scumm/script_v8.cpp
@@ -249,7 +249,7 @@ void Scumm_v8::setupOpcodes()
OPCODE(o6_pickupObject),
OPCODE(o6_setBoxFlags),
/* A8 */
- OPCODE(o6_createBoxMatrix),
+ OPCODE(o8_createBoxMatrix),
OPCODE(o6_invalid),
OPCODE(o8_resourceRoutines),
OPCODE(o8_roomOps),
@@ -865,6 +865,20 @@ void Scumm_v8::o8_cursorCommand()
_vars[VAR_USERPUT] = _userPut;
}
+void Scumm_v8::o8_createBoxMatrix()
+{
+ int i;
+ Actor *a;
+
+ createBoxMatrix();
+
+ for(i = 1; i < NUM_ACTORS; i++) {
+ a = &_actors[i];
+ if (a && a->isInCurrentRoom())
+ a->adjustActorPos();
+ }
+}
+
void Scumm_v8::o8_resourceRoutines()
{
// TODO
@@ -1457,15 +1471,35 @@ void Scumm_v8::o8_kernelSetFunctions()
case 24: // clearTextQueue
warning("o8_kernelSetFunctions: clearTextQueue()");
break;
- case 25: // saveGameWrite
- warning("o8_kernelSetFunctions: saveGameWrite(%d, %d)", args[1], args[2]);
+ case 25: { // saveGameReadName
+ SaveFileManager *mgr = _system->get_savefile_manager();
+ char *address = (char*)getStringAddress(args[2]);
+ char name[30];
+
+ if (!address) {
+ warning("o8_kernelSetFunctions: saveGameReadName failed finding slot string %d", args[2]);
+ break;
+ }
+ getSavegameName(args[1] - 1, name, mgr);
+ if (strlen(name) > 0 && strlen(name) < 30)
+ strcpy(address, name);
break;
- case 26: // saveGameRead
- warning("o8_kernelSetFunctions: saveGameRead(%d, %d)", args[1], args[2]);
+ }
+ case 26: { // saveGame?
+ //SaveFileManager *mgr = _system->get_savefile_manager();
+ //char *address = (char*)getStringAddress(args[2]);
+ char address[30];
+ warning("o8_kernelSetFunctions: saveGame?(%d, %s)", args[1], address);
break;
- case 27: // saveGameReadName
- warning("o8_kernelSetFunctions: saveGameReadName(%d)", args[1]);
+ }
+ case 27: { // FIXME: This doesn't work
+ // saveGameRead
+ _saveLoadSlot = 0;
+ _saveLoadFlag = 2;
+ _saveLoadCompatible = false;
+ warning("Sgl: %d\n", args[1]);
break;
+ }
case 28: // saveGameStampScreenshot
warning("o8_kernelSetFunctions: saveGameStampScreenshot(%d, %d, %d, %d, %d, %d)", args[1], args[2], args[3], args[4], args[5], args[6]);
break;
@@ -1686,14 +1720,18 @@ void Scumm_v8::o8_getObjectImageHeight()
void Scumm_v8::o8_getStringWidth()
{
+ char temp[1024];
int charset = pop();
int len = resStrLen(_scriptPointer);
int oldID = _charset->getCurID();
int width;
+ // Parse the string to get rid of substitution codes
+ strcpy(temp, (char*)_scriptPointer);
+ addMessageToStack((byte*)&temp);
// Temporary set the specified charset id
_charset->setCurID(charset);
- width = _charset->getStringWidth(0, _scriptPointer);
+ width = _charset->getStringWidth(0, (byte*)temp);
_charset->setCurID(oldID);
push(width);
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index f5dae0b3ff..44e80f7c34 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -1,6 +1,6 @@
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001 Ludvig Strigeus
- * wCopyright (C) 2001/2002 The ScummVM project
+ * Copyright (C) 2001-2003 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -461,7 +461,7 @@ int Scumm::scummLoop(int delta)
_vars[VAR_GAME_LOADED] = 0;
if (_saveLoadFlag) {
bool success;
- const char *errMsg = "Succesfully saved game state to file:\n\n%s";
+ const char *errMsg = "Succesfully saved/loaded game state in file:\n\n%s";
char filename[256];
if (_saveLoadFlag == 1) {