Skip to content

Commit

Permalink
Merge branch 'release-3.4.0'
Browse files Browse the repository at this point in the history
Conflicts:
	Common/core/def_version.h
	Editor/AGS.Types/Properties/AssemblyInfo.cs
	version.json
  • Loading branch information
ivan-mogilko committed Nov 5, 2016
2 parents b755f1e + db4412f commit 3784e8f
Show file tree
Hide file tree
Showing 10 changed files with 130 additions and 24 deletions.
23 changes: 23 additions & 0 deletions Changes.txt
@@ -1,5 +1,28 @@
REVISION HISTORY
================
VERSION 3.4.0 - Patch 1, November 2016

Editor:
- Fixed #if(n)ver preprocessor directive failed to properly compare versions
if the current and required versions have different number of digits.

Engine:
- Returned support for some older config options related to graphics mode,
so that the engine would be able to use old config files.
- Fixed graphics mode initialization failure in certain less common setup
cases, such as when requested window size was larger than current
desktop resolution, or when the final mode appeared smaller than the
precalculated one.
- Fixed couple of memory leaks occuring when saved game is restored.
- Fixed rare crash when restoring a game while having unreleased DrawingSurface
pointers.
- Fixed compilation in C++11 mode.

WinSetup:
- Fixed "native game resolution" mode choice was not properly restored when
loading config file.


VERSION 3.4.0, September 2016

Common features:
Expand Down
2 changes: 2 additions & 0 deletions Common/gui/guilistbox.cpp
Expand Up @@ -68,6 +68,8 @@ void GUIListBox::ReadFromFile(Stream *in, GuiVersion gui_version)
int a, i;
char tempbuf[300];

Clear();

GUIObject::ReadFromFile(in, gui_version);
// MACPORT FIXES: swap
in->ReadArrayOfInt32(&numItems, 11);
Expand Down
23 changes: 10 additions & 13 deletions Editor/AGS.CScript.Compiler/Preprocessor.cs
Expand Up @@ -205,26 +205,23 @@ private void ProcessConditionalDirective(string directive, string line, CompileR
includeCodeBlock = !includeCodeBlock;
}
}
else
else if (directive == "ifver" || directive == "ifnver")
{
if (!Char.IsDigit(macroName[0]))
{
RecordError(ErrorCode.InvalidVersionNumber, "Expected version number");
}
else
// Compare provided version number with the current application version
try
{
string appVer = _applicationVersion;
if (appVer.Length > macroName.Length)
{
// AppVer is "3.0.1.25", macroNAme might be "3.0" or "3.0.1"
appVer = appVer.Substring(0, macroName.Length);
}
includeCodeBlock = (appVer.CompareTo(macroName) >= 0);
Version appVersion = new Version(_applicationVersion);
Version macroVersion = new Version(macroName);
includeCodeBlock = appVersion.CompareTo(macroVersion) >= 0;
if (directive == "ifnver")
{
includeCodeBlock = !includeCodeBlock;
}
}
catch (Exception e)
{
RecordError(ErrorCode.InvalidVersionNumber, String.Format("Cannot parse version number: {0}", e.Message));
}
}

