From 97c12e8435abdc5e51b390f07600b3c4bb0517c0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 5 May 2022 20:35:49 -0700 Subject: [PATCH] AGS: Merged Character and ObjectCache structs, and hid in draw.cpp From upstream 753d47d975b10666702c47a22cbc4e68847787f1 --- engines/ags/engine/ac/character_cache.h | 48 ------- engines/ags/engine/ac/draw.cpp | 148 ++++++++++++---------- engines/ags/engine/ac/draw.h | 16 ++- engines/ags/engine/ac/drawing_surface.cpp | 2 - engines/ags/engine/ac/dynamic_sprite.cpp | 2 - engines/ags/engine/ac/game.cpp | 32 +---- engines/ags/engine/ac/global_object.cpp | 1 - engines/ags/engine/ac/object.cpp | 1 - engines/ags/engine/ac/object_cache.h | 42 ------ engines/ags/engine/ac/room.cpp | 2 - engines/ags/engine/game/game_init.cpp | 1 - engines/ags/engine/main/engine.cpp | 1 - engines/ags/engine/main/game_file.cpp | 1 - engines/ags/globals.cpp | 4 +- engines/ags/globals.h | 2 +- engines/ags/plugins/ags_plugin.cpp | 2 - 16 files changed, 105 insertions(+), 200 deletions(-) delete mode 100644 engines/ags/engine/ac/character_cache.h delete mode 100644 engines/ags/engine/ac/object_cache.h diff --git a/engines/ags/engine/ac/character_cache.h b/engines/ags/engine/ac/character_cache.h deleted file mode 100644 index 925075542b1..00000000000 --- a/engines/ags/engine/ac/character_cache.h +++ /dev/null @@ -1,48 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#ifndef AGS_ENGINE_AC_CHARACTER_CACHE_H -#define AGS_ENGINE_AC_CHARACTER_CACHE_H - -namespace AGS3 { - -namespace AGS { -namespace Shared { -class Bitmap; -} // namespace Shared -} // namespace AGS - -using namespace AGS; // FIXME later - -// stores cached info about the character -struct CharacterCache { - Shared::Bitmap *image = nullptr; - int sppic = 0; - int scaling = 0; - int inUse = 0; - short tintredwas = 0, tintgrnwas = 0, tintbluwas = 0, tintamntwas = 0; - short lightlevwas = 0, tintlightwas = 0; - // no mirroredWas is required, since the code inverts the sprite number -}; - -} // namespace AGS3 - -#endif diff --git a/engines/ags/engine/ac/draw.cpp b/engines/ags/engine/ac/draw.cpp index 696d988aa82..2416d54973a 100644 --- a/engines/ags/engine/ac/draw.cpp +++ b/engines/ags/engine/ac/draw.cpp @@ -1,4 +1,4 @@ -/* ScummVM - Graphic Adventure Engine + /* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -27,7 +27,6 @@ #include "ags/shared/util/compress.h" #include "ags/shared/util/wgt2_allg.h" #include "ags/shared/ac/view.h" -#include "ags/engine/ac/character_cache.h" #include "ags/engine/ac/character_extras.h" #include "ags/shared/ac/character_info.h" #include "ags/engine/ac/display.h" @@ -42,7 +41,6 @@ #include "ags/engine/ac/gui.h" #include "ags/engine/ac/mouse.h" #include "ags/engine/ac/move_list.h" -#include "ags/engine/ac/object_cache.h" #include "ags/engine/ac/overlay.h" #include "ags/engine/ac/sys_events.h" #include "ags/engine/ac/room_object.h" @@ -433,10 +431,10 @@ void dispose_room_drawdata() { void clear_drawobj_cache() { // clear the character cache for (auto &cc : _GP(charcache)) { - if (cc.inUse) + if (cc.in_use) delete cc.image; cc.image = nullptr; - cc.inUse = 0; + cc.in_use = false; } // clear the object cache @@ -600,7 +598,23 @@ void on_roomcamera_changed(Camera *cam) { } void mark_object_changed(int objid) { - _G(objcache)[objid].ywas = -9999; + _G(objcache)[objid].y = -9999; +} + +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(objs)[i].num == sprnum) + _G(objcache)[i].sppic = -1; + } + } + // 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; + } } void mark_screen_dirty() { @@ -1201,14 +1215,14 @@ int construct_object_gfx(int aa, int *drawnWidth, int *drawnHeight, bool alwaysU (_G(objcache)[aa].sppic == _G(objs)[aa].num) && (actsp.Bmp != nullptr)) { // HW acceleration - _G(objcache)[aa].tintamntwas = tint_level; - _G(objcache)[aa].tintredwas = tint_red; - _G(objcache)[aa].tintgrnwas = tint_green; - _G(objcache)[aa].tintbluwas = tint_blue; - _G(objcache)[aa].tintlightwas = tint_light; - _G(objcache)[aa].lightlevwas = light_level; - _G(objcache)[aa].zoomWas = zoom_level; - _G(objcache)[aa].mirroredWas = isMirrored; + _G(objcache)[aa].tintamnt = tint_level; + _G(objcache)[aa].tintr = tint_red; + _G(objcache)[aa].tintg = tint_green; + _G(objcache)[aa].tintb = tint_blue; + _G(objcache)[aa].tintlight = tint_light; + _G(objcache)[aa].lightlev = light_level; + _G(objcache)[aa].zoom = zoom_level; + _G(objcache)[aa].mirrored = isMirrored; return 1; } @@ -1222,24 +1236,24 @@ int construct_object_gfx(int aa, int *drawnWidth, int *drawnHeight, bool alwaysU // If we have the image cached, use it if ((_G(objcache)[aa].image != nullptr) && (_G(objcache)[aa].sppic == _G(objs)[aa].num) && - (_G(objcache)[aa].tintamntwas == tint_level) && - (_G(objcache)[aa].tintlightwas == tint_light) && - (_G(objcache)[aa].tintredwas == tint_red) && - (_G(objcache)[aa].tintgrnwas == tint_green) && - (_G(objcache)[aa].tintbluwas == tint_blue) && - (_G(objcache)[aa].lightlevwas == light_level) && - (_G(objcache)[aa].zoomWas == zoom_level) && - (_G(objcache)[aa].mirroredWas == isMirrored)) { + (_G(objcache)[aa].tintamnt == tint_level) && + (_G(objcache)[aa].tintlight == tint_light) && + (_G(objcache)[aa].tintr == tint_red) && + (_G(objcache)[aa].tintg == tint_green) && + (_G(objcache)[aa].tintb == tint_blue) && + (_G(objcache)[aa].lightlev == light_level) && + (_G(objcache)[aa].zoom == zoom_level) && + (_G(objcache)[aa].mirrored == isMirrored)) { // the image is the same, we can use it cached! if ((_G(walkBehindMethod) != DrawOverCharSprite) && (actsp.Bmp != nullptr)) return 1; // Check if the X & Y co-ords are the same, too -- if so, there // is scope for further optimisations - if ((_G(objcache)[aa].xwas == _G(objs)[aa].x) && - (_G(objcache)[aa].ywas == _G(objs)[aa].y) && - (actsp.Bmp != nullptr) && - (_G(walk_behind_baselines_changed) == 0)) + if ((_G(objcache)[aa].x == _G(objs)[aa].x) && + (_G(objcache)[aa].y == _G(objs)[aa].y) && + (actsp.Bmp != nullptr) && + (_G(walk_behind_baselines_changed) == 0)) return 1; recycle_bitmap(actsp.Bmp, coldept, sprwidth, sprheight); actsp.Bmp->Blit(_G(objcache)[aa].image, 0, 0, 0, 0, _G(objcache)[aa].image->GetWidth(), _G(objcache)[aa].image->GetHeight()); @@ -1278,14 +1292,14 @@ int construct_object_gfx(int aa, int *drawnWidth, int *drawnHeight, bool alwaysU // Create the cached image and store it _G(objcache)[aa].image->Blit(actsp.Bmp.get(), 0, 0); _G(objcache)[aa].sppic = _G(objs)[aa].num; - _G(objcache)[aa].tintamntwas = tint_level; - _G(objcache)[aa].tintredwas = tint_red; - _G(objcache)[aa].tintgrnwas = tint_green; - _G(objcache)[aa].tintbluwas = tint_blue; - _G(objcache)[aa].tintlightwas = tint_light; - _G(objcache)[aa].lightlevwas = light_level; - _G(objcache)[aa].zoomWas = zoom_level; - _G(objcache)[aa].mirroredWas = isMirrored; + _G(objcache)[aa].tintamnt = tint_level; + _G(objcache)[aa].tintr = tint_red; + _G(objcache)[aa].tintg = tint_green; + _G(objcache)[aa].tintb = tint_blue; + _G(objcache)[aa].tintlight = tint_light; + _G(objcache)[aa].lightlev = light_level; + _G(objcache)[aa].zoom = zoom_level; + _G(objcache)[aa].mirrored = isMirrored; return 0; } @@ -1307,8 +1321,8 @@ void prepare_objects_for_drawing() { auto &actsp = _GP(actsps)[useindx]; // update the cache for next time - _G(objcache)[aa].xwas = _G(objs)[aa].x; - _G(objcache)[aa].ywas = _G(objs)[aa].y; + _G(objcache)[aa].x = _G(objs)[aa].x; + _G(objcache)[aa].y = _G(objs)[aa].y; int atxp = data_to_game_coord(_G(objs)[aa].x); int atyp = data_to_game_coord(_G(objs)[aa].y) - tehHeight; @@ -1328,19 +1342,19 @@ void prepare_objects_for_drawing() { } if (_G(gfxDriver)->HasAcceleratedTransform()) { - actsp.Ddb->SetFlippedLeftRight(_G(objcache)[aa].mirroredWas != 0); + actsp.Ddb->SetFlippedLeftRight(_G(objcache)[aa].mirrored); actsp.Ddb->SetStretch(_G(objs)[aa].last_width, _G(objs)[aa].last_height); - actsp.Ddb->SetTint(_G(objcache)[aa].tintredwas, _G(objcache)[aa].tintgrnwas, _G(objcache)[aa].tintbluwas, (_G(objcache)[aa].tintamntwas * 256) / 100); + actsp.Ddb->SetTint(_G(objcache)[aa].tintr, _G(objcache)[aa].tintg, _G(objcache)[aa].tintb, (_G(objcache)[aa].tintamnt * 256) / 100); - if (_G(objcache)[aa].tintamntwas > 0) { - if (_G(objcache)[aa].tintlightwas == 0) // luminance of 0 -- pass 1 to enable + if (_G(objcache)[aa].tintamnt > 0) { + if (_G(objcache)[aa].tintlight == 0) // luminance of 0 -- pass 1 to enable actsp.Ddb->SetLightLevel(1); - else if (_G(objcache)[aa].tintlightwas < 250) - actsp.Ddb->SetLightLevel(_G(objcache)[aa].tintlightwas); + else if (_G(objcache)[aa].tintlight < 250) + actsp.Ddb->SetLightLevel(_G(objcache)[aa].tintlight); else actsp.Ddb->SetLightLevel(0); - } else if (_G(objcache)[aa].lightlevwas != 0) - actsp.Ddb->SetLightLevel((_G(objcache)[aa].lightlevwas * 25) / 10 + 256); + } else if (_G(objcache)[aa].lightlev != 0) + actsp.Ddb->SetLightLevel((_G(objcache)[aa].lightlev * 25) / 10 + 256); else actsp.Ddb->SetLightLevel(0); } @@ -1494,27 +1508,27 @@ void prepare_characters_for_drawing() { // if the character was the same sprite and scaling last time, // just use the cached image - if ((_GP(charcache)[aa].inUse) && - (_GP(charcache)[aa].sppic == specialpic) && - (_GP(charcache)[aa].scaling == zoom_level) && - (_GP(charcache)[aa].tintredwas == tint_red) && - (_GP(charcache)[aa].tintgrnwas == tint_green) && - (_GP(charcache)[aa].tintbluwas == tint_blue) && - (_GP(charcache)[aa].tintamntwas == tint_amount) && - (_GP(charcache)[aa].tintlightwas == tint_light) && - (_GP(charcache)[aa].lightlevwas == light_level)) { + if ((_GP(charcache)[aa].in_use) && + (_GP(charcache)[aa].sppic == specialpic) && + (_GP(charcache)[aa].zoom == zoom_level) && + (_GP(charcache)[aa].tintr == tint_red) && + (_GP(charcache)[aa].tintg == tint_green) && + (_GP(charcache)[aa].tintb == tint_blue) && + (_GP(charcache)[aa].tintamnt == tint_amount) && + (_GP(charcache)[aa].tintlight == tint_light) && + (_GP(charcache)[aa].lightlev == light_level)) { if (_G(walkBehindMethod) == DrawOverCharSprite) { recycle_bitmap(actsp.Bmp, _GP(charcache)[aa].image->GetColorDepth(), _GP(charcache)[aa].image->GetWidth(), _GP(charcache)[aa].image->GetHeight()); actsp.Bmp->Blit(_GP(charcache)[aa].image, 0, 0); } else { usingCachedImage = true; } - } else if ((_GP(charcache)[aa].inUse) && - (_GP(charcache)[aa].sppic == specialpic) && - (_G(gfxDriver)->HasAcceleratedTransform())) { + } else if ((_GP(charcache)[aa].in_use) && + (_GP(charcache)[aa].sppic == specialpic) && + (_G(gfxDriver)->HasAcceleratedTransform())) { usingCachedImage = true; - } else if (_GP(charcache)[aa].inUse) { - _GP(charcache)[aa].inUse = 0; + } else if (_GP(charcache)[aa].in_use) { + _GP(charcache)[aa].in_use = false; } _G(our_eip) = 3332; @@ -1545,17 +1559,17 @@ void prepare_characters_for_drawing() { // adjust the Y positioning for the character's Z co-ord - data_to_game_coord(chin->z); - _GP(charcache)[aa].scaling = zoom_level; + _GP(charcache)[aa].zoom = zoom_level; _GP(charcache)[aa].sppic = specialpic; - _GP(charcache)[aa].tintredwas = tint_red; - _GP(charcache)[aa].tintgrnwas = tint_green; - _GP(charcache)[aa].tintbluwas = tint_blue; - _GP(charcache)[aa].tintamntwas = tint_amount; - _GP(charcache)[aa].tintlightwas = tint_light; - _GP(charcache)[aa].lightlevwas = light_level; + _GP(charcache)[aa].tintr = tint_red; + _GP(charcache)[aa].tintg = tint_green; + _GP(charcache)[aa].tintb = tint_blue; + _GP(charcache)[aa].tintamnt = tint_amount; + _GP(charcache)[aa].tintlight = tint_light; + _GP(charcache)[aa].lightlev = light_level; // If cache needs to be re-drawn - if (!_GP(charcache)[aa].inUse) { + if (!_GP(charcache)[aa].in_use) { // create the base sprite in _GP(actsps)[useindx], which will // be scaled and/or flipped, as appropriate @@ -1587,7 +1601,7 @@ void prepare_characters_for_drawing() { } // update the character cache with the new image - _GP(charcache)[aa].inUse = 1; + _GP(charcache)[aa].in_use = true; _GP(charcache)[aa].image = recycle_bitmap(_GP(charcache)[aa].image, coldept, actsp.Bmp->GetWidth(), actsp.Bmp->GetHeight()); _GP(charcache)[aa].image->Blit(actsp.Bmp.get(), 0, 0); diff --git a/engines/ags/engine/ac/draw.h b/engines/ags/engine/ac/draw.h index 599ea9e4b38..c0bd6390e9f 100644 --- a/engines/ags/engine/ac/draw.h +++ b/engines/ags/engine/ac/draw.h @@ -84,6 +84,18 @@ struct ObjTexture { ObjTexture &operator =(ObjTexture &&o); }; +// ObjectCache stores cached object data, used to determine +// if active sprite / texture should be reconstructed +struct ObjectCache { + Shared::Bitmap *image = nullptr; + bool in_use = false; + int sppic = 0; + short tintr = 0, tintg = 0, tintb = 0, tintamnt = 0, tintlight = 0; + short lightlev = 0, zoom = 0; + bool mirrored = 0; + int x = 0, y = 0; +}; + // Converts AGS color index to the actual bitmap color using game's color depth int MakeColor(int color_index); @@ -116,8 +128,10 @@ void on_roomviewport_changed(Viewport *view); void detect_roomviewport_overlaps(size_t z_index); // Updates drawing settings if room camera's size has changed void on_roomcamera_changed(Camera *cam); -// Marks particular object as need too update the texture +// 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); // whether there are currently remnants of a DisplaySpeech void mark_screen_dirty(); diff --git a/engines/ags/engine/ac/drawing_surface.cpp b/engines/ags/engine/ac/drawing_surface.cpp index 14355bccaaf..0484e87d09e 100644 --- a/engines/ags/engine/ac/drawing_surface.cpp +++ b/engines/ags/engine/ac/drawing_surface.cpp @@ -22,13 +22,11 @@ #include "ags/engine/ac/draw.h" #include "ags/engine/ac/drawing_surface.h" #include "ags/shared/ac/common.h" -#include "ags/engine/ac/character_cache.h" #include "ags/engine/ac/display.h" #include "ags/engine/ac/game.h" #include "ags/shared/ac/game_setup_struct.h" #include "ags/engine/ac/game_state.h" #include "ags/engine/ac/global_translation.h" -#include "ags/engine/ac/object_cache.h" #include "ags/engine/ac/room_object.h" #include "ags/engine/ac/room_status.h" #include "ags/engine/ac/string.h" diff --git a/engines/ags/engine/ac/dynamic_sprite.cpp b/engines/ags/engine/ac/dynamic_sprite.cpp index de63ee39363..e6b3532bf17 100644 --- a/engines/ags/engine/ac/dynamic_sprite.cpp +++ b/engines/ags/engine/ac/dynamic_sprite.cpp @@ -22,7 +22,6 @@ #include "ags/lib/std/math.h" #include "ags/engine/ac/dynamic_sprite.h" #include "ags/shared/ac/common.h" -#include "ags/engine/ac/character_cache.h" #include "ags/engine/ac/draw.h" #include "ags/engine/ac/game.h" #include "ags/shared/ac/game_setup_struct.h" @@ -30,7 +29,6 @@ #include "ags/engine/ac/global_dynamic_sprite.h" #include "ags/engine/ac/global_game.h" #include "ags/engine/ac/math.h" // M_PI -#include "ags/engine/ac/object_cache.h" #include "ags/engine/ac/path_helper.h" #include "ags/engine/ac/room_object.h" #include "ags/engine/ac/room_status.h" diff --git a/engines/ags/engine/ac/game.cpp b/engines/ags/engine/ac/game.cpp index ac08772fc9f..3fcb319b723 100644 --- a/engines/ags/engine/ac/game.cpp +++ b/engines/ags/engine/ac/game.cpp @@ -26,7 +26,6 @@ #include "ags/engine/ac/audio_channel.h" #include "ags/engine/ac/button.h" #include "ags/engine/ac/character.h" -#include "ags/engine/ac/character_cache.h" #include "ags/shared/ac/dialog_topic.h" #include "ags/engine/ac/draw.h" #include "ags/engine/ac/dynamic_sprite.h" @@ -46,7 +45,6 @@ #include "ags/engine/ac/lip_sync.h" #include "ags/engine/ac/mouse.h" #include "ags/engine/ac/move_list.h" -#include "ags/engine/ac/object_cache.h" #include "ags/engine/ac/overlay.h" #include "ags/engine/ac/path_helper.h" #include "ags/engine/ac/sys_events.h" @@ -1342,19 +1340,9 @@ bool unserialize_audio_script_object(int index, const char *objectType, Stream * } void game_sprite_updated(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(objs)[i].num == sprnum) - _G(objcache)[i].sppic = -1; - } - } - // 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; - } + // character and object draw caches + reset_objcache_for_sprite(sprnum); + // gui backgrounds for (size_t i = 0; i < (size_t)_GP(game).numgui; ++i) { if (_GP(guis)[i].BgImage == sprnum) { @@ -1376,21 +1364,15 @@ void game_sprite_updated(int sprnum) { } void game_sprite_deleted(int sprnum) { - // Check if this sprite is assigned to any game object, and update them if necessary - // room objects and their cache + // character and object draw caches + reset_objcache_for_sprite(sprnum); + // room object graphics if (_G(croom) != nullptr) { for (size_t i = 0; i < (size_t)_G(croom)->numobj; ++i) { - if (_G(objs)[i].num == sprnum) { + if (_G(objs)[i].num == sprnum) _G(objs)[i].num = 0; - _G(objcache)[i].sppic = -1; - } } } - // 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; - } // gui backgrounds for (size_t i = 0; i < (size_t)_GP(game).numgui; ++i) { if (_GP(guis)[i].BgImage == sprnum) { diff --git a/engines/ags/engine/ac/global_object.cpp b/engines/ags/engine/ac/global_object.cpp index a7067fc827d..9c2eb1caf95 100644 --- a/engines/ags/engine/ac/global_object.cpp +++ b/engines/ags/engine/ac/global_object.cpp @@ -31,7 +31,6 @@ #include "ags/engine/ac/global_character.h" #include "ags/engine/ac/global_translation.h" #include "ags/engine/ac/object.h" -#include "ags/engine/ac/object_cache.h" #include "ags/engine/ac/properties.h" #include "ags/engine/ac/room_object.h" #include "ags/engine/ac/room_status.h" diff --git a/engines/ags/engine/ac/object.cpp b/engines/ags/engine/ac/object.cpp index e22ba59d883..cf731e84a10 100644 --- a/engines/ags/engine/ac/object.cpp +++ b/engines/ags/engine/ac/object.cpp @@ -27,7 +27,6 @@ #include "ags/engine/ac/game_state.h" #include "ags/engine/ac/global_object.h" #include "ags/engine/ac/global_translation.h" -#include "ags/engine/ac/object_cache.h" #include "ags/engine/ac/properties.h" #include "ags/engine/ac/room.h" #include "ags/engine/ac/room_status.h" diff --git a/engines/ags/engine/ac/object_cache.h b/engines/ags/engine/ac/object_cache.h deleted file mode 100644 index c0c09cc845d..00000000000 --- a/engines/ags/engine/ac/object_cache.h +++ /dev/null @@ -1,42 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#ifndef AGS_ENGINE_AC_OBJECT_CACHE_H -#define AGS_ENGINE_AC_OBJECT_CACHE_H - -namespace AGS3 { - -// stores cached object info -struct ObjectCache { - Shared::Bitmap *image = nullptr; - int sppic = 0; - short tintredwas = 0, tintgrnwas = 0, tintbluwas = 0; - short tintamntwas = 0, tintlightwas = 0; - short lightlevwas = 0, zoomWas = 0; - bool mirroredWas = false; - - // The following are used to determine if the character has moved - int xwas = 0, ywas = 0; -}; - -} // namespace AGS3 - -#endif diff --git a/engines/ags/engine/ac/room.cpp b/engines/ags/engine/ac/room.cpp index 8554a637956..cb4be1cc741 100644 --- a/engines/ags/engine/ac/room.cpp +++ b/engines/ags/engine/ac/room.cpp @@ -23,7 +23,6 @@ #include "ags/shared/util/string_utils.h" //strlwr() #include "ags/shared/ac/common.h" #include "ags/engine/ac/character.h" -#include "ags/engine/ac/character_cache.h" #include "ags/engine/ac/character_extras.h" #include "ags/engine/ac/draw.h" #include "ags/engine/ac/event.h" @@ -38,7 +37,6 @@ #include "ags/engine/ac/global_translation.h" #include "ags/engine/ac/move_list.h" #include "ags/engine/ac/mouse.h" -#include "ags/engine/ac/object_cache.h" #include "ags/engine/ac/overlay.h" #include "ags/engine/ac/properties.h" #include "ags/engine/ac/region.h" diff --git a/engines/ags/engine/game/game_init.cpp b/engines/ags/engine/game/game_init.cpp index 83add8905eb..7462af2625a 100644 --- a/engines/ags/engine/game/game_init.cpp +++ b/engines/ags/engine/game/game_init.cpp @@ -20,7 +20,6 @@ */ #include "ags/engine/ac/character.h" -#include "ags/engine/ac/character_cache.h" #include "ags/engine/ac/dialog.h" #include "ags/engine/ac/display.h" #include "ags/engine/ac/draw.h" diff --git a/engines/ags/engine/main/engine.cpp b/engines/ags/engine/main/engine.cpp index 2e78e61c113..20ea7e1420e 100644 --- a/engines/ags/engine/main/engine.cpp +++ b/engines/ags/engine/main/engine.cpp @@ -39,7 +39,6 @@ #include "ags/engine/ac/global_game.h" #include "ags/engine/ac/gui.h" #include "ags/engine/ac/lip_sync.h" -#include "ags/engine/ac/object_cache.h" #include "ags/engine/ac/path_helper.h" #include "ags/engine/ac/route_finder.h" #include "ags/engine/ac/sys_events.h" diff --git a/engines/ags/engine/main/game_file.cpp b/engines/ags/engine/main/game_file.cpp index a61aea73b05..adcd62429e9 100644 --- a/engines/ags/engine/main/game_file.cpp +++ b/engines/ags/engine/main/game_file.cpp @@ -25,7 +25,6 @@ #include "ags/shared/ac/common.h" #include "ags/engine/ac/character.h" -#include "ags/engine/ac/character_cache.h" #include "ags/shared/ac/dialog_topic.h" #include "ags/engine/ac/draw.h" #include "ags/engine/ac/game.h" diff --git a/engines/ags/globals.cpp b/engines/ags/globals.cpp index 0abe5bf48ec..23ac78fb66b 100644 --- a/engines/ags/globals.cpp +++ b/engines/ags/globals.cpp @@ -38,7 +38,6 @@ #include "ags/shared/gui/gui_textbox.h" #include "ags/shared/script/cc_common.h" #include "ags/shared/util/directory.h" -#include "ags/engine/ac/character_cache.h" #include "ags/engine/ac/character_extras.h" #include "ags/engine/ac/draw.h" #include "ags/engine/ac/draw_software.h" @@ -47,7 +46,6 @@ #include "ags/engine/ac/game_state.h" #include "ags/engine/ac/mouse.h" #include "ags/engine/ac/move_list.h" -#include "ags/engine/ac/object_cache.h" #include "ags/engine/ac/room_status.h" #include "ags/engine/ac/route_finder_jps.h" #include "ags/engine/ac/screen_overlay.h" @@ -238,7 +236,7 @@ Globals::Globals() { _scrHotspot = new ScriptHotspot[MAX_ROOM_HOTSPOTS]; _scrRegion = new ScriptRegion[MAX_ROOM_REGIONS]; _scrInv = new ScriptInvItem[MAX_INV]; - _charcache = new std::vector(); + _charcache = new std::vector(); _objcache = new ObjectCache[MAX_ROOM_OBJECTS]; _charextra = new std::vector(); _mls = new std::vector(); diff --git a/engines/ags/globals.h b/engines/ags/globals.h index 1919d4c2fee..0077f314ac8 100644 --- a/engines/ags/globals.h +++ b/engines/ags/globals.h @@ -752,7 +752,7 @@ public: std::vector *_views; // Cached character and object states, used to determine // whether these require texture update - std::vector *_charcache; + std::vector *_charcache; ObjectCache *_objcache; std::vector *_charextra; std::vector *_mls; diff --git a/engines/ags/plugins/ags_plugin.cpp b/engines/ags/plugins/ags_plugin.cpp index 9f978835def..29ef42dab91 100644 --- a/engines/ags/plugins/ags_plugin.cpp +++ b/engines/ags/plugins/ags_plugin.cpp @@ -26,7 +26,6 @@ #include "ags/plugins/core/core.h" #include "ags/shared/ac/common.h" #include "ags/shared/ac/view.h" -#include "ags/engine/ac/character_cache.h" #include "ags/engine/ac/display.h" #include "ags/engine/ac/draw.h" #include "ags/engine/ac/dynamic_sprite.h" @@ -39,7 +38,6 @@ #include "ags/shared/ac/keycode.h" #include "ags/engine/ac/mouse.h" #include "ags/engine/ac/move_list.h" -#include "ags/engine/ac/object_cache.h" #include "ags/engine/ac/parser.h" #include "ags/engine/ac/path_helper.h" #include "ags/engine/ac/room_status.h"