From 59b15386853af4e2e3dbe4ec21518874b6b45625 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Sat, 7 Apr 2007 10:02:59 +0000 Subject: Reduced dependency between project files, and prepared defs.h for deletion as soon as List<>'s usage is implemented. svn-id: r26400 --- engines/parallaction/archive.cpp | 1 + engines/parallaction/callables.cpp | 8 ++- engines/parallaction/commands.h | 7 +++ engines/parallaction/defs.h | 113 +--------------------------------- engines/parallaction/dialogue.cpp | 2 + engines/parallaction/disk.cpp | 2 + engines/parallaction/disk.h | 3 + engines/parallaction/graphics.cpp | 2 + engines/parallaction/graphics.h | 47 +++++++++++++- engines/parallaction/location.cpp | 1 + engines/parallaction/menu.cpp | 7 ++- engines/parallaction/menu.h | 2 + engines/parallaction/parallaction.cpp | 2 +- engines/parallaction/parallaction.h | 24 ++++++++ engines/parallaction/parser.h | 3 +- engines/parallaction/walk.cpp | 17 +++++ engines/parallaction/walk.h | 14 +++++ engines/parallaction/zone.h | 8 +++ 18 files changed, 146 insertions(+), 117 deletions(-) (limited to 'engines/parallaction') diff --git a/engines/parallaction/archive.cpp b/engines/parallaction/archive.cpp index 34d1165092..ab913f5d54 100644 --- a/engines/parallaction/archive.cpp +++ b/engines/parallaction/archive.cpp @@ -23,6 +23,7 @@ #include "common/file.h" #include "parallaction/disk.h" +#include "parallaction/parallaction.h" namespace Parallaction { diff --git a/engines/parallaction/callables.cpp b/engines/parallaction/callables.cpp index faf7c71280..5d0b8979c3 100644 --- a/engines/parallaction/callables.cpp +++ b/engines/parallaction/callables.cpp @@ -20,6 +20,12 @@ * */ + +#include "common/stdafx.h" +#include "common/system.h" + +#include "common/file.h" + #include "parallaction/disk.h" #include "parallaction/parallaction.h" #include "parallaction/graphics.h" @@ -28,8 +34,6 @@ #include "parallaction/music.h" #include "parallaction/zone.h" -#include "common/file.h" - namespace Parallaction { diff --git a/engines/parallaction/commands.h b/engines/parallaction/commands.h index eed3160480..5070aef2e9 100644 --- a/engines/parallaction/commands.h +++ b/engines/parallaction/commands.h @@ -23,6 +23,10 @@ #ifndef PARALLACTION_COMMANDS_H #define PARALLACTION_COMMANDS_H + +#include "common/stdafx.h" +#include "common/scummsys.h" + #include "parallaction/defs.h" namespace Parallaction { @@ -34,6 +38,9 @@ enum CommandFlags { kFlagsGlobal = 0x40000000 }; +struct Zone; +struct Animation; + // TODO: turn this into a struct union CommandData { uint32 _flags; diff --git a/engines/parallaction/defs.h b/engines/parallaction/defs.h index d6066ca44f..cab8f14be0 100644 --- a/engines/parallaction/defs.h +++ b/engines/parallaction/defs.h @@ -23,23 +23,16 @@ #ifndef PARALLACTION_DEFS_H #define PARALLACTION_DEFS_H -#include "common/stdafx.h" -#include "common/system.h" - namespace Parallaction { -#define PATH_LEN 200 - - - - +// TODO (LIST): this struct won't be used anymore as soon as List<> is enforced throughout the code. struct Node { Node* _prev; Node* _next; Node() { - _prev = NULL; - _next = NULL; + _prev = 0; + _next = 0; } virtual ~Node() { @@ -47,106 +40,6 @@ struct Node { } }; -struct WalkNode : public Node { - int32 _x; - int32 _y; - -public: - WalkNode() : _x(0), _y(0) { - } - - WalkNode(int32 x, int32 y) : _x(x), _y(y) { - } - - WalkNode(const WalkNode& w) : Node(), _x(w._x), _y(w._y) { - // TODO: This will not properly set _prev and _next - // -- not sure what would be "correct" here? - } - - void getPoint(Common::Point &p) const { - p.x = _x; - p.y = _y; - } -}; - -struct SpeakData; -struct Question; -typedef Question Dialogue; -struct Instruction; -struct LocalVariable; - -struct StaticCnv { - uint16 _width; // - uint16 _height; // - byte* _data0; // bitmap - byte* _data1; // unused - - StaticCnv() { - _width = _height = 0; - _data0 = _data1 = NULL; - } -}; - - -struct Cnv { - uint16 _count; // # of frames - uint16 _width; // - uint16 _height; // - byte** field_8; // unused - byte* _data; - -public: - Cnv() { - _width = _height = _count = 0; - _data = NULL; - } - - Cnv(uint16 numFrames, uint16 width, uint16 height, byte* data) : _count(numFrames), _width(width), _height(height), _data(data) { - - } - - ~Cnv() { - if (_count == 0 || _data == NULL) return; - free(_data); - } - - byte* getFramePtr(uint16 index) { - if (index >= _count) - return NULL; - return &_data[index * _width * _height]; - } -}; - -struct Animation; -struct Zone; -struct Label; - -struct Command; - -typedef void (*callable)(void*); - -struct Credit { - const char *_role; - const char *_name; -}; - -void errorFileNotFound(const char*); - -void beep(); - -enum { - kDebugDisk = 1 << 0, - kDebugWalk = 1 << 1, - kDebugLocation = 1 << 2, - kDebugDialogue = 1 << 3, - kDebugGraphics = 1 << 4, - kDebugJobs = 1 << 5, - kDebugInput = 1 << 6 -}; - -enum { - GF_DEMO = 1 << 0 -}; } // namespace Parallaction diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index 14cd262b62..d6278e205b 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -20,6 +20,8 @@ * */ +#include "common/stdafx.h" + #include "parallaction/commands.h" #include "parallaction/parallaction.h" #include "parallaction/graphics.h" diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp index b4f8fcb045..dea7a54078 100644 --- a/engines/parallaction/disk.cpp +++ b/engines/parallaction/disk.cpp @@ -20,6 +20,8 @@ * */ +#include "common/stdafx.h" + #include "parallaction/defs.h" #include "parallaction/graphics.h" #include "parallaction/parallaction.h" diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h index c4f49a86e9..5e6233f3af 100644 --- a/engines/parallaction/disk.h +++ b/engines/parallaction/disk.h @@ -40,6 +40,9 @@ class Parallaction; class Gfx; class Script; +struct Cnv; +struct StaticCnv; + class Archive : public Common::SeekableReadStream { protected: diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 7016c6039f..f7429d6262 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -20,6 +20,8 @@ * */ +#include "common/stdafx.h" +#include "common/system.h" #include "common/file.h" #include "parallaction/graphics.h" diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index 400f08d43f..ddee2f22df 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -23,10 +23,13 @@ #ifndef PARALLACTION_GRAPHICS_H #define PARALLACTION_GRAPHICS_H -#include "parallaction/defs.h" +#include "common/rect.h" #include "common/stream.h" +#include "parallaction/defs.h" + + namespace Parallaction { @@ -65,6 +68,48 @@ struct PaletteFxRange { #include "common/pack-end.h" // END STRUCT PACKING +struct StaticCnv { + uint16 _width; // + uint16 _height; // + byte* _data0; // bitmap + byte* _data1; // unused + + StaticCnv() { + _width = _height = 0; + _data0 = _data1 = NULL; + } +}; + +struct Cnv { + uint16 _count; // # of frames + uint16 _width; // + uint16 _height; // + byte** field_8; // unused + byte* _data; + +public: + Cnv() { + _width = _height = _count = 0; + _data = NULL; + } + + Cnv(uint16 numFrames, uint16 width, uint16 height, byte* data) : _count(numFrames), _width(width), _height(height), _data(data) { + + } + + ~Cnv() { + if (_count == 0 || _data == NULL) return; + free(_data); + } + + byte* getFramePtr(uint16 index) { + if (index >= _count) + return NULL; + return &_data[index * _width * _height]; + } +}; + + #define NUM_BUFFERS 6 class Parallaction; diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp index a41006fc91..eaf2d5c2e3 100644 --- a/engines/parallaction/location.cpp +++ b/engines/parallaction/location.cpp @@ -26,6 +26,7 @@ #include "parallaction/parser.h" #include "parallaction/music.h" #include "parallaction/commands.h" +#include "parallaction/walk.h" #include "parallaction/zone.h" namespace Parallaction { diff --git a/engines/parallaction/menu.cpp b/engines/parallaction/menu.cpp index 666adfde12..6ae01a2774 100644 --- a/engines/parallaction/menu.cpp +++ b/engines/parallaction/menu.cpp @@ -20,6 +20,9 @@ * */ +#include "common/stdafx.h" +#include "common/system.h" + #include "parallaction/menu.h" #include "parallaction/disk.h" #include "parallaction/music.h" @@ -199,7 +202,7 @@ uint16 Menu::chooseLanguage() { if (128 + _si*49 <= _vm->_mousePos.x) continue; if (180 - _si*25 <=_vm->_mousePos.y) continue; - beep(); +// beep(); return _si; } } @@ -337,7 +340,7 @@ void Menu::selectCharacter() { _vm->_gfx->flatBlitCnv(&v14, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, Gfx::kBitBack); _vm->_gfx->flatBlitCnv(&v14, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, Gfx::kBitFront); - beep(); +// beep(); if (_dinoKey[_di] == _si) _dino_points++; // dino diff --git a/engines/parallaction/menu.h b/engines/parallaction/menu.h index 6f7418a23b..666305e693 100644 --- a/engines/parallaction/menu.h +++ b/engines/parallaction/menu.h @@ -23,6 +23,8 @@ #ifndef PARALLACTION_MENU_H #define PARALLACTION_MENU_H +#include "common/rect.h" + #include "parallaction/defs.h" namespace Parallaction { diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index cbb610abec..91228720a3 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -601,7 +601,7 @@ Parallaction::InputData *Parallaction::translateInput() { } } - beep(); +// beep(); changeCursor(kCursorArrow); return &_input; } diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 26485b6b41..8e96a06ee5 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -41,6 +41,21 @@ namespace GUI { namespace Parallaction { +enum { + kDebugDisk = 1 << 0, + kDebugWalk = 1 << 1, + kDebugLocation = 1 << 2, + kDebugDialogue = 1 << 3, + kDebugGraphics = 1 << 4, + kDebugJobs = 1 << 5, + kDebugInput = 1 << 6 +}; + +enum { + GF_DEMO = 1 << 0 +}; + + // high values mean high priority enum { @@ -99,6 +114,13 @@ public: } }; +struct Credit { + const char *_role; + const char *_name; +}; + +typedef void (*callable)(void*); + extern uint16 _mouseButtons; extern uint16 _score; @@ -145,6 +167,8 @@ extern const char *_minidrkiName; #define IS_MINI_CHARACTER(s) (((s)[0] == 'm')) #define IS_DUMMY_CHARACTER(s) (((s)[0] == 'D')) +#define PATH_LEN 200 + void waitUntilLeftClick(); void addNode(Node *list, Node *n); diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h index f662d8a896..a6a2019743 100644 --- a/engines/parallaction/parser.h +++ b/engines/parallaction/parser.h @@ -23,9 +23,10 @@ #ifndef PARALLACTION_PARSER_H #define PARALLACTION_PARSER_H -#include "parallaction/defs.h" #include "common/stream.h" +#include "parallaction/defs.h" + namespace Parallaction { char *parseNextLine(char *s, uint16 count); diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp index ce9ec11af2..e9c19171e7 100644 --- a/engines/parallaction/walk.cpp +++ b/engines/parallaction/walk.cpp @@ -446,6 +446,23 @@ void initWalk() { _buffer = (byte*)malloc(SCREENPATH_WIDTH * SCREEN_HEIGHT); } + +WalkNode::WalkNode() : _x(0), _y(0) { +} + +WalkNode::WalkNode(int32 x, int32 y) : _x(x), _y(y) { +} + +WalkNode::WalkNode(const WalkNode& w) : _x(w._x), _y(w._y) { +} + +void WalkNode::getPoint(Common::Point &p) const { + p.x = _x; + p.y = _y; +} + + + } // namespace Parallaction diff --git a/engines/parallaction/walk.h b/engines/parallaction/walk.h index f145a05146..5bc33c3c3e 100644 --- a/engines/parallaction/walk.h +++ b/engines/parallaction/walk.h @@ -27,6 +27,18 @@ namespace Parallaction { +struct WalkNode : public Node { + int32 _x; + int32 _y; + +public: + WalkNode(); + WalkNode(int32 x, int32 y); + WalkNode(const WalkNode& w); + + void getPoint(Common::Point &p) const; +}; + WalkNode *buildWalkPath(uint16 x, uint16 y); void jobWalk(void*, Job *j); @@ -35,6 +47,8 @@ void setPath(byte *path); void initWalk(); uint16 queryPath(uint16 x, uint16 y); + + } #endif diff --git a/engines/parallaction/zone.h b/engines/parallaction/zone.h index ae9977b5e8..6d16e1349b 100644 --- a/engines/parallaction/zone.h +++ b/engines/parallaction/zone.h @@ -24,6 +24,8 @@ #define PARALLACTION_ZONE_H #include "parallaction/defs.h" +#include "parallaction/graphics.h" + namespace Parallaction { @@ -61,6 +63,8 @@ enum ZoneFlags { #define NUM_ANSWERS 5 +struct Command; + struct Question { char* _text; char* _answers[NUM_ANSWERS]; @@ -89,6 +93,8 @@ struct Question { } }; +typedef Question Dialogue; + struct GetData { // size = 24 uint32 _icon; StaticCnv *_cnv; @@ -235,6 +241,8 @@ enum InstructionFlags { kInstMaskedPut = 8 }; +struct Animation; + struct Instruction : public Node { uint32 _index; uint32 _flags; -- cgit v1.2.3