Skip to content

Commit

Permalink
Merge branch 'master' into develop-3.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-mogilko committed Dec 28, 2014
2 parents 43d4aac + 2faff25 commit 70ca266
Show file tree
Hide file tree
Showing 24 changed files with 147 additions and 72 deletions.
68 changes: 34 additions & 34 deletions Changes.txt
@@ -1,57 +1,57 @@
REVISION HISTORY
================
VERSION 3.3.2, September 2014

Bug Fixes:
- Restored letterboxed-by-design game mode (broken in 3.3.0 update-1).
- Fixed misinterpreted 320x200 resolution type when running very old games
(broken in 3.3.0 update-1).
- Fixed bug in script interpreter that could cause misinterpretation of value provided by plugin.
- Fixed "--setup" command line argument not working if it is not the first argument.
- Fixed WinSetup dialog not sized properly when larger fonts (DPI) option is used in
Windows display settings.

Log additions:
- Write the game data version and the list of supported graphic modes to the log.
VERSION 3.3.3, December 2014

Manual:
- Fixed Speech.VoiceMode example.


VERSION 3.3.0 hotfix-3, July 2014
Features:
- "Number dialog options" game setting now let you choose between "Disable", "Keyboard shortcuts
only" and "Draw numbers and use keyboard shortcuts" instead of being just "on"/"off".
- The built-in shortcut for showing runtime information has been changed from "Ctrl + V" to
"Ctrl + Alt + V".

Bug Fixes:
- Provided error handling for several exceptional cases on graphics mode initialization (program
should at least close normally, showing comprehensible error message).
- Fixed crash in legacy built-in inventory screen.
- Fixed screen size was incorrectly calculated in letterbox mode when the scrolling room is loaded
(this could cause some GUIs or Overlays refuse to take requested position, and also slightly
affected "box in/out" translation effect).
- Fixed audio-related crash on some Linux and Linux-derived systems caused by improper use of mutexes.
- Fixed division by zero and color value overflow cases in alpha blender.
- Fixed voice audio breaking playing on very rare occasions when clip format is OGG or MP3.
The fix is imperfect, and there's very short pause occuring at same point of playback. The voice
will continue playing though.
- Fixed character walking in hi-res games when the destination has negative Y coordinate.
- Fixed black borders not drawn in screen corners by Direct3D renderer.
- Corrected interpretation for games made with AGS 3.0 - 3.2 to let them assign empty loop
in SetObjectFrame().

Engine log:
- Do not log out supported gfx modes twice if the secondary color depth is equal to primary one.

VERSION 3.3.0 update-1, May 2014

Features:
- Reimplemented alternate display modes, now side-borders and top/bottom borders work properly for
all game resolutions.


VERSION 3.3.0 hotfix-2, April 2014
VERSION 3.3.2, September 2014

Features:
- Reimplemented alternate display modes, now side-borders and top/bottom borders work properly for
all game and screen resolutions.
- Added config option to run pre-3.1.0 lo-res games in hi-res mode.

Bug Fixes:
- Fixed Editor crashing when user types "#define" in script.
- Fixed error in game compilation after user moves item folders up or down in the project tree.
- Fixed bug which could make Character.Transparency and Object.Transparency properties return
slightly incorrect values.
- Fixed bug that could let user to load corrupted savedgame, which in turn could cause more trouble.
- Provided error handling for several exceptional cases on graphics mode initialization (program
should at least close normally, showing comprehensible error message).
- Fixed crash in legacy built-in inventory screen.
- Fixed bug in script interpreter that could cause misinterpretation of value provided by plugin.
- Fixed "--setup" command line argument not working if it is not the first argument.
- Fixed WinSetup dialog not sized properly when larger fonts (DPI) option is used in
Windows display settings.

Log additions:
- Write the game data version and the list of supported graphic modes to the log.

VERSION 3.3.0 hotfix-1, March 2014
Manual:
- Fixed Speech.VoiceMode example.

Bug Fixes:
- Fixed Editor crashing when user types "#define" in script.

NOTE: VERSION 3.3.1 was cancelled and never released: the WIP build was renamed to 3.4.0.


