Created
March 8, 2012 21:39
-
-
Save edsrzf/2003634 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 1fd11bc7e404fa8d0766c855aaa37123114dafe3 Mon Sep 17 00:00:00 2001 | |
From: Evan Shaw <edsrzf@gmail.com> | |
Date: Fri, 9 Mar 2012 10:45:57 +1300 | |
Subject: [PATCH] Fix select and command sound issues | |
* Correct the radio button values for CommandSounds and SelectionSounds in | |
all games. | |
* When Selection Sounds Frequency is Seldom, play sound 20% of the time | |
instead of 25% of the time to match the option description. | |
* When Command Sounds Frequency is Seldom, play a sound only once after | |
the character has been selected. | |
--- | |
gemrb/GUIScripts/bg1/GUIOPT.py | 12 ++++++------ | |
gemrb/GUIScripts/bg2/GUIOPT.py | 12 ++++++------ | |
gemrb/GUIScripts/iwd/GUIOPT.py | 12 ++++++------ | |
gemrb/GUIScripts/iwd2/GUIOPT.py | 12 ++++++------ | |
gemrb/core/Scriptable/Actor.cpp | 12 ++++++++---- | |
gemrb/core/Scriptable/Actor.h | 6 ++++-- | |
6 files changed, 36 insertions(+), 30 deletions(-) | |
diff --git a/gemrb/GUIScripts/bg1/GUIOPT.py b/gemrb/GUIScripts/bg1/GUIOPT.py | |
index 98ac733..cd46db0 100644 | |
--- a/gemrb/GUIScripts/bg1/GUIOPT.py | |
+++ b/gemrb/GUIScripts/bg1/GUIOPT.py | |
@@ -296,12 +296,12 @@ def OpenCharacterSoundsWindow (): | |
OptCheckbox ('Subtitles', Window, 5, 20, 'Subtitles', 1) | |
OptCheckbox ('AttackSounds', Window, 6, 18, 'Attack Sounds', 1) | |
OptCheckbox ('Footsteps', Window, 7, 19, 'Footsteps', 1) | |
- OptRadio ('CommandSounds', Window, 8, 21, 'Command Sounds Frequency', 1) | |
- OptRadio ('CommandSounds', Window, 9, 21, 'Command Sounds Frequency', 2) | |
- OptRadio ('CommandSounds', Window, 10, 21, 'Command Sounds Frequency', 3) | |
- OptRadio ('SelectionSounds', Window, 58, 57, 'Selection Sounds Frequency', 1) | |
- OptRadio ('SelectionSounds', Window, 59, 57, 'Selection Sounds Frequency', 2) | |
- OptRadio ('SelectionSounds', Window, 60, 57, 'Selection Sounds Frequency', 3) | |
+ OptRadio ('CommandSounds', Window, 8, 21, 'Command Sounds Frequency', 2) | |
+ OptRadio ('CommandSounds', Window, 9, 21, 'Command Sounds Frequency', 1) | |
+ OptRadio ('CommandSounds', Window, 10, 21, 'Command Sounds Frequency', 0) | |
+ OptRadio ('SelectionSounds', Window, 58, 57, 'Selection Sounds Frequency', 2) | |
+ OptRadio ('SelectionSounds', Window, 59, 57, 'Selection Sounds Frequency', 1) | |
+ OptRadio ('SelectionSounds', Window, 60, 57, 'Selection Sounds Frequency', 0) | |
Window.ShowModal (MODAL_SHADOW_GRAY) | |
diff --git a/gemrb/GUIScripts/bg2/GUIOPT.py b/gemrb/GUIScripts/bg2/GUIOPT.py | |
index 444925d..40239a4 100644 | |
--- a/gemrb/GUIScripts/bg2/GUIOPT.py | |
+++ b/gemrb/GUIScripts/bg2/GUIOPT.py | |
@@ -292,12 +292,12 @@ def OpenCharacterSoundsWindow (): | |
OptCheckbox ('Subtitles', Window, 5, 20, 'Subtitles', 1) | |
OptCheckbox ('AttackSounds', Window, 6, 18, 'Attack Sounds', 1) | |
OptCheckbox ('Footsteps', Window, 7, 19, 'Footsteps', 1) | |
- OptRadio ('CommandSounds', Window, 8, 21, 'Command Sounds Frequency', 1) | |
- OptRadio ('CommandSounds', Window, 9, 21, 'Command Sounds Frequency', 2) | |
- OptRadio ('CommandSounds', Window, 10, 21, 'Command Sounds Frequency', 3) | |
- OptRadio ('SelectionSounds', Window, 58, 57, 'Selection Sounds Frequency', 1) | |
- OptRadio ('SelectionSounds', Window, 59, 57, 'Selection Sounds Frequency', 2) | |
- OptRadio ('SelectionSounds', Window, 60, 57, 'Selection Sounds Frequency', 3) | |
+ OptRadio ('CommandSounds', Window, 8, 21, 'Command Sounds Frequency', 2) | |
+ OptRadio ('CommandSounds', Window, 9, 21, 'Command Sounds Frequency', 1) | |
+ OptRadio ('CommandSounds', Window, 10, 21, 'Command Sounds Frequency', 0) | |
+ OptRadio ('SelectionSounds', Window, 58, 57, 'Selection Sounds Frequency', 2) | |
+ OptRadio ('SelectionSounds', Window, 59, 57, 'Selection Sounds Frequency', 1) | |
+ OptRadio ('SelectionSounds', Window, 60, 57, 'Selection Sounds Frequency', 0) | |
Window.ShowModal (MODAL_SHADOW_GRAY) | |
diff --git a/gemrb/GUIScripts/iwd/GUIOPT.py b/gemrb/GUIScripts/iwd/GUIOPT.py | |
index ee8e21b..5946b14 100644 | |
--- a/gemrb/GUIScripts/iwd/GUIOPT.py | |
+++ b/gemrb/GUIScripts/iwd/GUIOPT.py | |
@@ -496,12 +496,12 @@ def OpenCharacterSoundsWindow (): | |
OptCheckbox ('Subtitles', Window, 5, 20, 'Subtitles', 1) | |
OptCheckbox ('AttackSounds', Window, 6, 18, 'Attack Sounds', 1) | |
OptCheckbox ('Footsteps', Window, 7, 19, 'Footsteps', 1) | |
- OptRadio ('CommandSounds', Window, 8, 21, 'Command Sounds Frequency', 1) | |
- OptRadio ('CommandSounds', Window, 9, 21, 'Command Sounds Frequency', 2) | |
- OptRadio ('CommandSounds', Window, 10, 21, 'Command Sounds Frequency', 3) | |
- OptRadio ('SelectionSounds', Window, 58, 57, 'Selection Sounds Frequency', 1) | |
- OptRadio ('SelectionSounds', Window, 59, 57, 'Selection Sounds Frequency', 2) | |
- OptRadio ('SelectionSounds', Window, 60, 57, 'Selection Sounds Frequency', 3) | |
+ OptRadio ('CommandSounds', Window, 8, 21, 'Command Sounds Frequency', 2) | |
+ OptRadio ('CommandSounds', Window, 9, 21, 'Command Sounds Frequency', 1) | |
+ OptRadio ('CommandSounds', Window, 10, 21, 'Command Sounds Frequency', 0) | |
+ OptRadio ('SelectionSounds', Window, 58, 57, 'Selection Sounds Frequency', 2) | |
+ OptRadio ('SelectionSounds', Window, 59, 57, 'Selection Sounds Frequency', 1) | |
+ OptRadio ('SelectionSounds', Window, 60, 57, 'Selection Sounds Frequency', 0) | |
Window.ShowModal (MODAL_SHADOW_GRAY) | |
def DisplayHelpSubtitles (): | |
diff --git a/gemrb/GUIScripts/iwd2/GUIOPT.py b/gemrb/GUIScripts/iwd2/GUIOPT.py | |
index 45f8f9c..b400afe 100644 | |
--- a/gemrb/GUIScripts/iwd2/GUIOPT.py | |
+++ b/gemrb/GUIScripts/iwd2/GUIOPT.py | |
@@ -494,12 +494,12 @@ def OpenCharacterSoundsWindow (): | |
OptCheckbox ('Subtitles', Window, 5, 20, 'Subtitles', 1) | |
OptCheckbox ('AttackSounds', Window, 6, 18, 'Attack Sounds', 1) | |
OptCheckbox ('Footsteps', Window, 7, 19, 'Footsteps', 1) | |
- OptRadio ('CommandSounds', Window, 8, 21, 'Command Sounds Frequency', 1) | |
- OptRadio ('CommandSounds', Window, 9, 21, 'Command Sounds Frequency', 2) | |
- OptRadio ('CommandSounds', Window, 10, 21, 'Command Sounds Frequency', 3) | |
- OptRadio ('SelectionSounds', Window, 58, 57, 'Selection Sounds Frequency', 1) | |
- OptRadio ('SelectionSounds', Window, 59, 57, 'Selection Sounds Frequency', 2) | |
- OptRadio ('SelectionSounds', Window, 60, 57, 'Selection Sounds Frequency', 3) | |
+ OptRadio ('CommandSounds', Window, 8, 21, 'Command Sounds Frequency', 2) | |
+ OptRadio ('CommandSounds', Window, 9, 21, 'Command Sounds Frequency', 1) | |
+ OptRadio ('CommandSounds', Window, 10, 21, 'Command Sounds Frequency', 0) | |
+ OptRadio ('SelectionSounds', Window, 58, 57, 'Selection Sounds Frequency', 2) | |
+ OptRadio ('SelectionSounds', Window, 59, 57, 'Selection Sounds Frequency', 1) | |
+ OptRadio ('SelectionSounds', Window, 60, 57, 'Selection Sounds Frequency', 0) | |
Window.ShowModal (MODAL_SHADOW_GRAY) | |
diff --git a/gemrb/core/Scriptable/Actor.cpp b/gemrb/core/Scriptable/Actor.cpp | |
index 2d62659..cd07e05 100644 | |
--- a/gemrb/core/Scriptable/Actor.cpp | |
+++ b/gemrb/core/Scriptable/Actor.cpp | |
@@ -378,6 +378,8 @@ Actor::Actor() | |
LongStrRef = (ieStrRef) -1; | |
ShortStrRef = (ieStrRef) -1; | |
+ playedCommandSound = false; | |
+ | |
PCStats = NULL; | |
LastDamage = 0; | |
LastDamageType = 0; | |
@@ -3105,13 +3107,14 @@ bool Actor::GetPartyComment() | |
} | |
//call this only from gui selects | |
-void Actor::SelectActor() const | |
+void Actor::SelectActor() | |
{ | |
+ playedCommandSound = false; | |
switch (sel_snd_freq) { | |
case 0: | |
return; | |
case 1: | |
- if (core->Roll(1,100,0) > 25) return; | |
+ if (core->Roll(1,100,0) > 20) return; | |
default:; | |
} | |
@@ -3133,13 +3136,14 @@ void Actor::SelectActor() const | |
#define SEL_ACTION_COUNT_ALL 7 | |
//call this when a PC receives a command from GUI | |
-void Actor::CommandActor() const | |
+void Actor::CommandActor() | |
{ | |
switch (cmd_snd_freq) { | |
case 0: | |
return; | |
case 1: | |
- if (core->Roll(1,100,0)>25) return; | |
+ if (playedCommandSound) return; | |
+ playedCommandSound = true; | |
case 2: | |
//PST has 4 states and rare sounds | |
if (raresnd) { | |
diff --git a/gemrb/core/Scriptable/Actor.h b/gemrb/core/Scriptable/Actor.h | |
index a58d2c5..53c18d6 100644 | |
--- a/gemrb/core/Scriptable/Actor.h | |
+++ b/gemrb/core/Scriptable/Actor.h | |
@@ -337,6 +337,8 @@ private: | |
CharAnimations* anims; | |
SpriteCover* extraCovers[EXTRA_ACTORCOVERS]; | |
ieByte SavingThrow[5]; | |
+ // true when command has been played after select | |
+ bool playedCommandSound; | |
//true every second round of attack | |
bool secondround; | |
int attacksperround; | |
@@ -485,9 +487,9 @@ public: | |
/* receives undead turning message */ | |
void Turn(Scriptable *cleric, ieDword turnlevel); | |
/* call this on gui selects */ | |
- void SelectActor() const; | |
+ void SelectActor(); | |
/* call this when adding actions via gui */ | |
- void CommandActor() const; | |
+ void CommandActor(); | |
/** handle panic and other involuntary actions that mess with scripting */ | |
bool OverrideActions(); | |
/** handle idle actions, that shouldn't mess with scripting */ | |
-- | |
1.7.9.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment