--- a/hedgewars/uGears.pas Tue Dec 28 20:44:06 2010 +0100
+++ b/hedgewars/uGears.pas Tue Dec 28 23:53:37 2010 +0100
@@ -795,7 +795,9 @@
begin
SuddenDeathDmg:= true;
AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState);
- playSound(sndSuddenDeath)
+ playSound(sndSuddenDeath);
+ MusicFN:= SDMusic;
+ ChangeMusic
end
else if (TotalRounds < cSuddenDTurns) and not isInMultiShoot then
begin
--- a/hedgewars/uSound.pas Tue Dec 28 20:44:06 2010 +0100
+++ b/hedgewars/uSound.pas Tue Dec 28 23:53:37 2010 +0100
@@ -39,6 +39,7 @@
procedure PlayMusic;
procedure PauseMusic;
procedure ResumeMusic;
+procedure ChangeMusic;
procedure StopSound(snd: TSound);
procedure StopSound(chn: LongInt);
function ChangeVolume(voldelta: LongInt): LongInt;
@@ -318,6 +319,17 @@
Mix_ResumeMusic(Mus);
end;
+procedure ChangeMusic;
+begin
+ if (MusicFN = '') or (not isMusicEnabled) then
+ exit;
+
+ if Mus <> nil then
+ Mix_FreeMusic(Mus);
+
+ PlayMusic;
+end;
+
procedure chVoicepack(var s: shortstring);
begin
if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/voicepack"', true);
--- a/hedgewars/uStore.pas Tue Dec 28 20:44:06 2010 +0100
+++ b/hedgewars/uStore.pas Tue Dec 28 23:53:37 2010 +0100
@@ -307,7 +307,7 @@
else
begin
Texture:= Surface2Tex(tmpsurf, false);
- if (ii = sprWater) and ((cReducedQuality and (rq2DWater or rqClampLess)) = 0) then // HACK: We should include some sprite attribute to define the texture wrap directions
+ if ((ii = sprWater) or (ii = sprSDWater)) and ((cReducedQuality and (rq2DWater or rqClampLess)) = 0) then // HACK: We should include some sprite attribute to define the texture wrap directions
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
end;
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, priority);
--- a/hedgewars/uTypes.pas Tue Dec 28 20:44:06 2010 +0100
+++ b/hedgewars/uTypes.pas Tue Dec 28 23:53:37 2010 +0100
@@ -16,7 +16,7 @@
TPathType = (ptNone, ptData, ptGraphics, ptThemes, ptCurrTheme, ptTeams, ptMaps,
ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts,
- ptLocale, ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps);
+ ptLocale, ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps, ptSuddenDeath);
TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame,
sprLag, sprArrow, sprBazookaShell, sprTargetP, sprBee,
@@ -52,7 +52,7 @@
sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk, sprNote,
sprSMineOff, sprSMineOn, sprHandSMine, sprHammer,
sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb,
- sprBulletHit, sprSnowball, sprHandSnowball, sprSnow
+ sprBulletHit, sprSnowball, sprHandSnowball, sprSnow, sprSDFlake, sprSDWater
);
// Gears that interact with other Gears and/or Land
--- a/hedgewars/uVariables.pas Tue Dec 28 20:44:06 2010 +0100
+++ b/hedgewars/uVariables.pas Tue Dec 28 23:53:37 2010 +0100
@@ -131,6 +131,8 @@
AttackBar : LongInt;
WaterColorArray : array[0..3] of HwColor4f;
+ SDWaterColorArray : array[0..3] of HwColor4f;
+ SDMusic : shortstring;
CursorPoint : TPoint;
TargetPoint : TPoint;
@@ -175,7 +177,8 @@
'Sounds/voices', // ptVoices
'Graphics/Hats', // ptHats
'Graphics/Flags', // ptFlags
- 'Missions/Maps' // ptMissionMaps
+ 'Missions/Maps', // ptMissionMaps
+ 'Graphics/SuddenDeath' // ptSuddenDeath
);
cTagsMasks : array[0..15] of byte = (7, 0, 0, 0, 15, 6, 4, 5, 0, 0, 0, 0, 0, 14, 12, 13);
@@ -558,7 +561,11 @@
(FileName: 'amSnowball'; Path: ptCurrTheme; AltPath: ptHedgehog; Texture: nil; Surface: nil;
Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandSnowball
(FileName: 'Snow'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil;
- Width: 4; Height: 4; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true) // sprSnow
+ Width: 4; Height: 4; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSnow
+ (FileName: 'Flake'; Path: ptSuddenDeath; AltPath: ptNone; Texture: nil; Surface: nil;
+ Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprSDFlake
+ (FileName: 'BlueWater'; Path: ptSuddenDeath; AltPath: ptNone; Texture: nil; Surface: nil;
+ Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: true; getImageDimensions: true) // sprSDWater
);
@@ -2165,6 +2172,19 @@
LAND_HEIGHT_MASK:= $FFFFF800
end;
+ SDWaterColorArray[0].r := 184;
+ SDWaterColorArray[0].g := 152;
+ SDWaterColorArray[0].b := 195;
+ SDWaterColorArray[0].a := 255;
+ SDWaterColorArray[2].r := 152;
+ SDWaterColorArray[2].g := 120;
+ SDWaterColorArray[2].b := 163;
+ SDWaterColorArray[2].a := 255;
+ SDWaterColorArray[1]:= SDWaterColorArray[0];
+ SDWaterColorArray[3]:= SDWaterColorArray[2];
+
+ SDMusic:= 'main_theme.ogg';
+
cDrownSpeed.QWordValue := 257698038; // 0.06
cDrownSpeedf := 0.06;
cMaxWindSpeed.QWordValue:= 1073742; // 0.00025
--- a/hedgewars/uVisualGears.pas Tue Dec 28 20:44:06 2010 +0100
+++ b/hedgewars/uVisualGears.pas Tue Dec 28 23:53:37 2010 +0100
@@ -383,9 +383,15 @@
if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
case Gear^.Kind of
vgtFlake: if vobVelocity = 0 then
- DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
+ if SuddenDeathDmg then
+ DrawSprite(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
+ else
+ DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
else
- DrawRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
+ if SuddenDeathDmg then
+ DrawRotatedF(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle)
+ else
+ DrawRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
vgtCloud: DrawSprite(sprCloud, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame);
end;
if Gear^.Tint <> $FFFFFFFF then Tint($FF,$FF,$FF,$FF);
--- a/hedgewars/uWorld.pas Tue Dec 28 20:44:06 2010 +0100
+++ b/hedgewars/uWorld.pas Tue Dec 28 23:53:37 2010 +0100
@@ -394,10 +394,20 @@
r: TSDL_Rect;
lw, lh: GLfloat;
begin
- WaterColorArray[0].a := Alpha;
- WaterColorArray[1].a := Alpha;
- WaterColorArray[2].a := Alpha;
- WaterColorArray[3].a := Alpha;
+ if SuddenDeathDmg then
+ begin
+ SDWaterColorArray[0].a := Alpha;
+ SDWaterColorArray[1].a := Alpha;
+ SDWaterColorArray[2].a := Alpha;
+ SDWaterColorArray[3].a := Alpha
+ end
+ else
+ begin
+ WaterColorArray[0].a := Alpha;
+ WaterColorArray[1].a := Alpha;
+ WaterColorArray[2].a := Alpha;
+ WaterColorArray[3].a := Alpha
+ end;
lw:= cScreenWidth / cScaleFactor;
lh:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 + 16;
@@ -421,7 +431,10 @@
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WaterColorArray[0]);
+ if SuddenDeathDmg then
+ glColorPointer(4, GL_UNSIGNED_BYTE, 0, @SDWaterColorArray[0])
+ else
+ glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WaterColorArray[0]);
glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
@@ -437,24 +450,39 @@
procedure DrawWaves(Dir, dX, dY: LongInt; tnt: Byte);
var VertexBuffer, TextureBuffer: array [0..3] of TVertex2f;
lw, waves, shift: GLfloat;
+ sprite: TSprite;
begin
+if SuddenDeathDmg then
+ sprite:= sprSDWater
+else
+ sprite:= sprWater;
+
+cWaveWidth:= SpritesData[sprite].Width;
+
lw:= cScreenWidth / cScaleFactor;
waves:= lw * 2 / cWaveWidth;
-Tint(LongInt(tnt) * WaterColorArray[2].r div 255 + 255 - tnt,
- LongInt(tnt) * WaterColorArray[2].g div 255 + 255 - tnt,
- LongInt(tnt) * WaterColorArray[2].b div 255 + 255 - tnt,
- 255
-);
+if SuddenDeathDmg then
+ Tint(LongInt(tnt) * SDWaterColorArray[2].r div 255 + 255 - tnt,
+ LongInt(tnt) * SDWaterColorArray[2].g div 255 + 255 - tnt,
+ LongInt(tnt) * SDWaterColorArray[2].b div 255 + 255 - tnt,
+ 255
+ )
+else
+ Tint(LongInt(tnt) * WaterColorArray[2].r div 255 + 255 - tnt,
+ LongInt(tnt) * WaterColorArray[2].g div 255 + 255 - tnt,
+ LongInt(tnt) * WaterColorArray[2].b div 255 + 255 - tnt,
+ 255
+ );
-glBindTexture(GL_TEXTURE_2D, SpritesData[sprWater].Texture^.id);
+glBindTexture(GL_TEXTURE_2D, SpritesData[sprite].Texture^.id);
VertexBuffer[0].X:= -lw;
VertexBuffer[0].Y:= cWaterLine + WorldDy + dY;
VertexBuffer[1].X:= lw;
VertexBuffer[1].Y:= VertexBuffer[0].Y;
VertexBuffer[2].X:= lw;
-VertexBuffer[2].Y:= VertexBuffer[0].Y + SpritesData[sprWater].Height;
+VertexBuffer[2].Y:= VertexBuffer[0].Y + SpritesData[sprite].Height;
VertexBuffer[3].X:= -lw;
VertexBuffer[3].Y:= VertexBuffer[2].Y;
@@ -464,7 +492,7 @@
TextureBuffer[1].X:= TextureBuffer[0].X + waves;
TextureBuffer[1].Y:= TextureBuffer[0].Y;
TextureBuffer[2].X:= TextureBuffer[1].X;
-TextureBuffer[2].Y:= SpritesData[sprWater].Texture^.ry;
+TextureBuffer[2].Y:= SpritesData[sprite].Texture^.ry;
TextureBuffer[3].X:= TextureBuffer[0].X;
TextureBuffer[3].Y:= TextureBuffer[2].Y;
--- a/share/hedgewars/Data/Graphics/CMakeLists.txt Tue Dec 28 20:44:06 2010 +0100
+++ b/share/hedgewars/Data/Graphics/CMakeLists.txt Tue Dec 28 23:53:37 2010 +0100
@@ -3,6 +3,7 @@
add_subdirectory(Graves)
add_subdirectory(Hats)
add_subdirectory(Hedgehog)
+add_subdirectory(SuddenDeath)
file(GLOB BaseSprites *.png)