o Eliminate all structure _tags.

o Fix RSCFile on MSVC8.
 o Started fixing script opcodes.

svn-id: r14686
This commit is contained in:
Eugene Sandulenko 2004-08-22 18:28:42 +00:00
parent 4f51ae9988
commit bfd0b42700
12 changed files with 135 additions and 143 deletions

View File

@ -61,7 +61,7 @@ struct R_SUBCVAR_FUNC {
int max_args;
};
typedef struct R_CVAR_tag {
struct R_CVAR {
int type;
const char *name;
const char *section;
@ -76,9 +76,9 @@ typedef struct R_CVAR_tag {
R_SUBCVAR_FUNC func;
} t;
struct R_CVAR_tag *next;
R_CVAR *next;
} R_CVAR;
};
} // End of namespace Saga

View File

@ -40,25 +40,25 @@ typedef char cv_char_t;
typedef void (*cv_func_t) (int cv_argc, char *cv_argv[], void *refCon);
/******************************************/
typedef struct R_CVAR_tag *R_CVAR_P; // opaque typedef
typedef struct R_CVAR *R_CVAR_P; // opaque typedef
typedef enum R_CVAR_TYPES_tag {
enum R_CVAR_TYPES {
R_CVAR_INVALID,
R_CVAR_INT,
R_CVAR_UINT,
R_CVAR_FLOAT,
R_CVAR_STRING,
R_CVAR_FUNC
} R_CVAR_TYPES;
};
typedef enum R_CVAR_FLAGS_tag {
enum R_CVAR_FLAGS {
R_CVAR_NONE,
R_CVAR_READONLY,
R_CVAR_LBOUND,
R_CVAR_UBOUND,
R_CVAR_CFG,
R_CVAR_SECTION
} R_CVAR_FLAGS;
};
#define R_CVAR_BOUNDED ( R_CVAR_LBOUND | R_CVAR_UBOUND )

View File

@ -516,6 +516,7 @@ int LoadGame(const char *game_dir, uint16 game_n) {
return R_MEM;
}
File::addDefaultDirectory(game_dir);
GameModule.gfile_n = game_filect;
// Load game resource files

View File

