- Refactor drill rocket
authorunc0rr
Tue, 06 Jan 2009 17:37:18 +0000
changeset 1590 646d56eacb8f
parent 1589 53eb1d3953ef
child 1591 1db9b654f880
- Refactor drill rocket - Add a releasing guide for me not to forget anything
doc/Release.txt
hedgewars/GSHandlers.inc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/Release.txt	Tue Jan 06 17:37:18 2009 +0000
@@ -0,0 +1,8 @@
+1. Check copyright headers
+2. Changelog
+3. Make a branch
+4. Make packages
+5. Test packages
+6. Upload (hedgewars.org, fireforge.net, gna.org)
+7. Post news (hedgewars.org, fireforge.net, gna.org, etc.)
+8. Make tag (svn copy svn+ssh://unc0rr@svn.fireforge.net/svnroot/hedgewars/branches/0.9.7 svn+ssh://unc0rr@svn.fireforge.net/svnroot/hedgewars/tags/0.9.7 -m "Tag for 0.9.7 release")
\ No newline at end of file
--- a/hedgewars/GSHandlers.inc	Tue Jan 06 14:53:49 2009 +0000
+++ b/hedgewars/GSHandlers.inc	Tue Jan 06 17:37:18 2009 +0000
@@ -1838,61 +1838,64 @@
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
-procedure doStepDiggingGear(Gear: PGear);
+procedure doStepDrillDrilling(Gear: PGear);
 var ox,oy: hwFloat;
 begin
+AllInactive:= false;
+
+if (Gear^.Timer > 0) and ((Gear^.Timer mod 20) = 0) then
+	begin
 	ox:= Gear^.X;
 	oy:= Gear^.Y;
 	Gear^.X:= Gear^.X + Gear^.dX;
 	Gear^.Y:= Gear^.Y + Gear^.dY;
 	DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 2, 6);
 	CheckGearDrowning(Gear);
+	end;
+
+if (Gear^.Timer = 0)
+or (not TestCollisionYWithGear(Gear, hwSign(Gear^.dY))
+and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))) then
+	begin //out of time or exited ground
+	doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
+	DeleteGear(Gear);
+	exit
+	end;
+
+dec(Gear^.Timer);
 end;
 
 procedure doStepDrill(Gear: PGear);
-var newX, newY, oldDx, oldDy: hwFloat;
-	t: PGearArray;
+var t: PGearArray;
+    newX, newY, oldDx, oldDy: hwFloat;
 begin
-	AllInactive:= false;
+AllInactive:= false;
 
-	if (Gear^.Timer = 5000) then begin //flying
-		Gear^.dX:= Gear^.dX + cWindSpeed;
-		oldDx:= Gear^.dX;
-		oldDy:= Gear^.dY;
-		doStepFallingGear(Gear);
-		if (GameTicks and $3F) = 0 then
-			AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0);
-	end;
+Gear^.dX:= Gear^.dX + cWindSpeed;
+oldDx:= Gear^.dX;
+oldDy:= Gear^.dY;
+
+doStepFallingGear(Gear);
+
+if (GameTicks and $3F) = 0 then
+	AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0);
 
-	if ((Gear^.State and gstCollision) <> 0) and (Gear^.Timer = 5000) then
-		begin //hit
-		Gear^.dX:= oldDx;
-		Gear^.dY:= oldDy;
-		t:= CheckGearsCollision(Gear);
-		if (t^.Count = 0) then
-			begin //hit the ground not the hedgehog
-			newy:= hwSqrt((_0_5 * Gear^.dY * Gear^.dY) / Distance(Gear^.dX, Gear^.dY));
-			if (Gear^.dY < _0) then newY := -newY;
-			newx:= newy * Gear^.dX / Gear^.dY;
-			Gear^.dX := newx;
-			Gear^.dY := newy;
-			dec(Gear^.Timer);
-			end
-		else
-			Gear^.Timer:= 0
-		end;
-
-	if (Gear^.Timer > 0) and (Gear^.Timer < 5000) and ((Gear^.Timer mod 20) = 0) then doStepDiggingGear(Gear);
-
-	if (Gear^.Timer = 0)
-	or ((Gear^.Timer < 5000)
-		and not TestCollisionYWithGear(Gear, hwSign(Gear^.dY))
-	and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))) then
-		begin //out of time or exited ground
-		doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
-		DeleteGear(Gear);
-		exit
-		end;
-
-	if (Gear^.Timer < 5000) then dec(Gear^.Timer);
-end;
\ No newline at end of file
+if ((Gear^.State and gstCollision) <> 0) then
+	begin //hit
+	Gear^.dX:= oldDx;
+	Gear^.dY:= oldDy;
+	t:= CheckGearsCollision(Gear);
+	Gear^.doStep:= @doStepDrillDrilling;
+	if (t^.Count = 0) then
+		begin //hit the ground not the hedgehog
+		newy:= hwSqrt((_0_5 * Gear^.dY * Gear^.dY) / Distance(Gear^.dX, Gear^.dY));
+		if (Gear^.dY < _0) then newY := -newY;
+		newx:= newy * Gear^.dX / Gear^.dY;
+		Gear^.dX := newx;
+		Gear^.dY := newy;
+		dec(Gear^.Timer)
+		end
+	else
+		Gear^.Timer:= 0
+	end
+end;