[Scummvm-git-logs] scummvm master -> 4fd4570f4109b2d4d9941910366bb3745db25992
mduggan
mgithub at guarana.org
Mon Aug 9 05:54:35 UTC 2021
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c8d834f555 ULTIMA8: Add option for camera to follow avatar in Crusader
2e1cc976af ULTIMA8: Update list of Crusader NPC types not notify when weapon fired
2009ddac79 ULTIMA8: Fix debug message
4fd4570f41 ULTIMA8: Crusader subtitle improvements
Commit: c8d834f555d80fd473195bab2d4cd8758522669f
https://github.com/scummvm/scummvm/commit/c8d834f555d80fd473195bab2d4cd8758522669f
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-08-09T11:58:57+09:00
Commit Message:
ULTIMA8: Add option for camera to follow avatar in Crusader
Changed paths:
engines/ultima/ultima8/meta_engine.cpp
engines/ultima/ultima8/world/camera_process.h
engines/ultima/ultima8/world/snap_process.cpp
diff --git a/engines/ultima/ultima8/meta_engine.cpp b/engines/ultima/ultima8/meta_engine.cpp
index 70bc136660..af78d5c330 100644
--- a/engines/ultima/ultima8/meta_engine.cpp
+++ b/engines/ultima/ultima8/meta_engine.cpp
@@ -187,6 +187,12 @@ static const ExtraGuiOption U8_OPTIONS[] = {
};
static const ExtraGuiOption CRUSADER_OPTIONS[] = {
+ {
+ _s("Camera moves with silencer"),
+ _s("Camera tracks the player movement rather than snapping to defined positions."),
+ "camera_on_player",
+ true
+ },
{ nullptr, nullptr, nullptr, false }
};
@@ -284,7 +290,7 @@ const ExtraGuiOptions MetaEngine::getExtraGuiOptions(const Common::String& targe
options.push_back(*o);
}
- // Game specific keymaps
+ // Game specific options
const ExtraGuiOption *game_options = (target.equals("ultima8") ? U8_OPTIONS : CRUSADER_OPTIONS);
for (const ExtraGuiOption *o = game_options; o->configOption; ++o) {
options.push_back(*o);
diff --git a/engines/ultima/ultima8/world/camera_process.h b/engines/ultima/ultima8/world/camera_process.h
index b84963ef01..09837c814d 100644
--- a/engines/ultima/ultima8/world/camera_process.h
+++ b/engines/ultima/ultima8/world/camera_process.h
@@ -103,6 +103,10 @@ public:
bool loadData(Common::ReadStream *rs, uint32 version);
void saveData(Common::WriteStream *ws) override;
+ uint16 getTrackedItem() const {
+ return _itemNum;
+ }
+
private:
int32 _sx, _sy, _sz;
int32 _ex, _ey, _ez;
diff --git a/engines/ultima/ultima8/world/snap_process.cpp b/engines/ultima/ultima8/world/snap_process.cpp
index 7a5427c74e..26679d79c8 100644
--- a/engines/ultima/ultima8/world/snap_process.cpp
+++ b/engines/ultima/ultima8/world/snap_process.cpp
@@ -20,6 +20,8 @@
*
*/
+#include "common/config-manager.h"
+
#include "ultima/ultima8/world/snap_process.h"
#include "ultima/ultima8/world/get_object.h"
#include "ultima/ultima8/world/actors/actor.h"
@@ -44,8 +46,23 @@ SnapProcess::~SnapProcess() {
}
void SnapProcess::run() {
- if (!_currentSnapEgg || !isNpcInRangeOfCurrentEgg()) {
- updateCurrentEgg();
+ bool snap_to_player = ConfMan.getBool("camera_on_player");
+ if (snap_to_player) {
+ const Actor *controlled = getControlledActor();
+ if (controlled) {
+ int32 x, y, z;
+ controlled->getCentre(x, y, z);
+ if (x > 0 || y > 0) {
+ _currentSnapEgg = 0;
+ CameraProcess *camera = CameraProcess::GetCameraProcess();
+ if (camera->getItemNum() != controlled->getObjId())
+ CameraProcess::SetCameraProcess(new CameraProcess(x, y, z));
+ }
+ }
+ } else {
+ if (!_currentSnapEgg || !isNpcInRangeOfCurrentEgg()) {
+ updateCurrentEgg();
+ }
}
}
@@ -77,7 +94,7 @@ void SnapProcess::updateCurrentEgg() {
for (Std::list<ObjId>::const_iterator iter = _snapEggs.begin();
iter != _snapEggs.end(); iter++) {
- Item *egg = getItem(*iter);
+ const Item *egg = getItem(*iter);
if (!egg)
continue;
Rect r;
@@ -111,7 +128,7 @@ bool SnapProcess::isNpcInRangeOfCurrentEgg() const {
return false;
const Actor *a = getControlledActor();
- Item *currentegg = getItem(_currentSnapEgg);
+ const Item *currentegg = getItem(_currentSnapEgg);
if (!a || !currentegg)
return false;
Commit: 2e1cc976af7171957ba86c6c6ba6327c2d488fc1
https://github.com/scummvm/scummvm/commit/2e1cc976af7171957ba86c6c6ba6327c2d488fc1
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-08-09T11:58:57+09:00
Commit Message:
ULTIMA8: Update list of Crusader NPC types not notify when weapon fired
Remorse and Regret have a slightly different list in this function.
Changed paths:
engines/ultima/ultima8/world/actors/cru_avatar_mover_process.cpp
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 5041d205c3..b883080496 100644
--- a/engines/ultima/ultima8/world/actors/cru_avatar_mover_process.cpp
+++ b/engines/ultima/ultima8/world/actors/cru_avatar_mover_process.cpp
@@ -632,7 +632,8 @@ void CruAvatarMoverProcess::checkForAlertingNPCs() {
uint16 range = 0;
uint32 npcshape = a->getShape();
if (npcshape == 0x2f5 || npcshape == 0x2f6 || npcshape == 0x2f7 ||
- npcshape == 0x595 || npcshape == 0x597) {
+ (GAME_IS_REMORSE && (npcshape == 0x595 || npcshape == 0x597)) ||
+ (GAME_IS_REGRET && (npcshape == 0x344 || npcshape == 0x384))) {
Actor *c = getActor(controllednpc);
if (c)
range = a->getRangeIfVisible(*c);
Commit: 2009ddac792d29c3f81a042d86b3c48d95a1591e
https://github.com/scummvm/scummvm/commit/2009ddac792d29c3f81a042d86b3c48d95a1591e
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-08-09T14:53:26+09:00
Commit Message:
ULTIMA8: Fix debug message
Changed paths:
engines/ultima/ultima8/ultima8.cpp
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index d88db30e32..9b864f536a 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -991,7 +991,7 @@ bool Ultima8Engine::saveGame(int slot, const Std::string &desc) {
// (Avatar is flagged dead by usecode when you finish the _game as well.)
MainActor *av = getMainActor();
if (!av || av->hasActorFlags(Actor::ACT_DEAD)) {
- pout << "Can't save: _game over." << Std::endl;
+ pout << "Can't save: game over." << Std::endl;
return false;
}
Commit: 4fd4570f4109b2d4d9941910366bb3745db25992
https://github.com/scummvm/scummvm/commit/4fd4570f4109b2d4d9941910366bb3745db25992
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-08-09T14:53:56+09:00
Commit Message:
ULTIMA8: Crusader subtitle improvements
* Add the black box behind them to make them more readable
* Fix the bug which meant the first subtitle sometimes got lost
Changed paths:
engines/ultima/ultima8/gumps/movie_gump.cpp
engines/ultima/ultima8/gumps/movie_gump.h
diff --git a/engines/ultima/ultima8/gumps/movie_gump.cpp b/engines/ultima/ultima8/gumps/movie_gump.cpp
index 7377901505..4f5645fb94 100644
--- a/engines/ultima/ultima8/gumps/movie_gump.cpp
+++ b/engines/ultima/ultima8/gumps/movie_gump.cpp
@@ -46,6 +46,13 @@
namespace Ultima {
namespace Ultima8 {
+// Some fourCCs used in IFF files
+static const uint32 IFF_MAGIC = MKTAG('F', 'O', 'R', 'M');
+static const uint32 IFF_LANG = MKTAG('L', 'A', 'N', 'G');
+static const uint32 IFF_LANG_FR = MKTAG('F', 'R', 'E', 'N');
+static const uint32 IFF_LANG_EN = MKTAG('E', 'N', 'G', 'L');
+static const uint32 IFF_LANG_DE = MKTAG('G', 'E', 'R', 'M');
+
static Std::string _fixCrusaderMovieName(const Std::string &s) {
/*
HACK! The game comes with movies MVA01.AVI etc, but the usecode mentions both
@@ -155,6 +162,7 @@ void MovieGump::run() {
_player->run();
+ // TODO: It would be nice to refactor this
AVIPlayer *aviplayer = dynamic_cast<AVIPlayer *>(_player);
if (aviplayer) {
// The AVI player can skip frame numbers, so search back from the
@@ -186,6 +194,25 @@ void MovieGump::run() {
void MovieGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
Gump::PaintThis(surf, lerp_factor, scaled);
_player->paint(surf, lerp_factor);
+
+ // If displaying subtitles, put a black box behind them. The box should be ~600px across.
+ if (_subtitleWidget) {
+ TextWidget *subtitle = dynamic_cast<TextWidget *>(getGump(_subtitleWidget));
+ if (subtitle) {
+ int32 x, y;
+ Rect textdims;
+ Rect screendims;
+ subtitle->getLocation(x, y);
+ subtitle->GetDims(textdims);
+ surf->GetSurfaceDims(screendims);
+ surf->Fill32(surf->getPixelFormat().RGBToColor(0, 0, 0),
+ screendims.width() / 2 - 300,
+ y - 3,
+ 600,
+ textdims.height() + 5);
+ }
+ }
+
}
bool MovieGump::OnKeyDown(int key, int mod) {
@@ -261,7 +288,7 @@ void MovieGump::loadSubtitles(Common::SeekableReadStream *rs) {
const uint32 id = rs->readUint32BE();
rs->seek(0);
- if (id == 0x464F524D) { // 'FORM'
+ if (id == IFF_MAGIC) {
loadIFFSubs(rs);
} else {
loadTXTSubs(rs);
@@ -273,26 +300,19 @@ void MovieGump::loadTXTSubs(Common::SeekableReadStream *rs) {
while (!rs->eos()) {
Common::String line = rs->readLine();
if (line.hasPrefix("@frame ")) {
- if (frameno != 0) {
+ if (frameno > 0) {
// two @frame directives in a row means that the last
// subtitle should be turned *off* at the first frame
_subtitles[frameno] = "";
}
frameno = atoi(line.c_str() + 7);
- } else {
+ } else if (frameno >= 0) {
_subtitles[frameno] = line;
- frameno = 0;
+ frameno = -1;
}
}
}
-// Some fourCCs used in IFF files
-static const uint32 IFF_MAGIC = MKTAG('F', 'O', 'R', 'M');
-static const uint32 IFF_LANG = MKTAG('L', 'A', 'N', 'G');
-static const uint32 IFF_LANG_FR = MKTAG('F', 'R', 'E', 'N');
-static const uint32 IFF_LANG_EN = MKTAG('E', 'N', 'G', 'L');
-static const uint32 IFF_LANG_DE = MKTAG('G', 'E', 'R', 'M');
-
void MovieGump::loadIFFSubs(Common::SeekableReadStream *rs) {
uint32 magic = rs->readUint32BE();
if (magic != IFF_MAGIC) {
diff --git a/engines/ultima/ultima8/gumps/movie_gump.h b/engines/ultima/ultima8/gumps/movie_gump.h
index 3b99bab0cf..1e2085858e 100644
--- a/engines/ultima/ultima8/gumps/movie_gump.h
+++ b/engines/ultima/ultima8/gumps/movie_gump.h
@@ -50,7 +50,6 @@ public:
void run() override;
- // Paint the Gump
void PaintThis(RenderSurface *, int32 lerp_factor, bool scaled) override;
bool OnKeyDown(int key, int mod) override;
@@ -69,20 +68,25 @@ public:
protected:
MoviePlayer *_player;
- // Load subtitles with format detection
+ /// Load subtitles with format detection
void loadSubtitles(Common::SeekableReadStream *rs);
- // Load subtitles from a txt file (No Remorse format)
+ /// Load subtitles from a txt file (No Remorse format)
void loadTXTSubs(Common::SeekableReadStream *rs);
- // Load subtitles from a iff file (No Regret format)
+ /// Load subtitles from a iff file (No Regret format)
void loadIFFSubs(Common::SeekableReadStream *rs);
- // Update the offset of the player if a shape has been set
+ /// Update the offset of the player if a shape has been set
void ClearPlayerOffset();
+ /// Subtitles, by frame number. Only used for Crusader movies.
Common::HashMap<int, Common::String> _subtitles;
+
+ /// Last widget used for displaying subtitles.
uint16 _subtitleWidget;
+
+ /// Last frame that was displayed, so we can catch up subtitles.
int _lastFrameNo;
};
More information about the Scummvm-git-logs
mailing list