Replaced custom ManagedList with Common::SharedPtr.
svn-id: r31415
This commit is contained in:
parent
affff7d395
commit
3d1a2e2049
20 changed files with 243 additions and 315 deletions
|
@ -40,9 +40,9 @@ namespace Parallaction {
|
||||||
game callables data members
|
game callables data members
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static Zone *_moveSarcZone0 = NULL;
|
static ZonePtr _moveSarcZone0;
|
||||||
static int16 _introSarcData1 = 0;
|
static int16 _introSarcData1 = 0;
|
||||||
static Zone *_moveSarcZone1 = NULL;
|
static ZonePtr _moveSarcZone1;
|
||||||
|
|
||||||
// part completion messages
|
// part completion messages
|
||||||
static const char *endMsg0[] = {"COMPLIMENTI!", "BRAVO!", "CONGRATULATIONS!", "PRIMA!"};
|
static const char *endMsg0[] = {"COMPLIMENTI!", "BRAVO!", "CONGRATULATIONS!", "PRIMA!"};
|
||||||
|
@ -56,14 +56,14 @@ static const char *endMsg6[] = {"DELL' AVVENTURA", "DE L'AVENTURE", "OF THIS ADV
|
||||||
static const char *endMsg7[] = {"ED ORA IL GRAN FINALE ", "ET MAINTENANT LE GRAND FINAL", "NOW THE GREAT FINAL", "UND YETZT DER GROSSE SCHLUSS!"};
|
static const char *endMsg7[] = {"ED ORA IL GRAN FINALE ", "ET MAINTENANT LE GRAND FINAL", "NOW THE GREAT FINAL", "UND YETZT DER GROSSE SCHLUSS!"};
|
||||||
|
|
||||||
static uint16 num_foglie = 0;
|
static uint16 num_foglie = 0;
|
||||||
static Zone *_moveSarcZones[5];
|
static ZonePtr _moveSarcZones[5];
|
||||||
static Zone *_moveSarcExaZones[5];
|
static ZonePtr _moveSarcExaZones[5];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
intro callables data members
|
intro callables data members
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static Animation *_rightHandAnim;
|
static AnimationPtr _rightHandAnim;
|
||||||
|
|
||||||
static uint16 _rightHandPositions[684] = {
|
static uint16 _rightHandPositions[684] = {
|
||||||
0x0064, 0x0046, 0x006c, 0x0046, 0x0074, 0x0046, 0x007c, 0x0046,
|
0x0064, 0x0046, 0x006c, 0x0046, 0x0074, 0x0046, 0x007c, 0x0046,
|
||||||
|
@ -215,12 +215,12 @@ void Parallaction_ns::_c_fade(void *parm) {
|
||||||
|
|
||||||
void Parallaction_ns::_c_moveSarc(void *parm) {
|
void Parallaction_ns::_c_moveSarc(void *parm) {
|
||||||
|
|
||||||
Animation *a;
|
AnimationPtr a;
|
||||||
|
|
||||||
if (_introSarcData2 != 0) {
|
if (_introSarcData2 != 0) {
|
||||||
|
|
||||||
_introSarcData2 = 0;
|
_introSarcData2 = 0;
|
||||||
if (_moveSarcZones[0] == NULL) {
|
if (!_moveSarcZones[0]) {
|
||||||
|
|
||||||
_moveSarcZones[0] = findZone("sarc1");
|
_moveSarcZones[0] = findZone("sarc1");
|
||||||
_moveSarcZones[1] = findZone("sarc2");
|
_moveSarcZones[1] = findZone("sarc2");
|
||||||
|
@ -238,7 +238,7 @@ void Parallaction_ns::_c_moveSarc(void *parm) {
|
||||||
|
|
||||||
a = findAnimation("sposta");
|
a = findAnimation("sposta");
|
||||||
|
|
||||||
_moveSarcZone1 = (Zone*)parm;
|
_moveSarcZone1 = *(ZonePtr*)parm;
|
||||||
|
|
||||||
for (uint16 _si = 0; _si < 5; _si++) {
|
for (uint16 _si = 0; _si < 5; _si++) {
|
||||||
if (_moveSarcZones[_si] == _moveSarcZone1) {
|
if (_moveSarcZones[_si] == _moveSarcZone1) {
|
||||||
|
|
|
@ -156,7 +156,7 @@ bool Debugger::Cmd_Zones(int argc, const char **argv) {
|
||||||
"| name | l | t | r | b | type | flag |\n"
|
"| name | l | t | r | b | type | flag |\n"
|
||||||
"+--------------------+---+---+---+---+--------+--------+\n");
|
"+--------------------+---+---+---+---+--------+--------+\n");
|
||||||
for ( ; b != e; b++) {
|
for ( ; b != e; b++) {
|
||||||
Zone *z = *b;
|
ZonePtr z = *b;
|
||||||
DebugPrintf("|%-20s|%3i|%3i|%3i|%3i|%8x|%8x|\n", z->_name, 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");
|
DebugPrintf("+--------------------+---+---+---+---+--------+--------+\n");
|
||||||
|
@ -174,7 +174,7 @@ bool Debugger::Cmd_Animations(int argc, const char **argv) {
|
||||||
"| name | x | y | z | f | type | flag | \n"
|
"| name | x | y | z | f | type | flag | \n"
|
||||||
"+--------------------+---+---+---+---+--------+--------+\n");
|
"+--------------------+---+---+---+---+--------+--------+\n");
|
||||||
for ( ; b != e; b++) {
|
for ( ; b != e; b++) {
|
||||||
Animation *a = *b;
|
AnimationPtr a = *b;
|
||||||
DebugPrintf("|%-20s|%3i|%3i|%3i|%3i|%8x|%8x|\n", a->_name, 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");
|
DebugPrintf("+--------------------+---+---+---+---+--------+--------+\n");
|
||||||
|
@ -230,7 +230,7 @@ bool Debugger::Cmd_Programs(int argc, const char** argv) {
|
||||||
"| # | bound animation | status |\n"
|
"| # | bound animation | status |\n"
|
||||||
"+---+--------------------+----------+\n");
|
"+---+--------------------+----------+\n");
|
||||||
for ( ; b != e; b++, i++) {
|
for ( ; b != e; b++, i++) {
|
||||||
Program *p = *b;
|
ProgramPtr p = *b;
|
||||||
DebugPrintf("|%3i|%-20s|%-10s|\n", i, p->_anim->_name, status[p->_status] );
|
DebugPrintf("|%3i|%-20s|%-10s|\n", i, p->_anim->_name, status[p->_status] );
|
||||||
}
|
}
|
||||||
DebugPrintf("+---+--------------------+---------+\n");
|
DebugPrintf("+---+--------------------+---------+\n");
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
/* ScummVM - Graphic Adventure Engine
|
|
||||||
*
|
|
||||||
* ScummVM is the legal property of its developers, whose names
|
|
||||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
||||||
* file distributed with this source distribution.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PARALLACTION_DEFS_H
|
|
||||||
#define PARALLACTION_DEFS_H
|
|
||||||
|
|
||||||
#include "common/list.h"
|
|
||||||
#include "common/rect.h"
|
|
||||||
|
|
||||||
namespace Parallaction {
|
|
||||||
|
|
||||||
#define PATH_LEN 200
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
class ManagedList : public Common::List<T> {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
typedef typename Common::List<T> Common_List;
|
|
||||||
typedef typename Common::List<T>::iterator iterator;
|
|
||||||
|
|
||||||
~ManagedList() {
|
|
||||||
clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void clear() {
|
|
||||||
erase(Common_List::begin(), Common_List::end());
|
|
||||||
}
|
|
||||||
|
|
||||||
iterator erase(iterator pos) {
|
|
||||||
if (pos != Common_List::end())
|
|
||||||
delete *pos;
|
|
||||||
return Common_List::erase(pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
iterator erase(iterator first, iterator last) {
|
|
||||||
for (iterator it = first; it != last; it++)
|
|
||||||
delete *it;
|
|
||||||
return Common_List::erase(first, last);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Parallaction
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
#ifndef PARALLACTION_DISK_H
|
#ifndef PARALLACTION_DISK_H
|
||||||
#define PARALLACTION_DISK_H
|
#define PARALLACTION_DISK_H
|
||||||
|
|
||||||
#include "parallaction/defs.h"
|
#define PATH_LEN 200
|
||||||
|
|
||||||
#include "common/file.h"
|
#include "common/file.h"
|
||||||
#include "graphics/surface.h"
|
#include "graphics/surface.h"
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ DECLARE_COMMAND_OPCODE(close) {
|
||||||
|
|
||||||
DECLARE_COMMAND_OPCODE(on) {
|
DECLARE_COMMAND_OPCODE(on) {
|
||||||
CommandData *data = &_cmdRunCtxt.cmd->u;
|
CommandData *data = &_cmdRunCtxt.cmd->u;
|
||||||
Zone *z = data->_zone;
|
ZonePtr z = data->_zone;
|
||||||
|
|
||||||
if (z) {
|
if (z) {
|
||||||
z->_flags |= kFlagsActive;
|
z->_flags |= kFlagsActive;
|
||||||
|
@ -138,7 +138,7 @@ DECLARE_COMMAND_OPCODE(on) {
|
||||||
|
|
||||||
DECLARE_COMMAND_OPCODE(off) {
|
DECLARE_COMMAND_OPCODE(off) {
|
||||||
CommandData *data = &_cmdRunCtxt.cmd->u;
|
CommandData *data = &_cmdRunCtxt.cmd->u;
|
||||||
Zone *z = data->_zone;
|
ZonePtr z = data->_zone;
|
||||||
|
|
||||||
if (z) {
|
if (z) {
|
||||||
z->_flags |= kFlagsRemove;
|
z->_flags |= kFlagsRemove;
|
||||||
|
@ -151,7 +151,7 @@ DECLARE_COMMAND_OPCODE(off) {
|
||||||
|
|
||||||
|
|
||||||
DECLARE_COMMAND_OPCODE(call) {
|
DECLARE_COMMAND_OPCODE(call) {
|
||||||
callFunction(_cmdRunCtxt.cmd->u._callable, _cmdRunCtxt.z);
|
callFunction(_cmdRunCtxt.cmd->u._callable, &_cmdRunCtxt.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -316,8 +316,8 @@ DECLARE_COMMAND_OPCODE(offsave) {
|
||||||
|
|
||||||
|
|
||||||
DECLARE_INSTRUCTION_OPCODE(on) {
|
DECLARE_INSTRUCTION_OPCODE(on) {
|
||||||
Instruction *inst = *_instRunCtxt.inst;
|
InstructionPtr inst = *_instRunCtxt.inst;
|
||||||
Zone *z = inst->_z;
|
ZonePtr z = inst->_z;
|
||||||
|
|
||||||
if (z) {
|
if (z) {
|
||||||
z->_flags |= kFlagsActive;
|
z->_flags |= kFlagsActive;
|
||||||
|
@ -331,8 +331,8 @@ DECLARE_INSTRUCTION_OPCODE(on) {
|
||||||
|
|
||||||
|
|
||||||
DECLARE_INSTRUCTION_OPCODE(off) {
|
DECLARE_INSTRUCTION_OPCODE(off) {
|
||||||
Instruction *inst = *_instRunCtxt.inst;
|
InstructionPtr inst = *_instRunCtxt.inst;
|
||||||
Zone *z = inst->_z;
|
ZonePtr z = inst->_z;
|
||||||
|
|
||||||
if (z) {
|
if (z) {
|
||||||
z->_flags |= kFlagsRemove;
|
z->_flags |= kFlagsRemove;
|
||||||
|
@ -345,7 +345,7 @@ DECLARE_INSTRUCTION_OPCODE(off) {
|
||||||
|
|
||||||
|
|
||||||
DECLARE_INSTRUCTION_OPCODE(set) {
|
DECLARE_INSTRUCTION_OPCODE(set) {
|
||||||
Instruction *inst = *_instRunCtxt.inst;
|
InstructionPtr inst = *_instRunCtxt.inst;
|
||||||
|
|
||||||
int16 rvalue = inst->_opB.getRValue();
|
int16 rvalue = inst->_opB.getRValue();
|
||||||
int16* lvalue = inst->_opA.getLValue();
|
int16* lvalue = inst->_opA.getLValue();
|
||||||
|
@ -356,7 +356,7 @@ DECLARE_INSTRUCTION_OPCODE(set) {
|
||||||
|
|
||||||
|
|
||||||
DECLARE_INSTRUCTION_OPCODE(loop) {
|
DECLARE_INSTRUCTION_OPCODE(loop) {
|
||||||
Instruction *inst = *_instRunCtxt.inst;
|
InstructionPtr inst = *_instRunCtxt.inst;
|
||||||
|
|
||||||
_instRunCtxt.program->_loopCounter = inst->_opB.getRValue();
|
_instRunCtxt.program->_loopCounter = inst->_opB.getRValue();
|
||||||
_instRunCtxt.program->_loopStart = _instRunCtxt.inst;
|
_instRunCtxt.program->_loopStart = _instRunCtxt.inst;
|
||||||
|
@ -364,7 +364,7 @@ DECLARE_INSTRUCTION_OPCODE(loop) {
|
||||||
|
|
||||||
|
|
||||||
DECLARE_INSTRUCTION_OPCODE(inc) {
|
DECLARE_INSTRUCTION_OPCODE(inc) {
|
||||||
Instruction *inst = *_instRunCtxt.inst;
|
InstructionPtr inst = *_instRunCtxt.inst;
|
||||||
|
|
||||||
int16 rvalue = inst->_opB.getRValue();
|
int16 rvalue = inst->_opB.getRValue();
|
||||||
|
|
||||||
|
@ -432,7 +432,7 @@ DECLARE_INSTRUCTION_OPCODE(move) {
|
||||||
|
|
||||||
|
|
||||||
DECLARE_INSTRUCTION_OPCODE(color) {
|
DECLARE_INSTRUCTION_OPCODE(color) {
|
||||||
Instruction *inst = *_instRunCtxt.inst;
|
InstructionPtr inst = *_instRunCtxt.inst;
|
||||||
|
|
||||||
int16 entry = inst->_opB.getRValue();
|
int16 entry = inst->_opB.getRValue();
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@ DECLARE_INSTRUCTION_OPCODE(print) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DECLARE_INSTRUCTION_OPCODE(text) {
|
DECLARE_INSTRUCTION_OPCODE(text) {
|
||||||
Instruction *inst = (*_instRunCtxt.inst);
|
InstructionPtr inst = (*_instRunCtxt.inst);
|
||||||
setupSubtitles(inst->_text, inst->_text2, inst->_y);
|
setupSubtitles(inst->_text, inst->_text2, inst->_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ typedef OpcodeImpl<Parallaction_ns> OpcodeV1;
|
||||||
|
|
||||||
|
|
||||||
DECLARE_INSTRUCTION_OPCODE(on) {
|
DECLARE_INSTRUCTION_OPCODE(on) {
|
||||||
Instruction *inst = *_instRunCtxt.inst;
|
InstructionPtr inst = *_instRunCtxt.inst;
|
||||||
|
|
||||||
inst->_a->_flags |= kFlagsActive;
|
inst->_a->_flags |= kFlagsActive;
|
||||||
inst->_a->_flags &= ~kFlagsRemove;
|
inst->_a->_flags &= ~kFlagsRemove;
|
||||||
|
@ -74,7 +74,7 @@ DECLARE_INSTRUCTION_OPCODE(off) {
|
||||||
|
|
||||||
|
|
||||||
DECLARE_INSTRUCTION_OPCODE(loop) {
|
DECLARE_INSTRUCTION_OPCODE(loop) {
|
||||||
Instruction *inst = *_instRunCtxt.inst;
|
InstructionPtr inst = *_instRunCtxt.inst;
|
||||||
|
|
||||||
_instRunCtxt.program->_loopCounter = inst->_opB.getRValue();
|
_instRunCtxt.program->_loopCounter = inst->_opB.getRValue();
|
||||||
_instRunCtxt.program->_loopStart = _instRunCtxt.inst;
|
_instRunCtxt.program->_loopStart = _instRunCtxt.inst;
|
||||||
|
@ -88,7 +88,7 @@ DECLARE_INSTRUCTION_OPCODE(endloop) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DECLARE_INSTRUCTION_OPCODE(inc) {
|
DECLARE_INSTRUCTION_OPCODE(inc) {
|
||||||
Instruction *inst = *_instRunCtxt.inst;
|
InstructionPtr inst = *_instRunCtxt.inst;
|
||||||
int16 _si = inst->_opB.getRValue();
|
int16 _si = inst->_opB.getRValue();
|
||||||
|
|
||||||
if (inst->_flags & kInstMod) { // mod
|
if (inst->_flags & kInstMod) { // mod
|
||||||
|
@ -114,7 +114,7 @@ DECLARE_INSTRUCTION_OPCODE(inc) {
|
||||||
|
|
||||||
|
|
||||||
DECLARE_INSTRUCTION_OPCODE(set) {
|
DECLARE_INSTRUCTION_OPCODE(set) {
|
||||||
Instruction *inst = *_instRunCtxt.inst;
|
InstructionPtr inst = *_instRunCtxt.inst;
|
||||||
|
|
||||||
int16 _si = inst->_opB.getRValue();
|
int16 _si = inst->_opB.getRValue();
|
||||||
int16 *lvalue = inst->_opA.getLValue();
|
int16 *lvalue = inst->_opA.getLValue();
|
||||||
|
@ -125,7 +125,7 @@ DECLARE_INSTRUCTION_OPCODE(set) {
|
||||||
|
|
||||||
|
|
||||||
DECLARE_INSTRUCTION_OPCODE(put) {
|
DECLARE_INSTRUCTION_OPCODE(put) {
|
||||||
Instruction *inst = *_instRunCtxt.inst;
|
InstructionPtr inst = *_instRunCtxt.inst;
|
||||||
Graphics::Surface v18;
|
Graphics::Surface v18;
|
||||||
v18.w = inst->_a->width();
|
v18.w = inst->_a->width();
|
||||||
v18.h = inst->_a->height();
|
v18.h = inst->_a->height();
|
||||||
|
@ -168,7 +168,7 @@ DECLARE_INSTRUCTION_OPCODE(sound) {
|
||||||
|
|
||||||
|
|
||||||
DECLARE_INSTRUCTION_OPCODE(move) {
|
DECLARE_INSTRUCTION_OPCODE(move) {
|
||||||
Instruction *inst = (*_instRunCtxt.inst);
|
InstructionPtr inst = (*_instRunCtxt.inst);
|
||||||
|
|
||||||
int16 x = inst->_opA.getRValue();
|
int16 x = inst->_opA.getRValue();
|
||||||
int16 y = inst->_opB.getRValue();
|
int16 y = inst->_opB.getRValue();
|
||||||
|
@ -262,14 +262,14 @@ DECLARE_COMMAND_OPCODE(close) {
|
||||||
|
|
||||||
|
|
||||||
DECLARE_COMMAND_OPCODE(on) {
|
DECLARE_COMMAND_OPCODE(on) {
|
||||||
Zone *z = _cmdRunCtxt.cmd->u._zone;
|
ZonePtr z = _cmdRunCtxt.cmd->u._zone;
|
||||||
// WORKAROUND: the original DOS-based engine didn't check u->_zone before dereferencing
|
// WORKAROUND: the original DOS-based engine didn't check u->_zone before dereferencing
|
||||||
// the pointer to get structure members, thus leading to crashes in systems with memory
|
// the pointer to get structure members, thus leading to crashes in systems with memory
|
||||||
// protection.
|
// protection.
|
||||||
// As a side note, the overwritten address is the 5th entry in the DOS interrupt table
|
// As a side note, the overwritten address is the 5th entry in the DOS interrupt table
|
||||||
// (print screen handler): this suggests that a system would hang when the print screen
|
// (print screen handler): this suggests that a system would hang when the print screen
|
||||||
// key is pressed after playing Nippon Safes, provided that this code path is taken.
|
// key is pressed after playing Nippon Safes, provided that this code path is taken.
|
||||||
if (z != NULL) {
|
if (z) {
|
||||||
z->_flags &= ~kFlagsRemove;
|
z->_flags &= ~kFlagsRemove;
|
||||||
z->_flags |= kFlagsActive;
|
z->_flags |= kFlagsActive;
|
||||||
if ((z->_type & 0xFFFF) == kZoneGet) {
|
if ((z->_type & 0xFFFF) == kZoneGet) {
|
||||||
|
@ -285,7 +285,7 @@ DECLARE_COMMAND_OPCODE(off) {
|
||||||
|
|
||||||
|
|
||||||
DECLARE_COMMAND_OPCODE(call) {
|
DECLARE_COMMAND_OPCODE(call) {
|
||||||
callFunction(_cmdRunCtxt.cmd->u._callable, _cmdRunCtxt.z);
|
callFunction(_cmdRunCtxt.cmd->u._callable, &_cmdRunCtxt.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ void Parallaction_ns::drawAnimations() {
|
||||||
|
|
||||||
for (AnimationList::iterator it = _animations.begin(); it != _animations.end(); it++) {
|
for (AnimationList::iterator it = _animations.begin(); it != _animations.end(); it++) {
|
||||||
|
|
||||||
Animation *v18 = *it;
|
AnimationPtr v18 = *it;
|
||||||
GfxObj *obj = v18->gfxobj;
|
GfxObj *obj = v18->gfxobj;
|
||||||
|
|
||||||
if ((v18->_flags & kFlagsActive) && ((v18->_flags & kFlagsRemove) == 0)) {
|
if ((v18->_flags & kFlagsActive) && ((v18->_flags & kFlagsRemove) == 0)) {
|
||||||
|
@ -376,7 +376,7 @@ void Parallaction_ns::runScripts() {
|
||||||
|
|
||||||
for (ProgramList::iterator it = _programs.begin(); it != _programs.end(); it++) {
|
for (ProgramList::iterator it = _programs.begin(); it != _programs.end(); it++) {
|
||||||
|
|
||||||
Animation *a = (*it)->_anim;
|
AnimationPtr a = (*it)->_anim;
|
||||||
|
|
||||||
if (a->_flags & kFlagsCharacter)
|
if (a->_flags & kFlagsCharacter)
|
||||||
a->_z = a->_top + a->height();
|
a->_z = a->_top + a->height();
|
||||||
|
@ -392,7 +392,7 @@ void Parallaction_ns::runScripts() {
|
||||||
debugC(9, kDebugExec, "Animation: %s, instruction: %s", a->_name, _instructionNamesRes[(*inst)->_index - 1]);
|
debugC(9, kDebugExec, "Animation: %s, instruction: %s", a->_name, _instructionNamesRes[(*inst)->_index - 1]);
|
||||||
|
|
||||||
_instRunCtxt.inst = inst;
|
_instRunCtxt.inst = inst;
|
||||||
_instRunCtxt.anim = a;
|
_instRunCtxt.anim = AnimationPtr(a);
|
||||||
_instRunCtxt.program = *it;
|
_instRunCtxt.program = *it;
|
||||||
_instRunCtxt.modCounter = modCounter;
|
_instRunCtxt.modCounter = modCounter;
|
||||||
_instRunCtxt.suspend = false;
|
_instRunCtxt.suspend = false;
|
||||||
|
@ -414,9 +414,9 @@ label1:
|
||||||
a->_z = a->_top + a->height();
|
a->_z = a->_top + a->height();
|
||||||
}
|
}
|
||||||
|
|
||||||
_char._ani._z = _char._ani.height() + _char._ani._top;
|
_char._ani->_z = _char._ani->height() + _char._ani->_top;
|
||||||
if (_char._ani.gfxobj) {
|
if (_char._ani->gfxobj) {
|
||||||
_char._ani.gfxobj->z = _char._ani._z;
|
_char._ani->gfxobj->z = _char._ani->_z;
|
||||||
}
|
}
|
||||||
modCounter++;
|
modCounter++;
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ label1:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Parallaction::runCommands(CommandList& list, Zone *z) {
|
void Parallaction::runCommands(CommandList& list, ZonePtr z) {
|
||||||
if (list.size() == 0)
|
if (list.size() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -433,7 +433,7 @@ void Parallaction::runCommands(CommandList& list, Zone *z) {
|
||||||
CommandList::iterator it = list.begin();
|
CommandList::iterator it = list.begin();
|
||||||
for ( ; it != list.end(); it++) {
|
for ( ; it != list.end(); it++) {
|
||||||
|
|
||||||
Command *cmd = *it;
|
CommandPtr cmd = *it;
|
||||||
uint32 v8 = _localFlags[_currentLocationIndex];
|
uint32 v8 = _localFlags[_currentLocationIndex];
|
||||||
|
|
||||||
if (_engineFlags & kEngineQuit)
|
if (_engineFlags & kEngineQuit)
|
||||||
|
@ -496,7 +496,7 @@ void Parallaction::displayComment(ExamineData *data) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint16 Parallaction::runZone(Zone *z) {
|
uint16 Parallaction::runZone(ZonePtr& z) {
|
||||||
debugC(3, kDebugExec, "runZone (%s)", z->_name);
|
debugC(3, kDebugExec, "runZone (%s)", z->_name);
|
||||||
|
|
||||||
uint16 subtype = z->_type & 0xFFFF;
|
uint16 subtype = z->_type & 0xFFFF;
|
||||||
|
@ -542,7 +542,7 @@ uint16 Parallaction::runZone(Zone *z) {
|
||||||
//
|
//
|
||||||
// ZONE TYPE: DOOR
|
// ZONE TYPE: DOOR
|
||||||
//
|
//
|
||||||
void Parallaction::updateDoor(Zone *z) {
|
void Parallaction::updateDoor(ZonePtr& z) {
|
||||||
|
|
||||||
if (z->u.door->gfxobj) {
|
if (z->u.door->gfxobj) {
|
||||||
uint frame = (z->_flags & kFlagsClosed ? 0 : 1);
|
uint frame = (z->_flags & kFlagsClosed ? 0 : 1);
|
||||||
|
@ -559,7 +559,7 @@ void Parallaction::updateDoor(Zone *z) {
|
||||||
// ZONE TYPE: GET
|
// ZONE TYPE: GET
|
||||||
//
|
//
|
||||||
|
|
||||||
int16 Parallaction::pickupItem(Zone *z) {
|
int16 Parallaction::pickupItem(ZonePtr &z) {
|
||||||
int r = addInventoryItem(z->u.get->_icon);
|
int r = addInventoryItem(z->u.get->_icon);
|
||||||
if (r != -1) {
|
if (r != -1) {
|
||||||
_gfx->showGfxObj(z->u.get->gfxobj, false);
|
_gfx->showGfxObj(z->u.get->gfxobj, false);
|
||||||
|
@ -570,7 +570,7 @@ int16 Parallaction::pickupItem(Zone *z) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Zone *Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
|
ZonePtr Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
|
||||||
// printf("hitZone(%i, %i, %i)", type, x, y);
|
// printf("hitZone(%i, %i, %i)", type, x, y);
|
||||||
|
|
||||||
uint16 _di = y;
|
uint16 _di = y;
|
||||||
|
@ -579,7 +579,7 @@ Zone *Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
|
||||||
for (ZoneList::iterator it = _zones.begin(); it != _zones.end(); it++) {
|
for (ZoneList::iterator it = _zones.begin(); it != _zones.end(); it++) {
|
||||||
// printf("Zone name: %s", z->_name);
|
// printf("Zone name: %s", z->_name);
|
||||||
|
|
||||||
Zone *z = *it;
|
ZonePtr z = *it;
|
||||||
|
|
||||||
if (z->_flags & kFlagsRemove) continue;
|
if (z->_flags & kFlagsRemove) continue;
|
||||||
|
|
||||||
|
@ -614,13 +614,13 @@ Zone *Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
|
||||||
|
|
||||||
if (z->_left != -1)
|
if (z->_left != -1)
|
||||||
continue;
|
continue;
|
||||||
if (_si < _char._ani._left)
|
if (_si < _char._ani->_left)
|
||||||
continue;
|
continue;
|
||||||
if (_si > (_char._ani._left + _char._ani.width()))
|
if (_si > (_char._ani->_left + _char._ani->width()))
|
||||||
continue;
|
continue;
|
||||||
if (_di < _char._ani._top)
|
if (_di < _char._ani->_top)
|
||||||
continue;
|
continue;
|
||||||
if (_di > (_char._ani._top + _char._ani.height()))
|
if (_di > (_char._ani->_top + _char._ani->height()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -639,7 +639,7 @@ Zone *Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
|
||||||
int16 _a, _b, _c, _d, _e, _f;
|
int16 _a, _b, _c, _d, _e, _f;
|
||||||
for (AnimationList::iterator ait = _animations.begin(); ait != _animations.end(); ait++) {
|
for (AnimationList::iterator ait = _animations.begin(); ait != _animations.end(); ait++) {
|
||||||
|
|
||||||
Animation *a = *ait;
|
AnimationPtr a = *ait;
|
||||||
|
|
||||||
_a = (a->_flags & kFlagsActive) ? 1 : 0; // _a: active Animation
|
_a = (a->_flags & kFlagsActive) ? 1 : 0; // _a: active Animation
|
||||||
_e = ((_si >= a->_left + a->width()) || (_si <= a->_left)) ? 0 : 1; // _e: horizontal range
|
_e = ((_si >= a->_left + a->width()) || (_si <= a->_left)) ? 0 : 1; // _e: horizontal range
|
||||||
|
@ -657,7 +657,7 @@ Zone *Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullZonePtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,14 +26,13 @@
|
||||||
#ifndef PARALLACTION_GRAPHICS_H
|
#ifndef PARALLACTION_GRAPHICS_H
|
||||||
#define PARALLACTION_GRAPHICS_H
|
#define PARALLACTION_GRAPHICS_H
|
||||||
|
|
||||||
|
#include "common/list.h"
|
||||||
#include "common/rect.h"
|
#include "common/rect.h"
|
||||||
#include "common/hash-str.h"
|
#include "common/hash-str.h"
|
||||||
#include "common/stream.h"
|
#include "common/stream.h"
|
||||||
|
|
||||||
#include "graphics/surface.h"
|
#include "graphics/surface.h"
|
||||||
|
|
||||||
#include "parallaction/defs.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Parallaction {
|
namespace Parallaction {
|
||||||
|
|
||||||
|
@ -609,3 +608,4 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,9 @@
|
||||||
namespace Parallaction {
|
namespace Parallaction {
|
||||||
|
|
||||||
|
|
||||||
|
ZonePtr nullZonePtr;
|
||||||
|
AnimationPtr nullAnimationPtr;
|
||||||
|
InstructionPtr nullInstructionPtr;
|
||||||
|
|
||||||
Command::Command() {
|
Command::Command() {
|
||||||
_id = 0;
|
_id = 0;
|
||||||
|
@ -126,7 +129,6 @@ Zone::Zone() {
|
||||||
// BRA specific
|
// BRA specific
|
||||||
_index = 0;
|
_index = 0;
|
||||||
_linkedName = 0;
|
_linkedName = 0;
|
||||||
_linkedAnim = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Zone::~Zone() {
|
Zone::~Zone() {
|
||||||
|
@ -230,8 +232,6 @@ Instruction::Instruction() {
|
||||||
_flags = 0;
|
_flags = 0;
|
||||||
|
|
||||||
// common
|
// common
|
||||||
_a = 0;
|
|
||||||
_z = 0;
|
|
||||||
_immediate = 0;
|
_immediate = 0;
|
||||||
|
|
||||||
// BRA specific
|
// BRA specific
|
||||||
|
|
|
@ -27,8 +27,7 @@
|
||||||
#define PARALLACTION_ZONE_H
|
#define PARALLACTION_ZONE_H
|
||||||
|
|
||||||
#include "common/list.h"
|
#include "common/list.h"
|
||||||
|
#include "common/ptr.h"
|
||||||
#include "parallaction/defs.h"
|
|
||||||
|
|
||||||
#include "parallaction/graphics.h"
|
#include "parallaction/graphics.h"
|
||||||
|
|
||||||
|
@ -43,6 +42,19 @@ struct Answer;
|
||||||
struct Instruction;
|
struct Instruction;
|
||||||
struct Program;
|
struct Program;
|
||||||
|
|
||||||
|
typedef Common::SharedPtr<Zone> ZonePtr;
|
||||||
|
typedef Common::List<ZonePtr> ZoneList;
|
||||||
|
extern ZonePtr nullZonePtr;
|
||||||
|
|
||||||
|
typedef Common::SharedPtr<Animation> AnimationPtr;
|
||||||
|
typedef Common::List<AnimationPtr> AnimationList;
|
||||||
|
extern AnimationPtr nullAnimationPtr;
|
||||||
|
|
||||||
|
typedef Common::SharedPtr<Instruction> InstructionPtr;
|
||||||
|
typedef Common::List<InstructionPtr> InstructionList;
|
||||||
|
extern InstructionPtr nullInstructionPtr;
|
||||||
|
|
||||||
|
|
||||||
enum ZoneTypes {
|
enum ZoneTypes {
|
||||||
kZoneExamine = 1, // zone displays comment if activated
|
kZoneExamine = 1, // zone displays comment if activated
|
||||||
kZoneDoor = 2, // zone activated on click (after some walk if needed)
|
kZoneDoor = 2, // zone activated on click (after some walk if needed)
|
||||||
|
@ -91,9 +103,11 @@ enum CommandFlags {
|
||||||
kFlagsTestTrue = 2
|
kFlagsTestTrue = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct CommandData {
|
struct CommandData {
|
||||||
uint32 _flags;
|
uint32 _flags;
|
||||||
Zone* _zone;
|
ZonePtr _zone;
|
||||||
char* _string;
|
char* _string;
|
||||||
uint16 _callable;
|
uint16 _callable;
|
||||||
uint16 _object;
|
uint16 _object;
|
||||||
|
@ -133,7 +147,8 @@ struct Command {
|
||||||
~Command();
|
~Command();
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef ManagedList<Command*> CommandList;
|
typedef Common::SharedPtr<Command> CommandPtr;
|
||||||
|
typedef Common::List<CommandPtr> CommandList;
|
||||||
|
|
||||||
|
|
||||||
#define NUM_QUESTIONS 20
|
#define NUM_QUESTIONS 20
|
||||||
|
@ -278,7 +293,7 @@ struct Zone {
|
||||||
// BRA specific
|
// BRA specific
|
||||||
uint _index;
|
uint _index;
|
||||||
char *_linkedName;
|
char *_linkedName;
|
||||||
Animation *_linkedAnim;
|
AnimationPtr _linkedAnim;
|
||||||
|
|
||||||
Zone();
|
Zone();
|
||||||
virtual ~Zone();
|
virtual ~Zone();
|
||||||
|
@ -289,8 +304,6 @@ struct Zone {
|
||||||
virtual uint16 height() const;
|
virtual uint16 height() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Zone* ZonePointer;
|
|
||||||
typedef ManagedList<ZonePointer> ZoneList;
|
|
||||||
|
|
||||||
struct LocalVariable {
|
struct LocalVariable {
|
||||||
int16 _value;
|
int16 _value;
|
||||||
|
@ -336,15 +349,14 @@ enum InstructionFlags {
|
||||||
kInstUnk20 = 0x20
|
kInstUnk20 = 0x20
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef ManagedList<Instruction*> InstructionList;
|
|
||||||
|
|
||||||
struct Instruction {
|
struct Instruction {
|
||||||
uint32 _index;
|
uint32 _index;
|
||||||
uint32 _flags;
|
uint32 _flags;
|
||||||
|
|
||||||
// common
|
// common
|
||||||
Animation *_a;
|
AnimationPtr _a;
|
||||||
Zone *_z;
|
ZonePtr _z;
|
||||||
int16 _immediate;
|
int16 _immediate;
|
||||||
ScriptVar _opA;
|
ScriptVar _opA;
|
||||||
ScriptVar _opB;
|
ScriptVar _opB;
|
||||||
|
@ -369,7 +381,7 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Program {
|
struct Program {
|
||||||
Animation *_anim;
|
AnimationPtr _anim;
|
||||||
|
|
||||||
LocalVariable *_locals;
|
LocalVariable *_locals;
|
||||||
|
|
||||||
|
@ -390,7 +402,8 @@ struct Program {
|
||||||
int16 addLocal(const char *name, int16 value = 0, int16 min = -10000, int16 max = 10000);
|
int16 addLocal(const char *name, int16 value = 0, int16 min = -10000, int16 max = 10000);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef ManagedList<Program*> ProgramList;
|
typedef Common::SharedPtr<Program> ProgramPtr;
|
||||||
|
typedef Common::List<ProgramPtr> ProgramList;
|
||||||
|
|
||||||
struct Animation : public Zone {
|
struct Animation : public Zone {
|
||||||
|
|
||||||
|
@ -415,10 +428,6 @@ struct Animation : public Zone {
|
||||||
byte* getFrameData(uint32 index) const;
|
byte* getFrameData(uint32 index) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Animation* AnimationPointer;
|
|
||||||
typedef ManagedList<AnimationPointer> AnimationList;
|
|
||||||
|
|
||||||
|
|
||||||
class Table {
|
class Table {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -130,7 +130,6 @@ int Parallaction::init() {
|
||||||
_location._endComment = NULL;
|
_location._endComment = NULL;
|
||||||
|
|
||||||
_pathBuffer = 0;
|
_pathBuffer = 0;
|
||||||
_activeZone = 0;
|
|
||||||
|
|
||||||
_screenSize = _screenWidth * _screenHeight;
|
_screenSize = _screenWidth * _screenHeight;
|
||||||
|
|
||||||
|
@ -140,8 +139,6 @@ int Parallaction::init() {
|
||||||
|
|
||||||
initInventory(); // needs to be pushed into subclass
|
initInventory(); // needs to be pushed into subclass
|
||||||
|
|
||||||
_hoverZone = NULL;
|
|
||||||
|
|
||||||
_gfx = new Gfx(this);
|
_gfx = new Gfx(this);
|
||||||
|
|
||||||
_debugger = new Debugger(this);
|
_debugger = new Debugger(this);
|
||||||
|
@ -288,7 +285,7 @@ void Parallaction::processInput(InputData *data) {
|
||||||
case kEvAction:
|
case kEvAction:
|
||||||
debugC(2, kDebugInput, "processInput: kEvAction");
|
debugC(2, kDebugInput, "processInput: kEvAction");
|
||||||
_procCurrentHoverItem = -1;
|
_procCurrentHoverItem = -1;
|
||||||
_hoverZone = NULL;
|
_hoverZone = nullZonePtr;
|
||||||
pauseJobs();
|
pauseJobs();
|
||||||
runZone(data->_zone);
|
runZone(data->_zone);
|
||||||
resumeJobs();
|
resumeJobs();
|
||||||
|
@ -296,7 +293,7 @@ void Parallaction::processInput(InputData *data) {
|
||||||
|
|
||||||
case kEvOpenInventory:
|
case kEvOpenInventory:
|
||||||
_procCurrentHoverItem = -1;
|
_procCurrentHoverItem = -1;
|
||||||
_hoverZone = NULL;
|
_hoverZone = nullZonePtr;
|
||||||
_gfx->setFloatingLabel(0);
|
_gfx->setFloatingLabel(0);
|
||||||
if (hitZone(kZoneYou, _mousePos.x, _mousePos.y) == 0) {
|
if (hitZone(kZoneYou, _mousePos.x, _mousePos.y) == 0) {
|
||||||
setArrowCursor();
|
setArrowCursor();
|
||||||
|
@ -319,7 +316,7 @@ void Parallaction::processInput(InputData *data) {
|
||||||
|
|
||||||
case kEvWalk:
|
case kEvWalk:
|
||||||
debugC(2, kDebugInput, "processInput: kEvWalk");
|
debugC(2, kDebugInput, "processInput: kEvWalk");
|
||||||
_hoverZone = NULL;
|
_hoverZone = nullZonePtr;
|
||||||
setArrowCursor();
|
setArrowCursor();
|
||||||
_char.scheduleWalk(data->_mousePos.x, data->_mousePos.y);
|
_char.scheduleWalk(data->_mousePos.x, data->_mousePos.y);
|
||||||
break;
|
break;
|
||||||
|
@ -329,13 +326,13 @@ void Parallaction::processInput(InputData *data) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kEvSaveGame:
|
case kEvSaveGame:
|
||||||
_hoverZone = NULL;
|
_hoverZone = nullZonePtr;
|
||||||
saveGame();
|
saveGame();
|
||||||
setArrowCursor();
|
setArrowCursor();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kEvLoadGame:
|
case kEvLoadGame:
|
||||||
_hoverZone = NULL;
|
_hoverZone = nullZonePtr;
|
||||||
loadGame();
|
loadGame();
|
||||||
setArrowCursor();
|
setArrowCursor();
|
||||||
break;
|
break;
|
||||||
|
@ -440,25 +437,25 @@ bool Parallaction::translateGameInput() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// test if mouse is hovering on an interactive zone for the currently selected inventory item
|
// test if mouse is hovering on an interactive zone for the currently selected inventory item
|
||||||
Zone *z = hitZone(_activeItem._id, _mousePos.x, _mousePos.y);
|
ZonePtr z = hitZone(_activeItem._id, _mousePos.x, _mousePos.y);
|
||||||
|
|
||||||
if (((_mouseButtons == kMouseLeftUp) && (_activeItem._id == 0) && ((_engineFlags & kEngineWalking) == 0)) && ((z == NULL) || ((z->_type & 0xFFFF) != kZoneCommand))) {
|
if (((_mouseButtons == kMouseLeftUp) && (_activeItem._id == 0) && ((_engineFlags & kEngineWalking) == 0)) && ((!z) || ((z->_type & 0xFFFF) != kZoneCommand))) {
|
||||||
_input._event = kEvWalk;
|
_input._event = kEvWalk;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((z != _hoverZone) && (_hoverZone != NULL)) {
|
if ((z != _hoverZone) && (_hoverZone)) {
|
||||||
_hoverZone = NULL;
|
_hoverZone = nullZonePtr;
|
||||||
_input._event = kEvExitZone;
|
_input._event = kEvExitZone;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (z == NULL) {
|
if (!z) {
|
||||||
_input._event = kEvNone;
|
_input._event = kEvNone;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_hoverZone == NULL) && ((z->_flags & kFlagsNoName) == 0)) {
|
if ((!_hoverZone) && ((z->_flags & kFlagsNoName) == 0)) {
|
||||||
_hoverZone = z;
|
_hoverZone = z;
|
||||||
_input._event = kEvEnterZone;
|
_input._event = kEvEnterZone;
|
||||||
_input._label = z->_label;
|
_input._label = z->_label;
|
||||||
|
@ -512,9 +509,9 @@ bool Parallaction::translateInventoryInput() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_engineFlags &= ~kEngineDragging;
|
_engineFlags &= ~kEngineDragging;
|
||||||
Zone *z = hitZone(kZoneMerge, _activeItem._index, getInventoryItemIndex(_input._inventoryIndex));
|
ZonePtr z = hitZone(kZoneMerge, _activeItem._index, getInventoryItemIndex(_input._inventoryIndex));
|
||||||
|
|
||||||
if (z != NULL) {
|
if (z) {
|
||||||
dropItem(z->u.merge->_obj1);
|
dropItem(z->u.merge->_obj1);
|
||||||
dropItem(z->u.merge->_obj2);
|
dropItem(z->u.merge->_obj2);
|
||||||
addInventoryItem(z->u.merge->_obj3);
|
addInventoryItem(z->u.merge->_obj3);
|
||||||
|
@ -623,12 +620,12 @@ void Parallaction::parseStatement() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Animation *Parallaction::findAnimation(const char *name) {
|
AnimationPtr& Parallaction::findAnimation(const char *name) {
|
||||||
|
|
||||||
for (AnimationList::iterator it = _animations.begin(); it != _animations.end(); it++)
|
for (AnimationList::iterator it = _animations.begin(); it != _animations.end(); it++)
|
||||||
if (!scumm_stricmp((*it)->_name, name)) return *it;
|
if (!scumm_stricmp((*it)->_name, name)) return *it;
|
||||||
|
|
||||||
return NULL;
|
return nullAnimationPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parallaction::freeAnimations() {
|
void Parallaction::freeAnimations() {
|
||||||
|
@ -773,7 +770,7 @@ void Parallaction::doLocationEnterTransition() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Zone *Parallaction::findZone(const char *name) {
|
ZonePtr Parallaction::findZone(const char *name) {
|
||||||
|
|
||||||
for (ZoneList::iterator it = _zones.begin(); it != _zones.end(); it++) {
|
for (ZoneList::iterator it = _zones.begin(); it != _zones.end(); it++) {
|
||||||
if (!scumm_stricmp((*it)->_name, name)) return *it;
|
if (!scumm_stricmp((*it)->_name, name)) return *it;
|
||||||
|
@ -792,7 +789,7 @@ void Parallaction::freeZones() {
|
||||||
|
|
||||||
// NOTE : this condition has been relaxed compared to the original, to allow the engine
|
// NOTE : this condition has been relaxed compared to the original, to allow the engine
|
||||||
// to retain special - needed - zones that were lost across location switches.
|
// to retain special - needed - zones that were lost across location switches.
|
||||||
Zone* z = *it;
|
ZonePtr z = *it;
|
||||||
if (((z->_top == -1) || (z->_left == -2)) && ((_engineFlags & kEngineQuit) == 0)) {
|
if (((z->_top == -1) || (z->_left == -2)) && ((_engineFlags & kEngineQuit) == 0)) {
|
||||||
debugC(2, kDebugExec, "freeZones preserving zone '%s'", z->_name);
|
debugC(2, kDebugExec, "freeZones preserving zone '%s'", z->_name);
|
||||||
it++;
|
it++;
|
||||||
|
@ -810,36 +807,36 @@ const char Character::_suffixTras[] = "tras";
|
||||||
const char Character::_empty[] = "\0";
|
const char Character::_empty[] = "\0";
|
||||||
|
|
||||||
|
|
||||||
Character::Character(Parallaction *vm) : _vm(vm), _builder(&_ani) {
|
Character::Character(Parallaction *vm) : _vm(vm), _ani(new Animation), _builder(_ani) {
|
||||||
_talk = NULL;
|
_talk = NULL;
|
||||||
_head = NULL;
|
_head = NULL;
|
||||||
_objs = NULL;
|
_objs = NULL;
|
||||||
|
|
||||||
_dummy = false;
|
_dummy = false;
|
||||||
|
|
||||||
_ani._left = 150;
|
_ani->_left = 150;
|
||||||
_ani._top = 100;
|
_ani->_top = 100;
|
||||||
_ani._z = 10;
|
_ani->_z = 10;
|
||||||
_ani._oldPos.x = -1000;
|
_ani->_oldPos.x = -1000;
|
||||||
_ani._oldPos.y = -1000;
|
_ani->_oldPos.y = -1000;
|
||||||
_ani._frame = 0;
|
_ani->_frame = 0;
|
||||||
_ani._flags = kFlagsActive | kFlagsNoName;
|
_ani->_flags = kFlagsActive | kFlagsNoName;
|
||||||
_ani._type = kZoneYou;
|
_ani->_type = kZoneYou;
|
||||||
strncpy(_ani._name, "yourself", ZONENAME_LENGTH);
|
strncpy(_ani->_name, "yourself", ZONENAME_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Character::getFoot(Common::Point &foot) {
|
void Character::getFoot(Common::Point &foot) {
|
||||||
foot.x = _ani._left + _ani.width() / 2;
|
foot.x = _ani->_left + _ani->width() / 2;
|
||||||
foot.y = _ani._top + _ani.height();
|
foot.y = _ani->_top + _ani->height();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Character::setFoot(const Common::Point &foot) {
|
void Character::setFoot(const Common::Point &foot) {
|
||||||
_ani._left = foot.x - _ani.width() / 2;
|
_ani->_left = foot.x - _ani->width() / 2;
|
||||||
_ani._top = foot.y - _ani.height();
|
_ani->_top = foot.y - _ani->height();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Character::scheduleWalk(int16 x, int16 y) {
|
void Character::scheduleWalk(int16 x, int16 y) {
|
||||||
if ((_ani._flags & kFlagsRemove) || (_ani._flags & kFlagsActive) == 0) {
|
if ((_ani->_flags & kFlagsRemove) || (_ani->_flags & kFlagsActive) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -853,7 +850,7 @@ void Character::free() {
|
||||||
delete _head;
|
delete _head;
|
||||||
delete _objs;
|
delete _objs;
|
||||||
|
|
||||||
_ani.gfxobj = NULL;
|
_ani->gfxobj = NULL;
|
||||||
_talk = NULL;
|
_talk = NULL;
|
||||||
_head = NULL;
|
_head = NULL;
|
||||||
_objs = NULL;
|
_objs = NULL;
|
||||||
|
|
|
@ -33,13 +33,14 @@
|
||||||
|
|
||||||
#include "engines/engine.h"
|
#include "engines/engine.h"
|
||||||
|
|
||||||
#include "parallaction/defs.h"
|
|
||||||
#include "parallaction/inventory.h"
|
#include "parallaction/inventory.h"
|
||||||
#include "parallaction/parser.h"
|
#include "parallaction/parser.h"
|
||||||
#include "parallaction/objects.h"
|
#include "parallaction/objects.h"
|
||||||
#include "parallaction/disk.h"
|
#include "parallaction/disk.h"
|
||||||
#include "parallaction/walk.h"
|
#include "parallaction/walk.h"
|
||||||
|
|
||||||
|
#define PATH_LEN 200
|
||||||
|
|
||||||
|
|
||||||
extern OSystem *g_system;
|
extern OSystem *g_system;
|
||||||
|
|
||||||
|
@ -200,7 +201,7 @@ struct Character {
|
||||||
Parallaction *_vm;
|
Parallaction *_vm;
|
||||||
|
|
||||||
|
|
||||||
Animation _ani;
|
AnimationPtr _ani;
|
||||||
Frames *_head;
|
Frames *_head;
|
||||||
Frames *_talk;
|
Frames *_talk;
|
||||||
Frames *_objs;
|
Frames *_objs;
|
||||||
|
@ -319,15 +320,15 @@ public:
|
||||||
OpcodeSet _commandOpcodes;
|
OpcodeSet _commandOpcodes;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
Command *cmd;
|
CommandPtr cmd;
|
||||||
Zone *z;
|
ZonePtr z;
|
||||||
} _cmdRunCtxt;
|
} _cmdRunCtxt;
|
||||||
|
|
||||||
OpcodeSet _instructionOpcodes;
|
OpcodeSet _instructionOpcodes;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
Animation *anim;
|
AnimationPtr anim;
|
||||||
Program *program;
|
ProgramPtr program;
|
||||||
InstructionList::iterator inst;
|
InstructionList::iterator inst;
|
||||||
uint16 modCounter;
|
uint16 modCounter;
|
||||||
bool suspend;
|
bool suspend;
|
||||||
|
@ -340,19 +341,19 @@ public:
|
||||||
void resumeJobs();
|
void resumeJobs();
|
||||||
|
|
||||||
void finalizeWalk(WalkNodeList *list);
|
void finalizeWalk(WalkNodeList *list);
|
||||||
int16 selectWalkFrame(const Common::Point& pos, const WalkNode* from);
|
int16 selectWalkFrame(const Common::Point& pos, const WalkNodePtr& from);
|
||||||
void clipMove(Common::Point& pos, const WalkNode* from);
|
void clipMove(Common::Point& pos, const WalkNodePtr& from);
|
||||||
|
|
||||||
Zone *findZone(const char *name);
|
ZonePtr findZone(const char *name);
|
||||||
Zone *hitZone(uint32 type, uint16 x, uint16 y);
|
ZonePtr hitZone(uint32 type, uint16 x, uint16 y);
|
||||||
uint16 runZone(Zone*);
|
uint16 runZone(ZonePtr& z);
|
||||||
void freeZones();
|
void freeZones();
|
||||||
|
|
||||||
void runDialogue(SpeakData*);
|
void runDialogue(SpeakData*);
|
||||||
|
|
||||||
void runCommands(CommandList& list, Zone *z = NULL);
|
void runCommands(CommandList& list, ZonePtr z = nullZonePtr);
|
||||||
|
|
||||||
Animation *findAnimation(const char *name);
|
AnimationPtr &findAnimation(const char *name);
|
||||||
void freeAnimations();
|
void freeAnimations();
|
||||||
|
|
||||||
void setBackground(const char *background, const char *mask, const char *path);
|
void setBackground(const char *background, const char *mask, const char *path);
|
||||||
|
@ -402,7 +403,7 @@ public:
|
||||||
p = _mousePos;
|
p = _mousePos;
|
||||||
}
|
}
|
||||||
|
|
||||||
Zone *_activeZone;
|
ZonePtr _activeZone;
|
||||||
|
|
||||||
ZoneList _zones;
|
ZoneList _zones;
|
||||||
AnimationList _animations;
|
AnimationList _animations;
|
||||||
|
@ -423,7 +424,7 @@ protected: // data
|
||||||
uint16 _event;
|
uint16 _event;
|
||||||
Common::Point _mousePos;
|
Common::Point _mousePos;
|
||||||
int16 _inventoryIndex;
|
int16 _inventoryIndex;
|
||||||
Zone* _zone;
|
ZonePtr _zone;
|
||||||
Label* _label;
|
Label* _label;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -446,7 +447,7 @@ protected: // data
|
||||||
bool _hasLocationSound;
|
bool _hasLocationSound;
|
||||||
char _locationSound[50];
|
char _locationSound[50];
|
||||||
|
|
||||||
Zone *_hoverZone;
|
ZonePtr _hoverZone;
|
||||||
|
|
||||||
|
|
||||||
protected: // members
|
protected: // members
|
||||||
|
@ -480,7 +481,7 @@ protected: // members
|
||||||
|
|
||||||
void freeCharacter();
|
void freeCharacter();
|
||||||
|
|
||||||
int16 pickupItem(Zone *z);
|
int16 pickupItem(ZonePtr &z);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void callFunction(uint index, void* parm) { }
|
virtual void callFunction(uint index, void* parm) { }
|
||||||
|
@ -490,7 +491,7 @@ public:
|
||||||
|
|
||||||
virtual void parseLocation(const char* name) = 0;
|
virtual void parseLocation(const char* name) = 0;
|
||||||
|
|
||||||
void updateDoor(Zone *z);
|
void updateDoor(ZonePtr &z);
|
||||||
|
|
||||||
virtual void runScripts() = 0;
|
virtual void runScripts() = 0;
|
||||||
virtual void walk() = 0;
|
virtual void walk() = 0;
|
||||||
|
@ -676,12 +677,12 @@ protected:
|
||||||
|
|
||||||
const char *filename;
|
const char *filename;
|
||||||
Script *script;
|
Script *script;
|
||||||
Zone *z;
|
ZonePtr z;
|
||||||
Animation *a;
|
AnimationPtr a;
|
||||||
int nextToken;
|
int nextToken;
|
||||||
CommandList *list;
|
CommandList *list;
|
||||||
bool endcommands;
|
bool endcommands;
|
||||||
Command *cmd;
|
CommandPtr cmd;
|
||||||
|
|
||||||
// BRA specific
|
// BRA specific
|
||||||
int numZones;
|
int numZones;
|
||||||
|
@ -733,12 +734,12 @@ protected:
|
||||||
DECLARE_UNQUALIFIED_COMMAND_PARSER(move);
|
DECLARE_UNQUALIFIED_COMMAND_PARSER(move);
|
||||||
DECLARE_UNQUALIFIED_COMMAND_PARSER(endcommands);
|
DECLARE_UNQUALIFIED_COMMAND_PARSER(endcommands);
|
||||||
|
|
||||||
virtual void parseGetData(Script &script, Zone *z);
|
virtual void parseGetData(Script &script, ZonePtr& z);
|
||||||
virtual void parseExamineData(Script &script, Zone *z);
|
virtual void parseExamineData(Script &script, ZonePtr& z);
|
||||||
virtual void parseDoorData(Script &script, Zone *z);
|
virtual void parseDoorData(Script &script, ZonePtr& z);
|
||||||
virtual void parseMergeData(Script &script, Zone *z);
|
virtual void parseMergeData(Script &script, ZonePtr& z);
|
||||||
virtual void parseHearData(Script &script, Zone *z);
|
virtual void parseHearData(Script &script, ZonePtr& z);
|
||||||
virtual void parseSpeakData(Script &script, Zone *z);
|
virtual void parseSpeakData(Script &script, ZonePtr& z);
|
||||||
|
|
||||||
void parseLocation(const char *filename);
|
void parseLocation(const char *filename);
|
||||||
char *parseComment(Script &script);
|
char *parseComment(Script &script);
|
||||||
|
@ -749,12 +750,12 @@ protected:
|
||||||
Question *parseQuestion(Script &script);
|
Question *parseQuestion(Script &script);
|
||||||
|
|
||||||
void parseZone(Script &script, ZoneList &list, char *name);
|
void parseZone(Script &script, ZoneList &list, char *name);
|
||||||
void parseZoneTypeBlock(Script &script, Zone *z);
|
void parseZoneTypeBlock(Script &script, ZonePtr z);
|
||||||
void parseWalkNodes(Script& script, WalkNodeList &list);
|
void parseWalkNodes(Script& script, WalkNodeList &list);
|
||||||
Animation *parseAnimation(Script &script, AnimationList &list, char *name);
|
void parseAnimation(Script &script, AnimationList &list, char *name);
|
||||||
void parseCommands(Script &script, CommandList&);
|
void parseCommands(Script &script, CommandList&);
|
||||||
void parseCommandFlags();
|
void parseCommandFlags();
|
||||||
void saveCommandForward(const char *name, Command* cmd);
|
void saveCommandForward(const char *name, CommandPtr &cmd);
|
||||||
void resolveCommandForwards();
|
void resolveCommandForwards();
|
||||||
void createCommand(uint id);
|
void createCommand(uint id);
|
||||||
void addCommand();
|
void addCommand();
|
||||||
|
@ -763,7 +764,7 @@ protected:
|
||||||
|
|
||||||
struct CommandForwardReference {
|
struct CommandForwardReference {
|
||||||
char name[20];
|
char name[20];
|
||||||
Command* cmd;
|
CommandPtr cmd;
|
||||||
} _forwardedCommands[MAX_FORWARDS];
|
} _forwardedCommands[MAX_FORWARDS];
|
||||||
uint _numForwardedCommands;
|
uint _numForwardedCommands;
|
||||||
|
|
||||||
|
@ -773,13 +774,13 @@ protected:
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool end;
|
bool end;
|
||||||
Animation *a;
|
AnimationPtr a;
|
||||||
Instruction *inst;
|
InstructionPtr inst;
|
||||||
LocalVariable *locals;
|
LocalVariable *locals;
|
||||||
Program *program;
|
ProgramPtr program;
|
||||||
|
|
||||||
// BRA specific
|
// BRA specific
|
||||||
Instruction *openIf;
|
InstructionPtr openIf;
|
||||||
} _instParseCtxt;
|
} _instParseCtxt;
|
||||||
|
|
||||||
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(defLocal);
|
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(defLocal);
|
||||||
|
@ -798,8 +799,8 @@ protected:
|
||||||
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(null);
|
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(null);
|
||||||
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(endscript);
|
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(endscript);
|
||||||
|
|
||||||
void parseInstruction(Program *program);
|
void parseInstruction(ProgramPtr &program);
|
||||||
void loadProgram(Animation *a, const char *filename);
|
void loadProgram(AnimationPtr &a, const char *filename);
|
||||||
void parseLValue(ScriptVar &var, const char *str);
|
void parseLValue(ScriptVar &var, const char *str);
|
||||||
virtual void parseRValue(ScriptVar &var, const char *str);
|
virtual void parseRValue(ScriptVar &var, const char *str);
|
||||||
void wrapLocalVar(LocalVariable *local);
|
void wrapLocalVar(LocalVariable *local);
|
||||||
|
@ -889,7 +890,7 @@ public:
|
||||||
int _subtitleY;
|
int _subtitleY;
|
||||||
int _subtitle[2];
|
int _subtitle[2];
|
||||||
|
|
||||||
Zone *_activeZone2;
|
ZonePtr _activeZone2;
|
||||||
|
|
||||||
int32 _counters[32];
|
int32 _counters[32];
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,6 @@ int Parallaction_br::init() {
|
||||||
|
|
||||||
_soundMan = new DummySoundMan(this);
|
_soundMan = new DummySoundMan(this);
|
||||||
|
|
||||||
_activeZone2 = 0;
|
|
||||||
|
|
||||||
initResources();
|
initResources();
|
||||||
initFonts();
|
initFonts();
|
||||||
initCursors();
|
initCursors();
|
||||||
|
@ -192,17 +190,17 @@ void Parallaction_br::startPart() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parallaction_br::runPendingZones() {
|
void Parallaction_br::runPendingZones() {
|
||||||
Zone *z;
|
ZonePtr z;
|
||||||
|
|
||||||
if (_activeZone) {
|
if (_activeZone) {
|
||||||
z = _activeZone; // speak Zone or sound
|
z = _activeZone; // speak Zone or sound
|
||||||
_activeZone = NULL;
|
_activeZone = nullZonePtr;
|
||||||
// runZone(z); // FIXME: BRA doesn't handle sound yet
|
// runZone(z); // FIXME: BRA doesn't handle sound yet
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_activeZone2) {
|
if (_activeZone2) {
|
||||||
z = _activeZone2; // speak Zone or sound
|
z = _activeZone2; // speak Zone or sound
|
||||||
_activeZone2 = NULL;
|
_activeZone2 = nullZonePtr;
|
||||||
runZone(z);
|
runZone(z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ int Parallaction_ns::init() {
|
||||||
initOpcodes();
|
initOpcodes();
|
||||||
initParsers();
|
initParsers();
|
||||||
|
|
||||||
_animations.push_front(&_char._ani);
|
_animations.push_front(_char._ani);
|
||||||
|
|
||||||
Parallaction::init();
|
Parallaction::init();
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ Parallaction_ns::~Parallaction_ns() {
|
||||||
delete _instructionNames;
|
delete _instructionNames;
|
||||||
delete _locationStmt;
|
delete _locationStmt;
|
||||||
|
|
||||||
_animations.remove(&_char._ani);
|
_animations.remove(_char._ani);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,8 +278,8 @@ void Parallaction_ns::showSlide(const char *name) {
|
||||||
|
|
||||||
void Parallaction_ns::runPendingZones() {
|
void Parallaction_ns::runPendingZones() {
|
||||||
if (_activeZone) {
|
if (_activeZone) {
|
||||||
Zone *z = _activeZone; // speak Zone or sound
|
ZonePtr z = _activeZone; // speak Zone or sound
|
||||||
_activeZone = NULL;
|
_activeZone = nullZonePtr;
|
||||||
runZone(z);
|
runZone(z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,12 +295,12 @@ void Parallaction_ns::changeLocation(char *location) {
|
||||||
_gfx->setFloatingLabel(0);
|
_gfx->setFloatingLabel(0);
|
||||||
_gfx->freeLabels();
|
_gfx->freeLabels();
|
||||||
|
|
||||||
_hoverZone = NULL;
|
_hoverZone = nullZonePtr;
|
||||||
if (_engineFlags & kEngineBlockInput) {
|
if (_engineFlags & kEngineBlockInput) {
|
||||||
setArrowCursor();
|
setArrowCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
_animations.remove(&_char._ani);
|
_animations.remove(_char._ani);
|
||||||
|
|
||||||
freeLocation();
|
freeLocation();
|
||||||
|
|
||||||
|
@ -320,19 +320,19 @@ void Parallaction_ns::changeLocation(char *location) {
|
||||||
changeCharacter(locname.character());
|
changeCharacter(locname.character());
|
||||||
}
|
}
|
||||||
|
|
||||||
_animations.push_front(&_char._ani);
|
_animations.push_front(_char._ani);
|
||||||
|
|
||||||
strcpy(_saveData1, locname.location());
|
strcpy(_saveData1, locname.location());
|
||||||
parseLocation(_saveData1);
|
parseLocation(_saveData1);
|
||||||
|
|
||||||
_char._ani._oldPos.x = -1000;
|
_char._ani->_oldPos.x = -1000;
|
||||||
_char._ani._oldPos.y = -1000;
|
_char._ani->_oldPos.y = -1000;
|
||||||
|
|
||||||
_char._ani.field_50 = 0;
|
_char._ani->field_50 = 0;
|
||||||
if (_location._startPosition.x != -1000) {
|
if (_location._startPosition.x != -1000) {
|
||||||
_char._ani._left = _location._startPosition.x;
|
_char._ani->_left = _location._startPosition.x;
|
||||||
_char._ani._top = _location._startPosition.y;
|
_char._ani->_top = _location._startPosition.y;
|
||||||
_char._ani._frame = _location._startFrame;
|
_char._ani->_frame = _location._startFrame;
|
||||||
_location._startPosition.y = -1000;
|
_location._startPosition.y = -1000;
|
||||||
_location._startPosition.x = -1000;
|
_location._startPosition.x = -1000;
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ void Parallaction_ns::changeCharacter(const char *name) {
|
||||||
freeCharacter();
|
freeCharacter();
|
||||||
|
|
||||||
Common::String oldArchive = _disk->selectArchive((getFeatures() & GF_DEMO) ? "disk0" : "disk1");
|
Common::String oldArchive = _disk->selectArchive((getFeatures() & GF_DEMO) ? "disk0" : "disk1");
|
||||||
_char._ani.gfxobj = _gfx->loadAnim(_char.getFullName());
|
_char._ani->gfxobj = _gfx->loadAnim(_char.getFullName());
|
||||||
|
|
||||||
if (!_char.dummy()) {
|
if (!_char.dummy()) {
|
||||||
if (getPlatform() == Common::kPlatformAmiga) {
|
if (getPlatform() == Common::kPlatformAmiga) {
|
||||||
|
@ -414,7 +414,7 @@ void Parallaction_ns::cleanupGame() {
|
||||||
_engineFlags &= ~kEngineTransformedDonna;
|
_engineFlags &= ~kEngineTransformedDonna;
|
||||||
|
|
||||||
// this code saves main character animation from being removed from the following code
|
// this code saves main character animation from being removed from the following code
|
||||||
_animations.remove(&_char._ani);
|
_animations.remove(_char._ani);
|
||||||
_numLocations = 0;
|
_numLocations = 0;
|
||||||
_commandFlags = 0;
|
_commandFlags = 0;
|
||||||
|
|
||||||
|
@ -431,7 +431,7 @@ void Parallaction_ns::cleanupGame() {
|
||||||
_engineFlags &= ~kEngineQuit;
|
_engineFlags &= ~kEngineQuit;
|
||||||
|
|
||||||
// main character animation is restored
|
// main character animation is restored
|
||||||
_animations.push_front(&_char._ani);
|
_animations.push_front(_char._ani);
|
||||||
_score = 0;
|
_score = 0;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
|
|
||||||
#include "common/stream.h"
|
#include "common/stream.h"
|
||||||
|
|
||||||
#include "parallaction/defs.h"
|
|
||||||
|
|
||||||
namespace Parallaction {
|
namespace Parallaction {
|
||||||
|
|
||||||
char *parseNextToken(char *s, char *tok, uint16 count, const char *brk, bool ignoreQuotes = false);
|
char *parseNextToken(char *s, char *tok, uint16 count, const char *brk, bool ignoreQuotes = false);
|
||||||
|
@ -64,3 +62,4 @@ public:
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -130,14 +130,14 @@ DECLARE_LOCATION_PARSER(location) {
|
||||||
// TODO: handle background horizontal flip (via a context parameter)
|
// TODO: handle background horizontal flip (via a context parameter)
|
||||||
|
|
||||||
if (_tokens[nextToken][0] != '\0') {
|
if (_tokens[nextToken][0] != '\0') {
|
||||||
_char._ani._left = atoi(_tokens[nextToken]);
|
_char._ani->_left = atoi(_tokens[nextToken]);
|
||||||
nextToken++;
|
nextToken++;
|
||||||
_char._ani._top = atoi(_tokens[nextToken]);
|
_char._ani->_top = atoi(_tokens[nextToken]);
|
||||||
nextToken++;
|
nextToken++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_tokens[nextToken][0] != '\0') {
|
if (_tokens[nextToken][0] != '\0') {
|
||||||
_char._ani._frame = atoi(_tokens[nextToken]);
|
_char._ani->_frame = atoi(_tokens[nextToken]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,11 +695,11 @@ DECLARE_INSTRUCTION_PARSER(if_op) {
|
||||||
DECLARE_INSTRUCTION_PARSER(endif) {
|
DECLARE_INSTRUCTION_PARSER(endif) {
|
||||||
debugC(7, kDebugParser, "INSTRUCTION_PARSER(endif) ");
|
debugC(7, kDebugParser, "INSTRUCTION_PARSER(endif) ");
|
||||||
|
|
||||||
if (_instParseCtxt.openIf == 0)
|
if (!_instParseCtxt.openIf)
|
||||||
error("unexpected 'endif'");
|
error("unexpected 'endif'");
|
||||||
|
|
||||||
// _instParseCtxt.openIf->_endif = _instParseCtxt.inst;
|
// _instParseCtxt.openIf->_endif = _instParseCtxt.inst;
|
||||||
_instParseCtxt.openIf = NULL;
|
_instParseCtxt.openIf = nullInstructionPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -716,14 +716,14 @@ void Parallaction_br::parseRValue(ScriptVar &v, const char *str) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Animation *a;
|
AnimationPtr a;
|
||||||
if (str[1] == '.') {
|
if (str[1] == '.') {
|
||||||
a = findAnimation(&str[2]);
|
a = findAnimation(&str[2]);
|
||||||
if (!a) {
|
if (!a) {
|
||||||
error("unknown animation '%s' in script", &str[2]);
|
error("unknown animation '%s' in script", &str[2]);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
a = _instParseCtxt.a;
|
a = AnimationPtr(_instParseCtxt.a);
|
||||||
|
|
||||||
if (str[0] == 'X') {
|
if (str[0] == 'X') {
|
||||||
v.setField(&a->_left);
|
v.setField(&a->_left);
|
||||||
|
|
|
@ -179,26 +179,24 @@ DECLARE_ANIM_PARSER(endanimation) {
|
||||||
popParserTables();
|
popParserTables();
|
||||||
}
|
}
|
||||||
|
|
||||||
Animation *Parallaction_ns::parseAnimation(Script& script, AnimationList &list, char *name) {
|
void Parallaction_ns::parseAnimation(Script& script, AnimationList &list, char *name) {
|
||||||
debugC(5, kDebugParser, "parseAnimation(name: %s)", name);
|
debugC(5, kDebugParser, "parseAnimation(name: %s)", name);
|
||||||
|
|
||||||
Animation *a = new Animation;
|
AnimationPtr a(new Animation);
|
||||||
|
|
||||||
strncpy(a->_name, name, ZONENAME_LENGTH);
|
strncpy(a->_name, name, ZONENAME_LENGTH);
|
||||||
|
|
||||||
list.push_front(a);
|
list.push_front(AnimationPtr(a));
|
||||||
|
|
||||||
_locParseCtxt.a = a;
|
_locParseCtxt.a = a;
|
||||||
_locParseCtxt.script = &script;
|
_locParseCtxt.script = &script;
|
||||||
|
|
||||||
pushParserTables(&_locationAnimParsers, _locationAnimStmt);
|
pushParserTables(&_locationAnimParsers, _locationAnimStmt);
|
||||||
|
|
||||||
return a;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parallaction_ns::parseInstruction(Program *program) {
|
void Parallaction_ns::parseInstruction(ProgramPtr &program) {
|
||||||
|
|
||||||
Instruction *inst = new Instruction;
|
InstructionPtr inst(new Instruction);
|
||||||
|
|
||||||
if (_tokens[0][1] == '.') {
|
if (_tokens[0][1] == '.') {
|
||||||
_tokens[0][1] = '\0';
|
_tokens[0][1] = '\0';
|
||||||
|
@ -221,14 +219,14 @@ void Parallaction_ns::parseInstruction(Program *program) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parallaction_ns::loadProgram(Animation *a, const char *filename) {
|
void Parallaction_ns::loadProgram(AnimationPtr &a, const char *filename) {
|
||||||
debugC(1, kDebugParser, "loadProgram(Animation: %s, script: %s)", a->_name, filename);
|
debugC(1, kDebugParser, "loadProgram(Animation: %s, script: %s)", a->_name, filename);
|
||||||
|
|
||||||
Script *script = _disk->loadScript(filename);
|
Script *script = _disk->loadScript(filename);
|
||||||
Program *program = new Program;
|
ProgramPtr program(new Program);
|
||||||
program->_anim = a;
|
program->_anim = a;
|
||||||
|
|
||||||
_instParseCtxt.openIf = NULL;
|
_instParseCtxt.openIf = nullInstructionPtr;
|
||||||
_instParseCtxt.end = false;
|
_instParseCtxt.end = false;
|
||||||
_instParseCtxt.program = program;
|
_instParseCtxt.program = program;
|
||||||
|
|
||||||
|
@ -415,7 +413,7 @@ void Parallaction_ns::parseRValue(ScriptVar &v, const char *str) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Animation *a;
|
AnimationPtr a;
|
||||||
if (str[1] == '.') {
|
if (str[1] == '.') {
|
||||||
a = findAnimation(&str[2]);
|
a = findAnimation(&str[2]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -445,7 +443,7 @@ void Parallaction_ns::parseLValue(ScriptVar &v, const char *str) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Animation *a;
|
AnimationPtr a;
|
||||||
if (str[1] == '.') {
|
if (str[1] == '.') {
|
||||||
a = findAnimation(&str[2]);
|
a = findAnimation(&str[2]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -501,7 +499,7 @@ DECLARE_COMMAND_PARSER(zone) {
|
||||||
createCommand(_lookup);
|
createCommand(_lookup);
|
||||||
|
|
||||||
_locParseCtxt.cmd->u._zone = findZone(_tokens[_locParseCtxt.nextToken]);
|
_locParseCtxt.cmd->u._zone = findZone(_tokens[_locParseCtxt.nextToken]);
|
||||||
if (_locParseCtxt.cmd->u._zone == NULL) {
|
if (!_locParseCtxt.cmd->u._zone) {
|
||||||
saveCommandForward(_tokens[_locParseCtxt.nextToken], _locParseCtxt.cmd);
|
saveCommandForward(_tokens[_locParseCtxt.nextToken], _locParseCtxt.cmd);
|
||||||
}
|
}
|
||||||
_locParseCtxt.nextToken++;
|
_locParseCtxt.nextToken++;
|
||||||
|
@ -584,7 +582,7 @@ DECLARE_COMMAND_PARSER(endcommands) {
|
||||||
void Parallaction_ns::parseCommandFlags() {
|
void Parallaction_ns::parseCommandFlags() {
|
||||||
|
|
||||||
int _si = _locParseCtxt.nextToken;
|
int _si = _locParseCtxt.nextToken;
|
||||||
Command *cmd = _locParseCtxt.cmd;
|
CommandPtr cmd = _locParseCtxt.cmd;
|
||||||
|
|
||||||
if (!scumm_stricmp(_tokens[_si], "flags")) {
|
if (!scumm_stricmp(_tokens[_si], "flags")) {
|
||||||
_si++;
|
_si++;
|
||||||
|
@ -650,12 +648,12 @@ void Parallaction_ns::addCommand() {
|
||||||
void Parallaction_ns::createCommand(uint id) {
|
void Parallaction_ns::createCommand(uint id) {
|
||||||
|
|
||||||
_locParseCtxt.nextToken = 1;
|
_locParseCtxt.nextToken = 1;
|
||||||
_locParseCtxt.cmd = new Command;
|
_locParseCtxt.cmd = CommandPtr(new Command);
|
||||||
_locParseCtxt.cmd->_id = id;
|
_locParseCtxt.cmd->_id = id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parallaction_ns::saveCommandForward(const char *name, Command* cmd) {
|
void Parallaction_ns::saveCommandForward(const char *name, CommandPtr &cmd) {
|
||||||
assert(_numForwardedCommands < MAX_FORWARDS);
|
assert(_numForwardedCommands < MAX_FORWARDS);
|
||||||
|
|
||||||
strcpy(_forwardedCommands[_numForwardedCommands].name, name);
|
strcpy(_forwardedCommands[_numForwardedCommands].name, name);
|
||||||
|
@ -858,12 +856,12 @@ DECLARE_LOCATION_PARSER(location) {
|
||||||
switchBackground(_location._name, mask);
|
switchBackground(_location._name, mask);
|
||||||
|
|
||||||
if (_tokens[2][0] != '\0') {
|
if (_tokens[2][0] != '\0') {
|
||||||
_char._ani._left = atoi(_tokens[2]);
|
_char._ani->_left = atoi(_tokens[2]);
|
||||||
_char._ani._top = atoi(_tokens[3]);
|
_char._ani->_top = atoi(_tokens[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_tokens[4][0] != '\0') {
|
if (_tokens[4][0] != '\0') {
|
||||||
_char._ani._frame = atoi(_tokens[4]);
|
_char._ani->_frame = atoi(_tokens[4]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1023,10 +1021,10 @@ void Parallaction_ns::parseWalkNodes(Script& script, WalkNodeList &list) {
|
||||||
|
|
||||||
if (!scumm_stricmp(_tokens[0], "COORD")) {
|
if (!scumm_stricmp(_tokens[0], "COORD")) {
|
||||||
|
|
||||||
WalkNode *v4 = new WalkNode(
|
WalkNodePtr v4(new WalkNode(
|
||||||
atoi(_tokens[1]),
|
atoi(_tokens[1]),
|
||||||
atoi(_tokens[2])
|
atoi(_tokens[2])
|
||||||
);
|
));
|
||||||
|
|
||||||
list.push_front(v4);
|
list.push_front(v4);
|
||||||
}
|
}
|
||||||
|
@ -1267,7 +1265,7 @@ void Parallaction_ns::parseZone(Script &script, ZoneList &list, char *name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Zone *z = new Zone;
|
ZonePtr z(new Zone);
|
||||||
|
|
||||||
strncpy(z->_name, name, ZONENAME_LENGTH);
|
strncpy(z->_name, name, ZONENAME_LENGTH);
|
||||||
|
|
||||||
|
@ -1284,7 +1282,7 @@ void Parallaction_ns::parseZone(Script &script, ZoneList &list, char *name) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Parallaction_ns::parseGetData(Script &script, Zone *z) {
|
void Parallaction_ns::parseGetData(Script &script, ZonePtr &z) {
|
||||||
|
|
||||||
GetData *data = new GetData;
|
GetData *data = new GetData;
|
||||||
|
|
||||||
|
@ -1315,7 +1313,7 @@ void Parallaction_ns::parseGetData(Script &script, Zone *z) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Parallaction_ns::parseExamineData(Script &script, Zone *z) {
|
void Parallaction_ns::parseExamineData(Script &script, ZonePtr &z) {
|
||||||
|
|
||||||
ExamineData *data = new ExamineData;
|
ExamineData *data = new ExamineData;
|
||||||
|
|
||||||
|
@ -1336,7 +1334,7 @@ void Parallaction_ns::parseExamineData(Script &script, Zone *z) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Parallaction_ns::parseDoorData(Script &script, Zone *z) {
|
void Parallaction_ns::parseDoorData(Script &script, ZonePtr &z) {
|
||||||
|
|
||||||
DoorData *data = new DoorData;
|
DoorData *data = new DoorData;
|
||||||
|
|
||||||
|
@ -1380,7 +1378,7 @@ void Parallaction_ns::parseDoorData(Script &script, Zone *z) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Parallaction_ns::parseMergeData(Script &script, Zone *z) {
|
void Parallaction_ns::parseMergeData(Script &script, ZonePtr &z) {
|
||||||
|
|
||||||
MergeData *data = new MergeData;
|
MergeData *data = new MergeData;
|
||||||
|
|
||||||
|
@ -1403,7 +1401,7 @@ void Parallaction_ns::parseMergeData(Script &script, Zone *z) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parallaction_ns::parseHearData(Script &script, Zone *z) {
|
void Parallaction_ns::parseHearData(Script &script, ZonePtr &z) {
|
||||||
|
|
||||||
HearData *data = new HearData;
|
HearData *data = new HearData;
|
||||||
|
|
||||||
|
@ -1424,7 +1422,7 @@ void Parallaction_ns::parseHearData(Script &script, Zone *z) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parallaction_ns::parseSpeakData(Script &script, Zone *z) {
|
void Parallaction_ns::parseSpeakData(Script &script, ZonePtr &z) {
|
||||||
|
|
||||||
SpeakData *data = new SpeakData;
|
SpeakData *data = new SpeakData;
|
||||||
|
|
||||||
|
@ -1445,7 +1443,7 @@ void Parallaction_ns::parseSpeakData(Script &script, Zone *z) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Parallaction_ns::parseZoneTypeBlock(Script &script, Zone *z) {
|
void Parallaction_ns::parseZoneTypeBlock(Script &script, ZonePtr z) {
|
||||||
debugC(7, kDebugParser, "parseZoneTypeBlock(name: %s, type: %x)", z->_name, z->_type);
|
debugC(7, kDebugParser, "parseZoneTypeBlock(name: %s, type: %x)", z->_name, z->_type);
|
||||||
|
|
||||||
switch (z->_type & 0xFFFF) {
|
switch (z->_type & 0xFFFF) {
|
||||||
|
|
|
@ -207,9 +207,9 @@ void Parallaction_ns::doSaveGame(uint16 slot, const char* name) {
|
||||||
|
|
||||||
sprintf(s, "%s\n", _saveData1);
|
sprintf(s, "%s\n", _saveData1);
|
||||||
f->writeString(s);
|
f->writeString(s);
|
||||||
sprintf(s, "%d\n", _char._ani._left);
|
sprintf(s, "%d\n", _char._ani->_left);
|
||||||
f->writeString(s);
|
f->writeString(s);
|
||||||
sprintf(s, "%d\n", _char._ani._top);
|
sprintf(s, "%d\n", _char._ani->_top);
|
||||||
f->writeString(s);
|
f->writeString(s);
|
||||||
sprintf(s, "%d\n", _score);
|
sprintf(s, "%d\n", _score);
|
||||||
f->writeString(s);
|
f->writeString(s);
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
#include "sound/mididrv.h"
|
#include "sound/mididrv.h"
|
||||||
|
|
||||||
#include "parallaction/defs.h"
|
#define PATH_LEN 200
|
||||||
|
|
||||||
class MidiParser;
|
class MidiParser;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
namespace Parallaction {
|
namespace Parallaction {
|
||||||
|
|
||||||
static uint16 _doorData1 = 1000;
|
static uint16 _doorData1 = 1000;
|
||||||
static Zone *_zoneTrap = NULL;
|
static ZonePtr _zoneTrap;
|
||||||
|
|
||||||
static uint16 walkData1 = 0;
|
static uint16 walkData1 = 0;
|
||||||
static uint16 walkData2 = 0; // next walk frame
|
static uint16 walkData2 = 0; // next walk frame
|
||||||
|
@ -129,7 +129,7 @@ uint32 PathBuilder::buildSubPath(const Common::Point& pos, const Common::Point&
|
||||||
(*nearest)->getPoint(v20);
|
(*nearest)->getPoint(v20);
|
||||||
v34 = v30 = v20.sqrDist(stop);
|
v34 = v30 = v20.sqrDist(stop);
|
||||||
|
|
||||||
_subPath.push_back(new WalkNode(**nearest));
|
_subPath.push_back(WalkNodePtr(new WalkNode(**nearest)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return v34;
|
return v34;
|
||||||
|
@ -154,14 +154,13 @@ WalkNodeList *PathBuilder::buildPath(uint16 x, uint16 y) {
|
||||||
correctPathPoint(to);
|
correctPathPoint(to);
|
||||||
debugC(1, kDebugWalk, "found closest path point at (%i, %i)", to.x, to.y);
|
debugC(1, kDebugWalk, "found closest path point at (%i, %i)", to.x, to.y);
|
||||||
|
|
||||||
WalkNode *v48 = new WalkNode(to.x, to.y);
|
WalkNodePtr v48(new WalkNode(to.x, to.y));
|
||||||
WalkNode *v44 = new WalkNode(*v48);
|
WalkNodePtr v44 = v48;
|
||||||
|
|
||||||
uint16 v38 = walkFunc1(to.x, to.y, v44);
|
uint16 v38 = walkFunc1(to.x, to.y, v44);
|
||||||
if (v38 == 1) {
|
if (v38 == 1) {
|
||||||
// destination directly reachable
|
// destination directly reachable
|
||||||
debugC(1, kDebugWalk, "direct move to (%i, %i)", to.x, to.y);
|
debugC(1, kDebugWalk, "direct move to (%i, %i)", to.x, to.y);
|
||||||
delete v44;
|
|
||||||
|
|
||||||
_list = new WalkNodeList;
|
_list = new WalkNodeList;
|
||||||
_list->push_back(v48);
|
_list->push_back(v48);
|
||||||
|
@ -198,7 +197,6 @@ WalkNodeList *PathBuilder::buildPath(uint16 x, uint16 y) {
|
||||||
printNodes(_list, "complete");
|
printNodes(_list, "complete");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete v44;
|
|
||||||
return _list;
|
return _list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +208,7 @@ WalkNodeList *PathBuilder::buildPath(uint16 x, uint16 y) {
|
||||||
// 1 : Point reachable in a straight line
|
// 1 : Point reachable in a straight line
|
||||||
// other values: square distance to target (point not reachable in a straight line)
|
// other values: square distance to target (point not reachable in a straight line)
|
||||||
//
|
//
|
||||||
uint16 PathBuilder::walkFunc1(int16 x, int16 y, WalkNode *Node) {
|
uint16 PathBuilder::walkFunc1(int16 x, int16 y, WalkNodePtr &Node) {
|
||||||
|
|
||||||
Common::Point arg(x, y);
|
Common::Point arg(x, y);
|
||||||
|
|
||||||
|
@ -261,7 +259,7 @@ uint16 PathBuilder::walkFunc1(int16 x, int16 y, WalkNode *Node) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parallaction::clipMove(Common::Point& pos, const WalkNode* from) {
|
void Parallaction::clipMove(Common::Point& pos, const WalkNodePtr& from) {
|
||||||
|
|
||||||
if ((pos.x < from->_x) && (pos.x < _pathBuffer->w) && (_pathBuffer->getValue(pos.x + 2, pos.y) != 0)) {
|
if ((pos.x < from->_x) && (pos.x < _pathBuffer->w) && (_pathBuffer->getValue(pos.x + 2, pos.y) != 0)) {
|
||||||
pos.x = (pos.x + 2 < from->_x) ? pos.x + 2 : from->_x;
|
pos.x = (pos.x + 2 < from->_x) ? pos.x + 2 : from->_x;
|
||||||
|
@ -282,7 +280,7 @@ void Parallaction::clipMove(Common::Point& pos, const WalkNode* from) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 Parallaction::selectWalkFrame(const Common::Point& pos, const WalkNode* from) {
|
int16 Parallaction::selectWalkFrame(const Common::Point& pos, const WalkNodePtr& from) {
|
||||||
|
|
||||||
Common::Point dist(from->_x - pos.x, from->_y - pos.y);
|
Common::Point dist(from->_x - pos.x, from->_y - pos.y);
|
||||||
|
|
||||||
|
@ -295,7 +293,7 @@ int16 Parallaction::selectWalkFrame(const Common::Point& pos, const WalkNode* fr
|
||||||
|
|
||||||
// walk frame selection
|
// walk frame selection
|
||||||
int16 v16;
|
int16 v16;
|
||||||
if (_char._ani.getFrameNum() == 20) {
|
if (_char._ani->getFrameNum() == 20) {
|
||||||
|
|
||||||
if (dist.x > dist.y) {
|
if (dist.x > dist.y) {
|
||||||
walkData2 = (from->_x > pos.x) ? 0 : 7;
|
walkData2 = (from->_x > pos.x) ? 0 : 7;
|
||||||
|
@ -329,7 +327,7 @@ uint16 Parallaction::checkDoor() {
|
||||||
|
|
||||||
if (_currentLocationIndex != _doorData1) {
|
if (_currentLocationIndex != _doorData1) {
|
||||||
_doorData1 = _currentLocationIndex;
|
_doorData1 = _currentLocationIndex;
|
||||||
_zoneTrap = NULL;
|
_zoneTrap = nullZonePtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
_engineFlags &= ~kEngineWalking;
|
_engineFlags &= ~kEngineWalking;
|
||||||
|
@ -337,16 +335,16 @@ uint16 Parallaction::checkDoor() {
|
||||||
Common::Point foot;
|
Common::Point foot;
|
||||||
|
|
||||||
_char.getFoot(foot);
|
_char.getFoot(foot);
|
||||||
Zone *z = hitZone(kZoneDoor, foot.x, foot.y);
|
ZonePtr z = hitZone(kZoneDoor, foot.x, foot.y);
|
||||||
|
|
||||||
if (z != NULL) {
|
if (z) {
|
||||||
|
|
||||||
if ((z->_flags & kFlagsClosed) == 0) {
|
if ((z->_flags & kFlagsClosed) == 0) {
|
||||||
_location._startPosition = z->u.door->_startPos;
|
_location._startPosition = z->u.door->_startPos;
|
||||||
_location._startFrame = z->u.door->_startFrame;
|
_location._startFrame = z->u.door->_startFrame;
|
||||||
|
|
||||||
scheduleLocationSwitch(z->u.door->_location);
|
scheduleLocationSwitch(z->u.door->_location);
|
||||||
_zoneTrap = NULL;
|
_zoneTrap = nullZonePtr;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
runCommands(z->_commands, z);
|
runCommands(z->_commands, z);
|
||||||
|
@ -356,23 +354,23 @@ uint16 Parallaction::checkDoor() {
|
||||||
_char.getFoot(foot);
|
_char.getFoot(foot);
|
||||||
z = hitZone(kZoneTrap, foot.x, foot.y);
|
z = hitZone(kZoneTrap, foot.x, foot.y);
|
||||||
|
|
||||||
if (z != NULL) {
|
if (z) {
|
||||||
_localFlags[_currentLocationIndex] |= kFlagsEnter;
|
_localFlags[_currentLocationIndex] |= kFlagsEnter;
|
||||||
runCommands(z->_commands, z);
|
runCommands(z->_commands, z);
|
||||||
_localFlags[_currentLocationIndex] &= ~kFlagsEnter;
|
_localFlags[_currentLocationIndex] &= ~kFlagsEnter;
|
||||||
_zoneTrap = z;
|
_zoneTrap = z;
|
||||||
} else
|
} else
|
||||||
if (_zoneTrap != NULL) {
|
if (_zoneTrap) {
|
||||||
_localFlags[_currentLocationIndex] |= kFlagsExit;
|
_localFlags[_currentLocationIndex] |= kFlagsExit;
|
||||||
runCommands(_zoneTrap->_commands, _zoneTrap);
|
runCommands(_zoneTrap->_commands, _zoneTrap);
|
||||||
_localFlags[_currentLocationIndex] &= ~kFlagsExit;
|
_localFlags[_currentLocationIndex] &= ~kFlagsExit;
|
||||||
_zoneTrap = NULL;
|
_zoneTrap = nullZonePtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("done\n");
|
// printf("done\n");
|
||||||
|
|
||||||
_char._ani._frame = walkData2;
|
_char._ani->_frame = walkData2;
|
||||||
return _char._ani._frame;
|
return _char._ani->_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -388,8 +386,8 @@ void Parallaction_ns::walk() {
|
||||||
|
|
||||||
WalkNodeList *list = _char._walkPath;
|
WalkNodeList *list = _char._walkPath;
|
||||||
|
|
||||||
_char._ani._oldPos.x = _char._ani._left;
|
_char._ani->_oldPos.x = _char._ani->_left;
|
||||||
_char._ani._oldPos.y = _char._ani._top;
|
_char._ani->_oldPos.y = _char._ani->_top;
|
||||||
|
|
||||||
Common::Point pos;
|
Common::Point pos;
|
||||||
_char.getFoot(pos);
|
_char.getFoot(pos);
|
||||||
|
@ -416,14 +414,14 @@ void Parallaction_ns::walk() {
|
||||||
|
|
||||||
_char.setFoot(pos);
|
_char.setFoot(pos);
|
||||||
|
|
||||||
Common::Point newpos(_char._ani._left, _char._ani._top);
|
Common::Point newpos(_char._ani->_left, _char._ani->_top);
|
||||||
|
|
||||||
if (newpos == _char._ani._oldPos) {
|
if (newpos == _char._ani->_oldPos) {
|
||||||
debugC(1, kDebugWalk, "walk was blocked by an unforeseen obstacle");
|
debugC(1, kDebugWalk, "walk was blocked by an unforeseen obstacle");
|
||||||
// j->_finished = 1;
|
// j->_finished = 1;
|
||||||
finalizeWalk(list);
|
finalizeWalk(list);
|
||||||
} else {
|
} else {
|
||||||
_char._ani._frame = v16 + walkData2 + 1;
|
_char._ani->_frame = v16 + walkData2 + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -444,7 +442,7 @@ void WalkNode::getPoint(Common::Point &p) const {
|
||||||
p.y = _y;
|
p.y = _y;
|
||||||
}
|
}
|
||||||
|
|
||||||
PathBuilder::PathBuilder(Animation *anim) : _anim(anim), _list(0) {
|
PathBuilder::PathBuilder(AnimationPtr &anim) : _anim(anim), _list(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
#ifndef PARALLACTION_WALK_H
|
#ifndef PARALLACTION_WALK_H
|
||||||
#define PARALLACTION_WALK_H
|
#define PARALLACTION_WALK_H
|
||||||
|
|
||||||
#include "parallaction/defs.h"
|
#include "common/ptr.h"
|
||||||
|
#include "common/list.h"
|
||||||
|
|
||||||
namespace Parallaction {
|
namespace Parallaction {
|
||||||
|
|
||||||
|
@ -44,22 +45,23 @@ public:
|
||||||
void getPoint(Common::Point &p) const;
|
void getPoint(Common::Point &p) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef ManagedList<WalkNode*> WalkNodeList;
|
typedef Common::SharedPtr<WalkNode> WalkNodePtr;
|
||||||
|
typedef Common::List<WalkNodePtr> WalkNodeList;
|
||||||
|
|
||||||
|
|
||||||
class PathBuilder {
|
class PathBuilder {
|
||||||
|
|
||||||
Animation *_anim;
|
AnimationPtr _anim;
|
||||||
|
|
||||||
WalkNodeList *_list;
|
WalkNodeList *_list;
|
||||||
Common::List<WalkNode*> _subPath;
|
WalkNodeList _subPath;
|
||||||
|
|
||||||
void correctPathPoint(Common::Point &to);
|
void correctPathPoint(Common::Point &to);
|
||||||
uint32 buildSubPath(const Common::Point& pos, const Common::Point& stop);
|
uint32 buildSubPath(const Common::Point& pos, const Common::Point& stop);
|
||||||
uint16 walkFunc1(int16 x, int16 y, WalkNode *Node);
|
uint16 walkFunc1(int16 x, int16 y, WalkNodePtr& Node);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PathBuilder(Animation *anim);
|
PathBuilder(AnimationPtr &anim);
|
||||||
WalkNodeList* buildPath(uint16 x, uint16 y);
|
WalkNodeList* buildPath(uint16 x, uint16 y);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue