diff options
author | Eugene Sandulenko | 2010-10-18 19:17:38 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-10-18 19:17:38 +0000 |
commit | 86d650926f9b991b6398e4ad4b0613ac264dfbaa (patch) | |
tree | 5e6791249fa5fce7dd3e1a6406dff4bf720ca085 /engines/lastexpress/game/state.cpp | |
parent | c92d2bc234f2f73a9629b3622cd5e66c57439cda (diff) | |
download | scummvm-rg350-86d650926f9b991b6398e4ad4b0613ac264dfbaa.tar.gz scummvm-rg350-86d650926f9b991b6398e4ad4b0613ac264dfbaa.tar.bz2 scummvm-rg350-86d650926f9b991b6398e4ad4b0613ac264dfbaa.zip |
LASTEXPRESS: Merge in the engine.
svn-id: r53579
Diffstat (limited to 'engines/lastexpress/game/state.cpp')
-rw-r--r-- | engines/lastexpress/game/state.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/engines/lastexpress/game/state.cpp b/engines/lastexpress/game/state.cpp new file mode 100644 index 0000000000..8675f6e312 --- /dev/null +++ b/engines/lastexpress/game/state.cpp @@ -0,0 +1,74 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#include "lastexpress/game/state.h" + +#include "lastexpress/game/inventory.h" +#include "lastexpress/game/object.h" +#include "lastexpress/game/savepoint.h" + +#include "lastexpress/lastexpress.h" + +namespace LastExpress { + +State::State(LastExpressEngine *engine) : _engine(engine), _timer(0) { + _inventory = new Inventory(engine); + _objects = new Objects(engine); + _savepoints = new SavePoints(engine); + _state = new GameState(); + _flags = new Flags(); +} + +State::~State() { + delete _inventory; + delete _objects; + delete _savepoints; + delete _state; + delete _flags; + + // Zero passed pointers + _engine = NULL; +} + +bool State::isNightTime() const { + return (_state->progress.chapter == kChapter1 + || _state->progress.chapter == kChapter4 + || (_state->progress.chapter == kChapter5 && !_state->progress.isNightTime)); +} + +uint32 State::getPowerOfTwo(uint32 x) { + if (!x || (x & 1)) + return 0; + + uint32 num = 0; + do { + x >>= 1; + num++; + } while ((x & 1) == 0); + + return num; +} + +} // End of namespace LastExpress |