Mode to place hogs at start of game. Will probably need a bit more testing.
--- a/QTfrontend/ammoSchemeModel.cpp Fri Feb 05 13:47:25 2010 +0000
+++ b/QTfrontend/ammoSchemeModel.cpp Mon Feb 08 03:03:18 2010 +0000
@@ -37,13 +37,14 @@
<< QVariant(false) // artillery 11
<< QVariant(true) // random order 12
<< QVariant(false) // king 13
- << QVariant(100) // damage modfier 14
- << QVariant(45) // turn time 15
- << QVariant(100) // init health 16
- << QVariant(15) // sudden death 17
- << QVariant(5) // case prob 18
- << QVariant(3) // mines time 19
- << QVariant(4) // landadds 20
+ << QVariant(false) // place hog 14
+ << QVariant(100) // damage modfier 15
+ << QVariant(45) // turn time 16
+ << QVariant(100) // init health 17
+ << QVariant(15) // sudden death 18
+ << QVariant(5) // case prob 19
+ << QVariant(3) // mines time 20
+ << QVariant(4) // landadds 21
;
AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) :
@@ -74,13 +75,14 @@
<< "artillery" // 11
<< "randomorder" // 12
<< "king" // 13
- << "damagefactor" // 14
- << "turntime" // 15
- << "health" // 16
- << "suddendeath" // 17
- << "caseprobability" // 18
- << "minestime" // 19
- << "landadds" // 20
+ << "placehog" // 14
+ << "damagefactor" // 15
+ << "turntime" // 16
+ << "health" // 17
+ << "suddendeath" // 18
+ << "caseprobability" // 19
+ << "minestime" // 20
+ << "landadds" // 21
;
QList<QVariant> proMode;
@@ -99,13 +101,14 @@
<< QVariant(false) // artillery 11
<< QVariant(true) // random order 12
<< QVariant(false) // king 13
- << QVariant(100) // damage modfier 14
- << QVariant(15) // turn time 15
- << QVariant(100) // init health 16
- << QVariant(15) // sudden death 17
- << QVariant(0) // case prob 18
- << QVariant(3) // mines time 19
- << QVariant(4) // landadds 20
+ << QVariant(false) // place hog 14
+ << QVariant(100) // damage modfier 15
+ << QVariant(15) // turn time 16
+ << QVariant(100) // init health 17
+ << QVariant(15) // sudden death 18
+ << QVariant(0) // case prob 19
+ << QVariant(3) // mines time 20
+ << QVariant(4) // landadds 21
;
QList<QVariant> shoppa;
@@ -124,13 +127,14 @@
<< QVariant(false) // artillery 11
<< QVariant(true) // random order 12
<< QVariant(false) // king 13
- << QVariant(100) // damage modfier 14
- << QVariant(30) // turn time 15
- << QVariant(100) // init health 16
- << QVariant(50) // sudden death 17
- << QVariant(1) // case prob 18
- << QVariant(3) // mines time 19
- << QVariant(4) // landadds 20
+ << QVariant(false) // place hog 14
+ << QVariant(100) // damage modfier 15
+ << QVariant(30) // turn time 16
+ << QVariant(100) // init health 17
+ << QVariant(50) // sudden death 18
+ << QVariant(1) // case prob 19
+ << QVariant(3) // mines time 20
+ << QVariant(4) // landadds 21
;
QList<QVariant> basketball;
@@ -149,13 +153,14 @@
<< QVariant(false) // artillery 11
<< QVariant(true) // random order 12
<< QVariant(false) // king 13
- << QVariant(100) // damage modfier 14
- << QVariant(30) // turn time 15
- << QVariant(100) // init health 16
- << QVariant(15) // sudden death 17
- << QVariant(0) // case prob 18
- << QVariant(3) // mines time 19
- << QVariant(4) // landadds 20
+ << QVariant(false) // place hog 14
+ << QVariant(100) // damage modfier 15
+ << QVariant(30) // turn time 16
+ << QVariant(100) // init health 17
+ << QVariant(15) // sudden death 18
+ << QVariant(0) // case prob 19
+ << QVariant(3) // mines time 20
+ << QVariant(4) // landadds 21
;
QList<QVariant> minefield;
@@ -174,13 +179,14 @@
<< QVariant(false) // artillery 11
<< QVariant(true) // random order 12
<< QVariant(false) // king 13
- << QVariant(150) // damage modfier 14
- << QVariant(30) // turn time 15
- << QVariant(50) // init health 16
- << QVariant(15) // sudden death 17
- << QVariant(0) // case prob 18
- << QVariant(0) // mines time 19
- << QVariant(50) // landadds 20
+ << QVariant(false) // place hog 14
+ << QVariant(150) // damage modfier 15
+ << QVariant(30) // turn time 16
+ << QVariant(50) // init health 17
+ << QVariant(15) // sudden death 18
+ << QVariant(0) // case prob 19
+ << QVariant(0) // mines time 20
+ << QVariant(50) // landadds 21
;
schemes.append(defaultScheme);
--- a/QTfrontend/gamecfgwidget.cpp Fri Feb 05 13:47:25 2010 +0000
+++ b/QTfrontend/gamecfgwidget.cpp Mon Feb 08 03:03:18 2010 +0000
@@ -124,13 +124,15 @@
result |= 0x2000;
if (schemeData(13).toBool())
result |= 0x4000;
+ if (schemeData(14).toBool())
+ result |= 0x8000;
return result;
}
quint32 GameCFGWidget::getInitHealth() const
{
- return schemeData(16).toInt();
+ return schemeData(17).toInt();
}
QStringList GameCFGWidget::getFullConfig() const
@@ -138,12 +140,12 @@
QStringList sl;
sl.append("eseed " + pMapContainer->getCurrentSeed());
sl.append(QString("e$gmflags %1").arg(getGameFlags()));
- sl.append(QString("e$damagepct %1").arg(schemeData(14).toInt()));
- sl.append(QString("e$turntime %1").arg(schemeData(15).toInt() * 1000));
- sl.append(QString("e$minestime %1").arg(schemeData(19).toInt() * 1000));
- sl.append(QString("e$landadds %1").arg(schemeData(20).toInt()));
- sl.append(QString("e$sd_turns %1").arg(schemeData(17).toInt()));
- sl.append(QString("e$casefreq %1").arg(schemeData(18).toInt()));
+ sl.append(QString("e$damagepct %1").arg(schemeData(15).toInt()));
+ sl.append(QString("e$turntime %1").arg(schemeData(16).toInt() * 1000));
+ sl.append(QString("e$minestime %1").arg(schemeData(20).toInt() * 1000));
+ sl.append(QString("e$landadds %1").arg(schemeData(21).toInt()));
+ sl.append(QString("e$sd_turns %1").arg(schemeData(18).toInt()));
+ sl.append(QString("e$casefreq %1").arg(schemeData(19).toInt()));
sl.append(QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter()));
QString currentMap = pMapContainer->getCurrentMap();
--- a/QTfrontend/hedgewars.qrc Fri Feb 05 13:47:25 2010 +0000
+++ b/QTfrontend/hedgewars.qrc Mon Feb 08 03:03:18 2010 +0000
@@ -59,6 +59,7 @@
<file>res/btnArtillery.png</file>
<file>res/btnRandomOrder.png</file>
<file>res/btnKing.png</file>
+ <file>res/btnPlaceHog.png</file>
<file>res/iconBox.png</file>
<file>res/iconHealth.png</file>
<file>res/iconSuddenDeath.png</file>
--- a/QTfrontend/pages.cpp Fri Feb 05 13:47:25 2010 +0000
+++ b/QTfrontend/pages.cpp Mon Feb 08 03:03:18 2010 +0000
@@ -1087,6 +1087,11 @@
TBW_king->setToolTip(tr("Play with a King. If he dies, your side dies."));
glGMLayout->addWidget(TBW_king,3,0,1,1);
+ TBW_placehog = new ToggleButtonWidget(gbGameModes, ":/res/btnPlaceHog.png");
+ TBW_placehog->setText(ToggleButtonWidget::tr("Place Hedgehogs"));
+ TBW_placehog->setToolTip(tr("Take turns placing your hedgehogs before the start of play."));
+ glGMLayout->addWidget(TBW_placehog,3,1,1,1);
+
// Right
QLabel * l;
@@ -1236,13 +1241,14 @@
mapper->addMapping(TBW_artillery->button(), 11);
mapper->addMapping(TBW_randomorder->button(), 12);
mapper->addMapping(TBW_king->button(), 13);
- mapper->addMapping(SB_DamageModifier, 14);
- mapper->addMapping(SB_TurnTime, 15);
- mapper->addMapping(SB_InitHealth, 16);
- mapper->addMapping(SB_SuddenDeath, 17);
- mapper->addMapping(SB_CaseProb, 18);
- mapper->addMapping(SB_MinesTime, 19);
- mapper->addMapping(SB_Mines, 20);
+ mapper->addMapping(TBW_placehog->button(), 14);
+ mapper->addMapping(SB_DamageModifier, 15);
+ mapper->addMapping(SB_TurnTime, 16);
+ mapper->addMapping(SB_InitHealth, 17);
+ mapper->addMapping(SB_SuddenDeath, 18);
+ mapper->addMapping(SB_CaseProb, 19);
+ mapper->addMapping(SB_MinesTime, 20);
+ mapper->addMapping(SB_Mines, 21);
mapper->toFirst();
}
--- a/QTfrontend/pages.h Fri Feb 05 13:47:25 2010 +0000
+++ b/QTfrontend/pages.h Mon Feb 08 03:03:18 2010 +0000
@@ -437,6 +437,7 @@
ToggleButtonWidget * TBW_artillery;
ToggleButtonWidget * TBW_randomorder;
ToggleButtonWidget * TBW_king;
+ ToggleButtonWidget * TBW_placehog;
QSpinBox * SB_DamageModifier;
QSpinBox * SB_TurnTime;
Binary file QTfrontend/res/btnPlaceHog.png has changed
--- a/hedgewars/GSHandlers.inc Fri Feb 05 13:47:25 2010 +0000
+++ b/hedgewars/GSHandlers.inc Mon Feb 08 03:03:18 2010 +0000
@@ -1643,6 +1643,7 @@
procedure doStepTeleportAfter(Gear: PGear);
var HHGear: PGear;
begin
+PHedgehog(Gear^.Hedgehog)^.Unplaced:= false;
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
HHGear^.Y:= HHGear^.Y + HHGear^.dY; // hedgehog falling to collect cases
HHGear^.dY:= HHGear^.dY + cGravity;
--- a/hedgewars/HHHandlers.inc Fri Feb 05 13:47:25 2010 +0000
+++ b/hedgewars/HHHandlers.inc Mon Feb 08 03:03:18 2010 +0000
@@ -480,6 +480,13 @@
procedure doStepHedgehogMoving(Gear: PGear);
var isFalling: boolean;
begin
+if PHedgehog(Gear^.Hedgehog)^.Unplaced then
+ begin
+ Gear^.dY:= _0;
+ Gear^.dX:= _0;
+ Gear^.State:= Gear^.State and not gstMoving;
+ exit
+ end;
isFalling:= (Gear^.dY.isNegative) or not TestCollisionYKick(Gear, 1);
if isFalling then
begin
--- a/hedgewars/uAmmos.pas Fri Feb 05 13:47:25 2010 +0000
+++ b/hedgewars/uAmmos.pas Mon Feb 08 03:03:18 2010 +0000
@@ -36,6 +36,7 @@
procedure SwitchNotHeldAmmo(var Hedgehog: THedgehog);
procedure SetWeapon(weap: TAmmoType);
procedure DisableSomeWeapons;
+procedure ResetWeapons;
var shoppa: boolean;
@@ -57,7 +58,12 @@
begin
TryDo(mi[Ammoz[a].Slot] <= cMaxSlotAmmoIndex, 'Ammo slot overflow', true);
Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo;
+
Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= cnts[a];
+ Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].InitialCount:= cnts[a];
+
+ if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then
+ Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= AMMO_INFINITE;
inc(mi[Ammoz[a].Slot])
end
end;
@@ -110,6 +116,10 @@
if ((GameFlags and gfKing) <> 0) and (Ammoz[a].SkipTurns = 0) and (a <> amTeleport) and (a <> amSkip) then
Ammoz[a].SkipTurns:= 1;
+
+ if ((GameFlags and gfPlaceHog) <> 0) and
+ (a <> amTeleport) and (a <> amSkip) and
+ (Ammoz[a].SkipTurns < 10000) then inc(Ammoz[a].SkipTurns,10000)
end else
ammos[a]:= AMMO_INFINITE
end;
@@ -323,6 +333,24 @@
if (Ammoz[t].Ammo.Propz and ammoprop_NotBorder) <> 0 then Ammoz[t].Probability:= 0
end;
+// Restore indefinitely disabled weapons and initial weapon counts. Only used for hog placement right now
+procedure ResetWeapons;
+var i, slot, a: Longword;
+ t: TAmmoType;
+begin
+for i:= 0 to Pred(StoreCnt) do
+ for slot:= 0 to cMaxSlotIndex do
+ begin
+ for a:= 0 to cMaxSlotAmmoIndex do
+ with StoresList[i]^[slot, a] do
+ if Count <> InitialCount then Count:= InitialCount;
+
+ PackAmmo(StoresList[i], slot)
+ end;
+for t:= Low(TAmmoType) to High(TAmmoType) do
+ if Ammoz[t].SkipTurns >= 10000 then dec(Ammoz[t].SkipTurns,10000);
+end;
+
procedure init_uAmmos;
begin
shoppa:= false;
--- a/hedgewars/uConsts.pas Fri Feb 05 13:47:25 2010 +0000
+++ b/hedgewars/uConsts.pas Mon Feb 08 03:03:18 2010 +0000
@@ -137,6 +137,9 @@
TAmmo = record
Propz: LongWord;
Count: LongWord;
+(* Using for place hedgehogs mode, but for any other situation where the initial count would be needed I guess.
+For example, say, a mode where the weaponset is reset each turn, or on sudden death *)
+ InitialCount: LongWord;
NumPerTurn: LongWord;
Timer: LongWord;
Pos: LongWord;
@@ -302,6 +305,7 @@
gfOneClanMode = $00001000;
gfRandomOrder = $00002000;
gfKing = $00004000;
+ gfPlaceHog = $00008000;
gstDrowning = $00000001;
gstHHDriven = $00000002;
@@ -770,6 +774,7 @@
NumberInCase: 0;
Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold or ammoprop_Utility;
Count: AMMO_INFINITE;
+ InitialCount: AMMO_INFINITE;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -789,6 +794,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse;
Count: AMMO_INFINITE;
+ InitialCount: AMMO_INFINITE;
NumPerTurn: 0;
Timer: 3000;
Pos: 0;
@@ -808,6 +814,7 @@
NumberInCase: 3;
Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse;
Count: 5;
+ InitialCount: 5;
NumPerTurn: 0;
Timer: 3000;
Pos: 0;
@@ -827,6 +834,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_Power or ammoprop_AltUse;
Count: AMMO_INFINITE;
+ InitialCount: AMMO_INFINITE;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -846,6 +854,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_Power or ammoprop_NeedTarget or ammoprop_DontHold;
Count: 2;
+ InitialCount: 2;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -865,6 +874,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_ForwMsgs;
Count: AMMO_INFINITE;
+ InitialCount: AMMO_INFINITE;
NumPerTurn: 1;
Timer: 0;
Pos: 0;
@@ -884,6 +894,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInMove or ammoprop_NoCrosshair or ammoprop_DontHold;
Count: 2;
+ InitialCount: 2;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -903,6 +914,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold;
Count: AMMO_INFINITE;
+ InitialCount: AMMO_INFINITE;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -925,6 +937,7 @@
ammoprop_AttackInMove or
ammoprop_AltAttack;
Count: 5;
+ InitialCount: 5;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -944,6 +957,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInMove or ammoprop_DontHold or ammoprop_AltUse;
Count: 2;
+ InitialCount: 2;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -963,6 +977,7 @@
NumberInCase: 2;
Ammo: (Propz: 0;
Count: 3;
+ InitialCount: 3;
NumPerTurn: 3;
Timer: 0;
Pos: 0;
@@ -982,6 +997,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInMove or ammoprop_DontHold or ammoprop_AltUse;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1001,6 +1017,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_ForwMsgs or ammoprop_AttackInMove;
Count: AMMO_INFINITE;
+ InitialCount: AMMO_INFINITE;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1020,6 +1037,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_NoCrosshair;
Count: AMMO_INFINITE;
+ InitialCount: AMMO_INFINITE;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1039,6 +1057,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_DontHold;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1063,6 +1082,7 @@
ammoprop_DontHold or
ammoprop_AltAttack;
Count: 2;
+ InitialCount: 2;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1086,6 +1106,7 @@
ammoprop_DontHold or
ammoprop_NotBorder;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1109,6 +1130,7 @@
ammoprop_DontHold or
ammoprop_NotBorder;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1128,6 +1150,7 @@
NumberInCase: 2;
Ammo: (Propz: ammoprop_ForwMsgs;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1150,6 +1173,7 @@
ammoprop_NeedTarget or
ammoprop_AttackingPut;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1173,6 +1197,7 @@
ammoprop_AttackingPut or
ammoprop_DontHold;
Count: 2;
+ InitialCount: 2;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1195,6 +1220,7 @@
ammoprop_NoCrosshair or
ammoprop_DontHold;
Count: 3;
+ InitialCount: 3;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1214,6 +1240,7 @@
NumberInCase: 4;
Ammo: (Propz: 0;
Count: 4;
+ InitialCount: 4;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1233,6 +1260,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold or ammoprop_AttackInMove;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1252,6 +1280,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_NoCrosshair or ammoprop_DontHold;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1271,6 +1300,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1290,6 +1320,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse;
Count: 0;
+ InitialCount: 0;
NumPerTurn: 0;
Timer: 3000;
Pos: 0;
@@ -1309,6 +1340,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_Power or ammoprop_AltUse;
Count: 0;
+ InitialCount: 0;
NumPerTurn: 0;
Timer: 5000;
Pos: 0;
@@ -1332,6 +1364,7 @@
ammoprop_DontHold or
ammoprop_NotBorder;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1351,6 +1384,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_Power or ammoprop_AltUse;
Count: AMMO_INFINITE;
+ InitialCount: AMMO_INFINITE;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1370,6 +1404,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold;
Count: AMMO_INFINITE;
+ InitialCount: AMMO_INFINITE;
NumPerTurn: 0;
Timer: 5001;
Pos: 0;
@@ -1391,6 +1426,7 @@
ammoprop_DontHold or
ammoprop_AltAttack};
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1414,6 +1450,7 @@
ammoprop_AltUse or
ammoprop_Utility;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1437,6 +1474,7 @@
ammoprop_AltUse or
ammoprop_Utility;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1460,6 +1498,7 @@
ammoprop_AltUse or
ammoprop_Utility;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1483,6 +1522,7 @@
ammoprop_AltUse or
ammoprop_Utility;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1506,6 +1546,7 @@
ammoprop_AltUse or
ammoprop_Utility;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1529,6 +1570,7 @@
ammoprop_AltUse or
ammoprop_Utility;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 0;
Timer: 0;
Pos: 0;
@@ -1548,6 +1590,7 @@
NumberInCase: 2;
Ammo: (Propz: 0;
Count: 2;
+ InitialCount: 2;
NumPerTurn: 1;
Timer: 0;
Pos: 0;
@@ -1572,6 +1615,7 @@
ammoprop_DontHold or
ammoprop_AltAttack;
Count: 1;
+ InitialCount: 1;
NumPerTurn: 1;
Timer: 0;
Pos: 0;
@@ -1591,6 +1635,7 @@
NumberInCase: 1;
Ammo: (Propz: ammoprop_Power or ammoprop_AltUse;
Count: AMMO_INFINITE;
+ InitialCount: AMMO_INFINITE;
NumPerTurn: 0;
Timer: 3000;
Pos: 0;
--- a/hedgewars/uGears.pas Fri Feb 05 13:47:25 2010 +0000
+++ b/hedgewars/uGears.pas Mon Feb 08 03:03:18 2010 +0000
@@ -70,6 +70,7 @@
SpeechText: shortstring;
TrainingTargetGear: PGear;
skipFlag: boolean;
+ PlacingHogs: boolean; // a convenience flag to indicate placement of hogs is still in progress
procedure init_uGears;
procedure free_uGears;
@@ -86,6 +87,7 @@
procedure InsertGearToList(Gear: PGear);
procedure RemoveGearFromList(Gear: PGear);
function ModifyDamage(dmg: Longword; Gear: PGear): Longword;
+procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt);
implementation
uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uLand, uIO, uLandGraphics,
@@ -115,7 +117,6 @@
function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; forward;
procedure SpawnBoxOfSmth; forward;
procedure AfterAttack; forward;
-procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt); forward;
procedure HedgehogStep(Gear: PGear); forward;
procedure doStepHedgehogMoving(Gear: PGear); forward;
procedure HedgehogChAngle(Gear: PGear); forward;
@@ -632,7 +633,7 @@
else begin
bBetweenTurns:= true;
HealthMachine;
- SuddenDeathDmg:= true;
+ SuddenDeathDmg:= true;
step:= stChDmg
end
end;
@@ -814,6 +815,7 @@
defaultPos, HatVisible: boolean;
VertexBuffer: array [0..1] of TVertex2f;
begin
+if PHedgehog(Gear^.Hedgehog)^.Unplaced then exit;
m:= 1;
if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then m:= -1;
if (Gear^.State and gstHHDeath) <> 0 then
@@ -1522,7 +1524,7 @@
gtAirBomb: DrawRotated(sprAirBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
gtTeleport: begin
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
- DrawRotatedF(sprTeleport, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, Gear^.Pos, hwSign(HHGear^.dX), 0);
+ if not PHedgehog(Gear^.Hedgehog)^.Unplaced then DrawRotatedF(sprTeleport, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, Gear^.Pos, hwSign(HHGear^.dX), 0);
DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0);
end;
gtSwitcher: DrawSprite(sprSwitch, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 56 + WorldDy, (GameTicks shr 6) mod 12);
@@ -1785,7 +1787,7 @@
with Hedgehogs[i] do
if (Gear <> nil) and (Gear^.X.QWordValue = 0) then
begin
- FindPlace(Gear, false, t, t + LAND_WIDTH div 2);// could make Gear == nil
+ FindPlace(Gear, false, t, t + LAND_WIDTH div 2);// could make Gear == nil
if Gear <> nil then
begin
Gear^.Pos:= GetRandom(49);
@@ -1796,6 +1798,7 @@
end
end else // mix hedgehogs
begin
+ if (GameFlags and gfPlaceHog) <> 0 then PlacingHogs:= true;
Count:= 0;
for p:= 0 to Pred(TeamsCount) do
with TeamsArray[p]^ do
@@ -1815,7 +1818,8 @@
while (Count > 0) do
begin
i:= GetRandom(Count);
- FindPlace(ar[i]^.Gear, false, 0, LAND_WIDTH);
+ if PlacingHogs then ar[i]^.Unplaced:= true
+ else FindPlace(ar[i]^.Gear, false, 0, LAND_WIDTH);
if ar[i]^.Gear <> nil then
begin
ar[i]^.Gear^.dX.isNegative:= hwRound(ar[i]^.Gear^.X) > LAND_WIDTH div 2;
@@ -1899,7 +1903,8 @@
var t: LongInt;
i: TAmmoType;
begin
-if (cCaseFactor = 0) or
+if (PlacingHogs) or
+ (cCaseFactor = 0) or
(CountGears(gtCase) >= 5) or
(getrandom(cCaseFactor) <> 0) then exit;
--- a/hedgewars/uTeams.pas Fri Feb 05 13:47:25 2010 +0000
+++ b/hedgewars/uTeams.pas Mon Feb 08 03:03:18 2010 +0000
@@ -20,7 +20,7 @@
unit uTeams;
interface
-uses SDLh, uConsts, uKeys, uGears, uRandom, uFloat, uStats, uVisualGears,
+uses SDLh, uConsts, uKeys, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions,
{$IFDEF GLES11}
gles11,
{$ELSE}
@@ -53,6 +53,7 @@
stats: TStatistics;
Hat: String;
King: boolean; // Flag for a bunch of hedgehog attributes
+ Unplaced: boolean; // Flag for hog placing mode
end;
TTeam = record
@@ -168,9 +169,22 @@
begin
TargetPoint.X:= NoPointX;
TryDo(CurrentTeam <> nil, 'nil Team', true);
+with CurrentHedgehog^ do
+ if (PreviousTeam <> nil) and PlacingHogs and Unplaced then
+ begin
+ Unplaced:= false;
+ if Gear <> nil then
+ begin
+ Gear^.CollisionIndex:= -1;
+ FindPlace(Gear, false, 0, LAND_WIDTH);
+ if Gear <> nil then AddGearCI(Gear)
+ end
+ end;
+
PreviousTeam:= CurrentTeam;
with CurrentHedgehog^ do
+ begin
if Gear <> nil then
begin
MultiShootAttacks:= 0;
@@ -178,14 +192,15 @@
Gear^.Z:= cHHZ;
RemoveGearFromList(Gear);
InsertGearToList(Gear)
- end;
+ end
+ end;
c:= CurrentTeam^.Clan^.ClanIndex;
repeat
inc(c);
if c = ClansCount then
begin
- inc(TotalRounds);
+ if not PlacingHogs then inc(TotalRounds);
c:= 0
end;
@@ -211,7 +226,24 @@
procedure AfterSwitchHedgehog;
var g: PGear;
+ i, t: LongInt;
begin
+if PlacingHogs then
+ begin
+ PlacingHogs:= false;
+ for t:= 0 to Pred(TeamsCount) do
+ for i:= 0 to cMaxHHIndex do
+ if (TeamsArray[t]^.Hedgehogs[i].Gear <> nil) and (TeamsArray[t]^.Hedgehogs[i].Unplaced) then
+ PlacingHogs:= true;
+
+ if not PlacingHogs then // Reset various things I mucked with
+ begin
+ for i:= 0 to ClansCount do
+ if ClansArray[i] <> nil then ClansArray[i]^.TurnNumber:= 0;
+ ResetWeapons
+ end
+ end;
+
inc(CurrentTeam^.Clan^.TurnNumber);
SwitchNotHeldAmmo(CurrentHedgehog^);
@@ -248,7 +280,12 @@
else
PlaySound(sndYesSir, CurrentTeam^.voicepack);
-TurnTimeLeft:= cHedgehogTurnTime
+if PlacingHogs then
+ begin
+ if CurrentHedgehog^.Unplaced then TurnTimeLeft:= 10000
+ else TurnTimeLeft:= 0
+ end
+else TurnTimeLeft:= cHedgehogTurnTime
end;
function AddTeam(TeamColor: Longword): PTeam;
--- a/hedgewars/uWorld.pas Fri Feb 05 13:47:25 2010 +0000
+++ b/hedgewars/uWorld.pas Mon Feb 08 03:03:18 2010 +0000
@@ -167,7 +167,6 @@
DrawSprite(sprTurnsLeft, x + g * 33 + 51, y + 17, l);
end else
DrawSprite(sprAMAmmos, x + g * 33 + 35, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
-
if (Slot = i)
and (CursorPoint.X >= x + g * 33 + 35)
and (CursorPoint.X < x + g * 33 + 68) then
@@ -701,7 +700,7 @@
CursorPoint.Y:= cScreenHeight - CursorPoint.Y;
end;
-if (FollowGear <> nil) and (not isCursorVisible) and (not fastUntilLag) then
+if (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not fastUntilLag) then
if abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y) > 4 then
begin
FollowGear:= nil;