# HG changeset patch
# User koda
# Date 1288798157 -3600
# Node ID af612377fcbabc3ab01d7ef5053f5de141aba1ad
# Parent 40df542b5f6222bd3921b1ab4daa2d700b743bbd
health reset mode ftw (replaces gfmines)
diff -r 40df542b5f62 -r af612377fcba QTfrontend/ammoSchemeModel.cpp
--- a/QTfrontend/ammoSchemeModel.cpp Wed Nov 03 00:48:42 2010 +0100
+++ b/QTfrontend/ammoSchemeModel.cpp Wed Nov 03 16:29:17 2010 +0100
@@ -31,7 +31,7 @@
<< QVariant(false) // low gravity 5
<< QVariant(false) // laser sight 6
<< QVariant(false) // invulnerable 7
- << QVariant(true) // add mines 8
+ << QVariant(false) // reset health 8
<< QVariant(false) // vampiric 9
<< QVariant(false) // karma 10
<< QVariant(false) // artillery 11
@@ -81,7 +81,7 @@
<< "lowgrav" // 5
<< "laser" // 6
<< "invulnerability" // 7
- << "mines" // 8
+ << "resethealth" // 8
<< "vampiric" // 9
<< "karma" // 10
<< "artillery" // 11
@@ -116,7 +116,7 @@
<< QVariant(false) // low gravity 5
<< QVariant(false) // laser sight 6
<< QVariant(false) // invulnerable 7
- << QVariant(false) // add mines 8
+ << QVariant(false) // reset health 8
<< QVariant(false) // vampiric 9
<< QVariant(false) // karma 10
<< QVariant(false) // artillery 11
@@ -151,7 +151,7 @@
<< QVariant(false) // low gravity 5
<< QVariant(false) // laser sight 6
<< QVariant(false) // invulnerable 7
- << QVariant(false) // add mines 8
+ << QVariant(false) // reset health 8
<< QVariant(false) // vampiric 9
<< QVariant(false) // karma 10
<< QVariant(false) // artillery 11
@@ -186,7 +186,7 @@
<< QVariant(true) // low gravity 5
<< QVariant(false) // laser sight 6
<< QVariant(true) // invulnerable 7
- << QVariant(false) // add mines 8
+ << QVariant(false) // reset health 8
<< QVariant(false) // vampiric 9
<< QVariant(false) // karma 10
<< QVariant(false) // artillery 11
@@ -221,7 +221,7 @@
<< QVariant(false) // low gravity 5
<< QVariant(false) // laser sight 6
<< QVariant(false) // invulnerable 7
- << QVariant(true) // add mines 8
+ << QVariant(false) // reset health 8
<< QVariant(false) // vampiric 9
<< QVariant(false) // karma 10
<< QVariant(false) // artillery 11
@@ -256,7 +256,7 @@
<< QVariant(false) // low gravity 5
<< QVariant(false) // laser sight 6
<< QVariant(false) // invulnerable 7
- << QVariant(false) // add mines 8
+ << QVariant(false) // reset health 8
<< QVariant(false) // vampiric 9
<< QVariant(false) // karma 10
<< QVariant(false) // artillery 11
@@ -291,7 +291,7 @@
<< QVariant(false) // low gravity 5
<< QVariant(false) // laser sight 6
<< QVariant(false) // invulnerable 7
- << QVariant(true) // add mines 8
+ << QVariant(false) // reset health 8
<< QVariant(false) // vampiric 9
<< QVariant(false) // karma 10
<< QVariant(false) // artillery 11
diff -r 40df542b5f62 -r af612377fcba QTfrontend/hedgewars.qrc
--- a/QTfrontend/hedgewars.qrc Wed Nov 03 00:48:42 2010 +0100
+++ b/QTfrontend/hedgewars.qrc Wed Nov 03 16:29:17 2010 +0100
@@ -54,7 +54,7 @@
res/btnInvulnerable.png
res/btnLaserSight.png
res/btnLowGravity.png
- res/btnMines.png
+ res/btnResetHealth.png
res/btnTeamsDivide.png
res/btnSolid.png
res/btnVampiric.png
diff -r 40df542b5f62 -r af612377fcba QTfrontend/pages.cpp
--- a/QTfrontend/pages.cpp Wed Nov 03 00:48:42 2010 +0100
+++ b/QTfrontend/pages.cpp Wed Nov 03 16:29:17 2010 +0100
@@ -1503,9 +1503,9 @@
TBW_invulnerable->setToolTip("" + ToggleButtonWidget::tr("Invulnerable") + ":
" + tr("All hogs have a personal forcefield"));
glGMLayout->addWidget(TBW_invulnerable,1,1,1,1);
- TBW_mines = new ToggleButtonWidget(gbGameModes, ":/res/btnMines.png");
- TBW_mines->setToolTip("" + ToggleButtonWidget::tr("Add Mines") + ":
" + tr("Enable random mines"));
- glGMLayout->addWidget(TBW_mines,1,2,1,1);
+ TBW_resethealth = new ToggleButtonWidget(gbGameModes, ":/res/btnResetHealth.png");
+ TBW_resethealth->setToolTip("" + ToggleButtonWidget::tr("Reset Health") + ":
" + tr("Every hog of the team is fully restored at the end of turn"));
+ glGMLayout->addWidget(TBW_resethealth,1,2,1,1);
TBW_vampiric = new ToggleButtonWidget(gbGameModes, ":/res/btnVampiric.png");
TBW_vampiric->setToolTip("" + ToggleButtonWidget::tr("Vampirism") + ":
" + tr("Gain 80% of the damage you do back in health"));
@@ -1732,7 +1732,7 @@
mapper->addMapping(TBW_lowGravity, 5);
mapper->addMapping(TBW_laserSight, 6);
mapper->addMapping(TBW_invulnerable, 7);
- mapper->addMapping(TBW_mines, 8);
+ mapper->addMapping(TBW_resethealth, 8);
mapper->addMapping(TBW_vampiric, 9);
mapper->addMapping(TBW_karma, 10);
mapper->addMapping(TBW_artillery, 11);
diff -r 40df542b5f62 -r af612377fcba QTfrontend/pages.h
--- a/QTfrontend/pages.h Wed Nov 03 00:48:42 2010 +0100
+++ b/QTfrontend/pages.h Wed Nov 03 16:29:17 2010 +0100
@@ -466,7 +466,7 @@
ToggleButtonWidget * TBW_lowGravity;
ToggleButtonWidget * TBW_laserSight;
ToggleButtonWidget * TBW_invulnerable;
- ToggleButtonWidget * TBW_mines;
+ ToggleButtonWidget * TBW_resethealth;
ToggleButtonWidget * TBW_vampiric;
ToggleButtonWidget * TBW_karma;
ToggleButtonWidget * TBW_artillery;
diff -r 40df542b5f62 -r af612377fcba QTfrontend/res/btnMines.png
Binary file QTfrontend/res/btnMines.png has changed
diff -r 40df542b5f62 -r af612377fcba QTfrontend/res/btnResetHealth.png
Binary file QTfrontend/res/btnResetHealth.png has changed
diff -r 40df542b5f62 -r af612377fcba hedgewars/CCHandlers.inc
--- a/hedgewars/CCHandlers.inc Wed Nov 03 00:48:42 2010 +0100
+++ b/hedgewars/CCHandlers.inc Wed Nov 03 16:29:17 2010 +0100
@@ -170,6 +170,7 @@
else CurrentHedgehog^.AmmoStore:= TeamsCount - 1;
CurrentHedgehog^.Gear:= Gear;
CurrentHedgehog^.Name:= id;
+ CurrentHedgehog^.InitialHealth:= Gear^.Health;
CurrHedgehog:= HedgehogsNumber;
inc(HedgehogsNumber)
end
diff -r 40df542b5f62 -r af612377fcba hedgewars/uConsts.pas
--- a/hedgewars/uConsts.pas Wed Nov 03 00:48:42 2010 +0100
+++ b/hedgewars/uConsts.pas Wed Nov 03 16:29:17 2010 +0100
@@ -339,7 +339,7 @@
gfLowGravity = $00000020;
gfLaserSight = $00000040;
gfInvulnerable = $00000080;
- gfMines = $00000100; // redundant? same effect as 'landadds 0'
+ gfResetHealth = $00000100;
gfVampiric = $00000200;
gfKarma = $00000400;
gfArtillery = $00000800;
diff -r 40df542b5f62 -r af612377fcba hedgewars/uGears.pas
--- a/hedgewars/uGears.pas Wed Nov 03 00:48:42 2010 +0100
+++ b/hedgewars/uGears.pas Wed Nov 03 16:29:17 2010 +0100
@@ -935,20 +935,30 @@
cArtillery:= false;
// have to sweep *all* current team hedgehogs since it is theoretically possible if you have enough invulnerabilities and switch turns to make your entire team invulnerable
if (CurrentTeam <> nil) then
- with CurrentTeam^ do
- for i:= 0 to cMaxHHIndex do
- with Hedgehogs[i] do
- begin
- if (SpeechGear <> nil) then
- begin
- DeleteVisualGear(SpeechGear); // remove to restore persisting beyond end of turn. Tiy says was too much of a gameplay issue
- SpeechGear:= nil
- end;
+ with CurrentTeam^ do
+ for i:= 0 to cMaxHHIndex do
+ with Hedgehogs[i] do
+ begin
+ if (SpeechGear <> nil) then
+ begin
+ DeleteVisualGear(SpeechGear); // remove to restore persisting beyond end of turn. Tiy says was too much of a gameplay issue
+ SpeechGear:= nil
+ end;
- if (Gear <> nil) then
- if (GameFlags and gfInvulnerable) = 0 then
- Gear^.Invulnerable:= false;
- end;
+ if (Gear <> nil) then
+ begin
+ if (GameFlags and gfInvulnerable) = 0 then
+ Gear^.Invulnerable:= false;
+ if (GameFlags and gfResetHealth) <> 0 then
+ begin
+ if Gear^.Health < InitialHealth then
+ begin
+ Gear^.Health:= InitialHealth;
+ RenderHealth(CurrentHedgehog^);
+ end;
+ end;
+ end;
+ end;
t:= GearsList;
while t <> nil do
begin
@@ -957,7 +967,9 @@
end;
if (GameFlags and gfResetWeps) <> 0 then
- ResetWeapons
+ ResetWeapons;
+ if (GameFlags and gfResetHealth) <> 0 then
+ RecountTeamHealth(CurrentTeam);
end;
procedure ApplyDamage(Gear: PGear; Damage: Longword; Source: TDamageSource);
@@ -1203,12 +1215,11 @@
if ((GameFlags and gfForts) = 0) then
begin
- if ((GameFlags and gfMines) <> 0) then
- for i:= 0 to Pred(cLandMines) do
- begin
- Gear:= AddGear(0, 0, gtMine, 0, _0, _0, 0);
- FindPlace(Gear, false, 0, LAND_WIDTH);
- end;
+ for i:= 0 to Pred(cLandMines) do
+ begin
+ Gear:= AddGear(0, 0, gtMine, 0, _0, _0, 0);
+ FindPlace(Gear, false, 0, LAND_WIDTH);
+ end;
for i:= 0 to Pred(cExplosives) do
begin
Gear:= AddGear(0, 0, gtExplosives, 0, _0, _0, 0);
diff -r 40df542b5f62 -r af612377fcba hedgewars/uTeams.pas
--- a/hedgewars/uTeams.pas Wed Nov 03 00:48:42 2010 +0100
+++ b/hedgewars/uTeams.pas Wed Nov 03 16:29:17 2010 +0100
@@ -47,6 +47,7 @@
HatVisibility: GLfloat;
stats: TStatistics;
Hat: shortstring;
+ InitialHealth: Byte; // used for gfResetHealth
King: boolean; // Flag for a bunch of hedgehog attributes
Unplaced: boolean; // Flag for hog placing mode
Timer: Longword;