aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2017-01-14 16:39:38 -0500
committerPaul Gilbert2017-01-14 16:39:38 -0500
commitdc37fe5039e9bdbdb10119e9f316ec1e71d464f8 (patch)
tree0f3aaa29f49f3521f22bb3c3082cb93ee5fb3657
parent585fcc2daeaae532936b64e71cefbb6ba25b2ff9 (diff)
downloadscummvm-rg350-dc37fe5039e9bdbdb10119e9f316ec1e71d464f8.tar.gz
scummvm-rg350-dc37fe5039e9bdbdb10119e9f316ec1e71d464f8.tar.bz2
scummvm-rg350-dc37fe5039e9bdbdb10119e9f316ec1e71d464f8.zip
TITANIC: Renamings and cleanup for lemon dispensor
-rw-r--r--engines/titanic/game/lemon_dispensor.cpp47
-rw-r--r--engines/titanic/game/lemon_dispensor.h13
-rw-r--r--engines/titanic/titanic.cpp2
3 files changed, 25 insertions, 37 deletions
diff --git a/engines/titanic/game/lemon_dispensor.cpp b/engines/titanic/game/lemon_dispensor.cpp
index f84a494c26..2d4a89203d 100644
--- a/engines/titanic/game/lemon_dispensor.cpp
+++ b/engines/titanic/game/lemon_dispensor.cpp
@@ -31,30 +31,23 @@ BEGIN_MESSAGE_MAP(CLemonDispensor, CBackground)
END_MESSAGE_MAP()
bool CLemonDispensor::_isSummer;
-int CLemonDispensor::_v2;
-int CLemonDispensor::_v3;
+bool CLemonDispensor::_lemonDropped;
+int CLemonDispensor::_hitCounter;
CGameObject *CLemonDispensor::_draggingObject;
CLemonDispensor::CLemonDispensor() : CBackground(),
- _fieldE0(0), _origPt(Point(9, 15)), _fieldEC(0) {
-}
-
-void CLemonDispensor::init() {
- _isSummer = false;
- _v2 = 0;
- _v3 = 0;
- _draggingObject = nullptr;
+ _unused1(0), _origPt(Point(9, 15)), _onDispensor(false) {
}
void CLemonDispensor::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_isSummer, indent);
- file->writeNumberLine(_v2, indent);
- file->writeNumberLine(_v3, indent);
- file->writeNumberLine(_fieldE0, indent);
+ file->writeNumberLine(_lemonDropped, indent);
+ file->writeNumberLine(_hitCounter, indent);
+ file->writeNumberLine(_unused1, indent);
file->writeNumberLine(_origPt.x, indent);
file->writeNumberLine(_origPt.y, indent);
- file->writeNumberLine(_fieldEC, indent);
+ file->writeNumberLine(_onDispensor, indent);
CBackground::save(file, indent);
}
@@ -62,18 +55,19 @@ void CLemonDispensor::save(SimpleFile *file, int indent) {
void CLemonDispensor::load(SimpleFile *file) {
file->readNumber();
_isSummer = file->readNumber();
- _v2 = file->readNumber();
- _v3 = file->readNumber();
- _fieldE0 = file->readNumber();
+ _lemonDropped = file->readNumber();
+ _hitCounter = file->readNumber();
+ _unused1 = file->readNumber();
_origPt.x = file->readNumber();
_origPt.y = file->readNumber();
- _fieldEC = file->readNumber();
+ _onDispensor = file->readNumber();
+ _draggingObject = nullptr;
CBackground::load(file);
}
bool CLemonDispensor::FrameMsg(CFrameMsg *msg) {
- if (_v2 || !_isSummer)
+ if (_lemonDropped || !_isSummer)
return true;
if (!_draggingObject) {
@@ -94,14 +88,15 @@ bool CLemonDispensor::FrameMsg(CFrameMsg *msg) {
_origPt.y + _draggingObject->_bounds.top);
bool flag = checkPoint(pt, true);
- if (_fieldEC == 0) {
- if (flag && ++_v3 > 10) {
+ if (!_onDispensor) {
+ if (flag && ++_hitCounter > 10) {
CLemonFallsFromTreeMsg lemonMsg(pt);
lemonMsg.execute("Lemon");
- _v2 = 1;
+ _lemonDropped = true;
}
- } else if (_fieldEC == 1 && !flag) {
- _fieldEC = 0;
+ _onDispensor = true;
+ } else if (_onDispensor && !flag) {
+ _onDispensor = false;
}
}
@@ -115,8 +110,8 @@ bool CLemonDispensor::ChangeSeasonMsg(CChangeSeasonMsg *msg) {
bool CLemonDispensor::LeaveViewMsg(CLeaveViewMsg *msg) {
_draggingObject = nullptr;
- _v3 = 0;
- _fieldEC = 0;
+ _hitCounter = 0;
+ _onDispensor = false;
return true;
}
diff --git a/engines/titanic/game/lemon_dispensor.h b/engines/titanic/game/lemon_dispensor.h
index 933e0b6af0..bc58e0df0d 100644
--- a/engines/titanic/game/lemon_dispensor.h
+++ b/engines/titanic/game/lemon_dispensor.h
@@ -34,23 +34,18 @@ class CLemonDispensor : public CBackground {
bool LeaveViewMsg(CLeaveViewMsg *msg);
private:
static bool _isSummer;
- static int _v2;
- static int _v3;
+ static bool _lemonDropped;
+ static int _hitCounter;
static CGameObject *_draggingObject;
- int _fieldE0;
+ int _unused1;
Point _origPt;
- int _fieldEC;
+ bool _onDispensor;
public:
CLASSDEF;
CLemonDispensor();
/**
- * Initialize statics
- */
- static void init();
-
- /**
* Save the data for the class to file
*/
virtual void save(SimpleFile *file, int indent);
diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp
index 48feab5aa4..60d01dae35 100644
--- a/engines/titanic/titanic.cpp
+++ b/engines/titanic/titanic.cpp
@@ -33,7 +33,6 @@
#include "titanic/carry/hose.h"
#include "titanic/core/saveable_object.h"
#include "titanic/game/get_lift_eye2.h"
-#include "titanic/game/lemon_dispensor.h"
#include "titanic/game/television.h"
#include "titanic/game/parrot/parrot_lobby_object.h"
#include "titanic/game/sgt/sgt_navigation.h"
@@ -86,7 +85,6 @@ void TitanicEngine::initialize() {
CGameObject::init();
CGetLiftEye2::init();
CHose::init();
- CLemonDispensor::init();
CMovie::init();
CParrotLobbyObject::init();
CSGTNavigation::init();