[Scummvm-git-logs] scummvm master -> e83af482649b3d6f21d54ecbaab3e039ff39d7c9
OMGPizzaGuy
noreply at scummvm.org
Sat May 4 20:09:55 UTC 2024
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
bd382affee ULTIMA8: Prevent overlapping barks per actor.
e83af48264 ULTIMA8: Override low talkspeed when not in stasis.
Commit: bd382affee98e8041430f09d3e4628a832c31cf5
https://github.com/scummvm/scummvm/commit/bd382affee98e8041430f09d3e4628a832c31cf5
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2024-05-04T15:08:59-05:00
Commit Message:
ULTIMA8: Prevent overlapping barks per actor.
Track the current bark gump per item and close previous before starting a new one. Barks are also dismissed when item leave fast area. Fixes #15103
Changed paths:
engines/ultima/ultima8/gumps/bark_gump.cpp
engines/ultima/ultima8/gumps/bark_gump.h
engines/ultima/ultima8/world/item.cpp
engines/ultima/ultima8/world/item.h
diff --git a/engines/ultima/ultima8/gumps/bark_gump.cpp b/engines/ultima/ultima8/gumps/bark_gump.cpp
index 180d6efe067..ded3021bd8c 100644
--- a/engines/ultima/ultima8/gumps/bark_gump.cpp
+++ b/engines/ultima/ultima8/gumps/bark_gump.cpp
@@ -26,6 +26,7 @@
#include "ultima/ultima8/kernel/kernel.h"
#include "ultima/ultima8/audio/audio_process.h"
#include "ultima/ultima8/world/get_object.h"
+#include "ultima/ultima8/world/item.h"
namespace Ultima {
namespace Ultima8 {
@@ -110,6 +111,15 @@ void BarkGump::InitGump(Gump *newparent, bool take_focus) {
ItemRelativeGump::InitGump(newparent, take_focus);
}
+
+void BarkGump::Close(bool no_del) {
+ Item *item = getItem(_owner);
+ if (item)
+ item->clearBark();
+
+ ItemRelativeGump::Close(no_del);
+}
+
bool BarkGump::NextText() {
TextWidget *widget = dynamic_cast<TextWidget *>(getGump(_textWidget));
assert(widget);
diff --git a/engines/ultima/ultima8/gumps/bark_gump.h b/engines/ultima/ultima8/gumps/bark_gump.h
index 9cf0a1c5324..43a65690bce 100644
--- a/engines/ultima/ultima8/gumps/bark_gump.h
+++ b/engines/ultima/ultima8/gumps/bark_gump.h
@@ -59,6 +59,9 @@ public:
// Init the gump, call after construction
void InitGump(Gump *newparent, bool take_focus = true) override;
+ // Close the gump
+ void Close(bool no_del = false) override;
+
/// Get the font that should be used from dialog from this actor
static int dialogFontForActor(uint16 actor);
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index c4ab0711361..035afed529e 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -77,7 +77,7 @@ Item::Item()
_flags(0), _quality(0), _npcNum(0), _mapNum(0),
_extendedFlags(0), _parent(0),
_cachedShape(nullptr), _cachedShapeInfo(nullptr),
- _gump(0), _gravityPid(0), _lastSetup(0),
+ _gump(0), _bark(0), _gravityPid(0), _lastSetup(0),
_ix(0), _iy(0), _iz(0), _damagePoints(1) {
}
@@ -1942,9 +1942,9 @@ void Item::leaveFastArea() {
callUsecodeEvent_leaveFastArea();
// If we have a gump open, close it (unless we're in a container)
- if (!_parent && (_flags & FLG_GUMP_OPEN)) {
- Gump *g = Ultima8Engine::get_instance()->getGump(_gump);
- if (g) g->Close();
+ if (!_parent) {
+ closeGump();
+ closeBark();
}
// Unset the flag
@@ -2027,6 +2027,42 @@ void Item::clearGump() {
_flags &= ~FLG_GUMP_OPEN;
}
+ProcId Item::bark(const Std::string &msg, ObjId id) {
+ closeBark();
+
+ uint32 shapenum = getShape();
+ if (id == 666)
+ shapenum = 666; // Hack for guardian barks
+
+ Gump *gump = new BarkGump(getObjId(), msg, shapenum);
+ _bark = gump->getObjId();
+
+ // Adds talk animations when bark is active.
+ // FIXME: This also affects bark after look unlike original game
+ if (getObjId() < 256) { // CONSTANT!
+ GumpNotifyProcess *notifyproc;
+ notifyproc = new ActorBarkNotifyProcess(getObjId());
+ Kernel::get_instance()->addProcess(notifyproc);
+ gump->SetNotifyProcess(notifyproc);
+ }
+
+ gump->InitGump(0);
+
+ return gump->GetNotifyProcess()->getPid();
+}
+
+void Item::closeBark() {
+ Gump *gump = Ultima8Engine::get_instance()->getGump(_bark);
+ if (gump)
+ gump->Close();
+
+ clearBark();
+}
+
+void Item::clearBark() {
+ _bark = 0;
+}
+
int32 Item::ascend(int delta) {
debugC(kDebugObject, "Ascend: _objId=%u, delta=%d", getObjId(), delta);
@@ -2613,6 +2649,9 @@ void Item::saveData(Common::WriteStream *ws) {
}
if ((_flags & FLG_ETHEREAL) && (_flags & (FLG_CONTAINED | FLG_EQUIPPED)))
ws->writeUint16LE(_parent);
+
+ // TODO: Consider saving this
+ // ws->writeUint16LE(_bark);
}
bool Item::loadData(Common::ReadStream *rs, uint32 version) {
@@ -2641,6 +2680,8 @@ bool Item::loadData(Common::ReadStream *rs, uint32 version) {
else
_parent = 0;
+ _bark = 0;
+
//!! hackish...
if (_extendedFlags & EXT_INCURMAP) {
World::get_instance()->getCurrentMap()->addItem(this);
@@ -3033,21 +3074,7 @@ uint32 Item::I_bark(const uint8 *args, unsigned int /*argsize*/) {
return 0;
}
- uint32 shapenum = item->getShape();
- if (id_item == 666)
- shapenum = 666; // Hack for guardian barks
- Gump *gump = new BarkGump(item->getObjId(), str, shapenum);
-
- if (item->getObjId() < 256) { // CONSTANT!
- GumpNotifyProcess *notifyproc;
- notifyproc = new ActorBarkNotifyProcess(item->getObjId());
- Kernel::get_instance()->addProcess(notifyproc);
- gump->SetNotifyProcess(notifyproc);
- }
-
- gump->InitGump(0);
-
- return gump->GetNotifyProcess()->getPid();
+ return item->bark(str, id_item);
}
uint32 Item::I_look(const uint8 *args, unsigned int /*argsize*/) {
@@ -3130,6 +3157,10 @@ uint32 Item::I_ask(const uint8 *args, unsigned int /*argsize*/) {
if (!answers) return 0;
+ Actor *actor = getMainActor();
+ if (actor)
+ actor->closeBark();
+
// Use AskGump
Gump *_gump = new AskGump(1, answers);
_gump->InitGump(0);
diff --git a/engines/ultima/ultima8/world/item.h b/engines/ultima/ultima8/world/item.h
index 67a90f5968d..f897ce1e114 100644
--- a/engines/ultima/ultima8/world/item.h
+++ b/engines/ultima/ultima8/world/item.h
@@ -265,6 +265,12 @@ public:
//! Close this Item's gump, if any
void closeGump();
+ ProcId bark(const Std::string &msg, ObjId id = 0);
+ //! Call this to notify the Item's open bark has closed.
+ void clearBark(); // set bark to 0
+ //! Close this Item's bark, if any
+ void closeBark();
+
//! Destroy self.
virtual void destroy(bool delnow = false);
@@ -635,7 +641,8 @@ protected:
Lerped _lNext; // Next (current) state (relative to camera)
int32 _ix, _iy, _iz; // Interpolated position in camera space
- ObjId _gump; // Item's gump
+ ObjId _gump; // Item's container gump
+ ObjId _bark; // Item's bark gump
ProcId _gravityPid; // Item's GravityTracker (or 0)
uint8 _damagePoints; // Damage points, used for item damage in Crusader
Commit: e83af482649b3d6f21d54ecbaab3e039ff39d7c9
https://github.com/scummvm/scummvm/commit/e83af482649b3d6f21d54ecbaab3e039ff39d7c9
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2024-05-04T15:09:00-05:00
Commit Message:
ULTIMA8: Override low talkspeed when not in stasis.
Text still remains on screen for a very long time, but needed as every item look description would stay on screen until dismissed.
Changed paths:
engines/ultima/ultima8/gumps/bark_gump.cpp
diff --git a/engines/ultima/ultima8/gumps/bark_gump.cpp b/engines/ultima/ultima8/gumps/bark_gump.cpp
index ded3021bd8c..b59505d1d16 100644
--- a/engines/ultima/ultima8/gumps/bark_gump.cpp
+++ b/engines/ultima/ultima8/gumps/bark_gump.cpp
@@ -27,6 +27,7 @@
#include "ultima/ultima8/audio/audio_process.h"
#include "ultima/ultima8/world/get_object.h"
#include "ultima/ultima8/world/item.h"
+#include "ultima/ultima8/ultima8.h"
namespace Ultima {
namespace Ultima8 {
@@ -77,6 +78,11 @@ int BarkGump::dialogFontForActor(uint16 actor) {
void BarkGump::InitGump(Gump *newparent, bool take_focus) {
int fontnum = dialogFontForActor(_owner);
+ //.Set a reasonable minimum speed for text speed when not in stasis
+ if (_talkSpeed < 10 && !Ultima8Engine::get_instance()->isAvatarInStasis()) {
+ _talkSpeed = 10;
+ }
+
// This is a hack. We init the gump twice...
ItemRelativeGump::InitGump(newparent, take_focus);
More information about the Scummvm-git-logs
mailing list