Skip to content

Commit

Permalink
BLADERUNNER: Init globals, game flags, and actor clues
Browse files Browse the repository at this point in the history
  • Loading branch information
madmoose authored and sev- committed Sep 29, 2016
1 parent b83daef commit 2d8f421
Show file tree
Hide file tree
Showing 13 changed files with 1,543 additions and 12 deletions.
9 changes: 9 additions & 0 deletions engines/bladerunner/bladerunner.cpp
Expand Up @@ -26,6 +26,7 @@
#include "bladerunner/ambient_sounds.h"
#include "bladerunner/audio_player.h"
#include "bladerunner/chapters.h"
#include "bladerunner/clues.h"
#include "bladerunner/gameinfo.h"
#include "bladerunner/gameflags.h"
#include "bladerunner/image.h"
Expand All @@ -36,6 +37,7 @@
#include "bladerunner/settings.h"
#include "bladerunner/slice_animations.h"
#include "bladerunner/slice_renderer.h"
#include "bladerunner/text_resource.h"
#include "bladerunner/vqa_decoder.h"

#include "common/error.h"
Expand All @@ -58,6 +60,7 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst)
_ambientSounds = new AmbientSounds(this);
_audioPlayer = new AudioPlayer(this);
_chapters = nullptr;
_clues = nullptr;
_gameInfo = nullptr;
_gameFlags = new GameFlags();
_gameVars = nullptr;
Expand All @@ -77,6 +80,7 @@ BladeRunnerEngine::~BladeRunnerEngine() {
delete _gameVars;
delete _gameFlags;
delete _gameInfo;
delete _clues;
delete _chapters;
delete _audioPlayer;
delete _ambientSounds;
Expand Down Expand Up @@ -164,6 +168,11 @@ bool BladeRunnerEngine::startup() {
_zBuffer1 = new uint16[640 * 480];
_zBuffer2 = new uint16[640 * 480];

_actorNames = new TextResource(this);
_actorNames->open("ACTORS");

_clues = new Clues(this, "CLUES", _gameInfo->getClueCount());

ScriptInit initScript(this);
initScript.SCRIPT_Initialize_Game();

Expand Down
5 changes: 5 additions & 0 deletions engines/bladerunner/bladerunner.h
Expand Up @@ -39,13 +39,15 @@ namespace BladeRunner {
class AmbientSounds;
class AudioPlayer;
class Chapters;
class Clues;
class GameInfo;
class GameFlags;
class Scene;
class Script;
class Settings;
class SliceAnimations;
class SliceRenderer;
class TextResource;

class BladeRunnerEngine : public Engine {
public:
Expand All @@ -55,6 +57,7 @@ class BladeRunnerEngine : public Engine {
AmbientSounds *_ambientSounds;
AudioPlayer *_audioPlayer;
Chapters *_chapters;
Clues *_clues;
GameInfo *_gameInfo;
GameFlags *_gameFlags;
Scene *_scene;
Expand All @@ -64,6 +67,8 @@ class BladeRunnerEngine : public Engine {
SliceRenderer *_sliceRenderer;
int *_gameVars;

TextResource *_actorNames;

int in_script_counter;

Graphics::Surface _surface1;
Expand Down
56 changes: 56 additions & 0 deletions engines/bladerunner/clues.cpp
@@ -0,0 +1,56 @@
/* 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.
*
*/

#include "bladerunner/clues.h"

#include "bladerunner/bladerunner.h"
#include "bladerunner/text_resource.h"

namespace BladeRunner {

Clues::Clues(BladeRunnerEngine *vm, const char *cluesResource, uint32 clueCount)
: _clueCount(clueCount)
{
// reset();

_crimes = new int[_clueCount];
_assetTypes = new int[_clueCount];

_cluesText = new TextResource(vm);
_cluesText->open(cluesResource);

for (uint32 i = 0; i != _clueCount; ++i) {
_crimes[i] = -1;
_assetTypes[i] = -1;
}
}

Clues::~Clues() {
delete[] _assetTypes;
delete[] _crimes;
}

const char *Clues::getClueText(int id) {
return _cluesText->getText(id);
}

} // End of namespace BladeRunner
48 changes: 48 additions & 0 deletions engines/bladerunner/clues.h
@@ -0,0 +1,48 @@
/* 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 BLADERUNNER_CLUES_H
#define BLADERUNNER_CLUES_H

#include "common/scummsys.h"

namespace BladeRunner {

class BladeRunnerEngine;
class TextResource;

class Clues {
uint32 _clueCount;
int *_crimes;
int *_assetTypes;
TextResource *_cluesText;

public:
Clues(BladeRunnerEngine *vm, const char *cluesResource, uint32 clueCount);
~Clues();

const char *getClueText(int id);
};

} // End of namespace BladeRunner

#endif
2 changes: 1 addition & 1 deletion engines/bladerunner/gameinfo.cpp
Expand Up @@ -55,7 +55,7 @@ bool GameInfo::open(const Common::String &name) {
_actor_count = s->readUint32LE(); /* 00 */
_player_id = s->readUint32LE(); /* 01 */
_flag_count = s->readUint32LE(); /* 02 */
unk = s->readUint32LE(); /* 03 */
_clue_count = s->readUint32LE(); /* 03 */
_global_var_count = s->readUint32LE(); /* 04 */
_set_names_count = s->readUint32LE(); /* 05 */
_initial_scene_id = s->readUint32LE(); /* 06 */
Expand Down
2 changes: 2 additions & 0 deletions engines/bladerunner/gameinfo.h
Expand Up @@ -37,6 +37,7 @@ class GameInfo {
uint32 _actor_count;
uint32 _player_id;
uint32 _flag_count;
uint32 _clue_count;
uint32 _global_var_count;
uint32 _set_names_count;
uint32 _initial_scene_id;
Expand All @@ -62,6 +63,7 @@ class GameInfo {
uint32 getActorCount() { return _actor_count; }
uint32 getPlayerId() { return _player_id; }
uint32 getFlagCount() { return _flag_count; }
uint32 getClueCount() { return _clue_count; }
uint32 getGlobalVarCount() { return _global_var_count; }
uint32 getSetNamesCount() { return _set_names_count; }
uint32 getInitialSceneId() { return _initial_scene_id; }
Expand Down
2 changes: 2 additions & 0 deletions engines/bladerunner/module.mk
Expand Up @@ -8,6 +8,7 @@ MODULE_OBJS = \
bladerunner.o \
boundingbox.o \
chapters.o \
clues.o \
decompress_lcw.o \
decompress_lzo.o \
detection.o \
Expand All @@ -24,6 +25,7 @@ MODULE_OBJS = \
settings.o \
slice_animations.o \
slice_renderer.o \
text_resource.o \
view.o \
vqa_decoder.o \
vqa_player.o
Expand Down

0 comments on commit 2d8f421

Please sign in to comment.