[Scummvm-git-logs] scummvm branch-2-6 -> 83ccb69a75aafc60cdc854e9af5c58755bef9713

criezy noreply at scummvm.org
Mon Oct 10 01:07:23 UTC 2022


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

Summary:
83ccb69a75 Revert "AGS: fixed object cache may sometimes keep an old dynsprite ref"


Commit: 83ccb69a75aafc60cdc854e9af5c58755bef9713
    https://github.com/scummvm/scummvm/commit/83ccb69a75aafc60cdc854e9af5c58755bef9713
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-10-10T02:06:04+01:00

Commit Message:
Revert "AGS: fixed object cache may sometimes keep an old dynsprite ref"

This reverts commit f380e3edda2f76b8618db97d559cae45d2132ba2.

The commit uses other changes that were not merged in branch-2-6 and
will therefore need to be reworked if we want it in the branch.

Changed paths:
    engines/ags/engine/ac/draw.cpp
    engines/ags/engine/ac/draw.h
    engines/ags/engine/ac/game.cpp


diff --git a/engines/ags/engine/ac/draw.cpp b/engines/ags/engine/ac/draw.cpp
index 28d82e17b70..b598a3d1c82 100644
--- a/engines/ags/engine/ac/draw.cpp
+++ b/engines/ags/engine/ac/draw.cpp
@@ -603,24 +603,19 @@ void mark_object_changed(int objid) {
 	_G(objcache)[objid].y = -9999;
 }
 
-void reset_objcache_for_sprite(int sprnum, bool deleted) {
-	// Check if this sprite is assigned to any game object, and mark these for update;
-	// if the sprite was deleted, also dispose shared textures
+void reset_objcache_for_sprite(int sprnum) {
+	// Check if this sprite is assigned to any game object, and update them if necessary
 	// room objects cache
 	if (_G(croom) != nullptr) {
 		for (size_t i = 0; i < (size_t)_G(croom)->numobj; ++i) {
-			if (_G(objcache)[i].sppic == sprnum)
+			if (_G(objs)[i].num == sprnum)
 				_G(objcache)[i].sppic = -1;
-			if (deleted && (_GP(actsps)[i].SpriteID == sprnum))
-				_GP(actsps)[i] = ObjTexture();
 		}
 	}
 	// character cache
 	for (size_t i = 0; i < (size_t)_GP(game).numcharacters; ++i) {
 		if (_GP(charcache)[i].sppic == sprnum)
 			_GP(charcache)[i].sppic = -1;
-		if (deleted && (_GP(actsps)[ACTSP_OBJSOFF + i].SpriteID == sprnum))
-			_GP(actsps)[i] = ObjTexture();
 	}
 }
 
diff --git a/engines/ags/engine/ac/draw.h b/engines/ags/engine/ac/draw.h
index 9b750871e51..6c032b51edb 100644
--- a/engines/ags/engine/ac/draw.h
+++ b/engines/ags/engine/ac/draw.h
@@ -130,7 +130,7 @@ void on_roomcamera_changed(Camera *cam);
 // Marks particular object as need to update the texture
 void mark_object_changed(int objid);
 // Resets all object caches which reference this sprite
-void reset_objcache_for_sprite(int sprnum, bool deleted);
+void reset_objcache_for_sprite(int sprnum);
 
 // whether there are currently remnants of a DisplaySpeech
 void mark_screen_dirty();
diff --git a/engines/ags/engine/ac/game.cpp b/engines/ags/engine/ac/game.cpp
index ec72f72a984..3a1908ed4ba 100644
--- a/engines/ags/engine/ac/game.cpp
+++ b/engines/ags/engine/ac/game.cpp
@@ -1336,7 +1336,7 @@ bool unserialize_audio_script_object(int index, const char *objectType, Stream *
 
 void game_sprite_updated(int sprnum) {
 	// character and object draw caches
-	reset_objcache_for_sprite(sprnum, false);
+	reset_objcache_for_sprite(sprnum);
 
 	// gui backgrounds
 	for (auto &gui : _GP(guis)) {
@@ -1365,7 +1365,7 @@ void game_sprite_updated(int sprnum) {
 
 void game_sprite_deleted(int sprnum) {
 	// character and object draw caches
-	reset_objcache_for_sprite(sprnum, true);
+	reset_objcache_for_sprite(sprnum);
 	// room object graphics
 	if (_G(croom) != nullptr) {
 		for (size_t i = 0; i < (size_t)_G(croom)->numobj; ++i) {




More information about the Scummvm-git-logs mailing list