VERSION 3.3.0, February 2014:
Expand Down
8 changes: 8 additions & 0 deletions Common/ac/gamestructdefines.h
Expand Up @@ -128,4 +128,12 @@ inline bool IsHiRes(GameResolutionType resolution)

Size ResolutionTypeToSize(GameResolutionType resolution, bool letterbox = false);

// Automatic numbering of dialog options (OPT_DIALOGNUMBERED)
enum DialogOptionNumbering
{
kDlgOptNoNumbering = -1,
kDlgOptKeysOnly = 0, // implicit key shortcuts
kDlgOptNumbering = 1 // draw option indices and use key shortcuts
};

#endif // __AGS_CN_AC__GAMESTRUCTDEFINES_H
2 changes: 1 addition & 1 deletion Editor/AGS.Editor/DataFileWriter.cs
Expand Up @@ -405,7 +405,7 @@ private static void WriteGameSetupStructBase_Aligned(BinaryWriter writer, Game g
options[NativeConstants.GameOptions.OPT_LEFTTORIGHTEVAL] = (game.Settings.LeftToRightPrecedence ? 1 : 0);
options[NativeConstants.GameOptions.OPT_LETTERBOX] = (game.Settings.LetterboxMode ? 1 : 0);
options[NativeConstants.GameOptions.OPT_MOUSEWHEEL] = (game.Settings.MouseWheelEnabled ? 1 : 0);
options[NativeConstants.GameOptions.OPT_DIALOGNUMBERED] = (game.Settings.NumberDialogOptions ? 1 : 0);
options[NativeConstants.GameOptions.OPT_DIALOGNUMBERED] = (int)game.Settings.NumberDialogOptions;
options[NativeConstants.GameOptions.OPT_PIXPERFECT] = (game.Settings.PixelPerfect ? 1 : 0);
options[NativeConstants.GameOptions.OPT_FADETYPE] = (int)game.Settings.RoomTransition;
options[NativeConstants.GameOptions.OPT_RUNGAMEDLGOPTS] = (game.Settings.RunGameLoopsWhileDialogOptionsDisplayed ? 1 : 0);
Expand Down
4 changes: 2 additions & 2 deletions Editor/AGS.Native/agsnative.cpp
Expand Up @@ -3780,7 +3780,7 @@ Game^ load_old_game_dta_file(const char *fileName)
game->Settings->LetterboxMode = (thisgame.options[OPT_LETTERBOX] != 0);
game->Settings->MaximumScore = thisgame.totalscore;
game->Settings->MouseWheelEnabled = (thisgame.options[OPT_MOUSEWHEEL] != 0);
game->Settings->NumberDialogOptions = (thisgame.options[OPT_DIALOGNUMBERED] != 0);
game->Settings->NumberDialogOptions = (thisgame.options[OPT_DIALOGNUMBERED] != 0) ? DialogOptionsNumbering::Normal : DialogOptionsNumbering::KeyShortcutsOnly;
game->Settings->PixelPerfect = (thisgame.options[OPT_PIXPERFECT] != 0);
game->Settings->PlaySoundOnScore = thisgame.options[OPT_SCORESOUND];
game->Settings->Resolution = (GameResolutions)thisgame.GetDefaultResolution();
Expand Down Expand Up @@ -4894,7 +4894,7 @@ void save_game_to_dta_file(Game^ game, const char *fileName)
thisgame.options[OPT_LETTERBOX] = game->Settings->LetterboxMode;
thisgame.totalscore = game->Settings->MaximumScore;
thisgame.options[OPT_MOUSEWHEEL] = game->Settings->MouseWheelEnabled;
thisgame.options[OPT_DIALOGNUMBERED] = game->Settings->NumberDialogOptions;
thisgame.options[OPT_DIALOGNUMBERED] = (int)game->Settings->NumberDialogOptions;
thisgame.options[OPT_PIXPERFECT] = game->Settings->PixelPerfect;
thisgame.options[OPT_SCORESOUND] = 0; // saved elsewhere now to make it 32-bit
SetGameResolution(game);
Expand Down
2 changes: 2 additions & 0 deletions Editor/AGS.Types/AGS.Types.csproj
Expand Up @@ -236,11 +236,13 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AGSColor.cs" />
<Compile Include="Attributes\DeserializeConvertValueAttribute.cs" />
<Compile Include="Attributes\DeserializeIgnoreAttribute.cs" />
<Compile Include="AudioClipType.cs" />
<Compile Include="BaseFolderCollection.cs" />
<Compile Include="BuildTargetsInfo.cs" />
<Compile Include="Enums\BuildConfiguration.cs" />
<Compile Include="Enums\DialogOptionsNumbering.cs" />
<Compile Include="Enums\SpriteAlphaStyle.cs" />
<Compile Include="HelperTypes\BindingListWithRemoving.cs" />
<Compile Include="CharacterFolder.cs" />
Expand Down
29 changes: 29 additions & 0 deletions Editor/AGS.Types/Attributes/DeserializeConvertValueAttribute.cs
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace AGS.Types
{
/// <summary>
/// Defines a conversion for particular values of the property type.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate,
AllowMultiple = true)]
public class DeserializeConvertValueAttribute : Attribute
{
public DeserializeConvertValueAttribute(string convertFrom, string convertTo)
: base()
{
this.ConvertFrom = convertFrom;
this.ConvertTo = convertTo;
}

public string ConvertFrom { get; private set; }
public string ConvertTo { get; private set; }

public string Convert(string value)
{
return (ConvertFrom == value) ? ConvertTo : value;
}
}
}
18 changes: 18 additions & 0 deletions Editor/AGS.Types/Enums/DialogOptionsNumbering.cs
@@ -0,0 +1,18 @@
using System;
using System.ComponentModel;
using System.Text;

