[Scummvm-cvs-logs] CVS: scummvm/sword2 interpreter.cpp,1.31,1.32 interpreter.h,1.11,1.12 logic.h,1.23,1.24 speech.cpp,1.53,1.54
Torbj?rn Andersson
eriktorbjorn at users.sourceforge.net
Sun Dec 14 08:34:01 CET 2003
Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1:/tmp/cvs-serv31794
Modified Files:
interpreter.cpp interpreter.h logic.h speech.cpp
Log Message:
Mostly cleanups, but I believe this also fixes an endian problem in the
"restart script" opcode. To actually verify this, though, I'd need to find
a case where any other script than script 0 at offset 0 is restarted...
Index: interpreter.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/interpreter.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- interpreter.cpp 29 Nov 2003 17:05:30 -0000 1.31
+++ interpreter.cpp 14 Dec 2003 16:33:27 -0000 1.32
@@ -24,197 +24,188 @@
namespace Sword2 {
-// This file serves two purposes. It is compiled as part of the test functions
-// of Linc, and also as part of the game
-
-// I assume Linc was the name of some sort of development tool. Anyway, I've
-// removed the pieces of code that were labelled as INSIDE_LINC, because we
-// don't have it, and probably wouldn't have much use for it if we did.
-
// The machine code table
[...1006 lines suppressed...]
- debug(5, "%d <= %d -> %d",
- stack2[stackPointer2 - 2],
- stack2[stackPointer2 - 1],
- stack2[stackPointer2 - 2] <= stack2[stackPointer2 - 1]);
- DOOPERATION(stack2[stackPointer2 - 2] <= stack2[stackPointer2 - 1]);
- break;
- case OP_OROR:
- // '||'
- debug(5, "%d || %d -> %d",
- stack2[stackPointer2 - 2],
- stack2[stackPointer2 - 1],
- stack2[stackPointer2 - 2] || stack2[stackPointer2 - 1]);
- DOOPERATION (stack2[stackPointer2 - 2] || stack2[stackPointer2 - 1]);
- break;
default:
- error("Interpreter error: Invalid token %d", curCommand);
+ error("Invalid script command %d", curCommand);
return 3;
}
}
Index: interpreter.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/interpreter.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- interpreter.h 21 Oct 2003 08:54:50 -0000 1.11
+++ interpreter.h 14 Dec 2003 16:33:27 -0000 1.12
@@ -54,11 +54,11 @@
CP_SKIPALWAYS = 8, // Skip a block of code
CP_SWITCH = 9, // Switch on last stack value
CP_ADDNPOP_LOCAL_VAR32 = 10, // Add to a local varible
- CP_SUBNPOP_LOCAL_VAR32 = 11, // Subtract to a local variable
+ CP_SUBNPOP_LOCAL_VAR32 = 11, // Subtract from a local variable
CP_SKIPONTRUE = 12, // Skip if the bottom value on the stack is true
CP_POP_GLOBAL_VAR32 = 13, // Pop a global variable
- CP_ADDNPOP_GLOBAL_VAR32 = 14,
- CP_SUBNPOP_GLOBAL_VAR32 = 15,
+ CP_ADDNPOP_GLOBAL_VAR32 = 14, // Add to a global variable
+ CP_SUBNPOP_GLOBAL_VAR32 = 15, // Subtract from a global variable
CP_DEBUGON = 16, // Turn debugging on
CP_DEBUGOFF = 17, // Turn debugging off
CP_QUIT = 18, // Quit for a cycle
Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/logic.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- logic.h 1 Dec 2003 07:47:54 -0000 1.23
+++ logic.h 14 Dec 2003 16:33:27 -0000 1.24
@@ -30,6 +30,8 @@
namespace Sword2 {
+#define STACK_SIZE 10
+
#define MAX_events 10
// There won't be many, will there? Probably 2 at most i reckon
@@ -59,14 +61,6 @@
// Set this to turn debugging on
bool _debugFlag;
- typedef int32 (Logic::*OpcodeProc)(int32 *);
- struct OpcodeEntry {
- OpcodeProc proc;
- const char *desc;
- };
-
- const OpcodeEntry *_opcodes;
-
// denotes the res id of the game-object-list in current use
uint32 _currentRunList;
@@ -76,7 +70,6 @@
// each object has one of these tacked onto the beginning
_object_hub *_curObjectHub;
- void setupOpcodes(void);
void processKillList(void);
// Stores resource id of the wav to use as lead-out from smacker
@@ -180,7 +173,6 @@
memset(_eventList, 0, sizeof(_eventList));
memset(_syncList, 0, sizeof(_syncList));
_router = new Router(_vm);
- setupOpcodes();
initStartMenu();
}
@@ -209,8 +201,6 @@
void setGlobalInterpreterVariables(int32 *vars);
int runScript(char *scriptData, char *objectData, uint32 *offset);
-
- int32 executeOpcode(int op, int32 *params);
struct _event_unit {
uint32 id;
Index: speech.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/speech.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- speech.cpp 11 Dec 2003 13:08:36 -0000 1.53
+++ speech.cpp 14 Dec 2003 16:33:27 -0000 1.54
@@ -126,7 +126,7 @@
OBJECT_HELD = 0; // clear it so it doesn't keep happening!
IN_SUBJECT = 0; // clear the subject list
- return IR_CONT + (response << 3);
+ return IR_CONT | (response << 3);
}
// new thing for skipping chooser with "nothing else to say" text
@@ -140,7 +140,7 @@
// return special subject chosen code (same as in normal
// chooser routine below)
- return IR_CONT + (_subjectList[0].ref << 3);
+ return IR_CONT | (_subjectList[0].ref << 3);
}
if (!_choosing) {
@@ -232,7 +232,7 @@
RESULT = _subjectList[hit].res;
// return special subject chosen code
- return IR_CONT + (_subjectList[hit].ref << 3);
+ return IR_CONT | (_subjectList[hit].ref << 3);
}
int32 Logic::fnStartConversation(int32 *params) {
More information about the Scummvm-git-logs
mailing list