[Scummvm-git-logs] scummvm master -> a291894e3bf57ab37e38bedb13b664ef70aa0fd2
dreammaster
dreammaster at scummvm.org
Wed Feb 17 05:14:03 UTC 2021
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:
17ee6fbc3e AGS: Change sizeof(int) to sizeof(int32) were appropriate
155e74eae5 AGS: Change DLL base class to PluginBase
a291894e3b AGS: Change plugins savegame code to use Serializer
Commit: 17ee6fbc3ead2e979271ea221b0ba3ea239b12d8
https://github.com/scummvm/scummvm/commit/17ee6fbc3ead2e979271ea221b0ba3ea239b12d8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-02-16T20:11:40-08:00
Commit Message:
AGS: Change sizeof(int) to sizeof(int32) were appropriate
There were some places where even after reversion to the old type
usage, some usages of sizeof(int) should really be sizeof(int32)
Changed paths:
engines/ags/engine/ac/route_finder_impl.cpp
engines/ags/engine/ac/route_finder_impl_legacy.cpp
engines/ags/engine/gfx/gfxdriverbase.cpp
engines/ags/engine/main/engine.cpp
engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
diff --git a/engines/ags/engine/ac/route_finder_impl.cpp b/engines/ags/engine/ac/route_finder_impl.cpp
index 13ea1c667a..95bcdb4ba6 100644
--- a/engines/ags/engine/ac/route_finder_impl.cpp
+++ b/engines/ags/engine/ac/route_finder_impl.cpp
@@ -54,7 +54,7 @@ namespace RouteFinder {
#define MAKE_INTCOORD(x,y) (((unsigned short)x << 16) | ((unsigned short)y))
static const int MAXNAVPOINTS = MAXNEEDSTAGES;
-static int navpoints[MAXNAVPOINTS];
+static int32_t navpoints[MAXNAVPOINTS];
static int num_navpoints;
static fixed move_speed_x, move_speed_y;
static Navigation nav;
@@ -245,7 +245,7 @@ int find_route(short srcx, short srcy, short xx, short yy, Bitmap *onscreen, int
int mlist = movlst;
mls[mlist].numstage = num_navpoints;
- memcpy(&mls[mlist].pos[0], &navpoints[0], sizeof(int) * num_navpoints);
+ memcpy(&mls[mlist].pos[0], &navpoints[0], sizeof(int32_t) * num_navpoints);
#ifdef DEBUG_PATHFINDER
AGS::Shared::Debug::Printf("stages: %d\n", num_navpoints);
#endif
diff --git a/engines/ags/engine/ac/route_finder_impl_legacy.cpp b/engines/ags/engine/ac/route_finder_impl_legacy.cpp
index 9b662526e3..c047ab1ee1 100644
--- a/engines/ags/engine/ac/route_finder_impl_legacy.cpp
+++ b/engines/ags/engine/ac/route_finder_impl_legacy.cpp
@@ -796,7 +796,7 @@ int find_route(short srcx, short srcy, short xx, short yy, Bitmap *onscreen, int
if (pathbackstage >= 0) {
int nearestpos = 0, nearestindx;
- int reallyneed[MAXNEEDSTAGES], numstages = 0;
+ int32_t reallyneed[MAXNEEDSTAGES], numstages = 0;
reallyneed[numstages] = MAKE_INTCOORD(srcx, srcy);
numstages++;
nearestindx = -1;
@@ -859,7 +859,7 @@ stage_again:
#endif
int mlist = movlst;
mls[mlist].numstage = numstages;
- memcpy(&mls[mlist].pos[0], &reallyneed[0], sizeof(int) * numstages);
+ memcpy(&mls[mlist].pos[0], &reallyneed[0], sizeof(int32_t) * numstages);
#ifdef DEBUG_PATHFINDER
AGS::Shared::Debug::Printf("stages: %d\n", numstages);
#endif
diff --git a/engines/ags/engine/gfx/gfxdriverbase.cpp b/engines/ags/engine/gfx/gfxdriverbase.cpp
index 4b458a78b6..03d83e87d3 100644
--- a/engines/ags/engine/gfx/gfxdriverbase.cpp
+++ b/engines/ags/engine/gfx/gfxdriverbase.cpp
@@ -363,7 +363,7 @@ void VideoMemoryGraphicsDriver::BitmapToVideoMem(const Bitmap *bitmap, const boo
}
} else if (src_depth == 32) {
unsigned int *ptrLong = (unsigned int *)dst_ptr;
- const unsigned int *srcData = (const unsigned int *)&scanline_at[(x + tile->x) * sizeof(int)];
+ const unsigned int *srcData = (const unsigned int *)&scanline_at[(x + tile->x) * sizeof(unsigned int)];
if (*srcData == MASK_COLOR_32) {
if (!usingLinearFiltering)
ptrLong[x] = 0;
@@ -376,9 +376,9 @@ void VideoMemoryGraphicsDriver::BitmapToVideoMem(const Bitmap *bitmap, const boo
if (x < tile->width - 1)
get_pixel_if_not_transparent32(&srcData[1], &red, &green, &blue, &divisor);
if (y > 0)
- get_pixel_if_not_transparent32((const unsigned int *)&scanline_before[(x + tile->x) * sizeof(int)], &red, &green, &blue, &divisor);
+ get_pixel_if_not_transparent32((const uint32 *)&scanline_before[(x + tile->x) * sizeof(uint32)], &red, &green, &blue, &divisor);
if (y < tile->height - 1)
- get_pixel_if_not_transparent32((const unsigned int *)&scanline_after[(x + tile->x) * sizeof(int)], &red, &green, &blue, &divisor);
+ get_pixel_if_not_transparent32((const uint32 *)&scanline_after[(x + tile->x) * sizeof(uint32)], &red, &green, &blue, &divisor);
if (divisor > 0)
ptrLong[x] = VMEMCOLOR_RGBA(red / divisor, green / divisor, blue / divisor, 0);
else
@@ -419,7 +419,7 @@ void VideoMemoryGraphicsDriver::BitmapToVideoMemOpaque(const Bitmap *bitmap, con
memPtrLong[x] = VMEMCOLOR_RGBA(algetr16(*srcData), algetg16(*srcData), algetb16(*srcData), 0xFF);
} else if (src_depth == 32) {
//unsigned int *memPtrLong = (unsigned int *)dst_ptr;
- const unsigned int *srcData = (const unsigned int *)&scanline_at[(x + tile->x) * sizeof(int)];
+ const uint32 *srcData = (const uint32 *)&scanline_at[(x + tile->x) * sizeof(uint32)];
if (has_alpha)
memPtrLong[x] = VMEMCOLOR_RGBA(algetr32(*srcData), algetg32(*srcData), algetb32(*srcData), algeta32(*srcData));
else
diff --git a/engines/ags/engine/main/engine.cpp b/engines/ags/engine/main/engine.cpp
index cf877f8f1d..0ac53c0831 100644
--- a/engines/ags/engine/main/engine.cpp
+++ b/engines/ags/engine/main/engine.cpp
@@ -879,8 +879,8 @@ void engine_init_game_settings() {
play.shake_screen_yoff = 0;
memset(&play.walkable_areas_on[0], 1, MAX_WALK_AREAS + 1);
- memset(&play.script_timers[0], 0, MAX_TIMERS * sizeof(int));
- memset(&play.default_audio_type_volumes[0], -1, MAX_AUDIO_TYPES * sizeof(int));
+ memset(&play.script_timers[0], 0, MAX_TIMERS * sizeof(int32_t));
+ memset(&play.default_audio_type_volumes[0], -1, MAX_AUDIO_TYPES * sizeof(int32_t));
// reset graphical script vars (they're still used by some games)
for (ee = 0; ee < MAXGLOBALVARS; ee++)
diff --git a/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp b/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
index 38b8e58138..e24e14b8fb 100644
--- a/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
+++ b/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
@@ -1688,17 +1688,17 @@ NumberPtr AGSPalRender::AGS_EngineOnEvent(int event, NumberPtr data) {
}
if (event == AGSE_SAVEGAME) {
for (int i = 0; i < MAX_OVERLAYS; ++i) {
- engine->FWrite(&overlay[i].sprite, sizeof(int), data);
- engine->FWrite(&overlay[i].spritemask, sizeof(int), data);
- engine->FWrite(&overlay[i].x, sizeof(int), data);
- engine->FWrite(&overlay[i].y, sizeof(int), data);
- engine->FWrite(&overlay[i].level, sizeof(int), data);
- engine->FWrite(&overlay[i].trans, sizeof(int), data);
- engine->FWrite(&overlay[i].blendtype, sizeof(int), data);
+ engine->FWrite(&overlay[i].sprite, sizeof(int32), data);
+ engine->FWrite(&overlay[i].spritemask, sizeof(int32), data);
+ engine->FWrite(&overlay[i].x, sizeof(int32), data);
+ engine->FWrite(&overlay[i].y, sizeof(int32), data);
+ engine->FWrite(&overlay[i].level, sizeof(int32), data);
+ engine->FWrite(&overlay[i].trans, sizeof(int32), data);
+ engine->FWrite(&overlay[i].blendtype, sizeof(int32), data);
engine->FWrite(&overlay[i].enabled, sizeof(bool), data);
}
- engine->FWrite(&clutslot, sizeof(int), data);
- engine->FWrite(&drawreflections, sizeof(int), data);
+ engine->FWrite(&clutslot, sizeof(int32), data);
+ engine->FWrite(&drawreflections, sizeof(int32), data);
for (int j = 0; j < 256; ++j) {
engine->FWrite(&cycle_remap[j], sizeof(unsigned char), data);
}
@@ -1710,25 +1710,25 @@ NumberPtr AGSPalRender::AGS_EngineOnEvent(int event, NumberPtr data) {
for (int j = 0; j < 256; ++j) {
engine->FWrite(&sprite[j].x, sizeof(double), data);
engine->FWrite(&sprite[j].y, sizeof(double), data);
- engine->FWrite(&sprite[j].texture, sizeof(int), data);
+ engine->FWrite(&sprite[j].texture, sizeof(int32), data);
engine->FWrite(&sprite[j].alpha, sizeof(unsigned char), data);
engine->FWrite(&sprite[j].uDivW, sizeof(double), data);
engine->FWrite(&sprite[j].uDivH, sizeof(double), data);
engine->FWrite(&sprite[j].vMove, sizeof(double), data);
engine->FWrite(&sprite[j].hMove, sizeof(double), data);
engine->FWrite(&sprite[j].objectinteract, sizeof(char), data);
- engine->FWrite(&sprite[j].view, sizeof(int), data);
- engine->FWrite(&sprite[j].frame, sizeof(int), data);
- engine->FWrite(&sprite[j].angle, sizeof(int), data);
+ engine->FWrite(&sprite[j].view, sizeof(int32), data);
+ engine->FWrite(&sprite[j].frame, sizeof(int32), data);
+ engine->FWrite(&sprite[j].angle, sizeof(int32), data);
}
for (int j = 0; j < 256; ++j) {
for (int k = 0; k < 4; ++k) {
- engine->FWrite(&wallData[j].texture[k], sizeof(int), data);
- engine->FWrite(&wallData[j].solid[k], sizeof(int), data);
- engine->FWrite(&wallData[j].ignorelighting[k], sizeof(int), data);
- engine->FWrite(&wallData[j].alpha[k], sizeof(int), data);
- engine->FWrite(&wallData[j].blendtype[k], sizeof(int), data);
- engine->FWrite(&wallData[j].mask[k], sizeof(int), data);
+ engine->FWrite(&wallData[j].texture[k], sizeof(int32), data);
+ engine->FWrite(&wallData[j].solid[k], sizeof(int32), data);
+ engine->FWrite(&wallData[j].ignorelighting[k], sizeof(int32), data);
+ engine->FWrite(&wallData[j].alpha[k], sizeof(int32), data);
+ engine->FWrite(&wallData[j].blendtype[k], sizeof(int32), data);
+ engine->FWrite(&wallData[j].mask[k], sizeof(int32), data);
}
engine->FWrite(&wallData[j].hotspotinteract, sizeof(char), data);
}
@@ -1747,30 +1747,30 @@ NumberPtr AGSPalRender::AGS_EngineOnEvent(int event, NumberPtr data) {
for (int j = 0; j < MAP_HEIGHT; ++j) {
engine->FWrite(&worldMap [i][j], sizeof(unsigned char), data);
engine->FWrite(&lightMap [i][j], sizeof(unsigned char), data);
- engine->FWrite(&ceilingMap [i][j], sizeof(int), data);
- engine->FWrite(&floorMap [i][j], sizeof(int), data);
- engine->FWrite(&heightMap [i][j], sizeof(int), data);
+ engine->FWrite(&ceilingMap [i][j], sizeof(int32), data);
+ engine->FWrite(&floorMap [i][j], sizeof(int32), data);
+ engine->FWrite(&heightMap [i][j], sizeof(int32), data);
}
}
- engine->FWrite(&textureSlot, sizeof(int), data);
- engine->FWrite(&skybox, sizeof(int), data);
- engine->FWrite(&ambientlight, sizeof(int), data);
+ engine->FWrite(&textureSlot, sizeof(int32), data);
+ engine->FWrite(&skybox, sizeof(int32), data);
+ engine->FWrite(&ambientlight, sizeof(int32), data);
}
if (event == AGSE_RESTOREGAME) {
for (int i = 0; i < MAX_OVERLAYS; ++i) {
- engine->FRead(&overlay[i].sprite, sizeof(int), data);
- engine->FRead(&overlay[i].spritemask, sizeof(int), data);
- engine->FRead(&overlay[i].x, sizeof(int), data);
- engine->FRead(&overlay[i].y, sizeof(int), data);
- engine->FRead(&overlay[i].level, sizeof(int), data);
- engine->FRead(&overlay[i].trans, sizeof(int), data);
- engine->FRead(&overlay[i].blendtype, sizeof(int), data);
+ engine->FRead(&overlay[i].sprite, sizeof(int32), data);
+ engine->FRead(&overlay[i].spritemask, sizeof(int32), data);
+ engine->FRead(&overlay[i].x, sizeof(int32), data);
+ engine->FRead(&overlay[i].y, sizeof(int32), data);
+ engine->FRead(&overlay[i].level, sizeof(int32), data);
+ engine->FRead(&overlay[i].trans, sizeof(int32), data);
+ engine->FRead(&overlay[i].blendtype, sizeof(int32), data);
engine->FRead(&overlay[i].enabled, sizeof(bool), data);
}
- engine->FRead(&clutslot, sizeof(int), data);
- engine->FRead(&drawreflections, sizeof(int), data);
+ engine->FRead(&clutslot, sizeof(int32), data);
+ engine->FRead(&drawreflections, sizeof(int32), data);
for (int j = 0; j < 256; ++j) {
engine->FRead(&cycle_remap[j], sizeof(unsigned char), data);
}
@@ -1782,25 +1782,25 @@ NumberPtr AGSPalRender::AGS_EngineOnEvent(int event, NumberPtr data) {
for (int j = 0; j < 256; ++j) { //Save Raycaster Sprite struct, 256 instances.
engine->FRead(&sprite[j].x, sizeof(double), data);
engine->FRead(&sprite[j].y, sizeof(double), data);
- engine->FRead(&sprite[j].texture, sizeof(int), data);
+ engine->FRead(&sprite[j].texture, sizeof(int32), data);
engine->FRead(&sprite[j].alpha, sizeof(unsigned char), data);
engine->FRead(&sprite[j].uDivW, sizeof(double), data);
engine->FRead(&sprite[j].uDivH, sizeof(double), data);
engine->FRead(&sprite[j].vMove, sizeof(double), data);
engine->FRead(&sprite[j].hMove, sizeof(double), data);
engine->FRead(&sprite[j].objectinteract, sizeof(char), data);
- engine->FRead(&sprite[j].view, sizeof(int), data);
- engine->FRead(&sprite[j].frame, sizeof(int), data);
- engine->FRead(&sprite[j].angle, sizeof(int), data);
+ engine->FRead(&sprite[j].view, sizeof(int32), data);
+ engine->FRead(&sprite[j].frame, sizeof(int32), data);
+ engine->FRead(&sprite[j].angle, sizeof(int32), data);
}
for (int j = 0; j < 256; ++j) { //Save Raycaster wall type data.
for (int k = 0; k < 4; ++k) {
- engine->FRead(&wallData[j].texture[k], sizeof(int), data);
- engine->FRead(&wallData[j].solid[k], sizeof(int), data);
- engine->FRead(&wallData[j].ignorelighting[k], sizeof(int), data);
- engine->FRead(&wallData[j].alpha[k], sizeof(int), data);
- engine->FRead(&wallData[j].blendtype[k], sizeof(int), data);
- engine->FRead(&wallData[j].mask[k], sizeof(int), data);
+ engine->FRead(&wallData[j].texture[k], sizeof(int32), data);
+ engine->FRead(&wallData[j].solid[k], sizeof(int32), data);
+ engine->FRead(&wallData[j].ignorelighting[k], sizeof(int32), data);
+ engine->FRead(&wallData[j].alpha[k], sizeof(int32), data);
+ engine->FRead(&wallData[j].blendtype[k], sizeof(int32), data);
+ engine->FRead(&wallData[j].mask[k], sizeof(int32), data);
}
engine->FRead(&wallData[j].hotspotinteract, sizeof(char), data);
}
@@ -1820,9 +1820,9 @@ NumberPtr AGSPalRender::AGS_EngineOnEvent(int event, NumberPtr data) {
for (int j = 0; j < MAP_HEIGHT; ++j) {
engine->FRead(&worldMap [i][j], sizeof(unsigned char), data);
engine->FRead(&lightMap [i][j], sizeof(unsigned char), data);
- engine->FRead(&ceilingMap [i][j], sizeof(int), data);
- engine->FRead(&floorMap [i][j], sizeof(int), data);
- engine->FRead(&heightMap [i][j], sizeof(int), data);
+ engine->FRead(&ceilingMap [i][j], sizeof(int32), data);
+ engine->FRead(&floorMap [i][j], sizeof(int32), data);
+ engine->FRead(&heightMap [i][j], sizeof(int32), data);
seenMap [i][j] = 0;
}
}
@@ -1830,10 +1830,10 @@ NumberPtr AGSPalRender::AGS_EngineOnEvent(int event, NumberPtr data) {
//Reinitialize all the buffers and stuff.
}
- engine->FRead(&textureSlot, sizeof(int), data);
+ engine->FRead(&textureSlot, sizeof(int32), data);
if (textureSlot) MakeTextures(textureSlot);
- engine->FRead(&skybox, sizeof(int), data);
- engine->FRead(&ambientlight, sizeof(int), data);
+ engine->FRead(&skybox, sizeof(int32), data);
+ engine->FRead(&ambientlight, sizeof(int32), data);
LoadCLUT(clutslot);
}
if (event == AGSE_ENTERROOM) {
Commit: 155e74eae5b215bc6d6473d117219a7344e2f610
https://github.com/scummvm/scummvm/commit/155e74eae5b215bc6d6473d117219a7344e2f610
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-02-16T20:22:43-08:00
Commit Message:
AGS: Change DLL base class to PluginBase
Changed paths:
A engines/ags/plugins/plugin_base.cpp
A engines/ags/plugins/plugin_base.h
R engines/ags/plugins/dll.cpp
R engines/ags/plugins/dll.h
engines/ags/engine/util/library_scummvm.h
engines/ags/module.mk
engines/ags/plugins/ags_blend/ags_blend.cpp
engines/ags/plugins/ags_blend/ags_blend.h
engines/ags/plugins/ags_creditz/ags_creditz.h
engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
engines/ags/plugins/ags_flashlight/ags_flashlight.h
engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.cpp
engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.h
engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
engines/ags/plugins/ags_pal_render/ags_pal_render.h
engines/ags/plugins/ags_parallax/ags_parallax.cpp
engines/ags/plugins/ags_parallax/ags_parallax.h
engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp
engines/ags/plugins/ags_snow_rain/ags_snow_rain.h
engines/ags/plugins/ags_snow_rain/weather.h
engines/ags/plugins/ags_sprite_font/ags_sprite_font.cpp
engines/ags/plugins/ags_sprite_font/ags_sprite_font.h
engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.h
engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.cpp
engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.h
diff --git a/engines/ags/engine/util/library_scummvm.h b/engines/ags/engine/util/library_scummvm.h
index 760a0b0017..06e730b81e 100644
--- a/engines/ags/engine/util/library_scummvm.h
+++ b/engines/ags/engine/util/library_scummvm.h
@@ -26,7 +26,7 @@
#include "ags/shared/core/platform.h"
#include "ags/shared/util/string.h"
#include "ags/shared/debugging/out.h"
-#include "ags/plugins/dll.h"
+#include "ags/plugins/plugin_base.h"
#include "ags/engine/globals.h"
namespace AGS3 {
diff --git a/engines/ags/module.mk b/engines/ags/module.mk
index f2f94b987b..23bff060d5 100644
--- a/engines/ags/module.mk
+++ b/engines/ags/module.mk
@@ -284,8 +284,8 @@ MODULE_OBJS = \
engine/script/script_runtime.o \
engine/script/systemimports.o \
plugins/agsplugin.o \
- plugins/dll.o \
plugins/global_plugin.o \
+ plugins/plugin_base.o \
plugins/pluginobjectreader.o \
plugins/ags_blend/ags_blend.o \
plugins/ags_creditz/ags_creditz.o \
diff --git a/engines/ags/plugins/ags_blend/ags_blend.cpp b/engines/ags/plugins/ags_blend/ags_blend.cpp
index dd063b7fbe..de7b91e40d 100644
--- a/engines/ags/plugins/ags_blend/ags_blend.cpp
+++ b/engines/ags/plugins/ags_blend/ags_blend.cpp
@@ -79,7 +79,7 @@ namespace AGSBlend {
IAGSEngine *AGSBlend::_engine;
-AGSBlend::AGSBlend() : DLL() {
+AGSBlend::AGSBlend() : PluginBase() {
DLL_METHOD(AGS_GetPluginName);
DLL_METHOD(AGS_EngineStartup);
}
diff --git a/engines/ags/plugins/ags_blend/ags_blend.h b/engines/ags/plugins/ags_blend/ags_blend.h
index 5e6d8c1669..1afe908fb1 100644
--- a/engines/ags/plugins/ags_blend/ags_blend.h
+++ b/engines/ags/plugins/ags_blend/ags_blend.h
@@ -23,7 +23,7 @@
#ifndef AGS_PLUGINS_AGS_BLEND_AGS_BLEND_H
#define AGS_PLUGINS_AGS_BLEND_AGS_BLEND_H
-#include "ags/plugins/dll.h"
+#include "ags/plugins/plugin_base.h"
namespace AGS3 {
namespace Plugins {
@@ -33,7 +33,7 @@ namespace AGSBlend {
* Author: Steven Poulton
* Description: An AGS Plugin to allow true Alpha Blending
*/
-class AGSBlend : public DLL {
+class AGSBlend : public PluginBase {
private:
static IAGSEngine *_engine;
private:
diff --git a/engines/ags/plugins/ags_creditz/ags_creditz.h b/engines/ags/plugins/ags_creditz/ags_creditz.h
index cf6c663d1f..c8e51f7cac 100644
--- a/engines/ags/plugins/ags_creditz/ags_creditz.h
+++ b/engines/ags/plugins/ags_creditz/ags_creditz.h
@@ -23,7 +23,7 @@
#ifndef AGS_PLUGINS_AGSCREDITZ_AGSCREDITZ_H
#define AGS_PLUGINS_AGSCREDITZ_AGSCREDITZ_H
-#include "ags/plugins/dll.h"
+#include "ags/plugins/plugin_base.h"
#include "common/array.h"
#include "common/rect.h"
#include "common/str.h"
@@ -112,7 +112,7 @@ struct State {
int32 _screenWidth = 0, _screenHeight = 0, _screenColorDepth = 0;
};
-class AGSCreditz : public DLL {
+class AGSCreditz : public PluginBase {
protected:
enum Version {
VERSION_11 = 11, VERSION_20 = 20
diff --git a/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp b/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
index 5eb0abb02b..0390b570dc 100644
--- a/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
+++ b/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
@@ -73,7 +73,7 @@ unsigned long AGSFlashlight::flashlight_n;
IAGSEngine *AGSFlashlight::_engine;
-AGSFlashlight::AGSFlashlight() : DLL() {
+AGSFlashlight::AGSFlashlight() : PluginBase() {
_engine = nullptr;
screen_width = 320;
screen_height = 200;
diff --git a/engines/ags/plugins/ags_flashlight/ags_flashlight.h b/engines/ags/plugins/ags_flashlight/ags_flashlight.h
index ccb989a5da..99beb91a9b 100644
--- a/engines/ags/plugins/ags_flashlight/ags_flashlight.h
+++ b/engines/ags/plugins/ags_flashlight/ags_flashlight.h
@@ -23,7 +23,7 @@
#ifndef AGS_PLUGINS_AGSFLASHLIGHT_AGSFLASHLIGHT_H
#define AGS_PLUGINS_AGSFLASHLIGHT_AGSFLASHLIGHT_H
-#include "ags/plugins/dll.h"
+#include "ags/plugins/plugin_base.h"
#include "ags/lib/allegro.h"
namespace AGS3 {
@@ -34,7 +34,7 @@ namespace AGSFlashlight {
* This is not the AGS Flashlight plugin,
* but a workalike plugin originally created for the AGS engine PSP port.
*/
-class AGSFlashlight : public DLL {
+class AGSFlashlight : public PluginBase {
private:
static IAGSEngine *_engine;
static int32 screen_width;
diff --git a/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.cpp b/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.cpp
index 5a22f1c4b0..b39a208260 100644
--- a/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.cpp
+++ b/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.cpp
@@ -26,7 +26,7 @@ namespace AGS3 {
namespace Plugins {
namespace AGSGalaxySteam {
-AGS2Client::AGS2Client() : DLL() {
+AGS2Client::AGS2Client() : PluginBase() {
DLL_METHOD(AGS_EngineStartup);
}
diff --git a/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.h b/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.h
index 0341aed78c..21974efa0c 100644
--- a/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.h
+++ b/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.h
@@ -23,7 +23,7 @@
#ifndef AGS_PLUGINS_AGS_GALAXY_STEAM_AGS_GALAXY_STEAM_H
#define AGS_PLUGINS_AGS_GALAXY_STEAM_AGS_GALAXY_STEAM_H
-#include "ags/plugins/dll.h"
+#include "ags/plugins/plugin_base.h"
#include "common/array.h"
#include "common/rect.h"
#include "common/str.h"
@@ -32,7 +32,7 @@ namespace AGS3 {
namespace Plugins {
namespace AGSGalaxySteam {
-class AGS2Client : public DLL {
+class AGS2Client : public PluginBase {
protected:
static int IsAchievementAchieved(const ScriptMethodParams ¶ms);
static int SetAchievementAchieved(const ScriptMethodParams ¶ms);
diff --git a/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp b/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
index e24e14b8fb..7452d46eb9 100644
--- a/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
+++ b/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
@@ -1391,7 +1391,7 @@ int DrawTranslucentOverlay(int spriteId, int translevel, int ox, int oy, int mas
/*------------------------------------------------------------------*/
-AGSPalRender::AGSPalRender() : DLL() {
+AGSPalRender::AGSPalRender() : PluginBase() {
DLL_METHOD(AGS_GetPluginName);
DLL_METHOD(AGS_EngineStartup);
DLL_METHOD(AGS_EngineShutdown);
diff --git a/engines/ags/plugins/ags_pal_render/ags_pal_render.h b/engines/ags/plugins/ags_pal_render/ags_pal_render.h
index 730a43ea85..b9fcf0bd3c 100644
--- a/engines/ags/plugins/ags_pal_render/ags_pal_render.h
+++ b/engines/ags/plugins/ags_pal_render/ags_pal_render.h
@@ -23,13 +23,13 @@
#ifndef AGS_PLUGINS_AGS_PAL_RENDER_AGS_PAL_RENDER_H
#define AGS_PLUGINS_AGS_PAL_RENDER_AGS_PAL_RENDER_H
-#include "ags/plugins/dll.h"
+#include "ags/plugins/plugin_base.h"
namespace AGS3 {
namespace Plugins {
namespace AGSPalRender {
-class AGSPalRender : public DLL {
+class AGSPalRender : public PluginBase {
private:
static const char *AGS_GetPluginName();
static void AGS_EngineStartup(IAGSEngine *lpEngine);
diff --git a/engines/ags/plugins/ags_parallax/ags_parallax.cpp b/engines/ags/plugins/ags_parallax/ags_parallax.cpp
index 004bfc2d76..e9ec5c6476 100644
--- a/engines/ags/plugins/ags_parallax/ags_parallax.cpp
+++ b/engines/ags/plugins/ags_parallax/ags_parallax.cpp
@@ -40,7 +40,7 @@ bool AGSParallax::_enabled;
Sprite AGSParallax::_sprites[MAX_SPRITES];
-AGSParallax::AGSParallax() : DLL() {
+AGSParallax::AGSParallax() : PluginBase() {
_engine = nullptr;
_screenWidth = 320;
_screenHeight = 200;
diff --git a/engines/ags/plugins/ags_parallax/ags_parallax.h b/engines/ags/plugins/ags_parallax/ags_parallax.h
index 3fa68e95de..89ca665fd5 100644
--- a/engines/ags/plugins/ags_parallax/ags_parallax.h
+++ b/engines/ags/plugins/ags_parallax/ags_parallax.h
@@ -23,7 +23,7 @@
#ifndef AGS_PLUGINS_AGS_PARALLAX_AGS_PARALLAX_H
#define AGS_PLUGINS_AGS_PARALLAX_AGS_PARALLAX_H
-#include "ags/plugins/dll.h"
+#include "ags/plugins/plugin_base.h"
#include "ags/plugins/serializer.h"
namespace AGS3 {
@@ -46,7 +46,7 @@ struct Sprite {
* This is not the AGS Parallax plugin by Scorpiorus
* but a workalike plugin created for the AGS engine ports.
*/
-class AGSParallax : public DLL {
+class AGSParallax : public PluginBase {
private:
static IAGSEngine *_engine;
static int32 _screenWidth;
diff --git a/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp b/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp
index 557a427048..3062ef53cd 100644
--- a/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp
+++ b/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp
@@ -34,7 +34,7 @@ int32 _screenColorDepth;
Weather *AGSSnowRain::_rain;
Weather *AGSSnowRain::_snow;
-AGSSnowRain::AGSSnowRain() : DLL() {
+AGSSnowRain::AGSSnowRain() : PluginBase() {
_engine = nullptr;
_screenWidth = 320;
_screenHeight = 200;
diff --git a/engines/ags/plugins/ags_snow_rain/ags_snow_rain.h b/engines/ags/plugins/ags_snow_rain/ags_snow_rain.h
index e307532df0..f0ffb9102d 100644
--- a/engines/ags/plugins/ags_snow_rain/ags_snow_rain.h
+++ b/engines/ags/plugins/ags_snow_rain/ags_snow_rain.h
@@ -23,7 +23,7 @@
#ifndef AGS_PLUGINS_AGS_SNOW_RAIN_AGS_SNOW_RAIN_H
#define AGS_PLUGINS_AGS_SNOW_RAIN_AGS_SNOW_RAIN_H
-#include "ags/plugins/dll.h"
+#include "ags/plugins/plugin_base.h"
#include "ags/plugins/ags_snow_rain/weather.h"
namespace AGS3 {
@@ -39,7 +39,7 @@ extern int32 _screenColorDepth;
* This is not the original AGS SnowRain plugin, but a workalike
* plugin created for the AGS engine PSP port.
*/
-class AGSSnowRain : public DLL {
+class AGSSnowRain : public PluginBase {
private:
static Weather *_rain;
static Weather *_snow;
diff --git a/engines/ags/plugins/ags_snow_rain/weather.h b/engines/ags/plugins/ags_snow_rain/weather.h
index a2e634c9cf..b166bb27f7 100644
--- a/engines/ags/plugins/ags_snow_rain/weather.h
+++ b/engines/ags/plugins/ags_snow_rain/weather.h
@@ -23,7 +23,7 @@
#ifndef AGS_PLUGINS_AGS_SNOW_RAIN_WEATHER_H
#define AGS_PLUGINS_AGS_SNOW_RAIN_WEATHER_H
-#include "ags/plugins/dll.h"
+#include "ags/plugins/plugin_base.h"
#include "ags/plugins/serializer.h"
namespace AGS3 {
diff --git a/engines/ags/plugins/ags_sprite_font/ags_sprite_font.cpp b/engines/ags/plugins/ags_sprite_font/ags_sprite_font.cpp
index 2f4c9e8df0..01318e764a 100644
--- a/engines/ags/plugins/ags_sprite_font/ags_sprite_font.cpp
+++ b/engines/ags/plugins/ags_sprite_font/ags_sprite_font.cpp
@@ -76,7 +76,7 @@ VariableWidthSpriteFontRenderer *AGSSpriteFont::_vWidthRenderer;
#define STRINGIFY(s) STRINGIFY_X(s)
#define STRINGIFY_X(s) #s
-AGSSpriteFont::AGSSpriteFont() : DLL() {
+AGSSpriteFont::AGSSpriteFont() : PluginBase() {
_engine = nullptr;
DLL_METHOD(AGS_GetPluginName);
diff --git a/engines/ags/plugins/ags_sprite_font/ags_sprite_font.h b/engines/ags/plugins/ags_sprite_font/ags_sprite_font.h
index 449c4d7a66..53b459b463 100644
--- a/engines/ags/plugins/ags_sprite_font/ags_sprite_font.h
+++ b/engines/ags/plugins/ags_sprite_font/ags_sprite_font.h
@@ -23,7 +23,7 @@
#ifndef AGS_PLUGINS_AGS_SPRITE_FONT_AGS_SPRITE_FONT_H
#define AGS_PLUGINS_AGS_SPRITE_FONT_AGS_SPRITE_FONT_H
-#include "ags/plugins/dll.h"
+#include "ags/plugins/plugin_base.h"
#include "ags/plugins/serializer.h"
#include "ags/plugins/ags_sprite_font/sprite_font_renderer.h"
#include "ags/plugins/ags_sprite_font/variable_width_sprite_font.h"
@@ -32,7 +32,7 @@ namespace AGS3 {
namespace Plugins {
namespace AGSSpriteFont {
-class AGSSpriteFont : public DLL {
+class AGSSpriteFont : public PluginBase {
private:
static IAGSEngine *_engine;
static SpriteFontRenderer *_fontRenderer;
diff --git a/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.h b/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.h
index 4bd05f58cc..b45fbd95a8 100644
--- a/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.h
+++ b/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.h
@@ -23,7 +23,7 @@
#ifndef AGS_PLUGINS_AGS_SPRITE_FONT_VAR_WIDTH_SPR_FONT_H
#define AGS_PLUGINS_AGS_SPRITE_FONT_VAR_WIDTH_SPR_FONT_H
-#include "ags/plugins/dll.h"
+#include "ags/plugins/plugin_base.h"
#include "ags/plugins/serializer.h"
#include "ags/plugins/agsplugin.h"
#include "ags/plugins/ags_sprite_font/variable_width_font.h"
diff --git a/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.cpp b/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.cpp
index cf5bb82271..bad988c624 100644
--- a/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.cpp
+++ b/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.cpp
@@ -28,7 +28,7 @@ namespace Plugins {
namespace AGSTcpIp {
-AGSTcpIp::AGSTcpIp() : DLL() {
+AGSTcpIp::AGSTcpIp() : PluginBase() {
DLL_METHOD(AGS_GetPluginName);
DLL_METHOD(AGS_EngineStartup);
}
diff --git a/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.h b/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.h
index cbcf43a06c..e7e34efcde 100644
--- a/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.h
+++ b/engines/ags/plugins/ags_tcp_ip/ags_tcp_ip.h
@@ -23,14 +23,14 @@
#ifndef AGS_PLUGINS_AGS_TCP_IP_AGS_TCP_IP_H
#define AGS_PLUGINS_AGS_TCP_IP_AGS_TCP_IP_H
-#include "ags/plugins/dll.h"
+#include "ags/plugins/plugin_base.h"
#include "ags/lib/allegro.h"
namespace AGS3 {
namespace Plugins {
namespace AGSTcpIp {
-class AGSTcpIp : public DLL {
+class AGSTcpIp : public PluginBase {
private:
static const char *AGS_GetPluginName();
static void AGS_EngineStartup(IAGSEngine *engine);
diff --git a/engines/ags/plugins/dll.cpp b/engines/ags/plugins/plugin_base.cpp
similarity index 84%
rename from engines/ags/plugins/dll.cpp
rename to engines/ags/plugins/plugin_base.cpp
index b678d4ba45..e9e478d147 100644
--- a/engines/ags/plugins/dll.cpp
+++ b/engines/ags/plugins/plugin_base.cpp
@@ -21,7 +21,7 @@
*/
#include "ags/lib/allegro.h"
-#include "ags/plugins/dll.h"
+#include "ags/plugins/plugin_base.h"
#include "ags/plugins/ags_blend/ags_blend.h"
#include "ags/plugins/ags_creditz/ags_creditz1.h"
#include "ags/plugins/ags_creditz/ags_creditz2.h"
@@ -91,14 +91,14 @@ void *pluginOpen(const char *filename) {
}
int pluginClose(void *lib) {
- DLL *dll = static_cast<DLL *>(lib);
- delete dll;
+ PluginBase *plugin = static_cast<PluginBase *>(lib);
+ delete plugin;
return 0;
}
void *pluginSym(void *lib, const char *method) {
- DLL *dll = static_cast<DLL *>(lib);
- return (*dll)[method];
+ PluginBase *plugin = static_cast<PluginBase *>(lib);
+ return (*plugin)[method];
}
const char *pluginError() {
@@ -107,7 +107,7 @@ const char *pluginError() {
/*------------------------------------------------------------------*/
-DLL::DLL() {
+PluginBase::PluginBase() {
DLL_METHOD(AGS_PluginV2);
DLL_METHOD(AGS_EditorStartup);
DLL_METHOD(AGS_EditorShutdown);
@@ -121,38 +121,38 @@ DLL::DLL() {
DLL_METHOD(AGS_EngineInitGfx);
}
-int DLL::AGS_EditorStartup(IAGSEditor *) {
+int PluginBase::AGS_EditorStartup(IAGSEditor *) {
return 0;
}
-void DLL::AGS_EditorShutdown() {
+void PluginBase::AGS_EditorShutdown() {
}
-void DLL::AGS_EditorProperties(HWND) {
+void PluginBase::AGS_EditorProperties(HWND) {
}
-int DLL::AGS_EditorSaveGame(char *, int) {
+int PluginBase::AGS_EditorSaveGame(char *, int) {
return 0;
}
-void DLL::AGS_EditorLoadGame(char *, int) {
+void PluginBase::AGS_EditorLoadGame(char *, int) {
}
-void DLL::AGS_EngineStartup(IAGSEngine *) {
+void PluginBase::AGS_EngineStartup(IAGSEngine *) {
}
-void DLL::AGS_EngineShutdown() {
+void PluginBase::AGS_EngineShutdown() {
}
-NumberPtr DLL::AGS_EngineOnEvent(int, NumberPtr) {
+NumberPtr PluginBase::AGS_EngineOnEvent(int, NumberPtr) {
return 0;
}
-int DLL::AGS_EngineDebugHook(const char *, int, int) {
+int PluginBase::AGS_EngineDebugHook(const char *, int, int) {
return 0;
}
-void DLL::AGS_EngineInitGfx(const char *driverID, void *data) {
+void PluginBase::AGS_EngineInitGfx(const char *driverID, void *data) {
assert(!strcmp(driverID, "Software"));
}
diff --git a/engines/ags/plugins/dll.h b/engines/ags/plugins/plugin_base.h
similarity index 96%
rename from engines/ags/plugins/dll.h
rename to engines/ags/plugins/plugin_base.h
index 034be5774c..8783dafcd7 100644
--- a/engines/ags/plugins/dll.h
+++ b/engines/ags/plugins/plugin_base.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef AGS_PLUGINS_DLL_H
-#define AGS_PLUGINS_DLL_H
+#ifndef AGS_PLUGINS_PLUGIN_BASE_H
+#define AGS_PLUGINS_PLUGIN_BASE_H
#include "ags/shared/util/string.h"
#include "ags/plugins/agsplugin.h"
@@ -85,9 +85,9 @@ using string = const char *;
typedef uint32 HWND;
/**
- * Base class for the implementation of AGS plugin DLLs
+ * Base class for the implementation of AGS plugins
*/
-class DLL {
+class PluginBase {
protected:
Common::HashMap<Common::String, void *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _methods;
@@ -105,7 +105,7 @@ protected:
static int AGS_EngineDebugHook(const char *, int, int);
static void AGS_EngineInitGfx(const char *driverID, void *data);
public:
- DLL();
+ PluginBase();
void *operator[](const Common::String &methodName) const {
return _methods[methodName];
Commit: a291894e3bf57ab37e38bedb13b664ef70aa0fd2
https://github.com/scummvm/scummvm/commit/a291894e3bf57ab37e38bedb13b664ef70aa0fd2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-02-16T21:13:45-08:00
Commit Message:
AGS: Change plugins savegame code to use Serializer
Changed paths:
engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
engines/ags/plugins/ags_flashlight/ags_flashlight.h
engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
engines/ags/plugins/ags_pal_render/ags_pal_render.h
engines/ags/plugins/ags_pal_render/pal_render.h
engines/ags/plugins/ags_pal_render/raycast.cpp
engines/ags/plugins/ags_pal_render/raycast.h
engines/ags/plugins/ags_parallax/ags_parallax.cpp
engines/ags/plugins/ags_parallax/ags_parallax.h
engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp
engines/ags/plugins/ags_snow_rain/weather.cpp
engines/ags/plugins/ags_snow_rain/weather.h
engines/ags/plugins/ags_sprite_font/ags_sprite_font.h
engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.h
engines/ags/plugins/serializer.h
diff --git a/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp b/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
index 0390b570dc..861dc9ebc2 100644
--- a/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
+++ b/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
@@ -175,9 +175,11 @@ NumberPtr AGSFlashlight::AGS_EngineOnEvent(int event, NumberPtr data) {
if (event == AGSE_PREGUIDRAW) {
Update();
} else if (event == AGSE_RESTOREGAME) {
- RestoreGame(data);
+ Serializer s(_engine, data, true);
+ syncGame(s);
} else if (event == AGSE_SAVEGAME) {
- SaveGame(data);
+ Serializer s(_engine, data, false);
+ syncGame(s);
} else if (event == AGSE_PRESCREENDRAW) {
// Get screen size once here.
_engine->GetScreenDimensions(&screen_width, &screen_height, &screen_color_depth);
@@ -527,78 +529,42 @@ void AGSFlashlight::Update() {
_engine->MarkRegionDirty(0, 0, screen_width, screen_height);
}
-size_t AGSFlashlight::engineFileRead(void *ptr, size_t size, size_t count, long fileHandle) {
- auto totalBytes = _engine->FRead(ptr, size * count, fileHandle);
- return totalBytes / size;
-}
-
-size_t AGSFlashlight::engineFileWrite(const void *ptr, size_t size, size_t count, long fileHandle) {
- auto totalBytes = _engine->FWrite(const_cast<void *>(ptr), size * count, fileHandle);
- return totalBytes / size;
-}
-
-void AGSFlashlight::RestoreGame(long file) {
- unsigned int SaveVersion = 0;
- engineFileRead(&SaveVersion, sizeof(SaveVersion), 1, file);
+void AGSFlashlight::syncGame(Serializer &s) {
+ unsigned int SaveVersion = SaveMagic;
+ s.syncAsInt(SaveVersion);
- if (SaveVersion != SaveMagic) {
+ if (s.isLoading() && SaveVersion != SaveMagic)
_engine->AbortGame("agsflashlight: bad save.");
- }
-
- // Current version
- engineFileRead(&g_RedTint, 4, 1, file);
- engineFileRead(&g_GreenTint, 4, 1, file);
- engineFileRead(&g_BlueTint, 4, 1, file);
-
- engineFileRead(&g_DarknessLightLevel, 4, 1, file);
- engineFileRead(&g_BrightnessLightLevel, 4, 1, file);
- engineFileRead(&g_DarknessSize, 4, 1, file);
- engineFileRead(&g_DarknessDiameter, 4, 1, file);
- engineFileRead(&g_BrightnessSize, 4, 1, file);
-
- engineFileRead(&g_FlashlightX, 4, 1, file);
- engineFileRead(&g_FlashlightY, 4, 1, file);
- engineFileRead(&g_FlashlightFollowMouse, 4, 1, file);
+ s.syncAsInt(g_RedTint);
+ s.syncAsInt(g_GreenTint);
+ s.syncAsInt(g_BlueTint);
- engineFileRead(&g_FollowCharacterId, 4, 1, file);
- engineFileRead(&g_FollowCharacterDx, 4, 1, file);
- engineFileRead(&g_FollowCharacterDy, 4, 1, file);
- engineFileRead(&g_FollowCharacterHorz, 4, 1, file);
- engineFileRead(&g_FollowCharacterVert, 4, 1, file);
+ s.syncAsInt(g_DarknessLightLevel);
+ s.syncAsInt(g_BrightnessLightLevel);
+ s.syncAsInt(g_DarknessSize);
+ s.syncAsInt(g_DarknessDiameter);
+ s.syncAsInt(g_BrightnessSize);
- if (g_FollowCharacterId != 0)
- g_FollowCharacter = _engine->GetCharacter(g_FollowCharacterId);
+ s.syncAsInt(g_FlashlightX);
+ s.syncAsInt(g_FlashlightY);
- g_BitmapMustBeUpdated = true;
-}
-
-void AGSFlashlight::SaveGame(long file) {
- engineFileWrite(&SaveMagic, sizeof(SaveMagic), 1, file);
-
- engineFileWrite(&g_RedTint, 4, 1, file);
- engineFileWrite(&g_GreenTint, 4, 1, file);
- engineFileWrite(&g_BlueTint, 4, 1, file);
+ s.syncAsInt(g_FlashlightFollowMouse);
- engineFileWrite(&g_DarknessLightLevel, 4, 1, file);
- engineFileWrite(&g_BrightnessLightLevel, 4, 1, file);
- engineFileWrite(&g_DarknessSize, 4, 1, file);
- engineFileWrite(&g_DarknessDiameter, 4, 1, file);
- engineFileWrite(&g_BrightnessSize, 4, 1, file);
+ s.syncAsInt(g_FollowCharacterId);
+ s.syncAsInt(g_FollowCharacterDx);
+ s.syncAsInt(g_FollowCharacterDy);
+ s.syncAsInt(g_FollowCharacterHorz);
+ s.syncAsInt(g_FollowCharacterVert);
- engineFileWrite(&g_FlashlightX, 4, 1, file);
- engineFileWrite(&g_FlashlightY, 4, 1, file);
+ if (s.isLoading()) {
+ if (g_FollowCharacterId != 0)
+ g_FollowCharacter = _engine->GetCharacter(g_FollowCharacterId);
- engineFileWrite(&g_FlashlightFollowMouse, 4, 1, file);
-
- engineFileWrite(&g_FollowCharacterId, 4, 1, file);
- engineFileWrite(&g_FollowCharacterDx, 4, 1, file);
- engineFileWrite(&g_FollowCharacterDy, 4, 1, file);
- engineFileWrite(&g_FollowCharacterHorz, 4, 1, file);
- engineFileWrite(&g_FollowCharacterVert, 4, 1, file);
+ g_BitmapMustBeUpdated = true;
+ }
}
-
// ********************************************
// ************ AGS Interface ***************
// ********************************************
diff --git a/engines/ags/plugins/ags_flashlight/ags_flashlight.h b/engines/ags/plugins/ags_flashlight/ags_flashlight.h
index 99beb91a9b..b47e4fbc7c 100644
--- a/engines/ags/plugins/ags_flashlight/ags_flashlight.h
+++ b/engines/ags/plugins/ags_flashlight/ags_flashlight.h
@@ -24,6 +24,7 @@
#define AGS_PLUGINS_AGSFLASHLIGHT_AGSFLASHLIGHT_H
#include "ags/plugins/plugin_base.h"
+#include "ags/plugins/serializer.h"
#include "ags/lib/allegro.h"
namespace AGS3 {
@@ -85,10 +86,7 @@ private:
static void DrawDarkness();
static void CreateLightBitmap();
static void Update();
- static size_t engineFileRead(void *ptr, size_t size, size_t count, long fileHandle);
- static size_t engineFileWrite(const void *ptr, size_t size, size_t count, long fileHandle);
- static void RestoreGame(long file);
- static void SaveGame(long file);
+ static void syncGame(Serializer &s);
static void SetFlashlightTint(int RedTint, int GreenTint, int BlueTint);
static int GetFlashlightTintRed();
static int GetFlashlightTintGreen();
diff --git a/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp b/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
index 7452d46eb9..4d4581408a 100644
--- a/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
+++ b/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
@@ -63,7 +63,7 @@ struct transoverlaytype {
int clutslot;
int drawreflections;
-unsigned char cycle_remap [256];
+byte cycle_remap[256];
struct starstype {
float x;
@@ -1687,154 +1687,12 @@ NumberPtr AGSPalRender::AGS_EngineOnEvent(int event, NumberPtr data) {
if (LensOption.draw == 1 && LensOption.level == 4) DrawLens(LensOption.x, LensOption.y);
}
if (event == AGSE_SAVEGAME) {
- for (int i = 0; i < MAX_OVERLAYS; ++i) {
- engine->FWrite(&overlay[i].sprite, sizeof(int32), data);
- engine->FWrite(&overlay[i].spritemask, sizeof(int32), data);
- engine->FWrite(&overlay[i].x, sizeof(int32), data);
- engine->FWrite(&overlay[i].y, sizeof(int32), data);
- engine->FWrite(&overlay[i].level, sizeof(int32), data);
- engine->FWrite(&overlay[i].trans, sizeof(int32), data);
- engine->FWrite(&overlay[i].blendtype, sizeof(int32), data);
- engine->FWrite(&overlay[i].enabled, sizeof(bool), data);
- }
- engine->FWrite(&clutslot, sizeof(int32), data);
- engine->FWrite(&drawreflections, sizeof(int32), data);
- for (int j = 0; j < 256; ++j) {
- engine->FWrite(&cycle_remap[j], sizeof(unsigned char), data);
- }
- for (int j = 0; j < 256; ++j) {
- engine->FWrite(&objectivepal[j].r, sizeof(unsigned char), data);
- engine->FWrite(&objectivepal[j].b, sizeof(unsigned char), data);
- engine->FWrite(&objectivepal[j].g, sizeof(unsigned char), data);
- }
- for (int j = 0; j < 256; ++j) {
- engine->FWrite(&sprite[j].x, sizeof(double), data);
- engine->FWrite(&sprite[j].y, sizeof(double), data);
- engine->FWrite(&sprite[j].texture, sizeof(int32), data);
- engine->FWrite(&sprite[j].alpha, sizeof(unsigned char), data);
- engine->FWrite(&sprite[j].uDivW, sizeof(double), data);
- engine->FWrite(&sprite[j].uDivH, sizeof(double), data);
- engine->FWrite(&sprite[j].vMove, sizeof(double), data);
- engine->FWrite(&sprite[j].hMove, sizeof(double), data);
- engine->FWrite(&sprite[j].objectinteract, sizeof(char), data);
- engine->FWrite(&sprite[j].view, sizeof(int32), data);
- engine->FWrite(&sprite[j].frame, sizeof(int32), data);
- engine->FWrite(&sprite[j].angle, sizeof(int32), data);
- }
- for (int j = 0; j < 256; ++j) {
- for (int k = 0; k < 4; ++k) {
- engine->FWrite(&wallData[j].texture[k], sizeof(int32), data);
- engine->FWrite(&wallData[j].solid[k], sizeof(int32), data);
- engine->FWrite(&wallData[j].ignorelighting[k], sizeof(int32), data);
- engine->FWrite(&wallData[j].alpha[k], sizeof(int32), data);
- engine->FWrite(&wallData[j].blendtype[k], sizeof(int32), data);
- engine->FWrite(&wallData[j].mask[k], sizeof(int32), data);
- }
- engine->FWrite(&wallData[j].hotspotinteract, sizeof(char), data);
- }
- engine->FWrite(&raycastOn, sizeof(bool), data);
- engine->FWrite(&heightmapOn, sizeof(bool), data);
- engine->FWrite(&posX, sizeof(double), data);
- engine->FWrite(&posY, sizeof(double), data);
- engine->FWrite(&dirX, sizeof(double), data);
- engine->FWrite(&dirY, sizeof(double), data);
- engine->FWrite(&planeX, sizeof(double), data);
- engine->FWrite(&planeY, sizeof(double), data);
- engine->FWrite(&moveSpeed, sizeof(double), data);
- engine->FWrite(&rotSpeed, sizeof(double), data);
- if (raycastOn) { //If the raycaster is active, we have additional data to save.
- for (int i = 0; i < MAP_WIDTH; ++i)
- for (int j = 0; j < MAP_HEIGHT; ++j) {
- engine->FWrite(&worldMap [i][j], sizeof(unsigned char), data);
- engine->FWrite(&lightMap [i][j], sizeof(unsigned char), data);
- engine->FWrite(&ceilingMap [i][j], sizeof(int32), data);
- engine->FWrite(&floorMap [i][j], sizeof(int32), data);
- engine->FWrite(&heightMap [i][j], sizeof(int32), data);
- }
- }
- engine->FWrite(&textureSlot, sizeof(int32), data);
- engine->FWrite(&skybox, sizeof(int32), data);
- engine->FWrite(&ambientlight, sizeof(int32), data);
+ Serializer s(engine, data, false);
+ syncGame(s);
}
if (event == AGSE_RESTOREGAME) {
-
-
- for (int i = 0; i < MAX_OVERLAYS; ++i) {
- engine->FRead(&overlay[i].sprite, sizeof(int32), data);
- engine->FRead(&overlay[i].spritemask, sizeof(int32), data);
- engine->FRead(&overlay[i].x, sizeof(int32), data);
- engine->FRead(&overlay[i].y, sizeof(int32), data);
- engine->FRead(&overlay[i].level, sizeof(int32), data);
- engine->FRead(&overlay[i].trans, sizeof(int32), data);
- engine->FRead(&overlay[i].blendtype, sizeof(int32), data);
- engine->FRead(&overlay[i].enabled, sizeof(bool), data);
- }
- engine->FRead(&clutslot, sizeof(int32), data);
- engine->FRead(&drawreflections, sizeof(int32), data);
- for (int j = 0; j < 256; ++j) {
- engine->FRead(&cycle_remap[j], sizeof(unsigned char), data);
- }
- for (int j = 0; j < 256; ++j) { //Save Objective Palette, for palette mixing.
- engine->FRead(&objectivepal[j].r, sizeof(unsigned char), data);
- engine->FRead(&objectivepal[j].b, sizeof(unsigned char), data);
- engine->FRead(&objectivepal[j].g, sizeof(unsigned char), data);
- }
- for (int j = 0; j < 256; ++j) { //Save Raycaster Sprite struct, 256 instances.
- engine->FRead(&sprite[j].x, sizeof(double), data);
- engine->FRead(&sprite[j].y, sizeof(double), data);
- engine->FRead(&sprite[j].texture, sizeof(int32), data);
- engine->FRead(&sprite[j].alpha, sizeof(unsigned char), data);
- engine->FRead(&sprite[j].uDivW, sizeof(double), data);
- engine->FRead(&sprite[j].uDivH, sizeof(double), data);
- engine->FRead(&sprite[j].vMove, sizeof(double), data);
- engine->FRead(&sprite[j].hMove, sizeof(double), data);
- engine->FRead(&sprite[j].objectinteract, sizeof(char), data);
- engine->FRead(&sprite[j].view, sizeof(int32), data);
- engine->FRead(&sprite[j].frame, sizeof(int32), data);
- engine->FRead(&sprite[j].angle, sizeof(int32), data);
- }
- for (int j = 0; j < 256; ++j) { //Save Raycaster wall type data.
- for (int k = 0; k < 4; ++k) {
- engine->FRead(&wallData[j].texture[k], sizeof(int32), data);
- engine->FRead(&wallData[j].solid[k], sizeof(int32), data);
- engine->FRead(&wallData[j].ignorelighting[k], sizeof(int32), data);
- engine->FRead(&wallData[j].alpha[k], sizeof(int32), data);
- engine->FRead(&wallData[j].blendtype[k], sizeof(int32), data);
- engine->FRead(&wallData[j].mask[k], sizeof(int32), data);
- }
- engine->FRead(&wallData[j].hotspotinteract, sizeof(char), data);
- }
- //Delete worldmap data if it exists.
- engine->FRead(&raycastOn, sizeof(bool), data);
- engine->FRead(&heightmapOn, sizeof(bool), data);
- engine->FRead(&posX, sizeof(double), data);
- engine->FRead(&posY, sizeof(double), data);
- engine->FRead(&dirX, sizeof(double), data);
- engine->FRead(&dirY, sizeof(double), data);
- engine->FRead(&planeX, sizeof(double), data);
- engine->FRead(&planeY, sizeof(double), data);
- engine->FRead(&moveSpeed, sizeof(double), data);
- engine->FRead(&rotSpeed, sizeof(double), data);
- if (raycastOn) { //If the raycaster is currently running, we have additional data to load.
- for (int i = 0; i < MAP_WIDTH; ++i) {
- for (int j = 0; j < MAP_HEIGHT; ++j) {
- engine->FRead(&worldMap [i][j], sizeof(unsigned char), data);
- engine->FRead(&lightMap [i][j], sizeof(unsigned char), data);
- engine->FRead(&ceilingMap [i][j], sizeof(int32), data);
- engine->FRead(&floorMap [i][j], sizeof(int32), data);
- engine->FRead(&heightMap [i][j], sizeof(int32), data);
- seenMap [i][j] = 0;
- }
- }
-
- //Reinitialize all the buffers and stuff.
-
- }
- engine->FRead(&textureSlot, sizeof(int32), data);
- if (textureSlot) MakeTextures(textureSlot);
- engine->FRead(&skybox, sizeof(int32), data);
- engine->FRead(&ambientlight, sizeof(int32), data);
- LoadCLUT(clutslot);
+ Serializer s(engine, data, true);
+ syncGame(s);
}
if (event == AGSE_ENTERROOM) {
ResetRemapping();
@@ -1844,6 +1702,90 @@ NumberPtr AGSPalRender::AGS_EngineOnEvent(int event, NumberPtr data) {
return 0;
}
+void AGSPalRender::syncGame(Serializer &s) {
+ for (int i = 0; i < MAX_OVERLAYS; ++i) {
+ s.syncAsInt(overlay[i].sprite);
+ s.syncAsInt(overlay[i].spritemask);
+ s.syncAsInt(overlay[i].x);
+ s.syncAsInt(overlay[i].y);
+ s.syncAsInt(overlay[i].level);
+ s.syncAsInt(overlay[i].trans);
+ s.syncAsInt(overlay[i].blendtype);
+ s.syncAsBool(overlay[i].enabled);
+ }
+ s.syncAsInt(clutslot);
+ s.syncAsInt(drawreflections);
+
+ for (int j = 0; j < 256; ++j)
+ s.syncAsByte(cycle_remap[j]);
+
+ for (int j = 0; j < 256; ++j) {
+ s.syncAsByte(objectivepal[j].r);
+ s.syncAsByte(objectivepal[j].b);
+ s.syncAsByte(objectivepal[j].g);
+ }
+
+ for (int j = 0; j < 256; ++j) {
+ s.syncAsDouble(sprite[j].x);
+ s.syncAsDouble(sprite[j].y);
+ s.syncAsInt(sprite[j].texture);
+ s.syncAsByte(sprite[j].alpha);
+ s.syncAsDouble(sprite[j].uDivW);
+ s.syncAsDouble(sprite[j].uDivH);
+ s.syncAsDouble(sprite[j].vMove);
+ s.syncAsDouble(sprite[j].hMove);
+ s.syncAsInt8(sprite[j].objectinteract);
+ s.syncAsInt(sprite[j].view);
+ s.syncAsInt(sprite[j].frame);
+ s.syncAsInt(sprite[j].angle);
+ }
+
+ for (int j = 0; j < 256; ++j) {
+ for (int k = 0; k < 4; ++k) {
+ s.syncAsInt(wallData[j].texture[k]);
+ s.syncAsInt(wallData[j].solid[k]);
+ s.syncAsInt(wallData[j].ignorelighting[k]);
+ s.syncAsInt(wallData[j].alpha[k]);
+ s.syncAsInt(wallData[j].blendtype[k]);
+ s.syncAsInt(wallData[j].mask[k]);
+ }
+
+ s.syncAsByte(wallData[j].hotspotinteract);
+ }
+
+ s.syncAsBool(raycastOn);
+ s.syncAsBool(heightmapOn);
+ s.syncAsDouble(posX);
+ s.syncAsDouble(posY);
+ s.syncAsDouble(dirX);
+ s.syncAsDouble(dirY);
+ s.syncAsDouble(planeX);
+ s.syncAsDouble(planeY);
+ s.syncAsDouble(moveSpeed);
+ s.syncAsDouble(rotSpeed);
+
+ if (raycastOn) { //If the raycaster is active, we have additional data to save.
+ for (int i = 0; i < MAP_WIDTH; ++i)
+ for (int j = 0; j < MAP_HEIGHT; ++j) {
+ s.syncAsByte(worldMap[i][j]);
+ s.syncAsByte(lightMap[i][j]);
+ s.syncAsInt(ceilingMap[i][j]);
+ s.syncAsInt(floorMap[i][j]);
+ s.syncAsInt(heightMap[i][j]);
+ }
+ }
+
+ s.syncAsInt(textureSlot);
+ if (s.isLoading() && textureSlot)
+ MakeTextures(textureSlot);
+
+ s.syncAsInt(skybox);
+ s.syncAsInt(ambientlight);
+
+ if (s.isLoading())
+ LoadCLUT(clutslot);
+}
+
} // namespace AGSPalRender
} // namespace Plugins
} // namespace AGS3
diff --git a/engines/ags/plugins/ags_pal_render/ags_pal_render.h b/engines/ags/plugins/ags_pal_render/ags_pal_render.h
index b9fcf0bd3c..2eaa35f7c7 100644
--- a/engines/ags/plugins/ags_pal_render/ags_pal_render.h
+++ b/engines/ags/plugins/ags_pal_render/ags_pal_render.h
@@ -24,6 +24,7 @@
#define AGS_PLUGINS_AGS_PAL_RENDER_AGS_PAL_RENDER_H
#include "ags/plugins/plugin_base.h"
+#include "ags/plugins/serializer.h"
namespace AGS3 {
namespace Plugins {
@@ -35,7 +36,7 @@ private:
static void AGS_EngineStartup(IAGSEngine *lpEngine);
static void AGS_EngineShutdown();
static NumberPtr AGS_EngineOnEvent(int event, NumberPtr data);
-
+ static void syncGame(Serializer &s);
public:
AGSPalRender();
};
diff --git a/engines/ags/plugins/ags_pal_render/pal_render.h b/engines/ags/plugins/ags_pal_render/pal_render.h
index 1f160791cd..aac0469da3 100644
--- a/engines/ags/plugins/ags_pal_render/pal_render.h
+++ b/engines/ags/plugins/ags_pal_render/pal_render.h
@@ -37,9 +37,9 @@ namespace AGSPalRender {
#define RETURN_FLOAT(x) int32 __ret##x; memcpy(&__ret##x, &x, sizeof(float)); return __ret##x
struct PALSTRUCT {
- int r;
- int b;
- int g;
+ byte r;
+ byte b;
+ byte g;
};
extern IAGSEngine *engine;
diff --git a/engines/ags/plugins/ags_pal_render/raycast.cpp b/engines/ags/plugins/ags_pal_render/raycast.cpp
index dfafe3e6ec..329750babc 100644
--- a/engines/ags/plugins/ags_pal_render/raycast.cpp
+++ b/engines/ags/plugins/ags_pal_render/raycast.cpp
@@ -38,12 +38,12 @@ double dirX = -1.0, dirY = 0.0; //initial direction vector
double planeX = 0.0, planeY = 0.77; //the 2d raycaster version of camera plane
double moveSpeed = (1.0 / 60.0) * 3.0; //the constant value is in squares/second
double rotSpeed = (1.0 / 60.0) * 2.0; //the constant value is in radians/second
-unsigned char worldMap[MAP_WIDTH][MAP_HEIGHT];
-unsigned char lightMap[MAP_WIDTH][MAP_HEIGHT];
+byte worldMap[MAP_WIDTH][MAP_HEIGHT];
+byte lightMap[MAP_WIDTH][MAP_HEIGHT];
int ceilingMap[MAP_WIDTH][MAP_HEIGHT];
int floorMap[MAP_WIDTH][MAP_HEIGHT];
int heightMap[MAP_WIDTH][MAP_HEIGHT];
-unsigned char seenMap[MAP_WIDTH][MAP_HEIGHT];
+byte seenMap[MAP_WIDTH][MAP_HEIGHT];
int textureSlot;
int ambientlight;
int ambientweight = 0;
diff --git a/engines/ags/plugins/ags_pal_render/raycast.h b/engines/ags/plugins/ags_pal_render/raycast.h
index d0bcb7e78f..ab83fa413b 100644
--- a/engines/ags/plugins/ags_pal_render/raycast.h
+++ b/engines/ags/plugins/ags_pal_render/raycast.h
@@ -36,13 +36,13 @@ struct Sprite {
double x;
double y;
int texture;
- unsigned char alpha;
+ byte alpha;
int blendmode;
double uDivW;
double uDivH;
double vMove;
double hMove;
- char objectinteract;
+ int8 objectinteract;
int view;
int frame;
int angle;
@@ -55,7 +55,7 @@ struct wallType {
int alpha[4];
int blendtype[4];
int mask[4];
- unsigned char hotspotinteract;
+ byte hotspotinteract;
};
diff --git a/engines/ags/plugins/ags_parallax/ags_parallax.cpp b/engines/ags/plugins/ags_parallax/ags_parallax.cpp
index e9ec5c6476..aa13a1fcd6 100644
--- a/engines/ags/plugins/ags_parallax/ags_parallax.cpp
+++ b/engines/ags/plugins/ags_parallax/ags_parallax.cpp
@@ -86,10 +86,10 @@ NumberPtr AGSParallax::AGS_EngineOnEvent(int event, NumberPtr data) {
_engine->UnrequestEventHook(AGSE_PRESCREENDRAW);
} else if (event == AGSE_RESTOREGAME) {
Serializer s(_engine, data, true);
- SyncGame(s);
+ syncGame(s);
} else if (event == AGSE_SAVEGAME) {
Serializer s(_engine, data, false);
- SyncGame(s);
+ syncGame(s);
}
return 0;
@@ -104,7 +104,7 @@ void AGSParallax::clear() {
_enabled = false;
}
-void AGSParallax::SyncGame(Serializer &s) {
+void AGSParallax::syncGame(Serializer &s) {
int saveVersion = SaveMagic;
s.syncAsInt(saveVersion);
if ((uint)saveVersion != SaveMagic) {
@@ -113,7 +113,7 @@ void AGSParallax::SyncGame(Serializer &s) {
}
for (int i = 0; i < MAX_SPRITES; ++i)
- _sprites[i].SyncGame(s);
+ _sprites[i].syncGame(s);
s.syncAsBool(_enabled);
}
@@ -186,7 +186,7 @@ void AGSParallax::pxDeleteSprite(int id) {
/*------------------------------------------------------------------*/
-void Sprite::SyncGame(Serializer &s) {
+void Sprite::syncGame(Serializer &s) {
s.syncAsInt(x);
s.syncAsInt(y);
s.syncAsInt(slot);
diff --git a/engines/ags/plugins/ags_parallax/ags_parallax.h b/engines/ags/plugins/ags_parallax/ags_parallax.h
index 89ca665fd5..128e740d93 100644
--- a/engines/ags/plugins/ags_parallax/ags_parallax.h
+++ b/engines/ags/plugins/ags_parallax/ags_parallax.h
@@ -36,7 +36,7 @@ struct Sprite {
int slot = -1;
int speed = 0;
- void SyncGame(Serializer &s);
+ void syncGame(Serializer &s);
};
#define MAX_SPEED 1000
@@ -64,7 +64,7 @@ private:
static void pxDeleteSprite(int id);
private:
- static void SyncGame(Serializer &s);
+ static void syncGame(Serializer &s);
static void Draw(bool foreground);
static void clear();
diff --git a/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp b/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp
index 3062ef53cd..df27e3e358 100644
--- a/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp
+++ b/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp
@@ -109,12 +109,12 @@ NumberPtr AGSSnowRain::AGS_EngineOnEvent(int event, NumberPtr data) {
_snow->EnterRoom();
} else if (event == AGSE_RESTOREGAME) {
Serializer s(_engine, data, true);
- _rain->SyncGame(s);
- _snow->SyncGame(s);
+ _rain->syncGame(s);
+ _snow->syncGame(s);
} else if (event == AGSE_SAVEGAME) {
Serializer s(_engine, data, false);
- _rain->SyncGame(s);
- _snow->SyncGame(s);
+ _rain->syncGame(s);
+ _snow->syncGame(s);
} else if (event == AGSE_PRESCREENDRAW) {
// Get screen size once here
_engine->GetScreenDimensions(&_screenWidth, &_screenHeight , &_screenColorDepth);
diff --git a/engines/ags/plugins/ags_snow_rain/weather.cpp b/engines/ags/plugins/ags_snow_rain/weather.cpp
index 214cb0737e..69bb4544ca 100644
--- a/engines/ags/plugins/ags_snow_rain/weather.cpp
+++ b/engines/ags/plugins/ags_snow_rain/weather.cpp
@@ -37,7 +37,7 @@ const unsigned int SaveMagic = Magic + Version;
const float PI = 3.14159265f;
-void View::SyncGame(Serializer &s) {
+void View::syncGame(Serializer &s) {
s.syncAsInt(view);
s.syncAsInt(loop);
s.syncAsBool(is_default);
@@ -133,7 +133,7 @@ void Weather::UpdateWithDrift() {
_engine->MarkRegionDirty(0, 0, _screenWidth, _screenHeight);
}
-void Weather::SyncGame(Serializer &s) {
+void Weather::syncGame(Serializer &s) {
int saveVersion = SaveMagic;
s.syncAsInt(saveVersion);
@@ -165,7 +165,7 @@ void Weather::SyncGame(Serializer &s) {
s.syncAsInt(_mDeltaFallSpeed);
for (int i = 0; i < 5; ++i)
- _mViews[i].SyncGame(s);
+ _mViews[i].syncGame(s);
if (s.isLoading())
InitializeParticles();
diff --git a/engines/ags/plugins/ags_snow_rain/weather.h b/engines/ags/plugins/ags_snow_rain/weather.h
index b166bb27f7..dc229bf531 100644
--- a/engines/ags/plugins/ags_snow_rain/weather.h
+++ b/engines/ags/plugins/ags_snow_rain/weather.h
@@ -36,7 +36,7 @@ struct View {
bool is_default = false;
BITMAP *bitmap = nullptr;
- void SyncGame(Serializer &s);
+ void syncGame(Serializer &s);
};
struct Drop {
@@ -95,7 +95,7 @@ public:
void Initialize();
void InitializeParticles();
- void SyncGame(Serializer &s);
+ void syncGame(Serializer &s);
bool ReinitializeViews();
bool IsActive();
diff --git a/engines/ags/plugins/ags_sprite_font/ags_sprite_font.h b/engines/ags/plugins/ags_sprite_font/ags_sprite_font.h
index 53b459b463..4fad6b3f80 100644
--- a/engines/ags/plugins/ags_sprite_font/ags_sprite_font.h
+++ b/engines/ags/plugins/ags_sprite_font/ags_sprite_font.h
@@ -24,7 +24,6 @@
#define AGS_PLUGINS_AGS_SPRITE_FONT_AGS_SPRITE_FONT_H
#include "ags/plugins/plugin_base.h"
-#include "ags/plugins/serializer.h"
#include "ags/plugins/ags_sprite_font/sprite_font_renderer.h"
#include "ags/plugins/ags_sprite_font/variable_width_sprite_font.h"
diff --git a/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.h b/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.h
index b45fbd95a8..ce64d41a9e 100644
--- a/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.h
+++ b/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.h
@@ -24,7 +24,6 @@
#define AGS_PLUGINS_AGS_SPRITE_FONT_VAR_WIDTH_SPR_FONT_H
#include "ags/plugins/plugin_base.h"
-#include "ags/plugins/serializer.h"
#include "ags/plugins/agsplugin.h"
#include "ags/plugins/ags_sprite_font/variable_width_font.h"
diff --git a/engines/ags/plugins/serializer.h b/engines/ags/plugins/serializer.h
index 68a5795081..12e878eea5 100644
--- a/engines/ags/plugins/serializer.h
+++ b/engines/ags/plugins/serializer.h
@@ -60,12 +60,33 @@ public:
_engine->FWrite(&value, 1, _file);
}
+ void syncAsInt8(int8 &value) {
+ if (_isLoading)
+ _engine->FRead(&value, 1, _file);
+ else
+ _engine->FWrite(&value, 1, _file);
+ }
+
+ void syncAsByte(byte &value) {
+ if (_isLoading)
+ _engine->FRead(&value, 1, _file);
+ else
+ _engine->FWrite(&value, 1, _file);
+ }
+
void syncAsFloat(float &value) {
if (_isLoading)
_engine->FRead(&value, sizeof(float), _file);
else
_engine->FWrite(&value, sizeof(float), _file);
}
+
+ void syncAsDouble(double &value) {
+ if (_isLoading)
+ _engine->FRead(&value, sizeof(double), _file);
+ else
+ _engine->FWrite(&value, sizeof(double), _file);
+ }
};
} // namespace Plugins
More information about the Scummvm-git-logs
mailing list