[Scummvm-git-logs] scummvm master -> ed14e9f7d2bf4566face1b25d7bdc2d45464d5cb

mduggan mgithub at guarana.org
Wed Jul 14 23:57:12 UTC 2021


This automated email contains information about 8 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5cc52830c1 ULTIMA8: Allow check for any sfx on a given object
ff53e99b88 ULTIMA8: Add No Regret attack starting sfx
99aaab459f ULTIMA8: Handle NPC death a bit better
b972ac8f7d ULTIMA8: Fix initial No Regret avatar entrance
bcff36a877 ULTIMA8: Downgrade music error to warning
b39c9323ac ULTIMA8: Fix Crusader SuperSpriteProcess process loader
4f38c3ff73 ULTIMA8: Add more items to Regret data
ed14e9f7d2 ULTIMA8: Match original display font for ammo in No Regret


Commit: 5cc52830c1c7264f43bce755409a7f77dab0de61
    https://github.com/scummvm/scummvm/commit/5cc52830c1c7264f43bce755409a7f77dab0de61
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-07-15T08:51:11+09:00

Commit Message:
ULTIMA8: Allow check for any sfx on a given object

Changed paths:
    engines/ultima/ultima8/audio/audio_process.cpp


diff --git a/engines/ultima/ultima8/audio/audio_process.cpp b/engines/ultima/ultima8/audio/audio_process.cpp
index 745e97d9fe..ddfc08fead 100644
--- a/engines/ultima/ultima8/audio/audio_process.cpp
+++ b/engines/ultima/ultima8/audio/audio_process.cpp
@@ -318,7 +318,7 @@ bool AudioProcess::isSFXPlayingForObject(int sfxNum, ObjId objId) {
 	AudioMixer *mixer = AudioMixer::get_instance();
 	Std::list<SampleInfo>::iterator it;
 	for (it = _sampleInfo.begin(); it != _sampleInfo.end(); ++it) {
-		if (it->_sfxNum == sfxNum && (objId == it->_objId) && mixer->isPlaying(it->_channel))
+		if ((it->_sfxNum == sfxNum || sfxNum == -1) && (objId == it->_objId) && mixer->isPlaying(it->_channel))
 			return true;
 	}
 


Commit: ff53e99b88f907060b7729c3f75d2a9c471282e4
    https://github.com/scummvm/scummvm/commit/ff53e99b88f907060b7729c3f75d2a9c471282e4
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-07-15T08:51:11+09:00

Commit Message:
ULTIMA8: Add No Regret attack starting sfx

So the NPCs say "enemy sighted!" etc.

Changed paths:
    engines/ultima/ultima8/world/actors/attack_process.cpp
    engines/ultima/ultima8/world/actors/attack_process.h


diff --git a/engines/ultima/ultima8/world/actors/attack_process.cpp b/engines/ultima/ultima8/world/actors/attack_process.cpp
index d63feed0b2..bf79c9ff44 100644
--- a/engines/ultima/ultima8/world/actors/attack_process.cpp
+++ b/engines/ultima/ultima8/world/actors/attack_process.cpp
@@ -43,13 +43,31 @@ namespace Ultima8 {
 
 DEFINE_RUNTIME_CLASSTYPE_CODE(AttackProcess)
 
-static const int16 ATTACK_SFX_1[] = {0x15, 0x78, 0x80, 0x83, 0xDC, 0xDD};
-static const int16 ATTACK_SFX_2[] = {0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xE7};
-static const int16 ATTACK_SFX_3[] = {0xFC, 0xFD, 0xFE, 0xC8};
-static const int16 ATTACK_SFX_4[] = {0xCC, 0xCD, 0xCE, 0xCF};
-static const int16 ATTACK_SFX_5[] = {0xC7, 0xCA, 0xC9};
-static const int16 ATTACK_SFX_6[] = {0x82, 0x84, 0x85};
-static const int16 ATTACK_SFX_7[] = {0x9B, 0x9C, 0x9D, 0x9E, 0x9F};
+// These sound number arrays are in the order they appear in the original exes
+
+static const int16 REM_SFX_1[] = {0x15, 0x78, 0x80, 0x83, 0xDC, 0xDD};
+static const int16 REM_SFX_2[] = {0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xE7};
+static const int16 REM_SFX_3[] = {0xFC, 0xFD, 0xFE, 0xC8};
+static const int16 REM_SFX_4[] = {0xCC, 0xCD, 0xCE, 0xCF};
+static const int16 REM_SFX_5[] = {0xC7, 0xCA, 0xC9};
+static const int16 REM_SFX_6[] = {0x82, 0x84, 0x85};
+static const int16 REM_SFX_7[] = {0x9B, 0x9C, 0x9D, 0x9E, 0x9F};
+
+static const int16 REG_SFX_1[] = { 0xD2, 0xD3, 0xD4, 0xD5, 0xE5, 0x100 };
+static const int16 REG_SFX_2[] = { 0x9, 0x79, 0x7A, 0x7B, 0x7C, 0x7D };
+static const int16 REG_SFX_3[] = { 0x7E, 0x7F, 0x90, 0xB6, 0xC2, 0xD0 };
+static const int16 REG_SFX_4[] = { 0x101, 0x102, 0x103, 0x104, 0x105, 0x106 };
+static const int16 REG_SFX_5[] = { 0x108, 0x109, 0x1AB, 0x1AC, 0x1AD, 0x1AF, 0x1AE };
+static const int16 REG_SFX_6[] = { 0x1B0, 0x1B1, 0x1B2, 0x1B3, 0x1B4 };
+static const int16 REG_SFX_7[] = { 0x1B5, 0x1B6, 0x1B7, 0x1B8, 0x1B9, 0x1BA, 0x1BB };
+static const int16 REG_SFX_8[] = { 0x1C1, 0x1C0, 0x1BF, 0x1BE, 0x1BD, 0x1BC };
+static const int16 REG_SFX_9[] = { 0x1C2, 0x1C3, 0x1C4, 0x1C5, 0x1C6, 0x1C7 };
+static const int16 REG_SFX_10[] = { 0x1C8, 0x1C9, 0x1CA, 0x1CB, 0x1CC, 0x1CD };
+static const int16 REG_SFX_11[] = { 0x1D0, 0x1D1, 0x1D2, 0x1D3, 0x1D4, 0x1D5 };
+static const int16 REG_SFX_12[] = { 0x1D7, 0x1D8, 0x1D9, 0x1DA, 0x1DB, 0x1DC };
+static const int16 REG_SFX_13[] = { 0x1DD, 0x1DE, 0x1DF, 0x1E0, 0x1E1, 0x1E2, 0x1E3 };
+static const int16 REG_SFX_14[] = { 0x9B, 0x9C, 0x9D, 0x9E, 0x9F };
+static const int16 REG_SFX_15[] = { 0x1E7, 0x1E8, 0x1E9, 0x1EA, 0x1ED };
 
 #define RANDOM_ELEM(array) (array[getRandom() % ARRAYSIZE(array)])
 
@@ -59,6 +77,9 @@ static const int MAGIC_DATA_OFF = 33000;
 
 const uint16 AttackProcess::ATTACK_PROCESS_TYPE = 0x259;
 
+int16 AttackProcess::_lastAttackSound = -1;
+int16 AttackProcess::_lastLastAttackSound = -1;
+
 static uint16 someSleepGlobal = 0;
 
 static inline int32 randomOf(int32 max) {
@@ -163,7 +184,7 @@ void AttackProcess::run() {
 		terminate();
 		return;
 	}
-	
+
 	if (!a->hasFlags(Item::FLG_FASTAREA))
 		return;
 
@@ -757,9 +778,91 @@ void AttackProcess::genericAttack() {
 	}
 }
 
+void AttackProcess::checkRandomAttackSoundRegret(const Actor *actor) {
+	AudioProcess *audio = AudioProcess::get_instance();
+
+	if (World::get_instance()->getControlledNPCNum() != 1)
+		return;
+
+	if (actor->isDead())
+		return;
+
+	if (audio->isSFXPlayingForObject(-1, actor->getObjId()))
+		return;
+
+	uint32 shapeno = actor->getShape();
+	int16 sndno = -1;
+	// The order here is pretty random, how it comes out of the disasm.
+	switch (shapeno) {
+	  case 0x4e0:
+		  sndno = RANDOM_ELEM(REG_SFX_8);
+		  break;
+	  case 899:
+		  sndno = RANDOM_ELEM(REG_SFX_14);
+		  break;
+	  case 900:
+		  sndno = RANDOM_ELEM(REG_SFX_7);
+		  break;
+	  case 0x4d1:
+	  case 0x528:
+		  sndno = RANDOM_ELEM(REG_SFX_3);
+		  break;
+	  case 0x344:
+		  sndno = RANDOM_ELEM(REG_SFX_13);
+		  break;
+	  case 0x371:
+	  case 0x62f:
+	  case 0x630:
+		  sndno = RANDOM_ELEM(REG_SFX_2);
+		  break;
+	  case 0x2f5:
+		  sndno = RANDOM_ELEM(REG_SFX_9);
+		  break;
+	  case 0x2f6:
+		  sndno = RANDOM_ELEM(REG_SFX_12);
+		  break;
+	  case 0x2f7:
+	  case 0x595:
+		  sndno = RANDOM_ELEM(REG_SFX_11);
+		  break;
+	  case 0x2df:
+		  sndno = RANDOM_ELEM(REG_SFX_6);
+		  break;
+	  case 0x597:
+		  sndno = RANDOM_ELEM(REG_SFX_10);
+		  break;
+	  case 0x5b1:
+		  sndno = RANDOM_ELEM(REG_SFX_15);
+		  break;
+	  case 0x5ff:
+	  case 0x5d7:
+		  sndno = RANDOM_ELEM(REG_SFX_5);
+		  break;
+	  case 0x1b4:
+	  case 0x625:
+		  sndno = RANDOM_ELEM(REG_SFX_4);
+		  break;
+	  case 0x5f0:
+	  case 0x308:
+		  sndno = RANDOM_ELEM(REG_SFX_1);
+		  break;
+	  default:
+		  break;
+	}
+
+	if (sndno != -1 && _lastAttackSound != sndno && _lastLastAttackSound != sndno) {
+		_lastLastAttackSound = _lastAttackSound;
+		_lastAttackSound = sndno;
+		_soundNo = sndno;
+		audio->playSFX(sndno, 0x80, actor->getObjId(), 1);
+	}
+}
+
 void AttackProcess::checkRandomAttackSound(int now, uint32 shapeno) {
-	if (GAME_IS_REGRET)
-		warning("TODO: checkRandomAttackSound: Update for No Regret");
+	if (GAME_IS_REGRET) {
+		checkRandomAttackSoundRegret(getActor(_itemNum));
+		return;
+	}
 	AudioProcess *audio = AudioProcess::get_instance();
 	int16 attacksound = -1;
 	if (!_playedStartSound) {
@@ -767,21 +870,21 @@ void AttackProcess::checkRandomAttackSound(int now, uint32 shapeno) {
 		if (randomOf(3) == 0) {
 			switch(shapeno) {
 				case 0x371:
-					attacksound = RANDOM_ELEM(ATTACK_SFX_3);
+					attacksound = RANDOM_ELEM(REM_SFX_3);
 					break;
 				case 0x1b4:
-					attacksound = RANDOM_ELEM(ATTACK_SFX_5);
+					attacksound = RANDOM_ELEM(REM_SFX_5);
 					break;
 				case 0x2fd:
 				case 0x319:
-					attacksound = RANDOM_ELEM(ATTACK_SFX_1);
+					attacksound = RANDOM_ELEM(REM_SFX_1);
 					break;
 				case 900:
-					attacksound = RANDOM_ELEM(ATTACK_SFX_2);
+					attacksound = RANDOM_ELEM(REM_SFX_2);
 					break;
 				case 0x4d1:
 				case 0x528:
-					attacksound = RANDOM_ELEM(ATTACK_SFX_4);
+					attacksound = RANDOM_ELEM(REM_SFX_4);
 					break;
 				default:
 					break;
@@ -790,9 +893,9 @@ void AttackProcess::checkRandomAttackSound(int now, uint32 shapeno) {
 	} else {
 		if (readyForNextSound(now)) {
 			if (shapeno == 0x2df)
-				attacksound = RANDOM_ELEM(ATTACK_SFX_6);
+				attacksound = RANDOM_ELEM(REM_SFX_6);
 			else if (shapeno == 899)
-				attacksound = RANDOM_ELEM(ATTACK_SFX_7);
+				attacksound = RANDOM_ELEM(REM_SFX_7);
 		}
 	}
 
diff --git a/engines/ultima/ultima8/world/actors/attack_process.h b/engines/ultima/ultima8/world/actors/attack_process.h
index e3019974cd..538f19f9ad 100644
--- a/engines/ultima/ultima8/world/actors/attack_process.h
+++ b/engines/ultima/ultima8/world/actors/attack_process.h
@@ -119,6 +119,9 @@ private:
 	 * that's on startup, but some make regular sounds (see readyForNextSound) */
 	void checkRandomAttackSound(int now, uint32 shapeno);
 
+	/** Check if it's time to make a new sound, Regret version. */
+	void checkRandomAttackSoundRegret(const Actor *actor);
+
 	uint16 _target; // TODO: this is stored in NPC in game, does it matter?
 	uint16 _tactic;
 	uint16 _block;
@@ -161,6 +164,10 @@ private:
 	int32 _soundTimestamp; /// 0x84/0x86 in orig - time a sound was last played
 	int32 _fireTimestamp; /// 0x90/0x92 in orig - time NPC last fired
 
+	// Used in No Regret only, to avoid replaying the same sfx for attack twice in a row.
+	static int16 _lastAttackSound;
+	static int16 _lastLastAttackSound;
+
 };
 
 } // End of namespace Ultima8


Commit: 99aaab459f95aa96c7a090dbdbe600a498a80a0f
    https://github.com/scummvm/scummvm/commit/99aaab459f95aa96c7a090dbdbe600a498a80a0f
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-07-15T08:53:04+09:00

Commit Message:
ULTIMA8: Handle NPC death a bit better

The isDead intrinsic should default to 1 if queried item is not an Actor (fixes
biohazard buzzes appearing on dead actors in No Regret).  This may fix some
subtle bugs in Ultima 8 and No Regret too as all the games return 1 for a
non-npc object.

Also when actors die in Crusader, be sure to remove them from the target list.

Changed paths:
    engines/ultima/ultima8/world/actors/actor.cpp


diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index 4ccb0db542..524a262a21 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -1404,6 +1404,8 @@ ProcId Actor::dieCru(uint16 damageType, uint16 damagePts, Direction srcDir) {
 
 	World *world = World::get_instance();
 
+	world->getCurrentMap()->removeTargetItem(this);
+
     if (world->getControlledNPCNum() == _objId) {
 		TargetReticleProcess::get_instance()->avatarMoved();
 		if (_objId != 1) {
@@ -2334,7 +2336,7 @@ uint32 Actor::I_isEnemy(const uint8 *args, unsigned int /*argsize*/) {
 
 uint32 Actor::I_isDead(const uint8 *args, unsigned int /*argsize*/) {
 	ARG_ACTOR_FROM_PTR(actor);
-	if (!actor) return 0;
+	if (!actor) return 1;
 
 	if (actor->isDead())
 		return 1;


Commit: b972ac8f7db43bac8575a296a38ffc8d05a94c19
    https://github.com/scummvm/scummvm/commit/b972ac8f7db43bac8575a296a38ffc8d05a94c19
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-07-15T08:54:10+09:00

Commit Message:
ULTIMA8: Fix initial No Regret avatar entrance

Avatar should run in with weapon drawn.

Changed paths:
    engines/ultima/ultima8/games/start_crusader_process.cpp
    engines/ultima/ultima8/world/actors/animation.cpp
    engines/ultima/ultima8/world/actors/cru_avatar_mover_process.cpp


diff --git a/engines/ultima/ultima8/games/start_crusader_process.cpp b/engines/ultima/ultima8/games/start_crusader_process.cpp
index f26e71895f..dbc200a893 100644
--- a/engines/ultima/ultima8/games/start_crusader_process.cpp
+++ b/engines/ultima/ultima8/games/start_crusader_process.cpp
@@ -97,6 +97,10 @@ void StartCrusaderProcess::run() {
 			0x038E, 0x0388, 0x038A, 0x038D, 0x038B, 0x0386,
 			// Ammo
 			0x033D, 0x033E, 0x033F, 0x0340, 0x0341
+			// No Regret Weapons
+			0x5F6, 0x5F5, 0x198,
+			// No Regret Ammo
+			0x615, 0x614
 		};
 		for (int i = 0; i < ARRAYSIZE(wpnshapes); i++) {
 			for (int j = 0; j < 5; j++) {
@@ -111,6 +115,12 @@ void StartCrusaderProcess::run() {
 		// teleport, so undo the flag that normally stops that.
 		avatar->setJustTeleported(false);
 
+		if (GAME_IS_REGRET) {
+			avatar->setInCombat(0);
+			avatar->setDir(Direction::dir_south);
+			avatar->setActorFlag(Actor::ACT_WEAPONREADY);
+		}
+
 		Process *fader = new PaletteFaderProcess(0x00FFFFFF, true, 0x7FFF, 60, false);
 		Kernel::get_instance()->addProcess(fader);
 	}
diff --git a/engines/ultima/ultima8/world/actors/animation.cpp b/engines/ultima/ultima8/world/actors/animation.cpp
index b59b21bfdb..d79db4c91d 100644
--- a/engines/ultima/ultima8/world/actors/animation.cpp
+++ b/engines/ultima/ultima8/world/actors/animation.cpp
@@ -65,9 +65,10 @@ bool isCastAnimU8(const Sequence anim) {
 }
 
 bool isCombatAnimCru(const Sequence anim) {
-	switch (anim) {
+	switch (anim & ~crusaderAbsoluteAnimFlag) {
 	case combatStand:
 	case combatStandSmallWeapon:
+	case combatStandLargeWeapon:
 	case readyWeapon:
 	case advance:
 	case retreat:
diff --git a/engines/ultima/ultima8/world/actors/cru_avatar_mover_process.cpp b/engines/ultima/ultima8/world/actors/cru_avatar_mover_process.cpp
index 8b8aefb6b6..f4c51a95f2 100644
--- a/engines/ultima/ultima8/world/actors/cru_avatar_mover_process.cpp
+++ b/engines/ultima/ultima8/world/actors/cru_avatar_mover_process.cpp
@@ -39,7 +39,7 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(CruAvatarMoverProcess)
 static const int REBEL_BASE_MAP = 40;
 
 CruAvatarMoverProcess::CruAvatarMoverProcess() : AvatarMoverProcess(),
-_avatarAngle(0), _SGA1Loaded(false), _nextFireTick(0) {
+_avatarAngle(-1), _SGA1Loaded(false), _nextFireTick(0) {
 }
 
 


Commit: bcff36a877ee0365cf6e31c94d650757fe3b626b
    https://github.com/scummvm/scummvm/commit/bcff36a877ee0365cf6e31c94d650757fe3b626b
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-07-15T08:54:10+09:00

Commit Message:
ULTIMA8: Downgrade music error to warning

Changed paths:
    engines/ultima/ultima8/audio/cru_music_process.cpp


diff --git a/engines/ultima/ultima8/audio/cru_music_process.cpp b/engines/ultima/ultima8/audio/cru_music_process.cpp
index 7803ec9dfa..f6b97f71ed 100644
--- a/engines/ultima/ultima8/audio/cru_music_process.cpp
+++ b/engines/ultima/ultima8/audio/cru_music_process.cpp
@@ -185,7 +185,8 @@ void CruMusicProcess::playMusic_internal(int track) {
 		assert(filesystem);
 		Common::SeekableReadStream *rs = filesystem->ReadFile(fname);
 		if (!rs) {
-			error("Couldn't load AMF file: %s", fname.c_str());
+			// This happens in No Regret demo.
+			warning("Couldn't load AMF file: %s", fname.c_str());
 			return;
 		}
 


Commit: b39c9323ac78a1b691d03303580af354f37c98c4
    https://github.com/scummvm/scummvm/commit/b39c9323ac78a1b691d03303580af354f37c98c4
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-07-15T08:54:10+09:00

Commit Message:
ULTIMA8: Fix Crusader SuperSpriteProcess process loader

The data size used in the loader did not match the data size in the saver.
This bug lasted a long time as SuperSprite processes are short lived and rarely
appear in saves, but when they did they were corrupting the data.

Changed paths:
    engines/ultima/ultima8/world/super_sprite_process.cpp


diff --git a/engines/ultima/ultima8/world/super_sprite_process.cpp b/engines/ultima/ultima8/world/super_sprite_process.cpp
index fc46ff2c55..05b7885ecb 100644
--- a/engines/ultima/ultima8/world/super_sprite_process.cpp
+++ b/engines/ultima/ultima8/world/super_sprite_process.cpp
@@ -493,7 +493,7 @@ bool SuperSpriteProcess::loadData(Common::ReadStream *rs, uint32 version) {
 	if (!Process::loadData(rs, version)) return false;
 
 	_shape = static_cast<int>(rs->readUint32LE());
-	_frame = rs->readUint16LE();
+	_frame = rs->readUint32LE();
 	_nowpt.loadData(rs, version);
 	_nextpt.loadData(rs, version);
 	_pt3.loadData(rs, version);


Commit: 4f38c3ff7335aad4a5a737a9c9c81994076a9cf5
    https://github.com/scummvm/scummvm/commit/4f38c3ff7335aad4a5a737a9c9c81994076a9cf5
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-07-15T08:55:08+09:00

Commit Message:
ULTIMA8: Add more items to Regret data

Configure shapes and inventory gump frames for various inventory objects.

Changed paths:
    devtools/create_ultima/files/ultima8/regretweapons.ini


diff --git a/devtools/create_ultima/files/ultima8/regretweapons.ini b/devtools/create_ultima/files/ultima8/regretweapons.ini
index 2fba79201b..90bf4f1d49 100644
--- a/devtools/create_ultima/files/ultima8/regretweapons.ini
+++ b/devtools/create_ultima/files/ultima8/regretweapons.ini
@@ -362,3 +362,38 @@ display_frame=0xD
 shape=0x111
 display_shape=5
 display_frame=0xD
+
+[DISRUPTER]
+shape=0x616
+display_shape=5
+display_frame=0x1C
+
+[SPIDER MINE]
+shape=0x11E
+display_shape=5
+display_frame=0x1D
+
+[DATA PICK]
+shape=0x613
+display_shape=5
+display_frame=0x1E
+
+[MINE DET]
+shape=0x61C
+display_shape=5
+display_frame=0x1F
+
+[PORTABLE BETTY]
+shape=0x63E
+display_shape=5
+display_frame=0x22
+
+[RADIATION SHIELD]
+shape=0x191
+display_shape=5
+display_frame=0x21
+
+[VIR IMAGER]
+shape=0x4ED
+display_shape=5
+display_frame=0x20


Commit: ed14e9f7d2bf4566face1b25d7bdc2d45464d5cb
    https://github.com/scummvm/scummvm/commit/ed14e9f7d2bf4566face1b25d7bdc2d45464d5cb
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-07-15T08:55:34+09:00

Commit Message:
ULTIMA8: Match original display font for ammo in No Regret

Changed paths:
    engines/ultima/ultima8/gumps/cru_ammo_gump.cpp


diff --git a/engines/ultima/ultima8/gumps/cru_ammo_gump.cpp b/engines/ultima/ultima8/gumps/cru_ammo_gump.cpp
index 006906b0c7..c0e9d27831 100644
--- a/engines/ultima/ultima8/gumps/cru_ammo_gump.cpp
+++ b/engines/ultima/ultima8/gumps/cru_ammo_gump.cpp
@@ -25,12 +25,21 @@
 #include "ultima/ultima8/world/actors/main_actor.h"
 #include "ultima/ultima8/gumps/widgets/text_widget.h"
 #include "ultima/ultima8/world/get_object.h"
+#include "ultima/ultima8/ultima8.h"
 
 namespace Ultima {
 namespace Ultima8 {
 
 DEFINE_RUNTIME_CLASSTYPE_CODE(CruAmmoGump)
 
+static const int REM_FONT_NUM = 15;
+static const int REG_FONT_NUM = 8;
+
+static const int REM_XOFF = 22;
+static const int REG_XOFF = 38;
+static const int REM_YOFF = 3;
+static const int REG_YOFF = 6;
+
 CruAmmoGump::CruAmmoGump() : CruStatGump(), _clipsText(nullptr), _bulletsText(nullptr) {
 
 }
@@ -73,13 +82,17 @@ void CruAmmoGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
 
 	// Only paint if this weapon has bullets that get used up.
 	if (bullets >= 0 && a == getControlledActor()) {
+		const int xoff = GAME_IS_REMORSE ? REM_XOFF : REG_XOFF;
+		const int yoff = GAME_IS_REMORSE ? REM_YOFF : REG_YOFF;
+		const int fontno = GAME_IS_REMORSE ? REM_FONT_NUM : REG_FONT_NUM;
+
 		const Std::string bulletstr = Std::string::format("%d", bullets);
 		if (!_bulletsText || !bulletstr.equals(_bulletsText->getText())) {
 			if (_bulletsText) {
 				RemoveChild(_bulletsText);
 				_bulletsText->Close();
 			}
-			_bulletsText = new TextWidget(22, _dims.height() / 2 - 3, bulletstr, true, 15);
+			_bulletsText = new TextWidget(xoff, _dims.height() / 2 - yoff, bulletstr, true, fontno);
 			_bulletsText->InitGump(this, false);
 		}
 
@@ -98,7 +111,7 @@ void CruAmmoGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
 				RemoveChild(_clipsText);
 				_clipsText->Close();
 			}
-			_clipsText = new TextWidget(_dims.width() / 2 + 22, _dims.height() / 2 - 3, clipstr, true, 15);
+			_clipsText = new TextWidget(_dims.width() / 2 + xoff, _dims.height() / 2 - yoff, clipstr, true, fontno);
 			_clipsText->InitGump(this, false);
 		}
 		CruStatGump::PaintThis(surf, lerp_factor, scaled);




More information about the Scummvm-git-logs mailing list