mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-13 07:14:59 +00:00
BLADERUNNER: Fix unsorted args for getRandomNumberRng
Fix for bug #11034
This commit is contained in:
parent
70126b9685
commit
c8a23cc401
@ -976,7 +976,7 @@ void Actor::modifyFriendlinessToOther(int otherActorId, signed int change) {
|
||||
}
|
||||
|
||||
void Actor::setFriendlinessToOther(int otherActorId, int friendliness) {
|
||||
_friendlinessToOther[otherActorId] = friendliness;
|
||||
_friendlinessToOther[otherActorId] = CLIP(friendliness, 0, 100);
|
||||
}
|
||||
|
||||
bool Actor::checkFriendlinessAndHonesty(int otherActorId) {
|
||||
@ -995,19 +995,19 @@ bool Actor::checkFriendlinessAndHonesty(int otherActorId) {
|
||||
}
|
||||
|
||||
void Actor::setHonesty(int honesty) {
|
||||
_honesty = honesty;
|
||||
_honesty = CLIP(honesty, 0, 100);
|
||||
}
|
||||
|
||||
void Actor::setIntelligence(int intelligence) {
|
||||
_intelligence = intelligence;
|
||||
_intelligence = CLIP(intelligence, 0, 100);
|
||||
}
|
||||
|
||||
void Actor::setStability(int stability) {
|
||||
_stability = stability;
|
||||
_stability = CLIP(stability, 0, 100);
|
||||
}
|
||||
|
||||
void Actor::setCombatAggressiveness(int combatAggressiveness) {
|
||||
_combatAggressiveness = combatAggressiveness;
|
||||
_combatAggressiveness = CLIP(combatAggressiveness, 0, 100);
|
||||
}
|
||||
|
||||
void Actor::setInvisible(bool isInvisible) {
|
||||
@ -1064,15 +1064,18 @@ void Actor::setTarget(bool target) {
|
||||
}
|
||||
|
||||
void Actor::setCurrentHP(int hp) {
|
||||
_currentHP = hp;
|
||||
_currentHP = CLIP(hp, 0, 100);
|
||||
if (hp > 0) {
|
||||
retire(false, 0, 0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
void Actor::setHealth(int hp, int maxHp) {
|
||||
_currentHP = hp;
|
||||
_maxHP = maxHp;
|
||||
if (hp > maxHp) {
|
||||
hp = maxHp;
|
||||
}
|
||||
_currentHP = CLIP(hp, 0, 100);
|
||||
_maxHP = CLIP(maxHp, 0, 100);
|
||||
if (hp > 0) {
|
||||
retire(false, 0, 0, -1);
|
||||
}
|
||||
|
@ -65,6 +65,14 @@ static inline void sort(int &a, int &b) {
|
||||
}
|
||||
}
|
||||
|
||||
static inline void sort(uint &a, uint &b) {
|
||||
if (a > b) {
|
||||
uint t = a;
|
||||
a = b;
|
||||
b = t;
|
||||
}
|
||||
}
|
||||
|
||||
void AmbientSounds::addSound(
|
||||
int sfxId,
|
||||
uint32 timeMin, uint32 timeMax,
|
||||
@ -73,6 +81,10 @@ void AmbientSounds::addSound(
|
||||
int panEndMin, int panEndMax,
|
||||
int priority, int unk) {
|
||||
|
||||
#if BLADERUNNER_ORIGINAL_BUGS
|
||||
#else
|
||||
sort(timeMin, timeMax);
|
||||
#endif // BLADERUNNER_ORIGINAL_BUGS
|
||||
sort(volumeMin, volumeMax);
|
||||
sort(panStartMin, panStartMax);
|
||||
sort(panEndMin, panEndMax);
|
||||
@ -102,6 +114,10 @@ void AmbientSounds::removeAllNonLoopingSounds(bool stopPlaying) {
|
||||
}
|
||||
|
||||
void AmbientSounds::addSpeech(int actorId, int sentenceId, uint32 timeMin, uint32 timeMax, int volumeMin, int volumeMax, int panStartMin, int panStartMax, int panEndMin, int panEndMax, int priority, int unk) {
|
||||
#if BLADERUNNER_ORIGINAL_BUGS
|
||||
#else
|
||||
sort(timeMin, timeMax);
|
||||
#endif // BLADERUNNER_ORIGINAL_BUGS
|
||||
sort(volumeMin, volumeMax);
|
||||
sort(panStartMin, panStartMax);
|
||||
sort(panEndMin, panEndMax);
|
||||
@ -315,6 +331,14 @@ void AmbientSounds::addSoundByName(
|
||||
|
||||
uint32 now = _vm->_time->current();
|
||||
|
||||
#if BLADERUNNER_ORIGINAL_BUGS
|
||||
#else
|
||||
sort(timeMin, timeMax);
|
||||
sort(volumeMin, volumeMax);
|
||||
sort(panStartMin, panStartMax);
|
||||
sort(panEndMin, panEndMax);
|
||||
#endif // BLADERUNNER_ORIGINAL_BUGS
|
||||
|
||||
track.isActive = true;
|
||||
track.name = name;
|
||||
track.hash = MIXArchive::getHash(name);
|
||||
@ -416,6 +440,10 @@ void AmbientSounds::load(SaveFileReadStream &f) {
|
||||
track.timeMax = (uint32)f.readInt();
|
||||
f.skip(4); // track.nextPlayTime is not used after load
|
||||
track.nextPlayTimeStart = now;
|
||||
#if BLADERUNNER_ORIGINAL_BUGS
|
||||
#else
|
||||
sort(track.timeMin, track.timeMax);
|
||||
#endif // BLADERUNNER_ORIGINAL_BUGS
|
||||
track.nextPlayTimeDiff = _vm->_rnd.getRandomNumberRng(track.timeMin, track.timeMax);
|
||||
track.volumeMin = f.readInt();
|
||||
track.volumeMax = f.readInt();
|
||||
@ -424,6 +452,12 @@ void AmbientSounds::load(SaveFileReadStream &f) {
|
||||
track.panStartMax = f.readInt();
|
||||
track.panEndMin = f.readInt();
|
||||
track.panEndMax = f.readInt();
|
||||
#if BLADERUNNER_ORIGINAL_BUGS
|
||||
#else
|
||||
sort(track.volumeMin, track.volumeMax);
|
||||
sort(track.panStartMin, track.panStartMax);
|
||||
sort(track.panEndMin, track.panEndMax);
|
||||
#endif // BLADERUNNER_ORIGINAL_BUGS
|
||||
track.priority = f.readInt();
|
||||
f.skip(4); // field_45
|
||||
}
|
||||
|
@ -263,6 +263,7 @@ void KIASectionPogo::draw(Graphics::Surface &surface) {
|
||||
_vm->_mainFont->drawString(&surface, title, 313 - _vm->_mainFont->getStringWidth(title) / 2, 143, surface.w, surface.format.RGBToColor(240, 232, 192));
|
||||
|
||||
int y = 158;
|
||||
int lineTextWidth;
|
||||
for (int i = 0; i < kLineCount; ++i) {
|
||||
if (updateTimeout) {
|
||||
if (_lineTimeouts[i] > 0) {
|
||||
@ -270,7 +271,8 @@ void KIASectionPogo::draw(Graphics::Surface &surface) {
|
||||
} else {
|
||||
_lineTexts[i] = _strings[_stringIndex];
|
||||
_lineTimeouts[i] = 63;
|
||||
_lineOffsets[i] = _vm->_rnd.getRandomNumberRng(0, 306 - _vm->_mainFont->getStringWidth(_lineTexts[i])) + 155;
|
||||
lineTextWidth = _vm->_mainFont->getStringWidth(_lineTexts[i]);
|
||||
_lineOffsets[i] = _vm->_rnd.getRandomNumberRng(0, (306 - lineTextWidth) > 0 ? (306 - lineTextWidth) : 0) + 155;
|
||||
|
||||
_stringIndex = (_stringIndex + 1) % kStringCount;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user