Reduced dependency between project files, and prepared defs.h for deletion as soon as List<>'s usage is implemented.

svn-id: r26400
This commit is contained in:
Nicola Mettifogo 2007-04-07 10:02:59 +00:00
parent 9367371107
commit 59b1538685
18 changed files with 146 additions and 117 deletions

View File

@ -23,6 +23,7 @@
#include "common/file.h"
#include "parallaction/disk.h"
#include "parallaction/parallaction.h"
namespace Parallaction {

View File

@ -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 {

View File

@ -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;

View File

@ -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

View File

@ -20,6 +20,8 @@
*
*/
#include "common/stdafx.h"
#include "parallaction/commands.h"
#include "parallaction/parallaction.h"
#include "parallaction/graphics.h"

View File

@ -20,6 +20,8 @@
*
*/
#include "common/stdafx.h"
#include "parallaction/defs.h"
#include "parallaction/graphics.h"
#include "parallaction/parallaction.h"

View File

@ -40,6 +40,9 @@ class Parallaction;
class Gfx;
class Script;
struct Cnv;
struct StaticCnv;
class Archive : public Common::SeekableReadStream {
protected:

View File

@ -20,6 +20,8 @@
*
*/
#include "common/stdafx.h"
#include "common/system.h"
#include "common/file.h"
#include "parallaction/graphics.h"

View File

@ -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;

View File

@ -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 {

View File

@ -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

View File

@ -23,6 +23,8 @@
#ifndef PARALLACTION_MENU_H
#define PARALLACTION_MENU_H
#include "common/rect.h"
#include "parallaction/defs.h"
namespace Parallaction {

View File

@ -601,7 +601,7 @@ Parallaction::InputData *Parallaction::translateInput() {
}
}
beep();
// beep();
changeCursor(kCursorArrow);
return &_input;
}

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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;