Skip to content
Permalink
Browse files

BLADERUNNER: added Runciter character (petshop owner)

  • Loading branch information
peterkohaut committed Mar 20, 2017
1 parent ccc6cbf commit dd7498544f60ecf32d89c19b95eee105fbfb79ab
@@ -530,16 +530,16 @@ void Actor::setSetId(int setId) {
if (_setId > 0) {
for (i = 0; i < (int)_vm->_gameInfo->getActorCount(); i++) {
if (_vm->_actors[i]->_id != _id && _vm->_actors[i]->_setId == _setId) {
// TODO: _vm->_aiScripts->OtherAgentExitedThisScene( i, _id);
_vm->_aiScripts->OtherAgentExitedThisScene(i, _id);
}
}
}
_setId = setId;
// TODO: _vm->_aiScripts->EnteredScene(_id, set);
_vm->_aiScripts->EnteredScene(_id, _setId);
if (_setId > 0) {
for (i = 0; i < (int)_vm->_gameInfo->getActorCount(); i++) {
if (_vm->_actors[i]->_id != _id && _vm->_actors[i]->_setId == _setId) {
// TODO: _vm->_aiScripts->OtherAgentEnteredThisScene(i, _id);
_vm->_aiScripts->OtherAgentEnteredThisScene(i, _id);
}
}
}
@@ -851,11 +851,11 @@ int Actor::getAnimationMode() {
}

void Actor::setGoal(int goalNumber) {
if (goalNumber == _goalNumber)
if (goalNumber == _goalNumber) {
return;
}

//TODO: _vm->actorScript->GoalChanged(_id, _goalNumber, goalNumber);

_vm->_aiScripts->GoalChanged(_id, _goalNumber, goalNumber);
_vm->_script->ActorChangedGoal(_id, goalNumber, _goalNumber, _vm->_scene->getSetId() == _setId);
}

@@ -943,6 +943,12 @@ int Actor::countdownTimerGetRemainingTime(int timerId) {
return _timersRemain[timerId];
}

void Actor::countdownTimersUpdate() {
for (int i = 0; i <= 6; i++) {
countdownTimerUpdate(i);
}
}

void Actor::countdownTimerUpdate(int timerId) {
if (_timersRemain[timerId] == 0)
return;
@@ -959,7 +965,14 @@ void Actor::countdownTimerUpdate(int timerId) {
case 0:
case 1:
case 2:
// AI timers, call AI dll
if (!_vm->_aiScripts->IsInsideScript() && !_vm->_script->IsInsideScript()) {
_vm->_aiScripts->TimerExpired(this->_id, timerId);
this->_timersRemain[timerId] = 0;
//return false;
} else {
this->_timersRemain[timerId] = 1;
//return true;
}
break;
case 3:
// Movement track timer
@@ -136,6 +136,7 @@ class Actor {
void countdownTimerStart(int timerId, int interval);
void countdownTimerReset(int timerId);
int countdownTimerGetRemainingTime(int timerId);
void countdownTimersUpdate();
void countdownTimerUpdate(int timerId);

int getSetId();
@@ -60,7 +60,7 @@
#include "engines/util.h"

#include "graphics/pixelformat.h"
#include "suspects_database.h"
#include "suspects_database.h"

namespace BladeRunner {

@@ -337,7 +337,7 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
initScript.SCRIPT_Initialize_Game();

// TODO: Load AI-ACT1.DLL
_aiScripts = new AIScripts(this);
_aiScripts = new AIScripts(this, actorCount);

initChapterAndScene();

@@ -619,17 +619,20 @@ void BladeRunnerEngine::gameTick() {
#endif

// TODO: Render overlays
// TODO: Tick Actor AI and Timers

if (_settings->getNewScene() == -1 || _script->_inScriptCounter /* || in_ai */) {
//if (!dialogueMenu)
actorsUpdate();

if (_settings->getNewScene() == -1 || _script->IsInsideScript() || _aiScripts->IsInsideScript()) {
_sliceRenderer->setView(*_view);

// Tick and draw all actors in current set
//int setId = _scene->_setId;
int setId = _scene->getSetId();
for (int i = 0, end = _gameInfo->getActorCount(); i != end; ++i) {
//if (_actors[i]->getSetId() == setId) {
if (i == 0 || i == 23) { // Currently limited to McCoy and Officer Leroy
_actors[i]->tick(backgroundChanged);
if (_actors[i]->getSetId() == setId) {
if (i == 0 || i == 15 || i == 23) { // Currently limited to McCoy, Runciter and Officer Leroy
_actors[i]->tick(backgroundChanged);
}
}
}

@@ -724,16 +727,30 @@ void BladeRunnerEngine::gameTick() {

}

for (int i = 0; i < (int)_lights->_lights.size(); i++) {
Light *light = _lights->_lights[i];
Matrix4x3 m = light->_matrix;
Vector3 pos = Vector3(m(0, 3), m(1, 3), m(2, 3));
// for (int i = 0; i < (int)_lights->_lights.size(); i++) {
// Light *light = _lights->_lights[i];
// Matrix4x3 m = light->_matrix;
// Vector3 pos = Vector3(m(0, 3), m(1, 3), m(2, 3));
// Vector3 size = Vector3(5.0f, 5.0f, 5.0f);
// int colorR = (light->_color.r * 31.0f);
// int colorG = (light->_color.g * 31.0f);
// int colorB = (light->_color.b * 31.0f);
// int color = (colorR << 10) + (colorG << 5) + colorB;
// drawBBox(pos - size, pos + size, _view, &_surface2, color);
// }

for(int i = 0; i < _waypoints->_count; i++) {
Waypoint *waypoint = &_waypoints->_waypoints[i];
if(waypoint->_setId != _scene->getSetId())
continue;
Vector3 pos = waypoint->_position;
Vector3 size = Vector3(5.0f, 5.0f, 5.0f);
int colorR = (light->_color.r * 31.0f);
int colorG = (light->_color.g * 31.0f);
int colorB = (light->_color.b * 31.0f);
int color = (colorR << 10) + (colorG << 5) + colorB;
int color = 0b111111111111111;
drawBBox(pos - size, pos + size, _view, &_surface2, color);
Vector3 spos = _view->calculateScreenPosition(pos);
char waypointText[40];
sprintf(waypointText, "waypoint %i", i);
_mainFont->drawColor(waypointText, _surface2, spos.x, spos.y, color);

}
#endif
@@ -745,6 +762,22 @@ void BladeRunnerEngine::gameTick() {
}
}

void BladeRunnerEngine::actorsUpdate() {
int actorCount = (int)_gameInfo->getActorCount();
int setId = _scene->getSetId();

//TODO: original game updates every non-visible characters by updating only one character in one frame
if (setId != 89 || _gameVars[1] != 4 || _gameFlags->query(670) != 1 || !_aiScripts->IsInsideScript()) {
for (int i = 0; i < actorCount; i++) {
Actor *actor = _actors[i];
if (actor->getSetId() == setId) {
_aiScripts->Update(i);
actor->countdownTimersUpdate();
}
}
}
}

void BladeRunnerEngine::handleEvents() {
if (shouldQuit()) {
_gameIsRunning = false;
@@ -155,6 +155,7 @@ class BladeRunnerEngine : public Engine {

void gameLoop();
void gameTick();
void actorsUpdate();
void handleEvents();
void handleMouseClick(int x, int y);
void handleMouseClickExit(int x, int y, int exitIndex);
@@ -39,6 +39,7 @@ MODULE_OBJS = \
scene.o \
scene_objects.o \
script/ai_00_mccoy.o \
script/ai_15_runciter.o \
script/ai_23_officer_leroy.o \
script/init.o \
script/kia.o \
@@ -211,13 +211,13 @@ void AIScript_McCoy::ClickedByPlayer() {
void AIScript_McCoy::EnteredScene(int sceneId) {
}

void AIScript_McCoy::OtherAgentEnteredThisScene() {
void AIScript_McCoy::OtherAgentEnteredThisScene(int otherActorId) {
}

void AIScript_McCoy::OtherAgentExitedThisScene() {
void AIScript_McCoy::OtherAgentExitedThisScene(int otherActorId) {
}

void AIScript_McCoy::OtherAgentEnteredCombatMode() {
void AIScript_McCoy::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) {
}

void AIScript_McCoy::ShotAtAndMissed() {
@@ -54,9 +54,9 @@ class AIScript_McCoy : public AIScriptBase {
void ReceivedClue(int clueId, int fromActorId);
void ClickedByPlayer();
void EnteredScene(int sceneId);
void OtherAgentEnteredThisScene();
void OtherAgentExitedThisScene();
void OtherAgentEnteredCombatMode();
void OtherAgentEnteredThisScene(int otherActorId);
void OtherAgentExitedThisScene(int otherActorId);
void OtherAgentEnteredCombatMode(int otherActorId, int combatMode);
void ShotAtAndMissed();
void ShotAtAndHit();
void Retired(int byActorId);

0 comments on commit dd74985

Please sign in to comment.
You can’t perform that action at this time.