Skip to content

Commit

Permalink
Editor: removed Score related settings
Browse files Browse the repository at this point in the history
* Marked MaximumScore and PlaySoundOnScore properties as obsolete;
* Removed "give-score" dialog script command;
* Removed GiveScore() and score-related variables from script API.
  • Loading branch information
ivan-mogilko committed Oct 26, 2023
1 parent 058ebc6 commit cf5c525
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 36 deletions.
4 changes: 2 additions & 2 deletions Editor/AGS.Editor/DataFileWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ private static void WriteGameSetupStructBase(BinaryWriter writer, Game game)
writer.Write(game.ViewCount);
writer.Write(game.Characters.Count);
writer.Write(game.PlayerCharacter.ID);
writer.Write(game.Settings.MaximumScore);
writer.Write(0); // [DEPRECATED]
writer.Write((short)(game.InventoryItems.Count + 1));
writer.Write(new byte[2]); // alignment padding
writer.Write(game.Dialogs.Count);
Expand Down Expand Up @@ -1680,7 +1680,7 @@ public static bool SaveThisGameToFile(string fileName, Game game, CompileMessage
writer.Write(new byte[2]); // struct alignment padding
writer.Write(0); // reserved
}
writer.Write(game.GetAudioArrayIDFromFixedIndex(game.Settings.PlaySoundOnScore));
writer.Write(0); // [DEPRECATED]
if (game.Settings.DebugMode)
{
writer.Write(game.Rooms.Count);
Expand Down
10 changes: 4 additions & 6 deletions Editor/AGS.Editor/Resources/agsdefns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -878,8 +878,6 @@ import int GetTextHeight(const string text, FontType, int width);
import int GetFontHeight(FontType);
/// Gets the default step between two lines of text for the specified font
import int GetFontLineSpacing(FontType);
/// Adds to the player's score and plays the score sound, if set.
import void GiveScore(int points);
/// Refreshes the on-screen inventory display.
import void UpdateInventory();
/// From within dialog_request, tells AGS not to return to the dialog after this function ends.
Expand Down Expand Up @@ -1193,7 +1191,7 @@ enum EventType {
eEventLeaveRoom = 1,
eEventEnterRoomBeforeFadein = 2,
// 3 is reserved by an obsolete "death" event
eEventGotScore = 4,
// 4 is reserved by an obsolete "got score" event
eEventGUIMouseDown = 5,
eEventGUIMouseUp = 6,
eEventAddInventory = 7,
Expand Down Expand Up @@ -2335,7 +2333,7 @@ builtin struct Game {
};
builtin struct GameState {
int score;
readonly int reserved__11; // $AUTOCOMPLETEIGNORE$
int used_mode;
int disabled_user_interface;
int gscript_timer;
Expand All @@ -2353,7 +2351,7 @@ builtin struct GameState {
int swap_portrait;
int speech_text_gui;
int following_room_timer;
int total_score;
int reserved__12; // $AUTOCOMPLETEIGNORE$
int skip_display;
int no_multiloop_repeat;
int roomscript_finished;
Expand All @@ -2371,7 +2369,7 @@ builtin struct GameState {
readonly int room_width;
readonly int room_height;
int game_speed_modifier; // $AUTOCOMPLETEIGNORE$
int score_sound;
int reserved__13; // $AUTOCOMPLETEIGNORE$
int previous_game_data;
readonly readonly int unused__041; // $AUTOCOMPLETEIGNORE$
int dialog_options_x;
Expand Down
1 change: 0 additions & 1 deletion Editor/AGS.Editor/Tasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,6 @@ private void SetDefaultValuesForNewFeatures(Game game)
audioIDToIndex.Add(clip.ID, clip.Index);
}

game.Settings.PlaySoundOnScore = RemapAudioClipIDToFixedIndex(game.Settings.PlaySoundOnScore, audioIDToIndex);
foreach (Types.View view in game.RootViewFolder.AllItemsFlat)
{
foreach (Types.ViewLoop loop in view.Loops)
Expand Down
4 changes: 0 additions & 4 deletions Editor/AGS.Editor/Utils/DialogScriptConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,6 @@ private void ConvertDialogScriptCommandToScript(string dlgScriptCommand, StringW
convertedScriptLine = ProcessSingleIntParameterCommand(dlgScriptCommand, "new-room", "player.ChangeRoom({0}); return RUN_DIALOG_STOP_DIALOG;") + "}";
_currentlyInsideCodeArea = false;
}
else if (dlgScriptCommand.StartsWith("give-score"))
{
convertedScriptLine = ProcessSingleIntParameterCommand(dlgScriptCommand, "give-score", "GiveScore({0});");
}
else
{
RaiseDialogScriptCompileError("Unknown command: " + dlgScriptCommand + ". The command may require parameters which you have not supplied.");
Expand Down
2 changes: 0 additions & 2 deletions Editor/AGS.Native/agsnative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2360,10 +2360,8 @@ Game^ import_compiled_game_dta(const AGSString &filename)
game->Settings->UseGlobalSpeechAnimationDelay = true; // this was always on in pre-3.0 games
game->Settings->HandleInvClicksInScript = (thisgame.options[OPT_HANDLEINVCLICKS] != 0);
game->Settings->InventoryCursors = !thisgame.options[OPT_FIXEDINVCURSOR];
game->Settings->MaximumScore = thisgame.totalscore;
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->RoomTransition = (RoomTransitionStyle)thisgame.options[OPT_FADETYPE];
game->Settings->SaveScreenshots = (thisgame.options[OPT_SAVESCREENSHOT] != 0);
game->Settings->SkipSpeech = (SkipSpeechStyle)thisgame.options[OPT_NOSKIPTEXT];
Expand Down
27 changes: 6 additions & 21 deletions Editor/AGS.Types/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public Settings()
private ScriptAPIVersion _scriptCompatLevelReal = Utilities.GetActualAPI(ScriptAPIVersion.Highest);
private bool _oldKeyHandling = false;
private bool _scaleCharacterSpriteOffsets = true;
private int _playSoundOnScore = -1;
private int _dialogOptionsGUI = 0;
private int _dialogOptionsGap = 0;
private int _dialogBulletImage = 0;
Expand All @@ -97,7 +96,6 @@ public Settings()
private bool _backwardsText = false;
private int _uniqueID;
private Guid _guid;
private int _totalScore = 0;
private bool _runGameLoopsWhileDialogOptionsDisplayed = false;
private InventoryHotspotMarker _inventoryHotspotMarker = new InventoryHotspotMarker();
private int _defRoomMaskResolution = 1;
Expand Down Expand Up @@ -653,16 +651,9 @@ public bool UseOldKeyboardHandling
set { _oldKeyHandling = value; }
}

[DisplayName("Play sound when the player gets points")]
[Description("This sound number will be played whenever the player scores points (0 to disable)")]
[DefaultValue(AudioClip.FixedIndexNoValue)]
[Category("Sound")]
[TypeConverter(typeof(AudioClipTypeConverter))]
public int PlaySoundOnScore
{
get { return _playSoundOnScore; }
set { _playSoundOnScore = value; }
}
[Obsolete]
[Browsable(false)]
public int PlaySoundOnScore { get; }

[Obsolete]
[Browsable(false)]
Expand Down Expand Up @@ -882,14 +873,9 @@ public bool BackwardsText
set { _backwardsText = value; }
}

[DisplayName("Maximum possible score")]
[Description("The maximum score that the player can achieve (displayed by @TOTALSCORE@ on GUI labels)")]
[Category("(Basic properties)")]
public int MaximumScore
{
get { return _totalScore; }
set { _totalScore = value; }
}
[Obsolete]
[Browsable(false)]
public int MaximumScore { get; }

[DisplayName("Default mask resolution")]
[Description("What resolution do room region masks have relative to the room size")]
Expand Down Expand Up @@ -1065,7 +1051,6 @@ public void ToXml(XmlTextWriter writer)

public void FromXml(XmlNode node)
{
_totalScore = 0;
_guid = Guid.Empty;
_description = string.Empty;
_releaseDate = DateTime.Now;
Expand Down

0 comments on commit cf5c525

Please sign in to comment.