aboutsummaryrefslogtreecommitdiff
path: root/engines/lure
diff options
context:
space:
mode:
authorEugene Sandulenko2007-09-19 13:55:05 +0000
committerEugene Sandulenko2007-09-19 13:55:05 +0000
commit77eea722afe175003baba3ed5341bfbf8cf988f6 (patch)
treeff95cd001b8929308468d69466623f0c28be476b /engines/lure
parent2254028365cf5f162bd41cf0011b4475ec608f4c (diff)
downloadscummvm-rg350-77eea722afe175003baba3ed5341bfbf8cf988f6.tar.gz
scummvm-rg350-77eea722afe175003baba3ed5341bfbf8cf988f6.tar.bz2
scummvm-rg350-77eea722afe175003baba3ed5341bfbf8cf988f6.zip
Modified patch #1738058: "Action recorder".
svn-id: r28968
Diffstat (limited to 'engines/lure')
-rw-r--r--engines/lure/hotspots.cpp10
-rw-r--r--engines/lure/res.cpp2
-rw-r--r--engines/lure/scripts.cpp1
3 files changed, 13 insertions, 0 deletions
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index 93860bbd3e..f3235dd3d9 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -588,6 +588,8 @@ void Hotspot::setRandomDest() {
Common::RandomSource rnd;
int16 xp, yp;
+ g_system->getEventManager()->registerRandomSource(rnd, "lureHotspots");
+
if (_currentActions.isEmpty())
_currentActions.addFront(START_WALKING, roomNumber());
else
@@ -2925,6 +2927,8 @@ void HotspotTickHandlers::followerAnimHandler(Hotspot &h) {
Common::RandomSource rnd;
RandomActionType actionType;
uint16 scheduleId;
+ g_system->getEventManager()->registerRandomSource(rnd, "lureHotspots");
+
int actionIndex = rnd.getRandomNumber(set->numActions() - 1);
set->getEntry(actionIndex, actionType, scheduleId);
@@ -3113,6 +3117,8 @@ void HotspotTickHandlers::prisonerAnimHandler(Hotspot &h) {
ValueTableData &fields = Resources::getReference().fieldList();
Common::RandomSource rnd;
+ g_system->getEventManager()->registerRandomSource(rnd, "lureHotspots");
+
h.handleTalkDialog();
if (h.frameCtr() > 0) {
h.setFrameCtr(h.frameCtr() - 1);
@@ -3153,6 +3159,8 @@ void HotspotTickHandlers::morkusAnimHandler(Hotspot &h) {
if (h.executeScript()) {
// Script is done - set new script to one of two alternates randomly
Common::RandomSource rnd;
+ g_system->getEventManager()->registerRandomSource(rnd, "lureHotspots");
+
h.setHotspotScript(rnd.getRandomNumber(100) >= 50 ? 0x54 : 0);
h.setFrameCtr(20 + rnd.getRandomNumber(63));
}
@@ -3417,6 +3425,8 @@ void HotspotTickHandlers::barmanAnimHandler(Hotspot &h) {
Common::RandomSource rnd;
static bool ewanXOffset = false;
+ g_system->getEventManager()->registerRandomSource(rnd, "lureHotspots");
+
h.handleTalkDialog();
if (h.delayCtr() > 0) {
h.setDelayCtr(h.delayCtr() - 1);
diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp
index b0e99b5be5..983afb7357 100644
--- a/engines/lure/res.cpp
+++ b/engines/lure/res.cpp
@@ -28,6 +28,7 @@
#include "lure/scripts.h"
#include "lure/screen.h"
#include "common/endian.h"
+#include "common/events.h"
namespace Lure {
@@ -40,6 +41,7 @@ Resources &Resources::getReference() {
}
Resources::Resources() {
+ g_system->getEventManager()->registerRandomSource(_rnd, "lureResources");
int_resources = this;
reloadData();
diff --git a/engines/lure/scripts.cpp b/engines/lure/scripts.cpp
index bba364bcf2..da1977f00e 100644
--- a/engines/lure/scripts.cpp
+++ b/engines/lure/scripts.cpp
@@ -704,6 +704,7 @@ void Script::addActions(uint16 hotspotId, uint16 actions, uint16 v3) {
void Script::randomToGeneral(uint16 maxVal, uint16 minVal, uint16 v3) {
Common::RandomSource rnd;
+ g_system->getEventManager()->registerRandomSource(rnd, "lureScripts");
uint16 v = minVal + rnd.getRandomNumber(maxVal - minVal);
Resources::getReference().fieldList().setField(GENERAL, v);
}