2007-01-14 21:29:12 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2006 The ScummVM project
|
|
|
|
*
|
|
|
|
* 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_ZONE_H
|
|
|
|
#define PARALLACTION_ZONE_H
|
|
|
|
|
|
|
|
#include "parallaction/defs.h"
|
2007-04-07 10:02:59 +00:00
|
|
|
#include "parallaction/graphics.h"
|
|
|
|
|
2007-01-14 21:29:12 +00:00
|
|
|
|
|
|
|
namespace Parallaction {
|
|
|
|
|
|
|
|
enum ZoneTypes {
|
|
|
|
kZoneExamine = 1, // zone displays comment if activated
|
|
|
|
kZoneDoor = 2, // zone activated on click (after some walk if needed)
|
|
|
|
kZoneGet = 4, // for pickable items
|
|
|
|
kZoneMerge = 8, // tags items which can be merged in inventory
|
|
|
|
kZoneTaste = 0x10, // NEVER USED
|
|
|
|
kZoneHear = 0x20, // NEVER USED: they ran out of time before integrating sfx
|
|
|
|
kZoneFeel = 0x40, // NEVER USED
|
|
|
|
kZoneSpeak = 0x80, // tags NPCs the character can talk with
|
|
|
|
kZoneNone = 0x100, // used to prevent parsing on peculiar Animations
|
|
|
|
kZoneTrap = 0x200, // zone activated when character enters
|
|
|
|
kZoneYou = 0x400, // marks the character
|
|
|
|
kZoneCommand = 0x800
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum ZoneFlags {
|
|
|
|
kFlagsClosed = 1, // Zone: door is closed / switch is off
|
|
|
|
kFlagsActive = 2, // Zone/Animation: object is visible
|
|
|
|
kFlagsRemove = 4, // Zone/Animation: object is soon to be removed
|
|
|
|
kFlagsActing = 8, // Animation: script execution is active
|
|
|
|
kFlagsLocked = 0x10, // Zone: door or switch cannot be toggled
|
|
|
|
kFlagsFixed = 0x20, // Zone: Zone item cannot be picked up
|
|
|
|
kFlagsNoName = 0x40, // Zone with no name (used to prevent some kEvEnterZone events)
|
|
|
|
kFlagsNoMasked = 0x80, // Animation is to be drawn ignoring z buffer
|
|
|
|
kFlagsLooping = 0x100, // Animation: script is to be executed repeatedly
|
|
|
|
kFlagsAdded = 0x200, // NEVER USED in Nippon Safes
|
|
|
|
kFlagsCharacter = 0x400, //
|
|
|
|
kFlagsNoWalk = 0x800 // Zone: character doesn't need to walk towards object to interact
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-03-18 20:18:19 +00:00
|
|
|
#define NUM_ANSWERS 5
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2007-04-07 10:02:59 +00:00
|
|
|
struct Command;
|
|
|
|
|
2007-01-14 21:29:12 +00:00
|
|
|
struct Question {
|
|
|
|
char* _text;
|
2007-03-18 20:18:19 +00:00
|
|
|
char* _answers[NUM_ANSWERS];
|
2007-01-14 21:29:12 +00:00
|
|
|
uint16 _mood;
|
2007-03-18 20:18:19 +00:00
|
|
|
uint16 _answer_moods[NUM_ANSWERS];
|
2007-01-14 21:29:12 +00:00
|
|
|
union {
|
2007-03-18 20:18:19 +00:00
|
|
|
Question* _questions[NUM_ANSWERS];
|
|
|
|
char* _names[NUM_ANSWERS];
|
2007-01-14 21:29:12 +00:00
|
|
|
} _following;
|
2007-03-18 20:18:19 +00:00
|
|
|
Command* _commands[NUM_ANSWERS];
|
|
|
|
uint32 _noFlags[NUM_ANSWERS];
|
|
|
|
uint32 _yesFlags[NUM_ANSWERS];
|
|
|
|
|
|
|
|
Question() {
|
|
|
|
_text = NULL;
|
|
|
|
_mood = 0;
|
|
|
|
|
|
|
|
for (uint32 i = 0; i < NUM_ANSWERS; i++) {
|
|
|
|
_answers[i] = NULL;
|
|
|
|
_answer_moods[i] = 0;
|
|
|
|
_following._questions[i] = NULL;
|
|
|
|
_commands[i] = NULL;
|
|
|
|
_noFlags[i] = 0;
|
|
|
|
_yesFlags[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
};
|
|
|
|
|
2007-04-07 10:02:59 +00:00
|
|
|
typedef Question Dialogue;
|
|
|
|
|
2007-01-14 21:29:12 +00:00
|
|
|
struct GetData { // size = 24
|
|
|
|
uint32 _icon;
|
2007-03-18 21:15:39 +00:00
|
|
|
StaticCnv *_cnv;
|
2007-03-12 19:58:10 +00:00
|
|
|
byte *_backup;
|
2007-01-14 21:29:12 +00:00
|
|
|
uint16 field_14; // unused
|
|
|
|
uint16 field_16; // unused
|
2007-03-18 20:18:19 +00:00
|
|
|
|
|
|
|
GetData() {
|
|
|
|
_icon = 0;
|
|
|
|
_backup = NULL;
|
2007-03-18 21:15:39 +00:00
|
|
|
_cnv = NULL;
|
2007-03-18 20:18:19 +00:00
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
};
|
|
|
|
struct SpeakData { // size = 36
|
|
|
|
char _name[32];
|
|
|
|
Dialogue *_dialogue;
|
2007-03-18 20:18:19 +00:00
|
|
|
|
|
|
|
SpeakData() {
|
|
|
|
_name[0] = '\0';
|
|
|
|
_dialogue = NULL;
|
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
};
|
|
|
|
struct ExamineData { // size = 28
|
2007-03-18 21:15:39 +00:00
|
|
|
StaticCnv *_cnv;
|
2007-01-14 21:29:12 +00:00
|
|
|
uint16 _opBase; // unused
|
|
|
|
uint16 field_12; // unused
|
|
|
|
char* _description;
|
|
|
|
char* _filename;
|
2007-03-18 20:18:19 +00:00
|
|
|
|
|
|
|
ExamineData() {
|
|
|
|
_opBase = 0;
|
|
|
|
_description = NULL;
|
|
|
|
_filename = NULL;
|
2007-03-18 21:15:39 +00:00
|
|
|
_cnv = NULL;
|
2007-03-18 20:18:19 +00:00
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
};
|
|
|
|
struct DoorData { // size = 28
|
|
|
|
char* _location;
|
2007-03-18 21:00:22 +00:00
|
|
|
Cnv *_cnv;
|
2007-01-14 21:29:12 +00:00
|
|
|
byte* _background;
|
2007-03-18 17:17:21 +00:00
|
|
|
Common::Point _startPos;
|
2007-01-14 21:29:12 +00:00
|
|
|
uint16 _startFrame;
|
2007-03-18 20:18:19 +00:00
|
|
|
|
|
|
|
DoorData() {
|
|
|
|
_location = NULL;
|
|
|
|
_background = NULL;
|
|
|
|
_startFrame = 0;
|
2007-03-18 21:00:22 +00:00
|
|
|
_cnv = NULL;
|
2007-03-18 20:18:19 +00:00
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
};
|
|
|
|
struct HearData { // size = 20
|
|
|
|
char _name[20];
|
2007-03-18 20:18:19 +00:00
|
|
|
|
|
|
|
HearData() {
|
|
|
|
_name[0] = '\0';
|
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
};
|
|
|
|
struct MergeData { // size = 12
|
|
|
|
uint32 _obj1;
|
|
|
|
uint32 _obj2;
|
|
|
|
uint32 _obj3;
|
2007-03-18 20:18:19 +00:00
|
|
|
|
|
|
|
MergeData() {
|
|
|
|
_obj1 = _obj2 = _obj3 = 0;
|
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
};
|
|
|
|
|
2007-03-17 20:51:13 +00:00
|
|
|
struct TypeData {
|
2007-01-14 21:29:12 +00:00
|
|
|
GetData *get;
|
|
|
|
SpeakData *speak;
|
|
|
|
ExamineData *examine;
|
|
|
|
DoorData *door;
|
|
|
|
HearData *hear;
|
|
|
|
MergeData *merge;
|
2007-03-18 20:18:19 +00:00
|
|
|
|
|
|
|
TypeData() {
|
|
|
|
get = NULL;
|
|
|
|
speak = NULL;
|
|
|
|
examine = NULL;
|
|
|
|
door = NULL;
|
|
|
|
hear = NULL;
|
|
|
|
merge = NULL;
|
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
};
|
|
|
|
|
2007-03-17 20:51:13 +00:00
|
|
|
struct Label {
|
2007-02-04 08:12:33 +00:00
|
|
|
char* _text;
|
|
|
|
StaticCnv _cnv;
|
2007-03-18 20:18:19 +00:00
|
|
|
|
|
|
|
Label() {
|
|
|
|
_text = NULL;
|
|
|
|
}
|
2007-02-04 08:12:33 +00:00
|
|
|
};
|
2007-01-14 21:29:12 +00:00
|
|
|
|
2007-03-17 13:14:50 +00:00
|
|
|
struct Zone : public Node {
|
2007-04-07 09:31:24 +00:00
|
|
|
int16 _left;
|
|
|
|
int16 _top;
|
|
|
|
int16 _right;
|
|
|
|
int16 _bottom;
|
2007-01-14 21:29:12 +00:00
|
|
|
uint32 _type;
|
|
|
|
uint32 _flags;
|
2007-04-07 09:31:24 +00:00
|
|
|
Label _label;
|
2007-01-14 21:29:12 +00:00
|
|
|
uint16 field_2C; // unused
|
|
|
|
uint16 field_2E; // unused
|
2007-04-07 09:31:24 +00:00
|
|
|
TypeData u;
|
2007-01-14 21:29:12 +00:00
|
|
|
Command *_commands;
|
2007-03-18 17:17:21 +00:00
|
|
|
Common::Point _moveTo;
|
2007-03-17 20:48:23 +00:00
|
|
|
|
2007-04-07 09:31:24 +00:00
|
|
|
Zone();
|
|
|
|
virtual ~Zone();
|
2007-03-18 20:18:19 +00:00
|
|
|
|
2007-04-07 09:31:24 +00:00
|
|
|
void getRect(Common::Rect& r) const;
|
|
|
|
void translate(int16 x, int16 y);
|
|
|
|
virtual uint16 width() const;
|
|
|
|
virtual uint16 height() const;
|
2007-01-14 21:29:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct LocalVariable {
|
|
|
|
int16 _value;
|
|
|
|
int16 _min;
|
|
|
|
int16 _max;
|
2007-03-18 20:18:19 +00:00
|
|
|
|
|
|
|
LocalVariable() {
|
|
|
|
_value = 0;
|
|
|
|
_min = -10000;
|
|
|
|
_max = 10000;
|
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
union LValue {
|
|
|
|
int16 _value;
|
|
|
|
int16* _pvalue;
|
|
|
|
LocalVariable* _local;
|
2007-03-18 20:18:19 +00:00
|
|
|
|
|
|
|
LValue() {
|
|
|
|
_local = NULL;
|
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum InstructionFlags {
|
|
|
|
kInstUsesLiteral = 1,
|
|
|
|
kInstUsesLocal = 2,
|
|
|
|
kInstMod = 4,
|
|
|
|
kInstMaskedPut = 8
|
|
|
|
};
|
|
|
|
|
2007-04-07 10:02:59 +00:00
|
|
|
struct Animation;
|
|
|
|
|
2007-03-17 13:14:50 +00:00
|
|
|
struct Instruction : public Node {
|
2007-01-14 21:29:12 +00:00
|
|
|
uint32 _index;
|
|
|
|
uint32 _flags;
|
2007-03-18 20:18:19 +00:00
|
|
|
struct {
|
2007-01-14 21:29:12 +00:00
|
|
|
Animation *_a;
|
|
|
|
Zone *_z;
|
|
|
|
uint32 _index;
|
|
|
|
LValue _loopCounter;
|
|
|
|
} _opBase;
|
|
|
|
LValue _opA;
|
|
|
|
LValue _opB;
|
2007-03-18 20:18:19 +00:00
|
|
|
|
|
|
|
Instruction() {
|
|
|
|
_index = 0;
|
|
|
|
_flags = 0;
|
|
|
|
_opBase._a = NULL;
|
|
|
|
}
|
2007-01-14 21:29:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-04-06 18:29:55 +00:00
|
|
|
struct Program {
|
2007-01-14 21:29:12 +00:00
|
|
|
LocalVariable *_locals;
|
|
|
|
uint16 _loopCounter;
|
|
|
|
Instruction *_ip;
|
|
|
|
Instruction *_loopStart;
|
2007-04-06 18:29:55 +00:00
|
|
|
Instruction _start;
|
2007-03-18 20:18:19 +00:00
|
|
|
|
2007-04-07 09:31:24 +00:00
|
|
|
Program();
|
|
|
|
~Program();
|
2007-01-14 21:29:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-03-19 21:49:41 +00:00
|
|
|
struct Animation : public Zone {
|
2007-03-20 20:46:09 +00:00
|
|
|
|
|
|
|
Common::Point _oldPos;
|
2007-01-14 21:29:12 +00:00
|
|
|
Program *_program;
|
2007-03-18 20:35:12 +00:00
|
|
|
Cnv *_cnv;
|
2007-01-14 21:29:12 +00:00
|
|
|
int16 _frame;
|
|
|
|
uint16 field_50; // unused
|
|
|
|
int16 _z;
|
|
|
|
uint16 field_54; // unused
|
|
|
|
uint16 field_56; // unused
|
|
|
|
uint16 field_58; // unused
|
|
|
|
uint16 field_5A; // unused
|
|
|
|
uint16 field_5C; // unused
|
|
|
|
uint16 field_5E; // unused
|
2007-03-17 20:48:23 +00:00
|
|
|
|
2007-04-07 09:31:24 +00:00
|
|
|
Animation();
|
|
|
|
virtual ~Animation();
|
|
|
|
virtual uint16 width() const;
|
|
|
|
virtual uint16 height() const;
|
|
|
|
uint16 getFrameNum() const;
|
|
|
|
byte* getFrameData(uint32 index) const;
|
2007-01-14 21:29:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void dropItem(uint16 v);
|
|
|
|
int16 pickupItem(Zone *z);
|
|
|
|
|
|
|
|
|
|
|
|
void loadProgram(Animation *, char *filename);
|
2007-03-17 17:52:30 +00:00
|
|
|
|
2007-01-14 21:29:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace Parallaction
|
|
|
|
|
|
|
|
#endif
|