[Scummvm-git-logs] scummvm master -> 8f0d79940c07a86e4bf488ef26b911b568b9b60f
aquadran
noreply at scummvm.org
Wed Sep 3 10:14:44 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
8f0d79940c WINTERMUTE: Sync code with original
Commit: 8f0d79940c07a86e4bf488ef26b911b568b9b60f
https://github.com/scummvm/scummvm/commit/8f0d79940c07a86e4bf488ef26b911b568b9b60f
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2025-09-03T12:14:38+02:00
Commit Message:
WINTERMUTE: Sync code with original
Changed paths:
engines/wintermute/ad/ad_actor.cpp
engines/wintermute/ad/ad_actor_3dx.cpp
engines/wintermute/ad/ad_entity.cpp
engines/wintermute/ad/ad_game.cpp
engines/wintermute/ad/ad_item.cpp
engines/wintermute/ad/ad_scene_geometry.cpp
engines/wintermute/ad/ad_talk_node.cpp
engines/wintermute/base/base_sprite.cpp
engines/wintermute/base/base_sprite.h
engines/wintermute/base/gfx/xmodel.cpp
engines/wintermute/base/sound/base_sound_manager.cpp
engines/wintermute/utils/utils.cpp
diff --git a/engines/wintermute/ad/ad_actor.cpp b/engines/wintermute/ad/ad_actor.cpp
index e91bc3d85bd..3c9d9e34a83 100644
--- a/engines/wintermute/ad/ad_actor.cpp
+++ b/engines/wintermute/ad/ad_actor.cpp
@@ -598,13 +598,13 @@ bool AdActor::update() {
}
// finished playing animation?
- if (_state == STATE_PLAYING_ANIM && _animSprite != nullptr && _animSprite->isFinished()) {
+ if (_state == STATE_PLAYING_ANIM && _animSprite != nullptr && _animSprite->_finished) {
_state = _nextState;
_nextState = STATE_READY;
_currentSprite = _animSprite;
}
- if (_state == STATE_PLAYING_ANIM_SET && _animSprite2 != nullptr && _animSprite2->isFinished()) {
+ if (_state == STATE_PLAYING_ANIM_SET && _animSprite2 != nullptr && _animSprite2->_finished) {
_state = _nextState;
_nextState = STATE_READY;
_currentSprite = _animSprite2;
@@ -653,12 +653,11 @@ bool AdActor::update() {
//////////////////////////////////////////////////////////////////////////
case STATE_TURNING_LEFT:
- if (_tempSprite2 == nullptr || _tempSprite2->isFinished()) {
- if (_dir > 0) {
+ if (_tempSprite2 == nullptr || _tempSprite2->_finished) {
+ if (_dir > 0)
_dir = (TDirection)(_dir - 1);
- } else {
+ else
_dir = (TDirection)(NUM_DIRECTIONS - 1);
- }
if (_dir == _targetDir) {
_tempSprite2 = nullptr;
@@ -690,7 +689,7 @@ bool AdActor::update() {
//////////////////////////////////////////////////////////////////////////
case STATE_TURNING_RIGHT:
- if (_tempSprite2 == nullptr || _tempSprite2->isFinished()) {
+ if (_tempSprite2 == nullptr || _tempSprite2->_finished) {
_dir = (TDirection)(_dir + 1);
if ((int)_dir >= (int)NUM_DIRECTIONS) {
@@ -757,7 +756,7 @@ bool AdActor::update() {
}
bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->getTimer()->getTime() - _sentence->_startTime);
- if (_tempSprite2 == nullptr || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
+ if (_tempSprite2 == nullptr || _tempSprite2->_finished || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
if (timeIsUp) {
_sentence->finish();
_tempSprite2 = nullptr;
@@ -825,7 +824,7 @@ bool AdActor::update() {
if (_currentSprite && !already_moved) {
_currentSprite->getCurrentFrame(_zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100, _zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100);
- if (_currentSprite->isChanged()) {
+ if (_currentSprite->_changed) {
_posX += _currentSprite->_moveX;
_posY += _currentSprite->_moveY;
afterMove();
@@ -885,7 +884,7 @@ void AdActor::getNextStep() {
}
_currentSprite->getCurrentFrame(_zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100, _zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100);
- if (!_currentSprite->isChanged()) {
+ if (!_currentSprite->_changed) {
return;
}
diff --git a/engines/wintermute/ad/ad_actor_3dx.cpp b/engines/wintermute/ad/ad_actor_3dx.cpp
index 8b3dafefd1d..f7e3ff02c45 100644
--- a/engines/wintermute/ad/ad_actor_3dx.cpp
+++ b/engines/wintermute/ad/ad_actor_3dx.cpp
@@ -1539,6 +1539,7 @@ bool AdActor3DX::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta
AdGame *adGame = (AdGame *)_gameRef;
if (isGoToNeeded(x, y)) {
+ // check for adGame->_scene first if it's null
if (adGame->_scene && adGame->_scene->_2DPathfinding) {
goTo2D(x, y);
diff --git a/engines/wintermute/ad/ad_entity.cpp b/engines/wintermute/ad/ad_entity.cpp
index fa1cfa90f00..6ff009c2602 100644
--- a/engines/wintermute/ad/ad_entity.cpp
+++ b/engines/wintermute/ad/ad_entity.cpp
@@ -651,7 +651,7 @@ bool AdEntity::update() {
}
bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->getTimer()->getTime() - _sentence->_startTime);
- if (_tempSprite2 == nullptr || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
+ if (_tempSprite2 == nullptr || _tempSprite2->_finished || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
if (timeIsUp) {
_sentence->finish();
_tempSprite2 = nullptr;
@@ -677,7 +677,7 @@ bool AdEntity::update() {
if (_currentSprite) {
_currentSprite->getCurrentFrame(_zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100);
- if (_currentSprite->isChanged()) {
+ if (_currentSprite->_changed) {
_posX += _currentSprite->_moveX;
_posY += _currentSprite->_moveY;
}
diff --git a/engines/wintermute/ad/ad_game.cpp b/engines/wintermute/ad/ad_game.cpp
index 956832cdad5..5a8b57d7f6e 100644
--- a/engines/wintermute/ad/ad_game.cpp
+++ b/engines/wintermute/ad/ad_game.cpp
@@ -1983,6 +1983,7 @@ bool AdGame::branchResponseUsed(int id) const {
char *context = _dlgPendingBranches.getSize() > 0 ? _dlgPendingBranches[_dlgPendingBranches.getSize() - 1] : nullptr;
for (int32 i = 0; i < _responsesBranch.getSize(); i++) {
if (_responsesBranch[i]->_id == id) {
+ // make sure context != nullptr
if ((context == nullptr && _responsesBranch[i]->_context == nullptr) || (context != nullptr && scumm_stricmp(context, _responsesBranch[i]->_context) == 0)) {
return true;
}
@@ -2011,6 +2012,7 @@ bool AdGame::gameResponseUsed(int id) const {
for (int32 i = 0; i < _responsesGame.getSize(); i++) {
const AdResponseContext *respContext = _responsesGame[i];
if (respContext->_id == id) {
+ // make sure context != nullptr
if ((context == nullptr && respContext->_context == nullptr) || ((context != nullptr && respContext->_context != nullptr) && (context != nullptr && scumm_stricmp(context, respContext->_context) == 0))) {
return true;
}
@@ -2026,6 +2028,7 @@ bool AdGame::resetResponse(int id) {
for (int32 i = 0; i < _responsesGame.getSize(); i++) {
if (_responsesGame[i]->_id == id) {
+ // make sure context != nullptr
if ((context == nullptr && _responsesGame[i]->_context == nullptr) || (context != nullptr && scumm_stricmp(context, _responsesGame[i]->_context) == 0)) {
delete _responsesGame[i];
_responsesGame.removeAt(i);
@@ -2036,6 +2039,7 @@ bool AdGame::resetResponse(int id) {
for (int32 i = 0; i < _responsesBranch.getSize(); i++) {
if (_responsesBranch[i]->_id == id) {
+ // make sure context != nullptr
if ((context == nullptr && _responsesBranch[i]->_context == nullptr) || (context != nullptr && scumm_stricmp(context, _responsesBranch[i]->_context) == 0)) {
delete _responsesBranch[i];
_responsesBranch.removeAt(i);
diff --git a/engines/wintermute/ad/ad_item.cpp b/engines/wintermute/ad/ad_item.cpp
index f2fc57b0afc..6b39b4010ac 100644
--- a/engines/wintermute/ad/ad_item.cpp
+++ b/engines/wintermute/ad/ad_item.cpp
@@ -337,7 +337,7 @@ bool AdItem::update() {
}
// finished playing animation?
- if (_state == STATE_PLAYING_ANIM && _animSprite != nullptr && _animSprite->isFinished()) {
+ if (_state == STATE_PLAYING_ANIM && _animSprite != nullptr && _animSprite->_finished) {
_state = STATE_READY;
_currentSprite = _animSprite;
}
@@ -376,7 +376,7 @@ bool AdItem::update() {
}
bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->getTimer()->getTime() - _sentence->_startTime);
- if (_tempSprite2 == nullptr || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
+ if (_tempSprite2 == nullptr || _tempSprite2->_finished || (/*_tempSprite2->_looping &&*/ timeIsUp)) {
if (timeIsUp) {
_sentence->finish();
_tempSprite2 = nullptr;
diff --git a/engines/wintermute/ad/ad_scene_geometry.cpp b/engines/wintermute/ad/ad_scene_geometry.cpp
index 272802a4e96..d55ec10d1ea 100644
--- a/engines/wintermute/ad/ad_scene_geometry.cpp
+++ b/engines/wintermute/ad/ad_scene_geometry.cpp
@@ -1011,7 +1011,6 @@ int AdSceneGeometry::compareLights(const void *obj1, const void *obj2) {
//////////////////////////////////////////////////////////////////////////
bool AdSceneGeometry::correctTargetPoint(const DXVector3 &source, DXVector3 *target) {
- // the source parameter is not even used in wme3d
int32 i;
int32 MaxLen = 1000;
int32 Step = 10;
diff --git a/engines/wintermute/ad/ad_talk_node.cpp b/engines/wintermute/ad/ad_talk_node.cpp
index d47b0709d72..9d34c8ccfdd 100644
--- a/engines/wintermute/ad/ad_talk_node.cpp
+++ b/engines/wintermute/ad/ad_talk_node.cpp
@@ -263,9 +263,9 @@ bool AdTalkNode::loadSprite() {
bool AdTalkNode::isInTimeInterval(uint32 time, TDirection dir) {
if (time >= _startTime) {
if (_playToEnd) {
- if ((_spriteFilename && _sprite == nullptr) || (_sprite && _sprite->isFinished() == false)) {
+ if ((_spriteFilename && _sprite == nullptr) || (_sprite && _sprite->_finished == false)) {
return true;
- } else if ((_spriteSetFilename && _spriteSet == nullptr) || (_spriteSet && _spriteSet->getSprite(dir) && _spriteSet->getSprite(dir)->isFinished() == false)) {
+ } else if ((_spriteSetFilename && _spriteSet == nullptr) || (_spriteSet && _spriteSet->getSprite(dir) && _spriteSet->getSprite(dir)->_finished == false)) {
return true;
} else {
return false;
diff --git a/engines/wintermute/base/base_sprite.cpp b/engines/wintermute/base/base_sprite.cpp
index b4fbda15865..0afbe1c3c0f 100644
--- a/engines/wintermute/base/base_sprite.cpp
+++ b/engines/wintermute/base/base_sprite.cpp
@@ -122,14 +122,6 @@ bool BaseSprite::draw(int x, int y, BaseObject *registerOwner, float zoomX, floa
return display(x, y, registerOwner, zoomX, zoomY, alpha);
}
-bool BaseSprite::isChanged() {
- return _changed;
-}
-
-bool BaseSprite::isFinished() {
- return _finished;
-}
-
//////////////////////////////////////////////////////////////////////
bool BaseSprite::loadFile(const Common::String &filename, int lifeTime, TSpriteCacheType cacheType) {
if (!BaseFileManager::getEngineInstance()->hasFile(filename)) {
diff --git a/engines/wintermute/base/base_sprite.h b/engines/wintermute/base/base_sprite.h
index bfa55ad9e6d..795031acbf9 100644
--- a/engines/wintermute/base/base_sprite.h
+++ b/engines/wintermute/base/base_sprite.h
@@ -63,9 +63,9 @@ public:
bool _continuous;
void reset();
BaseObject *_owner;
- bool isChanged();
+ bool _changed;
bool _paused;
- bool isFinished();
+ bool _finished;
bool loadBuffer(char *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
bool loadFile(const Common::String &filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
uint32 _lastFrameTime;
@@ -84,9 +84,6 @@ public:
bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
const char *scToString() override;
Common::String debuggerToString() const override;
-private:
- bool _changed;
- bool _finished;
};
} // End of namespace Wintermute
diff --git a/engines/wintermute/base/gfx/xmodel.cpp b/engines/wintermute/base/gfx/xmodel.cpp
index a7f3f73bd1b..06423f9c570 100644
--- a/engines/wintermute/base/gfx/xmodel.cpp
+++ b/engines/wintermute/base/gfx/xmodel.cpp
@@ -395,7 +395,7 @@ bool XModel::playAnim(int channel, const Common::String &name, uint32 transition
AnimationSet *anim = getAnimationSetByName(name);
if (anim) {
char *currentAnim = _channels[channel]->getName();
- if (_owner && currentAnim) {
+ if (_owner && currentAnim && !name.empty()) {
transitionTime = _owner->getAnimTransitionTime(currentAnim, const_cast<char *>(name.c_str()));
}
diff --git a/engines/wintermute/base/sound/base_sound_manager.cpp b/engines/wintermute/base/sound/base_sound_manager.cpp
index 07f27d0c567..8f065f61cef 100644
--- a/engines/wintermute/base/sound/base_sound_manager.cpp
+++ b/engines/wintermute/base/sound/base_sound_manager.cpp
@@ -138,8 +138,6 @@ BaseSoundBuffer *BaseSoundMgr::addSound(const Common::String &filename, Audio::M
_sounds.add(sound);
return sound;
-
- return nullptr;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/utils/utils.cpp b/engines/wintermute/utils/utils.cpp
index 5e4508ae39d..cfcc7876087 100644
--- a/engines/wintermute/utils/utils.cpp
+++ b/engines/wintermute/utils/utils.cpp
@@ -414,7 +414,7 @@ static void quickSort(void *base, uint32 num, uint32 size,
void qsort_msvc(void *base, uint32 num, uint32 size,
int32 (*compare)(const void *, const void *)) {
- if (base == NULL || num == 0)
+ if (base == nullptr || num == 0)
return;
quickSort(base, num, size, compare);
More information about the Scummvm-git-logs
mailing list