aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/actor.cpp
diff options
context:
space:
mode:
authorThanasis Antoniou2019-07-22 01:08:23 +0300
committerThanasis Antoniou2019-07-22 01:09:23 +0300
commitaf9ec2f69139d74a697b6e534d31c8f31e1ce587 (patch)
treec521d71c82aa8a4a7adc3ef05225a11da9c4edb1 /engines/bladerunner/actor.cpp
parent4e16711e478d416846502164864faa31bc59fa7b (diff)
downloadscummvm-rg350-af9ec2f69139d74a697b6e534d31c8f31e1ce587.tar.gz
scummvm-rg350-af9ec2f69139d74a697b6e534d31c8f31e1ce587.tar.bz2
scummvm-rg350-af9ec2f69139d74a697b6e534d31c8f31e1ce587.zip
BLADERUNNER: Revert uint32 vars to int32 if they could be init to -1
Diffstat (limited to 'engines/bladerunner/actor.cpp')
-rw-r--r--engines/bladerunner/actor.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp
index df78b00593..e52cebf2b7 100644
--- a/engines/bladerunner/actor.cpp
+++ b/engines/bladerunner/actor.cpp
@@ -100,7 +100,7 @@ void Actor::setup(int actorId) {
_timer4RemainDefault = 60000u;
_movementTrackWalkingToWaypointId = -1;
- _movementTrackDelayOnNextWaypoint = (uint32)(-1); // original was -1, int
+ _movementTrackDelayOnNextWaypoint = -1;
for (int i = 0; i != kActorTimers; ++i) {
_timersLeft[i] = 0u;
@@ -122,7 +122,7 @@ void Actor::setup(int actorId) {
_movementTrackPaused = false;
_movementTrackNextWaypointId = -1;
- _movementTrackNextDelay = (uint32)(-1); // original was -1, int
+ _movementTrackNextDelay = -1;
_movementTrackNextAngle = -1;
_movementTrackNextRunning = false;
@@ -220,12 +220,12 @@ void Actor::increaseFPS() {
setFPS(fps);
}
-void Actor::timerStart(int timerId, uint32 interval) {
+void Actor::timerStart(int timerId, int32 interval) {
assert(timerId >= 0 && timerId < kActorTimers);
- if ((int32)interval == -1 ) {
- interval = 0u;
+ if (interval < 0 ) {
+ interval = 0;
}
- _timersLeft[timerId] = interval;
+ _timersLeft[timerId] = (uint32)interval;
_timersLast[timerId] = _vm->_time->current();
}
@@ -310,7 +310,7 @@ void Actor::movementTrackNext(bool omitAiScript) {
bool hasNextMovement;
bool running;
int angle;
- uint32 delay;
+ int32 delay;
int waypointId;
Vector3 waypointPosition;
bool arrived;
@@ -340,9 +340,9 @@ void Actor::movementTrackNext(bool omitAiScript) {
setAtXYZ(waypointPosition, angle, true, false, false);
if (!delay) {
- delay = 1u;
+ delay = 1;
}
- if ((int32)delay != -1 && delay > 1u) {
+ if (delay > 1) {
changeAnimationMode(kAnimationModeIdle, false);
}
timerStart(kActorTimerMovementTrack, delay);
@@ -380,13 +380,13 @@ void Actor::movementTrackUnpause() {
void Actor::movementTrackWaypointReached() {
if (!_movementTrack->isPaused() && _id != kActorMcCoy) {
- if (_movementTrackWalkingToWaypointId >= 0 && (int32)(_movementTrackDelayOnNextWaypoint) != -1) { // original was _movementTrackDelayOnNextWaypoint >= 0u
+ if (_movementTrackWalkingToWaypointId >= 0 && _movementTrackDelayOnNextWaypoint >= 0) {
if (!_movementTrackDelayOnNextWaypoint) {
- _movementTrackDelayOnNextWaypoint = 1u;
+ _movementTrackDelayOnNextWaypoint = 1;
}
if (_vm->_aiScripts->reachedMovementTrackWaypoint(_id, _movementTrackWalkingToWaypointId)) {
- uint32 delay = _movementTrackDelayOnNextWaypoint;
- if (delay > 1u) {
+ int32 delay = _movementTrackDelayOnNextWaypoint;
+ if (delay > 1) {
changeAnimationMode(kAnimationModeIdle, false);
delay = _movementTrackDelayOnNextWaypoint; // todo: analyze if movement is changed in some aiscript->ChangeAnimationMode?
}
@@ -394,7 +394,7 @@ void Actor::movementTrackWaypointReached() {
}
}
_movementTrackWalkingToWaypointId = -1;
- _movementTrackDelayOnNextWaypoint = 0u;
+ _movementTrackDelayOnNextWaypoint = 0;
}
}
@@ -734,7 +734,7 @@ bool Actor::tick(bool forceDraw, Common::Rect *screenRect) {
if (nextFrameTime <= 0) {
nextFrameTime = 1;
}
- timerStart(kActorTimerAnimationFrame, (uint32)nextFrameTime);
+ timerStart(kActorTimerAnimationFrame, nextFrameTime);
}
if (_targetFacing >= 0) {
if (_targetFacing == _facing) {
@@ -1454,7 +1454,7 @@ void Actor::load(SaveFileReadStream &f) {
_position = f.readVector3();
_facing = f.readInt();
_targetFacing = f.readInt();
- _timer4RemainDefault = (uint32)f.readInt();
+ _timer4RemainDefault = f.readUint32LE();
_honesty = f.readInt();
_intelligence = f.readInt();
@@ -1468,7 +1468,7 @@ void Actor::load(SaveFileReadStream &f) {
_movementTrackPaused = f.readBool();
_movementTrackNextWaypointId = f.readInt();
- _movementTrackNextDelay = (uint32)f.readInt();
+ _movementTrackNextDelay = f.readInt();
_movementTrackNextAngle = f.readInt();
_movementTrackNextRunning = f.readBool();
@@ -1488,7 +1488,7 @@ void Actor::load(SaveFileReadStream &f) {
_animationFrame = f.readInt();
_movementTrackWalkingToWaypointId = f.readInt();
- _movementTrackDelayOnNextWaypoint = (uint32)f.readInt();
+ _movementTrackDelayOnNextWaypoint = f.readInt();
_screenRectangle = f.readRect();
_retiredWidth = f.readInt();
@@ -1499,7 +1499,7 @@ void Actor::load(SaveFileReadStream &f) {
_scale = f.readFloat();
for (int i = 0; i < kActorTimers; ++i) {
- _timersLeft[i] = (uint32)f.readInt();
+ _timersLeft[i] = f.readUint32LE();
}
// Bugfix: Special initialization case for timer 4 (kActorTimerClueExchange) when its value is restored as 0
// This should be harmless, but will remedy any broken save-games where the timer 4 was saved as 0.
@@ -1509,7 +1509,7 @@ void Actor::load(SaveFileReadStream &f) {
uint32 now = _vm->_time->getPauseStart();
for (int i = 0; i < kActorTimers; ++i) {
- _timersLast[i] = now - (uint32)(f.readInt()); // we require an unsigned difference here, since _timersLast is essentially keeping time
+ _timersLast[i] = now - f.readUint32LE(); // we require an unsigned difference here, since _timersLast is essentially keeping time
}
int actorCount = _vm->_gameInfo->getActorCount();