2013-07-20 16:08:05 +03:00
|
|
|
/* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FULLPIPE_MESSAGEQUEUE_H
|
|
|
|
#define FULLPIPE_MESSAGEQUEUE_H
|
|
|
|
|
|
|
|
#include "fullpipe/utils.h"
|
|
|
|
#include "fullpipe/inventory.h"
|
|
|
|
#include "fullpipe/gfx.h"
|
|
|
|
#include "fullpipe/sound.h"
|
|
|
|
#include "fullpipe/scene.h"
|
|
|
|
|
|
|
|
namespace Fullpipe {
|
|
|
|
|
2013-07-26 15:47:12 +03:00
|
|
|
class Message : public CObject {
|
|
|
|
public:
|
|
|
|
int _messageKind;
|
|
|
|
int16 _parentId;
|
|
|
|
int _x;
|
|
|
|
int _y;
|
|
|
|
int _field_14;
|
|
|
|
int _sceneClickX;
|
|
|
|
int _sceneClickY;
|
|
|
|
int _field_20;
|
|
|
|
int _field_24;
|
2013-08-07 00:43:08 +03:00
|
|
|
int _keyCode;
|
2013-07-26 15:47:12 +03:00
|
|
|
int _field_2C;
|
|
|
|
int _field_30;
|
|
|
|
int _field_34;
|
|
|
|
|
|
|
|
public:
|
|
|
|
Message();
|
|
|
|
Message(Message *src);
|
2013-07-29 22:16:14 +03:00
|
|
|
Message(int16 parentId, int messageKind, int x, int y, int a6, int a7, int sceneClickX, int sceneClickY, int a10);
|
2013-07-26 15:47:12 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class ExCommand : public Message {
|
2013-08-07 00:43:08 +03:00
|
|
|
public:
|
2013-07-29 22:16:14 +03:00
|
|
|
|
2013-07-26 15:47:12 +03:00
|
|
|
int _messageNum;
|
|
|
|
int _field_3C;
|
|
|
|
int _excFlags;
|
|
|
|
int _parId;
|
|
|
|
|
|
|
|
ExCommand();
|
|
|
|
ExCommand(ExCommand *src);
|
2013-07-29 22:16:14 +03:00
|
|
|
ExCommand(int16 parentId, int messageKind, int messageNum, int x, int y, int a7, int a8, int sceneClickX, int sceneClickY, int a11);
|
2013-07-26 15:47:12 +03:00
|
|
|
virtual ~ExCommand() {}
|
|
|
|
|
|
|
|
virtual bool load(MfcArchive &file);
|
2013-07-31 20:06:13 +03:00
|
|
|
|
2013-08-02 02:04:03 +03:00
|
|
|
bool handleMessage();
|
2013-08-03 00:26:34 +03:00
|
|
|
void sendMessage();
|
2013-07-26 15:47:12 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class CObjstateCommand : public CObject {
|
|
|
|
ExCommand _cmd;
|
|
|
|
char *_objCommandName;
|
|
|
|
int _value;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CObjstateCommand();
|
|
|
|
virtual bool load(MfcArchive &file);
|
|
|
|
};
|
|
|
|
|
2013-07-20 16:08:05 +03:00
|
|
|
class MessageQueue : public CObject {
|
|
|
|
friend class GlobalMessageQueueList;
|
2013-07-29 22:16:14 +03:00
|
|
|
friend class CGameLoader;
|
|
|
|
friend class Scene;
|
2013-07-20 16:08:05 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int _id;
|
|
|
|
int _flags;
|
|
|
|
char *_queueName;
|
|
|
|
int16 _dataId;
|
|
|
|
int16 _field_12;
|
|
|
|
int _field_14;
|
|
|
|
CPtrList _exCommands;
|
|
|
|
int _counter;
|
|
|
|
int _field_38;
|
|
|
|
int _isFinished;
|
|
|
|
int _parId;
|
|
|
|
int _flag1;
|
|
|
|
|
|
|
|
public:
|
|
|
|
MessageQueue();
|
2013-07-29 22:16:14 +03:00
|
|
|
MessageQueue(MessageQueue *src, int parId, int field_38);
|
2013-07-20 16:08:05 +03:00
|
|
|
virtual bool load(MfcArchive &file);
|
|
|
|
|
|
|
|
int getFlags() { return _flags; }
|
2013-07-29 22:16:14 +03:00
|
|
|
void setFlags(int flags) { _flags = flags; }
|
|
|
|
|
|
|
|
bool chain(StaticANIObject *ani);
|
2013-08-02 02:04:03 +03:00
|
|
|
void update();
|
|
|
|
void sendNextCommand();
|
|
|
|
void finish();
|
2013-08-03 00:26:34 +03:00
|
|
|
|
|
|
|
void messageQueueCallback1(int par);
|
2013-07-20 16:08:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class GlobalMessageQueueList : public CPtrList {
|
|
|
|
public:
|
|
|
|
MessageQueue *getMessageQueueById(int id);
|
|
|
|
void deleteQueueById(int id);
|
|
|
|
void disableQueueById(int id);
|
2013-07-29 22:16:14 +03:00
|
|
|
void addMessageQueue(MessageQueue *msg);
|
|
|
|
|
|
|
|
int compact();
|
2013-07-20 16:08:05 +03:00
|
|
|
};
|
|
|
|
|
2013-07-22 22:46:08 +03:00
|
|
|
struct MessageHandler {
|
|
|
|
int (*callback)(ExCommand *cmd);
|
|
|
|
int16 id;
|
|
|
|
int16 field_6;
|
|
|
|
int index;
|
|
|
|
MessageHandler *nextItem;
|
|
|
|
};
|
|
|
|
|
|
|
|
bool removeMessageHandler(int16 id, int pos);
|
|
|
|
void updateMessageHandlerIndex(MessageHandler *msg, int offset);
|
2013-07-22 23:38:11 +03:00
|
|
|
void addMessageHandler(int (*callback)(ExCommand *), int16 id);
|
|
|
|
MessageHandler *getMessageHandlerById(int16 id);
|
|
|
|
bool allocMessageHandler(MessageHandler *where, int16 id, int (*callback)(ExCommand *), int index);
|
|
|
|
int getMessageHandlersCount();
|
|
|
|
bool addMessageHandlerByIndex(int (*callback)(ExCommand *), int index, int16 id);
|
|
|
|
bool insertMessageHandler(int (*callback)(ExCommand *), int index, int16 id);
|
|
|
|
void clearMessageHandlers();
|
2013-07-31 20:06:13 +03:00
|
|
|
void postMessage(ExCommand *ex);
|
|
|
|
void processMessages();
|
2013-07-22 22:46:08 +03:00
|
|
|
|
2013-07-20 16:08:05 +03:00
|
|
|
} // End of namespace Fullpipe
|
|
|
|
|
|
|
|
#endif /* FULLPIPE_MESSAGEQUEUE_H */
|