TITANIC: Cleanup and fixes for message hierarchy

This commit is contained in:
Paul Gilbert 2016-03-24 07:49:59 -04:00
parent 2f532c086d
commit 66e198d665
78 changed files with 160 additions and 173 deletions

View file

@ -160,7 +160,7 @@ void CViewItem::enterView(CViewItem *newView) {
}
}
bool CViewItem::handleEvent(CMouseButtonDownMsg &msg) {
bool CViewItem::handleMessage(CMouseButtonDownMsg &msg) {
if (msg._buttons & MB_LEFT) {
if (!handleMouseMsg(&msg, true)) {
CGameManager *gm = getGameManager();
@ -185,21 +185,21 @@ bool CViewItem::handleEvent(CMouseButtonDownMsg &msg) {
return true;
}
bool CViewItem::handleEvent(CMouseButtonUpMsg &msg) {
bool CViewItem::handleMessage(CMouseButtonUpMsg &msg) {
if (msg._buttons & MB_LEFT)
handleMouseMsg(&msg, false);
return true;
}
bool CViewItem::handleEvent(CMouseDoubleClickMsg &msg) {
bool CViewItem::handleMessage(CMouseDoubleClickMsg &msg) {
if (msg._buttons & MB_LEFT)
handleMouseMsg(&msg, false);
return true;
}
bool CViewItem::handleEvent(CMouseMoveMsg &msg) {
bool CViewItem::handleMessage(CMouseMoveMsg &msg) {
CScreenManager *screenManager = CScreenManager::_screenManagerPtr;
if (handleMouseMsg(&msg, true)) {
@ -224,8 +224,8 @@ bool CViewItem::handleEvent(CMouseMoveMsg &msg) {
return true;
}
bool CViewItem::handleMouseMsg(const CMouseMsg *msg, bool flag) {
const CMouseButtonUpMsg *upMsg = dynamic_cast<const CMouseButtonUpMsg *>(msg);
bool CViewItem::handleMouseMsg(CMouseMsg *msg, bool flag) {
CMouseButtonUpMsg *upMsg = dynamic_cast<CMouseButtonUpMsg *>(msg);
if (msg->isButtonUpMsg()) {
handleButtonUpMsg(upMsg);
return true;
@ -272,7 +272,7 @@ bool CViewItem::handleMouseMsg(const CMouseMsg *msg, bool flag) {
return result;
}
void CViewItem::handleButtonUpMsg(const CMouseButtonUpMsg *msg) {
void CViewItem::handleButtonUpMsg(CMouseButtonUpMsg *msg) {
CTreeItem *&target = _buttonUpTargets[msg->_buttons >> 1];
if (target) {

View file

@ -39,12 +39,12 @@ private:
/**
* Called to handle mouse messagaes on the view
*/
bool handleMouseMsg(const CMouseMsg *msg, bool flag);
bool handleMouseMsg(CMouseMsg *msg, bool flag);
/**
* Handles mouse button up messages
*/
void handleButtonUpMsg(const CMouseButtonUpMsg *msg);
void handleButtonUpMsg(CMouseButtonUpMsg *msg);
protected:
int _field24;
double _field28;
@ -52,10 +52,10 @@ protected:
int _field50;
int _field54;
protected:
virtual bool handleEvent(CMouseButtonDownMsg &msg);
virtual bool handleEvent(CMouseButtonUpMsg &msg);
virtual bool handleEvent(CMouseMoveMsg &msg);
virtual bool handleEvent(CMouseDoubleClickMsg &msg);
virtual bool handleMessage(CMouseButtonDownMsg &msg);
virtual bool handleMessage(CMouseButtonUpMsg &msg);
virtual bool handleMessage(CMouseMoveMsg &msg);
virtual bool handleMessage(CMouseDoubleClickMsg &msg);
public:
int _viewNumber;
public:

View file

@ -133,17 +133,17 @@ void CArboretumGate::load(SimpleFile *file) {
CBackground::load(file);
}
bool CArboretumGate::handleEvent(CActMsg &msg) { return false; }
bool CArboretumGate::handleEvent(CLeaveViewMsg &msg) { return false; }
bool CArboretumGate::handleEvent(CTurnOff &msg) { return false; }
bool CArboretumGate::handleEvent(CMouseButtonDownMsg &msg) { return false; }
bool CArboretumGate::handleMessage(CActMsg &msg) { return false; }
bool CArboretumGate::handleMessage(CLeaveViewMsg &msg) { return false; }
bool CArboretumGate::handleMessage(CTurnOff &msg) { return false; }
bool CArboretumGate::handleMessage(CMouseButtonDownMsg &msg) { return false; }
bool CArboretumGate::handleEvent(CEnterViewMsg &msg) {
bool CArboretumGate::handleMessage(CEnterViewMsg &msg) {
warning("CArboretumGate::handleEvent");
return false;
}
bool CArboretumGate::handleEvent(CTurnOn &msg) { return false; }
bool CArboretumGate::handleEvent(CMovieEndMsg &msg) { return false; }
bool CArboretumGate::handleMessage(CTurnOn &msg) { return false; }
bool CArboretumGate::handleMessage(CMovieEndMsg &msg) { return false; }
} // End of namespace Titanic

View file

@ -69,13 +69,13 @@ private:
int _field150;
CString _string2;
protected:
virtual bool handleEvent(CActMsg &msg);
virtual bool handleEvent(CLeaveViewMsg &msg);
virtual bool handleEvent(CTurnOff &msg);
virtual bool handleEvent(CMouseButtonDownMsg &msg);
virtual bool handleEvent(CEnterViewMsg &msg);
virtual bool handleEvent(CTurnOn &msg);
virtual bool handleEvent(CMovieEndMsg &msg);
virtual bool handleMessage(CActMsg &msg);
virtual bool handleMessage(CLeaveViewMsg &msg);
virtual bool handleMessage(CTurnOff &msg);
virtual bool handleMessage(CMouseButtonDownMsg &msg);
virtual bool handleMessage(CEnterViewMsg &msg);
virtual bool handleMessage(CTurnOn &msg);
virtual bool handleMessage(CMovieEndMsg &msg);
public:
CLASSDEF
CArboretumGate();

View file

@ -40,7 +40,7 @@ void CAutoAnimate::load(SimpleFile *file) {
CBackground::load(file);
}
bool CAutoAnimate::handleEvent(CEnterViewMsg &msg) {
bool CAutoAnimate::handleMessage(CEnterViewMsg &msg) {
warning("CAutoAnimate::handleEvent");
return true;
}

View file

@ -34,7 +34,7 @@ private:
int _fieldE4;
int _fieldE8;
protected:
virtual bool handleEvent(CEnterViewMsg &msg);
virtual bool handleMessage(CEnterViewMsg &msg);
public:
CLASSDEF
CAutoAnimate() : CBackground(), _fieldE0(1), _fieldE4(1), _fieldE8(0) {}

View file

@ -50,7 +50,7 @@ void CBarBell::load(SimpleFile *file) {
CGameObject::load(file);
}
bool CBarBell::handleEvent(CEnterRoomMsg &msg) {
bool CBarBell::handleMessage(CEnterRoomMsg &msg) {
_fieldBC = 0;
return true;
}

View file

@ -36,7 +36,7 @@ public:
int _fieldC8;
int _fieldCC;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CBarBell();

View file

@ -70,7 +70,7 @@ void CBomb::load(SimpleFile *file) {
CBackground::load(file);
}
bool CBomb::handleEvent(CEnterRoomMsg &msg) {
bool CBomb::handleMessage(CEnterRoomMsg &msg) {
_fieldE8 = 12;
_fieldEC = 9;
_fieldF0 = 0;

View file

@ -41,7 +41,7 @@ private:
int _startingTicks;
int _field104;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CBomb();

View file

@ -40,7 +40,7 @@ void CChickenCooler::load(SimpleFile *file) {
CGameObject::load(file);
}
bool CChickenCooler::handleEvent(CEnterRoomMsg &msg) {
bool CChickenCooler::handleMessage(CEnterRoomMsg &msg) {
warning("CChickenCoolor::handlEvent");
return true;
}

View file

@ -33,7 +33,7 @@ private:
int _fieldBC;
int _fieldC0;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CChickenCooler() : CGameObject(), _fieldBC(0), _fieldC0(0) {}

View file

@ -40,7 +40,7 @@ void CDoorbotElevatorHandler::load(SimpleFile *file) {
CGameObject::load(file);
}
bool CDoorbotElevatorHandler::handleEvent(CEnterNodeMsg &msg) {
bool CDoorbotElevatorHandler::handleMessage(CEnterNodeMsg &msg) {
warning("CDoorbotElevatorHandler::handleEvent");
return true;
}

View file

@ -33,7 +33,7 @@ private:
static int _v1;
int _value;
protected:
virtual bool handleEvent(CEnterNodeMsg &msg);
virtual bool handleMessage(CEnterNodeMsg &msg);
public:
CLASSDEF

View file

@ -34,7 +34,7 @@ void CEndSequenceControl::load(SimpleFile *file) {
CGameObject::load(file);
}
bool CEndSequenceControl::handleEvent(CEnterRoomMsg &msg) {
bool CEndSequenceControl::handleMessage(CEnterRoomMsg &msg) {
warning("TODO: CEndSequenceControl::handleEvent");
return true;
}

View file

@ -30,7 +30,7 @@ namespace Titanic {
class CEndSequenceControl : public CGameObject, CEnterRoomMsgTarget {
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF

View file

@ -55,7 +55,7 @@ void CFanNoises::load(SimpleFile *file) {
CGameObject::load(file);
}
bool CFanNoises::handleEvent(CEnterRoomMsg &msg) {
bool CFanNoises::handleMessage(CEnterRoomMsg &msg) {
warning("CFanNoises::handleEvent");
return true;
}

View file

@ -38,7 +38,7 @@ private:
int _fieldD0;
int _fieldD4;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CFanNoises();

View file

@ -46,7 +46,7 @@ void CGetLiftEye2::load(SimpleFile *file) {
CGameObject::load(file);
}
bool CGetLiftEye2::handleEvent(CEnterRoomMsg &msg) {
bool CGetLiftEye2::handleMessage(CEnterRoomMsg &msg) {
warning("CGetLiftEye2::handleEvent");
return true;
}

View file

@ -31,7 +31,7 @@ class CGetLiftEye2 : public CGameObject, CEnterRoomMsgTarget {
private:
static CString *_v1;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
static void init();

View file

@ -57,7 +57,7 @@ void CGondolierMixer::load(SimpleFile *file) {
CGondolierBase::load(file);
}
bool CGondolierMixer::handleEvent(CEnterRoomMsg &msg) {
bool CGondolierMixer::handleMessage(CEnterRoomMsg &msg) {
CRoomItem *parentRoom = dynamic_cast<CRoomItem *>(getParent());
if (parentRoom == msg._newRoom)
msg.execute(parentRoom);

View file

@ -38,7 +38,7 @@ private:
CString _string2;
int _fieldE4;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CGondolierMixer();

View file

@ -57,7 +57,7 @@ void CLight::load(SimpleFile *file) {
CBackground::load(file);
}
bool CLight::handleEvent(CEnterRoomMsg &msg) {
bool CLight::handleMessage(CEnterRoomMsg &msg) {
warning("CLight::handleEvent");
return true;
}

View file

@ -39,7 +39,7 @@ private:
int _fieldF8;
int _fieldFC;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CLight();

View file

@ -50,7 +50,7 @@ void CLightSwitch::load(SimpleFile *file) {
CBackground::load(file);
}
bool CLightSwitch::handleEvent(CEnterRoomMsg &msg) {
bool CLightSwitch::handleMessage(CEnterRoomMsg &msg) {
warning("CLightSwitch::handleEvent");
return true;
}

View file

@ -36,7 +36,7 @@ private:
int _fieldE4;
int _fieldE8;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CLightSwitch();

View file

@ -42,7 +42,7 @@ void CLongStickDispenser::load(SimpleFile *file) {
CGameObject::load(file);
}
bool CLongStickDispenser::handleEvent(CEnterRoomMsg &msg) {
bool CLongStickDispenser::handleMessage(CEnterRoomMsg &msg) {
_fieldC0 = 0;
_fieldC4 = 1;
return true;

View file

@ -34,7 +34,7 @@ private:
int _fieldC0;
int _fieldC4;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CLongStickDispenser() : CGameObject(), _fieldBC(0),

View file

@ -34,7 +34,7 @@ void CPlayerMeetsParrot::load(SimpleFile *file) {
CGameObject::load(file);
}
bool CPlayerMeetsParrot::handleEvent(CEnterRoomMsg &msg) {
bool CPlayerMeetsParrot::handleMessage(CEnterRoomMsg &msg) {
warning("CPlayerMeetsParrot::handleEvent");
return true;
}

View file

@ -30,7 +30,7 @@ namespace Titanic {
class CPlayerMeetsParrot : public CGameObject, CEnterRoomMsgTarget {
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF

View file

@ -34,7 +34,7 @@ void CPETMonitor::load(SimpleFile *file) {
CGameObject::load(file);
}
bool CPETMonitor::handleEvent(CEnterRoomMsg &msg) {
bool CPETMonitor::handleMessage(CEnterRoomMsg &msg) {
warning("CPETMonitor::handleEvent");
return true;
}

View file

@ -30,7 +30,7 @@ namespace Titanic {
class CPETMonitor : public CGameObject, CEnterRoomMsgTarget {
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF

View file

@ -34,7 +34,7 @@ void CPETPosition::load(SimpleFile *file) {
CGameObject::load(file);
}
bool CPETPosition::handleEvent(CEnterRoomMsg &msg) {
bool CPETPosition::handleMessage(CEnterRoomMsg &msg) {
warning("CPETPosition::handleEvent");
return true;
}

View file

@ -30,7 +30,7 @@ namespace Titanic {
class CPETPosition : public CGameObject, CEnterRoomMsgTarget {
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF

View file

@ -34,7 +34,7 @@ void CPETTransport::load(SimpleFile *file) {
CGameObject::load(file);
}
bool CPETTransport::handleEvent(CEnterRoomMsg &msg) {
bool CPETTransport::handleMessage(CEnterRoomMsg &msg) {
warning("CPETTransport::handleEvent");
return true;
}

View file

@ -30,7 +30,7 @@ namespace Titanic {
class CPETTransport : public CGameObject, CEnterRoomMsgTarget {
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF

View file

@ -55,7 +55,7 @@ void CPhonograph::load(SimpleFile *file) {
CMusicPlayer::load(file);
}
bool CPhonograph::handleEvent(CEnterRoomMsg &msg) {
bool CPhonograph::handleMessage(CEnterRoomMsg &msg) {
warning("CPhonograph::handleEvent");
return true;
}

View file

@ -38,7 +38,7 @@ protected:
int _fieldF0;
int _fieldF4;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CPhonograph();

View file

@ -90,7 +90,7 @@ void CSGTStateRoom::load(SimpleFile *file) {
CBackground::load(file);
}
bool CSGTStateRoom::handleEvent(CEnterRoomMsg &msg) {
bool CSGTStateRoom::handleMessage(CEnterRoomMsg &msg) {
warning("CSGTStateRoom::handleEvent");
return true;
}

View file

@ -55,7 +55,7 @@ private:
int _fieldEC;
int _fieldF0;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CSGTStateRoom();

View file

@ -48,7 +48,7 @@ void CShipSetting::load(SimpleFile *file) {
CBackground::load(file);
}
bool CShipSetting::handleEvent(CEnterRoomMsg &msg) {
bool CShipSetting::handleMessage(CEnterRoomMsg &msg) {
warning("CShipSetting::handleEvent");
return true;
}

View file

@ -35,7 +35,7 @@ private:
CString _string4;
CString _string5;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CShipSetting();

View file

@ -57,7 +57,7 @@ void CLift::load(SimpleFile *file) {
CTransport::load(file);
}
bool CLift::handleEvent(CEnterRoomMsg &msg) {
bool CLift::handleMessage(CEnterRoomMsg &msg) {
warning("CLift::handleEvent");
return true;
}

View file

@ -39,7 +39,7 @@ private:
int _fieldF8;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CLift() : CTransport(), _fieldF8(1) {}

View file

@ -35,7 +35,7 @@ private:
int _field108;
int _field10C;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg) { return true; }
virtual bool handleMessage(CEnterRoomMsg &msg) { return true; }
public:
CLASSDEF
CLiftindicator();

View file

@ -43,7 +43,7 @@ void CPellerator::load(SimpleFile *file) {
CTransport::load(file);
}
bool CPellerator::handleEvent(CEnterRoomMsg &msg) {
bool CPellerator::handleMessage(CEnterRoomMsg &msg) {
warning("CPellerator::handleEvent");
return true;
}

View file

@ -33,7 +33,7 @@ private:
static int _v1;
static int _v2;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF

View file

@ -48,7 +48,7 @@ void CUpLighter::load(SimpleFile *file) {
CDropTarget::load(file);
}
bool CUpLighter::handleEvent(CEnterRoomMsg &msg) {
bool CUpLighter::handleMessage(CEnterRoomMsg &msg) {
warning("CUpLighter::handleEvent");
return true;
}

View file

@ -35,7 +35,7 @@ private:
int _field120;
int _field124;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CUpLighter();

View file

@ -45,7 +45,7 @@ void CVolumeControl::load(SimpleFile *file) {
CGameObject::load(file);
}
bool CVolumeControl::handleEvent(CEnterNodeMsg &msg) {
bool CVolumeControl::handleMessage(CEnterNodeMsg &msg) {
warning("CVolumeControl::handleEvent");
return true;
}

View file

@ -34,7 +34,7 @@ private:
CString _string1;
int _fieldCC;
protected:
virtual bool handleEvent(CEnterNodeMsg &msg);
virtual bool handleMessage(CEnterNodeMsg &msg);
public:
CLASSDEF
CVolumeControl();

View file

@ -48,7 +48,7 @@ void CInputHandler::decLockCount() {
}
}
void CInputHandler::handleMessage(const CMessage &msg, bool respectLock) {
void CInputHandler::handleMessage(CMessage &msg, bool respectLock) {
if (!respectLock || _lockCount <= 0) {
if (_gameManager->_gameState._mode == GSMODE_1) {
processMessage(&msg);
@ -58,7 +58,7 @@ void CInputHandler::handleMessage(const CMessage &msg, bool respectLock) {
}
}
void CInputHandler::processMessage(const CMessage *msg) {
void CInputHandler::processMessage(CMessage *msg) {
const CMouseMsg *mouseMsg = dynamic_cast<const CMouseMsg *>(msg);
_field24 = 0;
dispatchMessage(msg);
@ -126,7 +126,7 @@ void CInputHandler::processMessage(const CMessage *msg) {
}
}
void CInputHandler::dispatchMessage(const CMessage *msg) {
void CInputHandler::dispatchMessage(CMessage *msg) {
CPetControl *pet = _gameManager->_project->getPetControl();
if (!pet || !msg->execute(pet, nullptr, MSGFLAG_BREAK_IF_HANDLED)) {
CViewItem *view = _gameManager->getView();

View file

@ -36,12 +36,12 @@ private:
/**
* Process and dispatch a passed message
*/
void processMessage(const CMessage *msg);
void processMessage(CMessage *msg);
/**
* Dispatches a message to the project
*/
void dispatchMessage(const CMessage *msg);
void dispatchMessage(CMessage *msg);
/**
* Called when a drag operation has ended
@ -75,7 +75,7 @@ public:
/**
* Handles a genereated mouse message
*/
void handleMessage(const CMessage &msg, bool respectLock = true);
void handleMessage(CMessage &msg, bool respectLock = true);
};
} // End of namespace Titanic

View file

@ -34,7 +34,7 @@ void CBilgeDispensorEvent::load(SimpleFile *file) {
CAutoSoundEvent::load(file);
}
bool CBilgeDispensorEvent::handleEvent(CEnterRoomMsg &msg) {
bool CBilgeDispensorEvent::handleMessage(CEnterRoomMsg &msg) {
_value1 = 0;
return true;
}

View file

@ -30,7 +30,7 @@ namespace Titanic {
class CBilgeDispensorEvent : public CAutoSoundEvent {
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF

View file

@ -39,7 +39,7 @@ void CMessage::load(SimpleFile *file) {
CSaveableObject::load(file);
}
bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) const {
bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) {
// If no target was specified, then there's nothing to do
if (!target)
return false;
@ -51,7 +51,7 @@ bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) c
if (flags & MSGFLAG_SCAN)
nextItem = item->scan(target);
if (!(flags & MSGFLAG_CLASS_DEF) || item->isInstanceOf(classDef)) {
if (!classDef || item->isInstanceOf(classDef)) {
bool handled = perform(item);
if (handled) {

View file

@ -35,7 +35,7 @@ enum MessageFlag {
};
#define MSGTARGET(NAME) class NAME; class NAME##Target { public: \
virtual bool handleEvent(NAME &msg) = 0; }
virtual bool handleMessage(NAME &msg) = 0; }
class CGameObject;
class CRoomItem;
@ -47,10 +47,14 @@ public:
CLASSDEF
CMessage();
/**
* Executes the message, passing it on to the designated target,
* and optionally it's children
*/
bool execute(CTreeItem *target, const ClassDef *classDef = nullptr,
int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED) const;
int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED);
virtual bool perform(CTreeItem *treeItem) const { return false; }
virtual bool perform(CTreeItem *treeItem) { return false; }
/**
* Save the data for the class to file
@ -80,8 +84,6 @@ public:
MSGTARGET(CEditControlMsg);
class CEditControlMsg : public CMessage {
protected:
virtual bool handleMessage(const CEditControlMsg &msg) { return false; }
public:
int _field4;
int _field8;
@ -95,19 +97,17 @@ public:
_field1C(0), _field20(0) {}
static bool isSupportedBy(const CTreeItem *item) {
return dynamic_cast<const CEditControlMsg *>(item) != nullptr;
return dynamic_cast<const CEditControlMsgTarget *>(item) != nullptr;
}
virtual bool perform(CTreeItem *treeItem) const {
CEditControlMsg *dest = dynamic_cast<CEditControlMsg *>(treeItem);
virtual bool perform(CTreeItem *treeItem) {
CEditControlMsgTarget *dest = dynamic_cast<CEditControlMsgTarget *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
};
MSGTARGET(CLightsMsg);
class CLightsMsg : public CMessage {
protected:
virtual bool handleMessage(const CLightsMsg &msg) { return false; }
public:
int _field4;
int _field8;
@ -119,19 +119,16 @@ public:
_fieldC(0), _field10(0) {}
static bool isSupportedBy(const CTreeItem *item) {
return dynamic_cast<const CLightsMsg *>(item) != nullptr;
return dynamic_cast<const CLightsMsgTarget *>(item) != nullptr;
}
virtual bool perform(CTreeItem *treeItem) const {
CLightsMsg *dest = dynamic_cast<CLightsMsg *>(treeItem);
virtual bool perform(CTreeItem *treeItem) {
CLightsMsgTarget *dest = dynamic_cast<CLightsMsgTarget *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
};
MSGTARGET(CIsHookedOnMsg);
class CIsHookedOnMsg : public CMessage {
protected:
virtual bool handleMessage(const CIsHookedOnMsg &msg) { return false; }
public:
int _field4;
int _field8;
@ -145,19 +142,16 @@ public:
_field18(0), _field1C(0), _field20(0) {}
static bool isSupportedBy(const CTreeItem *item) {
return dynamic_cast<const CIsHookedOnMsg *>(item) != nullptr;
return dynamic_cast<const CIsHookedOnMsgTarget *>(item) != nullptr;
}
virtual bool perform(CTreeItem *treeItem) const {
CIsHookedOnMsg *dest = dynamic_cast<CIsHookedOnMsg *>(treeItem);
virtual bool perform(CTreeItem *treeItem) {
CIsHookedOnMsgTarget *dest = dynamic_cast<CIsHookedOnMsgTarget *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
};
MSGTARGET(CSubAcceptCCarryMsg);
class CSubAcceptCCarryMsg : public CMessage {
protected:
virtual bool handleMessage(const CSubAcceptCCarryMsg &msg) { return false; }
public:
CString _string1;
int _value1, _value2, _value3;
@ -166,19 +160,16 @@ public:
CSubAcceptCCarryMsg() : _value1(0), _value2(0), _value3(0) {}
static bool isSupportedBy(const CTreeItem *item) {
return dynamic_cast<const CSubAcceptCCarryMsg *>(item) != nullptr;
return dynamic_cast<const CSubAcceptCCarryMsgTarget *>(item) != nullptr;
}
virtual bool perform(CTreeItem *treeItem) const {
CSubAcceptCCarryMsg *dest = dynamic_cast<CSubAcceptCCarryMsg *>(treeItem);
virtual bool perform(CTreeItem *treeItem) {
CSubAcceptCCarryMsgTarget *dest = dynamic_cast<CSubAcceptCCarryMsgTarget *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
};
MSGTARGET(CTransportMsg);
class CTransportMsg : public CMessage {
protected:
virtual bool handleMessage(const CTransportMsg &msg) { return false; }
public:
CString _string;
int _value1, _value2;
@ -187,11 +178,10 @@ public:
CTransportMsg() : _value1(0), _value2(0) {}
static bool isSupportedBy(const CTreeItem *item) {
return dynamic_cast<const CTransportMsg *>(item) != nullptr;
return dynamic_cast<const CTransportMsgTarget *>(item) != nullptr;
}
virtual bool perform(CTreeItem *treeItem) const {
CTransportMsg *dest = dynamic_cast<CTransportMsg *>(treeItem);
virtual bool perform(CTreeItem *treeItem) {
CTransportMsgTarget *dest = dynamic_cast<CTransportMsgTarget *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
};
@ -201,10 +191,9 @@ public:
public: NAME() : CMessage() {} \
CLASSDEF \
static bool isSupportedBy(const CTreeItem *item) { \
return dynamic_cast<const NAME *>(item) != nullptr; } \
virtual bool handleMessage(const NAME &msg) { return false; } \
virtual bool perform(CTreeItem *treeItem) const { \
NAME *dest = dynamic_cast<NAME *>(treeItem); \
return dynamic_cast<const NAME##Target *>(item) != nullptr; } \
virtual bool perform(CTreeItem *treeItem) { \
NAME##Target *dest = dynamic_cast<NAME##Target *>(treeItem); \
return dest != nullptr && dest->handleMessage(*this); \
} }
#define MESSAGE1(NAME, F1, N1, V1) MSGTARGET(NAME); \
@ -214,10 +203,9 @@ public:
NAME(F1 N1) : CMessage(), _##N1(N1) {} \
CLASSDEF \
static bool isSupportedBy(const CTreeItem *item) { \
return dynamic_cast<const NAME *>(item) != nullptr; } \
virtual bool handleMessage(const NAME &msg) { return false; } \
return dynamic_cast<const NAME##Target *>(item) != nullptr; } \
virtual bool perform(CTreeItem *treeItem) { \
NAME *dest = dynamic_cast<NAME *>(treeItem); \
NAME##Target *dest = dynamic_cast<NAME##Target *>(treeItem); \
return dest != nullptr && dest->handleMessage(*this); \
} }
#define MESSAGE2(NAME, F1, N1, V1, F2, N2, V2) MSGTARGET(NAME); \
@ -227,10 +215,9 @@ public:
NAME(F1 N1, F2 N2) : CMessage(), _##N1(N1), _##N2(N2) {} \
CLASSDEF \
static bool isSupportedBy(const CTreeItem *item) { \
return dynamic_cast<const NAME *>(item) != nullptr; } \
virtual bool handleMessage(const NAME &msg) { return false; } \
return dynamic_cast<const NAME##Target *>(item) != nullptr; } \
virtual bool perform(CTreeItem *treeItem) { \
NAME *dest = dynamic_cast<NAME *>(treeItem); \
NAME##Target *dest = dynamic_cast<NAME##Target *>(treeItem); \
return dest != nullptr && dest->handleMessage(*this); \
} }
#define MESSAGE3(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3) MSGTARGET(NAME); \
@ -240,10 +227,9 @@ public:
NAME(F1 N1, F2 N2, F3 N3) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3) {} \
CLASSDEF \
static bool isSupportedBy(const CTreeItem *item) { \
return dynamic_cast<const NAME *>(item) != nullptr; } \
virtual bool handleMessage(const NAME &msg) { return false; } \
return dynamic_cast<const NAME##Target *>(item) != nullptr; } \
virtual bool perform(CTreeItem *treeItem) { \
NAME *dest = dynamic_cast<NAME *>(treeItem); \
NAME##Target *dest = dynamic_cast<NAME##Target *>(treeItem); \
return dest != nullptr && dest->handleMessage(*this); \
} }
#define MESSAGE4(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3, F4, N4, V4) MSGTARGET(NAME); \
@ -253,10 +239,9 @@ public:
NAME(F1 N1, F2 N2, F3 N3, F4 N4) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3), _##N4(N4) {} \
CLASSDEF \
static bool isSupportedBy(const CTreeItem *item) { \
return dynamic_cast<const NAME *>(item) != nullptr; } \
virtual bool handleMessage(const NAME &msg) { return false; } \
return dynamic_cast<const NAME##Target *>(item) != nullptr; } \
virtual bool perform(CTreeItem *treeItem) { \
NAME *dest = dynamic_cast<NAME *>(treeItem); \
NAME##Target *dest = dynamic_cast<NAME##Target *>(treeItem); \
return dest != nullptr && dest->handleMessage(*this); \
} }

View file

@ -30,6 +30,7 @@ namespace Titanic {
enum MouseButton { MB_LEFT = 1, MB_MIDDLE = 2, MB_RIGHT = 4 };
MSGTARGET(CMouseMsg);
class CMouseMsg : public CMessage {
public:
int _buttons;
@ -39,6 +40,11 @@ public:
static bool isSupportedBy(const CTreeItem *item) {
return dynamic_cast<const CMouseMsg *>(item) != nullptr;
}
virtual bool perform(CTreeItem *treeItem) {
CMouseMsgTarget *dest = dynamic_cast<CMouseMsgTarget *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
CMouseMsg() : _buttons(0) {}
CMouseMsg(const Point &pt, int buttons) :
_mousePos(pt), _buttons(buttons) {}
@ -52,15 +58,15 @@ public:
CMouseMoveMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {}
static bool isSupportedBy(const CTreeItem *item) {
return dynamic_cast<const CMouseMoveMsg *>(item) != nullptr;
return dynamic_cast<const CMouseMoveMsgTarget *>(item) != nullptr;
}
virtual bool handleMessage(const CMouseMoveMsg &msg) { return false; }
virtual bool perform(CTreeItem *treeItem) {
CMouseMoveMsg *dest = dynamic_cast<CMouseMoveMsg *>(treeItem);
CMouseMoveMsgTarget *dest = dynamic_cast<CMouseMoveMsgTarget *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
};
MSGTARGET(CMouseButtonMsg);
class CMouseButtonMsg : public CMouseMsg {
public:
int _field10;
@ -70,7 +76,7 @@ public:
CMouseButtonMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {}
static bool isSupportedBy(const CTreeItem *item) {
return dynamic_cast<const CMouseButtonMsg *>(item) != nullptr;
return dynamic_cast<const CMouseButtonMsgTarget *>(item) != nullptr;
}
};
@ -82,11 +88,10 @@ public:
CMouseButtonDownMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {}
static bool isSupportedBy(const CTreeItem *item) {
return dynamic_cast<const CMouseButtonDownMsg *>(item) != nullptr;
return dynamic_cast<const CMouseButtonDownMsgTarget *>(item) != nullptr;
}
virtual bool handleMessage(const CMouseButtonDownMsg &msg) { return false; }
virtual bool perform(CTreeItem *treeItem) {
CMouseButtonDownMsg *dest = dynamic_cast<CMouseButtonDownMsg *>(treeItem);
CMouseButtonDownMsgTarget *dest = dynamic_cast<CMouseButtonDownMsgTarget *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
};
@ -101,9 +106,8 @@ public:
static bool isSupportedBy(const CTreeItem *item) {
return dynamic_cast<const CMouseButtonUpMsg *>(item) != nullptr;
}
virtual bool handleMessage(const CMouseButtonUpMsg &msg) { return false; }
virtual bool perform(CTreeItem *treeItem) {
CMouseButtonUpMsg *dest = dynamic_cast<CMouseButtonUpMsg *>(treeItem);
CMouseButtonUpMsgTarget *dest = dynamic_cast<CMouseButtonUpMsgTarget *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
};
@ -116,15 +120,15 @@ public:
CMouseDoubleClickMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {}
static bool isSupportedBy(const CTreeItem *item) {
return dynamic_cast<const CMouseDoubleClickMsg *>(item) != nullptr;
return dynamic_cast<const CMouseDoubleClickMsgTarget *>(item) != nullptr;
}
virtual bool handleMessage(const CMouseDoubleClickMsg &msg) { return false; }
virtual bool perform(CTreeItem *treeItem) {
CMouseDoubleClickMsg *dest = dynamic_cast<CMouseDoubleClickMsg *>(treeItem);
CMouseDoubleClickMsgTarget *dest = dynamic_cast<CMouseDoubleClickMsgTarget *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
};
MSGTARGET(CMouseDragMsg);
class CMouseDragMsg : public CMouseMsg {
public:
CLASSDEF
@ -136,6 +140,7 @@ public:
}
};
MSGTARGET(CMouseDragMoveMsg);
class CMouseDragMoveMsg : public CMouseDragMsg {
public:
CLASSDEF
@ -143,11 +148,10 @@ public:
CMouseDragMoveMsg(const Point &pt) : CMouseDragMsg(pt) {}
static bool isSupportedBy(const CTreeItem *item) {
return dynamic_cast<const CMouseDragMoveMsg *>(item) != nullptr;
return dynamic_cast<const CMouseDragMoveMsgTarget *>(item) != nullptr;
}
virtual bool handleMessage(const CMouseDragMoveMsg &msg) { return false; }
virtual bool perform(CTreeItem *treeItem) {
CMouseDragMoveMsg *dest = dynamic_cast<CMouseDragMoveMsg *>(treeItem);
CMouseDragMoveMsgTarget *dest = dynamic_cast<CMouseDragMoveMsgTarget *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
};
@ -164,11 +168,10 @@ public:
_dragItem(nullptr), _field14(0) {}
static bool isSupportedBy(const CTreeItem *item) {
return dynamic_cast<const CMouseDragStartMsg *>(item) != nullptr;
return dynamic_cast<const CMouseDragStartMsgTarget *>(item) != nullptr;
}
virtual bool handleMessage(const CMouseDragStartMsg &msg) { return false; }
virtual bool perform(CTreeItem *treeItem) {
CMouseDragStartMsg *dest = dynamic_cast<CMouseDragStartMsg *>(treeItem);
CMouseDragStartMsgTarget *dest = dynamic_cast<CMouseDragStartMsgTarget *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
};
@ -184,11 +187,10 @@ public:
CMouseDragMsg(pt), _dragItem(dragItem) {}
static bool isSupportedBy(const CTreeItem *item) {
return dynamic_cast<const CMouseDragEndMsg *>(item) != nullptr;
return dynamic_cast<const CMouseDragEndMsgTarget *>(item) != nullptr;
}
virtual bool handleMessage(const CMouseDragEndMsg &msg) { return false; }
virtual bool perform(CTreeItem *treeItem) {
CMouseDragEndMsg *dest = dynamic_cast<CMouseDragEndMsg *>(treeItem);
CMouseDragEndMsgTarget *dest = dynamic_cast<CMouseDragEndMsgTarget *>(treeItem);
return dest != nullptr && dest->handleMessage(*this);
}
};

View file

@ -36,7 +36,7 @@ void CEnterBridge::load(SimpleFile *file) {
CGameObject::load(file);
}
bool CEnterBridge::handleEvent(CEnterRoomMsg &msg) {
bool CEnterBridge::handleMessage(CEnterRoomMsg &msg) {
warning("CEnterBridge::handlEvent");
return true;
}

View file

@ -32,7 +32,7 @@ class CEnterBridge : public CGameObject, CEnterRoomMsgTarget {
private:
int _value;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CEnterBridge() : CGameObject(), _value(1) {}

View file

@ -233,7 +233,7 @@ void CBarbot::load(SimpleFile *file) {
CTrueTalkNPC::load(file);
}
bool CBarbot::handleEvent(CEnterRoomMsg &msg) {
bool CBarbot::handleMessage(CEnterRoomMsg &msg) {
warning("TODO: Barbot::CEnterRoomMsg");
return true;
}

View file

@ -174,7 +174,7 @@ private:
int _field33C;
int _field340;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CBarbot();

View file

@ -48,7 +48,7 @@ void CLiftBot::load(SimpleFile *file) {
CTrueTalkNPC::load(file);
}
bool CLiftBot::handleEvent(CEnterRoomMsg &msg) {
bool CLiftBot::handleMessage(CEnterRoomMsg &msg) {
warning("CLiftBot::handleEvent");
return true;
}

View file

@ -35,7 +35,7 @@ private:
private:
int _field108;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CLiftBot();

View file

@ -41,7 +41,7 @@ void CAutoMusicPlayer::load(SimpleFile *file) {
CAutoMusicPlayerBase::load(file);
}
bool CAutoMusicPlayer::handleEvent(CEnterRoomMsg &msg) {
bool CAutoMusicPlayer::handleMessage(CEnterRoomMsg &msg) {
if (!_fieldCC) {
warning("TODO");
}

View file

@ -32,7 +32,7 @@ class CAutoMusicPlayer : public CAutoMusicPlayerBase, CEnterRoomMsgTarget {
private:
CString _string2;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CAutoMusicPlayer();

View file

@ -44,7 +44,7 @@ void CMusicPlayer::load(SimpleFile *file) {
CGameObject::load(file);
}
bool CMusicPlayer::handleEvent(CEnterRoomMsg &msg) {
bool CMusicPlayer::handleMessage(CEnterRoomMsg &msg) {
warning("TODO: CMusicPlayer::handleEvent");
return true;
}

View file

@ -35,7 +35,7 @@ protected:
int _fieldCC;
int _fieldD0;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CMusicPlayer() : CGameObject(),

View file

@ -36,7 +36,7 @@ void CNodeAutoSoundPlayer::load(SimpleFile *file) {
CAutoSoundPlayer::load(file);
}
bool CNodeAutoSoundPlayer::handleEvent(CEnterNodeMsg &msg) {
bool CNodeAutoSoundPlayer::handleMessage(CEnterNodeMsg &msg) {
warning("CNodeAutoSoundPlayer::handleEvent");
return true;
}

View file

@ -32,7 +32,7 @@ class CNodeAutoSoundPlayer : public CAutoSoundPlayer, CEnterNodeMsgTarget {
private:
int _fieldEC;
protected:
virtual bool handleEvent(CEnterNodeMsg &msg);
virtual bool handleMessage(CEnterNodeMsg &msg);
public:
CLASSDEF
CNodeAutoSoundPlayer() : CAutoSoundPlayer(), _fieldEC(1) {}

View file

@ -44,7 +44,7 @@ void CRestrictedAutoMusicPlayer::load(SimpleFile *file) {
CAutoMusicPlayer::load(file);
}
bool CRestrictedAutoMusicPlayer::handleEvent(CEnterRoomMsg &msg) {
bool CRestrictedAutoMusicPlayer::handleMessage(CEnterRoomMsg &msg) {
warning("CRestrictedAutoMusicPlayer::handleEvent");
return true;
}

View file

@ -35,7 +35,7 @@ private:
CString _string5;
CString _string6;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF

View file

@ -34,7 +34,7 @@ void CRoomAutoSoundPlayer::load(SimpleFile *file) {
CAutoSoundPlayer::load(file);
}
bool CRoomAutoSoundPlayer::handleEvent(CEnterRoomMsg &msg) {
bool CRoomAutoSoundPlayer::handleMessage(CEnterRoomMsg &msg) {
warning("CRoomAutoSoundPlayer::handleEvent");
return true;
}

View file

@ -30,7 +30,7 @@ namespace Titanic {
class CRoomAutoSoundPlayer : public CAutoSoundPlayer, CEnterRoomMsgTarget {
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF

View file

@ -34,7 +34,7 @@ void CRoomTriggerAutoMusicPlayer::load(SimpleFile *file) {
CTriggerAutoMusicPlayer::load(file);
}
bool CRoomTriggerAutoMusicPlayer::handleEvent(CEnterRoomMsg &msg) {
bool CRoomTriggerAutoMusicPlayer::handleMessage(CEnterRoomMsg &msg) {
warning("CRoomTriggerAutoMusicPlayer::handleEvent");
return true;
}

View file

@ -30,7 +30,7 @@ namespace Titanic {
class CRoomTriggerAutoMusicPlayer : public CTriggerAutoMusicPlayer, CEnterRoomMsgTarget {
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF

View file

@ -40,7 +40,7 @@ void CTitaniaSpeech::load(SimpleFile *file) {
CGameObject::load(file);
}
bool CTitaniaSpeech::handleEvent(CEnterRoomMsg &msg) {
bool CTitaniaSpeech::handleMessage(CEnterRoomMsg &msg) {
warning("CTitaniaSpeech::handleEvent");
return true;
}

View file

@ -32,7 +32,7 @@ class CTitaniaSpeech : public CGameObject {
private:
int _value1, _value2;
protected:
virtual bool handleEvent(CEnterRoomMsg &msg);
virtual bool handleMessage(CEnterRoomMsg &msg);
public:
CLASSDEF
CTitaniaSpeech() : CGameObject(), _value1(1), _value2(0) {}