[Scummvm-git-logs] scummvm master -> b736c3af776b6914114bb0579d3a127e7e8c6cdc
dreammaster
noreply at scummvm.org
Mon May 30 22:26:54 UTC 2022
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2e726fa214 AGS: Removed deprecated globals
14fc1796e8 AGS: Move walk_behind globals to Globals
b736c3af77 AGS: Make the ComponentHandlers array static const
Commit: 2e726fa214d50c2ae4114a26c984548b9362422d
https://github.com/scummvm/scummvm/commit/2e726fa214d50c2ae4114a26c984548b9362422d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-05-30T15:23:20-07:00
Commit Message:
AGS: Removed deprecated globals
Changed paths:
engines/ags/plugins/ags_plugin.cpp
engines/ags/shared/util/version.cpp
engines/ags/shared/util/version.h
diff --git a/engines/ags/plugins/ags_plugin.cpp b/engines/ags/plugins/ags_plugin.cpp
index 29ef42dab91..4da04349f8a 100644
--- a/engines/ags/plugins/ags_plugin.cpp
+++ b/engines/ags/plugins/ags_plugin.cpp
@@ -72,6 +72,7 @@
#include "ags/shared/util/stream.h"
#include "ags/shared/util/string_compat.h"
#include "ags/shared/util/wgt2_allg.h"
+#include "ags/globals.h"
namespace AGS3 {
@@ -292,7 +293,6 @@ void IAGSEngine::DrawTextWrapped(int32 xx, int32 yy, int32 wid, int32 font, int3
draw_and_invalidate_text(ds, xx, yy + linespacing * i, font, text_color, _GP(Lines)[i].GetCStr());
}
-Bitmap glVirtualScreenWrap;
void IAGSEngine::SetVirtualScreen(BITMAP *bmp) {
if (!_G(gfxDriver)->UsesMemoryBackBuffer()) {
debug_script_warn("SetVirtualScreen: this plugin requires software graphics driver to work correctly.");
@@ -300,10 +300,10 @@ void IAGSEngine::SetVirtualScreen(BITMAP *bmp) {
}
if (bmp) {
- glVirtualScreenWrap.WrapAllegroBitmap(bmp, true);
- _G(gfxDriver)->SetMemoryBackBuffer(&glVirtualScreenWrap);
+ _GP(glVirtualScreenWrap).WrapAllegroBitmap(bmp, true);
+ _G(gfxDriver)->SetMemoryBackBuffer(&_GP(glVirtualScreenWrap));
} else {
- glVirtualScreenWrap.Destroy();
+ _GP(glVirtualScreenWrap).Destroy();
_G(gfxDriver)->SetMemoryBackBuffer(nullptr);
}
}
diff --git a/engines/ags/shared/util/version.cpp b/engines/ags/shared/util/version.cpp
index 9919a870181..53899f2be81 100644
--- a/engines/ags/shared/util/version.cpp
+++ b/engines/ags/shared/util/version.cpp
@@ -26,8 +26,6 @@ namespace AGS3 {
namespace AGS {
namespace Shared {
-const Version Version::LastOldFormatVersion(3, 2, 2, 1120);
-
Version::Version()
: Major(0)
, Minor(0)
diff --git a/engines/ags/shared/util/version.h b/engines/ags/shared/util/version.h
index e5e902d9b03..47ad028eb34 100644
--- a/engines/ags/shared/util/version.h
+++ b/engines/ags/shared/util/version.h
@@ -48,9 +48,6 @@ struct Version {
String ShortString;
String BackwardCompatibleString;
- // Last engine version, using different version format than AGS Editor (3.22.1120 / 3.2.2.1120)
- static const Version LastOldFormatVersion;
-
Version();
Version(int32_t major, int32_t minor, int32_t release);
Version(int32_t major, int32_t minor, int32_t release, int32_t revision);
Commit: 14fc1796e89de01c24087c5e09fcc0332eb1d02a
https://github.com/scummvm/scummvm/commit/14fc1796e89de01c24087c5e09fcc0332eb1d02a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-05-30T15:23:20-07:00
Commit Message:
AGS: Move walk_behind globals to Globals
Changed paths:
engines/ags/engine/ac/walk_behind.cpp
engines/ags/engine/ac/walk_behind.h
engines/ags/globals.h
diff --git a/engines/ags/engine/ac/walk_behind.cpp b/engines/ags/engine/ac/walk_behind.cpp
index 9c64a1466de..cb90cb9b8a4 100644
--- a/engines/ags/engine/ac/walk_behind.cpp
+++ b/engines/ags/engine/ac/walk_behind.cpp
@@ -34,21 +34,6 @@ namespace AGS3 {
using namespace AGS::Shared;
using namespace AGS::Engine;
-
-// An info on vertical column of walk-behind mask, which may contain WB area
-struct WalkBehindColumn {
- bool Exists = false; // whether any WB area is in this column
- int Y1 = 0, Y2 = 0; // WB top and bottom Y coords
-};
-
-WalkBehindMethodEnum walkBehindMethod = DrawOverCharSprite;
-std::vector<WalkBehindColumn> walkBehindCols; // precalculated WB positions
-Rect walkBehindAABB[MAX_WALK_BEHINDS]; // WB bounding box
-int walkBehindsCachedForBgNum = 0; // WB textures are for this background
-bool noWalkBehindsAtAll = false; // quick report that no WBs in this room
-bool walk_behind_baselines_changed = false;
-
-
// Generates walk-behinds as separate sprites
void walkbehinds_generate_sprites() {
const Bitmap *mask = _GP(thisroom).WalkBehindMask.get();
@@ -58,7 +43,7 @@ void walkbehinds_generate_sprites() {
Bitmap wbbmp; // temp buffer
// Iterate through walk-behinds and generate a texture for each of them
for (int wb = 1 /* 0 is "no area" */; wb < MAX_WALK_BEHINDS; ++wb) {
- const Rect pos = walkBehindAABB[wb];
+ const Rect pos = _G(walkBehindAABB)[wb];
if (pos.Right > 0) {
wbbmp.CreateTransparent(pos.GetWidth(), pos.GetHeight(), coldepth);
// Copy over all solid pixels belonging to this WB area
@@ -90,13 +75,13 @@ void walkbehinds_generate_sprites() {
}
}
- walkBehindsCachedForBgNum = _GP(play).bg_frame;
+ _G(walkBehindsCachedForBgNum) = _GP(play).bg_frame;
}
// Edits the given game object's sprite, cutting out pixels covered by walk-behinds;
// returns whether any pixels were updated;
bool walkbehinds_cropout(Bitmap *sprit, int sprx, int spry, int basel, int zoom) {
- if (noWalkBehindsAtAll)
+ if (_G(noWalkBehindsAtAll))
return false;
const int maskcol = sprit->GetMaskColor();
@@ -107,7 +92,7 @@ bool walkbehinds_cropout(Bitmap *sprit, int sprx, int spry, int basel, int zoom)
for (int x = MAX(0, 0 - sprx);
(x < sprit->GetWidth()) && (x + sprx < _GP(thisroom).WalkBehindMask->GetWidth()); ++x) {
// select the WB column at this x
- const auto &wbcol = walkBehindCols[x + sprx];
+ const auto &wbcol = _G(walkBehindCols)[x + sprx];
// skip if no area, or sprite lies outside of all areas in this column
if ((!wbcol.Exists) ||
(wbcol.Y2 <= spry) ||
@@ -145,17 +130,17 @@ bool walkbehinds_cropout(Bitmap *sprit, int sprx, int spry, int basel, int zoom)
void walkbehinds_recalc() {
// Reset all data
- walkBehindCols.clear();
+ _G(walkBehindCols).clear();
for (int wb = 0; wb < MAX_WALK_BEHINDS; ++wb) {
- walkBehindAABB[wb] = Rect(INT32_MAX, INT32_MAX, INT32_MIN, INT32_MIN);
+ _G(walkBehindAABB)[wb] = Rect(INT32_MAX, INT32_MAX, INT32_MIN, INT32_MIN);
}
- noWalkBehindsAtAll = true;
+ _G(noWalkBehindsAtAll) = true;
// Recalculate everything; note that mask is always 8-bit
const Bitmap *mask = _GP(thisroom).WalkBehindMask.get();
- walkBehindCols.resize(mask->GetWidth());
+ _G(walkBehindCols).resize(mask->GetWidth());
for (int col = 0; col < mask->GetWidth(); ++col) {
- auto &wbcol = walkBehindCols[col];
+ auto &wbcol = _G(walkBehindCols)[col];
for (int y = 0; y < mask->GetHeight(); ++y) {
int wb = mask->GetScanLine(y)[col];
// Valid areas start with index 1, 0 = no area
@@ -163,19 +148,19 @@ void walkbehinds_recalc() {
if (!wbcol.Exists) {
wbcol.Y1 = y;
wbcol.Exists = true;
- noWalkBehindsAtAll = false;
+ _G(noWalkBehindsAtAll) = false;
}
wbcol.Y2 = y + 1; // +1 to allow bottom line of screen to work (CHECKME??)
// resize the bounding rect
- walkBehindAABB[wb].Left = MIN(col, walkBehindAABB[wb].Left);
- walkBehindAABB[wb].Top = MIN(y, walkBehindAABB[wb].Top);
- walkBehindAABB[wb].Right = MAX(col, walkBehindAABB[wb].Right);
- walkBehindAABB[wb].Bottom = MAX(y, walkBehindAABB[wb].Bottom);
+ _G(walkBehindAABB)[wb].Left = MIN(col, _G(walkBehindAABB)[wb].Left);
+ _G(walkBehindAABB)[wb].Top = MIN(y, _G(walkBehindAABB)[wb].Top);
+ _G(walkBehindAABB)[wb].Right = MAX(col, _G(walkBehindAABB)[wb].Right);
+ _G(walkBehindAABB)[wb].Bottom = MAX(y, _G(walkBehindAABB)[wb].Bottom);
}
}
}
- if (walkBehindMethod == DrawAsSeparateSprite) {
+ if (_G(walkBehindMethod) == DrawAsSeparateSprite) {
walkbehinds_generate_sprites();
}
}
diff --git a/engines/ags/engine/ac/walk_behind.h b/engines/ags/engine/ac/walk_behind.h
index 52ce5894551..d1ded1cc642 100644
--- a/engines/ags/engine/ac/walk_behind.h
+++ b/engines/ags/engine/ac/walk_behind.h
@@ -40,6 +40,12 @@ enum WalkBehindMethodEnum {
DrawAsSeparateSprite
};
+// An info on vertical column of walk-behind mask, which may contain WB area
+struct WalkBehindColumn {
+ bool Exists = false; // whether any WB area is in this column
+ int Y1 = 0, Y2 = 0; // WB top and bottom Y coords
+};
+
namespace AGS { namespace Shared { class Bitmap; } }
using namespace AGS; // FIXME later
diff --git a/engines/ags/globals.h b/engines/ags/globals.h
index 2ee36e60fa9..0e68f9efb65 100644
--- a/engines/ags/globals.h
+++ b/engines/ags/globals.h
@@ -1381,6 +1381,8 @@ public:
int _walkBehindsCachedForBgNum = 0;
WalkBehindMethodEnum _walkBehindMethod = DrawOverCharSprite;
int _walk_behind_baselines_changed = 0;
+ Rect _walkBehindAABB[MAX_WALK_BEHINDS]; // WB bounding box
+ std::vector<WalkBehindColumn> _walkBehindCols; // precalculated WB positions
/**@}*/
Commit: b736c3af776b6914114bb0579d3a127e7e8c6cdc
https://github.com/scummvm/scummvm/commit/b736c3af776b6914114bb0579d3a127e7e8c6cdc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-05-30T15:23:20-07:00
Commit Message:
AGS: Make the ComponentHandlers array static const
Changed paths:
engines/ags/engine/game/savegame_components.cpp
diff --git a/engines/ags/engine/game/savegame_components.cpp b/engines/ags/engine/game/savegame_components.cpp
index 7537458e098..5abf4003012 100644
--- a/engines/ags/engine/game/savegame_components.cpp
+++ b/engines/ags/engine/game/savegame_components.cpp
@@ -1021,7 +1021,7 @@ struct ComponentHandler {
};
// Array of supported components
-ComponentHandler ComponentHandlers[] = {
+static const ComponentHandler ComponentHandlers[] = {
{
"Game State",
kGSSvgVersion_350_10,
@@ -1245,7 +1245,7 @@ HSaveError ReadAll(Stream *in, SavegameVersion svg_version, const PreservedParam
return new SavegameError(kSvgErr_ComponentListClosingTagMissing);
}
-HSaveError WriteComponent(Stream *out, ComponentHandler &hdlr) {
+HSaveError WriteComponent(Stream *out, const ComponentHandler &hdlr) {
WriteFormatTag(out, hdlr.Name, true);
out->WriteInt32(hdlr.Version);
soff_t ref_pos = out->GetPosition();
More information about the Scummvm-git-logs
mailing list