# HG changeset patch
# User unc0rr
# Date 1215182452 0
# Node ID ea195268734f566dfe488b08b10d398fcf36f952
# Parent f759aae1062f1e17f8a078096c14da848eb8f00b
Testing explosion particles implementation
diff -r f759aae1062f -r ea195268734f hedgewars.kdevelop
--- a/hedgewars.kdevelop Tue Jul 01 22:26:36 2008 +0000
+++ b/hedgewars.kdevelop Fri Jul 04 14:40:52 2008 +0000
@@ -39,83 +39,17 @@
false
- *.java
*.h
- *.H
- *.hh
- *.hxx
- *.hpp
*.c
- *.C
*.cc
*.cpp
*.c++
- *.cxx
- Makefile
CMakeLists.txt
*.pas
*.inc
*.dpr
-
- QTfrontend/moc_SDLs.cxx
- QTfrontend/moc_SquareLabel.cxx
- QTfrontend/moc_about.cxx
- QTfrontend/moc_chatwidget.cxx
- QTfrontend/moc_fpsedit.cxx
- QTfrontend/moc_frameTeam.cxx
- QTfrontend/moc_game.cxx
- QTfrontend/moc_gamecfgwidget.cxx
- QTfrontend/moc_gameuiconfig.cxx
- QTfrontend/moc_hedgehogerWidget.cxx
- QTfrontend/moc_hwform.cxx
- QTfrontend/moc_hwmap.cxx
- QTfrontend/moc_input_ip.cxx
- QTfrontend/moc_itemNum.cxx
- QTfrontend/moc_mapContainer.cxx
- QTfrontend/moc_netconnectedclient.cxx
- QTfrontend/moc_netregister.cxx
- QTfrontend/moc_netserver.cxx
- QTfrontend/moc_netserverslist.cxx
- QTfrontend/moc_netudpserver.cxx
- QTfrontend/moc_netudpwidget.cxx
- QTfrontend/moc_netwwwserver.cxx
- QTfrontend/moc_netwwwwidget.cxx
- QTfrontend/moc_newnetclient.cxx
- QTfrontend/moc_pages.cxx
- QTfrontend/moc_playrecordpage.cxx
- QTfrontend/moc_proto.cxx
- QTfrontend/moc_selectWeapon.cxx
- QTfrontend/moc_tcpBase.cxx
- QTfrontend/moc_teamselect.cxx
- QTfrontend/moc_teamselhelper.cxx
- QTfrontend/moc_vertScrollArea.cxx
- QTfrontend/moc_weaponItem.cxx
- bin/Makefile
- bin/checkstack.pas
- CMakeFiles
- CMakeFiles/CompilerIdC
- CMakeFiles/CompilerIdC/CMakeCCompilerId.c
- CMakeFiles/CompilerIdCXX
- CMakeFiles/CompilerIdCXX/CMakeCXXCompilerId.cpp
- Makefile
- QTfrontend/qrc_hedgewars.cxx
- misc
- misc/fbsd-port
- misc/fbsd-port/Makefile
- share/Makefile
- share/hedgewars/Data/Fonts/Makefile
- share/hedgewars/Data/Forts/Makefile
- share/hedgewars/Data/Graphics/Makefile
- share/hedgewars/Data/Locale/Makefile
- share/hedgewars/Data/Makefile
- share/hedgewars/Data/Maps/Makefile
- share/hedgewars/Data/Music/Makefile
- share/hedgewars/Data/Sounds/Makefile
- share/hedgewars/Data/Themes/Makefile
- share/hedgewars/Data/Trainings/Makefile
- share/hedgewars/Makefile
-
+
diff -r f759aae1062f -r ea195268734f hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc Tue Jul 01 22:26:36 2008 +0000
+++ b/hedgewars/GSHandlers.inc Fri Jul 04 14:40:52 2008 +0000
@@ -782,7 +782,7 @@
end;
////////////////////////////////////////////////////////////////////////////////
-procedure doStepExplosion(Gear: PGear);
+procedure doStepExplosionWork(Gear: PGear);
begin
inc(Gear^.Timer);
if Gear^.Timer > 75 then
@@ -793,6 +793,13 @@
end;
end;
+procedure doStepExplosion(Gear: PGear);
+var i: LongWord;
+begin
+for i:= 0 to 15 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtExplPart);
+Gear^.doStep:= @doStepExplosionWork
+end;
+
////////////////////////////////////////////////////////////////////////////////
procedure doStepMine(Gear: PGear);
begin
diff -r f759aae1062f -r ea195268734f hedgewars/uConsts.pas
--- a/hedgewars/uConsts.pas Tue Jul 01 22:26:36 2008 +0000
+++ b/hedgewars/uConsts.pas Fri Jul 04 14:40:52 2008 +0000
@@ -46,7 +46,7 @@
sprHandBlowTorch, sprBlowTorch, sprTeleport, sprHHDeath,
sprShotgun, sprDEagle, sprHHIdle, sprMortar, sprTurnsLeft,
sprHat, sprKamikaze, sprWhip, sprKowtow, sprSad, sprWave,
- sprHurrah, sprLemonade);
+ sprHurrah, sprLemonade, sprExplPart);
TGearType = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope,
@@ -411,7 +411,9 @@
(FileName: 'Hurrah'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
Width: 32; Height: 32; saveSurf: false),// sprHurrah
(FileName:'ILoveLemonade';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
- Width: 128; Height: 32; saveSurf: false) // sprLemonade
+ Width: 128; Height: 32; saveSurf: false),// sprLemonade
+ (FileName: 'ExplPart'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+ Width: 32; Height: 32; saveSurf: false) // sprExplPart
);
Wavez: array [TWave] of record
diff -r f759aae1062f -r ea195268734f hedgewars/uGears.pas
--- a/hedgewars/uGears.pas Tue Jul 01 22:26:36 2008 +0000
+++ b/hedgewars/uGears.pas Fri Jul 04 14:40:52 2008 +0000
@@ -72,7 +72,7 @@
implementation
uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions,
uLand, uIO, uLandGraphics, uAIMisc, uLocale, uAI, uAmmos, uTriggers, GL,
- uStats;
+ uStats, uVisualGears;
const MAXROPEPOINTS = 300;
var RopePoints: record
diff -r f759aae1062f -r ea195268734f hedgewars/uStore.pas
--- a/hedgewars/uStore.pas Tue Jul 01 22:26:36 2008 +0000
+++ b/hedgewars/uStore.pas Fri Jul 04 14:40:52 2008 +0000
@@ -617,6 +617,7 @@
ProgrTex:= Surface2Tex(texsurf);
SDL_FreeSurface(texsurf)
end;
+
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
r.x:= 0;
diff -r f759aae1062f -r ea195268734f hedgewars/uVisualGears.pas
--- a/hedgewars/uVisualGears.pas Tue Jul 01 22:26:36 2008 +0000
+++ b/hedgewars/uVisualGears.pas Fri Jul 04 14:40:52 2008 +0000
@@ -40,7 +40,7 @@
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
procedure ProcessVisualGears(Steps: Longword);
-procedure DrawVisualGears();
+procedure DrawVisualGears(Layer: LongWord);
procedure DeleteVisualGear(Gear: PVisualGear);
procedure AddClouds;
@@ -50,6 +50,7 @@
implementation
uses uWorld, uMisc, uStore;
+const cExplFrameTicks = 80;
// ==================================================================
procedure doStepFlake(Gear: PVisualGear; Steps: Longword);
@@ -93,8 +94,14 @@
Gear^.Y:= Gear^.Y + Gear^.dY;
Gear^.dY:= Gear^.dY + cGravity;
-dec(Gear^.FrameTicks);
-if Gear^.FrameTicks = 0 then DeleteVisualGear(Gear)
+if Gear^.FrameTicks <= Steps then
+ if Gear^.Frame = 0 then DeleteVisualGear(Gear)
+ else
+ begin
+ dec(Gear^.Frame);
+ Gear^.FrameTicks:= cExplFrameTicks
+ end
+ else dec(Gear^.FrameTicks, Steps)
end;
// ==================================================================
@@ -107,6 +114,8 @@
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
var Result: PVisualGear;
+ t: Longword;
+ sp: hwFloat;
begin
New(Result);
FillChar(Result^, sizeof(TVisualGear), 0);
@@ -138,11 +147,14 @@
end;
vgtExplPart: with Result^ do
begin
+ t:= random(1024);
+ sp:= _0_001 * (random(700) + 150);
+ dx:= AngleSin(t) * sp;
dx.isNegative:= random(2) = 0;
- dx.QWordValue:= random(300000) + 1000000;
+ dy:= AngleCos(t) * sp;
dy.isNegative:= random(2) = 0;
- dy.QWordValue:= random(300000) + 1000000;
- FrameTicks:= 700
+ Frame:= 7 - random(3);
+ FrameTicks:= cExplFrameTicks
end;
end;
@@ -179,22 +191,30 @@
end
end;
-procedure DrawVisualGears();
+procedure DrawVisualGears(Layer: LongWord);
var Gear: PVisualGear;
begin
Gear:= VisualGearsList;
-while Gear <> nil do
- begin
- case Gear^.Kind of
- vgtFlake: if vobVelocity = 0 then
- DrawSprite(sprFlake, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame)
- else
- DrawRotatedF(sprFlake, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
-
- vgtCloud: DrawSprite(sprCloud, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame);
- end;
- Gear:= Gear^.NextGear
- end;
+case Layer of
+ 0: while Gear <> nil do
+ begin
+ case Gear^.Kind of
+ vgtFlake: if vobVelocity = 0 then
+ DrawSprite(sprFlake, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame)
+ else
+ DrawRotatedF(sprFlake, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
+ vgtCloud: DrawSprite(sprCloud, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame);
+ end;
+ Gear:= Gear^.NextGear
+ end;
+ 1: while Gear <> nil do
+ begin
+ case Gear^.Kind of
+ vgtExplPart: DrawSprite(sprExplPart, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 7 - Gear^.Frame);
+ end;
+ Gear:= Gear^.NextGear
+ end
+ end
end;
procedure AddClouds;
diff -r f759aae1062f -r ea195268734f hedgewars/uWorld.pas
--- a/hedgewars/uWorld.pas Tue Jul 01 22:26:36 2008 +0000
+++ b/hedgewars/uWorld.pas Fri Jul 04 14:40:52 2008 +0000
@@ -189,7 +189,7 @@
DrawRepeated(sprSky, WorldDx * 3 div 8);
DrawRepeated(sprHorizont, WorldDx * 3 div 5);
-DrawVisualGears;
+DrawVisualGears(0);
// Waves
{$WARNINGS OFF}
@@ -220,6 +220,8 @@
DrawGears;
+DrawVisualGears(1);
+
// Waves
{$WARNINGS OFF}
for i:= -1 to cWaterSprCount do DrawSprite(sprWater, i * 256 + ((WorldDx + (RealTicks shr 6) + 64) and $FF), cWaterLine + WorldDy - 32, 0);
diff -r f759aae1062f -r ea195268734f share/hedgewars/Data/Graphics/ExplPart.png
Binary file share/hedgewars/Data/Graphics/ExplPart.png has changed