--- a/QTfrontend/ammoSchemeModel.cpp Sun Mar 15 14:47:59 2009 +0000
+++ b/QTfrontend/ammoSchemeModel.cpp Sun Mar 15 17:47:06 2009 +0000
@@ -24,15 +24,20 @@
QAbstractTableModel(parent)
{
defaultScheme
- << QVariant(tr("Default")) // name 0
- << QVariant(false) // fortsmode 1
- << QVariant(false) // team divide 2
- << QVariant(false) // solid land 3
- << QVariant(false) // border 4
- << QVariant(45) // turn time 5
- << QVariant(100) // init health 6
- << QVariant(15) // sudden death 7
- << QVariant(5) // case prob 8
+ << QVariant(tr("Default")) // name 0
+ << QVariant(false) // fortsmode 1
+ << QVariant(false) // team divide 2
+ << QVariant(false) // solid land 3
+ << QVariant(false) // border 4
+ << QVariant(false) // low gravity 5
+ << QVariant(false) // laser sight 6
+ << QVariant(false) // invulnerable 7
+ << QVariant(true) // add mines 8
+ << QVariant(100) // damage modfier 9
+ << QVariant(45) // turn time 10
+ << QVariant(100) // init health 11
+ << QVariant(15) // sudden death 12
+ << QVariant(5) // case prob 13
;
schemes.append(defaultScheme);
--- a/QTfrontend/gamecfgwidget.cpp Sun Mar 15 14:47:59 2009 +0000
+++ b/QTfrontend/gamecfgwidget.cpp Sun Mar 15 17:47:06 2009 +0000
@@ -84,13 +84,21 @@
result |= 0x04;
if (schemeData(4).toBool())
result |= 0x08;
+ if (schemeData(5).toBool())
+ result |= 0x20;
+ if (schemeData(6).toBool())
+ result |= 0x40;
+ if (schemeData(7).toBool())
+ result |= 0x80;
+ if (schemeData(8).toBool())
+ result |= 0x100;
return result;
}
quint32 GameCFGWidget::getInitHealth() const
{
- return schemeData(6).toInt();
+ return schemeData(11).toInt();
}
QStringList GameCFGWidget::getFullConfig() const
@@ -98,9 +106,10 @@
QStringList sl;
sl.append("eseed " + pMapContainer->getCurrentSeed());
sl.append(QString("e$gmflags %1").arg(getGameFlags()));
- sl.append(QString("e$turntime %1").arg(schemeData(5).toInt() * 1000));
- sl.append(QString("e$sd_turns %1").arg(schemeData(7).toInt()));
- sl.append(QString("e$casefreq %1").arg(schemeData(8).toInt()));
+ sl.append(QString("e$damagepct %1").arg(schemeData(9).toInt()));
+ sl.append(QString("e$turntime %1").arg(schemeData(10).toInt() * 1000));
+ sl.append(QString("e$sd_turns %1").arg(schemeData(12).toInt()));
+ sl.append(QString("e$casefreq %1").arg(schemeData(13).toInt()));
sl.append(QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter()));
QString currentMap = pMapContainer->getCurrentMap();
--- a/QTfrontend/hwform.cpp Sun Mar 15 14:47:59 2009 +0000
+++ b/QTfrontend/hwform.cpp Sun Mar 15 17:47:06 2009 +0000
@@ -317,7 +317,7 @@
if (editedTeam) {
curTeamSelWidget->addTeam(*editedTeam);
}
- } else if(lastid != ID_PAGE_GAMESTATS && lastid != ID_PAGE_INGAME) {
+ } else if(lastid != ID_PAGE_GAMESTATS && lastid != ID_PAGE_INGAME && lastid != ID_PAGE_SCHEME) {
curTeamSelWidget->resetPlayingTeams(teamsList);
}
} else
--- a/QTfrontend/pages.cpp Sun Mar 15 14:47:59 2009 +0000
+++ b/QTfrontend/pages.cpp Sun Mar 15 17:47:06 2009 +0000
@@ -873,6 +873,27 @@
CB_border->setText(QCheckBox::tr("Add Border"));
pageLayout->addWidget(CB_border, 3, 0, 1, 2);
+ CB_lowGravity = new QCheckBox(this);
+ CB_lowGravity->setText(QCheckBox::tr("Low Gravity"));
+ pageLayout->addWidget(CB_lowGravity, 4, 0, 1, 2);
+
+ CB_laserSight = new QCheckBox(this);
+ CB_laserSight->setText(QCheckBox::tr("Laser Sight"));
+ pageLayout->addWidget(CB_laserSight, 5, 0, 1, 2);
+
+ CB_invulnerable = new QCheckBox(this);
+ CB_invulnerable->setText(QCheckBox::tr("Invulnerable"));
+ pageLayout->addWidget(CB_invulnerable, 6, 0, 1, 2);
+
+ CB_mines = new QCheckBox(this);
+ CB_mines->setText(QCheckBox::tr("Add Mines"));
+ pageLayout->addWidget(CB_mines, 7, 0, 1, 2);
+
+ SB_DamageModifier = new QSpinBox(this);
+ SB_DamageModifier->setRange(10, 300);
+ SB_DamageModifier->setValue(100);
+ SB_DamageModifier->setSingleStep(25);
+
SB_TurnTime = new QSpinBox(this);
SB_TurnTime->setRange(1, 99);
SB_TurnTime->setValue(45);
@@ -894,19 +915,20 @@
LE_name = new QLineEdit(this);
- pageLayout->addWidget(SB_TurnTime, 4, 1);
- pageLayout->addWidget(SB_InitHealth, 5, 1);
- pageLayout->addWidget(SB_SuddenDeath, 6, 1);
- pageLayout->addWidget(SB_CaseProb, 7, 1);
- pageLayout->addWidget(LE_name, 8, 1);
+ pageLayout->addWidget(SB_DamageModifier, 8, 1);
+ pageLayout->addWidget(SB_TurnTime, 9, 1);
+ pageLayout->addWidget(SB_InitHealth, 10, 1);
+ pageLayout->addWidget(SB_SuddenDeath, 11, 1);
+ pageLayout->addWidget(SB_CaseProb, 12, 1);
+ pageLayout->addWidget(LE_name, 13, 1);
mapper = new QDataWidgetMapper(this);
- BtnBack = addButton(":/res/Exit.png", pageLayout, 10, 0, true);
- BtnNew = addButton(tr("New"), pageLayout, 10, 1);
- BtnPrev = addButton(tr("Prev"), pageLayout, 10, 2);
- BtnNext = addButton(tr("Next"), pageLayout, 10, 3);
- BtnSave = addButton(":/res/Save.png", pageLayout, 10, 4, true);
+ BtnBack = addButton(":/res/Exit.png", pageLayout, 15, 0, true);
+ BtnNew = addButton(tr("New"), pageLayout, 15, 1);
+ BtnPrev = addButton(tr("Prev"), pageLayout, 15, 2);
+ BtnNext = addButton(tr("Next"), pageLayout, 15, 3);
+ BtnSave = addButton(":/res/Save.png", pageLayout, 15, 4, true);
connect(BtnSave, SIGNAL(clicked()), mapper, SLOT(toFirst()));
connect(BtnNew, SIGNAL(clicked()), this, SLOT(newRow()));
@@ -923,10 +945,15 @@
mapper->addMapping(CB_teamsDivide, 2);
mapper->addMapping(CB_solid, 3);
mapper->addMapping(CB_border, 4);
- mapper->addMapping(SB_TurnTime, 5);
- mapper->addMapping(SB_InitHealth, 6);
- mapper->addMapping(SB_SuddenDeath, 7);
- mapper->addMapping(SB_CaseProb, 8);
+ mapper->addMapping(CB_lowGravity, 5);
+ mapper->addMapping(CB_laserSight, 6);
+ mapper->addMapping(CB_invulnerable, 7);
+ mapper->addMapping(CB_mines, 8);
+ mapper->addMapping(SB_DamageModifier, 9);
+ mapper->addMapping(SB_TurnTime, 10);
+ mapper->addMapping(SB_InitHealth, 11);
+ mapper->addMapping(SB_SuddenDeath, 12);
+ mapper->addMapping(SB_CaseProb, 13);
mapper->toFirst();
}
--- a/QTfrontend/pages.h Sun Mar 15 14:47:59 2009 +0000
+++ b/QTfrontend/pages.h Sun Mar 15 17:47:06 2009 +0000
@@ -421,6 +421,12 @@
QCheckBox * CB_teamsDivide;
QCheckBox * CB_solid;
QCheckBox * CB_border;
+ QCheckBox * CB_lowGravity;
+ QCheckBox * CB_laserSight;
+ QCheckBox * CB_invulnerable;
+ QCheckBox * CB_mines;
+
+ QSpinBox * SB_DamageModifier;
QSpinBox * SB_TurnTime;
QSpinBox * SB_InitHealth;
QSpinBox * SB_SuddenDeath;
--- a/hedgewars/uAmmos.pas Sun Mar 15 14:47:59 2009 +0000
+++ b/hedgewars/uAmmos.pas Sun Mar 15 17:47:06 2009 +0000
@@ -74,6 +74,13 @@
cnt:= AMMO_INFINITE;
Ammoz[a].Probability:= 0
end;
+ if ((a = amLowGravity) and ((GameFlags and gfLowGravity) <> 0)) or
+ ((a = amInvulnerable) and ((GameFlags and gfInvulnerable) <> 0)) or
+ ((a = amLaserSight) and ((GameFlags and gfLaserSight) <> 0)) then
+ begin
+ cnt:= 0;
+ Ammoz[a].Probability:= 0
+ end;
ammos[a]:= cnt
end;
--- a/hedgewars/uConsole.pas Sun Mar 15 14:47:59 2009 +0000
+++ b/hedgewars/uConsole.pas Sun Mar 15 17:47:06 2009 +0000
@@ -241,6 +241,7 @@
RegisterVariable('delay' , vtLongInt, @cInactDelay , false);
RegisterVariable('casefreq', vtLongInt, @cCaseFactor , false);
RegisterVariable('sd_turns', vtLongInt, @cSuddenDTurns , false);
+RegisterVariable('damagepct', vtLongInt, @cDamagePercent, false);
RegisterVariable('landadds', vtLongInt, @cLandAdditions , false);
RegisterVariable('gmflags' , vtLongInt, @GameFlags , false);
RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false);
--- a/hedgewars/uConsts.pas Sun Mar 15 14:47:59 2009 +0000
+++ b/hedgewars/uConsts.pas Sun Mar 15 17:47:06 2009 +0000
@@ -179,12 +179,16 @@
cMaxCaptions = 4;
- gfForts = $00000001;
- gfMultiWeapon = $00000002;
- gfSolidLand = $00000004;
- gfBorder = $00000008;
- gfDivideTeams = $00000010;
- gfOneClanMode = $10000000;
+ gfForts = $00000001;
+ gfMultiWeapon = $00000002;
+ gfSolidLand = $00000004;
+ gfBorder = $00000008;
+ gfDivideTeams = $00000010;
+ gfLowGravity = $00000020;
+ gfLaserSight = $00000040;
+ gfInvulnerable = $00000080;
+ gfMines = $00000100;
+ gfOneClanMode = $10000000;
gstDrowning = $00000001;
gstHHDriven = $00000002;
--- a/hedgewars/uGears.pas Sun Mar 15 14:47:59 2009 +0000
+++ b/hedgewars/uGears.pas Sun Mar 15 17:47:06 2009 +0000
@@ -605,17 +605,22 @@
procedure ResetUtilities;
var i: LongInt;
begin
- cGravity:= cMaxWindSpeed;
+ if (GameFlags and gfLowGravity) = 0 then
+ cGravity:= cMaxWindSpeed;
+
cDamageModifier:= _1;
- cLaserSighting:= false;
+
+ if (GameFlags and gfLaserSight) = 0 then
+ cLaserSighting:= 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
- if (Gear <> nil) then
- Gear^.Invulnerable:= false;
+ if (GameFlags and gfInvulnerable) = 0 then
+ if (CurrentTeam <> nil) then
+ with CurrentTeam^ do
+ for i:= 0 to cMaxHHIndex do
+ with Hedgehogs[i] do
+ if (Gear <> nil) then
+ Gear^.Invulnerable:= false;
end;
procedure SetAllToActive;
@@ -1290,12 +1295,26 @@
begin
AddGear(0, 0, gtATStartGame, 0, _0, _0, 2000);
-if (GameFlags and gfForts) = 0 then
+if ((GameFlags and gfForts) = 0) and ((GameFlags and gfMines) <> 0) then
for i:= 0 to Pred(cLandAdditions) do
begin
Gear:= AddGear(0, 0, gtMine, 0, _0, _0, 0);
FindPlace(Gear, false, 0, LAND_WIDTH)
- end
+ end;
+
+if (GameFlags and gfLowGravity) <> 0 then
+ cGravity:= cMaxWindSpeed / 2;
+
+Gear:= GearsList;
+if (GameFlags and gfInvulnerable) <> 0 then
+ while Gear <> nil do
+ begin
+ Gear^.Invulnerable:= true; // this is only checked on hogs right now, so no need for gear type check
+ Gear:= Gear^.NextGear
+ end;
+
+if (GameFlags and gfLaserSight) <> 0 then
+ cLaserSighting:= true
end;
procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord);
--- a/hedgewars/uMisc.pas Sun Mar 15 14:47:59 2009 +0000
+++ b/hedgewars/uMisc.pas Sun Mar 15 17:47:06 2009 +0000
@@ -38,6 +38,7 @@
GameFlags : Longword = 0;
TurnTimeLeft : Longword = 0;
cSuddenDTurns : LongInt = 15;
+ cDamagePercent : LongInt = 100;
cTemplateFilter : LongInt = 0;
cHedgehogTurnTime: Longword = 45000;
@@ -407,7 +408,7 @@
function modifyDamage(dmg: Longword): Longword;
begin
-ModifyDamage:= hwRound(int2HwFloat(dmg) * cDamageModifier)
+ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * cDamagePercent)
end;
{$IFDEF DEBUGFILE}