AGS: Engine: fixed System.ColorDepth to returning game's native depth

This logic got confused at some point in engine development. This property had a meaning back when display mode matched the game's native color depth.
Plugins also could rely on this, when drawing on a software renderer's virtual screen, which must match game's native depth and not the final display resolution.
From upstream 67c3bdc403d5178f1c5c390af820bc446f94f21b
This commit is contained in:
Walter Agazzi 2024-01-08 17:55:12 +01:00
parent 7e003f30e9
commit 30fc1a911d
3 changed files with 8 additions and 8 deletions

View File

@ -35,7 +35,7 @@ namespace AGS3 {
struct ScriptSystem {
int width = 0; // game screen width
int height = 0; // game screen height
int coldepth = 0; // game's color depth
int coldepth = 0; // game's color depth, in bits per pixel (8, 16, 32)
int os = 0; // operating system's code (see eScriptSystemOSID)
int windowed = 0; // windowed/fullscreen flag
int vsync = 0; // vertical sync flag

View File

@ -119,6 +119,7 @@ void convert_objects_to_data_resolution(GameDataVersion filever) {
void engine_setup_system_gamesize() {
_GP(scsystem).width = _GP(game).GetGameRes().Width;
_GP(scsystem).height = _GP(game).GetGameRes().Height;
_GP(scsystem).coldepth = _GP(game).GetColorDepth();
_GP(scsystem).viewport_width = game_to_data_coord(_GP(play).GetMainViewport().GetWidth());
_GP(scsystem).viewport_height = game_to_data_coord(_GP(play).GetMainViewport().GetHeight());
}
@ -254,7 +255,6 @@ void engine_pre_gfxmode_mouse_cleanup() {
// Fill in _GP(scsystem) struct with display mode parameters
void engine_setup_scsystem_screen(const DisplayMode &dm) {
_GP(scsystem).coldepth = dm.ColorDepth;
_GP(scsystem).windowed = dm.IsWindowed();
_GP(scsystem).vsync = dm.Vsync;
}

View File

@ -177,12 +177,12 @@ void IAGSEngine::DrawText(int32 x, int32 y, int32 font, int32 color, const char
}
void IAGSEngine::GetScreenDimensions(int32 *width, int32 *height, int32 *coldepth) {
if (width != nullptr)
width[0] = _GP(play).GetMainViewport().GetWidth();
if (height != nullptr)
height[0] = _GP(play).GetMainViewport().GetHeight();
if (coldepth != nullptr)
coldepth[0] = _GP(scsystem).coldepth;
if (width)
*width = _GP(play).GetMainViewport().GetWidth();
if (height)
*height = _GP(play).GetMainViewport().GetHeight();
if (coldepth)
*coldepth = _GP(scsystem).coldepth;
}
int IAGSEngine::GetBitmapPitch(BITMAP *bmp) {