_conditionalStatements.Push(includeCodeBlock);
Expand Down
2 changes: 1 addition & 1 deletion Editor/AGS.Types/Properties/AssemblyInfo.cs
Expand Up @@ -22,7 +22,7 @@ namespace AGS.Types
public class Version
{
public static readonly bool IS_BETA_VERSION = false;
public const string AGS_EDITOR_DATE = "October 2016";
public const string AGS_EDITOR_DATE = "November 2016";
public const string AGS_EDITOR_FRIENDLY_VERSION = "3.4.1";
public const string AGS_EDITOR_VERSION = "3.4.1.0";
public const string AGS_EDITOR_COPYRIGHT = "Copyright © 2006-2011 Chris Jones and 2011-2016 others.";
Expand Down
5 changes: 5 additions & 0 deletions Engine/ac/game.cpp
Expand Up @@ -1976,6 +1976,11 @@ SavegameError restore_game_data(Stream *in, SavegameVersion svg_version, const P

ReadGameSetupStructBase_Aligned(in);

// Delete unneeded data
// TODO: reorganize this (may be solved by optimizing safe format too)
delete [] game.load_messages;
game.load_messages = NULL;

if (game.numdialog!=numdiwas)
{
Out::FPrint("Restore game error: mismatching number of Dialogs");
Expand Down
8 changes: 8 additions & 0 deletions Engine/ac/room.cpp
Expand Up @@ -330,6 +330,8 @@ void unload_old_room() {
ccRemoveExternalSymbol(thisroom.hotspotScriptNames[ff]);
}

croom_ptr_clear();

// clear the object cache
for (ff = 0; ff < MAX_INIT_SPR; ff++) {
delete objcache[ff].image;
Expand Down Expand Up @@ -1131,6 +1133,12 @@ void on_background_frame_change () {
bg_just_changed = 1;
}

void croom_ptr_clear()
{
croom = NULL;
objs = NULL;
}

//=============================================================================
//
// Script API Functions
Expand Down
2 changes: 2 additions & 0 deletions Engine/ac/room.h
Expand Up @@ -50,6 +50,8 @@ void first_room_initialization();
void check_new_room();
void compile_room_script();
void on_background_frame_change ();
// Clear the current room pointer if room status is no longer valid
void croom_ptr_clear();

extern roomstruct thisroom;

Expand Down
65 changes: 64 additions & 1 deletion Engine/main/config.cpp
Expand Up @@ -147,6 +147,31 @@ void parse_scaling_option(const String &scaling_option, FrameScaleDefinition &sc
scale_factor = 0;
}

// Parses legacy filter ID and converts it into current scaling options
bool parse_legacy_frame_config(const String &scaling_option, String &filter_id, FrameScaleDefinition &scale_def, int &scale_factor)
{
struct
{
String LegacyName;
String CurrentName;
int Scaling;
} legacy_filters[6] = { {"none", "none", -1}, {"max", "StdScale", 0}, {"StdScale", "StdScale", -1},
{"AAx", "Linear", -1}, {"Hq2x", "Hqx", 2}, {"Hq3x", "Hqx", 3} };

for (int i = 0; i < 6; i++)
{
if (scaling_option.CompareLeftNoCase(legacy_filters[i].LegacyName) == 0)
{
filter_id = legacy_filters[i].CurrentName;
scale_def = legacy_filters[i].Scaling == 0 ? kFrame_MaxRound : kFrame_IntScale;
scale_factor = legacy_filters[i].Scaling >= 0 ? legacy_filters[i].Scaling :
scaling_option.Mid(legacy_filters[i].LegacyName.GetLength()).ToInt();
return true;
}
}
return false;
}

String make_scaling_option(FrameScaleDefinition scale_def, int scale_factor)
{
switch (scale_def)
Expand Down Expand Up @@ -238,6 +263,37 @@ void read_game_data_location(const ConfigTree &cfg)
usetup.main_data_filename = INIreadstring(cfg, "misc", "datafile", usetup.main_data_filename);
}

void read_legacy_graphics_config(const ConfigTree &cfg, const bool should_read_filter)
{
usetup.Screen.Windowed = INIreadint(cfg, "misc", "windowed") > 0;
usetup.Screen.DriverID = INIreadstring(cfg, "misc", "gfxdriver");

if (should_read_filter)
{
String legacy_filter = INIreadstring(cfg, "misc", "gfxfilter");
if (!legacy_filter.IsEmpty())
{
usetup.Screen.SizeDef = kScreenDef_ByGameScaling;

int scale_factor;
if (parse_legacy_frame_config(legacy_filter, usetup.Screen.Filter.ID, usetup.Screen.GameFrame.ScaleDef, scale_factor))
{
usetup.Screen.GameFrame.ScaleFactor = convert_scaling_to_fp(scale_factor);
}

// AGS 3.2.1 and 3.3.0 aspect ratio preferences
if (!usetup.Screen.Windowed)
{
usetup.Screen.MatchDeviceRatio =
(INIreadint(cfg, "misc", "sideborders") > 0 || INIreadint(cfg, "misc", "forceletterbox") > 0 ||
INIreadint(cfg, "misc", "prefer_sideborders") > 0 || INIreadint(cfg, "misc", "prefer_letterbox") > 0);
}
}
}

usetup.Screen.RefreshRate = INIreadint(cfg, "misc", "refresh");
}

void read_config(const ConfigTree &cfg)
{
{
Expand Down Expand Up @@ -271,6 +327,13 @@ void read_config(const ConfigTree &cfg)
psp_audio_multithreaded = INIreadint(cfg, "sound", "threaded", psp_audio_multithreaded);
#endif

// Filter can also be set by command line
// TODO: apply command line arguments to ConfigTree instead to override options read from config file
const bool should_read_filter = usetup.Screen.Filter.ID.IsEmpty();
// Legacy graphics settings has to be translated into new options;
// they must be read first, to let newer options override them, if ones are present
read_legacy_graphics_config(cfg, should_read_filter);

// Graphics mode
#if defined (WINDOWS_VERSION)
usetup.Screen.DriverID = INIreadstring(cfg, "graphics", "driver");
Expand All @@ -297,7 +360,7 @@ void read_config(const ConfigTree &cfg)
// PSP: No graphic filters are available.
usetup.Screen.Filter.ID = "";
#else
if (usetup.Screen.Filter.ID.IsEmpty())
if (should_read_filter)
{
usetup.Screen.Filter.ID = INIreadstring(cfg, "graphics", "filter", "StdScale");
int scale_factor;
Expand Down
20 changes: 13 additions & 7 deletions Engine/platform/windows/setup/winsetup.cpp
Expand Up @@ -446,7 +446,7 @@ class WinSetupDialog
void InitGfxModes();
void InitDriverDescFromFactory(const String &id, DriverDesc &drv_desc);
void SaveSetup();
void SelectNearestGfxMode(const Size screen_size, GfxModeSpecial gfx_mode_spec = kGfxMode_None);
void SelectNearestGfxMode(const Size screen_size);
void SetGfxModeText();
void UpdateMouseSpeedText();

Expand Down Expand Up @@ -930,7 +930,6 @@ void WinSetupDialog::FillGfxFilterList()

void WinSetupDialog::FillGfxModeList()
{
DWORD_PTR old_sel = GetCurItemData(_hGfxModeList, kGfxMode_None);
ResetContent(_hGfxModeList);

if (!_drvDesc)
Expand All @@ -941,7 +940,7 @@ void WinSetupDialog::FillGfxModeList()

AddString(_hGfxModeList, String::FromFormat("Desktop resolution (%d x %d)",
_desktopSize.Width, _desktopSize.Height), (DWORD_PTR)kGfxMode_Desktop);
AddString(_hGfxModeList, String::FromFormat("Game resolution (%d x %d)",
AddString(_hGfxModeList, String::FromFormat("Native game resolution (%d x %d)",
_winCfg.GameResolution.Width, _winCfg.GameResolution.Height), (DWORD_PTR)kGfxMode_GameRes);

const std::vector<DisplayMode> &modes = _drvDesc->GfxModeList.Modes;
Expand All @@ -963,7 +962,7 @@ void WinSetupDialog::FillGfxModeList()
}
}

SelectNearestGfxMode(_winCfg.ScreenSize, (GfxModeSpecial)old_sel);
SelectNearestGfxMode(_winCfg.ScreenSize);
}

void WinSetupDialog::FillLanguageList()
Expand Down Expand Up @@ -1139,16 +1138,23 @@ void WinSetupDialog::SaveSetup()
_winCfg.Save(_cfgOut);
}

void WinSetupDialog::SelectNearestGfxMode(const Size screen_size, GfxModeSpecial gfx_mode_spec)
void WinSetupDialog::SelectNearestGfxMode(const Size screen_size)
{
if (!_drvDesc)
{
OnGfxModeUpdate();
return;
}

if (gfx_mode_spec != kGfxMode_None && gfx_mode_spec < kNumGfxModeSpecials)
SetCurSel(_hGfxModeList, gfx_mode_spec);
// First check two special modes
if (screen_size == _desktopSize)
{
SetCurSel(_hGfxModeList, kGfxMode_Desktop);
}
else if (screen_size == _winCfg.GameResolution)
{
SetCurSel(_hGfxModeList, kGfxMode_GameRes);
}
else
{
// Look up for the nearest supported mode
Expand Down
4 changes: 2 additions & 2 deletions Manual/ags.tex
Expand Up @@ -6308,15 +6308,15 @@ \subsection{SetLightLevel (character)}\label{Character.SetLightLevel}\index{Char
In 8-bit games you cannot use positive light level for brightening effect, but you
may still use negative values to produce darkening effect.

To disable character lighting and tinting effects, call SetLightLevel with parameter \it{light_level} 0.
To disable character lighting and tinting effects, call \helprefn{RemoveTint}{Character.RemoveTint}.

\bf{NOTE}: Setting a light level will disable any RGB tint set for the character.

\bf{NOTE:} Character's individual light level OVERRIDES both ambient light level and local region light level.

\fcol{red}{Example:}
\begin{verbatim}
cEgo.LightLevel = 100;
cEgo.SetLightLevel(100);
\end{verbatim}
This will give character EGO maximal individual brightness.

Expand Down

0 comments on commit 3784e8f

Please sign in to comment.