@ -31,10 +31,10 @@
namespace Saga {
typedef enum INTERFACE_UPDATE_FLAGS_tag {
enum INTERFACE_UPDATE_FLAGS {
UPDATE_MOUSEMOVE = 1,
UPDATE_MOUSECLICK
} INTERFACE_UPDATE_FLAGS;
};
#define R_VERB_STRLIMIT 32
@ -72,18 +72,18 @@ typedef enum INTERFACE_UPDATE_FLAGS_tag {
#define IHNM_LPORTRAIT_X 5
#define IHNM_LPORTRAIT_Y 4
typedef enum R_PANEL_MODES_tag {
enum R_PANEL_MODES {
PANEL_COMMAND,
PANEL_DIALOGUE
} R_PANEL_MODES;
};
typedef enum R_BUTTON_FLAGS_tag {
enum R_BUTTON_FLAGS {
BUTTON_NONE = 0x0,
BUTTON_LABEL = 0x01,
BUTTON_BITMAP = 0x02,
BUTTON_SET = 0x04
} R_BUTTON_FLAGS;
};
#define BUTTON_VERB ( BUTTON_LABEL | BUTTON_BITMAP | BUTTON_SET )

View File

@ -35,6 +35,7 @@ R_RSCFILE_CONTEXT *RSC_CreateContext() {
empty_context.rc_file_loaded = 0;
empty_context.rc_res_table = NULL;
empty_context.rc_res_ct = 0;
empty_context.rc_file = new File();
R_RSCFILE_CONTEXT *new_context;
new_context = (R_RSCFILE_CONTEXT *)malloc(sizeof *new_context);
@ -48,11 +49,11 @@ R_RSCFILE_CONTEXT *RSC_CreateContext() {
}
int RSC_OpenContext(R_RSCFILE_CONTEXT *rsc_context, const char *fspec) {
if (rsc_context->rc_file.isOpen()) {
if (rsc_context->rc_file->isOpen()) {
return R_FAILURE;
}
if (!rsc_context->rc_file.open(fspec)) {
if (!rsc_context->rc_file->open(fspec)) {
return R_FAILURE;
}
@ -68,8 +69,8 @@ int RSC_OpenContext(R_RSCFILE_CONTEXT *rsc_context, const char *fspec) {
}
int RSC_CloseContext(R_RSCFILE_CONTEXT *rsc_context) {
if (rsc_context->rc_file.isOpen()) {
rsc_context->rc_file.close();
if (rsc_context->rc_file->isOpen()) {
rsc_context->rc_file->close();
}
RSC_FreeRSC(rsc_context);
@ -102,14 +103,14 @@ int RSC_LoadRSC(R_RSCFILE_CONTEXT *rsc) {
R_RSCFILE_RESOURCE *rsc_restbl;
if (rsc->rc_file.size() < RSC_MIN_FILESIZE) {
if (rsc->rc_file->size() < RSC_MIN_FILESIZE) {
return R_FAILURE;
}
// Read resource table info from the rear end of file
rsc->rc_file.seek((long)(rsc->rc_file.size() - 8), SEEK_SET);
rsc->rc_file->seek((long)(rsc->rc_file->size() - 8), SEEK_SET);
if (rsc->rc_file.read(tblinfo_buf, RSC_TABLEINFO_SIZE) != RSC_TABLEINFO_SIZE) {
if (rsc->rc_file->read(tblinfo_buf, RSC_TABLEINFO_SIZE) != RSC_TABLEINFO_SIZE) {
return R_FAILURE;
}
@ -119,7 +120,7 @@ int RSC_LoadRSC(R_RSCFILE_CONTEXT *rsc) {
res_tbl_ct = readS.readUint32LE();
// Check for sane table offset
if (res_tbl_offset != rsc->rc_file.size() - RSC_TABLEINFO_SIZE - RSC_TABLEENTRY_SIZE * res_tbl_ct) {
if (res_tbl_offset != rsc->rc_file->size() - RSC_TABLEINFO_SIZE - RSC_TABLEENTRY_SIZE * res_tbl_ct) {
return R_FAILURE;
}
@ -132,9 +133,9 @@ int RSC_LoadRSC(R_RSCFILE_CONTEXT *rsc) {
return R_FAILURE;
}
rsc->rc_file.seek((long)res_tbl_offset, SEEK_SET);
rsc->rc_file->seek((long)res_tbl_offset, SEEK_SET);
if (rsc->rc_file.read(tbl_buf, tbl_len) != tbl_len) {
if (rsc->rc_file->read(tbl_buf, tbl_len) != tbl_len) {
free(tbl_buf);
return R_FAILURE;
}
@ -150,7 +151,7 @@ int RSC_LoadRSC(R_RSCFILE_CONTEXT *rsc) {
for (i = 0; i < res_tbl_ct; i++) {
rsc_restbl[i].res_offset = readS1.readUint32LE();
rsc_restbl[i].res_size = readS1.readUint32LE();
if ((rsc_restbl[i].res_offset > rsc->rc_file.size()) || (rsc_restbl[i].res_size > rsc->rc_file.size())) {
if ((rsc_restbl[i].res_offset > rsc->rc_file->size()) || (rsc_restbl[i].res_size > rsc->rc_file->size())) {
free(tbl_buf);
free(rsc_restbl);
return R_FAILURE;
@ -170,6 +171,9 @@ int RSC_FreeRSC(R_RSCFILE_CONTEXT *rsc) {
return R_FAILURE;
}
delete rsc->rc_file;
rsc->rc_file = NULL;
free(rsc->rc_res_table);
return R_SUCCESS;
@ -223,14 +227,14 @@ int RSC_LoadResource(R_RSCFILE_CONTEXT *rsc, uint32 res_num, byte **res_p, size_
res_offset = rsc->rc_res_table[res_num].res_offset;
res_size = rsc->rc_res_table[res_num].res_size;
rsc->rc_file.seek((long)res_offset, SEEK_SET);
rsc->rc_file->seek((long)res_offset, SEEK_SET);
res_buf = (byte *)malloc(res_size);
if (res_buf == NULL) {
return R_MEM;
}
if (rsc->rc_file.read(res_buf, res_size) != res_size) {
if (rsc->rc_file->read(res_buf, res_size) != res_size) {
free(res_buf);
return R_FAILURE;
}

View File

@ -26,6 +26,7 @@
#ifndef SAGA_RSCFILE_H__
#define SAGA_RSCFILE_H__
#include "backends/fs/fs.h"
#include "common/file.h"
namespace Saga {
@ -43,7 +44,7 @@ struct R_RSCFILE_RESOURCE {
struct R_RSCFILE_CONTEXT {
const char *rc_file_fspec;
File rc_file;
File *rc_file;
int rc_file_loaded;
R_RSCFILE_RESOURCE *rc_res_table;
size_t rc_res_ct;

View File

@ -102,16 +102,18 @@ Script::Script() {
}
// Convert LUT resource to logical LUT
MemoryReadStream readS(rsc_ptr, rsc_len);
MemoryReadStream scriptS(rsc_ptr, rsc_len);
for (i = 0; i < _scriptLUTMax; i++) {
prevTell = readS.pos();
_scriptLUT[i].script_rn = readS.readUint16LE();
_scriptLUT[i].diag_list_rn = readS.readUint16LE();
_scriptLUT[i].voice_lut_rn = readS.readUint16LE();
prevTell = scriptS.pos();
_scriptLUT[i].script_rn = scriptS.readUint16LE();
_scriptLUT[i].diag_list_rn = scriptS.readUint16LE();
_scriptLUT[i].voice_lut_rn = scriptS.readUint16LE();
// Skip the unused portion of the structure
for (j = readS.pos(); j < prevTell + _scriptLUTEntryLen; j++)
readS.readByte();
for (j = scriptS.pos(); j < prevTell + _scriptLUTEntryLen; j++) {
if (scriptS.readByte() != 0)
error("Unused scriptLUT part isn't really unused for LUT %d (pos: %d)", i, j);
}
}
RSC_FreeResource(rsc_ptr);
@ -324,12 +326,12 @@ R_SCRIPT_BYTECODE *Script::loadBytecode(byte *bytecode_p, size_t bytecode_len) {
debug(0, "Loading script bytecode...");
MemoryReadStream readS(bytecode_p, bytecode_len);
MemoryReadStream scriptS(bytecode_p, bytecode_len);
// The first two uint32 values are the number of entrypoints, and the
// offset to the entrypoint table, respectively.
n_entrypoints = readS.readUint32LE();
ep_tbl_offset = readS.readUint32LE();
n_entrypoints = scriptS.readUint32LE();
ep_tbl_offset = scriptS.readUint32LE();
// Check that the entrypoint table offset is valid.
if ((bytecode_len - ep_tbl_offset) < (n_entrypoints * R_SCRIPT_TBLENTRY_LEN)) {
@ -360,15 +362,15 @@ R_SCRIPT_BYTECODE *Script::loadBytecode(byte *bytecode_p, size_t bytecode_len) {
// Read in the entrypoint table
while (readS.pos() < ep_tbl_offset)
readS.readByte();
while (scriptS.pos() < ep_tbl_offset)
scriptS.readByte();
for (i = 0; i < n_entrypoints; i++) {
// First uint16 is the offset of the entrypoint name from the start
// of the bytecode resource, second uint16 is the offset of the
// bytecode itself for said entrypoint
bc_ep_tbl[i].name_offset = readS.readUint16LE();
bc_ep_tbl[i].offset = readS.readUint16LE();
bc_ep_tbl[i].name_offset = scriptS.readUint16LE();
bc_ep_tbl[i].offset = scriptS.readUint16LE();
// Perform a simple range check on offset values
if ((bc_ep_tbl[i].name_offset > bytecode_len) || (bc_ep_tbl[i].offset > bytecode_len)) {
@ -405,10 +407,10 @@ R_DIALOGUE_LIST *Script::loadDialogue(const byte *dialogue_p, size_t dialogue_le
return NULL;
}
MemoryReadStream readS(dialogue_p, dialogue_len);
MemoryReadStream scriptS(dialogue_p, dialogue_len);
// First uint16 is the offset of the first string
offset = readS.readUint16LE();
offset = scriptS.readUint16LE();
if (offset > dialogue_len) {
warning("Error, invalid string offset");
return NULL;
@ -434,9 +436,9 @@ R_DIALOGUE_LIST *Script::loadDialogue(const byte *dialogue_p, size_t dialogue_le
}
// Read in tables from dialogue list resource
readS.seek(0);
scriptS.seek(0);
for (i = 0; i < n_dialogue; i++) {
offset = readS.readUint16LE();
offset = scriptS.readUint16LE();
if (offset > dialogue_len) {
warning("Error, invalid string offset");
free(dialogue_list->str);
@ -476,10 +478,10 @@ R_VOICE_LUT *Script::loadVoiceLUT(const byte *voicelut_p, size_t voicelut_len, R
return NULL;
}
MemoryReadStream readS(voicelut_p, voicelut_len);
MemoryReadStream scriptS(voicelut_p, voicelut_len);
for (i = 0; i < n_voices; i++) {
voice_lut->voices[i] = readS.readUint16LE();
voice_lut->voices[i] = scriptS.readUint16LE();
}
return voice_lut;

View File

@ -71,7 +71,7 @@ struct R_SEMAPHORE {
int hold_count;
};
struct R_SCRIPT_THREAD_tag {
struct R_SCRIPT_THREAD {
int executing;
int sleep_time;
@ -83,8 +83,6 @@ struct R_SCRIPT_THREAD_tag {
Common::Stack<SDataWord_T> *stack;
};
typedef struct R_SCRIPT_THREAD_tag R_SCRIPT_THREAD;
struct R_PROC_TBLENTRY {
size_t name_offset;
size_t offset;

View File

@ -48,7 +48,7 @@ struct R_SPRITELIST_OFFSET {
size_t offset;
};
struct R_SPRITELIST_tag {
struct R_SPRITELIST {
int append_count;
int sprite_count;
R_SPRITELIST_OFFSET *offset_list;
@ -56,7 +56,6 @@ struct R_SPRITELIST_tag {
byte *sprite_data[R_APPENDMAX];
};
typedef struct R_SPRITELIST_tag R_SPRITELIST;
class Sprite {
public:

View File

@ -215,66 +215,53 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
saved_offset = thread->i_offset;
MemoryReadStream readS(SThreadGetReadPtr(thread), SThreadGetReadLen(thread));
MemoryReadStream scriptS(SThreadGetReadPtr(thread), SThreadGetReadLen(thread));
in_char = readS.readByte();
in_char = scriptS.readByte();
debug(0, "Executing thread offset: %lu (%x)", thread->i_offset, in_char);
switch (in_char) {
// Align (ALGN)
case 0x01:
case 0x01: // Align (ALGN)
debug(0, "Stub: ALGN");
break;
// STACK INSTRUCTIONS
// Dup top element (DUP)
case 0x02:
case 0x02: // Dup top element (DUP)
thread->stack->push(thread->stack->top());
break;
// Pop nothing (POPN)
case 0x03:
case 0x03: // Pop nothing (POPN)
thread->stack->pop();
break;
// Push false (PSHF)
case 0x04:
case 0x04: // Push false (PSHF)
thread->stack->push(0);
break;
// Push true (PSHT)
case 0x06:
case 0x05: // Push true (PSHT)
thread->stack->push(1);
break;
// Push word (PUSH)
case 0x07:
param1 = (SDataWord_T)readS.readUint16LE();
thread->stack->push(param1);
break;
// Push word (PSHD) (dialogue string index)
case 0x08:
param1 = (SDataWord_T)readS.readUint16LE();
case 0x06: // Push word (PUSH)
case 0x08: // Push word (PSHD) (dialogue string index)
param1 = (SDataWord_T)scriptS.readUint16LE();
thread->stack->push(param1);
break;
// DATA INSTRUCTIONS
// Test flag (TSTF)
case 0x0B:
n_buf = readS.readByte();
param1 = (SDataWord_T)readS.readUint16LE();
case 0x0B: // Test flag (TSTF)
n_buf = scriptS.readByte();
param1 = (SDataWord_T)scriptS.readUint16LE();
_vm->_sdata->getBit(n_buf, param1, &bitstate);
thread->stack->push(bitstate);
break;
// Get word (GETW)
case 0x0C:
n_buf = readS.readByte();
param1 = readS.readUint16LE();
case 0x0C: // Get word (GETW)
n_buf = scriptS.readByte();
param1 = scriptS.readUint16LE();
_vm->_sdata->getWord(n_buf, param1, &data);
thread->stack->push(data);
break;
// Modify flag (MODF)
case 0x0F:
n_buf = readS.readByte();
param1 = (SDataWord_T)readS.readUint16LE();
case 0x0F: // Modify flag (MODF)
n_buf = scriptS.readByte();
param1 = (SDataWord_T)scriptS.readUint16LE();
bitstate = _vm->_sdata->readWordU(param1);
data = thread->stack->top();
if (bitstate) {
@ -283,17 +270,15 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
_vm->_sdata->setBit(n_buf, data, 0);
}
break;
// Put word (PUTW)
case 0x10:
n_buf = readS.readByte();
param1 = (SDataWord_T)readS.readUint16LE();
case 0x10: // Put word (PUTW)
n_buf = scriptS.readByte();
param1 = (SDataWord_T)scriptS.readUint16LE();
data = thread->stack->top();
_vm->_sdata->putWord(n_buf, param1, data);
break;
// Modify flag and pop (MDFP)
case 0x13:
n_buf = readS.readByte();
param1 = (SDataWord_T)readS.readUint16LE();
case 0x13: // Modify flag and pop (MDFP)
n_buf = scriptS.readByte();
param1 = (SDataWord_T)scriptS.readUint16LE();
param1 = thread->stack->pop();
bitstate = _vm->_sdata->readWordU(param1);
if (bitstate) {
@ -302,10 +287,9 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
_vm->_sdata->setBit(n_buf, param1, 0);
}
break;
// Put word and pop (PTWP)
case 0x14:
n_buf = readS.readByte();
param1 = (SDataWord_T)readS.readUint16LE();
case 0x14: // Put word and pop (PTWP)
n_buf = scriptS.readByte();
param1 = (SDataWord_T)scriptS.readUint16LE();
data = thread->stack->top();
_vm->_sdata->putWord(n_buf, param1, data);
break;
@ -318,10 +302,10 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
int temp;
int temp2;
temp = readS.readByte();
temp2 = readS.readByte();
param1 = (SDataWord_T)readS.readUint16LE();
data = readS.pos();
temp = scriptS.readByte();
temp2 = scriptS.readByte();
param1 = (SDataWord_T)scriptS.readUint16LE();
data = scriptS.pos();
//thread->stack->push((SDataWord_T)temp);
thread->stack->push(data);
thread->i_offset = (unsigned long)param1;
@ -336,8 +320,8 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
int FIXME_SHADOWED_result;
SFunc_T sfunc;
n_args = readS.readByte();
func_num = readS.readUint16LE();
n_args = scriptS.readByte();
func_num = scriptS.readUint16LE();
if (func_num >= R_SFUNC_NUM) {
_vm->_console->print(S_ERROR_PREFIX "Invalid script function number: (%X)\n", func_num);
thread->executing = 0;
@ -360,12 +344,11 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
}
}
break;
// (ENTR) Enter the dragon
case 0x1A:
//data = readS.pos();
case 0x1A: // (ENTR) Enter the dragon
//data = scriptS.pos();
//thread->stack->push(data);
param1 = readS.readUint16LE();
param1 = scriptS.readUint16LE();
break;
// (?) Unknown
case 0x1B:
@ -386,12 +369,12 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
// (JMP): Unconditional jump
case 0x1D:
param1 = readS.readUint16LE();
param1 = scriptS.readUint16LE();
thread->i_offset = (unsigned long)param1;
break;
// (JNZP): Jump if nonzero + POP
case 0x1E:
param1 = readS.readUint16LE();
param1 = scriptS.readUint16LE();
data = thread->stack->pop();
if (data) {
thread->i_offset = (unsigned long)param1;
@ -399,7 +382,7 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
break;
// (JZP): Jump if zero + POP
case 0x1F:
param1 = readS.readUint16LE();
param1 = scriptS.readUint16LE();
data = thread->stack->pop();
if (!data) {
thread->i_offset = (unsigned long)param1;
@ -407,7 +390,7 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
break;
// (JNZ): Jump if nonzero
case 0x20:
param1 = readS.readUint16LE();
param1 = scriptS.readUint16LE();
data = thread->stack->top();
if (data) {
thread->i_offset = (unsigned long)param1;
@ -415,7 +398,7 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
break;
// (JZ): Jump if zero
case 0x21:
param1 = readS.readUint16LE();
param1 = scriptS.readUint16LE();
data = thread->stack->top();
if (!data) {
thread->i_offset = (unsigned long)param1;
@ -424,9 +407,9 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
// (JMPR): Relative jump
case 0x57:
// ignored?
readS.readUint16LE();
readS.readUint16LE();
iparam1 = (long)readS.readByte();
scriptS.readUint16LE();
scriptS.readUint16LE();
iparam1 = (long)scriptS.readByte();
thread->i_offset += iparam1;
break;
// (SWCH): Switch
@ -439,10 +422,10 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
int case_found = 0;
data = thread->stack->pop();
n_switch = readS.readUint16LE();
n_switch = scriptS.readUint16LE();
for (i = 0; i < n_switch; i++) {
switch_num = readS.readUint16LE();
switch_jmp = readS.readUint16LE();
switch_num = scriptS.readUint16LE();
switch_jmp = scriptS.readUint16LE();
// Found the specified case
if (data == (SDataWord_T) switch_num) {
thread->i_offset = switch_jmp;
@ -453,7 +436,7 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
// Jump to default case
if (!case_found) {
default_jmp = readS.readUint16LE();
default_jmp = scriptS.readUint16LE();
thread->i_offset = default_jmp;
}
}
@ -468,11 +451,11 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
int branch_found = 0;
// Ignored?
readS.readUint16LE();
n_branch = readS.readUint16LE();
scriptS.readUint16LE();
n_branch = scriptS.readUint16LE();
for (i = 0; i < n_branch; i++) {
branch_wt = readS.readUint16LE();
branch_jmp = readS.readUint16LE();
branch_wt = scriptS.readUint16LE();
branch_jmp = scriptS.readUint16LE();
if (rand_sel == i) {
thread->i_offset = branch_jmp;
branch_found = 1;
@ -510,29 +493,29 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
case 0x28:
unhandled = 1;
printf("??? ");
readS.readByte();
readS.readUint16LE();
scriptS.readByte();
scriptS.readUint16LE();
break;
// (?)
case 0x29:
unhandled = 1;
printf("??? ");
readS.readByte();
readS.readUint16LE();
scriptS.readByte();
scriptS.readUint16LE();
break;
// (?)
case 0x2A:
unhandled = 1;
printf("??? ");
readS.readByte();
readS.readUint16LE();
scriptS.readByte();
scriptS.readUint16LE();
break;
// (?)
case 0x2B:
unhandled = 1;
printf("??? ");
readS.readByte();
readS.readUint16LE();
scriptS.readByte();
scriptS.readUint16LE();
break;
// ARITHMETIC INSTRUCTIONS
@ -714,11 +697,11 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
int a_index;
int voice_rn;
n_voices = readS.readByte();
param1 = (SDataWord_T) readS.readUint16LE();
n_voices = scriptS.readByte();
param1 = (SDataWord_T) scriptS.readUint16LE();
// ignored ?
readS.readByte();
readS.readUint16LE();
scriptS.readByte();
scriptS.readUint16LE();
a_index = _vm->_actor->getActorIndex(param1);
if (a_index < 0) {
@ -752,12 +735,12 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
int FIXME_SHADOWED_param3;
printf("DLGO | ");
FIXME_SHADOWED_param1 = readS.readByte();
FIXME_SHADOWED_param2 = readS.readByte();
FIXME_SHADOWED_param1 = scriptS.readByte();
FIXME_SHADOWED_param2 = scriptS.readByte();
printf("%02X %02X ", FIXME_SHADOWED_param1, FIXME_SHADOWED_param2);
if (FIXME_SHADOWED_param2 > 0) {
FIXME_SHADOWED_param3 = readS.readUint16LE();
FIXME_SHADOWED_param3 = scriptS.readUint16LE();
printf("%04X", FIXME_SHADOWED_param3);
}
}
@ -774,7 +757,7 @@ int Script::SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec) {
// Set instruction offset only if a previous instruction didn't branch
if (saved_offset == thread->i_offset) {
thread->i_offset = readS.pos();
thread->i_offset = scriptS.pos();
}
if (unhandled) {
_vm->_console->print(S_ERROR_PREFIX "%X: Unhandled opcode.\n", thread->i_offset);

View File

@ -34,7 +34,7 @@ namespace Saga {
#define R_TEXT_MARGIN 10
#define R_TEXT_LINESPACING 2
struct R_TEXTLIST_tag {
struct R_TEXTLIST {
YS_DL_LIST *list;
};
@ -43,8 +43,8 @@ enum R_TEXT_FLAGS {
};
struct R_TEXTLIST_ENTRY {
struct R_TEXTLIST_ENTRY_tag *next;
struct R_TEXTLIST_ENTRY_tag *prev;
R_TEXTLIST_ENTRY *next;
R_TEXTLIST_ENTRY *prev;
int display;
int id;
int text_x;
@ -58,7 +58,6 @@ struct R_TEXTLIST_ENTRY {
R_TEXTLIST_ENTRY() { memset(this, 0, sizeof(*this)); }
};
typedef struct R_TEXTLIST_tag R_TEXTLIST;
} // End of namespace Saga
#endif

View File

@ -51,3 +51,8 @@ Interp.c
========
dispatchThreads() STHREAD_ExecThreads()
runThread() STHREAD_completeThread()
moduleList _scriptLUT
ModuleEntry->codeID _scriptLUT->script_rn
ModuleEntry->strID _scriptLUT->diag_list_rn
ModuleEntry->vtableID _scriptLUT->voice_lut_rn