# HG changeset patch # User Xeli # Date 1314889399 -7200 # Node ID e27100a0e2d0fe783a617aad9d52f8bef52ca71d # Parent ba4c3a4c8b098d96e37010bf9c764610bc7fdfa5# Parent 87eec4c9a889a5dcb2df6fe77723229c7ab9cc24 merge + changed the tardis image to egg.png because the data folder isn't up to date diff -r ba4c3a4c8b09 -r e27100a0e2d0 QTfrontend/ammoSchemeModel.cpp --- a/QTfrontend/ammoSchemeModel.cpp Thu Sep 01 14:55:31 2011 +0200 +++ b/QTfrontend/ammoSchemeModel.cpp Thu Sep 01 17:03:19 2011 +0200 @@ -48,21 +48,22 @@ << QVariant(false) // no wind 22 << QVariant(false) // more wind 23 << QVariant(false) // tag team 24 - << QVariant(100) // damage modfier 25 - << QVariant(45) // turn time 26 - << QVariant(100) // init health 27 - << QVariant(15) // sudden death 28 - << QVariant(5) // case prob 29 - << QVariant(3) // mines time 30 - << QVariant(4) // mines number 31 - << QVariant(0) // mine dud pct 32 - << QVariant(2) // explosives 33 - << QVariant(35) // health case pct 34 - << QVariant(25) // health case amt 35 - << QVariant(47) // water rise amt 36 - << QVariant(5) // health dec amt 37 - << QVariant(100) // rope modfier 38 - << QVariant(100) // get away time 39 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(45) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(5) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(4) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(2) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 ; AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) : @@ -111,21 +112,22 @@ << "disablewind" // 22 << "morewind" // 23 << "tagteam" // 24 - << "damagefactor" // 25 - << "turntime" // 26 - << "health" // 27 - << "suddendeath" // 28 - << "caseprobability" // 29 - << "minestime" // 30 - << "minesnum" // 31 - << "minedudpct" // 32 - << "explosives" // 33 - << "healthprobability" // 34 - << "healthcaseamount" // 35 - << "waterrise" // 36 - << "healthdecrease" // 37 - << "ropepct" // 38 - << "getawaytime" // 39 + << "bottomborder" // 25 + << "damagefactor" // 26 + << "turntime" // 27 + << "health" // 28 + << "suddendeath" // 29 + << "caseprobability" // 30 + << "minestime" // 31 + << "minesnum" // 32 + << "minedudpct" // 33 + << "explosives" // 34 + << "healthprobability" // 35 + << "healthcaseamount" // 36 + << "waterrise" // 37 + << "healthdecrease" // 38 + << "ropepct" // 39 + << "getawaytime" // 40 ; QList proMode; @@ -155,21 +157,22 @@ << QVariant(false) // no wind 22 << QVariant(false) // more wind 23 << QVariant(false) // tag team 24 - << QVariant(100) // damage modfier 25 - << QVariant(15) // turn time 26 - << QVariant(100) // init health 27 - << QVariant(15) // sudden death 28 - << QVariant(0) // case prob 29 - << QVariant(3) // mines time 30 - << QVariant(0) // mines number 31 - << QVariant(0) // mine dud pct 32 - << QVariant(2) // explosives 33 - << QVariant(35) // health case pct 34 - << QVariant(25) // health case amt 35 - << QVariant(47) // water rise amt 36 - << QVariant(5) // health dec amt 37 - << QVariant(100) // rope modfier 38 - << QVariant(100) // get away time 39 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(15) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(0) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(0) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(2) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 ; QList shoppa; @@ -199,21 +202,22 @@ << QVariant(false) // no wind 22 << QVariant(false) // more wind 23 << QVariant(false) // tag team 24 - << QVariant(100) // damage modfier 25 - << QVariant(30) // turn time 26 - << QVariant(100) // init health 27 - << QVariant(50) // sudden death 28 - << QVariant(1) // case prob 29 - << QVariant(3) // mines time 30 - << QVariant(0) // mines number 31 - << QVariant(0) // mine dud pct 32 - << QVariant(0) // explosives 33 - << QVariant(0) // health case pct 34 - << QVariant(25) // health case amt 35 - << QVariant(47) // water rise amt 36 - << QVariant(5) // health dec amt 37 - << QVariant(100) // rope modfier 38 - << QVariant(100) // get away time 39 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(30) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(50) // sudden death 29 + << QVariant(1) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(0) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(0) // explosives 34 + << QVariant(0) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 ; QList cleanslate; @@ -243,21 +247,22 @@ << QVariant(false) // no wind 22 << QVariant(false) // more wind 23 << QVariant(false) // tag team 24 - << QVariant(100) // damage modfier 25 - << QVariant(45) // turn time 26 - << QVariant(100) // init health 27 - << QVariant(15) // sudden death 28 - << QVariant(5) // case prob 29 - << QVariant(3) // mines time 30 - << QVariant(4) // mines number 31 - << QVariant(0) // mine dud pct 32 - << QVariant(2) // explosives 33 - << QVariant(35) // health case pct 34 - << QVariant(25) // health case amt 35 - << QVariant(47) // water rise amt 36 - << QVariant(5) // health dec amt 37 - << QVariant(100) // rope modfier 38 - << QVariant(100) // get away time 39 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(45) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(5) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(4) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(2) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 ; QList minefield; @@ -287,21 +292,22 @@ << QVariant(false) // no wind 22 << QVariant(false) // more wind 23 << QVariant(false) // tag team 24 - << QVariant(100) // damage modfier 25 - << QVariant(30) // turn time 26 - << QVariant(50) // init health 27 - << QVariant(15) // sudden death 28 - << QVariant(0) // case prob 29 - << QVariant(0) // mines time 30 - << QVariant(80) // mines number 31 - << QVariant(0) // mine dud pct 32 - << QVariant(0) // explosives 33 - << QVariant(35) // health case pct 34 - << QVariant(25) // health case amt 35 - << QVariant(47) // water rise amt 36 - << QVariant(5) // health dec amt 37 - << QVariant(100) // rope modfier 38 - << QVariant(100) // get away time 39 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(30) // turn time 27 + << QVariant(50) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(0) // case prob 30 + << QVariant(0) // mines time 31 + << QVariant(80) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(0) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 ; QList barrelmayhem; @@ -331,21 +337,22 @@ << QVariant(false) // no wind 22 << QVariant(false) // more wind 23 << QVariant(false) // tag team 24 - << QVariant(100) // damage modfier 25 - << QVariant(30) // turn time 26 - << QVariant(100) // init health 27 - << QVariant(15) // sudden death 28 - << QVariant(0) // case prob 29 - << QVariant(0) // mines time 30 - << QVariant(0) // mines number 31 - << QVariant(0) // mine dud pct 32 - << QVariant(80) // explosives 33 - << QVariant(35) // health case pct 34 - << QVariant(25) // health case amt 35 - << QVariant(47) // water rise amt 36 - << QVariant(5) // health dec amt 37 - << QVariant(100) // rope modfier 38 - << QVariant(100) // get away time 39 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(30) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(0) // case prob 30 + << QVariant(0) // mines time 31 + << QVariant(0) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(80) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 ; QList tunnelhogs; @@ -375,21 +382,22 @@ << QVariant(false) // no wind 22 << QVariant(false) // more wind 23 << QVariant(false) // tag team 24 - << QVariant(100) // damage modfier 25 - << QVariant(30) // turn time 26 - << QVariant(100) // init health 27 - << QVariant(15) // sudden death 28 - << QVariant(5) // case prob 29 - << QVariant(3) // mines time 30 - << QVariant(10) // mines number 31 - << QVariant(10) // mine dud pct 32 - << QVariant(10) // explosives 33 - << QVariant(35) // health case pct 34 - << QVariant(25) // health case amt 35 - << QVariant(47) // water rise amt 36 - << QVariant(5) // health dec amt 37 - << QVariant(100) // rope modfier 38 - << QVariant(100) // get away time 39 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(30) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(5) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(10) // mines number 32 + << QVariant(10) // mine dud pct 33 + << QVariant(10) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 ; QList forts; @@ -419,21 +427,22 @@ << QVariant(false) // no wind 22 << QVariant(false) // more wind 23 << QVariant(false) // tag team 24 - << QVariant(100) // damage modfier 25 - << QVariant(45) // turn time 26 - << QVariant(100) // init health 27 - << QVariant(15) // sudden death 28 - << QVariant(5) // case prob 29 - << QVariant(3) // mines time 30 - << QVariant(0) // mines number 31 - << QVariant(0) // mine dud pct 32 - << QVariant(0) // explosives 33 - << QVariant(35) // health case pct 34 - << QVariant(25) // health case amt 35 - << QVariant(47) // water rise amt 36 - << QVariant(5) // health dec amt 37 - << QVariant(100) // rope modfier 38 - << QVariant(100) // get away time 39 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(45) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(5) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(0) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(0) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 ; QList timeless; @@ -463,21 +472,22 @@ << QVariant(false) // no wind 22 << QVariant(false) // more wind 23 << QVariant(false) // tag team 24 - << QVariant(100) // damage modfier 25 - << QVariant(9999) // turn time 26 - << QVariant(100) // init health 27 - << QVariant(15) // sudden death 28 - << QVariant(5) // case prob 29 - << QVariant(3) // mines time 30 - << QVariant(5) // mines number 31 - << QVariant(10) // mine dud pct 32 - << QVariant(2) // explosives 33 - << QVariant(35) // health case pct 34 - << QVariant(30) // health case amt 35 - << QVariant(0) // water rise amt 36 - << QVariant(0) // health dec amt 37 - << QVariant(100) // rope modfier 38 - << QVariant(100) // get away time 39 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(9999) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(5) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(5) // mines number 32 + << QVariant(10) // mine dud pct 33 + << QVariant(2) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(30) // health case amt 36 + << QVariant(0) // water rise amt 37 + << QVariant(0) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 ; QList thinkingportals; @@ -507,21 +517,22 @@ << QVariant(false) // no wind 22 << QVariant(false) // more wind 23 << QVariant(false) // tag team 24 - << QVariant(100) // damage modfier 25 - << QVariant(45) // turn time 26 - << QVariant(100) // init health 27 - << QVariant(15) // sudden death 28 - << QVariant(2) // case prob 29 - << QVariant(3) // mines time 30 - << QVariant(5) // mines number 31 - << QVariant(0) // mine dud pct 32 - << QVariant(5) // explosives 33 - << QVariant(25) // health case pct 34 - << QVariant(25) // health case amt 35 - << QVariant(47) // water rise amt 36 - << QVariant(5) // health dec amt 37 - << QVariant(100) // rope modfier 38 - << QVariant(100) // get away time 39 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(45) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(2) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(5) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(5) // explosives 34 + << QVariant(25) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 ; QList kingmode; @@ -551,21 +562,22 @@ << QVariant(false) // no wind 22 << QVariant(false) // more wind 23 << QVariant(false) // tag team 24 - << QVariant(100) // damage modfier 25 - << QVariant(45) // turn time 26 - << QVariant(100) // init health 27 - << QVariant(15) // sudden death 28 - << QVariant(5) // case prob 29 - << QVariant(3) // mines time 30 - << QVariant(4) // mines number 31 - << QVariant(0) // mine dud pct 32 - << QVariant(2) // explosives 33 - << QVariant(35) // health case pct 34 - << QVariant(25) // health case amt 35 - << QVariant(47) // water rise amt 36 - << QVariant(5) // health dec amt 37 - << QVariant(100) // rope modfier 38 - << QVariant(100) // get away time 39 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(45) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(5) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(4) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(2) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 ; @@ -771,4 +783,4 @@ netScheme[i] = QVariant(cfg[i]); reset(); -} +} diff -r ba4c3a4c8b09 -r e27100a0e2d0 QTfrontend/gamecfgwidget.cpp --- a/QTfrontend/gamecfgwidget.cpp Thu Sep 01 14:55:31 2011 +0200 +++ b/QTfrontend/gamecfgwidget.cpp Thu Sep 01 17:03:19 2011 +0200 @@ -215,13 +215,15 @@ result |= 0x01000000; // more wind if (schemeData(24).toBool()) result |= 0x02000000; // tag team + if (schemeData(25).toBool()) + result |= 0x04000000; // bottom border return result; } quint32 GameCFGWidget::getInitHealth() const { - return schemeData(27).toInt(); + return schemeData(28).toInt(); } QByteArray GameCFGWidget::getFullConfig() const @@ -245,20 +247,20 @@ bcfg << QString("eseed " + pMapContainer->getCurrentSeed()).toUtf8(); bcfg << QString("e$gmflags %1").arg(getGameFlags()).toUtf8(); - bcfg << QString("e$damagepct %1").arg(schemeData(25).toInt()).toUtf8(); - bcfg << QString("e$turntime %1").arg(schemeData(26).toInt() * 1000).toUtf8(); - bcfg << QString("e$sd_turns %1").arg(schemeData(28).toInt()).toUtf8(); - bcfg << QString("e$casefreq %1").arg(schemeData(29).toInt()).toUtf8(); - bcfg << QString("e$minestime %1").arg(schemeData(30).toInt() * 1000).toUtf8(); - bcfg << QString("e$minesnum %1").arg(schemeData(31).toInt()).toUtf8(); - bcfg << QString("e$minedudpct %1").arg(schemeData(32).toInt()).toUtf8(); - bcfg << QString("e$explosives %1").arg(schemeData(33).toInt()).toUtf8(); - bcfg << QString("e$healthprob %1").arg(schemeData(34).toInt()).toUtf8(); - bcfg << QString("e$hcaseamount %1").arg(schemeData(35).toInt()).toUtf8(); - bcfg << QString("e$waterrise %1").arg(schemeData(36).toInt()).toUtf8(); - bcfg << QString("e$healthdec %1").arg(schemeData(37).toInt()).toUtf8(); - bcfg << QString("e$ropepct %1").arg(schemeData(38).toInt()).toUtf8(); - bcfg << QString("e$getawaytime %1").arg(schemeData(39).toInt()).toUtf8(); + bcfg << QString("e$damagepct %1").arg(schemeData(26).toInt()).toUtf8(); + bcfg << QString("e$turntime %1").arg(schemeData(27).toInt() * 1000).toUtf8(); + bcfg << QString("e$sd_turns %1").arg(schemeData(29).toInt()).toUtf8(); + bcfg << QString("e$casefreq %1").arg(schemeData(30).toInt()).toUtf8(); + bcfg << QString("e$minestime %1").arg(schemeData(31).toInt() * 1000).toUtf8(); + bcfg << QString("e$minesnum %1").arg(schemeData(32).toInt()).toUtf8(); + bcfg << QString("e$minedudpct %1").arg(schemeData(33).toInt()).toUtf8(); + bcfg << QString("e$explosives %1").arg(schemeData(34).toInt()).toUtf8(); + bcfg << QString("e$healthprob %1").arg(schemeData(35).toInt()).toUtf8(); + bcfg << QString("e$hcaseamount %1").arg(schemeData(36).toInt()).toUtf8(); + bcfg << QString("e$waterrise %1").arg(schemeData(37).toInt()).toUtf8(); + bcfg << QString("e$healthdec %1").arg(schemeData(38).toInt()).toUtf8(); + bcfg << QString("e$ropepct %1").arg(schemeData(39).toInt()).toUtf8(); + bcfg << QString("e$getawaytime %1").arg(schemeData(40).toInt()).toUtf8(); bcfg << QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter()).toUtf8(); bcfg << QString("e$mapgen %1").arg(mapgen).toUtf8(); diff -r ba4c3a4c8b09 -r e27100a0e2d0 QTfrontend/hedgewars.qrc --- a/QTfrontend/hedgewars.qrc Thu Sep 01 14:55:31 2011 +0200 +++ b/QTfrontend/hedgewars.qrc Thu Sep 01 17:03:19 2011 +0200 @@ -81,6 +81,7 @@ res/btnNoWind.png res/btnMoreWind.png res/btnTagTeam.png + res/btnBottomBorder.png res/iconBox.png res/iconHealth.png res/iconSuddenDeath.png diff -r ba4c3a4c8b09 -r e27100a0e2d0 QTfrontend/pagescheme.cpp --- a/QTfrontend/pagescheme.cpp Thu Sep 01 14:55:31 2011 +0200 +++ b/QTfrontend/pagescheme.cpp Thu Sep 01 17:03:19 2011 +0200 @@ -78,7 +78,7 @@ glGMLayout->addWidget(TBW_solid,0,2,1,1); TBW_border = new ToggleButtonWidget(gbGameModes, ":/res/btnBorder.png"); - TBW_border->setToolTip("" + ToggleButtonWidget::tr("Add Border") + ":
" + tr("Add an indestructable border around the terrain")); + TBW_border->setToolTip("" + ToggleButtonWidget::tr("Add Border") + ":
" + tr("Add an indestructible border around the terrain")); glGMLayout->addWidget(TBW_border,0,3,1,1); TBW_lowGravity = new ToggleButtonWidget(gbGameModes, ":/res/btnLowGravity.png"); @@ -161,6 +161,11 @@ TBW_tagteam->setToolTip("" + ToggleButtonWidget::tr("Tag Team") + ":
" + tr("Teams in each clan take successive turns sharing their turn time.")); glGMLayout->addWidget(TBW_tagteam,4,3,1,1); + TBW_bottomborder = new ToggleButtonWidget(gbGameModes, ":/res/btnBottomBorder.png"); + TBW_bottomborder->setToolTip("" + ToggleButtonWidget::tr("Add Bottom Border") + ":
" + tr("Add an indestructible border along the bottom")); + glGMLayout->addWidget(TBW_bottomborder,4,4,1,1); + + // Right QLabel * l; @@ -430,21 +435,22 @@ mapper->addMapping(TBW_nowind, 22); mapper->addMapping(TBW_morewind, 23); mapper->addMapping(TBW_tagteam, 24); - mapper->addMapping(SB_DamageModifier, 25); - mapper->addMapping(SB_TurnTime, 26); - mapper->addMapping(SB_InitHealth, 27); - mapper->addMapping(SB_SuddenDeath, 28); - mapper->addMapping(SB_CaseProb, 29); - mapper->addMapping(SB_MinesTime, 30); - mapper->addMapping(SB_Mines, 31); - mapper->addMapping(SB_MineDuds, 32); - mapper->addMapping(SB_Explosives, 33); - mapper->addMapping(SB_HealthCrates, 34); - mapper->addMapping(SB_CrateHealth, 35); - mapper->addMapping(SB_WaterRise, 36); - mapper->addMapping(SB_HealthDecrease, 37); - mapper->addMapping(SB_RopeModifier, 38); - mapper->addMapping(SB_GetAwayTime, 39); + mapper->addMapping(TBW_bottomborder, 25); + mapper->addMapping(SB_DamageModifier, 26); + mapper->addMapping(SB_TurnTime, 27); + mapper->addMapping(SB_InitHealth, 28); + mapper->addMapping(SB_SuddenDeath, 29); + mapper->addMapping(SB_CaseProb, 30); + mapper->addMapping(SB_MinesTime, 31); + mapper->addMapping(SB_Mines, 32); + mapper->addMapping(SB_MineDuds, 33); + mapper->addMapping(SB_Explosives, 34); + mapper->addMapping(SB_HealthCrates, 35); + mapper->addMapping(SB_CrateHealth, 36); + mapper->addMapping(SB_WaterRise, 37); + mapper->addMapping(SB_HealthDecrease, 38); + mapper->addMapping(SB_RopeModifier, 39); + mapper->addMapping(SB_GetAwayTime, 40); mapper->toFirst(); } diff -r ba4c3a4c8b09 -r e27100a0e2d0 QTfrontend/pagescheme.h --- a/QTfrontend/pagescheme.h Thu Sep 01 14:55:31 2011 +0200 +++ b/QTfrontend/pagescheme.h Thu Sep 01 17:03:19 2011 +0200 @@ -71,6 +71,7 @@ ToggleButtonWidget * TBW_nowind; ToggleButtonWidget * TBW_morewind; ToggleButtonWidget * TBW_tagteam; + ToggleButtonWidget * TBW_bottomborder; QSpinBox * SB_DamageModifier; QSpinBox * SB_TurnTime; diff -r ba4c3a4c8b09 -r e27100a0e2d0 QTfrontend/res/btnBottomBorder.png Binary file QTfrontend/res/btnBottomBorder.png has changed diff -r ba4c3a4c8b09 -r e27100a0e2d0 QTfrontend/res/btnTagTeam.png Binary file QTfrontend/res/btnTagTeam.png has changed diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/GSHandlers.inc Thu Sep 01 17:03:19 2011 +0200 @@ -356,7 +356,7 @@ Gear^.State := Gear^.State or gstMoving; if (Gear^.nImpactSounds > 0) and - ((Gear^.Damage <> 0) or + (((Gear^.Kind <> gtMine) and (Gear^.Damage <> 0)) or ((Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving))) and (((Gear^.Radius < 3) and (Gear^.dY < -_0_1)) or ((Gear^.Radius >= 3) and ((Gear^.dX.QWordValue > _0_1.QWordValue) or @@ -584,7 +584,9 @@ move, draw, allpx, gun: Boolean; s: PSDL_Surface; p: PLongwordArray; + lf: LongWord; begin +inc(Gear^.Pos); gun:= (Gear^.State and gstTmpFlag) <> 0; move:= false; draw:= false; @@ -626,6 +628,7 @@ // Solid pixel encountered else if ((xx and LAND_WIDTH_MASK) = 0) and (Land[yy, xx] <> 0) then begin + lf:= Land[yy, xx] and (lfObject or lfBasic); // If there's room below keep falling if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (Land[yy-1, xx] = 0) then begin @@ -664,7 +667,7 @@ begin // we've collided with land. draw some stuff and get back into the clouds move:= true; - if (CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtRope) then + if (Pos > 20) and ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtRope)) then begin ////////////////////////////////// TODO - ASK UNC0RR FOR A GOOD HOME FOR THIS //////////////////////////////////// if not gun then @@ -684,9 +687,9 @@ begin // try to avoid speckles. might need disabling LandDirty[yy div 32, xx div 32]:= 1; - Land[yy + py, xx + px]:= Land[yy + py, xx + px] or lfDamaged; - end; - Land[yy + py, xx + px]:= Land[yy + py, xx + px] or lfObject; + Land[yy + py, xx + px]:= (Land[yy + py, xx + px] or lfDamaged or lfObject) and not lfBasic; + end + else if Land[yy + py, xx + px] and $FF00 = 0 then Land[yy + py, xx + px]:= lf; if (cReducedQuality and rqBlurryLand) = 0 then begin if gun then @@ -728,6 +731,7 @@ DeleteGear(Gear); exit end; + Gear^.Pos:= 0; Gear^.X:= int2hwFloat(GetRandom(LAND_WIDTH+1024)-512); Gear^.Y:= int2hwFloat(750+(GetRandom(50)-25)); Gear^.State:= Gear^.State or gstInvisible; @@ -1222,21 +1226,21 @@ b := false; if abs(LongInt(HHGear^.Angle) - BTPrevAngle) > 7 then - begin - Gear^.dX := SignAs(AngleSin(HHGear^.Angle) * _0_5, HHGear^.dX); + begin + Gear^.dX := SignAs(AngleSin(HHGear^.Angle) * _0_5, Gear^.dX); Gear^.dY := AngleCos(HHGear^.Angle) * ( - _0_5); BTPrevAngle := HHGear^.Angle; b := true - end; + end; if ((HHGear^.State and gstMoving) <> 0) then - begin + begin doStepHedgehogMoving(HHGear); if (HHGear^.State and gstHHDriven) = 0 then Gear^.Timer := 0 - end; + end; if Gear^.Timer mod cHHStepTicks = 0 then - begin + begin b := true; if Gear^.dX.isNegative then HHGear^.Message := (HHGear^.Message and (gmAttack or gmUp or gmDown)) or gmLeft @@ -1244,7 +1248,7 @@ HHGear^.Message := (HHGear^.Message and (gmAttack or gmUp or gmDown)) or gmRight; if ((HHGear^.State and gstMoving) = 0) then - begin + begin HHGear^.State := HHGear^.State and not gstAttacking; prevX := hwRound(HHGear^.X); @@ -1257,24 +1261,24 @@ CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), lfIndestructible) then HHGear^.X := HHGear^.X + SignAs(_1, HHGear^.dX); HHGear^.State := HHGear^.State or gstAttacking - end; + end; inc(BTSteps); if BTSteps = 7 then - begin + begin BTSteps := 0; if CheckLandValue(hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_6, Gear^.dX)), hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)), lfIndestructible) then - begin + begin Gear^.X := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC); Gear^.Y := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC); - end; + end; HHGear^.State := HHGear^.State or gstNoDamage; AmmoShove(Gear, 2, 15); HHGear^.State := HHGear^.State and not gstNoDamage + end; end; - end; if b then DrawTunnel(HHGear^.X - Gear^.dX * cHHRadius, HHGear^.Y - _4 - Gear^.dY * cHHRadius + hwAbs( @@ -1283,12 +1287,12 @@ cHHRadius * 5, cHHRadius * 2 + 7); if (Gear^.Timer = 0) or ((HHGear^.Message and gmAttack) <> 0) then - begin + begin HHGear^.Message := 0; HHGear^.State := HHGear^.State and (not gstNotKickable); DeleteGear(Gear); AfterAttack - end + end end; procedure doStepBlowTorch(Gear: PGear); @@ -1556,7 +1560,7 @@ end; CheckCollision(Gear); - // if we haven't found any collision yet then check the otheer side too + // if we haven't found any collision yet then check the other side too if (Gear^.State and gstCollision) = 0 then begin Gear^.dX.isNegative:= not Gear^.dX.isNegative; @@ -1713,6 +1717,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepMine(Gear: PGear); +var vg: PVisualGear; begin if (Gear^.State and gstMoving) <> 0 then begin @@ -1742,7 +1747,10 @@ inc(Gear^.Damage, hwRound(Gear^.dX * -_70)); if (Gear^.Damage > random(30)) and ((GameTicks and $FF) = 0) then - AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke); + begin + vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke); + if vg <> nil then vg^.Scale:= 0.5 + end; if (Gear^.Damage > 35) then begin @@ -1774,8 +1782,8 @@ end else begin - AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), - vgtSmoke); + vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke); + if vg <> nil then vg^.Scale:= 0.5; PlaySound(sndVaporize); Gear^.Health := 0; Gear^.Damage := 0; @@ -2941,10 +2949,8 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepSeductionWork(Gear: PGear); -var - x, y, i: LongInt; +var i: LongInt; hogs: TPGearArray; - d: hwFloat; begin AllInactive := false; hogs := GearsNear(Gear^.X, Gear^.Y, gtHedgehog, Gear^.Radius); @@ -3670,10 +3676,10 @@ AllInactive := false; FollowGear := HHGear; with HHGear^ do - begin + begin State := State and not gstAttacking; Message := Message and not (gmAttack or gmUp or gmPrecise or gmLeft or gmRight) - end + end end; //////////////////////////////////////////////////////////////////////////////// @@ -4894,47 +4900,146 @@ end; //////////////////////////////////////////////////////////////////////////////// -procedure doStepTardis(Gear: PGear); -(*var - i, x, y: LongInt; - dX, dY: hwFloat; - Fire: PGear; - vg: PVisualGear;*) +(* + TARDIS needs + Warp in. Pos = 1 + Pause. Pos = 2 + Hide gear (TARDIS hedgehog was nil) + Warp out. Pos = 3 + ... idle active for some time period ... Pos = 4 + Warp in. Pos = 1 + Pause. Pos = 2 + Restore gear (TARDIS hedgehog was not nil) + Warp out. Pos = 3 +*) + +procedure doStepTardisWarp(Gear: PGear); +var HH: PHedgehog; + i,j,cnt: LongWord; begin - if (Gear^.State and gstTmpFlag) = 0 then dec(Gear^.Timer); - if (Gear^.Timer = 0) and (CurAmmoGear = Gear) then + +HH:= Gear^.Hedgehog; +if Gear^.Pos = 2 then + begin + if (Gear^.Timer = 0) then begin - if (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then + if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible = 0) then begin - DeleteGear(Gear); - exit + AfterAttack; + if Gear = CurAmmoGear then CurAmmoGear := nil; + DeleteCI(HH^.Gear); + RemoveGearFromList(HH^.Gear); + with HH^.Gear^ do + begin + Z := cHHZ; + Active := false; + State:= State and not (gstHHDriven or gstAttacking or gstAttacked); + Message := Message and not gmAttack; + end; + HH^.GearHidden:= HH^.Gear; + HH^.Gear:= nil + end + else if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible <> 0) then + begin + InsertGearToList(HH^.Gear); + HH^.Gear^.State:= HH^.Gear^.State and not (gstHHDriven or gstInvisible); + AddGearCI(HH^.Gear); + HH^.Gear^.Active:= true end; - if Gear = CurAmmoGear then CurAmmoGear := nil; - Gear^.Hedgehog:= CurrentHedgehog; - RemoveGearFromList(CurrentHedgehog^.Gear); - CurrentHedgehog^.Gear^.Z := cHHZ; - CurrentHedgehog^.Gear^.Active := false; - CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State and not gstHHDriven; - CurrentHedgehog^.GearHidden:= CurrentHedgehog^.Gear; - CurrentHedgehog^.Gear:= nil; - Gear^.State:= Gear^.State or gstTmpFlag; - Gear^.Timer:= GameTicks + GetRandom(cHedgehogTurnTime*TeamsCount)+cHedgehogTurnTime; - end - else if (((Gear^.State and gstTmpFlag) <> 0) and (Gear^.Timer = GameTicks)) or SuddenDeath then + end; + + inc(Gear^.Timer); + if (Gear^.Timer > 2000) and ((GameTicks mod 2000) = 1000) then + begin + Gear^.Pos:= 3; + end; + end; + +if (Gear^.Pos = 1) and (GameTicks and $1F = 0) and (Gear^.Power < 255) then inc(Gear^.Power); +if (Gear^.Pos = 3) and (GameTicks and $1F = 0) and (Gear^.Power > 0) then dec(Gear^.Power); +if (Gear^.Pos = 1) and (Gear^.Power = 255) and ((GameTicks mod 2000) = 1000) then Gear^.Pos:= 2; +if (Gear^.Pos = 3) and (Gear^.Power = 0) then + begin + if HH^.GearHidden = nil then + begin + DeleteGear(Gear); + exit + end; + Gear^.Pos:= 4; + // This condition might need tweaking + Gear^.Timer:= GetRandom(cHedgehogTurnTime*TeamsCount)+cHedgehogTurnTime + end; + +if (Gear^.Pos = 4) then + begin + cnt:= 0; + for j:= 0 to Pred(HH^.Team^.Clan^.TeamsNumber) do + for i:= 0 to Pred(HH^.Team^.Clan^.Teams[j]^.HedgehogsNumber) do + if (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear <> nil) and + ((HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.State and gstDrowning) = 0) and + (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Health > + HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Damage) then inc(cnt); + if (cnt = 0) or SuddenDeathDmg or (Gear^.Timer = 0) then begin - if Gear^.Hedgehog <> nil then + Gear^.Pos:= 1; + Gear^.Power:= 0; + Gear^.Timer:= 0; + if HH^.GearHidden <> nil then FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH,true); + if HH^.GearHidden <> nil then begin - Gear^.Hedgehog^.Gear:= Gear^.Hedgehog^.GearHidden; - Gear^.Hedgehog^.GearHidden:= nil; - FindPlace(Gear^.Hedgehog^.Gear, false, 0, LAND_WIDTH,true); - InsertGearToList(Gear^.Hedgehog^.Gear); - Gear^.Hedgehog^.Gear^.State:= (Gear^.Hedgehog^.Gear^.State or gstTmpFlag or gstAttacked) and not gstHHDriven; - Gear^.Hedgehog^.Gear^.Timer:= $FF; - Gear^.Hedgehog^.Gear^.doStep:= @doStepHedgehogReturn; - SetAllHHToActive; - end; - DeleteGear(Gear) + HH^.Gear:=HH^.GearHidden; + HH^.GearHidden:= nil; + HH^.Gear^.State:= HH^.Gear^.State or gstInvisible; + Gear^.X:= HH^.Gear^.X; + Gear^.Y:= HH^.Gear^.Y; + end end + else dec(Gear^.Timer); + end; + +end; + +procedure doStepTardis(Gear: PGear); +var i,j,cnt: LongWord; + HH: PHedgehog; +begin +(* + Conditions for not activating. + 1. Hog is last of his clan + 2. Sudden Death is in play + 3. Hog is a king +*) + HH:= Gear^.Hedgehog; + if (HH^.Gear = nil) or (HH^.King) or (SuddenDeathDmg) then + begin + if HH^.Gear <> nil then + begin + HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack; + HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking; + end; + PlaySound(sndDenied); + DeleteGear(gear); + exit + end; + cnt:= 0; + for j:= 0 to Pred(HH^.Team^.Clan^.TeamsNumber) do + for i:= 0 to Pred(HH^.Team^.Clan^.Teams[j]^.HedgehogsNumber) do + if (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear <> nil) and + ((HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.State and gstDrowning) = 0) and + (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Health > + HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Damage) then inc(cnt); + if cnt < 2 then + begin + if HH^.Gear <> nil then + begin + HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack; + HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking; + end; + PlaySound(sndDenied); + DeleteGear(gear); + exit + end; + Gear^.doStep:= @doStepTardisWarp end; //////////////////////////////////////////////////////////////////////////////// diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/HHHandlers.inc Thu Sep 01 17:03:19 2011 +0200 @@ -423,7 +423,8 @@ end end else Message:= Message and not gmAttack; end; - TargetPoint.X := NoPointX + TargetPoint.X := NoPointX; + ScriptCall('onHogAttack'); end; procedure AfterAttack; @@ -1093,13 +1094,3 @@ doStepHedgehogDriven(Gear) end; end; - -procedure doStepHedgehogReturn(Gear: PGear); -begin -if (Gear^.Timer > 0) and ((GameTicks mod 20) = 0) then dec(Gear^.Timer) -else if (Gear^.Timer = 0) then - begin - Gear^.doStep:= @doStepHedgehog; - Gear^.State:= Gear^.State and not gstTmpFlag; - end -end; diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/PascalExports.pas --- a/hedgewars/PascalExports.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/PascalExports.pas Thu Sep 01 17:03:19 2011 +0200 @@ -39,7 +39,6 @@ implementation {$IFDEF HWLIBRARY} var cZoomVal: GLfloat; - previousGameState: TGameState; // retrieve protocol information procedure HW_versionInfo(netProto: PLongInt; versionStr: PPChar); cdecl; export; @@ -188,17 +187,6 @@ exit( isPaused ); end; -procedure HW_suspend; cdecl; export; -begin - previousGameState:= GameState; - GameState:= gsSuspend; -end; - -procedure HW_resume; cdecl; export; -begin - GameState:= previousGameState; -end; - // equivalent to esc+y; when closeFrontend = true the game exits after memory cleanup procedure HW_terminate(closeFrontend: boolean); cdecl; export; begin diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/SDLh.pas --- a/hedgewars/SDLh.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/SDLh.pas Thu Sep 01 17:03:19 2011 +0200 @@ -224,7 +224,7 @@ SDL_JOYBUTTONDOWN = 10; SDL_JOYBUTTONUP = 11; SDL_QUITEV = 12; - SDL_VIDEORESIZE = 16; // TODO: outdated? no longer in SDL 1.3? + SDL_VIDEORESIZE = 16; // SDL_Surface flags SDL_SWSURFACE = $00000000; @@ -638,7 +638,7 @@ SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent); SDL_QUITEV: (quit: TSDL_QuitEvent); //SDL_SYSWMEVENT,SDL_EVENT_RESERVEDA,SDL_EVENT_RESERVEDB - //SDL_VIDEORESIZE: (resize: TSDL_ResizeEvent); + SDL_VIDEORESIZE: (resize: TSDL_ResizeEvent); {$ENDIF} end; @@ -881,12 +881,6 @@ function SDL_AllocFormat(format: Longword): PSDL_PixelFormat; {$IFDEF SDL13}cdecl; external SDLLibName;{$ENDIF} procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); {$IFDEF SDL13}cdecl; external SDLLibName;{$ENDIF} -{* OpenGL *} -{$IFDEF DARWIN} -function CGLGetCurrentContext(): Pointer; cdecl; external 'OpenGL'; -procedure CGLSetParameter(context: Pointer; option: LongInt; value: Pointer); cdecl; external 'OpenGL'; -{$ENDIF} - (* SDL_ttf *) function TTF_Init: LongInt; cdecl; external SDL_TTFLibName; procedure TTF_Quit; cdecl; external SDL_TTFLibName; diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/hwengine.pas Thu Sep 01 17:03:19 2011 +0200 @@ -101,7 +101,6 @@ gsExit: begin isTerminated:= true; end; - gsSuspend: exit; end; {$IFDEF SDL13} @@ -184,6 +183,16 @@ if prevFocusState xor cHasFocus then onFocusStateChanged() end; + SDL_VIDEORESIZE: begin + // using lower values causes widget overlap and video issues + if event.resize.w > cMinScreenWidth then cScreenWidth:= event.resize.w + else cScreenWidth:= cMinScreenWidth; + if event.resize.h > cMinScreenHeight then cScreenHeight:= event.resize.h + else cScreenHeight:= cMinScreenHeight; + ParseCommand('fullscr '+intToStr(LongInt(cFullScreen)), true); + WriteLnToConsole('window resize'); + InitCameraBorders(); + end; {$ENDIF} SDL_JOYAXISMOTION: ControllerAxisEvent(event.jaxis.which, event.jaxis.axis, event.jaxis.value); SDL_JOYHATMOTION: ControllerHatEvent(event.jhat.which, event.jhat.hat, event.jhat.value); @@ -244,6 +253,12 @@ recordFileName:= gameArgs[10]; cStereoMode:= smNone; {$ENDIF} + cMinScreenWidth:= cScreenWidth; + cMinScreenHeight:= cScreenHeight; + cOrigScreenWidth:= cScreenWidth; + cOrigScreenHeight:= cScreenHeight; + if 480 < cMinScreenWidth then cMinScreenWidth:= 480; + if 320 < cMinScreenHeight then cMinScreenHeight:= 320; initEverything(true); WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')'); diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uAmmos.pas --- a/hedgewars/uAmmos.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uAmmos.pas Thu Sep 01 17:03:19 2011 +0200 @@ -156,7 +156,8 @@ ammoidx:= 0; while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> am) do inc(ammoidx); GetAmmoEntry:= @Ammo^[slot, ammoidx]; - end + if (Ammo^[slot, ammoidx].AmmoType <> am) then GetAmmoEntry:= GetAmmoEntry(Hedgehog, amNothing) + end; end; procedure AssignStores; @@ -180,9 +181,12 @@ procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType); var cnt: LongWord; + a: PAmmo; begin -cnt:= GetAmmoEntry(Hedgehog, ammo)^.Count; -if cnt <> AMMO_INFINITE then +a:= GetAmmoEntry(Hedgehog, ammo); +if (a^.AmmoType <> amNothing) then cnt:= a^.Count +else cnt:= 0; +if (cnt <> AMMO_INFINITE) then begin inc(cnt, Ammoz[ammo].NumberInCase); AddAmmo(Hedgehog, ammo, cnt) diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uCommandHandlers.pas --- a/hedgewars/uCommandHandlers.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uCommandHandlers.pas Thu Sep 01 17:03:19 2011 +0200 @@ -450,7 +450,7 @@ procedure chSetMap(var s: shortstring); begin -if isDeveloperMode and (s <> '') then +if isDeveloperMode then begin UserPathz[ptMapCurrent]:= UserPathz[ptMaps] + '/' + s; Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s; diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uConsts.pas Thu Sep 01 17:03:19 2011 +0200 @@ -198,6 +198,7 @@ gfDisableWind = $00800000; gfMoreWind = $01000000; gfTagTeam = $02000000; + gfBottomBorder = $04000000; // NOTE: When adding new game flags, ask yourself // if a "game start notice" would be useful. If so, // add one in uWorld.pas - look for "AddGoal". diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uGears.pas Thu Sep 01 17:03:19 2011 +0200 @@ -75,7 +75,6 @@ procedure AfterAttack; forward; procedure HedgehogStep(Gear: PGear); forward; procedure doStepHedgehogMoving(Gear: PGear); forward; -procedure doStepHedgehogReturn(Gear: PGear); forward; procedure HedgehogChAngle(HHGear: PGear); forward; procedure ShotgunShot(Gear: PGear); forward; procedure PickUp(HH, Gear: PGear); forward; @@ -218,7 +217,6 @@ gear^.doStep:= doStepHandlers[Kind]; gear^.CollisionIndex:= -1; gear^.Timer:= Timer; -gear^.Z:= cUsualZ; gear^.FlightTime:= 0; gear^.uid:= Counter; gear^.SoundChannel:= -1; @@ -226,6 +224,8 @@ gear^.nImpactSounds:= 0; // Define ammo association, if any. gear^.AmmoType:= GearKindAmmoTypeMap[Kind]; +if Ammoz[Gear^.AmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then gear^.Z:= cHHZ+1 +else gear^.Z:= cUsualZ; if CurrentHedgehog <> nil then begin @@ -289,6 +289,7 @@ gtFlake: begin with Gear^ do begin + Pos:= 0; Radius:= 1; DirAngle:= random * 360; dx.isNegative:= GetRandom(2) = 0; @@ -371,7 +372,8 @@ gear^.Elasticity:= _0_4; gear^.Friction:= _0_995; gear^.Density:= _6; - gear^.Health:= cBarrelHealth + gear^.Health:= cBarrelHealth; + gear^.Z:= cHHZ-1 end; gtDEagleShot: begin gear^.Radius:= 1; @@ -427,6 +429,11 @@ gear^.Elasticity:= _0_3; gear^.Timer:= 0 end; + gtTardis: begin + gear^.Timer:= 0; + gear^.Pos:= 1; + gear^.Z:= cCurrHHZ+1; + end; gtMortar: begin gear^.Radius:= 4; gear^.Elasticity:= _0_2; @@ -863,7 +870,7 @@ ChangeToSDClouds; ChangeToSDFlakes; - glClearColor(SDSkyColor.r / 255, SDSkyColor.g / 255, SDSkyColor.b / 255, 0.99); + glClearColor(SDSkyColor.r * (SDTint/255) / 255, SDSkyColor.g * (SDTint/255) / 255, SDSkyColor.b * (SDTint/255) / 255, 0.99); end; AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState); playSound(sndSuddenDeath); @@ -1227,7 +1234,7 @@ begin for i:= 0 to Pred(vobCount*2) do AddGear(GetRandom(LAND_WIDTH+1024)-512, LAND_HEIGHT - GetRandom(LAND_HEIGHT div 2), gtFlake, 0, _0, _0, 0); - disableLandBack:= true + //disableLandBack:= true end end; @@ -1300,7 +1307,7 @@ Gear^.Active:= true; if Gear^.Kind <> gtFlame then FollowGear:= Gear end; - if ((Mask and EXPLPoisoned) <> 0) and (Gear^.Kind = gtHedgehog) then + if ((Mask and EXPLPoisoned) <> 0) and (Gear^.Kind = gtHedgehog) and not Gear^.Invulnerable then Gear^.Hedgehog^.Effects[hePoisoned] := true; end; @@ -1449,7 +1456,11 @@ ApplyDamage(Gear, Ammo^.Hedgehog, tmpDmg, dsShove) else Gear^.State:= Gear^.State or gstWinner; - if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then ApplyDamage(Gear, Ammo^.Hedgehog, tmpDmg * 100, dsUnknown); // crank up damage for explosives + blowtorch + if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then + begin + if (Ammo^.Hedgehog^.Gear <> nil) then Ammo^.Hedgehog^.Gear^.State:= Ammo^.Hedgehog^.Gear^.State and not gstNotKickable; + ApplyDamage(Gear, Ammo^.Hedgehog, tmpDmg * 100, dsUnknown); // crank up damage for explosives + blowtorch + end; DeleteCI(Gear); if (Gear^.Kind = gtHedgehog) and Gear^.Hedgehog^.King then diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uGearsRender.pas Thu Sep 01 17:03:19 2011 +0200 @@ -227,13 +227,6 @@ Tint($FF, $FF, $FF, $FF) end; - if (CurAmmoGear <> nil) and - (CurrentHedgehog^.Gear <> nil) and - (CurrentHedgehog^.Gear = Gear) and - (CurAmmoGear^.Kind = gtTardis) then Tint($FF, $FF, $FF, CurAmmoGear^.Timer div 20) - // probably will need a new flag for this - else if (Gear^.State and gstTmpFlag <> 0) then Tint($FF, $FF, $FF, $FF-Gear^.Timer); - if ((Gear^.State and gstWinner) <> 0) and ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtPickHammer)) then begin @@ -1090,6 +1083,15 @@ //DrawRotatedF(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer, 1, Gear^.DirAngle); end; gtStructure: DrawSprite(sprTarget, x - 16, y - 16, 0); + gtTardis: if Gear^.Pos <> 4 then + begin + if (Gear^.Pos = 1) or (Gear^.Pos = 3) then + Tint($FF, $FF, $FF, max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000))))); + DrawSprite(sprTardis, x-24, y-63,0); + if (Gear^.Pos = 1) or (Gear^.Pos = 3) then + Tint($FF, $FF, $FF, $FF) + end; + end; if Gear^.RenderTimer and (Gear^.Tex <> nil) then DrawCentered(x + 8, y + 8, Gear^.Tex); diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uLand.pas --- a/hedgewars/uLand.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uLand.pas Thu Sep 01 17:03:19 2011 +0200 @@ -30,6 +30,7 @@ procedure initModule; procedure freeModule; +procedure DrawBottomBorder; procedure GenMap; function GenPreview: TPreview; @@ -1070,9 +1071,11 @@ begin if (cReducedQuality and rqBlurryLand) = 0 then begin - if Land[y, x-1] = lfBasic then LandPixels[y, x]:= LandPixels[y, x-1] - else if Land[y, x+1] = lfBasic then LandPixels[y, x]:= LandPixels[y, x+1]; - LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (128 shl AShift) + if (Land[y, x-1] = lfBasic) and (LandPixels[y, x-1] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y, x-1] + else if (Land[y, x+1] = lfBasic) and (LandPixels[y, x+1] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y, x+1] + else if (Land[y-1, x] = lfBasic) and (LandPixels[y-1, x] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y-1, x] + else if (Land[y+1, x] = lfBasic) and (LandPixels[y+1, x] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y+1, x]; + if (((LandPixels[y,x] and AMask) shr AShift) > 10) then LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (128 shl AShift) end; Land[y,x]:= lfObject end @@ -1088,11 +1091,11 @@ begin if (cReducedQuality and rqBlurryLand) = 0 then begin - if Land[y, x-1] = lfBasic then LandPixels[y, x]:= LandPixels[y, x-1] - else if Land[y, x+1] = lfBasic then LandPixels[y, x]:= LandPixels[y, x+1] - else if Land[y+1, x] = lfBasic then LandPixels[y, x]:= LandPixels[y+1, x] - else if Land[y-1, x] = lfBasic then LandPixels[y, x]:= LandPixels[y-1, x]; - LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (64 shl AShift) + if (Land[y, x-1] = lfBasic) and (LandPixels[y,x-1] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y, x-1] + else if (Land[y, x+1] = lfBasic) and (LandPixels[y,x+1] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y, x+1] + else if (Land[y+1, x] = lfBasic) and (LandPixels[y+1,x] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y+1, x] + else if (Land[y-1, x] = lfBasic) and (LandPixels[y-1,x] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y-1, x]; + if (((LandPixels[y,x] and AMask) shr AShift) > 10) then LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (64 shl AShift) end; Land[y,x]:= lfObject end; @@ -1220,6 +1223,25 @@ LoadMask(mapname); end; +procedure DrawBottomBorder; // broken out from other borders for doing a floor-only map, or possibly updating bottom during SD +var x, y, w, c: Longword; +begin +for w:= 0 to 23 do + for x:= leftX to rightX do + begin + Land[cWaterLine-1 - w, x]:= lfIndestructible; + if (x + w) mod 32 < 16 then + c:= AMask + else + c:= AMask or RMask or GMask; // FF00FFFF + + if (cReducedQuality and rqBlurryLand) = 0 then + LandPixels[cWaterLine-1 - w, x]:= c + else + LandPixels[(cWaterLine-1 - w) div 2, x div 2]:= c + end +end; + procedure GenMap; var x, y, w, c: Longword; begin @@ -1270,7 +1292,7 @@ for w:= 0 to 5 do // width of 3 allowed hogs to be knocked through with grenade begin for y:= topY to LAND_HEIGHT - 1 do - begin + begin Land[y, leftX + w]:= lfIndestructible; Land[y, rightX - w]:= lfIndestructible; if (y + w) mod 32 < 16 then @@ -1279,33 +1301,35 @@ c:= AMask or RMask or GMask; // FF00FFFF if (cReducedQuality and rqBlurryLand) = 0 then - begin + begin LandPixels[y, leftX + w]:= c; LandPixels[y, rightX - w]:= c; - end + end else - begin + begin LandPixels[y div 2, (leftX + w) div 2]:= c; LandPixels[y div 2, (rightX - w) div 2]:= c; + end; end; - end; for x:= leftX to rightX do begin - Land[topY + w, x]:= lfIndestructible; - if (x + w) mod 32 < 16 then - c:= AMask - else - c:= AMask or RMask or GMask; // FF00FFFF + Land[topY + w, x]:= lfIndestructible; + if (x + w) mod 32 < 16 then + c:= AMask + else + c:= AMask or RMask or GMask; // FF00FFFF - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[topY + w, x]:= c - else - LandPixels[(topY + w) div 2, x div 2]:= c; + if (cReducedQuality and rqBlurryLand) = 0 then + LandPixels[topY + w, x]:= c + else + LandPixels[(topY + w) div 2, x div 2]:= c; end; end; end; +if (GameFlags and gfBottomBorder) <> 0 then DrawBottomBorder; + if (GameFlags and gfDisableGirders) <> 0 then hasGirders:= false; if ((GameFlags and gfForts) = 0) diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uLandGraphics.pas Thu Sep 01 17:03:19 2011 +0200 @@ -47,24 +47,30 @@ function addBgColor(OldColor, NewColor: LongWord): LongWord; // Factor ranges from 0 to 100% NewColor var - oRed, oBlue, oGreen, oAlpha, nRed, nBlue, nGreen, nAlpha: Byte; + oRed, oBlue, oGreen, oAlpha, nRed, nBlue, nGreen, nAlpha: LongWord; begin + oAlpha := (OldColor shr AShift) and $FF; + nAlpha := (NewColor shr AShift) and $FF; + // shortcircuit + if (oAlpha = 0) or (nAlpha = $FF) then + begin + addBgColor:= NewColor; + exit + end; // Get colors - oAlpha := (OldColor shr AShift) and $FF; oRed := (OldColor shr RShift) and $FF; oGreen := (OldColor shr GShift) and $FF; oBlue := (OldColor shr BShift) and $FF; - nAlpha := (NewColor shr AShift) and $FF; nRed := (NewColor shr RShift) and $FF; nGreen := (NewColor shr GShift) and $FF; nBlue := (NewColor shr BShift) and $FF; // Mix colors + nRed := min(255,((nRed*nAlpha) div 255) + ((oRed*oAlpha*(255-nAlpha)) div 65025)); + nGreen := min(255,((nGreen*nAlpha) div 255) + ((oGreen*oAlpha*(255-nAlpha)) div 65025)); + nBlue := min(255,((nBlue*nAlpha) div 255) + ((oBlue*oAlpha*(255-nAlpha)) div 65025)); nAlpha := min(255, oAlpha + nAlpha); - nRed := ((oRed * oAlpha) + (nRed * Byte(255-oAlpha))) div 255; - nGreen := ((oGreen * oAlpha) + (nGreen * Byte(255-oAlpha))) div 255; - nBlue := ((oBlue * oAlpha) + (nBlue * Byte(255-oAlpha))) div 255; addBgColor := (nAlpha shl AShift) or (nRed shl RShift) or (nGreen shl GShift) or (nBlue shl BShift); end; @@ -782,14 +788,16 @@ begin if (cReducedQuality and rqBlurryLand) = 0 then begin - if (LandPixels[y,x] = 0) then LandPixels[y,x]:= (cExplosionBorderColor and not AMask) or (128 shl AShift) + if ((LandPixels[y,x] and AMask) shr AShift) < 10 then LandPixels[y,x]:= (cExplosionBorderColor and not AMask) or (128 shl AShift) else LandPixels[y,x]:= (((((LandPixels[y,x] and RMask shr RShift) div 2)+((cExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or (((((LandPixels[y,x] and GMask shr GShift) div 2)+((cExplosionBorderColor and GMask) shr GShift) div 2) and $FF) shl GShift) or (((((LandPixels[y,x] and BMask shr BShift) div 2)+((cExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift) end; - Land[y,x]:= lfBasic + if (Land[y, x-1] = lfObject) then Land[y,x]:= lfObject + else if (Land[y, x+1] = lfObject) then Land[y,x]:= lfObject + else Land[y,x]:= lfBasic; end else if ((((Land[y, x-1] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y+2,x] and lfDamaged) <> 0)) or (((Land[y, x-1] and lfDamaged) <> 0) and ((Land[y-1,x-1] and lfDamaged) <> 0) and ((Land[y-2,x] and lfDamaged) <> 0)) or @@ -802,14 +810,18 @@ begin if (cReducedQuality and rqBlurryLand) = 0 then begin - if (LandPixels[y,x] = 0) then LandPixels[y,x]:= (cExplosionBorderColor and not AMask) or (64 shl AShift) + if ((LandPixels[y,x] and AMask) shr AShift) < 10 then LandPixels[y,x]:= (cExplosionBorderColor and not AMask) or (64 shl AShift) else LandPixels[y,x]:= (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((cExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or (((((LandPixels[y,x] and GMask shr GShift) * 3 div 4)+((cExplosionBorderColor and GMask) shr GShift) div 4) and $FF) shl GShift) or (((((LandPixels[y,x] and BMask shr BShift) * 3 div 4)+((cExplosionBorderColor and BMask) shr BShift) div 4) and $FF) shl BShift) or ($FF shl AShift) end; - Land[y,x]:= lfBasic + if (Land[y, x-1] = lfObject) then Land[y, x]:= lfObject + else if (Land[y, x+1] = lfObject) then Land[y, x]:= lfObject + else if (Land[y+1, x] = lfObject) then Land[y, x]:= lfObject + else if (Land[y-1, x] = lfObject) then Land[y, x]:= lfObject + else Land[y,x]:= lfBasic end end end; diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uLandObjects.pas Thu Sep 01 17:03:19 2011 +0200 @@ -409,24 +409,24 @@ if key = 'sky' then begin i:= Pos(',', s); - c1.r:= StrToInt(Trim(Copy(s, 1, Pred(i)))); + SkyColor.r:= StrToInt(Trim(Copy(s, 1, Pred(i)))); Delete(s, 1, i); i:= Pos(',', s); - c1.g:= StrToInt(Trim(Copy(s, 1, Pred(i)))); + SkyColor.g:= StrToInt(Trim(Copy(s, 1, Pred(i)))); Delete(s, 1, i); - c1.b:= StrToInt(Trim(s)); + SkyColor.b:= StrToInt(Trim(s)); if cGrayScale then begin - t:= round(c1.r * RGB_LUMINANCE_RED + c1.g * RGB_LUMINANCE_GREEN + c1.b * RGB_LUMINANCE_BLUE); + t:= round(SkyColor.r * RGB_LUMINANCE_RED + SkyColor.g * RGB_LUMINANCE_GREEN + SkyColor.b * RGB_LUMINANCE_BLUE); if t > 255 then t:= 255; - c1.r:= t; - c1.g:= t; - c1.b:= t + SkyColor.r:= t; + SkyColor.g:= t; + SkyColor.b:= t end; - glClearColor(c1.r / 255, c1.g / 255, c1.b / 255, 0.99); - SDSkyColor.r:= byte(c1.r * SDTint div 255); - SDSkyColor.g:= byte(c1.g * SDTint div 255); - SDSkyColor.b:= byte(c1.b * SDTint div 255); + glClearColor(SkyColor.r / 255, SkyColor.g / 255, SkyColor.b / 255, 0.99); + SDSkyColor.r:= SkyColor.r; + SDSkyColor.g:= SkyColor.g; + SDSkyColor.b:= SkyColor.b; end else if key = 'border' then begin @@ -646,24 +646,24 @@ if ((cReducedQuality and rqNoBackground) <> 0) then begin i:= Pos(',', s); - c1.r:= StrToInt(Trim(Copy(s, 1, Pred(i)))); + RQSkyColor.r:= StrToInt(Trim(Copy(s, 1, Pred(i)))); Delete(s, 1, i); i:= Pos(',', s); - c1.g:= StrToInt(Trim(Copy(s, 1, Pred(i)))); + RQSkyColor.g:= StrToInt(Trim(Copy(s, 1, Pred(i)))); Delete(s, 1, i); - c1.b:= StrToInt(Trim(s)); + RQSkyColor.b:= StrToInt(Trim(s)); if cGrayScale then begin - t:= round(c1.r * RGB_LUMINANCE_RED + c1.g * RGB_LUMINANCE_GREEN + c1.b * RGB_LUMINANCE_BLUE); + t:= round(RQSkyColor.r * RGB_LUMINANCE_RED + RQSkyColor.g * RGB_LUMINANCE_GREEN + RQSkyColor.b * RGB_LUMINANCE_BLUE); if t > 255 then t:= 255; - c1.r:= t; - c1.g:= t; - c1.b:= t + RQSkyColor.r:= t; + RQSkyColor.g:= t; + RQSkyColor.b:= t end; - glClearColor(c1.r / 255, c1.g / 255, c1.b / 255, 0.99); - SDSkyColor.r:= byte(c1.r * SDTint div 255); - SDSkyColor.g:= byte(c1.g * SDTint div 255); - SDSkyColor.b:= byte(c1.b * SDTint div 255); + glClearColor(RQSkyColor.r / 255, RQSkyColor.g / 255, RQSkyColor.b / 255, 0.99); + SDSkyColor.r:= RQSkyColor.r; + SDSkyColor.g:= RQSkyColor.g; + SDSkyColor.b:= RQSkyColor.b; end end end; diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uLandTexture.pas --- a/hedgewars/uLandTexture.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uLandTexture.pas Thu Sep 01 17:03:19 2011 +0200 @@ -26,6 +26,7 @@ procedure freeModule; procedure UpdateLandTexture(X, Width, Y, Height: LongInt); procedure DrawLand(dX, dY: LongInt); +procedure ResetLand; implementation uses uConsts, GLunit, uTypes, uVariables, uTextures, uDebug, uRender; @@ -122,29 +123,34 @@ procedure initModule; begin if (cReducedQuality and rqBlurryLand) = 0 then - begin + begin LANDTEXARW:= LAND_WIDTH div TEXSIZE; LANDTEXARH:= LAND_HEIGHT div TEXSIZE; - end + end else - begin + begin LANDTEXARW:= (LAND_WIDTH div TEXSIZE) div 2; LANDTEXARH:= (LAND_HEIGHT div TEXSIZE) div 2; - end; + end; SetLength(LandTextures, LANDTEXARW, LANDTEXARH); end; -procedure freeModule; +procedure ResetLand; var x, y: LongInt; begin for x:= 0 to LANDTEXARW -1 do for y:= 0 to LANDTEXARH - 1 do with LandTextures[x, y] do - begin - FreeTexture(tex); + begin + if tex <> nil then FreeTexture(tex); tex:= nil; - end; + end; +end; + +procedure freeModule; +begin + ResetLand; if LandBackSurface <> nil then SDL_FreeSurface(LandBackSurface); LandBackSurface:= nil; diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uScript.pas Thu Sep 01 17:03:19 2011 +0200 @@ -282,9 +282,9 @@ else begin if lua_gettop(L) = 3 then health:= lua_tointeger(L, 3) else health:= cHealthCaseAmount; - gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), - HealthCrate, health); - lua_pushinteger(L, gear^.uid); + gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), HealthCrate, health); + if gear <> nil then lua_pushinteger(L, gear^.uid) + else lua_pushnil(L); end; lc_spawnhealthcrate := 1; end; @@ -297,9 +297,9 @@ lua_pushnil(L); end else begin - gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), - AmmoCrate, lua_tointeger(L, 3)); - lua_pushinteger(L, gear^.uid); + gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), AmmoCrate, lua_tointeger(L, 3)); + if gear <> nil then lua_pushinteger(L, gear^.uid) + else lua_pushnil(L); end; lc_spawnammocrate := 1; end; @@ -314,7 +314,8 @@ else begin gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), UtilityCrate, lua_tointeger(L, 3)); - lua_pushinteger(L, gear^.uid); + if gear <> nil then lua_pushinteger(L, gear^.uid) + else lua_pushnil(L); end; lc_spawnutilitycrate := 1; end; @@ -943,6 +944,25 @@ lc_addammo:= 0 end; +function lc_getammocount(L : Plua_State) : LongInt; Cdecl; +var gear : PGear; + ammo : PAmmo; +begin + if (lua_gettop(L) = 2) then + begin + gear:= GearByUID(lua_tointeger(L, 1)); + if (gear <> nil) and (gear^.Hedgehog <> nil) then + begin + ammo:= GetAmmoEntry(gear^.Hedgehog^, TAmmoType(lua_tointeger(L, 2))); + if ammo^.AmmoType = amNothing then lua_pushinteger(L, 0) + else lua_pushinteger(L, ammo^.Count) + end + else lua_pushinteger(L, 0) + end + else LuaError('Lua: Wrong number of parameters passed to GetAmmoCount!'); + lc_getammocount:= 0 +end; + function lc_sethealth(L : Plua_State) : LongInt; Cdecl; var gear : PGear; begin @@ -1547,6 +1567,8 @@ // push game variables so they may be modified by the script ScriptSetInteger('GameFlags', GameFlags); ScriptSetString('Seed', cSeed); +ScriptSetInteger('TemplateFilter', cTemplateFilter); +ScriptSetInteger('MapGen', cMapGen); ScriptSetInteger('ScreenHeight', cScreenHeight); ScriptSetInteger('ScreenWidth', cScreenWidth); ScriptSetInteger('TurnTime', cHedgehogTurnTime); @@ -1571,6 +1593,8 @@ // pop game variables ParseCommand('seed ' + ScriptGetString('Seed'), true); +ParseCommand('template_filter ' + IntToStr(ScriptGetInteger('TemplateFilter')), true); +ParseCommand('mapgen ' + IntToStr(ScriptGetInteger('MapGen')), true); ParseCommand('$gmflags ' + ScriptGetString('GameFlags'), true); ParseCommand('$turntime ' + ScriptGetString('TurnTime'), true); ParseCommand('$casefreq ' + ScriptGetString('CaseFreq'), true); @@ -1630,6 +1654,7 @@ ScriptSetInteger('GameTime', GameTicks); ScriptSetInteger('RealTime', RealTicks); ScriptSetInteger('TotalRounds', TotalRounds); +ScriptSetInteger('WaterLine', cWaterLine); if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) then ScriptSetInteger('CurrentHedgehog', CurrentHedgehog^.Gear^.UID) else @@ -1926,6 +1951,7 @@ lua_register(luaState, 'AddTeam', @lc_addteam); lua_register(luaState, 'AddHog', @lc_addhog); lua_register(luaState, 'AddAmmo', @lc_addammo); +lua_register(luaState, 'GetAmmoCount', @lc_getammocount); lua_register(luaState, 'SetHealth', @lc_sethealth); lua_register(luaState, 'GetHealth', @lc_gethealth); lua_register(luaState, 'SetEffect', @lc_seteffect); diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uSound.pas --- a/hedgewars/uSound.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uSound.pas Thu Sep 01 17:03:19 2011 +0200 @@ -301,7 +301,7 @@ procedure PlayNextVoice; var i : LongInt; begin - if (not isSoundEnabled) or fastUntilLag or (LastVoice.snd = sndNone) or (lastChan[LastVoice.snd] = -1) or (Mix_Playing(lastChan[LastVoice.snd]) = 0) then exit; + if (not isSoundEnabled) or fastUntilLag or ((LastVoice.snd <> sndNone) and (lastChan[LastVoice.snd] <> -1) and (Mix_Playing(lastChan[LastVoice.snd]) <> 0)) then exit; i:= 0; while (i<8) and (VoiceList[i].snd = sndNone) do inc(i); diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uStore.pas Thu Sep 01 17:03:19 2011 +0200 @@ -44,10 +44,10 @@ implementation uses uMisc, uConsole, uMobile, uVariables, uUtils, uTextures, uRender, uRenderUtils, uCommands, uDebug; -type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple); +//type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple); var MaxTextureSize: LongInt; - cGPUVendor: TGPUVendor; +// cGPUVendor: TGPUVendor; function WriteInRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: ansistring): TSDL_Rect; var w, h: LongInt; @@ -259,18 +259,20 @@ tmpsurf: PSDL_Surface; i: LongInt; begin +AddFileLog('StoreLoad()'); -for fi:= Low(THWFont) to High(THWFont) do - with Fontz[fi] do - begin - s:= UserPathz[ptFonts] + '/' + Name; - if not FileExists(s) then s:= Pathz[ptFonts] + '/' + Name; - WriteToConsole(msgLoading + s + ' (' + inttostr(Height) + 'pt)... '); - Handle:= TTF_OpenFont(Str2PChar(s), Height); - SDLTry(Handle <> nil, true); - TTF_SetFontStyle(Handle, style); - WriteLnToConsole(msgOK) - end; +if not reload then + for fi:= Low(THWFont) to High(THWFont) do + with Fontz[fi] do + begin + s:= UserPathz[ptFonts] + '/' + Name; + if not FileExists(s) then s:= Pathz[ptFonts] + '/' + Name; + WriteToConsole(msgLoading + s + ' (' + inttostr(Height) + 'pt)... '); + Handle:= TTF_OpenFont(Str2PChar(s), Height); + SDLTry(Handle <> nil, true); + TTF_SetFontStyle(Handle, style); + WriteLnToConsole(msgOK) + end; WriteNames(fnt16); MakeCrossHairs; @@ -345,10 +347,10 @@ // This should maybe be flagged. It wastes quite a bit of memory. if not reload then begin -{$IFNDEF DARWIN & WIN32} +{$IF DEFINED(DARWIN) OR DEFINED(WIN32)} + Surface:= tmpsurf +{$ELSE} if saveSurf then Surface:= tmpsurf else SDL_FreeSurface(tmpsurf) -{$ELSE} - Surface:= tmpsurf {$ENDIF} end end @@ -563,11 +565,28 @@ {$ENDIF} end; +procedure SetupOpenGLAttributes; +begin +{$IFDEF IPHONEOS} + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0); + SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 1); +{$ELSE} + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); +{$IFNDEF SDL13} // vsync is default in 1.3 + SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, LongInt((cReducedQuality and rqDesyncVBlank) = 0)); +{$ENDIF} +{$ENDIF} + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0); // no depth buffer + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); // no alpha channel required + SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 16); // buffer has to be 16 bit only + SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); // try to prefer hardware rendering +end; + procedure SetupOpenGL; -var vendor: shortstring = ''; -{$IFDEF DARWIN} -const one : LongInt = 1; -{$ENDIF} +//var vendor: shortstring = ''; begin {$IFDEF SDL13} // this function creates an opengles1.1 context by default on mobile devices @@ -577,39 +596,8 @@ SDL_GL_SetSwapInterval(1); {$ENDIF} -{$IFDEF IPHONEOS} - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0); - SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 1); - vendor:= vendor; // avoid hint - one:= one; // avoid hint -{$ELSE} - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - vendor:= LowerCase(shortstring(pchar(glGetString(GL_VENDOR)))); -{$IFNDEF SDL13} -// this attribute is default in 1.3 and must be enabled in MacOSX - SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, LongInt((cReducedQuality and rqDesyncVBlank) = 0)); - -{$IFDEF DARWIN} -// fixes vsync in Snow Leopard - CGLSetParameter(CGLGetCurrentContext(), 222, @one); -{$ENDIF} -{$ENDIF} -{$ENDIF} - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0); // no depth buffer - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); // no alpha channel required - SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 16); // buffer has to be 16 bit only - SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); // try to prefer hardware rendering - + // get the max (horizontal and vertical) size for textures that the gpu can support glGetIntegerv(GL_MAX_TEXTURE_SIZE, @MaxTextureSize); - - AddFileLog('OpenGL-- Renderer: ' + shortstring(pchar(glGetString(GL_RENDERER)))); - AddFileLog(' |----- Vendor: ' + shortstring(pchar(glGetString(GL_VENDOR)))); - AddFileLog(' |----- Version: ' + shortstring(pchar(glGetString(GL_VERSION)))); - AddFileLog(' \----- GL_MAX_TEXTURE_SIZE: ' + inttostr(MaxTextureSize)); - if MaxTextureSize <= 0 then begin MaxTextureSize:= 1024; @@ -621,17 +609,30 @@ AddFileLog('Texture size too small for backgrounds, disabling.'); end; +(* // find out which gpu we are using (for extension compatibility maybe?) {$IFDEF IPHONEOS} + vendor:= vendor; // avoid hint cGPUVendor:= gvApple; {$ELSE} + vendor:= LowerCase(shortstring(pchar(glGetString(GL_VENDOR)))); if StrPos(Str2PChar(vendor), Str2PChar('nvidia')) <> nil then cGPUVendor:= gvNVIDIA else if StrPos(Str2PChar(vendor), Str2PChar('intel')) <> nil then cGPUVendor:= gvATI else if StrPos(Str2PChar(vendor), Str2PChar('ati')) <> nil then - cGPUVendor:= gvIntel; + cGPUVendor:= gvIntel + else + AddFileLog('OpenGL Warning - unknown hardware vendor; please report'); {$ENDIF} //SupportNPOTT:= glLoadExtension('GL_ARB_texture_non_power_of_two'); +*) + + // everyone love debugging + AddFileLog('OpenGL-- Renderer: ' + shortstring(pchar(glGetString(GL_RENDERER)))); + AddFileLog(' |----- Vendor: ' + shortstring(pchar(glGetString(GL_VENDOR)))); + AddFileLog(' |----- Version: ' + shortstring(pchar(glGetString(GL_VERSION)))); + AddFileLog(' \----- Texture Size: ' + inttostr(MaxTextureSize)); + {$IFNDEF S3D_DISABLED} if (cStereoMode = smHorizontal) or (cStereoMode = smVertical) or (cStereoMode = smAFR) then begin @@ -674,9 +675,6 @@ end; {$ENDIF} - if cGPUVendor = gvUnknown then - AddFileLog('OpenGL Warning - unknown hardware vendor; please report'); - // set view port to whole window if (rotationQt = 0) or (rotationQt = 180) then glViewport(0, 0, cScreenWidth, cScreenHeight) @@ -760,7 +758,6 @@ SDL_GL_SwapBuffers(); {$ENDIF} inc(Step); - end; procedure FinishProgress; @@ -768,6 +765,7 @@ WriteLnToConsole('Freeing progress surface... '); FreeTexture(ProgrTex); uMobile.GameLoaded(); + Step:= 0 end; function RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture; @@ -952,50 +950,48 @@ reinit: boolean; {$IFDEF SDL13}x, y: LongInt;{$ENDIF} begin - s:= s; // avoid compiler hint if Length(s) = 0 then cFullScreen:= not cFullScreen else cFullScreen:= s = '1'; buf[0]:= char(0); // avoid compiler hint - AddFileLog('Prepare to change video parameters...'); - - flags:= SDL_OPENGL;// or SDL_RESIZABLE; - - if cFullScreen then - flags:= flags or SDL_FULLSCREEN; + AddFileLog('Preparing to change video parameters...'); + reinit:= false; + if SDLPrimSurface = nil then + begin + // set window title + SDL_WM_SetCaption('Hedgewars', nil); {$IFDEF SDL_IMAGE_NEWER} - WriteToConsole('Init SDL_image... '); - SDLTry(IMG_Init(IMG_INIT_PNG) <> 0, true); - WriteLnToConsole(msgOK); + WriteToConsole('Init SDL_image... '); + SDLTry(IMG_Init(IMG_INIT_PNG) <> 0, true); + WriteLnToConsole(msgOK); {$ENDIF} - // load engine icon + // load engine icon {$IFDEF DARWIN} - ico:= LoadImage(UserPathz[ptGraphics] + '/hwengine_mac', ifIgnoreCaps); - if ico = nil then ico:= LoadImage(Pathz[ptGraphics] + '/hwengine_mac', ifIgnoreCaps); + ico:= LoadImage(UserPathz[ptGraphics] + '/hwengine_mac', ifIgnoreCaps); + if ico = nil then ico:= LoadImage(Pathz[ptGraphics] + '/hwengine_mac', ifIgnoreCaps); {$ELSE} - ico:= LoadImage(UserPathz[ptGraphics] + '/hwengine', ifIgnoreCaps); - if ico = nil then ico:= LoadImage(Pathz[ptGraphics] + '/hwengine', ifIgnoreCaps); + ico:= LoadImage(UserPathz[ptGraphics] + '/hwengine', ifIgnoreCaps); + if ico = nil then ico:= LoadImage(Pathz[ptGraphics] + '/hwengine', ifIgnoreCaps); {$ENDIF} - if ico <> nil then - begin - SDL_WM_SetIcon(ico, 0); - SDL_FreeSurface(ico) - end; - - // set window title - SDL_WM_SetCaption('Hedgewars', nil); - reinit:= false; - if SDLPrimSurface <> nil then - begin -{$IFDEF DARWIN | WIN32} + if ico <> nil then + begin + SDL_WM_SetIcon(ico, 0); + SDL_FreeSurface(ico) + end; + end + else + begin +{$IF DEFINED(DARWIN) OR DEFINED(WIN32)} reinit:= true; {$ENDIF} AddFileLog('Freeing old primary surface...'); SDL_FreeSurface(SDLPrimSurface); SDLPrimSurface:= nil; - end; + end; + // these attributes must be set up before creating the sdl window + SetupOpenGLAttributes(); {$IFDEF SDL13} // these values in x and y make the window appear in the center x:= SDL_WINDOWPOS_CENTERED_MASK; @@ -1007,12 +1003,18 @@ x:= x or (SDL_GetNumVideoDisplays() - 1); y:= y or (SDL_GetNumVideoDisplays() - 1); - flags:= flags or SDL_WINDOW_BORDERLESS; // do not use SDL_WINDOW_RESIZABLE on ios (yet) + SDL_SetHint('SDL_IOS_ORIENTATIONS','LandscapeLeft LandscapeRight'); + flags:= flags or SDL_WINDOW_BORDERLESS or SDL_WINDOW_RESIZABLE; {$ENDIF} - SDLwindow:= SDL_CreateWindow('Hedgewars', x, y, cScreenWidth, cScreenHeight, flags); + if cFullScreen then SDLwindow:= SDL_CreateWindow('Hedgewars', x, y, cOrigScreenWidth, cOrigScreenHeight, flags or SDL_WINDOW_FULLSCREEN) + else SDLwindow:= SDL_CreateWindow('Hedgewars', x, y, cScreenWidth, cScreenHeight, flags); SDLTry(SDLwindow <> nil, true); {$ELSE} + flags:= SDL_OPENGL or SDL_RESIZABLE; + if cFullScreen then + flags:= flags or SDL_FULLSCREEN; + if not cOnlyStats then begin {$IFDEF WIN32} @@ -1029,8 +1031,17 @@ SetupOpenGL(); if reinit then begin + if SuddenDeathDmg then + glClearColor(SDSkyColor.r * (SDTint/255) / 255, SDSkyColor.g * (SDTint/255) / 255, SDSkyColor.b * (SDTint/255) / 255, 0.99) + else if ((cReducedQuality and rqNoBackground) = 0) then + glClearColor(SkyColor.r / 255, SkyColor.g / 255, SkyColor.b / 255, 0.99) + else glClearColor(RQSkyColor.r / 255, RQSkyColor.g / 255, RQSkyColor.b / 255, 0.99); + StoreRelease(true); StoreLoad(true); + + ResetLand; + UpdateLandTexture(0, LAND_WIDTH, 0, LAND_HEIGHT) end; end; @@ -1043,15 +1054,12 @@ SDLPrimSurface:= nil; -{$IFNDEF IPHONEOS} rotationQt:= 0; - cGPUVendor:= gvUnknown; -{$ENDIF} - cScaleFactor:= 2.0; - SupportNPOTT:= false; Step:= 0; ProgrTex:= nil; + SupportNPOTT:= false; +// cGPUVendor:= gvUnknown; // init all ammo name texture pointers for ai:= Low(TAmmoType) to High(TAmmoType) do diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uTypes.pas --- a/hedgewars/uTypes.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uTypes.pas Thu Sep 01 17:03:19 2011 +0200 @@ -36,7 +36,7 @@ end; // Possible states of the game - TGameState = (gsLandGen, gsStart, gsGame, gsChat, gsConfirm, gsExit, gsSuspend); + TGameState = (gsLandGen, gsStart, gsGame, gsChat, gsConfirm, gsExit); // Game types that help determining what the engine is actually supposed to do TGameType = (gmtLocal, gmtDemo, gmtNet, gmtSave, gmtLandPreview, gmtSyntax); @@ -82,7 +82,7 @@ sprSMineOff, sprSMineOn, sprHandSMine, sprHammer, sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb, sprBulletHit, sprSnowball, sprHandSnowball, sprSnow, - sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprFireButton + sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprTardis, sprFireButton ); // Gears that interact with other Gears and/or Land diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uVariables.pas Thu Sep 01 17:03:19 2011 +0200 @@ -25,8 +25,12 @@ var /////// init flags /////// - cScreenWidth : LongInt = 1024; - cScreenHeight : LongInt = 768; + cMinScreenWidth : LongInt = 480; + cMinScreenHeight : LongInt = 320; + cScreenWidth : LongInt = 1024; + cScreenHeight : LongInt = 768; + cOrigScreenWidth : LongInt = 1024; + cOrigScreenHeight : LongInt = 768; cBits : LongInt = 32; ipcPort : Word = 0; cFullScreen : boolean = false; @@ -614,6 +618,8 @@ Width: 80; Height: 50; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSDSplash (FileName: 'SDDroplet'; Path: ptCurrTheme; AltPath: ptSuddenDeath; Texture: nil; Surface: nil; Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprSDDroplet + (FileName: 'Egg'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;//TODO change back 'Egg' to 'Tardis' + Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: true; getImageDimensions: true),// sprTardis (FileName: 'firebutton'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil; Width: 450; Height: 150; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true) // sprFireButton ); @@ -2299,7 +2305,7 @@ bShowFinger: boolean; Frames: Longword; WaterColor, DeepWaterColor: TSDL_Color; - SDSkyColor: TSDL_Color; + SkyColor, RQSkyColor, SDSkyColor: TSDL_Color; SkyOffset: LongInt; HorizontOffset: LongInt; {$IFDEF COUNTTICKS} diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uVisualGears.pas Thu Sep 01 17:03:19 2011 +0200 @@ -229,6 +229,7 @@ end; vgtSmokeWhite, vgtSmoke: begin + Scale:= 1.0; dx:= 0.0002 * (random(45) + 10); dy:= 0.0002 * (random(45) + 10); if random(2) = 0 then dx := -dx; @@ -535,7 +536,7 @@ end; if (cReducedQuality and rqAntiBoom) = 0 then case Gear^.Kind of - vgtSmoke: DrawSprite(sprSmoke, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame); + vgtSmoke: DrawTextureF(SpritesData[sprSmoke].Texture, Gear^.scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 7 - Gear^.Frame, 0, SpritesData[sprSmoke].Width, SpritesData[sprSmoke].Height); vgtSmokeWhite: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame); vgtDust: if Gear^.State = 1 then DrawSprite(sprSnowDust, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame) diff -r ba4c3a4c8b09 -r e27100a0e2d0 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Thu Sep 01 14:55:31 2011 +0200 +++ b/hedgewars/uWorld.pas Thu Sep 01 17:03:19 2011 +0200 @@ -32,6 +32,7 @@ procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt); procedure HideMission; procedure ShakeCamera(amount: LongWord); +procedure InitCameraBorders; procedure MoveCamera; procedure onFocusStateChanged; @@ -175,7 +176,7 @@ //cWaveHeight:= SpritesData[sprWater].Height; cWaveHeight:= 32; -cGearScrEdgesDist:= Min(cScreenWidth div 2 - 100, cScreenHeight div 2 - 50); +InitCameraBorders(); uCursor.init(); prevPoint.X:= 0; prevPoint.Y:= cScreenHeight div 2; @@ -196,6 +197,10 @@ HorizontOffset:= 0; end; +procedure InitCameraBorders; +begin +cGearScrEdgesDist:= min(2 * cScreenHeight div 5, 2 * cScreenWidth div 5); +end; procedure ShowAmmoMenu; const MENUSPEED = 15; @@ -1164,7 +1169,7 @@ with CurrentHedgehog^ do if (Gear <> nil) and ((Gear^.State and gstHHChooseTarget) <> 0) then begin - if CurAmmoType = amNapalm then + if (CurAmmoType = amNapalm) or (CurAmmoType = amMineStrike) then DrawLine(-3000, topY-300, 7000, topY-300, 3.0, (Team^.Clan^.Color shr 16), (Team^.Clan^.Color shr 8) and $FF, Team^.Clan^.Color and $FF, $FF); i:= GetAmmoEntry(CurrentHedgehog^)^.Pos; with Ammoz[CurAmmoType] do diff -r ba4c3a4c8b09 -r e27100a0e2d0 misc/libfreetype/Xcode-iPhoneOS/Freetype.xcodeproj/project.pbxproj --- a/misc/libfreetype/Xcode-iPhoneOS/Freetype.xcodeproj/project.pbxproj Thu Sep 01 14:55:31 2011 +0200 +++ b/misc/libfreetype/Xcode-iPhoneOS/Freetype.xcodeproj/project.pbxproj Thu Sep 01 17:03:19 2011 +0200 @@ -1102,7 +1102,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../include\""; - IPHONEOS_DEPLOYMENT_TARGET = 3.1; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; OTHER_LDFLAGS = "-ObjC"; PREBINDING = NO; SDKROOT = iphoneos; @@ -1126,7 +1126,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../include\""; - IPHONEOS_DEPLOYMENT_TARGET = 3.1; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; OTHER_LDFLAGS = "-ObjC"; PREBINDING = NO; SDKROOT = iphoneos; diff -r ba4c3a4c8b09 -r e27100a0e2d0 misc/liblua/Xcode/Lua.xcodeproj/project.pbxproj --- a/misc/liblua/Xcode/Lua.xcodeproj/project.pbxproj Thu Sep 01 14:55:31 2011 +0200 +++ b/misc/liblua/Xcode/Lua.xcodeproj/project.pbxproj Thu Sep 01 17:03:19 2011 +0200 @@ -392,7 +392,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 3.1; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; OTHER_LDFLAGS = "-ObjC"; PREBINDING = NO; SDKROOT = iphoneos; @@ -410,7 +410,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 3.1; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; OTHER_LDFLAGS = "-ObjC"; PREBINDING = NO; SDKROOT = iphoneos; diff -r ba4c3a4c8b09 -r e27100a0e2d0 misc/libtremor/Xcode/Tremor.xcodeproj/project.pbxproj --- a/misc/libtremor/Xcode/Tremor.xcodeproj/project.pbxproj Thu Sep 01 14:55:31 2011 +0200 +++ b/misc/libtremor/Xcode/Tremor.xcodeproj/project.pbxproj Thu Sep 01 17:03:19 2011 +0200 @@ -312,7 +312,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 3.1; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; OTHER_LDFLAGS = "-ObjC"; PREBINDING = NO; SDKROOT = iphoneos; @@ -330,7 +330,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 3.1; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; OTHER_LDFLAGS = "-ObjC"; PREBINDING = NO; SDKROOT = iphoneos; diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m --- a/project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m Thu Sep 01 17:03:19 2011 +0200 @@ -69,14 +69,7 @@ if (placingPoint.x == -1 || placingPoint.y == -1) placingPoint = container.center; - if (IS_DUALHEAD() == YES) { - UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; - if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight) - self.view.center = CGPointMake(placingPoint.y, placingPoint.x); - else - self.view.center = CGPointMake(placingPoint.x, placingPoint.y); - } else - self.view.center = CGPointMake(placingPoint.y, placingPoint.x); + self.view.center = placingPoint; self.isVisible = YES; if (IS_IPAD() == NO) @@ -87,8 +80,7 @@ if (self.isVisible) [self.view removeFromSuperview]; self.isVisible = NO; - placingPoint.x = self.view.center.y; - placingPoint.y = self.view.center.x; + placingPoint = self.view.center; if (IS_IPAD() == NO) HW_pauseToggle(); } diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/CommodityFunctions.h --- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.h Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.h Thu Sep 01 17:03:19 2011 +0200 @@ -63,6 +63,7 @@ #define IS_NOT_VERY_POWERFUL(x) ([x hasPrefix:@"iPad1"] || [x hasPrefix:@"iPhone2"] || [x hasPrefix:@"iPod3"] || [x hasPrefix:@"iPod4"]) #define IS_VERY_POWERFUL(x) (IS_NOT_POWERFUL(x) == NO && IS_NOT_VERY_POWERFUL(x) == NO) +#define UIVIEW_HW_SDLVIEW [[[[UIApplication sharedApplication] keyWindow] subviews] objectAtIndex:0] void print_free_memory (void); void playSound (NSString *snd); diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/CreationChamber.m --- a/project_files/HedgewarsMobile/Classes/CreationChamber.m Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/CreationChamber.m Thu Sep 01 17:03:19 2011 +0200 @@ -28,12 +28,8 @@ [settings setObject:[NSNumber numberWithBool:YES] forKey:@"music"]; [settings setObject:[NSNumber numberWithBool:YES] forKey:@"sound"]; [settings setObject:[NSNumber numberWithBool:NO] forKey:@"classic_menu"]; - [settings setObject:[NSNumber numberWithBool:YES] forKey:@"multitasking"]; [settings setObject:[NSNumber numberWithBool:YES] forKey:@"sync_ws"]; - // limit graphic usage on older devices - [settings setObject:[NSNumber numberWithBool:IS_VERY_POWERFUL(getModelType())] forKey:@"enhanced"]; - // don't overwrite these two strings when present if ([settings objectForKey:@"username"] == nil) [settings setObject:@"" forKey:@"username"]; diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/EditableCellView.m --- a/project_files/HedgewarsMobile/Classes/EditableCellView.m Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/EditableCellView.m Thu Sep 01 17:03:19 2011 +0200 @@ -36,6 +36,7 @@ textField.clearsOnBeginEditing = NO; textField.returnKeyType = UIReturnKeyDone; textField.adjustsFontSizeToFitWidth = YES; + textField.minimumFontSize = 9; textField.userInteractionEnabled = YES; textField.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; [textField addTarget:self action:@selector(save:) forControlEvents:UIControlEventEditingDidEndOnExit]; diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/GameConfigViewController.h --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.h Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.h Thu Sep 01 17:03:19 2011 +0200 @@ -25,6 +25,7 @@ @class MapConfigViewController; @class TeamConfigViewController; @class SchemeWeaponConfigViewController; +@class GameInterfaceBridge; @interface GameConfigViewController : UIViewController { UIView *imgContainer; @@ -33,6 +34,7 @@ MapConfigViewController *mapConfigViewController; TeamConfigViewController *teamConfigViewController; SchemeWeaponConfigViewController *schemeWeaponConfigViewController; + GameInterfaceBridge *interfaceBridge; } @property (retain) UIView *imgContainer; @@ -40,6 +42,7 @@ @property (nonatomic,retain) MapConfigViewController *mapConfigViewController; @property (nonatomic,retain) TeamConfigViewController *teamConfigViewController; @property (nonatomic,retain) SchemeWeaponConfigViewController *schemeWeaponConfigViewController; +@property (nonatomic,retain) GameInterfaceBridge *interfaceBridge; -(IBAction) buttonPressed:(id) sender; -(IBAction) segmentPressed:(id) sender; diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/GameConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Thu Sep 01 17:03:19 2011 +0200 @@ -30,7 +30,7 @@ #import "PascalImports.h" @implementation GameConfigViewController -@synthesize imgContainer, helpPage, mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController; +@synthesize imgContainer, helpPage, mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController, interfaceBridge; -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { @@ -230,11 +230,12 @@ script,@"mission_command", nil]; - GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self]; - - [bridge startLocalGame:gameDictionary]; - - [bridge release]; + if (self.interfaceBridge == nil) { + GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self]; + self.interfaceBridge = bridge; + [bridge release]; + } + [self.interfaceBridge startLocalGame:gameDictionary]; } -(void) loadNiceHogs { @@ -377,12 +378,15 @@ self.mapConfigViewController = nil; self.imgContainer = nil; + // don't nil this one or it won't be able to send messages + //self.interfaceBridge = nil; MSG_MEMCLEAN(); [super didReceiveMemoryWarning]; } -(void) viewDidUnload { self.imgContainer = nil; + self.interfaceBridge = nil; self.mapConfigViewController = nil; self.teamConfigViewController = nil; self.schemeWeaponConfigViewController = nil; @@ -393,6 +397,7 @@ -(void) dealloc { releaseAndNil(imgContainer); + releaseAndNil(interfaceBridge); releaseAndNil(mapConfigViewController); releaseAndNil(teamConfigViewController); releaseAndNil(schemeWeaponConfigViewController); diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/GameInterfaceBridge.h --- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.h Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.h Thu Sep 01 17:03:19 2011 +0200 @@ -38,7 +38,7 @@ TGameType gameType; } -@property (nonatomic,retain) UIViewController *parentController; +@property (assign) UIViewController *parentController; @property (nonatomic,retain) NSString *savePath; @property (nonatomic,retain) OverlayViewController *overlayController; diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m --- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Thu Sep 01 17:03:19 2011 +0200 @@ -45,7 +45,6 @@ } -(void) dealloc { - releaseAndNil(parentController); releaseAndNil(engineProtocol); releaseAndNil(savePath); releaseAndNil(overlayController); @@ -55,16 +54,16 @@ #pragma mark - // overlay with controls, become visible later, with a transparency effect since the sdlwindow is not yet created -(void) displayOverlayLater:(id) object { - [self.overlayController setInitialOrientation:self.parentController.interfaceOrientation]; - - UIWindow *gameWindow = (IS_DUALHEAD() ? [HedgewarsAppDelegate sharedAppDelegate].uiwindow : [[UIApplication sharedApplication] keyWindow]); - [gameWindow addSubview:self.overlayController.view]; + // in order to get rotation events we have to insert the view inside the first view of the second window + // when multihead we have to make sure that overlay is displayed in the touch-enabled window + UIView *injected = (IS_DUALHEAD() ? self.parentController.view : UIVIEW_HW_SDLVIEW); + [injected addSubview:self.overlayController.view]; } // main routine for calling the actual game engine -(void) startGameEngine { const char *gameArgs[11]; - NSInteger width, height, orientation; + NSInteger width, height; NSString *ipcString = [[NSString alloc] initWithFormat:@"%d", self.ipcPort]; NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]]; NSUserDefaults *settings = [NSUserDefaults standardUserDefaults]; @@ -73,18 +72,15 @@ CGRect screenBounds = [[[UIScreen screens] objectAtIndex:1] bounds]; width = (int) screenBounds.size.width; height = (int) screenBounds.size.height; - orientation = 0; } else { CGRect screenBounds = [[UIScreen mainScreen] bounds]; width = (int) screenBounds.size.height; height = (int) screenBounds.size.width; - orientation = (self.parentController.interfaceOrientation == UIDeviceOrientationLandscapeLeft) ? -90 : 90; } NSString *horizontalSize = [[NSString alloc] initWithFormat:@"%d", width]; NSString *verticalSize = [[NSString alloc] initWithFormat:@"%d", height]; - NSString *rotation = [[NSString alloc] initWithFormat:@"%d", orientation]; - BOOL enhanced = [[settings objectForKey:@"enhanced"] boolValue]; + NSString *rotation = [[NSString alloc] initWithString:@"0"]; NSString *modelId = getModelType(); NSInteger tmpQuality; @@ -92,7 +88,7 @@ tmpQuality = 0x00000001 | 0x00000002 | 0x00000008 | 0x00000040; // rqLowRes | rqBlurryLand | rqSimpleRope | rqKillFlakes else if ([modelId hasPrefix:@"iPhone2"] || [modelId hasPrefix:@"iPod3"]) // = iPhone 3GS or iPod Touch 3G tmpQuality = 0x00000002 | 0x00000040; // rqBlurryLand | rqKillFlakes - else if ([modelId hasPrefix:@"iPad1"] || [modelId hasPrefix:@"iPod4"] || enhanced == NO) // = iPad 1G or iPod Touch 4G or not enhanced mode + else if ([modelId hasPrefix:@"iPad1"] || [modelId hasPrefix:@"iPod4"]) // = iPad 1G or iPod Touch 4G tmpQuality = 0x00000002; // rqBlurryLand else // = everything else tmpQuality = 0; // full quality @@ -181,10 +177,6 @@ // warn our host that it's going to be visible again [self.parentController viewWillAppear:YES]; - // release the network manager and the savepath as they are not needed anymore - releaseAndNil(self.engineProtocol); - releaseAndNil(self.savePath); - if ([[userDefaults objectForKey:@"music"] boolValue]) [HedgewarsAppDelegate playBackgroundMusic]; } @@ -195,8 +187,10 @@ NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init]; [outputFormatter setDateFormat:@"yyyy-MM-dd '@' HH.mm"]; - self.savePath = [[NSString alloc] initWithFormat:@"%@%@.hws",SAVES_DIRECTORY(),[outputFormatter stringFromDate:[NSDate date]]]; + NSString *path = [[NSString alloc] initWithFormat:@"%@%@.hws",SAVES_DIRECTORY(),[outputFormatter stringFromDate:[NSDate date]]]; [outputFormatter release]; + self.savePath = path; + [path release]; // in the rare case in which a savefile with the same name exists the older one must be removed (or it gets corrupted) if ([[NSFileManager defaultManager] fileExistsAtPath:self.savePath]) @@ -209,7 +203,7 @@ // set up variables for a save game -(void) startSaveGame:(NSString *)atPath { self.gameType = gtSave; - self.savePath = [atPath retain]; + self.savePath = atPath; [self.engineProtocol spawnThread:self.savePath]; [self prepareEngineLaunch]; diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m --- a/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m Thu Sep 01 17:03:19 2011 +0200 @@ -87,12 +87,6 @@ case 90: //synched weapons/scheme [settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"sync_ws"]; break; - case 70: //enhanced graphics - [settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"enhanced"]; - break; - case 80: //nomultitasking - [settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"multitasking"]; - break; case 60: //classic menu [settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"classic_menu"]; break; @@ -126,7 +120,7 @@ return 2; break; case 2: // other options - return 5; + return 3; break; default: DLog(@"Nope"); @@ -240,21 +234,6 @@ switchContent.tag = 90; break; case 2: - cell.textLabel.text = NSLocalizedString(@"Multitasking", @""); - cell.detailTextLabel.text = NSLocalizedString(@"Disable it in case of issues when returing in game", @""); - switchContent.on = [[settings objectForKey:@"multitasking"] boolValue]; - switchContent.tag = 80; - break; - case 3: - cell.textLabel.text = NSLocalizedString(@"Enanched Graphics", @""); - cell.detailTextLabel.text = NSLocalizedString(@"Beware that the game will consume more memory", @""); - switchContent.on = [[settings objectForKey:@"enhanced"] boolValue]; - switchContent.tag = 70; - // prevent the oldest devices to even think about enabling it - if (IS_NOT_POWERFUL(getModelType())) - switchContent.enabled = NO; - break; - case 4: cell.textLabel.text = NSLocalizedString(@"Classic Ammo Menu", @""); cell.detailTextLabel.text = NSLocalizedString(@"Select which style of ammo menu you prefer",@""); switchContent.on = [[settings objectForKey:@"classic_menu"] boolValue]; @@ -282,6 +261,7 @@ #pragma mark - #pragma mark Table view delegate -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; if (0 == [indexPath section]) { EditableCellView *cell = (EditableCellView *)[aTableView cellForRowAtIndexPath:indexPath]; [cell replyKeyboard]; diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m --- a/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m Thu Sep 01 17:03:19 2011 +0200 @@ -65,7 +65,7 @@ AVAudioPlayer *background = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:musicString] error:nil]; background.delegate = nil; - background.volume = 0.5f; + background.volume = 0.4f; background.numberOfLoops = -1; [background prepareToPlay]; [HedgewarsAppDelegate sharedAppDelegate].backgroundMusic = background; @@ -122,54 +122,23 @@ } } --(void) applicationWillTerminate:(UIApplication *)application { - if (self.isInGame) - HW_terminate(YES); - - [super applicationWillTerminate:application]; -} - -(void) applicationDidReceiveMemoryWarning:(UIApplication *)application { + // don't stop music when it is playing + if (self.isInGame) { + [self.backgroundMusic stop]; + self.backgroundMusic = nil; + MSG_MEMCLEAN(); + } + print_free_memory(); // don't clean mainMenuViewController here!!! - [self.backgroundMusic stop]; - self.backgroundMusic = nil; - MSG_MEMCLEAN(); - print_free_memory(); } -//TODO: when the SDLUIKitDelegate methods applicationWillResignActive and applicationDidBecomeActive do work -// you'll be able to remove the methods below and just handle the SDL_WINDOWEVENT_MINIMIZED/SDL_WINDOWEVENT_RESTORED -// events in the MainLoop - -(void) applicationWillResignActive:(UIApplication *)application { - //[super applicationWillResignActive:application]; - - UIDevice *device = [UIDevice currentDevice]; - if ([device respondsToSelector:@selector(isMultitaskingSupported)] && - [device isMultitaskingSupported] && self.isInGame) { - // let's try to be permissive with multitasking here... - if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"multitasking"] boolValue]) - HW_suspend(); - else { - // so the game returns to the configuration view - if (isGameRunning()) - HW_terminate(NO); - else { - // while screen is loading you can't call HW_terminate() so we close the app - [self applicationWillTerminate:application]; - } - } - } + // true multitasking with sdl works only on 4.2 and above; we close the game to avoid a black screen at return + if (self.isInGame && ([[[UIDevice currentDevice] systemVersion] floatValue] < 4.2f)) + HW_terminate(NO); + [super applicationWillResignActive:application]; } --(void) applicationDidBecomeActive:(UIApplication *)application { - //[super applicationDidBecomeActive:application]; - - UIDevice *device = [UIDevice currentDevice]; - if ([device respondsToSelector:@selector(isMultitaskingSupported)] && - [device isMultitaskingSupported] && self.isInGame) { - HW_resume(); - } -} @end diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/InGameMenuViewController.m --- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m Thu Sep 01 17:03:19 2011 +0200 @@ -162,21 +162,12 @@ break; case 3: - // expand the view (and table) so that the actionsheet can be selected on the iPhone - if (IS_IPAD() == NO) { - CGRect screen = [[UIScreen mainScreen] bounds]; - [self.tableView deselectRowAtIndexPath:indexPath animated:NO]; - [UIView beginAnimations:@"table width more" context:NULL]; - [UIView setAnimationDuration:0.2]; - self.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width); - [UIView commitAnimations]; - } actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Are you reeeeeally sure?", @"") delegate:self cancelButtonTitle:NSLocalizedString(@"Well, maybe not...", @"") destructiveButtonTitle:NSLocalizedString(@"Of course!", @"") otherButtonTitles:nil]; - [actionSheet showInView:self.view]; + [actionSheet showInView:(IS_IPAD() ? self.view : UIVIEW_HW_SDLVIEW)]; [actionSheet release]; break; @@ -191,20 +182,13 @@ #pragma mark - #pragma mark actionSheet methods -(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex { - if (IS_IPAD() == NO) { - CGRect screen = [[UIScreen mainScreen] bounds]; - [UIView beginAnimations:@"table width less" context:NULL]; - [UIView setAnimationDuration:0.2]; - self.view.frame = CGRectMake(screen.size.height-200, 0, 200, VIEW_HEIGHT); - [UIView commitAnimations]; - } - if ([actionSheet cancelButtonIndex] != buttonIndex) { SDL_iPhoneKeyboardHide((SDL_Window *)HW_getSDLWindow()); HW_terminate(NO); } } +//TODO: check this is still needed since we switched to SDL_GL_CreateContext() #pragma mark - #pragma mark save screenshot //by http://www.bit-101.com/blog/?p=1861 diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/ObjcExports.m --- a/project_files/HedgewarsMobile/Classes/ObjcExports.m Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/ObjcExports.m Thu Sep 01 17:03:19 2011 +0200 @@ -67,8 +67,7 @@ overlay_instance.lowerIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; CGPoint center = overlay_instance.view.center; - overlay_instance.lowerIndicator.center = (IS_DUALHEAD() ? CGPointMake(center.y, center.x) - : CGPointMake(center.y, center.x * 5/3)); + overlay_instance.lowerIndicator.center = (IS_DUALHEAD() ? center : CGPointMake(center.x, center.y * 5/3)); [overlay_instance.lowerIndicator startAnimating]; [overlay_instance.view addSubview:overlay_instance.lowerIndicator]; @@ -110,8 +109,7 @@ overlay_instance.savesIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; - CGPoint center = overlay_instance.view.center; - overlay_instance.savesIndicator.center = CGPointMake(center.y, center.x); + overlay_instance.savesIndicator.center = overlay_instance.view.center; overlay_instance.savesIndicator.hidesWhenStopped = YES; [overlay_instance.savesIndicator startAnimating]; diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/OverlayViewController.h --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.h Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.h Thu Sep 01 17:03:19 2011 +0200 @@ -45,9 +45,6 @@ CGPoint startingPoint; BOOL isAttacking; - // stuff initialized externally - NSInteger initialOrientation; - // dual head support NSInteger initialScreenCount; @@ -67,7 +64,6 @@ @property (nonatomic,retain) UIButton *confirmButton; @property (nonatomic,retain) UISegmentedControl *grenadeTimeSegment; -@property (assign) NSInteger initialOrientation; @property (assign) NSInteger initialScreenCount; diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/OverlayViewController.m --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m Thu Sep 01 17:03:19 2011 +0200 @@ -35,8 +35,8 @@ @implementation OverlayViewController -@synthesize popoverController, popupMenu, helpPage, amvc, initialScreenCount, initialOrientation, - lowerIndicator, savesIndicator, confirmButton, grenadeTimeSegment; +@synthesize popoverController, popupMenu, helpPage, amvc, initialScreenCount, lowerIndicator, savesIndicator, + confirmButton, grenadeTimeSegment; #pragma mark - #pragma mark rotation @@ -45,48 +45,6 @@ return rotationManager(interfaceOrientation); } -// while in dual head the above rotation functions are not called --(void) handleRotationEvent:(NSNotification *)notification { - if (isGameRunning() == NO) - return; - - UIView *sdlView = nil; - for (UIView *oneView in [[[UIApplication sharedApplication] keyWindow] subviews]) - if ([oneView isMemberOfClass:[SDL_uikitopenglview class]]) { - sdlView = (UIView *)oneView; - break; - } - - UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; - NSInteger angle_left = (self.initialOrientation == UIInterfaceOrientationLandscapeLeft) ? 180 : 0; - NSInteger angle_right = (self.initialOrientation == UIInterfaceOrientationLandscapeLeft) ? 0 : 180; - - NSString *model = getModelType(); - if (IS_VERY_POWERFUL(model)) { - [UIView beginAnimations:@"overlay rotation" context:NULL]; - [UIView setAnimationDuration:0.7]; - } - switch (orientation) { - case UIDeviceOrientationLandscapeLeft: - self.view.frame = [[UIScreen mainScreen] bounds]; - self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(90)); - if (IS_DUALHEAD() == NO) - sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(angle_left)); - break; - case UIDeviceOrientationLandscapeRight: - self.view.frame = [[UIScreen mainScreen] bounds]; - self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90)); - if (IS_DUALHEAD() == NO) - sdlView.transform = CGAffineTransformMakeRotation(degreesToRadians(angle_right)); - break; - default: - // a debug log would spam too much - break; - } - if (IS_VERY_POWERFUL(model)) - [UIView commitAnimations]; -} - #pragma mark - #pragma mark View Management -(id) initWithCoder:(NSCoder *)aDecoder { @@ -94,7 +52,6 @@ isAttacking = NO; isPopoverVisible = NO; initialScreenCount = (IS_DUALHEAD() ? 2 : 1); - initialOrientation = 0; lowerIndicator = nil; savesIndicator = nil; } @@ -102,27 +59,10 @@ } -(void) viewDidLoad { - CGRect screenRect = [[UIScreen mainScreen] bounds]; - self.view.frame = CGRectMake(0, 0, screenRect.size.height, screenRect.size.width); - self.view.center = CGPointMake(self.view.frame.size.height/2, self.view.frame.size.width/2); + // fill all the screen available as sdlview disables autoresizing + CGRect rect = [[UIScreen mainScreen] bounds]; + self.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width); - // set initial orientation of the controller orientation - switch (self.interfaceOrientation) { - case UIDeviceOrientationLandscapeLeft: - self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(90)); - break; - case UIDeviceOrientationLandscapeRight: - self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90)); - break; - default: - break; - } - [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleRotationEvent:) - name:UIDeviceOrientationDidChangeNotification - object:nil]; - // the timer used to dim the overlay dimTimer = [[NSTimer alloc] initWithFireDate:(IS_DUALHEAD()) ? HIDING_TIME_NEVER : [NSDate dateWithTimeIntervalSinceNow:6] interval:1000 @@ -139,8 +79,7 @@ name:@"show help ingame" object:nil]; - // for iOS >= 3.2 - if ([UIScreen respondsToSelector:@selector(screens)]) { + if (IS_IPAD()) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(numberOfScreensIncreased) name:UIScreenDidConnectNotification @@ -161,7 +100,6 @@ } -(void) viewDidUnload { - [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] removeObserver:self]; [NSObject cancelPreviousPerformRequestsWithTarget:self @@ -409,14 +347,6 @@ doNotDim(); } -// present a further check before closing game --(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex { - if ([actionSheet cancelButtonIndex] != buttonIndex) - HW_terminate(NO); - else - HW_pause(); -} - // show up a popover containing a popupMenuViewController; we hook it with setPopoverContentSize // on iphone instead just use the tableViewController directly (and implement manually all animations) -(IBAction) showPopover{ diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/RestoreViewController.h --- a/project_files/HedgewarsMobile/Classes/RestoreViewController.h Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/RestoreViewController.h Thu Sep 01 17:03:19 2011 +0200 @@ -21,10 +21,13 @@ #import +@class GameInterfaceBridge; @interface RestoreViewController : UIViewController { + GameInterfaceBridge *interfaceBridge; +} -} +@property (nonatomic,retain) GameInterfaceBridge *interfaceBridge; -(IBAction) buttonReleased:(id) sender; diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/RestoreViewController.m --- a/project_files/HedgewarsMobile/Classes/RestoreViewController.m Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/RestoreViewController.m Thu Sep 01 17:03:19 2011 +0200 @@ -23,7 +23,7 @@ #import "GameInterfaceBridge.h" @implementation RestoreViewController - +@synthesize interfaceBridge; // Override to allow orientations other than the default portrait orientation. -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { @@ -36,21 +36,22 @@ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if (theButton.tag != 0) { - GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self.parentViewController]; + playSound(@"clickSound"); + if (self.interfaceBridge == nil) { + GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self.parentViewController]; + self.interfaceBridge = bridge; + [bridge release]; + } [self.parentViewController dismissModalViewControllerAnimated:NO]; - [bridge startSaveGame:[defaults objectForKey:@"savedGamePath"]]; - [bridge release]; + [self.interfaceBridge startSaveGame:[defaults objectForKey:@"savedGamePath"]]; } else { + playSound(@"backSound"); [defaults setObject:@"" forKey:@"savedGamePath"]; [defaults synchronize]; [self.parentViewController dismissModalViewControllerAnimated:YES]; } } --(void) didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; -} - -(void) viewDidLoad { NSString *imgName; if (IS_IPAD()) @@ -63,11 +64,19 @@ [super viewDidLoad]; } +-(void) didReceiveMemoryWarning { + // don't nil this one or it won't be able to send messages + //self.interfaceBridge = nil; + [super didReceiveMemoryWarning]; +} + -(void) viewDidUnload { + self.interfaceBridge = nil; [super viewDidUnload]; } -(void) dealloc { + releaseAndNil(interfaceBridge); [super dealloc]; } diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/SavedGamesViewController.h --- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.h Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.h Thu Sep 01 17:03:19 2011 +0200 @@ -22,17 +22,21 @@ #import #import "EditableCellView.h" +@class GameInterfaceBridge; + @interface SavedGamesViewController : UIViewController { UITableView *tableView; NSMutableArray *listOfSavegames; + NSInteger numberOfItems; + GameInterfaceBridge *interfaceBridge; } @property (nonatomic,retain) IBOutlet UITableView *tableView; @property (nonatomic,retain) NSMutableArray *listOfSavegames; +@property (nonatomic,retain) GameInterfaceBridge *interfaceBridge; +@property (assign) NSInteger numberOfItems; -(IBAction) buttonPressed:(id) sender; --(IBAction) toggleEdit:(id) sender; --(IBAction) clearAll:(id) sender; @end diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/SavedGamesViewController.m --- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m Thu Sep 01 17:03:19 2011 +0200 @@ -24,7 +24,7 @@ #import "CommodityFunctions.h" @implementation SavedGamesViewController -@synthesize tableView, listOfSavegames; +@synthesize tableView, listOfSavegames, interfaceBridge, numberOfItems; -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { return rotationManager(interfaceOrientation); @@ -35,6 +35,7 @@ NSMutableArray *array = [[NSMutableArray alloc] initWithArray:contentsOfDir copyItems:YES]; self.listOfSavegames = array; [array release]; + self.numberOfItems = [self.listOfSavegames count]; [self.tableView reloadData]; } @@ -52,6 +53,8 @@ self.view.backgroundColor = [UIColor colorWithPatternImage:img]; [img release]; + if (self.listOfSavegames == nil) + [self updateTable]; [super viewDidLoad]; } @@ -63,66 +66,47 @@ #pragma mark - #pragma mark button functions -(IBAction) buttonPressed:(id) sender { - playSound(@"backSound"); - [self.tableView setEditing:NO animated:YES]; - [[self parentViewController] dismissModalViewControllerAnimated:YES]; -} - --(IBAction) toggleEdit:(id) sender { - BOOL isEditing = self.tableView.editing; - [self.tableView setEditing:!isEditing animated:YES]; -} + UIButton *button = (UIButton *)sender; --(void) duplicateEntry:(id) sender { - UIButton *button = (UIButton *)sender; - NSUInteger row = button.tag; - - if (self.listOfSavegames == nil) - [self updateTable]; - - [(EditableCellView *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:0]] save:nil]; - NSString *currentSaveName = [self.listOfSavegames objectAtIndex:row]; - NSString *newSaveName = [[currentSaveName stringByDeletingPathExtension] stringByAppendingFormat:@" %d.hws",[self.listOfSavegames count]]; - - NSString *currentFilePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),currentSaveName]; - NSString *newFilePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),newSaveName]; - [[NSFileManager defaultManager] copyItemAtPath:currentFilePath toPath:newFilePath error:nil]; - [self.listOfSavegames addObject:newSaveName]; - [self.listOfSavegames sortUsingSelector:@selector(compare:)]; - - [self.tableView reloadData]; -} - --(IBAction) clearAll:(id) sender { - NSString *titleStr, *cancelStr, *confirmStr; - if (IS_IPAD()) { - titleStr = nil; - cancelStr = nil; - confirmStr = NSLocalizedString(@"Tap to confirm",@""); + if (button.tag == 0) { + playSound(@"backSound"); + [self.tableView setEditing:NO animated:YES]; + [[self parentViewController] dismissModalViewControllerAnimated:YES]; } else { + NSString *titleStr, *cancelStr, *confirmStr; titleStr = NSLocalizedString(@"Are you reeeeeally sure?", @""); cancelStr = NSLocalizedString(@"Well, maybe not...", @""); confirmStr = NSLocalizedString(@"Of course!", @""); - } + + UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:titleStr + delegate:self + cancelButtonTitle:cancelStr + destructiveButtonTitle:confirmStr + otherButtonTitles:nil]; - UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:titleStr - delegate:self - cancelButtonTitle:cancelStr - destructiveButtonTitle:confirmStr - otherButtonTitles:nil]; - - if (IS_IPAD()) - [actionSheet showFromBarButtonItem:(UIBarButtonItem *)sender animated:YES]; - else - [actionSheet showInView:self.view]; - [actionSheet release]; + if (IS_IPAD()) + [actionSheet showFromBarButtonItem:(UIBarButtonItem *)sender animated:YES]; + else + [actionSheet showInView:self.view]; + [actionSheet release]; + } } -(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex { if ([actionSheet cancelButtonIndex] != buttonIndex) { + // remove all files and recreate the directory [[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL]; [[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() withIntermediateDirectories:NO attributes:nil error:NULL]; - [self updateTable]; + + // update the table and the cached list + NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:self.numberOfItems]; + for (int i = 0; i < self.numberOfItems; i++) + [array addObject:[NSIndexPath indexPathForRow:i inSection:0]]; + self.numberOfItems = 0; + [self.tableView deleteRowsAtIndexPaths:array withRowAnimation:UITableViewRowAnimationTop]; + [self.listOfSavegames removeAllObjects]; + + [array release]; } } @@ -133,9 +117,7 @@ } -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - if (self.listOfSavegames == nil) - [self updateTable]; - return [self.listOfSavegames count]; + return self.numberOfItems; } -(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { @@ -148,32 +130,24 @@ editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; editableCell.delegate = self; } - editableCell.tag = [indexPath row]; editableCell.respectEditing = YES; editableCell.textField.text = [[self.listOfSavegames objectAtIndex:[indexPath row]] stringByDeletingPathExtension]; editableCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; - - UIImage *addImg = [UIImage imageWithContentsOfFile:@"plus.png"]; - UIButton *customButton = [UIButton buttonWithType:UIButtonTypeContactAdd]; - customButton.tag = [indexPath row]; - [customButton setImage:addImg forState:UIControlStateNormal]; - [customButton addTarget:self action:@selector(duplicateEntry:) forControlEvents:UIControlEventTouchUpInside]; - editableCell.editingAccessoryView = customButton; return (UITableViewCell *)editableCell; } -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger) section { - UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 50)]; + UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 60)]; footer.backgroundColor = [UIColor clearColor]; - - UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width*80/100, 100)]; - label.center = CGPointMake(self.tableView.frame.size.width/2, 70); + + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width*60/100, 60)]; + label.center = CGPointMake(self.tableView.frame.size.width/2, 30); label.textAlignment = UITextAlignmentCenter; - label.font = [UIFont systemFontOfSize:16]; + label.font = [UIFont italicSystemFontOfSize:16]; label.textColor = [UIColor lightGrayColor]; label.numberOfLines = 5; - label.text = NSLocalizedString(@"Games are automatically saved and can be resumed by selecting an entry above.\nYou can modify this list by pressing the 'Edit' button.\nCompleted games are removed at the end of the match.",@""); + label.text = NSLocalizedString(@"Press to resume playing or swipe to delete the save file.",@""); label.backgroundColor = [UIColor clearColor]; [footer addSubview:label]; @@ -182,22 +156,18 @@ } -(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { - return 125; + return 60; } -(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { - NSUInteger row = [indexPath row]; - [(EditableCellView *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:0]] save:nil]; - - if (self.listOfSavegames == nil) - [self updateTable]; - - NSString *saveName = [self.listOfSavegames objectAtIndex:row]; - NSString *currentFilePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),saveName]; - [[NSFileManager defaultManager] removeItemAtPath:currentFilePath error:nil]; + [(EditableCellView *)[self.tableView cellForRowAtIndexPath:indexPath] save:nil]; + self.numberOfItems--; + [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft]; + + NSString *saveName = [self.listOfSavegames objectAtIndex:[indexPath row]]; + NSString *filePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),saveName]; + [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil]; [self.listOfSavegames removeObject:saveName]; - - [self.tableView reloadData]; } #pragma mark - @@ -207,15 +177,30 @@ if (self.listOfSavegames == nil) [self updateTable]; + // duplicate the entry [(EditableCellView *)[self.tableView cellForRowAtIndexPath:indexPath] save:nil]; - GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self]; + NSString *currentSaveName = [self.listOfSavegames objectAtIndex:[indexPath row]]; + NSString *currentFilePath = [[NSString alloc] initWithFormat:@"%@/%@",SAVES_DIRECTORY(),currentSaveName]; + NSString *newSaveName = [[NSString alloc] initWithFormat:@"[%@] %@",NSLocalizedString(@"Backup",@""),currentSaveName]; + NSString *newFilePath = [[NSString alloc] initWithFormat:@"%@/%@",SAVES_DIRECTORY(),newSaveName]; + + [self.listOfSavegames addObject:newSaveName]; + [newSaveName release]; + [[NSFileManager defaultManager] copyItemAtPath:currentFilePath toPath:newFilePath error:nil]; + [newFilePath release]; - NSString *filePath = [[NSString alloc] initWithFormat:@"%@/%@",SAVES_DIRECTORY(),[self.listOfSavegames objectAtIndex:[indexPath row]]]; - [bridge startSaveGame:filePath]; - [filePath release]; + self.numberOfItems++; + [self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone]; - [bridge release]; + if (self.interfaceBridge == nil) { + GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self]; + self.interfaceBridge = bridge; + [bridge release]; + } + + [self.interfaceBridge startSaveGame:currentFilePath]; + [currentFilePath release]; } #pragma mark - @@ -238,6 +223,8 @@ #pragma mark Memory Management -(void) didReceiveMemoryWarning { self.listOfSavegames = nil; + // don't nil this one or it won't be able to send messages + //self.interfaceBridge = nil; MSG_MEMCLEAN(); [super didReceiveMemoryWarning]; } @@ -245,6 +232,7 @@ -(void) viewDidUnload { self.tableView = nil; self.listOfSavegames = nil; + self.interfaceBridge = nil; MSG_DIDUNLOAD(); [super viewDidUnload]; } @@ -252,6 +240,7 @@ -(void) dealloc { releaseAndNil(tableView); releaseAndNil(listOfSavegames); + releaseAndNil(interfaceBridge); [super dealloc]; } diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Classes/SupportViewController.m --- a/project_files/HedgewarsMobile/Classes/SupportViewController.m Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/SupportViewController.m Thu Sep 01 17:03:19 2011 +0200 @@ -37,9 +37,9 @@ NSArray *array = [[NSArray alloc] initWithObjects: NSLocalizedString(@"Leave a positive review on iTunes!",@""), NSLocalizedString(@"Join us on Facebook",@""), - NSLocalizedString(@"Follow on Twitter",@""), - NSLocalizedString(@"Visit website",@""), - NSLocalizedString(@"Chat with us in IRC",@""), + NSLocalizedString(@"Follow us on Twitter",@""), + NSLocalizedString(@"Visit our website",@""), + NSLocalizedString(@"Chat with the devs in IRC",@""), nil]; self.waysToSupport = array; [array release]; @@ -71,13 +71,14 @@ NSString *rowString = [self.waysToSupport objectAtIndex:(row + section)]; cell.textLabel.text = rowString; + NSString *imgString = nil; if (section == 0) { + imgString = [BTN_DIRECTORY() stringByAppendingString:@"/StatsStar.png"]; cell.textLabel.textAlignment = UITextAlignmentCenter; cell.imageView.image = nil; } else { cell.textLabel.textAlignment = UITextAlignmentLeft; - NSString *imgString = nil; switch (row) { case 0: imgString = @"fb.png"; @@ -95,11 +96,15 @@ DLog(@"No way"); break; } - - UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgString]; - cell.imageView.image = img; - [img release]; } + UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgString]; + cell.imageView.image = img; + if (section == 0) { + UIImageView *imgView = [[UIImageView alloc] initWithImage:img]; + cell.accessoryView = imgView; + [imgView release]; + } + [img release]; return cell; } diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Thu Sep 01 17:03:19 2011 +0200 @@ -26,7 +26,6 @@ 28FD15000DC6FC520079059D /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28FD14FF0DC6FC520079059D /* OpenGLES.framework */; }; 28FD15080DC6FC5B0079059D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28FD15070DC6FC5B0079059D /* QuartzCore.framework */; settings = {ATTRIBUTES = (Required, ); }; }; 61006F95128DE31F00EBA7F7 /* CreationChamber.m in Sources */ = {isa = PBXBuildFile; fileRef = 61006F94128DE31F00EBA7F7 /* CreationChamber.m */; }; - 6103D414129B417500911D8D /* plus@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D413129B417500911D8D /* plus@2x.png */; }; 610D5FB21270E2660033333A /* Icon-Small@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F7A43411E290650040BA66 /* Icon-Small@2x.png */; }; 610D5FB31270E26C0033333A /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F7A43611E290650040BA66 /* Icon@2x.png */; }; 61188BF212A6FE530026C5DA /* ammoButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D399129B350700911D8D /* ammoButton@2x.png */; }; @@ -55,7 +54,6 @@ 61188C0912A6FE9C0026C5DA /* tw@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D385129B348200911D8D /* tw@2x.png */; }; 611D9BFB12497E9800008271 /* SavedGamesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 611D9BF912497E9800008271 /* SavedGamesViewController.m */; }; 611D9BFC12497E9800008271 /* SavedGamesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 611D9BFA12497E9800008271 /* SavedGamesViewController.xib */; }; - 611DA1D0124E5C6300008271 /* plus.png in Resources */ = {isa = PBXBuildFile; fileRef = 611DA1CF124E5C6300008271 /* plus.png */; }; 611E0EE711FB20610077A41E /* ammoButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 611E0EE511FB20610077A41E /* ammoButton.png */; }; 611E0EE811FB20610077A41E /* cornerButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 611E0EE611FB20610077A41E /* cornerButton.png */; }; 611E12FF117BBBDA0044B62F /* Entitlements-Development.plist in Resources */ = {isa = PBXBuildFile; fileRef = 611E12FE117BBBDA0044B62F /* Entitlements-Development.plist */; }; @@ -194,6 +192,7 @@ 61B7A61812FA13B00051E14E /* libSDL_net.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B7A56812FA12D00051E14E /* libSDL_net.a */; }; 61B7A61912FA13B00051E14E /* libSDL_ttf.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B7A59012FA13330051E14E /* libSDL_ttf.a */; }; 61C079E411F35A300072BF46 /* EditableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 61C079E311F35A300072BF46 /* EditableCellView.m */; }; + 61CADE331402EE290030C3EB /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61CADE321402EE290030C3EB /* ImageIO.framework */; }; 61D205A1127CDD1100ABD83E /* ObjcExports.m in Sources */ = {isa = PBXBuildFile; fileRef = 61D205A0127CDD1100ABD83E /* ObjcExports.m */; }; 61D3D2A51290E03A003CE7C3 /* irc.png in Resources */ = {isa = PBXBuildFile; fileRef = 61D3D2A41290E03A003CE7C3 /* irc.png */; }; 61DE8F221257EB1100B80214 /* AmmoMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61DE8F211257EB1100B80214 /* AmmoMenuViewController.m */; }; @@ -335,11 +334,9 @@ 6103D39C129B350700911D8D /* arrowRight@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "arrowRight@2x.png"; path = "Resources/Overlay/arrowRight@2x.png"; sourceTree = ""; }; 6103D39D129B350700911D8D /* arrowUp@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "arrowUp@2x.png"; path = "Resources/Overlay/arrowUp@2x.png"; sourceTree = ""; }; 6103D39E129B350700911D8D /* cornerButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "cornerButton@2x.png"; path = "Resources/Overlay/cornerButton@2x.png"; sourceTree = ""; }; - 6103D413129B417500911D8D /* plus@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "plus@2x.png"; path = "Resources/Icons/plus@2x.png"; sourceTree = ""; }; 611D9BF812497E9800008271 /* SavedGamesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SavedGamesViewController.h; sourceTree = ""; }; 611D9BF912497E9800008271 /* SavedGamesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SavedGamesViewController.m; sourceTree = ""; }; 611D9BFA12497E9800008271 /* SavedGamesViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = SavedGamesViewController.xib; path = ../Resources/SavedGamesViewController.xib; sourceTree = ""; }; - 611DA1CF124E5C6300008271 /* plus.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = plus.png; path = Resources/Icons/plus.png; sourceTree = ""; }; 611E0EE511FB20610077A41E /* ammoButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ammoButton.png; path = Resources/Overlay/ammoButton.png; sourceTree = ""; }; 611E0EE611FB20610077A41E /* cornerButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = cornerButton.png; path = Resources/Overlay/cornerButton.png; sourceTree = ""; }; 611E12FE117BBBDA0044B62F /* Entitlements-Development.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Entitlements-Development.plist"; sourceTree = ""; }; @@ -358,7 +355,7 @@ 61272338117DF778005B90CF /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; 6129B9F611EFB04D0017E305 /* denied.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = denied.png; path = Resources/denied.png; sourceTree = ""; }; 612CABAA1391CE68005E9596 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; - 612CABC71391D3CC005E9596 /* hwclassic.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = hwclassic.mp3; sourceTree = ""; }; + 612CABC71391D3CC005E9596 /* hwclassic.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = hwclassic.mp3; path = Resources/hwclassic.mp3; sourceTree = ""; }; 61370652117B1D50004EE44A /* Entitlements-Distribution.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Entitlements-Distribution.plist"; sourceTree = ""; }; 61399012125D19C0003C2DC0 /* uMobile.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uMobile.pas; path = ../../hedgewars/uMobile.pas; sourceTree = SOURCE_ROOT; }; 6147DAD21253DCDE0010357E /* savesButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = savesButton.png; path = Resources/Frontend/savesButton.png; sourceTree = ""; }; @@ -531,6 +528,7 @@ 61B7A33712CC21080086B604 /* StatsPageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatsPageViewController.m; sourceTree = ""; }; 61C079E211F35A300072BF46 /* EditableCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EditableCellView.h; path = Classes/EditableCellView.h; sourceTree = ""; }; 61C079E311F35A300072BF46 /* EditableCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EditableCellView.m; path = Classes/EditableCellView.m; sourceTree = ""; }; + 61CADE321402EE290030C3EB /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; }; 61D2059F127CDD1100ABD83E /* ObjcExports.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjcExports.h; path = Classes/ObjcExports.h; sourceTree = ""; }; 61D205A0127CDD1100ABD83E /* ObjcExports.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ObjcExports.m; path = Classes/ObjcExports.m; sourceTree = ""; }; 61D3D2A41290E03A003CE7C3 /* irc.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = irc.png; path = Resources/Icons/irc.png; sourceTree = ""; }; @@ -600,6 +598,7 @@ 6199E81612463EA800DADF8C /* CFNetwork.framework in Frameworks */, 6199E81A12463EC400DADF8C /* SystemConfiguration.framework in Frameworks */, 612CABAB1391CE68005E9596 /* AVFoundation.framework in Frameworks */, + 61CADE331402EE290030C3EB /* ImageIO.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -715,6 +714,7 @@ 1D30AB110D05D00D00671497 /* Foundation.framework */, 28FD14FF0DC6FC520079059D /* OpenGLES.framework */, 28FD15070DC6FC5B0079059D /* QuartzCore.framework */, + 61CADE321402EE290030C3EB /* ImageIO.framework */, 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 61272338117DF778005B90CF /* MobileCoreServices.framework */, 6199E81512463EA800DADF8C /* CFNetwork.framework */, @@ -976,8 +976,6 @@ 61F7A42811E2905C0040BA66 /* Icons */ = { isa = PBXGroup; children = ( - 611DA1CF124E5C6300008271 /* plus.png */, - 6103D413129B417500911D8D /* plus@2x.png */, 61F2E7EB12060E31005734F7 /* checkbox.png */, 615FEAD912A2A4C10098EE92 /* checkbox@2x.png */, 61D3D2A41290E03A003CE7C3 /* irc.png */, @@ -1303,7 +1301,6 @@ 61842B40122B66280096E335 /* helpleft.png in Resources */, 6199E86D12464A8E00DADF8C /* surprise.png in Resources */, 611D9BFC12497E9800008271 /* SavedGamesViewController.xib in Resources */, - 611DA1D0124E5C6300008271 /* plus.png in Resources */, 6147DAD31253DCDE0010357E /* savesButton.png in Resources */, 610D5FB21270E2660033333A /* Icon-Small@2x.png in Resources */, 610D5FB31270E26C0033333A /* Icon@2x.png in Resources */, @@ -1321,7 +1318,6 @@ 6172FEF11298D25D00D73365 /* smallerBackground~ipad.png in Resources */, 6172FEF21298D25D00D73365 /* smallerBackground~iphone.png in Resources */, 61889985129995B500D55FD6 /* title~ipad.png in Resources */, - 6103D414129B417500911D8D /* plus@2x.png in Resources */, 615FEAE212A2A6640098EE92 /* localplayButton~ipad.png in Resources */, 615FEAE312A2A6640098EE92 /* localplayButton~iphone.png in Resources */, 61188BF212A6FE530026C5DA /* ammoButton@2x.png in Resources */, @@ -1573,7 +1569,7 @@ "\"$(SRCROOT)/../../../Library/SDL_net/\"", "\"$(SRCROOT)/../../../Library/SDL_mixer/\"", ); - IPHONEOS_DEPLOYMENT_TARGET = 3.1; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; LLVM_LTO = NO; ONLY_ACTIVE_ARCH = NO; OTHER_CODE_SIGN_FLAGS = ""; @@ -1656,7 +1652,7 @@ "\"$(SRCROOT)/../../../Library/SDL_net/\"", "\"$(SRCROOT)/../../../Library/SDL_mixer/\"", ); - IPHONEOS_DEPLOYMENT_TARGET = 3.1; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "-lz", @@ -1781,7 +1777,7 @@ "\"$(SRCROOT)/../../../Library/SDL_net/\"", "\"$(SRCROOT)/../../../Library/SDL_mixer/\"", ); - IPHONEOS_DEPLOYMENT_TARGET = 3.1; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "-lz", @@ -1828,7 +1824,7 @@ "\"$(SRCROOT)/../../../Library/SDL_net/\"", "\"$(SRCROOT)/../../../Library/SDL_mixer/\"", ); - IPHONEOS_DEPLOYMENT_TARGET = 3.1; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; LLVM_LTO = NO; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Resources/Icons/plus.png Binary file project_files/HedgewarsMobile/Resources/Icons/plus.png has changed diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Resources/Icons/plus@2x.png Binary file project_files/HedgewarsMobile/Resources/Icons/plus@2x.png has changed diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Resources/SavedGamesViewController.xib --- a/project_files/HedgewarsMobile/Resources/SavedGamesViewController.xib Thu Sep 01 14:55:31 2011 +0200 +++ b/project_files/HedgewarsMobile/Resources/SavedGamesViewController.xib Thu Sep 01 17:03:19 2011 +0200 @@ -1,18 +1,18 @@ - 1024 - 10F569 - 804 - 1038.29 + 1056 + 10K549 + 823 + 1038.36 461.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 123 + 132 YES - + YES @@ -64,16 +64,12 @@ 5 + 1 Clear All IBIPadFramework 1 - - IBIPadFramework - - 2 - @@ -155,19 +151,11 @@ - toggleEdit: - - - - 14 - - - - clearAll: + buttonPressed: - 16 + 17 @@ -206,7 +194,6 @@ YES - @@ -223,11 +210,6 @@ - 12 - - - - 13 @@ -245,7 +227,6 @@ YES -1.CustomClassName -2.CustomClassName - 12.IBPluginDependency 13.IBPluginDependency 15.IBPluginDependency 2.IBEditorWindowLastContentRect @@ -260,7 +241,6 @@ UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin {{467, 276}, {768, 768}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -284,7 +264,7 @@ - 16 + 17 @@ -520,6 +500,13 @@ UIView IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource UIKit.framework/Headers/UITextField.h @@ -573,7 +560,7 @@ IBIPadFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 @@ -582,6 +569,6 @@ YES ../Hedgewars.xcodeproj 3 - 123 + 132 diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/Resources/hwclassic.mp3 Binary file project_files/HedgewarsMobile/Resources/hwclassic.mp3 has changed diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/SDL-91c9a69dd2ad.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/SDL-91c9a69dd2ad.patch Thu Sep 01 17:03:19 2011 +0200 @@ -0,0 +1,127 @@ +diff -r 91c9a69dd2ad Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj +--- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj Mon Aug 29 00:27:43 2011 -0400 ++++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj Mon Aug 29 23:56:04 2011 +0200 +@@ -1596,9 +1596,12 @@ + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DEBUGGING_SYMBOLS = full; ++ GCC_OPTIMIZATION_LEVEL = 0; ++ GCC_THUMB_SUPPORT = NO; ++ GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = NO; +- IPHONEOS_DEPLOYMENT_TARGET = 3.1.3; ++ IPHONEOS_DEPLOYMENT_TARGET = 4.0; + ONLY_ACTIVE_ARCH = NO; + PREBINDING = NO; + SDKROOT = iphoneos; +@@ -1613,9 +1616,12 @@ + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; ++ GCC_FAST_MATH = YES; ++ GCC_THUMB_SUPPORT = NO; ++ GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = NO; +- IPHONEOS_DEPLOYMENT_TARGET = 3.1.3; ++ IPHONEOS_DEPLOYMENT_TARGET = 4.0; + PREBINDING = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; +diff -r 91c9a69dd2ad include/SDL_config_iphoneos.h +--- a/include/SDL_config_iphoneos.h Mon Aug 29 00:27:43 2011 -0400 ++++ b/include/SDL_config_iphoneos.h Mon Aug 29 23:56:04 2011 +0200 +@@ -106,7 +106,7 @@ + /* enable iPhone version of Core Audio driver */ + #define SDL_AUDIO_DRIVER_COREAUDIO 1 + /* Enable the dummy audio driver (src/audio/dummy/\*.c) */ +-#define SDL_AUDIO_DRIVER_DUMMY 1 ++#define SDL_AUDIO_DRIVER_DUMMY 0 + + /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ + #define SDL_HAPTIC_DISABLED 1 +@@ -132,14 +132,17 @@ + /* enable OpenGL ES */ + #define SDL_VIDEO_OPENGL_ES 1 + #define SDL_VIDEO_RENDER_OGL_ES 1 +-#define SDL_VIDEO_RENDER_OGL_ES2 1 ++#define SDL_VIDEO_RENDER_OGL_ES2 0 + + /* Enable system power support */ +-#define SDL_POWER_UIKIT 1 ++#define SDL_POWER_UIKIT 0 + + /* enable iPhone keyboard support */ + #define SDL_IPHONE_KEYBOARD 1 + ++/* enable joystick subsystem */ ++#define SDL_JOYSTICK_DISABLED 1 ++ + /* Set max recognized G-force from accelerometer + See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed + */ +diff -r 91c9a69dd2ad src/video/uikit/SDL_uikitopenglview.m +--- a/src/video/uikit/SDL_uikitopenglview.m Mon Aug 29 00:27:43 2011 -0400 ++++ b/src/video/uikit/SDL_uikitopenglview.m Mon Aug 29 23:56:04 2011 +0200 +@@ -123,8 +123,8 @@ + + // !!! FIXME: use the screen this is on! + /* Use the main screen scale (for retina display support) */ +- if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) +- self.contentScaleFactor = [UIScreen mainScreen].scale; ++ if ([self respondsToSelector:@selector(contentScaleFactor)]) ++ self.contentScaleFactor = [[UIScreen mainScreen] scale]; + + self.autoresizingMask = 0; // don't allow autoresize, since we need to do some magic in -(void)updateFrame. + } +@@ -152,8 +152,8 @@ + + // !!! FIXME: use the screen this is on! + /* Use the main screen scale (for retina display support) */ +- if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) +- self.contentScaleFactor = [UIScreen mainScreen].scale; ++ if ([self respondsToSelector:@selector(contentScaleFactor)]) ++ self.contentScaleFactor = [[UIScreen mainScreen] scale]; + } + + - (void)setCurrentContext { +diff -r 91c9a69dd2ad src/video/uikit/SDL_uikitvideo.m +--- a/src/video/uikit/SDL_uikitvideo.m Mon Aug 29 00:27:43 2011 -0400 ++++ b/src/video/uikit/SDL_uikitvideo.m Mon Aug 29 23:56:04 2011 +0200 +@@ -245,12 +245,8 @@ + const CGRect rect = [uiscreen bounds]; + UIKit_AddDisplay(uiscreen, uiscreenmode, (int)rect.size.width, (int)rect.size.height); + } else { +- const NSArray *screens = [UIScreen screens]; +- const NSUInteger screen_count = [screens count]; +- NSUInteger i; +- for (i = 0; i < screen_count; i++) { ++ for (UIScreen *uiscreen in [UIScreen screens]) { + // the main screen is the first element in the array. +- UIScreen *uiscreen = (UIScreen *) [screens objectAtIndex:i]; + UIScreenMode *uiscreenmode = [uiscreen currentMode]; + const CGSize size = [[uiscreen currentMode] size]; + UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height); +@@ -286,6 +282,9 @@ + UIScreen *uiscreen = (UIScreen *) display->driverdata; + [uiscreen release]; + display->driverdata = NULL; ++ UIScreenMode *desktopmode = (UIScreenMode *) display->desktop_mode.driverdata; ++ [desktopmode release]; ++ display->desktop_mode.driverdata = NULL; + for (j = 0; j < display->num_display_modes; j++) { + SDL_DisplayMode *mode = &display->display_modes[j]; + UIScreenMode *uimode = (UIScreenMode *) mode->driverdata; +diff -r 91c9a69dd2ad src/video/uikit/SDL_uikitviewcontroller.m +--- a/src/video/uikit/SDL_uikitviewcontroller.m Mon Aug 29 00:27:43 2011 -0400 ++++ b/src/video/uikit/SDL_uikitviewcontroller.m Mon Aug 29 23:56:04 2011 +0200 +@@ -138,7 +138,7 @@ + frame.origin.x = 0; + frame.origin.y = 0; + +- [uiwindow setFrame:frame]; ++ [uiwindow setFrame:[[UIScreen mainScreen] bounds]]; + [data->view updateFrame]; + SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, w, h); + } diff -r ba4c3a4c8b09 -r e27100a0e2d0 project_files/HedgewarsMobile/hwclassic.mp3 Binary file project_files/HedgewarsMobile/hwclassic.mp3 has changed diff -r ba4c3a4c8b09 -r e27100a0e2d0 share/hedgewars/Data/Graphics/AmmoMenu/Ammos.png Binary file share/hedgewars/Data/Graphics/AmmoMenu/Ammos.png has changed diff -r ba4c3a4c8b09 -r e27100a0e2d0 share/hedgewars/Data/Graphics/AmmoMenu/Ammos_bw.png Binary file share/hedgewars/Data/Graphics/AmmoMenu/Ammos_bw.png has changed diff -r ba4c3a4c8b09 -r e27100a0e2d0 share/hedgewars/Data/Graphics/Snow.png Binary file share/hedgewars/Data/Graphics/Snow.png has changed diff -r ba4c3a4c8b09 -r e27100a0e2d0 share/hedgewars/Data/Graphics/TARDIS.png Binary file share/hedgewars/Data/Graphics/TARDIS.png has changed diff -r ba4c3a4c8b09 -r e27100a0e2d0 share/hedgewars/Data/Graphics/TARDIS.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Graphics/TARDIS.svg Thu Sep 01 17:03:19 2011 +0200 @@ -0,0 +1,2170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ADVICE & ASSISTANCEOBTAINABLE IMMEDIATELY + POLICE TELEPHONE + FOR THE USE OF + FREE + PUBLIC + PULL TO OPEN + OFFICER & CARSRESPOND TO ALL CALLS + + + + + POLICE + BOX + PUBLICCALL + + + POLICE + BOX + PUBLICCALL + + + + + + + ADVICE & ASSISTANCEOBTAINABLE IMMEDIATELY + POLICE TELEPHONE + FOR THE USE OF + FREE + PUBLIC + PULL TO OPEN + OFFICER & CARSRESPOND TO ALL CALLS + + + + diff -r ba4c3a4c8b09 -r e27100a0e2d0 share/hedgewars/Data/Locale/hedgewars_en.ts --- a/share/hedgewars/Data/Locale/hedgewars_en.ts Thu Sep 01 14:55:31 2011 +0200 +++ b/share/hedgewars/Data/Locale/hedgewars_en.ts Thu Sep 01 17:03:19 2011 +0200 @@ -241,7 +241,7 @@ Quit reason: - Quit reason: + Quit reason: You got kicked diff -r ba4c3a4c8b09 -r e27100a0e2d0 share/hedgewars/Data/Locale/hedgewars_pt_PT.ts --- a/share/hedgewars/Data/Locale/hedgewars_pt_PT.ts Thu Sep 01 14:55:31 2011 +0200 +++ b/share/hedgewars/Data/Locale/hedgewars_pt_PT.ts Thu Sep 01 17:03:19 2011 +0200 @@ -16,15 +16,15 @@ DrawMapWidget File error - + Erro no ficheiro Cannot open file '%1' for writing - + Impossivel abrir o ficheiro '%1' para escrita Cannot read file '%1' - + Impossivel let o ficheiro '%1' @@ -44,8 +44,8 @@ GameCFGWidget - Edit schemes - Editar esquemas + Edit weapons + Editar armas Error @@ -56,8 +56,8 @@ Esquema de armas inválido - Edit weapons - Editar armas + Edit schemes + Editar esquemas When this option is enabled selecting a game scheme will auto-select a weapon @@ -289,14 +289,16 @@ Nickname - Nome de utilizador + Nome de utilizador Some one already uses your nickname %1 on the server. Please pick another nickname: - + O nome de utilizador %1 +já está a ser utilizado no servidor. +Por favor escolha outro nome de utilizador. @@ -334,11 +336,11 @@ Latest version protocol number: - Número do protocolo da versão mais recente: + Número do protocolo da mais recente versão: MOTD preview: - Pré-visualizar o MOTD + Pré-visualização do MOTD: Set data @@ -353,7 +355,7 @@ Cancel - Cancelar + Cancelar @@ -723,11 +725,6 @@ A versão do Hedgewars para Windows suporta Xfire. Não te esqueças de adicionar o Hedgewars à tua lista de jogos para que os teus amigos te possam ver a jogar. - The Homing Bee can be tricky to use. Its turn radius depends on it's velocity, so try to not use full power. - Tips - A Abelha Teleguiada pode-se demonstrar complicada de utilizar. O grau a que consegue virar depende da sua velocidade, por isso experimenta larga-la com diferentes níveis de força. - - Use the Molotov or Flame Thrower to temporary keep hedgehogs from passing terrain such as tunnels or platforms. Tips Utiliza um Molotov ou o Lança-chamas para temporariamente impedir outros ouriços de passar por áreas no terreno como túneis ou plataformas. @@ -735,7 +732,7 @@ The Homing Bee can be tricky to use. Its turn radius depends on its velocity, so try to not use full power. Tips - + A Abelha Teleguiada pode-se demonstrar complicada de utilizar. O grau a que consegue virar depende da sua velocidade, por isso experimenta lança-la com diferentes níveis de força. @@ -764,15 +761,15 @@ Error - Erro + Erro Please enter room name - Insira o nome da sala + Por favor insira o nome da sala OK - OK + OK @@ -992,9 +989,9 @@ %1 players online - - - + + %1 jogadores online + %1 jogador online @@ -1118,7 +1115,7 @@ Teams in each clan take successive turns sharing their turn time. - + As equipas do mesmo clã jogam de forma sucessiva partilhando o seu tempo para jogar. @@ -1215,7 +1212,7 @@ Update - Actualizar + Actualizar @@ -1325,67 +1322,67 @@ Disabled - + Desactivado Red/Cyan - + Vermelho/Ciano Cyan/Red - + Ciano/Vermelho Red/Blue - + Vermelho/Azul Blue/Red - + Azul/Vermelho Red/Green - + Vermelho/Verde Green/Red - + Verde/Vermelho Side-by-side - + Lado-a-lado Top-Bottom - + Cima-baixo Wiggle - + "Wiggle" Red/Cyan grayscale - + Vermelho/Ciano (tons de cinza) Cyan/Red grayscale - + Ciano/Vermelho (tons de cinza) Red/Blue grayscale - + Vermelho/Azul (tons de cinza) Blue/Red grayscale - + Azul/Vermelho (tons de cinza) Red/Green grayscale - + Vermelho/Verde (tons de cinza) Green/Red grayscale - + Verde/Vermelho (tons de cinza) @@ -1614,32 +1611,28 @@ % Comprimento da Corda - Gameplay - Jogabilidade - - Stereo rendering - + Renderização estereoscópica Game Options - + Opções de Jogo Style - + Estilo Scheme - + Esquema Password - Password + Password % Get Away Time - + % Tempo Para Retirar @@ -2002,7 +1995,7 @@ Tag Team - + Tag Team diff -r ba4c3a4c8b09 -r e27100a0e2d0 share/hedgewars/Data/Locale/hedgewars_sk.ts --- a/share/hedgewars/Data/Locale/hedgewars_sk.ts Thu Sep 01 14:55:31 2011 +0200 +++ b/share/hedgewars/Data/Locale/hedgewars_sk.ts Thu Sep 01 17:03:19 2011 +0200 @@ -16,15 +16,15 @@ DrawMapWidget File error - + Chyba v súbore Cannot open file '%1' for writing - + Nepodarilo sa otvoriť súbor '%1' pre zápis Cannot read file '%1' - + Nepodarilo sa prečítať súbor '%1' @@ -296,14 +296,17 @@ Nickname - Prezývka + Prezývka Some one already uses your nickname %1 on the server. Please pick another nickname: - + Niekto už používa +vašu prezývku %1 +na serveri. +Prosím vyberte si inú prezývku: @@ -360,7 +363,7 @@ Cancel - Zrušiť + Zrušiť @@ -446,9 +449,9 @@ The best killer is <b>%1</b> with <b>%2</b> kills in a turn. - Najlepším zabijákom je <b>%1</b> s <b>jedným</b> zabitím počas ťahu. - Najlepším zabijákom je <b>%1</b> s <b>%2</b> zabitiami počas ťahu. - Najlepším zabijákom je <b>%1</b> s <b>%2</b> zabitiami počas ťahu. + Najlepším zabijakom je <b>%1</b> s <b>jedným</b> zabitím počas ťahu. + Najlepším zabijakom je <b>%1</b> s <b>%2</b> zabitiami počas ťahu. + Najlepším zabijakom je <b>%1</b> s <b>%2</b> zabitiami počas ťahu. @@ -784,7 +787,7 @@ The Homing Bee can be tricky to use. Its turn radius depends on its velocity, so try to not use full power. Tips - + Navádzaná včela je trošku zložitejšia na použitie. Jej polomer otočenia závisí na jej rýchlosti, takže ju radšej nepoužívajte pri plnej sile. @@ -813,15 +816,15 @@ Error - Chyba + Chyba Please enter room name - Prosím zadajte názov miestnosti + Prosím zadajte názov miestnosti OK - OK + OK @@ -1043,10 +1046,10 @@ %1 players online - - - - + + %1 hráč online + %1 hráči online + %1 hráčov online @@ -1170,7 +1173,7 @@ Teams in each clan take successive turns sharing their turn time. - + Tímy každého klanu sa striedajú v ťahaní a zdieľajú svoj čas na ťah. @@ -1267,7 +1270,7 @@ Update - Obnoviť + Obnoviť @@ -1449,27 +1452,27 @@ Red/Cyan grayscale - + Červené/Azúrové (odtiene šedej) Cyan/Red grayscale - + Azúrové/Červené (odtiene šedej) Red/Blue grayscale - + Červené/Modré (odtiene šedej) Blue/Red grayscale - + Modré/Červené (odtiene šedej) Red/Green grayscale - + Červené/Zelené (odtiene šedej) Green/Red grayscale - + Zelené/červené (odtiene šedej) @@ -1718,23 +1721,23 @@ Game Options - + Voľby hry Style - + Štýl Scheme - + Schéma Password - Heslo + Heslo % Get Away Time - + % času na útek @@ -2101,7 +2104,7 @@ Tag Team - + Označit tím diff -r ba4c3a4c8b09 -r e27100a0e2d0 share/hedgewars/Data/Locale/pt_PT.lua --- a/share/hedgewars/Data/Locale/pt_PT.lua Thu Sep 01 14:55:31 2011 +0200 +++ b/share/hedgewars/Data/Locale/pt_PT.lua Thu Sep 01 17:03:19 2011 +0200 @@ -1,11 +1,11 @@ locale = { --- ["..."] = "", + ["..."] = "...", [":("] = ":(", ["!!!"] = "!!!", -- ["Accuracy Bonus!"] = "", --- ["a Hedgewars mini-game"] = "", -- Space_Invasion, The_Specialists + ["a Hedgewars mini-game"] = "um mini-jogo Hedgewars", -- Space_Invasion, The_Specialists ["Aiming Practice"] = "Pratica a tua pontaria", --Bazooka, Shotgun, SniperRifle --- ["Ammo"] = "", + ["Ammo"] = "Munições", -- ["Ammo Depleted!"] = "", -- ["Ammo Maniac!"] = "", -- ["Available points remaining: "] = "", @@ -15,15 +15,15 @@ ["Best laps per team: "] = "Melhores voltas por equipa: ", -- ["Best Team Times: "] = "", -- ["Bloody Rookies"] = "", -- 01#Boot_Camp, User_Mission_-_Dangerous_Ducklings, User_Mission_-_Diver, User_Mission_-_Spooky_Tree --- ["BOOM!"] = "", + ["BOOM!"] = "BOOM!", ["Boom!"] = "Boom!", --- ["Boss defeated!"] = "", + ["Boss defeated!"] = "Boss derrotado!", -- ["Boss Slayer!"] = "", ["CAPTURE THE FLAG"] = "CAPTURAR A BANDEIRA", --- ["Careless"] = "", + ["Careless"] = "Descuidado", -- ["Clumsy"] = "", -- ["Codename: Teamwork"] = "", --- ["Complete the track as fast as you can!"] = "", + ["Complete the track as fast as you can!"] = "Completa a pista o mais rápido que conseguires!", ["Congratulations!"] = "Parabéns!", ["Congratulations! You've eliminated all targets|within the allowed time frame."] = "Parabéns! Eliminaste todos os alvos|dentro do tempo limite.", --Bazooka, Shotgun, SniperRifle -- ["Control pillars to score points."] = "", @@ -45,7 +45,7 @@ -- ["Eliminate the enemy specialists."] = "", -- ["- Eliminate Unit 3378 |- Feeble Resistance must survive"] = "", ["Enjoy the swim..."] = "Aproveita o mergulho", --- ["[Enter]"] = "", + ["[Enter]"] = "[Enter]", ["Fastest lap: "] = "Volta mais rápida: ", -- ["Feeble Resistance"] = "", -- ["Fire"] = "", @@ -57,13 +57,13 @@ -- ["Game Modifiers: "] = "", -- ["GAME OVER!"] = "", -- ["Game Started!"] = "", --- ["Get on over there and take him out!"] = "Chega-te aqui e acaba com ele!", + ["Get on over there and take him out!"] = "Chega-te aqui e acaba com ele!", -- ["Goal"] = "", ["GO! GO! GO!"] = "GO! GO! GO!", ["Good birdy......"] = "Bom passarito......", ["Good luck out there!"] = "Boa sorte aí fora!", -- ["GOTCHA!"] = "", --- ["Hahahaha!"] = "", + ["Hahahaha!"] = "Hahahaha!", -- ["Haha, now THAT would be something!"] = "", -- ["Hapless Hogs"] = "", -- [" Hapless Hogs left!"] = "", @@ -79,15 +79,15 @@ -- ["invaders destroyed"] = "", -- ["It's a good thing SUDDEN DEATH is 99 turns away..."] = "", -- ["Jumping is disabled"] = "", --- ["Kamikaze Expert!"] = "", + ["Kamikaze Expert!"] = "Kamikaze profissional!", -- ["KILLS"] = "", --- ["[Left Shift]"] = "", + ["[Left Shift]"] = "[Shift Esquerdo]", ["Listen up, maggot!!"] = "Oiçam bem suas larvas!!", ["|- Mines Time:"] = "|- Tempo das minas:", -- User_Mission_-_Diver, User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork ["MISSION FAILED"] = "MISSÃO FALHADA", -- User_Mission_-_Dangerous_Ducklings, User_Mission_-_Diver, User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork ["MISSION SUCCESSFUL"] = "MISSÃO COMPLETA", -- User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork ["MISSION SUCCESS"] = "MISSÃO COMPLETA", -- User_Mission_-_Diver, User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork --- ["Movement: [Up], [Down], [Left], [Right]"] = "", + ["Movement: [Up], [Down], [Left], [Right]"] = "Movimento: [Cima], [Baixo], [Esquerda], [Direita]", -- ["Multi-shot!"] = "", -- ["Nameless Heroes"] = "", -- ["NEW CLAN RECORD: "] = "", @@ -117,14 +117,14 @@ -- ["SCORE"] = "", ["sec"] = "seg", -- CTF_Blizzard, TrophyRace, Basic_Training_-_Bazooka, Basic_Training_-_Shotgun, Basic_Training_-_Sniper_Rifle, User_Mission_-_Diver, User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork, Capture_the_Flag ["See ya!"] = "Chau!", --- ["s"] = "", -- GaudyRacer, Space_Invasion + ["s"] = "s", -- GaudyRacer, Space_Invasion -- ["Shield boosted! +30 power"] = "", --- ["Shield Depleted"] = "", --- ["Shield is fully recharged!"] = "", + ["Shield Depleted"] = "Escudo Esgotado", + ["Shield is fully recharged!"] = "Escudo completamente recarregado!", -- ["Shield Master!"] = "", -- ["Shield Miser!"] = "", --- ["Shield OFF:"] = "", --- ["Shield ON:"] = "", + ["Shield OFF:"] = "Escudo DESLIGADO:", + ["Shield ON:"] = "Escudo LIGADO:", -- ["Shield Seeker!"] = "", ["Shotgun Team"] = "Caçadores", ["Shotgun Training"] = "Treino com Caçadeira", @@ -148,10 +148,10 @@ -- ["The Nameless One"] = "", -- ["THE SPECIALISTS"] = "", -- ["This rain is really something..."] = "", --- ["TIME: "] = "", + ["TIME: "] = "TEMPO: ", -- ["Timed Kamikaze!"] = "", -- ["Time Extended!"] = "", --- ["Time Left: "] = "", + ["Time Left: "] = "Tempo Restante: ", -- ["Toggle Shield"] = "", -- ["Toxic Team"] = "", -- User_Mission_-_Diver, User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork -- ["TRACK COMPLETED"] = "", @@ -160,7 +160,7 @@ ["T_T"] = "T_T", -- ["Turn Time"] = "", ["Unit 3378"] = "Unidade 3378", --- ["Unlimited Attacks"] = "", + ["Unlimited Attacks"] = "Ataques Ilimitados", -- ["User Challenge"] = "", ["Use your rope to get from start to finish as fast as you can!"] = "Utilizando a corda, percorre o percurso do inicio ao fim o mais rápido que conseguires!", -- ["v.06"] = "", diff -r ba4c3a4c8b09 -r e27100a0e2d0 share/hedgewars/Data/Locale/pt_PT.txt --- a/share/hedgewars/Data/Locale/pt_PT.txt Thu Sep 01 14:55:31 2011 +0200 +++ b/share/hedgewars/Data/Locale/pt_PT.txt Thu Sep 01 17:03:19 2011 +0200 @@ -55,6 +55,7 @@ 00:52=Nenhuma arma selecionada 00:53=TARDIS 00:54=Estrutura +00:55=Terreno-instantâneo 01:00=Vamos lutar! 01:01=Ronda empatada @@ -71,6 +72,12 @@ 01:12=Último turno até Morte Súbita! 01:13=%1 turnos até Morte Súbita! 01:14=Prepara-te! +01:15=Ligeiro +01:16=Pouco +01:17=Normal +01:18=Muito +01:19=Excessivo +01:20=Ressalto: %1 ; Event messages ; Hog (%1) died @@ -516,3 +523,4 @@ 05:18=Ataques ilimitados 05:19=O armamento é restaurado no final do turno 05:20=O armamento não é partilhado entre ouriços +05:21=Tag Team: Todas as equipas do mesmo clã jogam de forma sucessiva|Tempo Partilhado: O tempo de turno é partilhado entre todas as equipas do mesmo clã diff -r ba4c3a4c8b09 -r e27100a0e2d0 share/hedgewars/Data/Locale/sk.lua --- a/share/hedgewars/Data/Locale/sk.lua Thu Sep 01 14:55:31 2011 +0200 +++ b/share/hedgewars/Data/Locale/sk.lua Thu Sep 01 17:03:19 2011 +0200 @@ -2,26 +2,26 @@ [":("] = ":(", ["!!!"] = "!!!", -- ["..."] = "", --- ["Accuracy Bonus!"] = "", --- ["a Hedgewars mini-game"] = "", -- Space_Invasion, The_Specialists + ["Accuracy Bonus!"] = "Bonus za presnosť!", + ["a Hedgewars mini-game"] = "minihra Hedgewars", -- Space_Invasion, The_Specialists ["Aiming Practice"] = "Tréning presnosti", --Bazooka, Shotgun, SniperRifle --- ["Ammo"] = "", --- ["Ammo Depleted!"] = "", + ["Ammo"] = "Výzbroj", + ["Ammo Depleted!"] = "Výzbroj vyčerpaná!", -- ["Ammo Maniac!"] = "", --- ["Available points remaining: "] = "", + ["Available points remaining: "] = "Zostavajúci počet bodov: ", ["Bat balls at your enemies and|push them into the sea!"] = "Loptami triafajte vašich nepriateľov|a zhoďte ich tak do mora!", ["Bat your opponents through the|baskets and out of the map!"] = "Odpálkujte vašich súperov do koša|a von z mapy!", ["Bazooka Training"] = "Tréning s bazukou", ["Best laps per team: "] = "Najrýchlejšie kolá podľa tímov: ", --- ["Best Team Times: "] = "", + ["Best Team Times: "] = "Najrýchlejšie tímové časy: ", ["Bloody Rookies"] = "Mizerní zelenáči", -- 01#Boot_Camp, User_Mission_-_Dangerous_Ducklings, User_Mission_-_Diver, User_Mission_-_Spooky_Tree --- ["BOOM!"] = "", + ["BOOM!"] = "BUM!", ["Boom!"] = "Bum!", -- ["Boss defeated!"] = "", -- ["Boss Slayer!"] = "", ["CAPTURE THE FLAG"] = "ZMOCNITE SA VLAJKY", --- ["Careless"] = "", --- ["Clumsy"] = "", + ["Careless"] = "Bezstarostný", + ["Clumsy"] = "Nešikovný", ["Codename: Teamwork"] = "Kódové meno: Teamová práca", -- ["Complete the track as fast as you can!"] = "", ["Congratulations!"] = "Gratulujem!", @@ -87,7 +87,7 @@ ["MISSION FAILED"] = "MISIA NEÚSPEŠNÁ", -- User_Mission_-_Dangerous_Ducklings, User_Mission_-_Diver, User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork -- ["MISSION SUCCESS"] = "", ["MISSION SUCCESSFUL"] = "MISIA ÚSPEŠNÁ", -- User_Mission_-_Diver, User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork --- ["Movement: [Up], [Down], [Left], [Right]"] = "", + ["Movement: [Up], [Down], [Left], [Right]"] = "Pohyb: [Hore], [Dole], [Vľavo], [Vpravo]", -- ["Multi-shot!"] = "", -- ["Nameless Heroes"] = "", -- ["NEW CLAN RECORD: "] = "", @@ -147,22 +147,22 @@ -- ["The Nameless One"] = "", -- ["THE SPECIALISTS"] = "", -- ["This rain is really something..."] = "", --- ["TIME: "] = "", + ["TIME: "] = "ČAS: ", -- ["Timed Kamikaze!"] = "", -- ["Time Extended!"] = "", -- ["Time Left: "] = "", -- ["Toggle Shield"] = "", ["Toxic Team"] = "Toxic tím", -- User_Mission_-_Diver, User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork -- ["TRACK COMPLETED"] = "", --- ["Track Time: "] = "", + ["Track Time: "] = "Čas: ", ["TrophyRace"] = "Preteky o trofej", ["T_T"] = "T_T", --- ["Turn Time"] = "", + ["Turn Time"] = "Čas na ťah", ["Unit 3378"] = "Jednotka 3378", --- ["Unlimited Attacks"] = "", + ["Unlimited Attacks"] = "Neobmedzené útoky", -- ["User Challenge"] = "", ["Use your rope to get from start to finish as fast as you can!"] = "Použite lano na presun zo štartovnej pozície do cieľa tak rýchlo, ako to len viete!", --- ["v.06"] = "", + ["v.06"] = "v.06", ["Victory for the "] = "Víťazstvo pre", -- CTF_Blizzard, Capture_the_Flag -- ["Waypoint placed."] = "", -- ["Weapons Reset"] = "", diff -r ba4c3a4c8b09 -r e27100a0e2d0 share/hedgewars/Data/Scripts/Multiplayer/Tumbler.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/Tumbler.lua Thu Sep 01 14:55:31 2011 +0200 +++ b/share/hedgewars/Data/Scripts/Multiplayer/Tumbler.lua Thu Sep 01 17:03:19 2011 +0200 @@ -1,36 +1,41 @@ ------------------------------------ -- TUMBLER --- v.0.6 +-- v.0.7 ------------------------------------ loadfile(GetDataPath() .. "Scripts/Locale.lua")() loadfile(GetDataPath() .. "Scripts/Tracker.lua")() ---local fMod = 1 --.15 local fMod = 1000000 -- use this for dev and .16+ games -local moveTimer = 0 + local leftOn = false local rightOn = false local upOn = false local downOn = false +local preciseOn = false -local preciseOn = false ---local HJumpOn = false ---local LJumpON = false -local fireTimer = 0 -local scoreTag = nil local wep = {} local wepAmmo = {} +local wepCol = {} local wepIndex = 0 local wepCount = 0 +local fGears = 0 + +local mineSpawn +local barrelSpawn + local roundKills = 0 +local barrelsEaten = 0 +local minesEaten = 0 +local moveTimer = 0 +local fireTimer = 0 local TimeLeftCounter = 0 local TimeLeft = 0 local stopMovement = false local tumbleStarted = false -local beam = false +local vTag = {} ------------------------ -- version 0.4 @@ -72,38 +77,173 @@ -- modified crate frequencies a bit -- added some simple kill-based achievements, i think +------------------------ +-- version 0.7 +------------------------ + +-- a few code optimisations/performance tweaks +-- removed some deprecated code +-- fix a potential spawn bug + +-- improved HUD (now shows ammo counts) +-- improved user feedback (less generic messages) +-- colour-coded addcaptions to match hud :) + +-- base tumbling time now equals scheme turntime +-- tumbling time extension is now based on the amount of health contained in crate +-- new mines per turn based on minesnum +-- new barrels per turn based on explosives + +-- added 2 more achievements: barrel eater and mine eater (like kills, don't do anything atm) +-- slightly increased grab distance for explosives/mines +-- slightly increased flamer velocity +-- slightly decreased flamer volume +-- added a flame vaporiser (based on number of flame gears?) +-- give tumblers an extra 47 health on the start of their tumble to counter the grenade (exp) +-- refocus camera on tumbler on newturn (not on crates, barrels etc) +-- increase delay: yes, yes, eat your hearts out + +-- commit log +-- Better HUD +-- Allow more user customization +-- Bugfix for new gear spawns +-- Performance tweaks +-- Variety of small gameplay changes + --------------------------- -- some other ideas/things --------------------------- --[[ --- fix "ammo extended" message to be non-generic +-- add better gameflag handling -- fix flamer "shots remaining" message on start or choose a standard versus % -- add more sounds --- make barrels always explode? --- persistent ammo? --- allow custom turntime? --- dont hurt tumblers and restore their health at turn end? +-- better barrel/minespawn effects +-- separate grab distance for mines/barrels +-- [probably not] make barrels always explode? +-- [probably not] persistent ammo? +-- [probably not] dont hurt tumblers and restore their health at turn end? ]] -function DrawTags() + +---------------------------------------------------------------- +---------------------------------------------------------------- + +local flames = {} +local fGearValues = {} + +function runOnflames(func) + for k, gear in ipairs(flames) do + func(gear) + end +end + +function trackFGear(gear) + table.insert(flames, gear) +end + +function trackFGearDeletion(gear) + fGearValues[gear] = nil + for k, g in ipairs(flames) do + if g == gear then + table.remove(flames, k) + break + end + end +end + +function getFGearValue(gear, key) + if fGearValues[gear] ~= nil then + return fGearValues[gear][key] + end + return nil +end + +function setFGearValue(gear, key, value) + found = false + for id, values in pairs(fGearValues) do + if id == gear then + values[key] = value + found = true + end + end + if not found then + fGearValues[gear] = { [key] = value } + end +end + +function decreaseFGearValue(gear, key) + for id, values in pairs(fGearValues) do + if id == gear then + values[key] = values[key] - 1 + end + end +end + +function HandleLife(gear) + + decreaseFGearValue(gear, "L") + if getFGearValue(gear, "L") == 0 then + AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false) + DeleteGear(gear) + end + +end + +---------------------------------------------------------------- +---------------------------------------------------------------- + +function HideTags() + + for i = 0, 3 do + SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00) + end + +end + +function DrawTag(i) zoomL = 1.3 - DeleteVisualGear(scoreTag) - scoreTag = AddVisualGear(0, 0, vgtHealthTag, 0, false) - g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(scoreTag) + xOffset = 40 + + if i == 0 then + yOffset = 40 + tCol = 0xffba00ff --0xffed09ff --0xffba00ff + tValue = TimeLeft + elseif i == 1 then + zoomL = 1.1 + yOffset = 70 + tCol = wepCol[0] + tValue = wepAmmo[0] + elseif i == 2 then + zoomL = 1.1 + xOffset = 40 + 35 + yOffset = 70 + tCol = wepCol[1] + tValue = wepAmmo[1] + elseif i == 3 then + zoomL = 1.1 + xOffset = 40 + 70 + yOffset = 70 + tCol = wepCol[2] + tValue = wepAmmo[2] + end + + DeleteVisualGear(vTag[i]) + vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false) + g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vTag[i]) SetVisualGearValues ( - scoreTag, --id - -(ScreenWidth/2) + 45, --xoffset - ScreenHeight - 50, --yoffset + vTag[i], --id + -(ScreenWidth/2) + xOffset, --xoffset + ScreenHeight - yOffset, --yoffset 0, --dx 0, --dy zoomL, --zoom 1, --~= 0 means align to screen g7, --frameticks - TimeLeft, --value + tValue, --value 240000, --timer - 0xffba00ff --GetClanColor( GetHogClan(CurrentHedgehog) ) + tCol --GetClanColor( GetHogClan(CurrentHedgehog) ) ) end @@ -123,22 +263,34 @@ -- yes that was my justification for a non generic method function CheckProximityToExplosives(gear) - if (GetGearDistance(gear) < 1300) then + if (GetGearDistance(gear) < 1400) then if (GetGearType(gear) == gtExplosives) then - - wepAmmo[0] = wepAmmo[0] + 1 + + wepAmmo[0] = wepAmmo[0] + 1 PlaySound(sndShotgunReload) DeleteGear(gear) - AddCaption(loc("Ammo extended!")) - + AddCaption(wep[0] .. " " .. loc("ammo extended!"), wepCol[0], capgrpAmmoinfo ) + DrawTag(1) + + barrelsEaten = barrelsEaten + 1 + if barrelsEaten == 5 then + AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Barrel Eater!"),0xffba00ff,capgrpMessage2) + end + elseif (GetGearType(gear) == gtMine) then - wepAmmo[2] = wepAmmo[2] + 1 + wepAmmo[1] = wepAmmo[1] + 1 PlaySound(sndShotgunReload) DeleteGear(gear) - AddCaption(loc("Ammo extended!")) - end + AddCaption(wep[1] .. " " .. loc("ammo extended!"), wepCol[1], capgrpAmmoinfo ) + DrawTag(2) + + minesEaten = minesEaten + 1 + if minesEaten == 5 then + AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Mine Eater!"),0xffba00ff,capgrpMessage2) + end + end else --AddCaption("There is nothing here...") @@ -150,103 +302,38 @@ function CheckProximity(gear) dist = GetGearDistance(gear) - --15000 - if ((dist < 15000) and (beam == true)) and - ( (GetGearType(gear) == gtMine) or (GetGearType(gear) == gtExplosives) ) then - -- ndx, ndy = GetGearVelocity(CurrentHedgehog) - -- SetGearVelocity(gear, ndx, ndy) - --AddCaption("hello???") - elseif (dist < 1600) and (GetGearType(gear) == gtCase) then - - if GetHealth(gear) > 0 then + + if (dist < 1600) and (GetGearType(gear) == gtCase) then + + if GetHealth(gear) > 0 then - AddCaption(loc("Tumbling Time Extended!")) - TimeLeft = TimeLeft + 5 --5s - DrawTags() + AddCaption(loc("Tumbling Time Extended!"), 0xffba00ff, capgrpMessage2 ) + + TimeLeft = TimeLeft + HealthCaseAmount --5 --5s + DrawTag(0) --PlaySound(sndShotgunReload) else - wepAmmo[1] = wepAmmo[1] + 800 + wepAmmo[2] = wepAmmo[2] + 800 PlaySound(sndShotgunReload) - AddCaption(loc("Ammo extended!")) + AddCaption(wep[2] .. " " .. loc("fuel extended!"), wepCol[2], capgrpAmmoinfo ) + DrawTag(3) end - + DeleteGear(gear) end end ---[[function ProjectileTrack(gear) - - if (GetGearType(gear) == gtMine) or (GetGearType(gear) == gtExplosives) then - - dist = GetGearDistance(gear) - - alt = 1 - if (dist < 30000) then - alt = -1 - end - - if (dist < 60000) - --and (dist > 16000) - then - - --if (GetGearType(gear) == gtShell) then - turningSpeed = 0.1*fMod*alt - --end - - dx, dy = GetGearVelocity(gear) - - if GetX(gear) > GetX(CurrentHedgehog) then - dx = dx - turningSpeed - else - dx = dx + turningSpeed - end +function ChangeWeapon() - if GetY(gear) > GetY(CurrentHedgehog) then - dy = dy - turningSpeed - else - dy = dy + turningSpeed - end - - - if (GetGearType(gear) == gtShell) then - dxlimit = 0.4*fMod - dylimit = 0.4*fMod - end - - if dx > dxlimit then - dx = dxlimit - end - if dy > dylimit then - dy = dylimit - end - if dx < -dxlimit then - dx = -dxlimit - end - if dy < -dylimit then - dy = -dylimit - end - - SetGearVelocity(gear, dx, dy) - - end - + wepIndex = wepIndex + 1 + if wepIndex == wepCount then + wepIndex = 0 end -end]] - - -function ChangeWeapon() - - --new - wepIndex = wepIndex + 1 - if wepIndex == wepCount then - wepIndex = 0 - end - - AddCaption(wep[wepIndex] .. " " .. loc("selected!"), GetClanColor(GetHogClan(CurrentHedgehog)),capgrpAmmoinfo ) - AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2) + AddCaption(wep[wepIndex] .. " " .. loc("selected!"), wepCol[wepIndex],capgrpAmmoinfo ) + AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2) end @@ -259,7 +346,7 @@ if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and (wepAmmo[wepIndex] > 0) then wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1 - AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2) + AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2) if wep[wepIndex] == loc("Barrel Launcher") then morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1) @@ -268,10 +355,12 @@ x = x*2 y = y*2 SetGearVelocity(morte, x, y) - + DrawTag(1) + elseif wep[wepIndex] == loc("Mine Deployer") then morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtMine, 0, 0, 0, 0) SetTimer(morte, 1000) + DrawTag(2) end end @@ -285,26 +374,14 @@ end function onHJump() - -- pick up explosives if nearby them + -- pick up explosives/mines if nearby them if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then runOnGears(CheckProximityToExplosives) end end function onLJump() - -- for attracting mines and explosives if the beam is on - --[[if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then - if beam == false then - beam = true - AddCaption(loc("Mine-attractor on!")) - else - beam = false - AddCaption(loc("Mine-attractor off!")) - end - end]] - ChangeWeapon() - end ----------------- @@ -353,22 +430,53 @@ -------------------------- function onGameInit() - --Theme = "Hell" CaseFreq = 0 - HealthCaseProb = 0 + HealthCaseProb = 0 + Delay = 1000 + + mineSpawn = MinesNum + if mineSpawn > 4 then + mineSpawn = 4 + end + + barrelSpawn = Explosives + if barrelSpawn > 4 then + barrelSpawn = 4 + end + + --MinesNum = 0 + --Explosives = 0 + + for i = 0, 3 do + vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false) + end + + HideTags() + + wep[0] = loc("Barrel Launcher") + wep[1] = loc("Mine Deployer") + wep[2] = loc("Flamer") + + wepCol[0] = 0x78818eff + wepCol[1] = 0xa12a77ff + wepCol[2] = 0xf49318ff + + wepCount = 3 + end function onGameStart() - + ShowMission ( "TUMBLER", loc("a Hedgewars mini-game"), loc("Eliminate the enemy hogs to win.") .. "|" .. " " .. "|" .. - --loc("Round Limit") .. ": " .. roundLimit .. "|" .. - --loc("Turn Time") .. ": " .. (TurnTime/1000) .. loc("sec") .. "|" .. - --" " .. "|" .. + loc("New Mines Per Turn") .. ": " .. (mineSpawn) .. "|" .. + loc("New Barrels Per Turn") .. ": " .. (barrelSpawn) .. "|" .. + loc("Time Extension") .. ": " .. (HealthCaseAmount) .. loc("sec") .. "|" .. + " " .. "|" .. loc("Movement: [Up], [Down], [Left], [Right]") .. "|" .. loc("Fire") .. ": " .. loc("[Left Shift]") .. "|" .. @@ -381,72 +489,66 @@ loc("Ammo is reset at the end of your turn.") .. "|" .. "", 4, 4000 - ) - - scoreTag = AddVisualGear(0, 0, vgtHealthTag, 0, false) - --DrawTags() - - SetVisualGearValues(scoreTag,0,0,0,0,0,1,0, 0, 240000, 0xffffff00) - - wep[0] = loc("Barrel Launcher") - wep[1] = loc("Flamer") - wep[2] = loc("Mine Deployer") - wepCount = 3 + ) end function onNewTurn() - + stopMovement = false tumbleStarted = false - beam = false - -- randomly create 2 new barrels and 3 mines on the map every turn - for i = 0, 1 do - gear = AddGear(0, 0, gtExplosives, 0, 0, 0, 0) + -- randomly create new barrels mines on the map every turn (can be disabled by setting mine/barrels to 0 in scheme) + for i = 0, barrelSpawn-1 do + gear = AddGear(100, 100, gtExplosives, 0, 0, 0, 0) SetHealth(gear, 100) - FindPlace(gear, false, 0, LAND_WIDTH) - tempE = AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) + if FindPlace(gear, false, 0, LAND_WIDTH, false) ~= nil then + tempE = AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) + end end - for i = 0, 2 do - gear = AddGear(0, 0, gtMine, 0, 0, 0, 0) - FindPlace(gear, false, 0, LAND_WIDTH) - tempE = AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) + for i = 0, mineSpawn-1 do + gear = AddGear(100, 100, gtMine, 0, 0, 0, 0) + if FindPlace(gear, false, 0, LAND_WIDTH, false) ~= nil then + tempE = AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) + end end + -- randomly spawn time extension crates / flamer fuel on the map r = GetRandom(100) if r > 50 then - SpawnHealthCrate(0, 0) + gear = SpawnHealthCrate(0, 0) end r = GetRandom(100) if r > 70 then - SpawnAmmoCrate(0, 0, amSkip) + gear = SpawnAmmoCrate(0, 0, amSkip) end - --DrawTags() - SetVisualGearValues(scoreTag,0,0,0,0,0,1,0, 0, 240000, 0xffffff00) + HideTags() --reset ammo counts wepAmmo[0] = 2 - wepAmmo[1] = 50 - wepAmmo[2] = 1 + wepAmmo[1] = 1 + wepAmmo[2] = 50 -- 50000 -- 50 wepIndex = 2 ChangeWeapon() roundKills = 0 + barrelsEaten = 0 + minesEaten = 0 + + FollowGear(CurrentHedgehog) end function DisableTumbler() stopMovement = true - beam = false upOn = false down = false leftOn = false rightOn = false - SetVisualGearValues(scoreTag,0,0,0,0,0,1,0, 0, 240000, 0xffffff00) + HideTags() end function onGameTick() @@ -456,33 +558,27 @@ if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then --AddCaption(loc("Good to go!")) tumbleStarted = true - TimeLeft = 30 + TimeLeft = (TurnTime/1000) AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1) - DrawTags() + SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog) + 47) -- new + for i = 0, 3 do + DrawTag(i) + end end end if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then - --AddCaption(GetX(CurrentHedgehog) .. ";" .. GetY(CurrentHedgehog) ) - - runOnGears(CheckProximity) -- crates and mines - - --if beam == true then - -- runOnGears(ProjectileTrack) - --end + runOnGears(CheckProximity) -- crates -- Calculate and display turn time TimeLeftCounter = TimeLeftCounter + 1 if TimeLeftCounter == 1000 then TimeLeftCounter = 0 TimeLeft = TimeLeft - 1 - - if TimeLeft >= 0 then - --AddCaption(TimeLeft) - DrawTags() + DrawTag(0) end end @@ -496,6 +592,8 @@ if moveTimer == 100 then -- 100 moveTimer = 0 + runOnflames(HandleLife) + --------------- -- new trail code --------------- @@ -540,8 +638,6 @@ dy = dy + 0.1*fMod end - - SetGearVelocity(CurrentHedgehog, dx, dy) end @@ -550,18 +646,19 @@ --flamer -- fireTimer = fireTimer + 1 - if fireTimer == 5 then -- 5 --10 + if fireTimer == 6 then -- 5 --10 fireTimer = 0 if (wep[wepIndex] == loc("Flamer") ) and (preciseOn == true) and (wepAmmo[wepIndex] > 0) and (stopMovement == false) and (tumbleStarted == true) then - wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1 - AddCaption( - loc("Flamer") .. ": " .. - (wepAmmo[wepIndex]/800*100) - (wepAmmo[wepIndex]/800*100)%2 .. "%", - GetClanColor(GetHogClan(CurrentHedgehog)), + wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1 + AddCaption( + loc("Flamer") .. ": " .. + (wepAmmo[wepIndex]/800*100) - (wepAmmo[wepIndex]/800*100)%2 .. "%", + wepCol[2], capgrpMessage2 - ) + ) + DrawTag(3) dx, dy = GetGearVelocity(CurrentHedgehog) shell = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtFlame, 0, 0, 0, 0) @@ -582,16 +679,14 @@ ydev = ydev*-1 end - --*13 --8 - SetGearVelocity(shell, (dx*4)+(xdev*fMod), (dy*4)+(ydev*fMod)) --10 + --*13 --8 *-4 + SetGearVelocity(shell, (dx*4.5)+(xdev*fMod), (dy*4.5)+(ydev*fMod)) --10 end end -- - - end @@ -600,7 +695,6 @@ function isATrackedGear(gear) if (GetGearType(gear) == gtExplosives) or (GetGearType(gear) == gtMine) or - (GetGearType(gear) == gtShell) or -- new -- gtBall (GetGearType(gear) == gtCase) then return(true) @@ -609,7 +703,6 @@ end end - --[[function onGearDamage(gear, damage) if gear == CurrentHedgehog then -- You are now tumbling @@ -618,50 +711,60 @@ function onGearAdd(gear) - if isATrackedGear(gear) then + if GetGearType(gear) == gtFlame then + + trackFGear(gear) + + fGears = fGears +1 + + if fGears < 80 then + setFGearValue(gear,"L",30) + else + setFGearValue(gear,"L",5) --3 + end + + elseif isATrackedGear(gear) then trackGear(gear) end - --if GetGearType(gear) == gtBall then - -- SetTimer(gear, 15000) - --end - end function onGearDelete(gear) - if isATrackedGear(gear) then + if GetGearType(gear) == gtFlame then + trackFGearDeletion(gear) + fGears = fGears -1 + + elseif isATrackedGear(gear) then trackDeletion(gear) + + -- achievements? prototype + elseif GetGearType(gear) == gtHedgehog then + + if GetHogTeamName(gear) ~= GetHogTeamName(CurrentHedgehog) then + + roundKills = roundKills + 1 + if roundKills == 2 then + AddCaption(loc("Double Kill!"),0xffba00ff,capgrpMessage2) + elseif roundKills == 3 then + AddCaption(loc("Killing spree!"),0xffba00ff,capgrpMessage2) + elseif roundKills >= 4 then + AddCaption(loc("Unstoppable!"),0xffba00ff,capgrpMessage2) + end + + elseif gear == CurrentHedgehog then + DisableTumbler() + + elseif gear ~= CurrentHedgehog then + AddCaption(loc("Friendly Fire!"),0xffba00ff,capgrpMessage2) + end + end if CurrentHedgehog ~= nil then FollowGear(CurrentHedgehog) end - if gear == CurrentHedgehog then - DisableTumbler() - end +end - -- achievements? prototype - if GetGearType(gear) == gtHedgehog then - if GetHogTeamName(gear) ~= GetHogTeamName(CurrentHedgehog) then - - roundKills = roundKills + 1 - if roundKills == 2 then - AddCaption(loc("Double Kill!"),0xffba00ff,capgrpMessage2) - elseif roundKills == 3 then - AddCaption(loc("Killing spree!"),0xffba00ff,capgrpMessage2) - elseif roundKills >= 4 then - AddCaption(loc("Unstoppable!"),0xffba00ff,capgrpMessage2) - end - - elseif gear ~= CurrentHedgehog then - AddCaption(loc("Friendly Fire!"),0xffba00ff,capgrpMessage2) - end - - end - - - -end diff -r ba4c3a4c8b09 -r e27100a0e2d0 share/hedgewars/Data/Sounds/sinegun.ogg Binary file share/hedgewars/Data/Sounds/sinegun.ogg has changed diff -r ba4c3a4c8b09 -r e27100a0e2d0 share/hedgewars/Data/Themes/Blox/theme.cfg --- a/share/hedgewars/Data/Themes/Blox/theme.cfg Thu Sep 01 14:55:31 2011 +0200 +++ b/share/hedgewars/Data/Themes/Blox/theme.cfg Thu Sep 01 17:03:19 2011 +0200 @@ -5,4 +5,4 @@ water-opacity = $80 music = Nature.ogg clouds = 0 -flakes = 100, 2, 500, 100, 300 +flakes = 0, 0, 0, 0, 0 diff -r ba4c3a4c8b09 -r e27100a0e2d0 share/hedgewars/Data/Themes/EarthRise/horizontL.png Binary file share/hedgewars/Data/Themes/EarthRise/horizontL.png has changed