[+] Added CPreference.StereoSound, to control stereo effects

[-] Some fixes to icon lifebars display
This commit is contained in:
cybermind 2015-02-14 23:20:40 +05:00
parent 15c177ef90
commit 84f9fc0f7b
4 changed files with 20 additions and 5 deletions

View file

@ -428,7 +428,7 @@ public:
CPreference() : ShowSightRange(false), ShowReactionRange(false),
ShowAttackRange(false), ShowMessages(true), BigScreen(false),
PauseOnLeave(true), AiExplores(true), GrayscaleIcons(false),
IconsShift(false),
IconsShift(false), StereoSound(true),
ShowOrders(0), ShowNameDelay(0), ShowNameTime(0) {};
bool ShowSightRange; /// Show sight range.
@ -440,6 +440,7 @@ public:
bool AiExplores; /// If true, AI sends explorers to search for resources (almost useless thing)
bool GrayscaleIcons; /// Use grayscaled icons for unavailable units, upgrades, etc
bool IconsShift; /// Shift icons slightly when you press on them
bool StereoSound; /// Enables/diables stereo sound effects
int ShowOrders; /// How many second show orders of unit on map.
int ShowNameDelay; /// How many cycles need to wait until unit's name popup will appear.

View file

@ -45,6 +45,7 @@
#include "iocompat.h"
#include "iolib.h"
#include "unit.h"
#include "SDL.h"
@ -425,6 +426,9 @@ int SetChannelVolume(int channel, int volume)
*/
int SetChannelStereo(int channel, int stereo)
{
if (Preference.StereoSound == false) {
stereo = 0;
}
if (channel < 0 || channel >= MaxChannels) {
return -1;
}

View file

@ -27,6 +27,7 @@ class CPreference
bool AiExplores;
bool GrayscaleIcons;
bool IconsShift;
bool StereoSound;
unsigned int ShowOrders;
unsigned int ShowNameDelay;

View file

@ -144,9 +144,17 @@ void DrawUserDefinedButtons()
static void UiDrawLifeBar(const CUnit &unit, int x, int y)
{
// FIXME: add icon borders
int hBar, hAll;
if (Preference.IconsShift) {
hBar = 6;
hAll = 10;
} else {
hBar = 5;
hAll = 7;
}
y += unit.Type->Icon.Icon->G->Height;
Video.FillRectangleClip(ColorBlack, x, y,
unit.Type->Icon.Icon->G->Width, 7);
Video.FillRectangleClip(ColorBlack, x - 4, y + 2,
unit.Type->Icon.Icon->G->Width + 8, hAll);
if (unit.Variable[HP_INDEX].Value) {
Uint32 color;
@ -162,8 +170,9 @@ static void UiDrawLifeBar(const CUnit &unit, int x, int y)
color = ColorRed;
}
f = (f * (unit.Type->Icon.Icon->G->Width)) / 100;
Video.FillRectangleClip(color, x + 1, y + 1, f > 1 ? f - 2 : 0, 5);
f = (f * (unit.Type->Icon.Icon->G->Width + 6)) / 100;
Video.FillRectangleClip(color, x - 2, y + 4,
f > 1 ? f - 2 : 0, hBar);
}
}