namespace AGS.Types
{
[DeserializeConvertValue("False", "KeyShortcutsOnly")]
[DeserializeConvertValue("True", "Normal")]
public enum DialogOptionsNumbering
{
[Description("Disable")]
None = -1,
[Description("Keyboard shortcuts only")]
KeyShortcutsOnly = 0,
[Description("Draw numbers and use keyboard shortcuts")]
Normal = 1,
}
}
14 changes: 13 additions & 1 deletion Editor/AGS.Types/SerializeUtils.cs
Expand Up @@ -154,7 +154,19 @@ public static void DeserializeFromXML(object obj, XmlNode node)
}
continue;
}
else if (!prop.CanWrite)

// Process any existing value conversions; this helps to upgrade game from older version
DeserializeConvertValueAttribute[] conversions =
(DeserializeConvertValueAttribute[])prop.PropertyType.GetCustomAttributes(typeof(DeserializeConvertValueAttribute), true);
if (conversions.Length > 0)
{
foreach (DeserializeConvertValueAttribute conversion in conversions)
{
elementValue = conversion.Convert(elementValue);
}
}

if (!prop.CanWrite)
{
// do nothing, read-only
}
Expand Down
7 changes: 4 additions & 3 deletions Editor/AGS.Types/Settings.cs
Expand Up @@ -63,7 +63,7 @@ public Settings()
private SpeechStyle _speechStyle = SpeechStyle.Lucasarts;
private int _globalSpeechAnimationDelay = 5;
private bool _useGlobalSpeechAnimationDelay = false;
private bool _numberDialogOptions = false;
private DialogOptionsNumbering _numberDialogOptions = DialogOptionsNumbering.KeyShortcutsOnly;
private bool _dialogOptionsBackwards = false;
private SpeechPortraitSide _speechPortraitSide = SpeechPortraitSide.Left;
private int _textWindowGUI = 0;
Expand Down Expand Up @@ -676,9 +676,10 @@ public bool LegacySpeechAnimationSpeed

[DisplayName("Number dialog options")]
[Description("Dialog options become numbered bullet points, and the numeric keys can be used to select them")]
[DefaultValue(false)]
[DefaultValue(DialogOptionsNumbering.None)]
[Category("Dialog")]
public bool NumberDialogOptions
[TypeConverter(typeof(EnumTypeConverter))]
public DialogOptionsNumbering NumberDialogOptions
{
get { return _numberDialogOptions; }
set { _numberDialogOptions = value; }
Expand Down
8 changes: 5 additions & 3 deletions Engine/ac/dialog.cpp
Expand Up @@ -367,7 +367,7 @@ int write_dialog_options(Bitmap *ds, bool ds_has_alpha, int dlgxp, int curyp, in
draw_gui_sprite_v330(ds, game.dialog_bullet, dlgxp, curyp, ds_has_alpha);
}
int cc;
if (game.options[OPT_DIALOGNUMBERED]) {
if (game.options[OPT_DIALOGNUMBERED] == kDlgOptNumbering) {
char tempbfr[20];
int actualpicwid = 0;
if (game.dialog_bullet > 0)
Expand Down Expand Up @@ -506,7 +506,7 @@ void DialogOptions::Prepare(int _dlgnum, bool _runGameLoopsInBackground)
bullet_wid = spritewidth[game.dialog_bullet]+3;

// numbered options, leave space for the numbers
if (game.options[OPT_DIALOGNUMBERED])
if (game.options[OPT_DIALOGNUMBERED] == kDlgOptNumbering)
bullet_wid += wgettextwidth_compensate("9. ", usingfont);

said_text = 0;
Expand Down Expand Up @@ -910,7 +910,9 @@ bool DialogOptions::Run()
run_function_on_non_blocking_thread(&runDialogOptionKeyPressHandlerFunc);
}
// Allow selection of options by keyboard shortcuts
else if ((gkey >= '1') && (gkey <= '9')) {
else if (game.options[OPT_DIALOGNUMBERED] >= kDlgOptKeysOnly &&
gkey >= '1' && gkey <= '9')
{
gkey -= '1';
if (gkey < numdisp) {
chose = disporder[gkey];
Expand Down
4 changes: 2 additions & 2 deletions Engine/ac/draw.cpp
Expand Up @@ -678,8 +678,8 @@ void render_black_borders(int atx, int aty)
if (aty > 0)
{
// letterbox borders
blankImage->SetStretch(play.viewport.GetWidth(), aty);
gfxDriver->DrawSprite(0, -aty, blankImage);
blankImage->SetStretch(game.size.Width, aty);
gfxDriver->DrawSprite(-atx, -aty, blankImage);
gfxDriver->DrawSprite(0, play.viewport.GetHeight(), blankImage);
}
if (atx > 0)
Expand Down
8 changes: 4 additions & 4 deletions Engine/ac/global_game.cpp
Expand Up @@ -605,7 +605,7 @@ int IsKeyPressed (int keycode) {
#ifdef ALLEGRO_KEYBOARD_HANDLER
if (keyboard_needs_poll())
poll_keyboard();
if (keycode >= 300) {
if (keycode >= AGS_EXT_KEY_SHIFT) {
// function keys are 12 lower in allegro 4
if ((keycode>=359) & (keycode<=368)) keycode-=12;
// F11-F12
Expand All @@ -629,17 +629,17 @@ int IsKeyPressed (int keycode) {
else if (keycode==372) keycode=345;
else if (keycode==373) keycode=346;
// insert
else if (keycode == AGS_KEYCODE_INSERT) keycode = KEY_INSERT + 300;
else if (keycode == AGS_KEYCODE_INSERT) keycode = KEY_INSERT + AGS_EXT_KEY_SHIFT;
// delete
else if (keycode == AGS_KEYCODE_DELETE) keycode = KEY_DEL + 300;
else if (keycode == AGS_KEYCODE_DELETE) keycode = KEY_DEL + AGS_EXT_KEY_SHIFT;

// deal with shift/ctrl/alt
if (keycode == 403) keycode = KEY_LSHIFT;
else if (keycode == 404) keycode = KEY_RSHIFT;
else if (keycode == 405) keycode = KEY_LCONTROL;
else if (keycode == 406) keycode = KEY_RCONTROL;
else if (keycode == 407) keycode = KEY_ALT;
else keycode -= 300;
else keycode -= AGS_EXT_KEY_SHIFT;

if (rec_iskeypressed(keycode))
return 1;
Expand Down
2 changes: 2 additions & 0 deletions Engine/ac/keycode.h
Expand Up @@ -24,6 +24,8 @@
#define EXTENDED_KEY_CODE 0
#endif

#define AGS_EXT_KEY_SHIFT 300

#define AGS_KEYCODE_INSERT 382
#define AGS_KEYCODE_DELETE 383
#define AGS_KEYCODE_ALT_TAB 399
Expand Down
2 changes: 1 addition & 1 deletion Engine/ac/path.cpp
Expand Up @@ -27,7 +27,7 @@ void convert_move_path_to_high_res(MoveList *ml)
{
short lowPart = (ml->pos[i] & 0x0000ffff) * current_screen_resolution_multiplier;
short highPart = ((ml->pos[i] >> 16) & 0x0000ffff) * current_screen_resolution_multiplier;
ml->pos[i] = (highPart << 16) | lowPart;
ml->pos[i] = ((int)highPart << 16) | (lowPart & 0x0000ffff);

ml->xpermove[i] *= current_screen_resolution_multiplier;
ml->ypermove[i] *= current_screen_resolution_multiplier;
Expand Down
2 changes: 1 addition & 1 deletion Engine/ac/record.cpp
Expand Up @@ -498,7 +498,7 @@ int my_readkey() {
}*/

if ((gott & 0x00ff) == EXTENDED_KEY_CODE) {
gott = scancode + 300;
gott = scancode + AGS_EXT_KEY_SHIFT;

// convert Allegro KEY_* numbers to scan codes
// (for backwards compatibility we can't just use the
Expand Down
10 changes: 4 additions & 6 deletions Engine/gfx/blender.cpp
Expand Up @@ -175,10 +175,6 @@ unsigned long _additive_alpha_copysrc_blender(unsigned long x, unsigned long y,
// assign new alpha value as a multiplication of translucenses.
// combined_alpha = front.alpha + back.alpha * (1 - front.alpha);
// combined_rgb = (front.rgb * front.alpha + back.rgb * (1 - front.alpha) * back.alpha) / combined_alpha;
//
// NOTE: Allegro does not call blender callback when source alpha is zero, therefore
// we do not check this case here; this should be kept in mind if a need arises to
// use this function elsewise.
unsigned long _argb2argb_blender(unsigned long src_col, unsigned long dst_col, unsigned long src_alpha)
{
unsigned long dst_g, dst_alpha;
Expand All @@ -189,6 +185,8 @@ unsigned long _argb2argb_blender(unsigned long src_col, unsigned long dst_col, u
src_alpha = geta32(src_col);
if (src_alpha)
src_alpha++;
else
return dst_col;
dst_alpha = geta32(dst_col);
if (dst_alpha)
dst_alpha++;
Expand All @@ -204,8 +202,8 @@ unsigned long _argb2argb_blender(unsigned long src_col, unsigned long dst_col, u
dst_col = (((src_col & 0xFF00FF) - (dst_col & 0xFF00FF)) * src_alpha / 256 + dst_col) & 0xFF00FF;

// dst_alpha now contains the final alpha
// we assume that final alpha will never be zero (see note above)
dst_alpha = src_alpha + (dst_alpha * (256 - src_alpha) / 256);
// we assume that final alpha will never be zero
dst_alpha = 256 - (256 - src_alpha) * (256 - dst_alpha) / 256;
// src_alpha is now the final alpha factor made for being multiplied by,
// instead of divided by: this makes it possible to use it in faster
// calculation below
Expand Down
3 changes: 2 additions & 1 deletion Engine/gui/cscidialog.cpp
Expand Up @@ -18,6 +18,7 @@
#include "ac/gamesetup.h"
#include "ac/gamestate.h"
#include "ac/gui.h"
#include "ac/keycode.h"
#include "ac/mouse.h"
#include "ac/record.h"
#include "ac/runtime_defines.h"
Expand Down Expand Up @@ -158,7 +159,7 @@ int WINAPI _export CSCIWaitMessage(Bitmap *ds, CSCIMessage * cscim)
if (kbhit()) {
int keywas = getch();
if (keywas == 0)
keywas = getch() + 300;
keywas = getch() + AGS_EXT_KEY_SHIFT;

if (keywas == 13) {
cscim->id = finddefaultcontrol(CNF_DEFAULT);
Expand Down

0 comments on commit 70ca266

Please sign in to comment.