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...

svn-id: r11638
This commit is contained in:
Torbjörn Andersson 2003-12-14 16:33:27 +00:00
parent ce04dd9f7e
commit 4420b15d9f
4 changed files with 451 additions and 494 deletions

File diff suppressed because it is too large Load Diff

View File

@ -54,11 +54,11 @@ enum {
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

View File

@ -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 @@ private:
// 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 @@ private:
// 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 @@ public:
memset(_eventList, 0, sizeof(_eventList));
memset(_syncList, 0, sizeof(_syncList));
_router = new Router(_vm);
setupOpcodes();
initStartMenu();
}
@ -210,8 +202,6 @@ public:
void setGlobalInterpreterVariables(int32 *vars);
int runScript(char *scriptData, char *objectData, uint32 *offset);
int32 executeOpcode(int op, int32 *params);
struct _event_unit {
uint32 id;
uint32 interact_id;

View File

@ -126,7 +126,7 @@ int32 Logic::fnChoose(int32 *params) {
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 @@ int32 Logic::fnChoose(int32 *params) {
// 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 @@ int32 Logic::fnChoose(int32 *params) {
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) {