Skip to content

Commit

Permalink
TITANIC: Implemented more game classes
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 27, 2016
1 parent c1b6fc3 commit 5ea32ef
Show file tree
Hide file tree
Showing 21 changed files with 181 additions and 58 deletions.
16 changes: 5 additions & 11 deletions engines/titanic/carry/plug_in.cpp
Expand Up @@ -47,19 +47,13 @@ bool CPlugIn::UseWithOtherMsg(CUseWithOtherMsg *msg) {

if (otherName == "PET") {
return CCarry::UseWithOtherMsg(msg);
} else if (otherName == "DatasideTransporter") {
CString name = getName();
if (name == "DatasideTransporter") {
// TODO
if (name != "SendYourself") {
// TODO
}
} else {
// TODO
}
} else {
} else if (isEquals("DatasideTransporter")) {
CShowTextMsg textMsg("This item is incorrectly calibrated.");
textMsg.execute("PET");
} else if (isEquals("DatasideTransporter")) {
error("TODO: Set msg->_other->fieldC4 = 2");
} else if (isEquals("SendYourself")) {
error("TODO: Set msg->_other->fieldC8 = 1");
}

return true;
Expand Down
12 changes: 6 additions & 6 deletions engines/titanic/core/saveable_object.cpp
Expand Up @@ -252,7 +252,7 @@
#include "titanic/game/pickup/pick_up_vis_centre.h"
#include "titanic/game/placeholder/bar_shelf_vis_centre.h"
#include "titanic/game/placeholder/lemon_on_bar.h"
#include "titanic/game/placeholder/place_holder_item.h"
#include "titanic/game/placeholder/place_holder.h"
#include "titanic/game/placeholder/tv_on_bar.h"
#include "titanic/game/sgt/armchair.h"
#include "titanic/game/sgt/basin.h"
Expand Down Expand Up @@ -669,7 +669,7 @@ DEFFN(CPickUpSpeechCentre);
DEFFN(CPickUpVisCentre);
DEFFN(CBarShelfVisCentre);
DEFFN(CLemonOnBar);
DEFFN(CPlaceHolderItem);
DEFFN(CPlaceHolder);
DEFFN(CTVOnBar);
DEFFN(CArmchair);
DEFFN(CBasin);
Expand Down Expand Up @@ -1251,10 +1251,10 @@ void CSaveableObject::initClassList() {
ADDFN(CPickUpLemon, CPickUp);
ADDFN(CPickUpSpeechCentre, CPickUp);
ADDFN(CPickUpVisCentre, CPickUp);
ADDFN(CBarShelfVisCentre, CPlaceHolderItem);
ADDFN(CLemonOnBar, CPlaceHolderItem);
ADDFN(CPlaceHolderItem, CGameObject);
ADDFN(CTVOnBar, CPlaceHolderItem);
ADDFN(CBarShelfVisCentre, CPlaceHolder);
ADDFN(CLemonOnBar, CPlaceHolder);
ADDFN(CPlaceHolder, CGameObject);
ADDFN(CTVOnBar, CPlaceHolder);
ADDFN(CArmchair, CSGTStateRoom);
ADDFN(CBasin, CSGTStateRoom);
ADDFN(CBedfoot, CSGTStateRoom);
Expand Down
4 changes: 2 additions & 2 deletions engines/titanic/core/tree_item.cpp
Expand Up @@ -34,7 +34,7 @@
#include "titanic/core/room_item.h"
#include "titanic/pet_control/pet_control.h"
#include "titanic/game_manager.h"
#include "titanic/game/placeholder/place_holder_item.h"
#include "titanic/game/placeholder/place_holder.h"

namespace Titanic {

Expand Down Expand Up @@ -96,7 +96,7 @@ bool CTreeItem::isLinkItem() const {
}

bool CTreeItem::isPlaceHolderItem() const {
return isInstanceOf(CPlaceHolderItem::_type);
return isInstanceOf(CPlaceHolder::_type);
}

bool CTreeItem::isNamedItem() const {
Expand Down
6 changes: 5 additions & 1 deletion engines/titanic/game/parrot/player_meets_parrot.cpp
Expand Up @@ -24,6 +24,10 @@

namespace Titanic {

BEGIN_MESSAGE_MAP(CPlayerMeetsParrot, CGameObject)
ON_MESSAGE(EnterRoomMsg)
END_MESSAGE_MAP()

void CPlayerMeetsParrot::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CGameObject::save(file, indent);
Expand All @@ -35,7 +39,7 @@ void CPlayerMeetsParrot::load(SimpleFile *file) {
}

bool CPlayerMeetsParrot::EnterRoomMsg(CEnterRoomMsg *msg) {
warning("CPlayerMeetsParrot::handleEvent");
stateSet24();
return true;
}

Expand Down
1 change: 1 addition & 0 deletions engines/titanic/game/parrot/player_meets_parrot.h
Expand Up @@ -29,6 +29,7 @@
namespace Titanic {

class CPlayerMeetsParrot : public CGameObject {
DECLARE_MESSAGE_MAP;
protected:
bool EnterRoomMsg(CEnterRoomMsg *msg);
public:
Expand Down
2 changes: 1 addition & 1 deletion engines/titanic/game/pickup/pick_up_speech_centre.cpp
Expand Up @@ -63,7 +63,7 @@ bool CPickUpSpeechCentre::MouseDragStartMsg(CMouseDragStartMsg *msg) {
CActMsg actMsg("PlayerGetsSpeechCentre");
actMsg.execute("SeasonalAdjust");
} else {
petDisplayMessage("You can',27h,'t pick this up on account of it being stuck to the branch.");
petDisplayMessage("You can't pick this up on account of it being stuck to the branch.");
}
}

Expand Down
6 changes: 3 additions & 3 deletions engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp
Expand Up @@ -24,7 +24,7 @@

namespace Titanic {

BEGIN_MESSAGE_MAP(CBarShelfVisCentre, CPlaceHolderItem)
BEGIN_MESSAGE_MAP(CBarShelfVisCentre, CPlaceHolder)
ON_MESSAGE(MouseButtonDownMsg)
ON_MESSAGE(TimerMsg)
ON_MESSAGE(EnterViewMsg)
Expand All @@ -33,13 +33,13 @@ END_MESSAGE_MAP()
void CBarShelfVisCentre::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_flag, indent);
CPlaceHolderItem::save(file, indent);
CPlaceHolder::save(file, indent);
}

void CBarShelfVisCentre::load(SimpleFile *file) {
file->readNumber();
_flag = file->readNumber();
CPlaceHolderItem::load(file);
CPlaceHolder::load(file);
}

bool CBarShelfVisCentre::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
Expand Down
6 changes: 3 additions & 3 deletions engines/titanic/game/placeholder/bar_shelf_vis_centre.h
Expand Up @@ -23,11 +23,11 @@
#ifndef TITANIC_BAR_SHELF_VIS_CENTRE_H
#define TITANIC_BAR_SHELF_VIS_CENTRE_H

#include "titanic/game/placeholder/place_holder_item.h"
#include "titanic/game/placeholder/place_holder.h"

namespace Titanic {

class CBarShelfVisCentre : public CPlaceHolderItem {
class CBarShelfVisCentre : public CPlaceHolder {
DECLARE_MESSAGE_MAP;
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
bool TimerMsg(CTimerMsg *msg);
Expand All @@ -36,7 +36,7 @@ class CBarShelfVisCentre : public CPlaceHolderItem {
bool _flag;
public:
CLASSDEF;
CBarShelfVisCentre() : CPlaceHolderItem(), _flag(false) {}
CBarShelfVisCentre() : CPlaceHolder(), _flag(false) {}

/**
* Save the data for the class to file
Expand Down
6 changes: 3 additions & 3 deletions engines/titanic/game/placeholder/lemon_on_bar.cpp
Expand Up @@ -24,20 +24,20 @@

namespace Titanic {

BEGIN_MESSAGE_MAP(CLemonOnBar, CPlaceHolderItem)
BEGIN_MESSAGE_MAP(CLemonOnBar, CPlaceHolder)
ON_MESSAGE(VisibleMsg)
END_MESSAGE_MAP()

void CLemonOnBar::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writePoint(_lemonPos, indent);
CPlaceHolderItem::save(file, indent);
CPlaceHolder::save(file, indent);
}

void CLemonOnBar::load(SimpleFile *file) {
file->readNumber();
_lemonPos = file->readPoint();
CPlaceHolderItem::load(file);
CPlaceHolder::load(file);
}

bool CLemonOnBar::VisibleMsg(CVisibleMsg *msg) {
Expand Down
4 changes: 2 additions & 2 deletions engines/titanic/game/placeholder/lemon_on_bar.h
Expand Up @@ -23,11 +23,11 @@
#ifndef TITANIC_LEMON_ON_BAR_H
#define TITANIC_LEMON_ON_BAR_H

#include "titanic/game/placeholder/place_holder_item.h"
#include "titanic/game/placeholder/place_holder.h"

namespace Titanic {

class CLemonOnBar : public CPlaceHolderItem {
class CLemonOnBar : public CPlaceHolder {
DECLARE_MESSAGE_MAP;
bool VisibleMsg(CVisibleMsg *msg);
private:
Expand Down
Expand Up @@ -20,18 +20,27 @@
*
*/

#include "titanic/game/placeholder/place_holder_item.h"
#include "titanic/game/placeholder/place_holder.h"

namespace Titanic {

void CPlaceHolderItem::save(SimpleFile *file, int indent) {
BEGIN_MESSAGE_MAP(CPlaceHolder, CGameObject)
ON_MESSAGE(VisibleMsg)
END_MESSAGE_MAP()

void CPlaceHolder::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CGameObject::save(file, indent);
}

void CPlaceHolderItem::load(SimpleFile *file) {
void CPlaceHolder::load(SimpleFile *file) {
file->readNumber();
CGameObject::load(file);
}

bool CPlaceHolder::VisibleMsg(CVisibleMsg *msg) {
setVisible(msg->_visible);
return true;
}

} // End of namespace Titanic
Expand Up @@ -27,7 +27,9 @@

namespace Titanic {

class CPlaceHolderItem : public CGameObject {
class CPlaceHolder : public CGameObject {
DECLARE_MESSAGE_MAP;
bool VisibleMsg(CVisibleMsg *msg);
public:
CLASSDEF;

Expand Down
4 changes: 2 additions & 2 deletions engines/titanic/game/placeholder/tv_on_bar.cpp
Expand Up @@ -27,13 +27,13 @@ namespace Titanic {
void CTVOnBar::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writePoint(_pos1, indent);
CPlaceHolderItem::save(file, indent);
CPlaceHolder::save(file, indent);
}

void CTVOnBar::load(SimpleFile *file) {
file->readNumber();
_pos1 = file->readPoint();
CPlaceHolderItem::load(file);
CPlaceHolder::load(file);
}

} // End of namespace Titanic
4 changes: 2 additions & 2 deletions engines/titanic/game/placeholder/tv_on_bar.h
Expand Up @@ -23,11 +23,11 @@
#ifndef TITANIC_TV_ON_BAR_H
#define TITANIC_TV_ON_BAR_H

#include "titanic/game/placeholder/place_holder_item.h"
#include "titanic/game/placeholder/place_holder.h"

namespace Titanic {

class CTVOnBar : public CPlaceHolderItem {
class CTVOnBar : public CPlaceHolder {
private:
Point _pos1;
public:
Expand Down
43 changes: 39 additions & 4 deletions engines/titanic/game/play_music_button.cpp
Expand Up @@ -21,23 +21,58 @@
*/

#include "titanic/game/play_music_button.h"
#include "titanic/sound/music_room.h"

namespace Titanic {

BEGIN_MESSAGE_MAP(CPlayMusicButton, CBackground)
ON_MESSAGE(MouseButtonDownMsg)
ON_MESSAGE(FrameMsg)
END_MESSAGE_MAP()

void CPlayMusicButton::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_fieldE0, indent);
file->writeNumberLine(_fieldE4, indent);
file->writeNumberLine(_flag, indent);
file->writeNumberLine(_ticks, indent);

CBackground::save(file, indent);
}

void CPlayMusicButton::load(SimpleFile *file) {
file->readNumber();
_fieldE0 = file->readNumber();
_fieldE4 = file->readNumber();
_flag = file->readNumber();
_ticks = file->readNumber();

CBackground::load(file);
}

bool CPlayMusicButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
CMusicRoom *musicRoom = getMusicRoom();
if (_flag) {
musicRoom->stopMusic();
stopMovie();
loadFrame(0);
_flag = false;
} else {
musicRoom->startMusic(100);
playMovie(MOVIE_REPEAT);
_ticks = getTicksCount();
_flag = true;
}

return true;
}

bool CPlayMusicButton::FrameMsg(CFrameMsg *msg) {
if (_flag && !CMusicRoom::_musicHandler->isBusy()) {
CMusicRoom *musicRoom = getMusicRoom();
musicRoom->stopMusic();
stopMovie();
loadFrame(0);
_flag = false;
}

return true;
}

} // End of namespace Titanic
9 changes: 6 additions & 3 deletions engines/titanic/game/play_music_button.h
Expand Up @@ -28,12 +28,15 @@
namespace Titanic {

class CPlayMusicButton : public CBackground {
DECLARE_MESSAGE_MAP;
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
bool FrameMsg(CFrameMsg *msg);
public:
int _fieldE0;
int _fieldE4;
bool _flag;
uint _ticks;
public:
CLASSDEF;
CPlayMusicButton() : CBackground(), _fieldE0(0), _fieldE4(0) {}
CPlayMusicButton() : CBackground(), _flag(false), _ticks(0) {}

/**
* Save the data for the class to file
Expand Down
21 changes: 21 additions & 0 deletions engines/titanic/game/play_on_act.cpp
Expand Up @@ -24,6 +24,11 @@

namespace Titanic {

BEGIN_MESSAGE_MAP(CPlayOnAct, CBackground)
ON_MESSAGE(ActMsg)
ON_MESSAGE(LeaveViewMsg)
END_MESSAGE_MAP()

void CPlayOnAct::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CBackground::save(file, indent);
Expand All @@ -34,4 +39,20 @@ void CPlayOnAct::load(SimpleFile *file) {
CBackground::load(file);
}

bool CPlayOnAct::ActMsg(CActMsg *msg) {
if (msg->_action == "PlayMovie") {
setVisible(true);
playMovie(0);
} else if (msg->_action == "PlayToEnd") {
setVisible(true);
playMovie(MOVIE_GAMESTATE);
}

return true;
}

bool CPlayOnAct::LeaveViewMsg(CLeaveViewMsg *msg) {
return true;
}

} // End of namespace Titanic
3 changes: 3 additions & 0 deletions engines/titanic/game/play_on_act.h
Expand Up @@ -28,6 +28,9 @@
namespace Titanic {

class CPlayOnAct : public CBackground {
DECLARE_MESSAGE_MAP;
bool ActMsg(CActMsg *msg);
bool LeaveViewMsg(CLeaveViewMsg *msg);
public:
CLASSDEF;

Expand Down

0 comments on commit 5ea32ef

Please sign in to comment.