cleanup and small fixes
svn-id: r25738
This commit is contained in:
parent
1bd5f9932b
commit
5886d3ed7f
6 changed files with 26 additions and 96 deletions
|
@ -269,8 +269,7 @@ void Parallaction::loadProgram(Animation *a, char *filename) {
|
||||||
|
|
||||||
_numLocals = 0;
|
_numLocals = 0;
|
||||||
|
|
||||||
LocScript *script = new LocScript(src);
|
Script *script = new Script(src);
|
||||||
// scriptFillBuffers(file);
|
|
||||||
|
|
||||||
fillBuffers(*script);
|
fillBuffers(*script);
|
||||||
|
|
||||||
|
@ -291,12 +290,14 @@ void Parallaction::loadProgram(Animation *a, char *filename) {
|
||||||
vCC = (Instruction*)memAlloc(sizeof(Instruction));
|
vCC = (Instruction*)memAlloc(sizeof(Instruction));
|
||||||
memset(vCC, 0, sizeof(Instruction));
|
memset(vCC, 0, sizeof(Instruction));
|
||||||
fillBuffers(*script);
|
fillBuffers(*script);
|
||||||
// scriptFillBuffers(file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vCC->_index = INST_END;
|
vCC->_index = INST_END;
|
||||||
addNode(vD0, &vCC->_node);
|
addNode(vD0, &vCC->_node);
|
||||||
|
|
||||||
|
delete script;
|
||||||
|
delete src;
|
||||||
|
|
||||||
a->_program->_ip = (Instruction*)a->_program->_node._next;
|
a->_program->_ip = (Instruction*)a->_program->_node._next;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -76,8 +76,7 @@ void Parallaction::parseLocation(const char *filename) {
|
||||||
uint32 count = file->_endOffset - file->_offset;
|
uint32 count = file->_endOffset - file->_offset;
|
||||||
location_src = (char*)memAlloc(0x4000);
|
location_src = (char*)memAlloc(0x4000);
|
||||||
|
|
||||||
_locationScript = new LocScript(location_src);
|
_locationScript = new Script(location_src);
|
||||||
// parseInit(location_src);
|
|
||||||
|
|
||||||
readArchivedFile(file, location_src, count);
|
readArchivedFile(file, location_src, count);
|
||||||
closeArchivedFile(file);
|
closeArchivedFile(file);
|
||||||
|
@ -192,6 +191,10 @@ void Parallaction::parseLocation(const char *filename) {
|
||||||
|
|
||||||
resolveLocationForwards();
|
resolveLocationForwards();
|
||||||
_vm->_graphics->freeCnv(&Graphics::_font);
|
_vm->_graphics->freeCnv(&Graphics::_font);
|
||||||
|
|
||||||
|
delete _locationScript;
|
||||||
|
_locationScript = NULL;
|
||||||
|
|
||||||
memFree(location_src);
|
memFree(location_src);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -165,6 +165,8 @@ Parallaction::Parallaction(OSystem *syst) :
|
||||||
_activeItem._id = 0;
|
_activeItem._id = 0;
|
||||||
_procCurrentHoverItem = -1;
|
_procCurrentHoverItem = -1;
|
||||||
|
|
||||||
|
_locationScript = NULL;
|
||||||
|
|
||||||
_musicData1 = 0;
|
_musicData1 = 0;
|
||||||
strcpy(_characterName1, "null");
|
strcpy(_characterName1, "null");
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ public:
|
||||||
|
|
||||||
InventoryItem _activeItem;
|
InventoryItem _activeItem;
|
||||||
|
|
||||||
LocScript *_locationScript;
|
Script *_locationScript;
|
||||||
|
|
||||||
protected: // data
|
protected: // data
|
||||||
|
|
||||||
|
|
|
@ -28,40 +28,12 @@
|
||||||
namespace Parallaction {
|
namespace Parallaction {
|
||||||
|
|
||||||
char _tokens[20][40];
|
char _tokens[20][40];
|
||||||
/*
|
|
||||||
static char *_src = NULL;
|
|
||||||
|
|
||||||
|
Script::Script(const char* s) : _src(s) {
|
||||||
|
|
||||||
void parseInit(char *s) {
|
|
||||||
_src = s;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *parseNextLine(char *s, uint16 count) {
|
|
||||||
|
|
||||||
uint16 _si;
|
|
||||||
char v2 = 0;
|
|
||||||
for ( _si = 0; _si<count; _si++) {
|
|
||||||
|
|
||||||
v2 = *_src++;
|
|
||||||
if (v2 == 0xA || v2 == -1) break;
|
|
||||||
if (v2 != -1 && _si < count) s[_si] = v2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_si == 0 && v2 == -1)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
s[_si] = 0xA;
|
|
||||||
s[_si+1] = '\0';
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
LocScript::LocScript(const char* s) : _src(s) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *LocScript::readLine(char *buf, size_t bufSize) {
|
char *Script::readLine(char *buf, size_t bufSize) {
|
||||||
|
|
||||||
uint16 _si;
|
uint16 _si;
|
||||||
char v2 = 0;
|
char v2 = 0;
|
||||||
|
@ -82,24 +54,24 @@ char *LocScript::readLine(char *buf, size_t bufSize) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 LocScript::read(void *dataPtr, uint32 dataSize) {
|
uint32 Script::read(void *dataPtr, uint32 dataSize) {
|
||||||
error("binary read not supported on LocScript streams");
|
error("binary read not supported on Script streams");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocScript::eos() const {
|
bool Script::eos() const {
|
||||||
error("EoS not supported on LocScript streams");
|
error("EoS not supported on Script streams");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 LocScript::pos() const {
|
uint32 Script::pos() const {
|
||||||
error("position not supported on LocScript streams");
|
error("position not supported on Script streams");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 LocScript::size() const {
|
uint32 Script::size() const {
|
||||||
error("can't get size of LocScript streams");
|
error("can't get size of Script streams");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocScript::seek(int32 offset, int whence) {
|
void Script::seek(int32 offset, int whence) {
|
||||||
error("seek not supported on LocScript streams");
|
error("seek not supported on Script streams");
|
||||||
}
|
}
|
||||||
|
|
||||||
// looks for next token in a string
|
// looks for next token in a string
|
||||||
|
@ -199,49 +171,5 @@ uint16 fillBuffers(Common::SeekableReadStream &stream, bool errorOnEOF) {
|
||||||
|
|
||||||
return fillTokens(line);
|
return fillTokens(line);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
//
|
|
||||||
// FIXME
|
|
||||||
// this function does the same Job as fillBuffers, except that
|
|
||||||
// it gets input from a SeekableStream instead of a memory buffer
|
|
||||||
//
|
|
||||||
uint16 tableFillBuffers(Common::SeekableReadStream &stream) {
|
|
||||||
|
|
||||||
clearTokens();
|
|
||||||
|
|
||||||
char buf[200];
|
|
||||||
char *line = NULL;
|
|
||||||
do {
|
|
||||||
line = stream.readLine(buf, 200);
|
|
||||||
if (line == NULL) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
line = Common::ltrim(line);
|
|
||||||
} while (strlen(line) == 0 || line[0] == '#');
|
|
||||||
|
|
||||||
return fillTokens(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// FIXME
|
|
||||||
// this function does the same Job as fillBuffers, except that
|
|
||||||
// it gets input from an ArchivedFile instead of a memory buffer
|
|
||||||
//
|
|
||||||
uint16 scriptFillBuffers(ArchivedFile *file) {
|
|
||||||
|
|
||||||
clearTokens();
|
|
||||||
|
|
||||||
char buf[200];
|
|
||||||
char *line = NULL;
|
|
||||||
do {
|
|
||||||
line = readArchivedFileText(buf, 200, file);
|
|
||||||
if (line == NULL) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
line = Common::ltrim(line);
|
|
||||||
} while (strlen(line) == 0 || line[0] == '#');
|
|
||||||
|
|
||||||
return fillTokens(line);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
} // namespace Parallaction
|
} // namespace Parallaction
|
||||||
|
|
|
@ -36,18 +36,14 @@ char *parseComment(ArchivedFile *file);
|
||||||
uint16 fillBuffers(Common::SeekableReadStream &stream, bool errorOnEOF = false);
|
uint16 fillBuffers(Common::SeekableReadStream &stream, bool errorOnEOF = false);
|
||||||
char *parseNextToken(char *s, char *tok, uint16 count, const char *brk);
|
char *parseNextToken(char *s, char *tok, uint16 count, const char *brk);
|
||||||
|
|
||||||
//uint16 tableFillBuffers(Common::SeekableReadStream &stream);
|
|
||||||
//uint16 scriptFillBuffers(ArchivedFile *file);
|
|
||||||
|
|
||||||
|
|
||||||
extern char _tokens[][40];
|
extern char _tokens[][40];
|
||||||
|
|
||||||
class LocScript : public Common::SeekableReadStream {
|
class Script : public Common::SeekableReadStream {
|
||||||
|
|
||||||
const char* _src;
|
const char* _src;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LocScript(const char* s);
|
Script(const char* s);
|
||||||
|
|
||||||
uint32 read(void *dataPtr, uint32 dataSize);
|
uint32 read(void *dataPtr, uint32 dataSize);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue