aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2008-01-08 20:32:29 +0000
committerNicola Mettifogo2008-01-08 20:32:29 +0000
commit1b80eedaa18c38ffa2203eb661fda44d245ca6da (patch)
tree999c51eac74608de97f90bcb218442c4debc7741 /engines/parallaction
parentcd23db6ce8fb660320804e1355f37558c2ebccc4 (diff)
downloadscummvm-rg350-1b80eedaa18c38ffa2203eb661fda44d245ca6da.tar.gz
scummvm-rg350-1b80eedaa18c38ffa2203eb661fda44d245ca6da.tar.bz2
scummvm-rg350-1b80eedaa18c38ffa2203eb661fda44d245ca6da.zip
Added a proper _name member to Zone, instead of using the label text.
svn-id: r30343
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/debug.cpp4
-rw-r--r--engines/parallaction/exec_ns.cpp6
-rw-r--r--engines/parallaction/graphics.cpp2
-rw-r--r--engines/parallaction/objects.cpp4
-rw-r--r--engines/parallaction/objects.h4
-rw-r--r--engines/parallaction/parallaction.cpp8
-rw-r--r--engines/parallaction/parser_ns.cpp12
7 files changed, 23 insertions, 17 deletions
diff --git a/engines/parallaction/debug.cpp b/engines/parallaction/debug.cpp
index ecca67bda2..ba7db28e35 100644
--- a/engines/parallaction/debug.cpp
+++ b/engines/parallaction/debug.cpp
@@ -183,7 +183,7 @@ bool Debugger::Cmd_Zones(int argc, const char **argv) {
"+--------------------+---+---+---+---+--------+--------+\n");
for ( ; b != e; b++) {
Zone *z = *b;
- DebugPrintf("|%-20s|%3i|%3i|%3i|%3i|%8x|%8x|\n", z->_label._text, z->_left, z->_top, z->_right, z->_bottom, z->_type, z->_flags );
+ DebugPrintf("|%-20s|%3i|%3i|%3i|%3i|%8x|%8x|\n", z->_name, z->_left, z->_top, z->_right, z->_bottom, z->_type, z->_flags );
}
DebugPrintf("+--------------------+---+---+---+---+--------+--------+\n");
@@ -201,7 +201,7 @@ bool Debugger::Cmd_Animations(int argc, const char **argv) {
"+--------------------+---+---+---+---+--------+--------+\n");
for ( ; b != e; b++) {
Animation *a = *b;
- DebugPrintf("|%-20s|%3i|%3i|%3i|%3i|%8x|%8x|\n", a->_label._text, a->_left, a->_top, a->_z, a->_frame, a->_type, a->_flags );
+ DebugPrintf("|%-20s|%3i|%3i|%3i|%3i|%8x|%8x|\n", a->_name, a->_left, a->_top, a->_z, a->_frame, a->_type, a->_flags );
}
DebugPrintf("+--------------------+---+---+---+---+--------+--------+\n");
diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp
index 18142f9101..f2ee015498 100644
--- a/engines/parallaction/exec_ns.cpp
+++ b/engines/parallaction/exec_ns.cpp
@@ -346,7 +346,7 @@ void Parallaction_ns::drawAnimations() {
else
_si = _gfx->queryMask(v18->_top + v18->height());
- debugC(9, kDebugExec, "jobDisplayAnimations(%s, x:%i, y:%i, z:%i, w:%i, h:%i, f:%i/%i, %p)", v18->_label._text, v18->_left, v18->_top, _si, v14.w, v14.h,
+ debugC(9, kDebugExec, "jobDisplayAnimations(%s, x:%i, y:%i, z:%i, w:%i, h:%i, f:%i/%i, %p)", v18->_name, v18->_left, v18->_top, _si, v14.w, v14.h,
frame, v18->getFrameNum(), v14.pixels);
_gfx->blitCnv(&v14, v18->_left, v18->_top, _si, Gfx::kBitBack);
@@ -410,7 +410,7 @@ void Parallaction_ns::runScripts() {
InstructionList::iterator inst = a->_program->_ip;
while (((*inst)->_index != INST_SHOW) && (a->_flags & kFlagsActing)) {
- debugC(9, kDebugExec, "Animation: %s, instruction: %s", a->_label._text, _instructionNamesRes[(*inst)->_index - 1]);
+ debugC(9, kDebugExec, "Animation: %s, instruction: %s", a->_name, _instructionNamesRes[(*inst)->_index - 1]);
_instRunCtxt.inst = inst;
_instRunCtxt.a = a;
@@ -514,7 +514,7 @@ void Parallaction::displayComment(ExamineData *data) {
uint16 Parallaction::runZone(Zone *z) {
- debugC(3, kDebugExec, "runZone (%s)", z->_label._text);
+ debugC(3, kDebugExec, "runZone (%s)", z->_name);
uint16 subtype = z->_type & 0xFFFF;
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 9c5208845e..a63445117d 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -514,7 +514,7 @@ void Gfx::setLabel(Label *label) {
}
void Gfx::drawLabel() {
- if (!_label || !_label->_text) {
+ if (!_label) {
return;
}
diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp
index 93ebca5ff1..cac1c5e148 100644
--- a/engines/parallaction/objects.cpp
+++ b/engines/parallaction/objects.cpp
@@ -122,10 +122,12 @@ Zone::Zone() {
_type = 0;
_flags = 0;
+
+ memset(_name, 0, ZONENAME_LENGTH);
}
Zone::~Zone() {
-// printf("~Zone(%s)\n", _label._text);
+// printf("~Zone(%s)\n", _name);
switch (_type & 0xFFFF) {
case kZoneExamine:
diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h
index 41596e3e38..5648ea25fb 100644
--- a/engines/parallaction/objects.h
+++ b/engines/parallaction/objects.h
@@ -271,7 +271,11 @@ struct Label {
void getRect(Common::Rect &r);
};
+#define ZONENAME_LENGTH 32
+
struct Zone {
+ char _name[ZONENAME_LENGTH];
+
int16 _left;
int16 _top;
int16 _right;
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 59d81f1f93..9327982a71 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -729,7 +729,7 @@ void Parallaction::parseStatement() {
Animation *Parallaction::findAnimation(const char *name) {
for (AnimationList::iterator it = _animations.begin(); it != _animations.end(); it++)
- if (!scumm_stricmp((*it)->_label._text, name)) return *it;
+ if (!scumm_stricmp((*it)->_name, name)) return *it;
return NULL;
}
@@ -900,7 +900,7 @@ void Parallaction::doLocationEnterTransition() {
Zone *Parallaction::findZone(const char *name) {
for (ZoneList::iterator it = _zones.begin(); it != _zones.end(); it++) {
- if (!scumm_stricmp((*it)->_label._text, name)) return *it;
+ if (!scumm_stricmp((*it)->_name, name)) return *it;
}
return findAnimation(name);
@@ -918,7 +918,7 @@ void Parallaction::freeZones() {
// to retain special - needed - zones that were lost across location switches.
Zone* z = *it;
if (((z->_top == -1) || (z->_left == -2)) && ((_engineFlags & kEngineQuit) == 0)) {
- debugC(2, kDebugExec, "freeZones preserving zone '%s'", z->_label._text);
+ debugC(2, kDebugExec, "freeZones preserving zone '%s'", z->_name);
it++;
} else {
it = _zones.erase(it);
@@ -950,7 +950,7 @@ Character::Character(Parallaction *vm) : _vm(vm), _builder(&_ani) {
_ani._flags = kFlagsActive | kFlagsNoName;
_ani._type = kZoneYou;
_ani._label._cnv.pixels = NULL;
- _ani._label._text = strdup("yourself");
+ strncpy(_ani._name, "yourself", ZONENAME_LENGTH);
}
void Character::getFoot(Common::Point &foot) {
diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp
index e6950299c1..85a330ddd1 100644
--- a/engines/parallaction/parser_ns.cpp
+++ b/engines/parallaction/parser_ns.cpp
@@ -184,7 +184,7 @@ Animation *Parallaction_ns::parseAnimation(Script& script, AnimationList &list,
Animation *a = new Animation;
- a->_label._text = strdup(name);
+ strncpy(a->_name, name, ZONENAME_LENGTH);
list.push_front(a);
@@ -222,7 +222,7 @@ void Parallaction_ns::parseInstruction(Animation *a, LocalVariable *locals) {
}
void Parallaction_ns::loadProgram(Animation *a, const char *filename) {
- debugC(1, kDebugParser, "loadProgram(Animation: %s, script: %s)", a->_label._text, filename);
+ debugC(1, kDebugParser, "loadProgram(Animation: %s, script: %s)", a->_name, filename);
Script *script = _disk->loadScript(filename);
@@ -249,7 +249,7 @@ void Parallaction_ns::loadProgram(Animation *a, const char *filename) {
DECLARE_INSTRUCTION_PARSER(animation) {
debugC(7, kDebugParser, "INSTRUCTION_PARSER(animation) ");
- if (!scumm_stricmp(_tokens[1], _instParseCtxt.a->_label._text)) {
+ if (!scumm_stricmp(_tokens[1], _instParseCtxt.a->_name)) {
_instParseCtxt.inst->_a = _instParseCtxt.a;
} else {
_instParseCtxt.inst->_a = findAnimation(_tokens[1]);
@@ -336,7 +336,7 @@ DECLARE_INSTRUCTION_PARSER(move) {
DECLARE_INSTRUCTION_PARSER(put) {
debugC(7, kDebugParser, "INSTRUCTION_PARSER(put) ");
- if (!scumm_stricmp(_tokens[1], _instParseCtxt.a->_label._text)) {
+ if (!scumm_stricmp(_tokens[1], _instParseCtxt.a->_name)) {
_instParseCtxt.inst->_a = _instParseCtxt.a;
} else {
_instParseCtxt.inst->_a = findAnimation(_tokens[1]);
@@ -1263,7 +1263,7 @@ void Parallaction_ns::parseZone(Script &script, ZoneList &list, char *name) {
Zone *z = new Zone;
- z->_label._text = strdup(name);
+ strncpy(z->_name, name, ZONENAME_LENGTH);
_locParseCtxt.z = z;
_locParseCtxt.script = &script;
@@ -1442,7 +1442,7 @@ void Parallaction_ns::parseSpeakData(Script &script, Zone *z) {
void Parallaction_ns::parseZoneTypeBlock(Script &script, Zone *z) {
- debugC(7, kDebugParser, "parseZoneTypeBlock(name: %s, type: %x)", z->_label._text, z->_type);
+ debugC(7, kDebugParser, "parseZoneTypeBlock(name: %s, type: %x)", z->_name, z->_type);
switch (z->_type & 0xFFFF) {
case kZoneExamine: // examine Zone alloc