aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/dm/TODOs/todo.txt3
-rw-r--r--engines/dm/champion.cpp10
-rw-r--r--engines/dm/dm.h2
-rw-r--r--engines/dm/gfx.cpp10
4 files changed, 12 insertions, 13 deletions
diff --git a/engines/dm/TODOs/todo.txt b/engines/dm/TODOs/todo.txt
index b2bac2aa71..65e7251161 100644
--- a/engines/dm/TODOs/todo.txt
+++ b/engines/dm/TODOs/todo.txt
@@ -8,9 +8,8 @@ Bugs:
Logic:
When object are put on the right side of the current square, they disappear
- Drawing door ornaments segfaults when going back to the start
Object display is a bit mixed up with regards to which cell is it drawn in
- Method cthulu messes up the callstack
+
Possible bugs:
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index 4b9809dc21..a7d27d1011 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -207,8 +207,8 @@ bool ChampionMan::f328_isObjectThrown(uint16 champIndex, int16 slotIndex, int16
f304_addSkillExperience(champIndex, k10_ChampionSkillThrow, experience);
kineticEnergy += weaponKineticEnergy;
int16 skillLevel = f303_getSkillLevel((ChampionIndex)champIndex, k10_ChampionSkillThrow);
- kineticEnergy += _vm->_rnd->getRandomNumber(16) + (kineticEnergy >> 1) + skillLevel;
- int16 attack = f26_getBoundedValue((uint16)40, (uint16)((skillLevel << 3) + _vm->_rnd->getRandomNumber(31)), (uint16)200);
+ kineticEnergy += _vm->getRandomNumber(16) + (kineticEnergy >> 1) + skillLevel;
+ int16 attack = f26_getBoundedValue((uint16)40, (uint16)((skillLevel << 3) + _vm->getRandomNumber(32)), (uint16)200);
int16 stepEnergy = MAX(5, 11 - skillLevel);
_vm->_projexpl->f212_projectileCreate(curThing, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY,
M21_normalizeModulo4(_vm->_dungeonMan->_g308_partyDir + side),
@@ -595,7 +595,7 @@ Thing ChampionMan::f298_getObjectRemovedFromLeaderHand() {
uint16 ChampionMan::f312_getStrength(int16 champIndex, int16 slotIndex) {
Champion *curChampion = &_gK71_champions[champIndex];
- int16 strength = _vm->_rnd->getRandomNumber(15) + curChampion->_statistics[k1_ChampionStatStrength][k1_ChampionStatCurrent];
+ int16 strength = _vm->getRandomNumber(16) + curChampion->_statistics[k1_ChampionStatStrength][k1_ChampionStatCurrent];
Thing curThing = curChampion->_slots[slotIndex];
uint16 objectWeight = _vm->_dungeonMan->f140_getObjectWeight(curThing);
uint16 oneSixteenthMaximumLoad = f309_getMaximumLoad(curChampion) >> 4;
@@ -791,7 +791,7 @@ int16 ChampionMan::f321_addPendingDamageAndWounds_getDamage(int16 champIndex, in
if (attack <= 0)
return 0;
- int16 adjustedAttack = f307_getStatisticAdjustedAttack(curChampion, k4_ChampionStatVitality, _vm->_rnd->getRandomNumber(127) + 10);
+ int16 adjustedAttack = f307_getStatisticAdjustedAttack(curChampion, k4_ChampionStatVitality, _vm->getRandomNumber(128) + 10);
if (attack > adjustedAttack) {
/* BUG0_45
This bug is not perceptible because of BUG0_41 that ignores Vitality while determining the
@@ -801,7 +801,7 @@ int16 ChampionMan::f321_addPendingDamageAndWounds_getDamage(int16 champIndex, in
wounded (because of more iterations in the loop below)
*/
do {
- setFlag(*(uint16 *)&_g410_championPendingWounds[champIndex], (1 << _vm->_rnd->getRandomNumber(7)) & allowedWounds);
+ setFlag(*(uint16 *)&_g410_championPendingWounds[champIndex], (1 << _vm->getRandomNumber(8)) & allowedWounds);
} while ((attack > (adjustedAttack <<= 1)) && adjustedAttack);
}
diff --git a/engines/dm/dm.h b/engines/dm/dm.h
index 7d2f925120..007f22c3fe 100644
--- a/engines/dm/dm.h
+++ b/engines/dm/dm.h
@@ -230,8 +230,8 @@ private:
Console *_console;
byte *_g562_entranceDoorAnimSteps[10]; // @ G0562_apuc_Bitmap_EntranceDoorAnimationSteps
byte *_g564_interfaceCredits; // @ G0564_puc_Graphic5_InterfaceCredits
-public:
Common::RandomSource *_rnd;
+public:
DisplayMan *_displayMan;
DungeonMan *_dungeonMan;
EventManager *_eventMan;
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index d264bf1c79..eb9012e601 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -1346,10 +1346,10 @@ void DisplayMan::f111_drawDoor(uint16 doorThingIndex, uint16 doorState, int16* d
memmove(_g74_tmpBitmap, f489_getNativeBitmapOrGraphic(doorNativeBitmapIndices[doorType = door->getType()]), byteCount * 2);
f109_drawDoorOrnament(door->getOrnOrdinal(), viewDoorOrnIndex);
if (getFlag(_vm->_dungeonMan->_g275_currMapDoorInfo[doorType]._attributes, k0x0004_MaskDoorInfo_Animated)) {
- if (_vm->_rnd->getRandomNumber(1)) {
+ if (_vm->getRandomNumber(2)) {
f130_flipBitmapHorizontal(_g74_tmpBitmap, doorFramesTemp->_closedOrDestroyed._srcByteWidth, doorFramesTemp->_closedOrDestroyed._srcHeight);
}
- if (_vm->_rnd->getRandomNumber(1)) {
+ if (_vm->getRandomNumber(2)) {
f131_flipVertical(_g74_tmpBitmap, doorFramesTemp->_closedOrDestroyed._srcByteWidth, doorFramesTemp->_closedOrDestroyed._srcHeight);
}
}
@@ -3632,7 +3632,7 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:;
AL_6_bitmapRedBanana = _g74_tmpBitmap;
}
f133_blitBoxFilledWithMaskedBitmap(AL_6_bitmapRedBanana, _g296_bitmapViewport, nullptr, f492_getDerivedBitmap(k0_DerivedBitmapViewport), g105_BoxExplosionPattern_D0C,
- _vm->_rnd->getRandomNumber(4) + 87, _vm->_rnd->getRandomNumber(64),
+ _vm->getRandomNumber(4) + 87, _vm->getRandomNumber(64),
224, (Color)(k0x0080_BlitDoNotUseMask | k10_ColorFlesh), 0, 0, 136, 93);
warning(false, "IGNORED CODE: F0493_CACHE_AddDerivedBitmap");
warning(false, "IGNORED CODE: F0493_CACHE_AddDerivedBitmap");
@@ -3655,9 +3655,9 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:;
}
AL_6_bitmapRedBanana = f114_getExplosionBitmap(AL_4_explosionAspectIndex, explosionScale, byteWidth, heightRedEagle);
T0115200_DrawExplosion:
- flipVertical = _vm->_rnd->getRandomNumber(2);
+ flipVertical = _vm->getRandomNumber(2);
paddingPixelCount = 0;
- if (flipHorizontal = _vm->_rnd->getRandomNumber(2)) {
+ if (flipHorizontal = _vm->getRandomNumber(2)) {
paddingPixelCount = (7 - ((byteWidth - 1) & 0x0007)) << 1; /* Number of unused pixels in the units on the right of the bitmap */
}
boxByteGreen._y2 = MIN(135, explosionCoordinates[1] + (heightRedEagle >> 1));