[Scummvm-git-logs] scummvm master -> be2a7d44f993ff63e65986a9394d54b668b1780a
dreammaster
noreply at scummvm.org
Wed Apr 13 05:29:59 UTC 2022
This automated email contains information about 28 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ffba3046d2 AGS: Fixed File_ReadRawLineImpl failing at char values >127
496d6870e8 AGS: Reword error messages for property lookup
97776f1b99 AGS: Fixed OPT_HIGHESTOPTION
6079ebaaf5 AGS: Updated build version (3.5.0.16)
186250aab9 AGS: added Room.BackgroundAnimationEnabled property
ceedf758fe AGS: Removed room template binary resource, create one in code
7c96238080 AGS: Do not preset Hotspot's names (description)
1dd1946aff AGS: Attempt to clarify meaning of the Font's import size
12a6d220fe AGS: Lock background animation depending on loaded room setting
a65583c09b AGS: Updated build version (3.6.0.17)
7fe18e925b AGS: Cleanup load room code a little
60ddcb068a AGS: In save components, "thisroom" should have same ver as "states"
4ecb2115ca AGS: Remove cursor limit
87d4970205 AGS: Added --translation and --no-translation cmd args
27ad60df72 AGS: Unify video flags in VideoPlayer, convert in script functions
9c01b99b32 AGS: Add clear cache on room change from Android port to config
f009829e67 AGS: Further unifying VideoPlayer code in the base class
8e3207b38b AGS: Moved frame wait and user input check outside of VideoPlayer
0b639b8f46 AGS: Implemented video pause/resume, react to window focus events
983de47d8b AGS: Added legacy support for Theora video positioning
fa997d3c4b AGS: Fixed bg frame and bg locked flag is reset on save restore
ee7d590335 AGS: Fixed weird implementation of TextStreamReader::ReadChar()
29ea22c308 AGS: Add rotation support in config
c87f807fd5 AGS: Added "GameTextEncoding" setting to the game
1b502b3d0f AGS: Switch text format mode depending on OPT_GAMETEXTENCODING
4e9cb56a9d AGS: Optionally use OPT_GAMETEXTENCODING for TRA keys conversion
d2665bfd71 AGS: Save text encoding hint in room files
be2a7d44f9 AGS: Updated build version (3.6.0.18)
Commit: ffba3046d252521eb80910d1d186ee575b5a09a3
https://github.com/scummvm/scummvm/commit/ffba3046d252521eb80910d1d186ee575b5a09a3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:52-07:00
Commit Message:
AGS: Fixed File_ReadRawLineImpl failing at char values >127
>From upstream 643e55f2b2b8237f27dc75e724bc87fa12339d7e
Changed paths:
engines/ags/engine/ac/file.cpp
diff --git a/engines/ags/engine/ac/file.cpp b/engines/ags/engine/ac/file.cpp
index b3e4fe2f37a..9dd6b1716f8 100644
--- a/engines/ags/engine/ac/file.cpp
+++ b/engines/ags/engine/ac/file.cpp
@@ -121,7 +121,7 @@ static bool File_ReadRawLineImpl(sc_File *fil, char *buffer, size_t buf_len) {
if (buf_len == 0) return false;
Stream *in = get_valid_file_stream_from_handle(fil->handle, "File.ReadRawLine");
for (size_t i = 0; i < buf_len - 1; ++i) {
- char c = in->ReadByte();
+ int c = in->ReadByte();
if (c < 0 || c == '\n') // EOF or LF
{
buffer[i] = 0;
Commit: 496d6870e869e6431853064e6dfa3c1794e74269
https://github.com/scummvm/scummvm/commit/496d6870e869e6431853064e6dfa3c1794e74269
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:52-07:00
Commit Message:
AGS: Reword error messages for property lookup
>From upstream 937f644c2bc7a8a93fd0b11559436bea1d301da4
Changed paths:
engines/ags/engine/ac/properties.cpp
diff --git a/engines/ags/engine/ac/properties.cpp b/engines/ags/engine/ac/properties.cpp
index 58e0493b4de..82f633f50bd 100644
--- a/engines/ags/engine/ac/properties.cpp
+++ b/engines/ags/engine/ac/properties.cpp
@@ -39,13 +39,13 @@ using namespace AGS::Shared;
bool get_property_desc(PropertyDesc &desc, const char *property, PropertyType want_type) {
PropertySchema::const_iterator sch_it = _GP(game).propSchema.find(property);
if (sch_it == _GP(game).propSchema.end())
- quit("!GetProperty: no such property found in schema. Make sure you are using the property's name, and not its description, when calling this command.");
+ quitprintf("!Did not find property '%s' in the schema. Make sure you are using the property's name, and not its description, when calling this command.", property);
desc = sch_it->_value;
if (want_type == kPropertyString && desc.Type != kPropertyString)
- quit("!GetTextProperty: need to use GetProperty for a non-text property");
+ quitprintf("!Property '%s' isn't a text property. Use GetProperty/SetProperty for non-text properties", property);
else if (want_type != kPropertyString && desc.Type == kPropertyString)
- quit("!GetProperty: need to use GetTextProperty for a text property");
+ quitprintf("!Property '%s' is a text property. Use GetTextProperty/SetTextProperty for text properties", property);
return true;
}
Commit: 97776f1b99eb1d4e3bdb16b04842376d2dff9699
https://github.com/scummvm/scummvm/commit/97776f1b99eb1d4e3bdb16b04842376d2dff9699
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:52-07:00
Commit Message:
AGS: Fixed OPT_HIGHESTOPTION
>From upstream 3bc36071ceb8d9ec6b6233bde22c957c7c4cf697
Changed paths:
engines/ags/shared/ac/game_struct_defines.h
diff --git a/engines/ags/shared/ac/game_struct_defines.h b/engines/ags/shared/ac/game_struct_defines.h
index 6fa6cf154e7..047a14852f5 100644
--- a/engines/ags/shared/ac/game_struct_defines.h
+++ b/engines/ags/shared/ac/game_struct_defines.h
@@ -84,7 +84,7 @@ namespace AGS3 {
#define OPT_RELATIVEASSETRES 46 // relative asset resolution mode (where sprites are resized to match game type)
#define OPT_WALKSPEEDABSOLUTE 47 // if movement speeds are independent of walkable mask resolution
#define OPT_CLIPGUICONTROLS 48 // clip drawn gui control contents to the control's rectangle
-#define OPT_HIGHESTOPTION OPT_WALKSPEEDABSOLUTE
+#define OPT_HIGHESTOPTION OPT_CLIPGUICONTROLS
#define OPT_NOMODMUSIC 98
#define OPT_LIPSYNCTEXT 99
#define PORTRAIT_LEFT 0
Commit: 6079ebaaf52bfe45c799fad25ee133cf73163497
https://github.com/scummvm/scummvm/commit/6079ebaaf52bfe45c799fad25ee133cf73163497
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:52-07:00
Commit Message:
AGS: Updated build version (3.5.0.16)
>From upstream c5491f0dec6974eb6fa08083e0e616ca91f95f2a
Changed paths:
engines/ags/shared/core/def_version.h
diff --git a/engines/ags/shared/core/def_version.h b/engines/ags/shared/core/def_version.h
index 88a446b3e21..dc7b10fdbc6 100644
--- a/engines/ags/shared/core/def_version.h
+++ b/engines/ags/shared/core/def_version.h
@@ -22,9 +22,9 @@
#ifndef AGS_SHARED_CORE_DEFVERSION_H
#define AGS_SHARED_CORE_DEFVERSION_H
-#define ACI_VERSION_STR "3.6.0.15"
+#define ACI_VERSION_STR "3.6.0.16"
#if defined (RC_INVOKED) // for MSVC resource compiler
-#define ACI_VERSION_MSRC_DEF 3.6.0.15
+#define ACI_VERSION_MSRC_DEF 3.6.0.16
#endif
#define SPECIAL_VERSION ""
Commit: 186250aab9de57712af9ad1ff60fe27aef308bc3
https://github.com/scummvm/scummvm/commit/186250aab9de57712af9ad1ff60fe27aef308bc3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:53-07:00
Commit Message:
AGS: added Room.BackgroundAnimationEnabled property
>From upstream 15a1c66344d25dbdfa21246408477f05b49f54ce
Changed paths:
engines/ags/shared/game/room_file.cpp
engines/ags/shared/game/room_struct.cpp
engines/ags/shared/game/room_struct.h
diff --git a/engines/ags/shared/game/room_file.cpp b/engines/ags/shared/game/room_file.cpp
index cbaa7b3c35e..3b3b0ad7687 100644
--- a/engines/ags/shared/game/room_file.cpp
+++ b/engines/ags/shared/game/room_file.cpp
@@ -44,7 +44,8 @@ namespace AGS3 {
#define LEGACY_ROOM_PASSWORD_LENGTH 11
#define LEGACY_ROOM_PASSWORD_SALT 60
#define ROOM_MESSAGE_FLAG_DISPLAYNEXT 200
-#define ROOM_LEGACY_OPTIONS_SIZE 10
+// Reserved room options (each is a byte)
+#define ROOM_OPTIONS_RESERVED 4
#define LEGACY_TINT_IS_ENABLED 0x80000000
namespace AGS {
@@ -236,7 +237,8 @@ HError ReadMainBlock(RoomStruct *room, Stream *in, RoomFileVersion data_ver) {
room->Options.PlayerCharOff = in->ReadInt8() != 0;
room->Options.PlayerView = in->ReadInt8();
room->Options.MusicVolume = (RoomVolumeMod)in->ReadInt8();
- in->Seek(ROOM_LEGACY_OPTIONS_SIZE - 5);
+ room->Options.Flags = in->ReadInt8();
+ in->Seek(ROOM_OPTIONS_RESERVED);
room->MessageCount = in->ReadInt16();
if (room->MessageCount > MAX_MESSAGES)
@@ -718,7 +720,8 @@ void WriteMainBlock(const RoomStruct *room, Stream *out) {
out->WriteInt8(room->Options.PlayerCharOff ? 1 : 0);
out->WriteInt8(room->Options.PlayerView);
out->WriteInt8(room->Options.MusicVolume);
- out->WriteByteCount(0, ROOM_LEGACY_OPTIONS_SIZE - 5);
+ out->WriteInt8(room->Options.Flags);
+ out->WriteByteCount(0, ROOM_OPTIONS_RESERVED);
out->WriteInt16((int16_t)room->MessageCount);
out->WriteInt32(room->GameID);
for (size_t i = 0; i < room->MessageCount; ++i) {
diff --git a/engines/ags/shared/game/room_struct.cpp b/engines/ags/shared/game/room_struct.cpp
index b9bcbd2187e..94635420c8f 100644
--- a/engines/ags/shared/game/room_struct.cpp
+++ b/engines/ags/shared/game/room_struct.cpp
@@ -33,7 +33,8 @@ RoomOptions::RoomOptions()
, SaveLoadDisabled(false)
, PlayerCharOff(false)
, PlayerView(0)
- , MusicVolume(kRoomVolumeNormal) {
+ , MusicVolume(kRoomVolumeNormal)
+ , Flags(0) {
}
RoomBgFrame::RoomBgFrame()
diff --git a/engines/ags/shared/game/room_struct.h b/engines/ags/shared/game/room_struct.h
index dad23e5d303..b864ce4bb4e 100644
--- a/engines/ags/shared/game/room_struct.h
+++ b/engines/ags/shared/game/room_struct.h
@@ -89,6 +89,11 @@ enum RoomVolumeMod {
kRoomVolumeMax = kRoomVolumeExtra2,
};
+// Extended room boolean options
+enum RoomFlags {
+ kRoomFlag_BkgFrameLocked = 0x01
+};
+
// Flag tells that walkable area does not have continious zoom
#define NOT_VECTOR_SCALED -10000
// Flags tells that room is not linked to particular game ID
@@ -128,6 +133,8 @@ struct RoomOptions {
int PlayerView;
// Room's music volume modifier
RoomVolumeMod MusicVolume;
+ // A collection of boolean options
+ int Flags;
RoomOptions();
};
Commit: ceedf758fe936b4186b84e76968bf29e8f6f9db5
https://github.com/scummvm/scummvm/commit/ceedf758fe936b4186b84e76968bf29e8f6f9db5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:53-07:00
Commit Message:
AGS: Removed room template binary resource, create one in code
>From upstream 632a93fb38292e80f32e42e99def1b69e4de4160
Changed paths:
engines/ags/shared/gfx/bitmap.cpp
engines/ags/shared/gfx/bitmap.h
diff --git a/engines/ags/shared/gfx/bitmap.cpp b/engines/ags/shared/gfx/bitmap.cpp
index a4925aa6153..59c4226cf0a 100644
--- a/engines/ags/shared/gfx/bitmap.cpp
+++ b/engines/ags/shared/gfx/bitmap.cpp
@@ -38,6 +38,16 @@ Bitmap *CreateBitmap(int width, int height, int color_depth) {
return bitmap;
}
+Bitmap *CreateClearBitmap(int width, int height, int clear_color, int color_depth) {
+ Bitmap *bitmap = new Bitmap();
+ if (!bitmap->Create(width, height, color_depth)) {
+ delete bitmap;
+ return nullptr;
+ }
+ bitmap->Clear(clear_color);
+ return bitmap;
+}
+
Bitmap *CreateTransparentBitmap(int width, int height, int color_depth) {
Bitmap *bitmap = new Bitmap();
if (!bitmap->CreateTransparent(width, height, color_depth)) {
diff --git a/engines/ags/shared/gfx/bitmap.h b/engines/ags/shared/gfx/bitmap.h
index 9ce08b8ebfc..7eb732ef85b 100644
--- a/engines/ags/shared/gfx/bitmap.h
+++ b/engines/ags/shared/gfx/bitmap.h
@@ -67,6 +67,7 @@ namespace BitmapHelper {
// Helper functions, that delete faulty bitmaps automatically, and return
// NULL if bitmap could not be created.
Bitmap *CreateBitmap(int width, int height, int color_depth = 0);
+Bitmap *CreateClearBitmap(int width, int height, int clear_color = 0, int color_depth = 0);
Bitmap *CreateTransparentBitmap(int width, int height, int color_depth = 0);
Bitmap *CreateSubBitmap(Bitmap *src, const Rect &rc);
Bitmap *CreateBitmapCopy(Bitmap *src, int color_depth = 0);
Commit: 7c96238080e0461601f1d0264333f2b77a63a8a9
https://github.com/scummvm/scummvm/commit/7c96238080e0461601f1d0264333f2b77a63a8a9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:53-07:00
Commit Message:
AGS: Do not preset Hotspot's names (description)
>From upstream 479f1067d7a474d41c32df217d10af8961ce2959
Changed paths:
engines/ags/shared/game/room_struct.cpp
diff --git a/engines/ags/shared/game/room_struct.cpp b/engines/ags/shared/game/room_struct.cpp
index 94635420c8f..377fc669477 100644
--- a/engines/ags/shared/game/room_struct.cpp
+++ b/engines/ags/shared/game/room_struct.cpp
@@ -165,13 +165,8 @@ void RoomStruct::InitDefaults() {
WalkBehindCount = 0;
MessageCount = 0;
- for (size_t i = 0; i < (size_t)MAX_ROOM_HOTSPOTS; ++i) {
+ for (size_t i = 0; i < (size_t)MAX_ROOM_HOTSPOTS; ++i)
Hotspots[i] = RoomHotspot();
- if (i == 0)
- Hotspots[i].Name = "No hotspot";
- else
- Hotspots[i].Name.Format("Hotspot %zu", i);
- }
for (size_t i = 0; i < (size_t)MAX_ROOM_OBJECTS; ++i)
Objects[i] = RoomObjectInfo();
for (size_t i = 0; i < (size_t)MAX_ROOM_REGIONS; ++i)
Commit: 1dd1946affa4665a16f9e0f01207c6bb147b27c5
https://github.com/scummvm/scummvm/commit/1dd1946affa4665a16f9e0f01207c6bb147b27c5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:53-07:00
Commit Message:
AGS: Attempt to clarify meaning of the Font's import size
>From upstream 71adfaa57e83b36315fc36feddaa72dd46dd11c5
Changed paths:
engines/ags/shared/ac/game_setup_struct.cpp
engines/ags/shared/ac/game_struct_defines.h
engines/ags/shared/font/fonts.cpp
diff --git a/engines/ags/shared/ac/game_setup_struct.cpp b/engines/ags/shared/ac/game_setup_struct.cpp
index 836be742286..b27262fa9aa 100644
--- a/engines/ags/shared/ac/game_setup_struct.cpp
+++ b/engines/ags/shared/ac/game_setup_struct.cpp
@@ -80,14 +80,14 @@ void GameSetupStruct::Free() {
// Assigns font info parameters using legacy flags value read from the game data
void SetFontInfoFromLegacyFlags(FontInfo &finfo, const uint8_t data) {
finfo.Flags = (data >> 6) & 0xFF;
- finfo.SizePt = data & FFLG_LEGACY_SIZEMASK;
+ finfo.Size = data & FFLG_LEGACY_SIZEMASK;
}
void AdjustFontInfoUsingFlags(FontInfo &finfo, const uint32_t flags) {
finfo.Flags = flags;
if ((flags & FFLG_SIZEMULTIPLIER) != 0) {
- finfo.SizeMultiplier = finfo.SizePt;
- finfo.SizePt = 0;
+ finfo.SizeMultiplier = finfo.Size;
+ finfo.Size = 0;
}
}
@@ -133,7 +133,7 @@ void GameSetupStruct::read_font_infos(Shared::Stream *in, GameDataVersion data_v
} else {
for (int i = 0; i < numfonts; ++i) {
uint32_t flags = in->ReadInt32();
- fonts[i].SizePt = in->ReadInt32();
+ fonts[i].Size = in->ReadInt32();
fonts[i].Outline = in->ReadInt32();
fonts[i].YOffset = in->ReadInt32();
fonts[i].LineSpacing = Math::Max<int32_t>(0, in->ReadInt32());
diff --git a/engines/ags/shared/ac/game_struct_defines.h b/engines/ags/shared/ac/game_struct_defines.h
index 047a14852f5..17b09a01f6c 100644
--- a/engines/ags/shared/ac/game_struct_defines.h
+++ b/engines/ags/shared/ac/game_struct_defines.h
@@ -249,8 +249,8 @@ struct FontInfo {
// General font's loading and rendering flags
uint32_t Flags;
- // Font size, in points (basically means pixels in AGS)
- int SizePt;
+ // Nominal font import size (in pixels)
+ int Size;
// Factor to multiply base font size by
int SizeMultiplier;
// Outlining font index, or auto-outline flag
diff --git a/engines/ags/shared/font/fonts.cpp b/engines/ags/shared/font/fonts.cpp
index 0eb4b658117..e130a33d04b 100644
--- a/engines/ags/shared/font/fonts.cpp
+++ b/engines/ags/shared/font/fonts.cpp
@@ -38,7 +38,7 @@ using namespace AGS::Shared;
FontInfo::FontInfo()
: Flags(0)
- , SizePt(0)
+ , Size(0)
, SizeMultiplier(1)
, Outline(FONT_OUTLINE_NONE)
, YOffset(0)
@@ -388,10 +388,10 @@ bool load_font_size(size_t fontNumber, const FontInfo &font_info) {
params.LoadMode = (font_info.Flags & FFLG_LOADMODEMASK);
FontMetrics metrics;
- if (_GP(ttfRenderer).LoadFromDiskEx(fontNumber, font_info.SizePt, ¶ms, &metrics)) {
+ if (_GP(ttfRenderer).LoadFromDiskEx(fontNumber, font_info.Size, ¶ms, &metrics)) {
_GP(fonts)[fontNumber].Renderer = &_GP(ttfRenderer);
_GP(fonts)[fontNumber].Renderer2 = &_GP(ttfRenderer);
- } else if (_GP(wfnRenderer).LoadFromDiskEx(fontNumber, font_info.SizePt, ¶ms, &metrics)) {
+ } else if (_GP(wfnRenderer).LoadFromDiskEx(fontNumber, font_info.Size, ¶ms, &metrics)) {
_GP(fonts)[fontNumber].Renderer = &_GP(wfnRenderer);
_GP(fonts)[fontNumber].Renderer2 = &_GP(wfnRenderer);
}
Commit: 12a6d220fe44a97cd6d522f6e49c7ef595b175da
https://github.com/scummvm/scummvm/commit/12a6d220fe44a97cd6d522f6e49c7ef595b175da
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:54-07:00
Commit Message:
AGS: Lock background animation depending on loaded room setting
>From upstream 1483fd631cf79ed6f25a5652d8280ac15333f7c0
Changed paths:
engines/ags/engine/ac/room.cpp
diff --git a/engines/ags/engine/ac/room.cpp b/engines/ags/engine/ac/room.cpp
index 5c6c3eca191..2162379e506 100644
--- a/engines/ags/engine/ac/room.cpp
+++ b/engines/ags/engine/ac/room.cpp
@@ -261,8 +261,6 @@ void unload_old_room() {
_G(roominst) = nullptr;
} else _G(croom)->tsdatasize = 0;
memset(&_GP(play).walkable_areas_on[0], 1, MAX_WALK_AREAS + 1);
- _GP(play).bg_frame = 0;
- _GP(play).bg_frame_locked = 0;
remove_screen_overlay(-1);
delete _G(raw_saved_screen);
_G(raw_saved_screen) = nullptr;
@@ -892,6 +890,8 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
_G(new_room_flags) = 0;
_GP(play).gscript_timer = -1; // avoid screw-ups with changing screens
_GP(play).player_on_region = 0;
+ _GP(play).bg_frame = 0;
+ _GP(play).bg_frame_locked = (_GP(thisroom).Options.Flags & kRoomFlag_BkgFrameLocked) != 0;
// trash any input which they might have done while it was loading
ags_clear_input_buffer();
// no fade in, so set the palette immediately in case of 256-col sprites
Commit: a65583c09bfd1fbad9d78e5c3e646c3e3c1c2f28
https://github.com/scummvm/scummvm/commit/a65583c09bfd1fbad9d78e5c3e646c3e3c1c2f28
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:54-07:00
Commit Message:
AGS: Updated build version (3.6.0.17)
>From upstream 02f236155127c940f9d8dde3fcbd4b54b8a17129
Changed paths:
engines/ags/shared/core/def_version.h
diff --git a/engines/ags/shared/core/def_version.h b/engines/ags/shared/core/def_version.h
index dc7b10fdbc6..f18751f2237 100644
--- a/engines/ags/shared/core/def_version.h
+++ b/engines/ags/shared/core/def_version.h
@@ -22,9 +22,9 @@
#ifndef AGS_SHARED_CORE_DEFVERSION_H
#define AGS_SHARED_CORE_DEFVERSION_H
-#define ACI_VERSION_STR "3.6.0.16"
+#define ACI_VERSION_STR "3.6.0.17"
#if defined (RC_INVOKED) // for MSVC resource compiler
-#define ACI_VERSION_MSRC_DEF 3.6.0.16
+#define ACI_VERSION_MSRC_DEF 3.6.0.17
#endif
#define SPECIAL_VERSION ""
Commit: 7fe18e925bb23963530f2b842a4514180082ef71
https://github.com/scummvm/scummvm/commit/7fe18e925bb23963530f2b842a4514180082ef71
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:55-07:00
Commit Message:
AGS: Cleanup load room code a little
>From upstream f9f49987d3109b8141648d603cafd03885bd148d
Changed paths:
engines/ags/engine/ac/room.cpp
engines/ags/engine/ac/room_status.cpp
engines/ags/engine/ac/room_status.h
engines/ags/shared/ac/common_defines.h
engines/ags/shared/ac/old_game_setup_struct.h
engines/ags/shared/game/room_file_deprecated.cpp
diff --git a/engines/ags/engine/ac/room.cpp b/engines/ags/engine/ac/room.cpp
index 2162379e506..d24412b5e4c 100644
--- a/engines/ags/engine/ac/room.cpp
+++ b/engines/ags/engine/ac/room.cpp
@@ -463,11 +463,6 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
update_polled_stuff_if_runtime();
_G(our_eip) = 201;
- /* // apparently, doing this stops volume spiking between tracks
- if (_GP(thisroom).Options.StartupMusic>0) {
- stopmusic();
- delay(100);
- }*/
_GP(play).room_width = _GP(thisroom).Width;
_GP(play).room_height = _GP(thisroom).Height;
@@ -594,14 +589,6 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
}
for (size_t i = 0; i < (size_t)MAX_WALK_BEHINDS; ++i)
_G(croom)->walkbehind_base[i] = _GP(thisroom).WalkBehinds[i].Baseline;
- for (cc = 0; cc < MAX_FLAGS; cc++) _G(croom)->flagstates[cc] = 0;
-
- /* // we copy these structs for the Score column to work
- _G(croom)->misccond=_GP(thisroom).misccond;
- for (cc=0;cc<MAX_ROOM_HOTSPOTS;cc++)
- _G(croom)->hscond[cc]=_GP(thisroom).hscond[cc];
- for (cc=0;cc<MAX_ROOM_OBJECTS;cc++)
- _G(croom)->objcond[cc]=_GP(thisroom).objcond[cc];*/
for (cc = 0; cc < MAX_ROOM_HOTSPOTS; cc++) {
_G(croom)->hotspot[cc].Enabled = true;
@@ -611,6 +598,16 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
_G(croom)->region_enabled[cc] = 1;
}
+#if defined (OBSOLETE)
+ for (cc = 0; cc < MAX_LEGACY_ROOM_FLAGS; cc++) _G(croom)->flagstates[cc] = 0;
+ // we copy these structs for the Score column to work
+ _G(croom)->misccond = _GP(thisroom).misccond;
+ for (cc = 0; cc < MAX_ROOM_HOTSPOTS; cc++)
+ _G(croom)->hscond[cc] = _GP(thisroom).hscond[cc];
+ for (cc = 0; cc < MAX_ROOM_OBJECTS; cc++)
+ _G(croom)->objcond[cc] = _GP(thisroom).objcond[cc];
+#endif
+
_G(croom)->beenhere = 1;
_G(in_new_room) = 2;
}
@@ -632,8 +629,6 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
_G(objs) = &_G(croom)->obj[0];
for (cc = 0; cc < MAX_ROOM_OBJECTS; cc++) {
- // 64 bit: Using the id instead
- // _G(scrObj)[cc].obj = &_G(croom)->obj[cc];
_G(objectScriptObjNames)[cc].Free();
}
@@ -653,17 +648,6 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
}
_G(our_eip) = 206;
- /* THIS IS DONE IN THE EDITOR NOW
- _GP(thisroom).BgFrames.IsPaletteShared[0] = 1;
- for (dd = 1; dd < _GP(thisroom).BgFrameCount; dd++) {
- if (memcmp (&_GP(thisroom).BgFrames.Palette[dd][0], &_G(palette)[0], sizeof(color) * 256) == 0)
- _GP(thisroom).BgFrames.IsPaletteShared[dd] = 1;
- else
- _GP(thisroom).BgFrames.IsPaletteShared[dd] = 0;
- }
- // only make the first frame shared if the last is
- if (_GP(thisroom).BgFrames.IsPaletteShared[_GP(thisroom).BgFrameCount - 1] == 0)
- _GP(thisroom).BgFrames.IsPaletteShared[0] = 0;*/
update_polled_stuff_if_runtime();
@@ -903,8 +887,6 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
debug_script_log("Now in room %d", _G(displayed_room));
GUI::MarkAllGUIForUpdate();
pl_run_plugin_hooks(AGSE_ENTERROOM, _G(displayed_room));
- // MoveToWalkableArea(_GP(game).playercharacter);
- // MSS_CHECK_ALL_BLOCKS;
}
// new_room: changes the current room number, and loads the new room from disk
@@ -970,8 +952,6 @@ int find_highest_room_entered() {
if (isRoomStatusValid(qq) && (getRoomStatus(qq)->beenhere != 0))
fndas = qq;
}
- // This is actually legal - they might start in room 400 and save
- //if (fndas<0) quit("find_highest_room: been in no rooms?");
return fndas;
}
@@ -997,7 +977,6 @@ void check_new_room() {
process_event(&evh);
_GP(play).disabled_user_interface --;
_G(in_new_room) = newroom_was;
- // setevent(EV_RUNEVBLOCK,EVB_ROOM,0,5);
}
}
diff --git a/engines/ags/engine/ac/room_status.cpp b/engines/ags/engine/ac/room_status.cpp
index 86b6e7afc41..b1625f0bae9 100644
--- a/engines/ags/engine/ac/room_status.cpp
+++ b/engines/ags/engine/ac/room_status.cpp
@@ -48,7 +48,6 @@ void HotspotState::WriteToSavegame(Shared::Stream *out) const {
RoomStatus::RoomStatus() {
beenhere = 0;
numobj = 0;
- memset(&flagstates, 0, sizeof(flagstates));
tsdatasize = 0;
tsdata = nullptr;
@@ -83,7 +82,7 @@ void RoomStatus::ReadFromFile_v321(Stream *in) {
beenhere = in->ReadInt32();
numobj = in->ReadInt32();
ReadRoomObjects_Aligned(in);
- in->ReadArrayOfInt16(flagstates, MAX_FLAGS);
+ in->Seek(MAX_LEGACY_ROOM_FLAGS * sizeof(int16_t)); // flagstates (OBSOLETE)
tsdatasize = in->ReadInt32();
in->ReadInt32(); // tsdata
for (int i = 0; i < MAX_ROOM_HOTSPOTS; ++i) {
diff --git a/engines/ags/engine/ac/room_status.h b/engines/ags/engine/ac/room_status.h
index 584cb2b6107..ee8d2e79f14 100644
--- a/engines/ags/engine/ac/room_status.h
+++ b/engines/ags/engine/ac/room_status.h
@@ -53,7 +53,6 @@ struct RoomStatus {
int beenhere = 0;
int numobj = 0;
RoomObject obj[MAX_ROOM_OBJECTS];
- short flagstates[MAX_FLAGS];
int tsdatasize = 0;
char *tsdata = nullptr;
Interaction intrHotspot[MAX_ROOM_HOTSPOTS];
@@ -64,17 +63,19 @@ struct RoomStatus {
Shared::StringIMap roomProps;
Shared::StringIMap hsProps[MAX_ROOM_HOTSPOTS];
Shared::StringIMap objProps[MAX_ROOM_OBJECTS];
- // [IKM] 2012-06-22: not used anywhere
-#ifdef UNUSED_CODE
- EventBlock hscond[MAX_ROOM_HOTSPOTS];
- EventBlock objcond[MAX_ROOM_OBJECTS];
- EventBlock misccond;
-#endif
HotspotState hotspot[MAX_ROOM_HOTSPOTS];
int8 region_enabled[MAX_ROOM_REGIONS];
short walkbehind_base[MAX_WALK_BEHINDS];
int32_t interactionVariableValues[MAX_GLOBAL_VARIABLES];
+ // Likely pre-2.5 data
+#if defined (OBSOLETE)
+ short flagstates[MAX_LEGACY_ROOM_FLAGS]{};
+ EventBlock hscond[MAX_ROOM_HOTSPOTS];
+ EventBlock objcond[MAX_ROOM_OBJECTS];
+ EventBlock misccond;
+#endif
+
RoomStatus();
~RoomStatus();
diff --git a/engines/ags/shared/ac/common_defines.h b/engines/ags/shared/ac/common_defines.h
index 41d797b0459..b9fcb338aef 100644
--- a/engines/ags/shared/ac/common_defines.h
+++ b/engines/ags/shared/ac/common_defines.h
@@ -92,10 +92,11 @@ namespace AGS3 {
#define OBJECT_ON 13
#define RUN_DIALOG 14
-
+// Number of state-saved rooms
#define MAX_ROOMS 300
+// Some obsolete room data, likely pre-2.5
+#define MAX_LEGACY_ROOM_FLAGS 15
-#define MAX_FLAGS 15
#define LEGACY_MAXOBJNAMELEN 30
#define LEGACY_MAX_SPRITES_V25 6000
diff --git a/engines/ags/shared/ac/old_game_setup_struct.h b/engines/ags/shared/ac/old_game_setup_struct.h
index 2c0e239abfc..572facd4b2a 100644
--- a/engines/ags/shared/ac/old_game_setup_struct.h
+++ b/engines/ags/shared/ac/old_game_setup_struct.h
@@ -23,7 +23,7 @@
#define AGS_SHARED_AC_OLD_GAME_SETUP_STRUCT_H
#include "ags/shared/ac/character_info.h" // OldCharacterInfo, CharacterInfo
-#ifdef UNUSED_CODE
+#if defined (OBSOLETE)
#include "ags/shared/ac/event_block.h" // EventBlock
#endif
#include "ags/shared/ac/interface_element.h" // InterfaceElement
@@ -46,10 +46,10 @@ struct OriGameSetupStruct {
char *globalscript;
int numcharacters;
OldCharacterInfo *chars;
- #ifdef UNUSED_CODE
- EventBlock __charcond[50]; // [IKM] 2012-06-22: does not seem to be used anywhere
- EventBlock __invcond[100]; // same
- #endif
+#if defined (OBSOLETE)
+ EventBlock __charcond[50];
+ EventBlock __invcond[100];
+#endif
ccScript *compiled_script;
int playercharacter;
unsigned char __old_spriteflags[2100];
diff --git a/engines/ags/shared/game/room_file_deprecated.cpp b/engines/ags/shared/game/room_file_deprecated.cpp
index 01653db2243..e04bdd0dbab 100644
--- a/engines/ags/shared/game/room_file_deprecated.cpp
+++ b/engines/ags/shared/game/room_file_deprecated.cpp
@@ -83,7 +83,7 @@ struct DeprecatedRoomStruct {
int32_t numwalkareas;
PolyPoints wallpoints[MAX_WALK_AREAS];
// Unknown flags
- int16_t flagstates[MAX_FLAGS];
+ int16_t flagstates[MAX_LEGACY_ROOM_FLAGS];
};
Commit: 60ddcb068a063fbd8cf55c2b83787fc632acb3c8
https://github.com/scummvm/scummvm/commit/60ddcb068a063fbd8cf55c2b83787fc632acb3c8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:55-07:00
Commit Message:
AGS: In save components, "thisroom" should have same ver as "states"
>From upstream 892e1876e9befa413b482a5524522973b49308e7
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 fa03c5feeed..68782e4cdd1 100644
--- a/engines/ags/engine/game/savegame_components.cpp
+++ b/engines/ags/engine/game/savegame_components.cpp
@@ -969,7 +969,7 @@ HSaveError ReadThisRoom(Stream *in, int32_t cmp_ver, const PreservedParams &pp,
// read the current troom state, in case they saved in temporary room
if (!in->ReadBool())
- _GP(troom).ReadFromSavegame(in, cmp_ver > 1 ? 1 : 0); // FIXME!!
+ _GP(troom).ReadFromSavegame(in, cmp_ver);
return HSaveError::None();
}
@@ -1101,14 +1101,14 @@ ComponentHandler ComponentHandlers[] = {
},
{
"Room States",
- 1,
+ 2,
0,
WriteRoomStates,
ReadRoomStates
},
{
"Loaded Room State",
- 2,
+ 2, // should correspond to "Room States"
0,
WriteThisRoom,
ReadThisRoom
Commit: 4ecb2115cacc20d8649e1ffb8d8f2133d3a69e49
https://github.com/scummvm/scummvm/commit/4ecb2115cacc20d8649e1ffb8d8f2133d3a69e49
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:55-07:00
Commit Message:
AGS: Remove cursor limit
>From upstream 612f5702ce7cdee0acb898705a0ae11c84651afb
Changed paths:
engines/ags/shared/ac/common_defines.h
engines/ags/shared/ac/game_setup_struct.cpp
engines/ags/shared/ac/game_setup_struct.h
engines/ags/shared/game/main_game_file.cpp
engines/ags/shared/game/main_game_file.h
diff --git a/engines/ags/shared/ac/common_defines.h b/engines/ags/shared/ac/common_defines.h
index b9fcb338aef..2ec21213368 100644
--- a/engines/ags/shared/ac/common_defines.h
+++ b/engines/ags/shared/ac/common_defines.h
@@ -101,7 +101,6 @@ namespace AGS3 {
#define LEGACY_MAX_SPRITES_V25 6000
#define LEGACY_MAX_SPRITES 30000
-#define MAX_CURSOR 20
#if AGS_PLATFORM_OS_WINDOWS
#define AGS_INLINE inline
diff --git a/engines/ags/shared/ac/game_setup_struct.cpp b/engines/ags/shared/ac/game_setup_struct.cpp
index b27262fa9aa..042a3dd2a69 100644
--- a/engines/ags/shared/ac/game_setup_struct.cpp
+++ b/engines/ags/shared/ac/game_setup_struct.cpp
@@ -39,8 +39,6 @@ GameSetupStruct::GameSetupStruct()
, roomNames(nullptr)
, scoreClipID(0) {
memset(invinfo, 0, sizeof(invinfo));
- for (int i = 0; i < MAX_CURSOR; ++i)
- mcurs[i].clear();
memset(lipSyncFrameLetters, 0, sizeof(lipSyncFrameLetters));
memset(guid, 0, sizeof(guid));
memset(saveGameFileExtension, 0, sizeof(saveGameFileExtension));
@@ -159,9 +157,6 @@ void GameSetupStruct::WriteInvInfo_Aligned(Stream *out) {
}
HGameFileError GameSetupStruct::read_cursors(Shared::Stream *in, GameDataVersion data_ver) {
- if (numcursors > MAX_CURSOR)
- return new MainGameFileError(kMGFErr_TooManyCursors, String::FromFormat("Count: %d, max: %d", numcursors, MAX_CURSOR));
-
ReadMouseCursors_Aligned(in);
return HGameFileError::None();
}
@@ -198,6 +193,7 @@ void GameSetupStruct::read_words_dictionary(Shared::Stream *in) {
}
void GameSetupStruct::ReadMouseCursors_Aligned(Stream *in) {
+ mcurs.resize(numcursors);
AlignedStream align_s(in, Shared::kAligned_Read);
for (int iteratorCount = 0; iteratorCount < numcursors; ++iteratorCount) {
mcurs[iteratorCount].ReadFromFile(&align_s);
@@ -410,7 +406,8 @@ void ConvertOldGameStruct(OldGameSetupStruct *ogss, GameSetupStruct *gss) {
}
memcpy(&gss->invinfo[0], &ogss->invinfo[0], 100 * sizeof(InventoryItemInfo));
- memcpy(&gss->mcurs[0], &ogss->mcurs[0], 10 * sizeof(MouseCursor));
+ for (int i = 0; i < 10; ++i)
+ gss->mcurs[i] = ogss->mcurs[i];
for (int i = 0; i < MAXGLOBALMES; i++)
gss->messages[i] = ogss->messages[i];
gss->dict = ogss->dict;
diff --git a/engines/ags/shared/ac/game_setup_struct.h b/engines/ags/shared/ac/game_setup_struct.h
index 3f1a259f790..7ae5da14ecd 100644
--- a/engines/ags/shared/ac/game_setup_struct.h
+++ b/engines/ags/shared/ac/game_setup_struct.h
@@ -57,7 +57,7 @@ struct GameSetupStruct : public GameSetupStructBase {
// TODO: split into installation params (used only when reading) and runtime params
std::vector<FontInfo> fonts;
InventoryItemInfo invinfo[MAX_INV];
- MouseCursor mcurs[MAX_CURSOR];
+ std::vector<MouseCursor> mcurs;
std::vector<PInteraction> intrChar;
PInteraction intrInv[MAX_INV];
std::vector<PInteractionScripts> charScripts;
diff --git a/engines/ags/shared/game/main_game_file.cpp b/engines/ags/shared/game/main_game_file.cpp
index 065a5166bb5..df1bf538bfb 100644
--- a/engines/ags/shared/game/main_game_file.cpp
+++ b/engines/ags/shared/game/main_game_file.cpp
@@ -70,8 +70,6 @@ String GetMainGameFileErrorText(MainGameFileErrorType err) {
return "Unable to determine native game resolution.";
case kMGFErr_TooManySprites:
return "Too many sprites for this engine to handle.";
- case kMGFErr_TooManyCursors:
- return "Too many cursors for this engine to handle.";
case kMGFErr_InvalidPropertySchema:
return "Failed to deserialize custom properties schema.";
case kMGFErr_InvalidPropertyValues:
diff --git a/engines/ags/shared/game/main_game_file.h b/engines/ags/shared/game/main_game_file.h
index 4e9a1e9c078..fe3b9e0ef1e 100644
--- a/engines/ags/shared/game/main_game_file.h
+++ b/engines/ags/shared/game/main_game_file.h
@@ -63,7 +63,6 @@ enum MainGameFileErrorType {
kMGFErr_CapsNotSupported,
kMGFErr_InvalidNativeResolution,
kMGFErr_TooManySprites,
- kMGFErr_TooManyCursors,
kMGFErr_InvalidPropertySchema,
kMGFErr_InvalidPropertyValues,
kMGFErr_CreateGlobalScriptFailed,
Commit: 87d497020590fef40da06943c0e0697a15e80a16
https://github.com/scummvm/scummvm/commit/87d497020590fef40da06943c0e0697a15e80a16
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:56-07:00
Commit Message:
AGS: Added --translation and --no-translation cmd args
>From upstream 2605765f2433ed06ae07b1ac95d6e1e0d8c27072
Changed paths:
engines/ags/engine/main/main.cpp
diff --git a/engines/ags/engine/main/main.cpp b/engines/ags/engine/main/main.cpp
index 1b3894c9778..373ce430af5 100644
--- a/engines/ags/engine/main/main.cpp
+++ b/engines/ags/engine/main/main.cpp
@@ -146,6 +146,7 @@ void main_print_help() {
#if AGS_PLATFORM_OS_WINDOWS
" --no-message-box Disable alerts as modal message boxes\n"
#endif
+ " --no-translation Use default game language on start\n"
" --noiface Don't draw game GUI\n"
" --noscript Don't run room scripts; *WARNING:* unreliable\n"
" --nospr Don't draw room objects and characters\n"
@@ -167,7 +168,8 @@ void main_print_help() {
" --tell-graphicdriver Print list of supported graphic drivers\n"
"\n"
" --test Run game in the test mode\n"
- " --version Print engine's version and stop\n"
+ " --translation <name> Select the given translation on start\n"
+ " --version Print engine's version and stop\n"
" --user-data-dir DIR Set the save game directory\n"
" --windowed Force display mode to windowed\n"
"\n"
@@ -257,6 +259,10 @@ int main_process_cmdline(ConfigTree &cfg, int argc, const char *argv[]) {
INIwritestring(cfg, "graphics", "game_scale_win", argv[++ee]);
else
INIwritestring(cfg, "graphics", "game_scale_win", "max_round");
+ } else if ((ags_stricmp(arg, "--translation") == 0) && (argc > ee + 1)) {
+ INIwritestring(cfg, "language", "translation", argv[++ee]);
+ } else if (ags_stricmp(arg, "--no-translation") == 0) {
+ INIwritestring(cfg, "language", "translation", "");
} else if (ags_stricmp(arg, "--fps") == 0) _G(display_fps) = kFPS_Forced;
else if (ags_stricmp(arg, "--test") == 0) _G(debug_flags) |= DBG_DEBUGMODE;
else if (ags_stricmp(arg, "--noiface") == 0) _G(debug_flags) |= DBG_NOIFACE;
Commit: 27ad60df724923f7f4e3ab7ff785701eed73c013
https://github.com/scummvm/scummvm/commit/27ad60df724923f7f4e3ab7ff785701eed73c013
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:56-07:00
Commit Message:
AGS: Unify video flags in VideoPlayer, convert in script functions
>From upstream e5c8293a8c8350c38a8df338f56e3806fdc4f119
Plus changes to local video player implementation to reflect changes
Changed paths:
engines/ags/engine/ac/global_api.cpp
engines/ags/engine/ac/global_video.cpp
engines/ags/engine/ac/global_video.h
engines/ags/engine/gfx/graphics_driver.h
engines/ags/engine/media/video/video.cpp
engines/ags/engine/media/video/video.h
engines/ags/engine/script/script.cpp
engines/ags/plugins/core/global_api.cpp
engines/ags/plugins/core/global_api.h
diff --git a/engines/ags/engine/ac/global_api.cpp b/engines/ags/engine/ac/global_api.cpp
index ea6e4effd8d..a3e45e25192 100644
--- a/engines/ags/engine/ac/global_api.cpp
+++ b/engines/ags/engine/ac/global_api.cpp
@@ -1023,7 +1023,7 @@ RuntimeScriptValue Sc_PlayAmbientSound(const RuntimeScriptValue *params, int32_t
// void (int numb,int playflags)
RuntimeScriptValue Sc_play_flc_file(const RuntimeScriptValue *params, int32_t param_count) {
- API_SCALL_VOID_PINT2(play_flc_file);
+ API_SCALL_VOID_PINT2(PlayFlic);
}
// void (char *filename)
@@ -1058,7 +1058,7 @@ RuntimeScriptValue Sc_PlaySoundEx(const RuntimeScriptValue *params, int32_t para
// void (const char* name, int skip, int flags)
RuntimeScriptValue Sc_scrPlayVideo(const RuntimeScriptValue *params, int32_t param_count) {
- API_SCALL_VOID_POBJ_PINT2(scrPlayVideo, const char);
+ API_SCALL_VOID_POBJ_PINT2(PlayVideo, const char);
}
// void (int dialog)
diff --git a/engines/ags/engine/ac/global_video.cpp b/engines/ags/engine/ac/global_video.cpp
index a31d89ee39b..8651dc41cc2 100644
--- a/engines/ags/engine/ac/global_video.cpp
+++ b/engines/ags/engine/ac/global_video.cpp
@@ -40,48 +40,96 @@
namespace AGS3 {
using namespace AGS::Shared;
+using namespace AGS::Engine;
-void scrPlayVideo(const char *name, int skip, int flags) {
- EndSkippingUntilCharStops();
+void pause_sound_if_necessary_and_play_video(const char *name, int flags, VideoSkipType skip);
+void PlayFlic(int numb, int scr_flags) {
+ EndSkippingUntilCharStops();
if (_GP(play).fast_forward)
return;
if (_G(debug_flags) & DBG_NOVIDEO)
return;
- if ((flags < 10) && (_GP(usetup).audio_backend == 0)) {
- // if game audio is disabled in Setup, then don't
- // play any sound on the video either
- flags += 10;
+ // AGS 2.x: If the screen is faded out, fade in again when playing a movie.
+ if (_G(loaded_game_file_version) <= kGameVersion_272)
+ _GP(play).screen_is_faded_out = 0;
+
+ // Convert PlayFlic flags to common video flags
+ /*
+ 0 player can't skip animation
+ 1 player can press ESC to skip animation
+ 2 player can press any key or click mouse to skip animation
+ +10 (i.e.10,11,12) do not stretch to full-screen, just play at flc size
+ +100 do not clear the screen before starting playback
+ */
+ int flags = kVideo_EnableVideo;
+ VideoSkipType skip = VideoSkipNone;
+ switch (scr_flags % 10) {
+ case 1: skip = VideoSkipEscape; break;
+ case 2: skip = VideoSkipKeyOrMouse; break;
+ default: break;
}
+ if ((scr_flags % 100) < 10)
+ flags |= kVideo_Stretch;
+ if (scr_flags < 100)
+ flags |= kVideo_ClearScreen;
- pause_sound_if_necessary_and_play_video(name, skip, flags);
+ play_flc_video(numb, flags, skip);
}
+void PlayVideo(const char *name, int skip, int scr_flags) {
+ EndSkippingUntilCharStops();
+
+ if (_GP(play).fast_forward)
+ return;
+ if (_G(debug_flags) & DBG_NOVIDEO)
+ return;
+
+ // Convert PlayVideo flags to common video flags
+ /*
+ 0: the video will be played at original size, with AVI audio
+ 1: the video will be stretched to full screen, with appropriate
+ black borders to maintain its aspect ratio and AVI audio.
+ 10: original size, with game audio continuing (AVI audio muted)
+ 11: stretched to full screen, with game audio continuing (AVI audio muted)
+ */
+ int flags = kVideo_EnableVideo;
+ if ((scr_flags % 10) == 1)
+ flags |= kVideo_Stretch;
+ if (scr_flags < 10)
+ flags |= kVideo_EnableAudio;
+
+ // if game audio is disabled, then don't play any sound on the video either
+ if (_GP(usetup).audio_backend == 0)
+ flags &= ~kVideo_EnableAudio;
+
+ pause_sound_if_necessary_and_play_video(name, flags, static_cast<VideoSkipType>(skip));
+}
#ifndef AGS_NO_VIDEO_PLAYER
-void pause_sound_if_necessary_and_play_video(const char *name, int skip, int flags) {
+void pause_sound_if_necessary_and_play_video(const char *name, int flags, VideoSkipType skip) {
int musplaying = _GP(play).cur_music_number, i;
int ambientWas[MAX_GAME_CHANNELS]{ 0 };
for (i = NUM_SPEECH_CHANS; i < _GP(game).numGameChannels; i++)
ambientWas[i] = _GP(ambient)[i].channel;
if ((strlen(name) > 3) && (ags_stricmp(&name[strlen(name) - 3], "ogv") == 0)) {
- play_theora_video(name, skip, flags, true);
+ play_theora_video(name, flags, skip, true);
} else if ((strlen(name) > 3) && (ags_stricmp(&name[strlen(name) - 3], "mpg") == 0)) {
- play_mpeg_video(name, skip, flags, true);
+ play_mpeg_video(name, flags, skip, true);
} else if ((strlen(name) > 3) && (ags_stricmp(&name[strlen(name) - 3], "avi") == 0)) {
- play_avi_video(name, skip, flags, true);
+ play_avi_video(name, flags, skip, true);
} else {
// Unsure what the video type is, so try each in turn
- if (!play_avi_video(name, skip, flags, false) &&
- !play_mpeg_video(name, skip, flags, false) &&
- !play_theora_video(name, skip, flags, false))
+ if (!play_avi_video(name, flags, skip, false) &&
+ !play_mpeg_video(name, flags, skip, false) &&
+ !play_theora_video(name, flags, skip, false))
Display("Unsupported video '%s'", name);
}
- if (flags < 10) {
+ if ((flags & kVideo_EnableAudio) != 0) {
update_music_volume();
// restart the music
if (musplaying >= 0)
@@ -96,7 +144,7 @@ void pause_sound_if_necessary_and_play_video(const char *name, int skip, int fla
#else
-void pause_sound_if_necessary_and_play_video(const char *name, int skip, int flags) {
+void pause_sound_if_necessary_and_play_video(const char *name, int flags, VideoSkipType skip) {
}
#endif
diff --git a/engines/ags/engine/ac/global_video.h b/engines/ags/engine/ac/global_video.h
index 2222a67916c..e7e6b6ad870 100644
--- a/engines/ags/engine/ac/global_video.h
+++ b/engines/ags/engine/ac/global_video.h
@@ -24,8 +24,8 @@
namespace AGS3 {
-void scrPlayVideo(const char *name, int skip, int flags);
-void pause_sound_if_necessary_and_play_video(const char *name, int skip, int flags);
+void PlayFlic(int numb, int flags);
+void PlayVideo(const char *name, int skip, int flags);
} // namespace AGS3
diff --git a/engines/ags/engine/gfx/graphics_driver.h b/engines/ags/engine/gfx/graphics_driver.h
index 71feb97065f..fafbfeb3f0b 100644
--- a/engines/ags/engine/gfx/graphics_driver.h
+++ b/engines/ags/engine/gfx/graphics_driver.h
@@ -56,13 +56,6 @@ enum TintMethod {
TintSpecifyMaximum = 1
};
-enum VideoSkipType {
- VideoSkipNone = 0,
- VideoSkipEscape = 1,
- VideoSkipAnyKey = 2,
- VideoSkipKeyOrMouse = 3
-};
-
// Sprite transformation
// TODO: combine with stretch parameters in the IDriverDependantBitmap?
struct SpriteTransform {
diff --git a/engines/ags/engine/media/video/video.cpp b/engines/ags/engine/media/video/video.cpp
index 67fda1a2e7d..07cad922d3c 100644
--- a/engines/ags/engine/media/video/video.cpp
+++ b/engines/ags/engine/media/video/video.cpp
@@ -52,7 +52,7 @@ namespace AGS3 {
using AGS::Shared::AssetManager;
-static bool play_video(Video::VideoDecoder *decoder, const char *name, int skip, int flags, bool showError) {
+static bool play_video(Video::VideoDecoder *decoder, const char *name, int flags, VideoSkipType skip, bool showError) {
std::unique_ptr<Stream> video_stream(_GP(AssetMgr)->OpenAsset(name));
if (!video_stream) {
if (showError)
@@ -70,11 +70,12 @@ static bool play_video(Video::VideoDecoder *decoder, const char *name, int skip,
update_polled_stuff_if_runtime();
Graphics::Screen scr;
- bool stretchVideo = (flags % 10) != 0;
- int canAbort = skip;
- bool ignoreAudio = (flags >= 10);
+ bool stretchVideo = (flags & kVideo_Stretch) != 0;
+ bool enableVideo = (flags & kVideo_EnableVideo) != 0;
+ bool enableAudio = (flags & kVideo_EnableAudio) != 0;
- if (!ignoreAudio) {
+ // TODO: This seems back to front
+ if (enableAudio) {
stop_all_sound_and_music();
}
@@ -86,8 +87,7 @@ static bool play_video(Video::VideoDecoder *decoder, const char *name, int skip,
// Get the next video frame and draw onto the screen
const Graphics::Surface *frame = decoder->decodeNextFrame();
- if (frame) {
-
+ if (frame && enableVideo) {
if (stretchVideo && frame->w == scr.w && frame->h == scr.h)
// Don't need to stretch video after all
stretchVideo = false;
@@ -107,18 +107,18 @@ static bool play_video(Video::VideoDecoder *decoder, const char *name, int skip,
g_system->delayMillis(10);
::AGS::g_events->pollEvents();
- if (canAbort) {
+ if (skip != VideoSkipNone) {
// Check for whether user aborted video
KeyInput key;
int mbut, mwheelz;
if (run_service_key_controls(key)) {
- if (key.Key == 27 && canAbort)
+ if (key.Key == 27 && skip >= VideoSkipEscape)
return true;
- if (canAbort >= 2)
+ if (skip >= VideoSkipAnyKey)
return true; // skip on any key
}
- if (run_service_mb_controls(mbut, mwheelz) && mbut >= 0 && canAbort == 3) {
+ if (run_service_mb_controls(mbut, mwheelz) && mbut >= 0 && skip == VideoSkipKeyOrMouse) {
return true; // skip on mouse click
}
}
@@ -129,29 +129,30 @@ static bool play_video(Video::VideoDecoder *decoder, const char *name, int skip,
return true;
}
-bool play_avi_video(const char *name, int skip, int flags, bool showError) {
+bool play_avi_video(const char *name, int flags, VideoSkipType skip, bool showError) {
Video::AVIDecoder decoder;
- return play_video(&decoder, name, skip, flags, showError);
+ return play_video(&decoder, name, flags, skip, showError);
}
-bool play_mpeg_video(const char *name, int skip, int flags, bool showError) {
+bool play_mpeg_video(const char *name, int flags, VideoSkipType skip, bool showError) {
Video::MPEGPSDecoder decoder;
- return play_video(&decoder, name, skip, flags, showError);
+ return play_video(&decoder, name, flags, skip, showError);
}
-bool play_theora_video(const char *name, int skip, int flags, bool showError) {
+bool play_theora_video(const char *name, int flags, VideoSkipType skip, bool showError) {
#if !defined (USE_THEORADEC)
if (showError)
Display("This games uses Theora videos but ScummVM has been compiled without Theora support");
return false;
#else
Video::TheoraDecoder decoder;
- return play_video(&decoder, name, skip, flags, showError);
+ return play_video(&decoder, name, flags, skip, showError);
#endif
}
-bool play_flc_file(int numb, int playflags) {
- warning("TODO: play_flc_file");
+bool play_flc_video(int numb, int flags, VideoSkipType skip) {
+ // TODO: play_flc_file
+ Display("This games uses Flic videos that ScummVM doesn't yet support");
return false;
}
diff --git a/engines/ags/engine/media/video/video.h b/engines/ags/engine/media/video/video.h
index 34a7c286de9..052a796e976 100644
--- a/engines/ags/engine/media/video/video.h
+++ b/engines/ags/engine/media/video/video.h
@@ -24,10 +24,24 @@
namespace AGS3 {
-extern bool play_avi_video(const char *name, int skip, int flags, bool showError);
-extern bool play_mpeg_video(const char *name, int skip, int flags, bool showError);
-extern bool play_theora_video(const char *name, int skip, int flags, bool showError);
-extern bool play_flc_file(int numb, int playflags);
+enum VideoFlags {
+ kVideo_EnableVideo = 0x0001,
+ kVideo_Stretch = 0x0002,
+ kVideo_ClearScreen = 0x0004,
+ kVideo_EnableAudio = 0x0010,
+};
+
+enum VideoSkipType {
+ VideoSkipNone = 0,
+ VideoSkipEscape = 1,
+ VideoSkipAnyKey = 2,
+ VideoSkipKeyOrMouse = 3
+};
+
+extern bool play_avi_video(const char *name, int flags, VideoSkipType skip, bool showError);
+extern bool play_mpeg_video(const char *name, int flags, VideoSkipType skip, bool showError);
+extern bool play_theora_video(const char *name, int flags, VideoSkipType skip, bool showError);
+extern bool play_flc_video(int numb, int flags, VideoSkipType skip);
} // namespace AGS3
diff --git a/engines/ags/engine/script/script.cpp b/engines/ags/engine/script/script.cpp
index 751970e98bf..e458ab3a1fa 100644
--- a/engines/ags/engine/script/script.cpp
+++ b/engines/ags/engine/script/script.cpp
@@ -37,6 +37,7 @@
#include "ags/engine/ac/global_hotspot.h"
#include "ags/engine/ac/global_object.h"
#include "ags/engine/ac/global_room.h"
+#include "ags/engine/ac/global_video.h"
#include "ags/engine/ac/inv_window.h"
#include "ags/engine/ac/mouse.h"
#include "ags/engine/ac/room.h"
@@ -699,7 +700,7 @@ int run_interaction_commandlist(InteractionCommandList *nicl, int *timesrun, int
play_sound(IPARAM1);
break;
case 8: // Play Flic
- play_flc_file(IPARAM1, IPARAM2);
+ PlayFlic(IPARAM1, IPARAM2);
break;
case 9: { // Run Dialog
int roomWas = _GP(play).room_changes;
diff --git a/engines/ags/plugins/core/global_api.cpp b/engines/ags/plugins/core/global_api.cpp
index 48dc8e79229..b4c84f5fa5b 100644
--- a/engines/ags/plugins/core/global_api.cpp
+++ b/engines/ags/plugins/core/global_api.cpp
@@ -265,14 +265,14 @@ void GlobalAPI::AGS_EngineStartup(IAGSEngine *engine) {
SCRIPT_METHOD(ParseText, GlobalAPI::ParseText);
SCRIPT_METHOD(PauseGame, GlobalAPI::PauseGame);
SCRIPT_METHOD(PlayAmbientSound, GlobalAPI::PlayAmbientSound);
- SCRIPT_METHOD(PlayFlic, GlobalAPI::play_flc_file);
+ SCRIPT_METHOD(PlayFlic, GlobalAPI::PlayFlic);
SCRIPT_METHOD(PlayMP3File, GlobalAPI::PlayMP3File);
SCRIPT_METHOD(PlayMusic, GlobalAPI::PlayMusicResetQueue);
SCRIPT_METHOD(PlayMusicQueued, GlobalAPI::PlayMusicQueued);
SCRIPT_METHOD(PlaySilentMIDI, GlobalAPI::PlaySilentMIDI);
SCRIPT_METHOD(PlaySound, GlobalAPI::play_sound);
SCRIPT_METHOD(PlaySoundEx, GlobalAPI::PlaySoundEx);
- SCRIPT_METHOD(PlayVideo, GlobalAPI::scrPlayVideo);
+ SCRIPT_METHOD(PlayVideo, GlobalAPI::PlayVideo);
SCRIPT_METHOD(ProcessClick, GlobalAPI::RoomProcessClick);
SCRIPT_METHOD(QuitGame, GlobalAPI::QuitGame);
SCRIPT_METHOD(Random, GlobalAPI::__Rand);
@@ -1354,9 +1354,9 @@ void GlobalAPI::PlayAmbientSound(ScriptMethodParams ¶ms) {
AGS3::PlayAmbientSound(channel, sndnum, vol, x, y);
}
-void GlobalAPI::play_flc_file(ScriptMethodParams ¶ms) {
+void GlobalAPI::PlayFlic(ScriptMethodParams ¶ms) {
PARAMS2(int, numb, int, playflags);
- params._result = AGS3::play_flc_file(numb, playflags);
+ AGS3::PlayFlic(numb, playflags);
}
void GlobalAPI::PlayMP3File(ScriptMethodParams ¶ms) {
@@ -1389,9 +1389,9 @@ void GlobalAPI::PlaySoundEx(ScriptMethodParams ¶ms) {
params._result = AGS3::PlaySoundEx(sndnum, channel);
}
-void GlobalAPI::scrPlayVideo(ScriptMethodParams ¶ms) {
+void GlobalAPI::PlayVideo(ScriptMethodParams ¶ms) {
PARAMS3(const char *, name, int, skip, int, flags);
- AGS3::scrPlayVideo(name, skip, flags);
+ AGS3::PlayVideo(name, skip, flags);
}
void GlobalAPI::RoomProcessClick(ScriptMethodParams ¶ms) {
diff --git a/engines/ags/plugins/core/global_api.h b/engines/ags/plugins/core/global_api.h
index d52c6a6f811..8b87637fdd1 100644
--- a/engines/ags/plugins/core/global_api.h
+++ b/engines/ags/plugins/core/global_api.h
@@ -220,14 +220,14 @@ public:
void ParseText(ScriptMethodParams ¶ms);
void PauseGame(ScriptMethodParams ¶ms);
void PlayAmbientSound(ScriptMethodParams ¶ms);
- void play_flc_file(ScriptMethodParams ¶ms);
+ void PlayFlic(ScriptMethodParams ¶ms);
void PlayMP3File(ScriptMethodParams ¶ms);
void PlayMusicResetQueue(ScriptMethodParams ¶ms);
void PlayMusicQueued(ScriptMethodParams ¶ms);
void PlaySilentMIDI(ScriptMethodParams ¶ms);
void play_sound(ScriptMethodParams ¶ms);
void PlaySoundEx(ScriptMethodParams ¶ms);
- void scrPlayVideo(ScriptMethodParams ¶ms);
+ void PlayVideo(ScriptMethodParams ¶ms);
void RoomProcessClick(ScriptMethodParams ¶ms);
void QuitGame(ScriptMethodParams ¶ms);
void __Rand(ScriptMethodParams ¶ms);
Commit: 9c01b99b32ea5c231255e8e110102c1c91372fa5
https://github.com/scummvm/scummvm/commit/9c01b99b32ea5c231255e8e110102c1c91372fa5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:56-07:00
Commit Message:
AGS: Add clear cache on room change from Android port to config
>From upstream 7abbd673e910289511bcca3101abd03101599eb0
Changed paths:
engines/ags/engine/ac/game_setup.cpp
engines/ags/engine/ac/game_setup.h
engines/ags/engine/ac/room.cpp
engines/ags/engine/main/config.cpp
engines/ags/engine/main/main.cpp
diff --git a/engines/ags/engine/ac/game_setup.cpp b/engines/ags/engine/ac/game_setup.cpp
index 948cce1936c..1727dec6ec6 100644
--- a/engines/ags/engine/ac/game_setup.cpp
+++ b/engines/ags/engine/ac/game_setup.cpp
@@ -40,6 +40,7 @@ GameSetup::GameSetup() {
mouse_speed_def = kMouseSpeed_CurrentDisplay;
RenderAtScreenRes = false;
Supersampling = 1;
+ clear_cache_on_room_change = false;
Screen.Params.RefreshRate = 0;
Screen.Params.VSync = false;
diff --git a/engines/ags/engine/ac/game_setup.h b/engines/ags/engine/ac/game_setup.h
index 1b7bc4a2dfc..8b998d82751 100644
--- a/engines/ags/engine/ac/game_setup.h
+++ b/engines/ags/engine/ac/game_setup.h
@@ -83,6 +83,7 @@ struct GameSetup {
MouseSpeedDef mouse_speed_def;
bool RenderAtScreenRes; // render sprites at screen resolution, as opposed to native one
int Supersampling;
+ bool clear_cache_on_room_change; // compatibility
DisplayModeSetup Screen;
diff --git a/engines/ags/engine/ac/room.cpp b/engines/ags/engine/ac/room.cpp
index d24412b5e4c..0d0a9dff89f 100644
--- a/engines/ags/engine/ac/room.cpp
+++ b/engines/ags/engine/ac/room.cpp
@@ -922,7 +922,7 @@ void new_room(int newnum, CharacterInfo *forchar) {
// change rooms
unload_old_room();
- if (_G(psp_clear_cache_on_room_change)) {
+ if (_GP(usetup).clear_cache_on_room_change) {
// Delete all cached sprites
_GP(spriteset).DisposeAll();
diff --git a/engines/ags/engine/main/config.cpp b/engines/ags/engine/main/config.cpp
index 476a6931d12..74e66fe45c1 100644
--- a/engines/ags/engine/main/config.cpp
+++ b/engines/ags/engine/main/config.cpp
@@ -361,6 +361,7 @@ void override_config_ext(ConfigTree &cfg) {
INIwriteint(cfg, "misc", "antialias", _G(psp_gfx_smooth_sprites) != 0);
INIwritestring(cfg, "language", "translation", _G(psp_translation));
+ INIwriteint(cfg, "misc", "clear_cache_on_room_change", _G(psp_clear_cache_on_room_change) != 0);
}
void apply_config(const ConfigTree &cfg) {
@@ -400,6 +401,7 @@ void apply_config(const ConfigTree &cfg) {
// This option is backwards (usevox is 0 if no_speech_pack)
_GP(usetup).no_speech_pack = INIreadint(cfg, "sound", "usespeech", 1) == 0;
+ _GP(usetup).clear_cache_on_room_change = INIreadint(cfg, "misc", "clear_cache_on_room_change", _GP(usetup).clear_cache_on_room_change);
_GP(usetup).user_data_dir = INIreadstring(cfg, "misc", "user_data_dir");
_GP(usetup).shared_data_dir = INIreadstring(cfg, "misc", "shared_data_dir");
diff --git a/engines/ags/engine/main/main.cpp b/engines/ags/engine/main/main.cpp
index 373ce430af5..0b4dcaab3b8 100644
--- a/engines/ags/engine/main/main.cpp
+++ b/engines/ags/engine/main/main.cpp
@@ -100,6 +100,7 @@ void main_print_help() {
"Usage: ags [OPTIONS] [GAMEFILE or DIRECTORY]\n\n"
//--------------------------------------------------------------------------------|
"Options:\n"
+ " --clear-cache-on-room-change Clears sprite cache on every room change\n"
" --conf FILEPATH Specify explicit config file to read on startup\n"
#if AGS_PLATFORM_OS_WINDOWS
" --console-attach Write output to the parent process's console\n"
@@ -232,6 +233,8 @@ int main_process_cmdline(ConfigTree &cfg, int argc, const char *argv[]) {
strncpy(_GP(play).takeover_from, argv[ee + 2], 49);
_GP(play).takeover_from[49] = 0;
ee += 2;
+ } else if (ags_stricmp(arg, "--clear-cache-on-room-change") == 0) {
+ INIwritestring(cfg, "misc", "clear_cache_on_room_change", "1");
} else if (ags_strnicmp(arg, "--tell", 6) == 0) {
if (arg[6] == 0)
_G(tellInfoKeys).insert(String("all"));
Commit: f009829e672bc191e05da747ccdae6f110e745c8
https://github.com/scummvm/scummvm/commit/f009829e672bc191e05da747ccdae6f110e745c8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:57-07:00
Commit Message:
AGS: Further unifying VideoPlayer code in the base class
>From upstream 6c6507e0427bbb8783616691affea83fdcaf10ef
Changed paths:
engines/ags/engine/gfx/ali_3d_scummvm.cpp
engines/ags/engine/gfx/ali_3d_scummvm.h
engines/ags/engine/gfx/gfx_driver_base.h
engines/ags/engine/gfx/graphics_driver.h
diff --git a/engines/ags/engine/gfx/ali_3d_scummvm.cpp b/engines/ags/engine/gfx/ali_3d_scummvm.cpp
index 876ede6e096..95ffe3364ba 100644
--- a/engines/ags/engine/gfx/ali_3d_scummvm.cpp
+++ b/engines/ags/engine/gfx/ali_3d_scummvm.cpp
@@ -212,10 +212,12 @@ int ScummVMRendererGraphicsDriver::GetCompatibleBitmapFormat(int color_depth) {
return color_depth;
}
+IDriverDependantBitmap *ScummVMRendererGraphicsDriver::CreateDDB(int width, int height, int color_depth, bool opaque) {
+ return new ALSoftwareBitmap(width, height, color_depth, opaque);
+}
+
IDriverDependantBitmap *ScummVMRendererGraphicsDriver::CreateDDBFromBitmap(Bitmap *bitmap, bool hasAlpha, bool opaque) {
- ALSoftwareBitmap *newBitmap = new ALSoftwareBitmap(bitmap, opaque, hasAlpha);
- UpdateDDBFromBitmap(newBitmap, bitmap, hasAlpha);
- return newBitmap;
+ return new ALSoftwareBitmap(bitmap, opaque, hasAlpha);
}
void ScummVMRendererGraphicsDriver::UpdateDDBFromBitmap(IDriverDependantBitmap *bitmapToUpdate, Bitmap *bitmap, bool hasAlpha) {
diff --git a/engines/ags/engine/gfx/ali_3d_scummvm.h b/engines/ags/engine/gfx/ali_3d_scummvm.h
index 07fa98ee01d..7bcbde0b230 100644
--- a/engines/ags/engine/gfx/ali_3d_scummvm.h
+++ b/engines/ags/engine/gfx/ali_3d_scummvm.h
@@ -79,22 +79,25 @@ public:
void SetTint(int red, int green, int blue, int tintSaturation) override {
}
- Bitmap *_bmp;
- bool _flipped;
- int _stretchToWidth, _stretchToHeight;
- bool _opaque; // no mask color
- bool _hasAlpha;
- int _transparency;
+ Bitmap *_bmp = nullptr;
+ bool _flipped = false;
+ int _stretchToWidth = 0, _stretchToHeight = 0;
+ bool _opaque = false; // no mask color
+ bool _hasAlpha = false;
+ int _transparency = 0;
+
+ ALSoftwareBitmap(int width, int height, int color_depth, bool opaque) {
+ _width = width;
+ _height = height;
+ _colDepth = color_depth;
+ _opaque = opaque;
+ }
ALSoftwareBitmap(Bitmap *bmp, bool opaque, bool hasAlpha) {
_bmp = bmp;
_width = bmp->GetWidth();
_height = bmp->GetHeight();
_colDepth = bmp->GetColorDepth();
- _flipped = false;
- _stretchToWidth = 0;
- _stretchToHeight = 0;
- _transparency = 0;
_opaque = opaque;
_hasAlpha = hasAlpha;
}
@@ -178,6 +181,7 @@ public:
// Clears the screen rectangle. The coordinates are expected in the **native game resolution**.
void ClearRectangle(int x1, int y1, int x2, int y2, RGB *colorToUse) override;
int GetCompatibleBitmapFormat(int color_depth) override;
+ IDriverDependantBitmap *CreateDDB(int width, int height, int color_depth, bool opaque) override;
IDriverDependantBitmap *CreateDDBFromBitmap(Bitmap *bitmap, bool hasAlpha, bool opaque) override;
void UpdateDDBFromBitmap(IDriverDependantBitmap *bitmapToUpdate, Bitmap *bitmap, bool hasAlpha) override;
void DestroyDDB(IDriverDependantBitmap *bitmap) override;
diff --git a/engines/ags/engine/gfx/gfx_driver_base.h b/engines/ags/engine/gfx/gfx_driver_base.h
index e872316a576..5c669b549ef 100644
--- a/engines/ags/engine/gfx/gfx_driver_base.h
+++ b/engines/ags/engine/gfx/gfx_driver_base.h
@@ -211,9 +211,6 @@ public:
IDriverDependantBitmap *CreateDDBFromBitmap(Bitmap *bitmap, bool hasAlpha, bool opaque = false) override;
protected:
- // Creates a "raw" DDB, without pixel initialization
- virtual IDriverDependantBitmap *CreateDDB(int width, int height, int color_depth, bool opaque = false) = 0;
-
// Stage screens are raw bitmap buffers meant to be sent to plugins on demand
// at certain drawing stages. If used at least once these buffers are then
// rendered as additional sprites in their respected order.
diff --git a/engines/ags/engine/gfx/graphics_driver.h b/engines/ags/engine/gfx/graphics_driver.h
index fafbfeb3f0b..7d20f1ad766 100644
--- a/engines/ags/engine/gfx/graphics_driver.h
+++ b/engines/ags/engine/gfx/graphics_driver.h
@@ -125,6 +125,9 @@ public:
// Gets closest recommended bitmap format (currently - only color depth) for the given original format.
// Engine needs to have game bitmaps brought to the certain range of formats, easing conversion into the video bitmaps.
virtual int GetCompatibleBitmapFormat(int color_depth) = 0;
+ // Creates a "raw" DDB, without pixel initialization
+ virtual IDriverDependantBitmap *CreateDDB(int width, int height, int color_depth, bool opaque = false) = 0;
+ // Creates DDB, initializes from the given bitmap
virtual IDriverDependantBitmap *CreateDDBFromBitmap(Shared::Bitmap *bitmap, bool hasAlpha, bool opaque = false) = 0;
virtual void UpdateDDBFromBitmap(IDriverDependantBitmap *bitmapToUpdate, Shared::Bitmap *bitmap, bool hasAlpha) = 0;
virtual void DestroyDDB(IDriverDependantBitmap *bitmap) = 0;
Commit: 8e3207b38b35e446786b5235a9be28901cea76de
https://github.com/scummvm/scummvm/commit/8e3207b38b35e446786b5235a9be28901cea76de
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:57-07:00
Commit Message:
AGS: Moved frame wait and user input check outside of VideoPlayer
>From upstream c5f815729792837b6b4a02c013c7c554942792d9
Only partially implemented, since ScummVM has it's own video player code
Changed paths:
engines/ags/engine/ac/timer.cpp
engines/ags/engine/ac/timer.h
engines/ags/engine/main/game_run.cpp
engines/ags/engine/main/game_run.h
engines/ags/engine/media/video/video.h
engines/ags/globals.h
diff --git a/engines/ags/engine/ac/timer.cpp b/engines/ags/engine/ac/timer.cpp
index 58fd168c969..281d119ced4 100644
--- a/engines/ags/engine/ac/timer.cpp
+++ b/engines/ags/engine/ac/timer.cpp
@@ -40,12 +40,15 @@ std::chrono::microseconds GetFrameDuration() {
return _G(tick_duration);
}
-void setTimerFps(int new_fps) {
+int setTimerFps(int new_fps) {
+ int old_fps = _G(framerate);
_G(tick_duration) = std::chrono::microseconds(1000000LL / new_fps);
+ _G(framerate) = new_fps;
_G(framerate_maxed) = new_fps >= 1000;
_G(last_tick_time) = AGS_Clock::now();
_G(next_frame_timestamp) = AGS_Clock::now();
+ return old_fps;
}
bool isTimerFpsMaxed() {
diff --git a/engines/ags/engine/ac/timer.h b/engines/ags/engine/ac/timer.h
index 136f5f50834..df594819dec 100644
--- a/engines/ags/engine/ac/timer.h
+++ b/engines/ags/engine/ac/timer.h
@@ -39,7 +39,7 @@ using AGS_Clock = std::conditional <
extern void WaitForNextFrame();
// Sets real FPS to the given number of frames per second; pass 1000+ for maxed FPS mode
-extern void setTimerFps(int new_fps);
+extern int setTimerFps(int new_fps);
// Tells whether maxed FPS mode is currently set
extern bool isTimerFpsMaxed();
// If more than N frames, just skip all, start a fresh.
diff --git a/engines/ags/engine/main/game_run.cpp b/engines/ags/engine/main/game_run.cpp
index 948e521923d..5830f9dc780 100644
--- a/engines/ags/engine/main/game_run.cpp
+++ b/engines/ags/engine/main/game_run.cpp
@@ -789,6 +789,13 @@ void UpdateGameOnce(bool checkControls, IDriverDependantBitmap *extraBitmap, int
WaitForNextFrame();
}
+void UpdateGameAudioOnly() {
+ update_audio_system_on_game_loop();
+ game_loop_update_loop_counter();
+ game_loop_update_fps();
+ WaitForNextFrame();
+}
+
static void UpdateMouseOverLocation() {
// Call GetLocationName - it will internally force a GUI refresh
// if the result it returns has changed from last time
diff --git a/engines/ags/engine/main/game_run.h b/engines/ags/engine/main/game_run.h
index 443edf2ebce..102134d22dc 100644
--- a/engines/ags/engine/main/game_run.h
+++ b/engines/ags/engine/main/game_run.h
@@ -45,6 +45,8 @@ void GameLoopUntilNoOverlay();
void RunGameUntilAborted();
// Update everything game related
void UpdateGameOnce(bool checkControls = false, IDriverDependantBitmap *extraBitmap = nullptr, int extraX = 0, int extraY = 0);
+// Update minimal required game state: audio, loop counter, etc
+void UpdateGameAudioOnly();
// Gets current logical game FPS, this is normally a fixed number set in script;
// in case of "maxed fps" mode this function returns real measured FPS.
float get_current_fps();
diff --git a/engines/ags/engine/media/video/video.h b/engines/ags/engine/media/video/video.h
index 052a796e976..55db8b0b7e4 100644
--- a/engines/ags/engine/media/video/video.h
+++ b/engines/ags/engine/media/video/video.h
@@ -19,6 +19,18 @@
*
*/
+//=============================================================================
+//
+// Video playback interface.
+//
+// TODO: good future changes:
+// - do not render to the screen right inside the VideoPlayer class,
+// instead write the frame into the bitmap or texture, and expose
+// current frame in the interface to let the engine decide what to do
+// with it.
+//
+//=============================================================================
+
#ifndef AGS_ENGINE_MEDIA_VIDEO_VIDEO_H
#define AGS_ENGINE_MEDIA_VIDEO_VIDEO_H
diff --git a/engines/ags/globals.h b/engines/ags/globals.h
index 5329f58330a..9f5e87384b4 100644
--- a/engines/ags/globals.h
+++ b/engines/ags/globals.h
@@ -1333,6 +1333,7 @@ public:
std::chrono::microseconds _tick_duration = std::chrono::microseconds(1000000LL / 40);
bool _framerate_maxed = false;
+ int _framerate = 0;
uint32 _last_tick_time = 0; // AGS_Clock::now();
uint32 _next_frame_timestamp = 0; // AGS_Clock::now();
Commit: 0b639b8f46da8df134732b430afa9e60f4bf631d
https://github.com/scummvm/scummvm/commit/0b639b8f46da8df134732b430afa9e60f4bf631d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:57-07:00
Commit Message:
AGS: Implemented video pause/resume, react to window focus events
>From upstream 5934c62be17e179607c3387ea31c70bfddaac399
Stuff in the VideoPlayer class not implemented
Changed paths:
engines/ags/engine/ac/game.cpp
engines/ags/engine/media/video/video.cpp
engines/ags/engine/media/video/video.h
diff --git a/engines/ags/engine/ac/game.cpp b/engines/ags/engine/ac/game.cpp
index 2a084c9455e..e82ba0a3bf8 100644
--- a/engines/ags/engine/ac/game.cpp
+++ b/engines/ags/engine/ac/game.cpp
@@ -68,6 +68,7 @@
#include "ags/engine/gui/gui_dialog.h"
#include "ags/engine/main/engine.h"
#include "ags/engine/media/audio/audio_system.h"
+#include "ags/engine/media/video/video.h"
#include "ags/engine/platform/base/ags_platform_driver.h"
#include "ags/engine/platform/base/sys_main.h"
#include "ags/plugins/plugin_engine.h"
@@ -1216,7 +1217,9 @@ void display_switch_out_suspend() {
// TODO: find out if anything has to be done here for SDL backend
- // stop the sound stuttering
+ video_pause();
+
+ // Pause all the sounds
for (int i = 0; i < TOTAL_AUDIO_CHANNELS; i++) {
auto *ch = AudioChans::GetChannelIfPlaying(i);
if (ch) {
@@ -1243,12 +1246,14 @@ void display_switch_in() {
void display_switch_in_resume() {
display_switch_in();
+ // Resume all the sounds
for (int i = 0; i < TOTAL_AUDIO_CHANNELS; i++) {
auto *ch = AudioChans::GetChannelIfPlaying(i);
if (ch) {
ch->resume();
}
}
+ video_resume();
// clear the screen if necessary
if (_G(gfxDriver) && _G(gfxDriver)->UsesMemoryBackBuffer())
diff --git a/engines/ags/engine/media/video/video.cpp b/engines/ags/engine/media/video/video.cpp
index 07cad922d3c..026f07b6c07 100644
--- a/engines/ags/engine/media/video/video.cpp
+++ b/engines/ags/engine/media/video/video.cpp
@@ -156,4 +156,12 @@ bool play_flc_video(int numb, int flags, VideoSkipType skip) {
return false;
}
+void video_pause() {
+ // TODO
+}
+
+void video_resume() {
+ // TODO
+}
+
} // namespace AGS3
diff --git a/engines/ags/engine/media/video/video.h b/engines/ags/engine/media/video/video.h
index 55db8b0b7e4..39cb1c466b0 100644
--- a/engines/ags/engine/media/video/video.h
+++ b/engines/ags/engine/media/video/video.h
@@ -55,6 +55,11 @@ extern bool play_mpeg_video(const char *name, int flags, VideoSkipType skip, boo
extern bool play_theora_video(const char *name, int flags, VideoSkipType skip, bool showError);
extern bool play_flc_video(int numb, int flags, VideoSkipType skip);
+// Pause the active video
+extern void video_pause();
+// Resume the active video
+extern void video_resume();
+
} // namespace AGS3
#endif
Commit: 983de47d8bdacfcdb1605cbc905bd2128868224a
https://github.com/scummvm/scummvm/commit/983de47d8bdacfcdb1605cbc905bd2128868224a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:57-07:00
Commit Message:
AGS: Added legacy support for Theora video positioning
>From upstream 757335c55c2908c4a9a0c179415b834ca5cfce0c
Changed paths:
engines/ags/engine/ac/global_video.cpp
engines/ags/engine/media/video/video.h
diff --git a/engines/ags/engine/ac/global_video.cpp b/engines/ags/engine/ac/global_video.cpp
index 8651dc41cc2..320ac267186 100644
--- a/engines/ags/engine/ac/global_video.cpp
+++ b/engines/ags/engine/ac/global_video.cpp
@@ -104,6 +104,9 @@ void PlayVideo(const char *name, int skip, int scr_flags) {
if (_GP(usetup).audio_backend == 0)
flags &= ~kVideo_EnableAudio;
+ if (_G(loaded_game_file_version) < kGameVersion_360_16)
+ flags |= kVideo_LegacyFrameSize;
+
pause_sound_if_necessary_and_play_video(name, flags, static_cast<VideoSkipType>(skip));
}
diff --git a/engines/ags/engine/media/video/video.h b/engines/ags/engine/media/video/video.h
index 39cb1c466b0..8d3acd297eb 100644
--- a/engines/ags/engine/media/video/video.h
+++ b/engines/ags/engine/media/video/video.h
@@ -40,6 +40,7 @@ enum VideoFlags {
kVideo_EnableVideo = 0x0001,
kVideo_Stretch = 0x0002,
kVideo_ClearScreen = 0x0004,
+ kVideo_LegacyFrameSize = 0x0008,
kVideo_EnableAudio = 0x0010,
};
Commit: fa997d3c4bf50753fc641f7d1466e48d86fced8e
https://github.com/scummvm/scummvm/commit/fa997d3c4bf50753fc641f7d1466e48d86fced8e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:57-07:00
Commit Message:
AGS: Fixed bg frame and bg locked flag is reset on save restore
>From upstream 2c1604074da6fc2ccea17a63596b370df0d12147
Changed paths:
engines/ags/engine/ac/room.cpp
engines/ags/engine/game/savegame.cpp
engines/ags/engine/main/game_start.cpp
diff --git a/engines/ags/engine/ac/room.cpp b/engines/ags/engine/ac/room.cpp
index 0d0a9dff89f..ec9e464c5e8 100644
--- a/engines/ags/engine/ac/room.cpp
+++ b/engines/ags/engine/ac/room.cpp
@@ -469,10 +469,6 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
_GP(play).anim_background_speed = _GP(thisroom).BgAnimSpeed;
_GP(play).bg_anim_delay = _GP(play).anim_background_speed;
- // Fixup the frame index, in case the new room does not have enough background frames
- if (_GP(play).bg_frame < 0 || _GP(play).bg_frame >= (int)_GP(thisroom).BgFrameCount)
- _GP(play).bg_frame = 0;
-
// do the palette
for (cc = 0; cc < 256; cc++) {
if (_GP(game).paluses[cc] == PAL_BACKGROUND)
@@ -874,8 +870,6 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
_G(new_room_flags) = 0;
_GP(play).gscript_timer = -1; // avoid screw-ups with changing screens
_GP(play).player_on_region = 0;
- _GP(play).bg_frame = 0;
- _GP(play).bg_frame_locked = (_GP(thisroom).Options.Flags & kRoomFlag_BkgFrameLocked) != 0;
// trash any input which they might have done while it was loading
ags_clear_input_buffer();
// no fade in, so set the palette immediately in case of 256-col sprites
@@ -932,6 +926,10 @@ void new_room(int newnum, CharacterInfo *forchar) {
update_polled_stuff_if_runtime();
load_new_room(newnum, forchar);
+
+ // Reset background frame state (it's not a part of the RoomStatus currently)
+ _GP(play).bg_frame = 0;
+ _GP(play).bg_frame_locked = (_GP(thisroom).Options.Flags & kRoomFlag_BkgFrameLocked) != 0;
}
void set_room_placeholder() {
@@ -957,8 +955,12 @@ int find_highest_room_entered() {
void first_room_initialization() {
_G(starting_room) = _G(displayed_room);
+ _G(playerchar)->prevroom = -1;
set_loop_counter(0);
_G(mouse_z_was) = _G(sys_mouse_z);
+ // Reset background frame state
+ _GP(play).bg_frame = 0;
+ _GP(play).bg_frame_locked = (_GP(thisroom).Options.Flags & kRoomFlag_BkgFrameLocked) != 0;
}
void check_new_room() {
diff --git a/engines/ags/engine/game/savegame.cpp b/engines/ags/engine/game/savegame.cpp
index fc8fa7a61ba..850bc0a45e2 100644
--- a/engines/ags/engine/game/savegame.cpp
+++ b/engines/ags/engine/game/savegame.cpp
@@ -513,6 +513,10 @@ HSaveError DoAfterRestore(const PreservedParams &pp, const RestoredData &r_data)
update_polled_stuff_if_runtime();
if (_G(displayed_room) >= 0) {
+ // Fixup the frame index, in case the restored room does not have enough background frames
+ if (_GP(play).bg_frame < 0 || _GP(play).bg_frame >= (int)_GP(thisroom).BgFrameCount)
+ _GP(play).bg_frame = 0;
+
for (int i = 0; i < MAX_ROOM_BGFRAMES; ++i) {
if (r_data.RoomBkgScene[i]) {
_GP(thisroom).BgFrames[i].Graphic = r_data.RoomBkgScene[i];
@@ -610,7 +614,6 @@ HSaveError DoAfterRestore(const PreservedParams &pp, const RestoredData &r_data)
if (_G(displayed_room) < 0) {
// the restart point, no room was loaded
load_new_room(_G(playerchar)->room, _G(playerchar));
- _G(playerchar)->prevroom = -1;
first_room_initialization();
}
diff --git a/engines/ags/engine/main/game_start.cpp b/engines/ags/engine/main/game_start.cpp
index e0d4bfe78cc..00c2f3014fa 100644
--- a/engines/ags/engine/main/game_start.cpp
+++ b/engines/ags/engine/main/game_start.cpp
@@ -97,8 +97,6 @@ void start_game() {
if (_G(displayed_room) < 0) {
current_fade_out_effect();
load_new_room(_G(playerchar)->room, _G(playerchar));
- // load_new_room updates it, but it should be -1 in the first room
- _G(playerchar)->prevroom = -1;
}
first_room_initialization();
Commit: ee7d5903350b7aa4651e445f6e7ebb755740e4a9
https://github.com/scummvm/scummvm/commit/ee7d5903350b7aa4651e445f6e7ebb755740e4a9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:57-07:00
Commit Message:
AGS: Fixed weird implementation of TextStreamReader::ReadChar()
>From upstream 83cbb21e0fee15b081306cc710d882fec7e21a79
Changed paths:
engines/ags/shared/util/text_stream_reader.cpp
diff --git a/engines/ags/shared/util/text_stream_reader.cpp b/engines/ags/shared/util/text_stream_reader.cpp
index 4c383f41215..eb5b2f20d7b 100644
--- a/engines/ags/shared/util/text_stream_reader.cpp
+++ b/engines/ags/shared/util/text_stream_reader.cpp
@@ -53,12 +53,7 @@ bool TextStreamReader::EOS() const {
}
char TextStreamReader::ReadChar() {
- // Skip carriage-returns
- char c;
- do {
- c = _stream->ReadByte();
- } while (!_stream->EOS() && c == '\r');
- return c;
+ return _stream->ReadInt8();
}
String TextStreamReader::ReadString(size_t length) {
Commit: 29ea22c308300bd0014e9e2fb6ce22b7a92285e9
https://github.com/scummvm/scummvm/commit/29ea22c308300bd0014e9e2fb6ce22b7a92285e9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:58-07:00
Commit Message:
AGS: Add rotation support in config
>From upstream d68e28eb1927c6c4391cddfe1e6294142181c365
Changed paths:
engines/ags/engine/ac/game_setup.cpp
engines/ags/engine/ac/game_setup.h
engines/ags/engine/main/config.cpp
engines/ags/engine/main/engine.cpp
engines/ags/engine/main/engine_setup.cpp
engines/ags/engine/main/engine_setup.h
engines/ags/engine/main/main.cpp
engines/ags/globals.h
diff --git a/engines/ags/engine/ac/game_setup.cpp b/engines/ags/engine/ac/game_setup.cpp
index 1727dec6ec6..a32820938f5 100644
--- a/engines/ags/engine/ac/game_setup.cpp
+++ b/engines/ags/engine/ac/game_setup.cpp
@@ -41,6 +41,7 @@ GameSetup::GameSetup() {
RenderAtScreenRes = false;
Supersampling = 1;
clear_cache_on_room_change = false;
+ rotation = kScreenRotation_Unlocked;
Screen.Params.RefreshRate = 0;
Screen.Params.VSync = false;
diff --git a/engines/ags/engine/ac/game_setup.h b/engines/ags/engine/ac/game_setup.h
index 8b998d82751..393929e7af7 100644
--- a/engines/ags/engine/ac/game_setup.h
+++ b/engines/ags/engine/ac/game_setup.h
@@ -42,6 +42,14 @@ enum MouseSpeedDef {
kNumMouseSpeedDefs
};
+// Screen rotation mode on supported platforms and devices
+enum ScreenRotation {
+ kScreenRotation_Unlocked = 0, // player can freely rotate the screen if possible
+ kScreenRotation_Portrait, // screen can only be in portrait orientation
+ kScreenRotation_Landscape, // screen can only be in landscape orientation
+ kNumScreenRotationOptions
+};
+
using AGS::Shared::String;
// TODO: reconsider the purpose of this struct.
@@ -84,6 +92,7 @@ struct GameSetup {
bool RenderAtScreenRes; // render sprites at screen resolution, as opposed to native one
int Supersampling;
bool clear_cache_on_room_change; // compatibility
+ ScreenRotation rotation;
DisplayModeSetup Screen;
diff --git a/engines/ags/engine/main/config.cpp b/engines/ags/engine/main/config.cpp
index 74e66fe45c1..633d276bc49 100644
--- a/engines/ags/engine/main/config.cpp
+++ b/engines/ags/engine/main/config.cpp
@@ -352,6 +352,12 @@ void override_config_ext(ConfigTree &cfg) {
else
INIwriteint(cfg, "graphics", "supersampling", 0);
+ // psp_gfx_rotation - scaling style:
+ // * 0 - unlocked, let the user rotate as wished.
+ // * 1 - portrait
+ // * 2 - landscape
+ INIwriteint(cfg, "graphics", "rotation", _G(psp_rotation));
+
#if AGS_PLATFORM_OS_ANDROID
// config_mouse_control_mode - enable relative mouse mode
// * 1 - relative mouse touch controls
@@ -395,7 +401,13 @@ void apply_config(const ConfigTree &cfg) {
_GP(usetup).Screen.Params.VSync = INIreadint(cfg, "graphics", "vsync") > 0;
_GP(usetup).RenderAtScreenRes = INIreadint(cfg, "graphics", "render_at_screenres") > 0;
_GP(usetup).Supersampling = INIreadint(cfg, "graphics", "supersampling", 1);
-
+#ifdef TODO
+ _GP(usetup).rotation = (ScreenRotation)INIreadint(cfg, "graphics", "rotation", _GP(usetup).rotation);
+ String rotation_str = INIreadstring(cfg, "graphics", "rotation", "unlocked");
+ _GP(usetup).rotation = StrUtil::ParseEnum<ScreenRotation>(
+ rotation_str, CstrArr<kNumScreenRotationOptions>{ "unlocked", "portrait", "landscape" },
+ _GP(usetup).rotation);
+#endif
_GP(usetup).enable_antialiasing = INIreadint(cfg, "misc", "antialias") > 0;
// This option is backwards (usevox is 0 if no_speech_pack)
diff --git a/engines/ags/engine/main/engine.cpp b/engines/ags/engine/main/engine.cpp
index d1e0f2c327c..794eac71842 100644
--- a/engines/ags/engine/main/engine.cpp
+++ b/engines/ags/engine/main/engine.cpp
@@ -1182,6 +1182,8 @@ int initialize_engine(const ConfigTree &startup_opts) {
engine_init_resolution_settings(_GP(game).GetGameRes());
+ engine_adjust_for_rotation_settings();
+
// Attempt to initialize graphics mode
if (!engine_try_set_gfxmode_any(_GP(usetup).Screen))
return EXIT_ERROR;
diff --git a/engines/ags/engine/main/engine_setup.cpp b/engines/ags/engine/main/engine_setup.cpp
index f4843f59f84..8f5847872e6 100644
--- a/engines/ags/engine/main/engine_setup.cpp
+++ b/engines/ags/engine/main/engine_setup.cpp
@@ -137,6 +137,23 @@ void engine_init_resolution_settings(const Size game_size) {
engine_setup_system_gamesize();
}
+void engine_adjust_for_rotation_settings() {
+#if 0
+ switch (_GP(usetup).rotation) {
+ case ScreenRotation::kScreenRotation_Portrait:
+ SDL_SetHint(SDL_HINT_ORIENTATIONS, "Portrait PortraitUpsideDown");
+ break;
+ case ScreenRotation::kScreenRotation_Landscape:
+ SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight");
+ break;
+ case kScreenRotation_Unlocked:
+ // let the user rotate as wished. No adjustment needed.
+ default:
+ break;
+ }
+#endif
+}
+
// Setup gfx driver callbacks and options
void engine_post_gfxmode_driver_setup() {
_G(gfxDriver)->SetCallbackForPolling(update_polled_stuff_if_runtime);
diff --git a/engines/ags/engine/main/engine_setup.h b/engines/ags/engine/main/engine_setup.h
index 7c450b872f9..29561550e53 100644
--- a/engines/ags/engine/main/engine_setup.h
+++ b/engines/ags/engine/main/engine_setup.h
@@ -38,6 +38,8 @@ void engine_pre_gfxmode_release();
void engine_pre_gfxsystem_shutdown();
// Applies necessary changes after screen<->virtual coordinate transformation has changed
void on_coordinates_scaling_changed();
+// prepares game screen for rotation setting
+void engine_adjust_for_rotation_settings();
} // namespace AGS3
diff --git a/engines/ags/engine/main/main.cpp b/engines/ags/engine/main/main.cpp
index 0b4dcaab3b8..960aa9cf5cb 100644
--- a/engines/ags/engine/main/main.cpp
+++ b/engines/ags/engine/main/main.cpp
@@ -153,6 +153,8 @@ void main_print_help() {
" --nospr Don't draw room objects and characters\n"
" --noupdate Don't run game update\n"
" --novideo Don't play game videos\n"
+ " --rotation <MODE> Screen rotation preferences. MODEs are:\n"
+ " unlocked (0), portrait (1), landscape (2)\n"
#if AGS_PLATFORM_OS_WINDOWS
" --setup Run setup application\n"
#endif
@@ -276,7 +278,9 @@ int main_process_cmdline(ConfigTree &cfg, int argc, const char *argv[]) {
else if (ags_stricmp(arg, "--nomusic") == 0) _G(debug_flags) |= DBG_NOMUSIC;
else if (ags_stricmp(arg, "--noscript") == 0) _G(debug_flags) |= DBG_NOSCRIPT;
else if (ags_stricmp(arg, "--novideo") == 0) _G(debug_flags) |= DBG_NOVIDEO;
- else if (ags_strnicmp(arg, "--log-", 6) == 0 && arg[6] != 0) {
+ else if (ags_stricmp(arg, "--rotation") == 0 && (argc > ee + 1)) {
+ INIwritestring(cfg, "graphics", "rotation", argv[++ee]);
+ } else if (ags_strnicmp(arg, "--log-", 6) == 0 && arg[6] != 0) {
String logarg = arg + 6;
size_t split_at = logarg.FindChar('=');
if (split_at != String::npos)
diff --git a/engines/ags/globals.h b/engines/ags/globals.h
index 9f5e87384b4..7e2e6b46f43 100644
--- a/engines/ags/globals.h
+++ b/engines/ags/globals.h
@@ -1088,6 +1088,7 @@ public:
const char *_psp_game_file_name = "";
const char *_psp_translation = "default";
+ int _psp_rotation = 0;
int _psp_gfx_renderer = 0;
int _psp_gfx_scaling = 1;
int _psp_gfx_smoothing = 0;
Commit: c87f807fd5fb700e0d1fbc904aa8ee0390c29fca
https://github.com/scummvm/scummvm/commit/c87f807fd5fb700e0d1fbc904aa8ee0390c29fca
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:58-07:00
Commit Message:
AGS: Added "GameTextEncoding" setting to the game
>From upstream bda95e652a22463443c05cb5e006f3cd28df0a20
Changed paths:
engines/ags/shared/ac/game_struct_defines.h
diff --git a/engines/ags/shared/ac/game_struct_defines.h b/engines/ags/shared/ac/game_struct_defines.h
index 17b09a01f6c..5bde0137f7f 100644
--- a/engines/ags/shared/ac/game_struct_defines.h
+++ b/engines/ags/shared/ac/game_struct_defines.h
@@ -84,7 +84,8 @@ namespace AGS3 {
#define OPT_RELATIVEASSETRES 46 // relative asset resolution mode (where sprites are resized to match game type)
#define OPT_WALKSPEEDABSOLUTE 47 // if movement speeds are independent of walkable mask resolution
#define OPT_CLIPGUICONTROLS 48 // clip drawn gui control contents to the control's rectangle
-#define OPT_HIGHESTOPTION OPT_CLIPGUICONTROLS
+#define OPT_GAMETEXTENCODING 49 // how the text in the game data should be interpreted
+#define OPT_HIGHESTOPTION OPT_GAMETEXTENCODING
#define OPT_NOMODMUSIC 98
#define OPT_LIPSYNCTEXT 99
#define PORTRAIT_LEFT 0
Commit: 1b502b3d0f228c8b5a237cf64549230aab1d28a3
https://github.com/scummvm/scummvm/commit/1b502b3d0f228c8b5a237cf64549230aab1d28a3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:58-07:00
Commit Message:
AGS: Switch text format mode depending on OPT_GAMETEXTENCODING
>From upstream 1295b8b70eced8ea7c6e277d0595c24e58b6c657
Changed paths:
engines/ags/engine/main/engine.cpp
diff --git a/engines/ags/engine/main/engine.cpp b/engines/ags/engine/main/engine.cpp
index 794eac71842..a9760d20a05 100644
--- a/engines/ags/engine/main/engine.cpp
+++ b/engines/ags/engine/main/engine.cpp
@@ -546,7 +546,10 @@ void engine_init_game_settings() {
Debug::Printf("Initialize game settings");
// Setup a text encoding mode depending on the game data hint
- set_uformat(U_ASCII);
+ if (_GP(game).options[OPT_GAMETEXTENCODING] == 65001) // utf-8 codepage number
+ set_uformat(U_UTF8);
+ else
+ set_uformat(U_ASCII);
int ee;
Commit: 4e9cb56a9d5b454452ba0884d155a2dc0511bb6e
https://github.com/scummvm/scummvm/commit/4e9cb56a9d5b454452ba0884d155a2dc0511bb6e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:58-07:00
Commit Message:
AGS: Optionally use OPT_GAMETEXTENCODING for TRA keys conversion
>From upstream f2eda64c172c9e8756d820a73edeca023d6f6933
Changed paths:
engines/ags/engine/ac/translation.cpp
diff --git a/engines/ags/engine/ac/translation.cpp b/engines/ags/engine/ac/translation.cpp
index 41ba8978a5a..ac6704789d1 100644
--- a/engines/ags/engine/ac/translation.cpp
+++ b/engines/ags/engine/ac/translation.cpp
@@ -115,17 +115,21 @@ bool init_translation(const String &lang, const String &fallback_lang) {
// Mixed encoding support:
// original text unfortunately may contain extended ASCII chars (> 127);
// if translation is UTF-8 but game is extended ASCII, then the translation
- // dictionary keys won't match.
- // With that assumption we must convert dictionary keys into ASCII using
- // provided locale hint.
- String key_enc = _GP(trans).StrOptions["gameencoding"];
- if (!key_enc.IsEmpty()) {
- StringMap conv_map;
- for (const auto &item : _GP(trans).Dict) {
- String key = convert_utf8_to_ascii(item._key.GetCStr(), key_enc.GetCStr());
- conv_map.insert(std::make_pair(key, item._value));
+ // dictionary keys won't match. With that assumption we must convert
+ // dictionary keys into ASCII using provided locale hint.
+ int game_codepage = _GP(game).options[OPT_GAMETEXTENCODING];
+ if ((get_uformat() == U_UTF8) && (game_codepage != 65001)) {
+ String key_enc = (game_codepage > 0) ?
+ String::FromFormat(".%d", game_codepage) :
+ _GP(trans).StrOptions["gameencoding"];
+ if (!key_enc.IsEmpty()) {
+ StringMap conv_map;
+ for (const auto &item : _GP(trans).Dict) {
+ String key = convert_utf8_to_ascii(item._key.GetCStr(), key_enc.GetCStr());
+ conv_map.insert(std::make_pair(key, item._value));
+ }
+ _GP(trans).Dict = conv_map;
}
- _GP(trans).Dict = conv_map;
}
Debug::Printf("Translation initialized: %s", _G(trans_filename).GetCStr());
Commit: d2665bfd71dda9efe7953b4115191d82e79552c4
https://github.com/scummvm/scummvm/commit/d2665bfd71dda9efe7953b4115191d82e79552c4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:58-07:00
Commit Message:
AGS: Save text encoding hint in room files
>From upstream 94f57933069768e170ec6423da8632ab2057068c
Changed paths:
engines/ags/shared/game/room_file.cpp
engines/ags/shared/game/room_struct.h
diff --git a/engines/ags/shared/game/room_file.cpp b/engines/ags/shared/game/room_file.cpp
index 3b3b0ad7687..16e92e71a12 100644
--- a/engines/ags/shared/game/room_file.cpp
+++ b/engines/ags/shared/game/room_file.cpp
@@ -438,11 +438,12 @@ HError ReadRoomBlock(RoomStruct *room, Stream *in, RoomFileBlock block, const St
String::FromFormat("Type: %d, known range: %d - %d.", block, kRoomFblk_Main, kRoomFblk_ObjectScNames));
}
- // Add extensions here checking ext_id, which is an up to 16-chars name, for example:
- // if (ext_id.CompareNoCase("REGION_NEWPROPS") == 0)
- // {
- // // read new region properties
- // }
+ // Add extensions here checking ext_id, which is an up to 16-chars name
+ if (ext_id.CompareNoCase("ext_sopts") == 0) {
+ StrUtil::ReadStringMap(room->StrOptions, in);
+ return HError::None();
+ }
+
return new RoomFileError(kRoomFileErr_UnknownBlockType,
String::FromFormat("Type: %s", ext_id.GetCStr()));
}
@@ -782,6 +783,10 @@ void WritePropertiesBlock(const RoomStruct *room, Stream *out) {
Properties::WriteValues(room->Objects[i].Properties, out);
}
+void WriteStrOptions(const RoomStruct *room, Stream *out) {
+ StrUtil::WriteStringMap(room->StrOptions, out);
+}
+
HRoomFileError WriteRoomData(const RoomStruct *room, Stream *out, RoomFileVersion data_ver) {
if (data_ver < kRoomVersion_Current)
return new RoomFileError(kRoomFileErr_FormatNotSupported, "We no longer support saving room in the older format.");
@@ -804,6 +809,9 @@ HRoomFileError WriteRoomData(const RoomStruct *room, Stream *out, RoomFileVersio
// Custom properties
WriteRoomBlock(room, kRoomFblk_Properties, WritePropertiesBlock, out);
+ // String options
+ WriteRoomBlock(room, "ext_sopts", WriteStrOptions, out);
+
// Write end of room file
out->WriteByte(kRoomFile_EOF);
return HRoomFileError::None();
diff --git a/engines/ags/shared/game/room_struct.h b/engines/ags/shared/game/room_struct.h
index b864ce4bb4e..89b1a182b50 100644
--- a/engines/ags/shared/game/room_struct.h
+++ b/engines/ags/shared/game/room_struct.h
@@ -372,6 +372,8 @@ public:
PInteractionScripts EventHandlers;
// Compiled room script
PScript CompiledScript;
+ // Various extended options with string values, meta-data etc
+ StringMap StrOptions;
private:
// Room's legacy resolution type, defines relation room and game's resolution
Commit: be2a7d44f993ff63e65986a9394d54b668b1780a
https://github.com/scummvm/scummvm/commit/be2a7d44f993ff63e65986a9394d54b668b1780a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-04-12T22:27:59-07:00
Commit Message:
AGS: Updated build version (3.6.0.18)
>From upstream 25b93b6953b23c6d533b3b6c8ad2d1497807bf6a
Changed paths:
engines/ags/shared/core/def_version.h
diff --git a/engines/ags/shared/core/def_version.h b/engines/ags/shared/core/def_version.h
index f18751f2237..9da371f8590 100644
--- a/engines/ags/shared/core/def_version.h
+++ b/engines/ags/shared/core/def_version.h
@@ -22,9 +22,9 @@
#ifndef AGS_SHARED_CORE_DEFVERSION_H
#define AGS_SHARED_CORE_DEFVERSION_H
-#define ACI_VERSION_STR "3.6.0.17"
+#define ACI_VERSION_STR "3.6.0.18"
#if defined (RC_INVOKED) // for MSVC resource compiler
-#define ACI_VERSION_MSRC_DEF 3.6.0.17
+#define ACI_VERSION_MSRC_DEF 3.6.0.18
#endif
#define SPECIAL_VERSION ""
More information about the Scummvm-git-logs
mailing list