sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
--- a/hedgewars/GSHandlers.inc Fri Dec 31 00:37:39 2010 +0100
+++ b/hedgewars/GSHandlers.inc Fri Dec 31 01:05:23 2010 +0100
@@ -233,10 +233,10 @@
AllInactive := false;
Gear^.Y := Gear^.Y + cDrownSpeed;
Gear^.X := Gear^.X + Gear^.dX * cDrownSpeed;
- if (cWaterOpacity > $FE) or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then
+ if (not SuddenDeathDmg and (cWaterOpacity > $FE)) or (SuddenDeathDmg and (cSDWaterOpacity > $FE)) or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then
DeleteGear(Gear);
// Create some bubbles (0.5% might be better but causes too few bubbles sometimes)
- if (cWaterOpacity < $FF) and ((GameTicks and $1F) = 0) then
+ if ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cSDWaterOpacity < $FF))) and ((GameTicks and $1F) = 0) then
if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then
AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius,
vgtBubble)
@@ -892,7 +892,7 @@
dec(Gear^.Health, Gear^.Damage);
Gear^.Damage := 0
end;
- if ((Gear^.State and gstDrowning) <> 0) and (Gear^.Damage < Gear^.Health) and (cWaterOpacity < $FF) then
+ if ((Gear^.State and gstDrowning) <> 0) and (Gear^.Damage < Gear^.Health) and ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cSDWaterOpacity < $FF))) then
begin
for i:=(Gear^.Health - Gear^.Damage) * 4 downto 0 do
begin
--- a/hedgewars/uConsts.pas Fri Dec 31 00:37:39 2010 +0100
+++ b/hedgewars/uConsts.pas Fri Dec 31 01:05:23 2010 +0100
@@ -116,6 +116,7 @@
cCursorEdgesDist : LongInt = 100;
cTeamHealthWidth : LongInt = 128;
cWaterOpacity : byte = $80;
+ cSDWaterOpacity : byte = $80;
cifRandomize = $00000001;
cifTheme = $00000002;
--- a/hedgewars/uGears.pas Fri Dec 31 00:37:39 2010 +0100
+++ b/hedgewars/uGears.pas Fri Dec 31 01:05:23 2010 +0100
@@ -557,7 +557,7 @@
begin
t:= max(Gear^.Damage, Gear^.Health);
Gear^.Damage:= t;
- if (cWaterOpacity < $FF) and (hwRound(Gear^.Y) < cWaterLine + 256) then
+ if ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cWaterOpacity < $FF))) and (hwRound(Gear^.Y) < cWaterLine + 256) then
spawnHealthTagForHH(Gear, t);
uStats.HedgehogDamaged(Gear)
end;
@@ -793,9 +793,14 @@
stHealth: begin
if (cWaterRise <> 0) or (cHealthDecrease <> 0) then
begin
- if (TotalRounds = cSuddenDTurns) and not SuddenDeathDmg and not isInMultiShoot then
+ if (TotalRounds = cSuddenDTurns) and not SuddenDeath and not isInMultiShoot then
begin
- SuddenDeathDmg:= true;
+ SuddenDeath:= true;
+ if cHealthDecrease <> 0 then
+ begin
+ SuddenDeathDmg:= true;
+ ChangeToSDClouds
+ end;
AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState);
playSound(sndSuddenDeath);
MusicFN:= SDMusic;
@@ -1885,6 +1890,7 @@
CurAmmoGear:= nil;
GearsList:= nil;
KilledHHs:= 0;
+ SuddenDeath:= false;
SuddenDeathDmg:= false;
SpeechType:= 1;
TrainingTargetGear:= nil;
--- a/hedgewars/uLandObjects.pas Fri Dec 31 00:37:39 2010 +0100
+++ b/hedgewars/uLandObjects.pas Fri Dec 31 01:05:23 2010 +0100
@@ -449,7 +449,11 @@
end
else if key = 'water-opacity' then cWaterOpacity:= StrToInt(Trim(s))
else if key = 'music' then MusicFN:= Trim(s)
- else if key = 'clouds' then cCloudsNumber:= StrToInt(Trim(s)) * cScreenSpace div LAND_WIDTH
+ else if key = 'clouds' then
+ begin
+ cCloudsNumber:= StrToInt(Trim(s)) * cScreenSpace div LAND_WIDTH;
+ cSDCloudsNumber:= cCloudsNumber
+ end
else if key = 'object' then
begin
inc(ThemeObjects.Count);
@@ -562,8 +566,8 @@
SDWaterColorArray[2].a := 255;
SDWaterColorArray[3]:= SDWaterColorArray[2];
end
- else if key = 'sd-water-opacity' then continue //cSDWaterOpacity:= StrToInt(Trim(s))
- else if key = 'sd-clouds' then continue //cSDCloudsNumber:= StrToInt(Trim(s)) * cScreenSpace div LAND_WIDTH
+ else if key = 'sd-water-opacity' then cSDWaterOpacity:= StrToInt(Trim(s))
+ else if key = 'sd-clouds' then cSDCloudsNumber:= StrToInt(Trim(s)) * cScreenSpace div LAND_WIDTH
else if key = 'sd-flakes' then continue //TODO: make :P
end;
--- a/hedgewars/uVariables.pas Fri Dec 31 00:37:39 2010 +0100
+++ b/hedgewars/uVariables.pas Fri Dec 31 01:05:23 2010 +0100
@@ -66,6 +66,7 @@
cHealthDecrease : LongInt;
cCloudsNumber : LongInt;
+ cSDCloudsNumber : LongInt;
cTagsMask : byte;
zoom : GLfloat;
@@ -2049,6 +2050,7 @@
AllInactive: boolean;
PrvInactive: boolean;
KilledHHs: Longword;
+ SuddenDeath: Boolean;
SuddenDeathDmg: Boolean;
SpeechType: Longword;
SpeechText: shortstring;
@@ -2234,6 +2236,7 @@
cMinesTime := 3000;
cMaxAIThinkTime := 9000;
cCloudsNumber := 9;
+ cSDCloudsNumber := 9;
cHealthCaseProb := 35;
cHealthCaseAmount := 25;
cWaterRise := 47;
--- a/hedgewars/uVisualGears.pas Fri Dec 31 00:37:39 2010 +0100
+++ b/hedgewars/uVisualGears.pas Fri Dec 31 01:05:23 2010 +0100
@@ -32,6 +32,7 @@
procedure DeleteVisualGear(Gear: PVisualGear);
function VisualGearByUID(uid : Longword) : PVisualGear;
procedure AddClouds;
+procedure ChangeToSDClouds;
procedure AddDamageTag(X, Y, Damage, Color: LongWord);
implementation
@@ -558,6 +559,24 @@
AddVisualGear(cLeftScreenBorder + i * cScreenSpace div (cCloudsNumber + 1), LAND_HEIGHT-1184, vgtCloud)
end;
+procedure ChangeToSDClouds;
+var i: LongInt;
+ vg, tmp: PVisualGear;
+begin
+if cCloudsNumber = cSDCloudsNumber then exit;
+vg:= VisualGearsList;
+while vg <> nil do
+ if vg^.Kind = vgtCloud then
+ begin
+ tmp:= vg^.NextGear;
+ DeleteVisualGear(vg);
+ vg:= tmp
+ end
+ else vg:= vg^.NextGear;
+for i:= 0 to cSDCloudsNumber - 1 do
+ AddVisualGear(cLeftScreenBorder + i * cScreenSpace div (cSDCloudsNumber + 1), LAND_HEIGHT-1184, vgtCloud)
+end;
+
procedure initModule;
begin
VisualGearsList:= nil;
--- a/hedgewars/uWorld.pas Fri Dec 31 00:37:39 2010 +0100
+++ b/hedgewars/uWorld.pas Fri Dec 31 01:05:23 2010 +0100
@@ -651,7 +651,10 @@
DrawVisualGears(2);
- DrawWater(cWaterOpacity, 0);
+ if SuddenDeathDmg then
+ DrawWater(cSDWaterOpacity, 0)
+ else
+ DrawWater(cWaterOpacity, 0);
// Waves
DrawWaves( 1, 25 - WorldDx div 9, - cWaveHeight, 12);
@@ -660,9 +663,15 @@
begin
//DrawWater(cWaterOpacity, - offsetY div 40);
DrawWaves(-1, 50 + WorldDx div 6, - cWaveHeight - offsetY div 40, 8);
- DrawWater(cWaterOpacity, - offsetY div 20);
+ if SuddenDeathDmg then
+ DrawWater(cSDWaterOpacity, - offsetY div 20)
+ else
+ DrawWater(cWaterOpacity, - offsetY div 20);
DrawWaves( 1, 75 - WorldDx div 4, - cWaveHeight - offsetY div 20, 2);
- DrawWater(cWaterOpacity, - offsetY div 10);
+ if SuddenDeathDmg then
+ DrawWater(cSDWaterOpacity, - offsetY div 10)
+ else
+ DrawWater(cWaterOpacity, - offsetY div 10);
DrawWaves( -1, 25 + WorldDx div 3, - cWaveHeight - offsetY div 10, 0);
end
else