# HG changeset patch # User koda # Date 1286826325 -7200 # Node ID cbec77b5f706bba2f3a5b713edcfc63dd9793247 # Parent d6412423da459022eb0d359d2a6c8187259c554e# Parent 09eea558ba83935dda6d42616049799773fdcde0 merge diff -r d6412423da45 -r cbec77b5f706 QTfrontend/hwconsts.cpp.in --- a/QTfrontend/hwconsts.cpp.in Mon Oct 11 03:28:15 2010 +0200 +++ b/QTfrontend/hwconsts.cpp.in Mon Oct 11 21:45:25 2010 +0200 @@ -36,10 +36,10 @@ int cMaxTeams = 6; QString * cDefaultAmmoStore = new QString( - "939192942219912103223511100120100000021111010101" - "040504054160065554655446477657666666615551010111" - "000000000000020550000004000700400000000020000000" - "131111031211111112311411111111111111121111110111" + "9391929422199121032235111001201000000211110101011" + "0405040541600655546554464776576666666155510101117" + "0000000000000205500000040007004000000000200000000" + "1311110312111111123114111111111111111211111101111" ); int cAmmoNumber = cDefaultAmmoStore->size() / 4; @@ -47,30 +47,30 @@ QList< QPair >() << qMakePair(QString("Default"), *cDefaultAmmoStore) << qMakePair(QString("Crazy"), QString( - "999999999999999999299999999999999929999999990999" // TODO: Remove Piano's unlimited uses! - "111111011111111111111111111111111111111111110111" - "000000000000000000000000000000000000000000000000" - "131111031211111112311411111111111111121111010111")) + "9999999999999999992999999999999999299999999909999" // TODO: Remove Piano's unlimited uses! + "1111110111111111111111111111111111111111111101111" + "0000000000000000000000000000000000000000000000000" + "1311110312111111123114111111111111111211110101111")) << qMakePair(QString("Pro mode"), QString( - "909000900000000000000900000000000000000000000000" - "000000000000000000000000000000000000000000000000" - "000000000000020550000004000700400000000020000000" - "111111111111111111111111111111111111111110010111")) + "9090009000000000000009000000000000000000000000000" + "0000000000000000000000000000000000000000000000000" + "0000000000000205500000040007004000000000200000000" + "1111111111111111111111111111111111111111100101111")) << qMakePair(QString("Shoppa"), QString( - "000000990000000000000000000000000000000000000000" - "444441004424440221011212122242200000000200040001" - "000000000000000000000000000000000000000000000000" - "111111111111111111111111111111111111111110110111")) + "0000009900000000000000000000000000000000000000000" + "4444410044244402210112121222422000000002000400010" + "0000000000000000000000000000000000000000000000000" + "1111111111111111111111111111111111111111101101111")) << qMakePair(QString("Basketball"),QString( - "000000900000090000000000000000000000000000000000" - "000000000000000000000000000000000000000000000000" - "000000000000000550000004000700400000000020000000" - "111111111111111111111111111111111111111111110111")) + "0000009000000900000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000" + "0000000000000005500000040007004000000000200000000" + "1111111111111111111111111111111111111111111101111")) << qMakePair(QString("Minefield"), QString( - "000000990009000000030000000000000000000000000000" - "000000000000000000000000000000000000000000000000" - "000000000000020550000004000700400000000020000000" - "111111111111111111111111111111111111111111110111")) + "0000009900090000000300000000000000000000000000000" + "0000000000000000000000000000000000000000000000000" + "0000000000000205500000040007004000000000200000000" + "1111111111111111111111111111111111111111111101111")) ; QColor *colors[] = { diff -r d6412423da45 -r cbec77b5f706 QTfrontend/mapContainer.cpp --- a/QTfrontend/mapContainer.cpp Mon Oct 11 03:28:15 2010 +0200 +++ b/QTfrontend/mapContainer.cpp Mon Oct 11 21:45:25 2010 +0200 @@ -154,7 +154,7 @@ gbTLayout->setSpacing(0); lwThemes = new QListWidget(this); lwThemes->setMinimumHeight(30); - lwThemes->setFixedWidth(120); + lwThemes->setFixedWidth(140); for (int i = 0; i < Themes->size(); ++i) { QListWidgetItem * lwi = new QListWidgetItem(); lwi->setText(Themes->at(i)); diff -r d6412423da45 -r cbec77b5f706 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Mon Oct 11 03:28:15 2010 +0200 +++ b/hedgewars/GSHandlers.inc Mon Oct 11 21:45:25 2010 +0200 @@ -859,6 +859,7 @@ StopSound(Gear^.SoundChannel); DeleteGear(Gear); AfterAttack; + doStepHedgehogMoving(HHGear); // for gfInfAttack exit end; @@ -1456,7 +1457,7 @@ dec(Gear^.Timer); end else // gsttmpFlag = 0 - if TurnTimeLeft = 0 then Gear^.State := Gear^.State or gsttmpFlag; + if (TurnTimeLeft = 0) or ((GameFlags and gfInfAttack) <> 0) then Gear^.State := Gear^.State or gsttmpFlag; end; //////////////////////////////////////////////////////////////////////////////// @@ -2933,7 +2934,7 @@ AfterAttack; CurAmmoGear := nil; - TurnTimeLeft := 14 * 125; + if (GameFlags and gfInfAttack) = 0 then TurnTimeLeft := 14 * 125; if (TrainingFlags and tfRCPlane) <> 0 then TurnTimeLeft := 0; @@ -3695,7 +3696,8 @@ CurrentHedgehog^.Gear^.Active := true; CurrentHedgehog^.Gear^.X := Gear^.X; CurrentHedgehog^.Gear^.Y := int2hwFloat(cWaterLine+cVisibleWater)+_128; - CurrentHedgehog^.Unplaced := false + CurrentHedgehog^.Unplaced := false; + TurnTimeLeft:= 0 end; ResumeMusic end; @@ -3713,7 +3715,8 @@ CurrentHedgehog^.Gear^.Active := true; CurrentHedgehog^.Gear^.X := Gear^.X; CurrentHedgehog^.Gear^.Y := int2hwFloat(cWaterLine+cVisibleWater)+_128; - CurrentHedgehog^.Unplaced := false + CurrentHedgehog^.Unplaced := false; + TurnTimeLeft:= 0 end; ResumeMusic end @@ -4080,3 +4083,80 @@ doStepHammerHitWork(Gear); Gear^.doStep := @doStepHammerHitWork end; + + +procedure doStepResurrectorWork(Gear: PGear); +var + graves: TPGearArray; + resgear: PGear; + hh: PHedgehog; + i: LongInt; +begin + AllInactive := false; + hh := PHedgehog(Gear^.Hedgehog); + RenderHealth(hh^); + DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy - + cHHRadius - 14 - hh^.HealthTagTex^.h, hh^.HealthTagTex); + DrawCircle(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, 1.5, 0, 0, $FF, + $FF); + + if ((Gear^.Message and gmUp) <> 0) then begin + if (GameTicks and $F) <> 0 then exit; + end else begin + if (GameTicks and $1FF) <> 0 then exit; + end; + + graves := GearsNear(hh^.Gear, gtGrave, Gear^.Radius); + + if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) then begin + i := getRandom(Length(graves)); + writeln(i); + dec(hh^.Gear^.Health); + inc(graves[i]^.Health); +{-for i:= 0 to High(graves) do begin + if hh^.Gear^.Health > 0 then begin + dec(hh^.Gear^.Health); + inc(graves[i]^.Health); + end; + end; -} + end else begin + // now really resurrect the hogs with the hp saved in the graves + for i:= 0 to High(graves) do begin + if graves[i]^.Health > 0 then begin + resgear := AddGear(hwRound(graves[i]^.X), hwRound(graves[i]^.Y), + gtHedgehog, gstWait, _0, _0, 0); + resgear^.Hedgehog := graves[i]^.Hedgehog; + resgear^.Health := graves[i]^.Health; + PHedgehog(graves[i]^.Hedgehog)^.Gear := resgear; + DeleteGear(graves[i]); + RenderHealth(PHedgehog(resgear^.Hedgehog)^); + RecountTeamHealth(Phedgehog(resgear^.Hedgehog)^.Team); + end; + end; + Gear^.Timer := 250; + Gear^.doStep := @doStepIdle; + end; +end; + +procedure doStepResurrector(Gear: PGear); +var + graves: TPGearArray; + hh: PHedgehog; + i: LongInt; +begin + AllInactive := false; + hh := PHedgehog(Gear^.Hedgehog); + graves := GearsNear(hh^.Gear, gtGrave, Gear^.Radius); + + if Length(graves) > 0 then begin + for i:= 0 to High(graves) do begin + PHedgehog(graves[i]^.Hedgehog)^.Gear := nil; + graves[i]^.Health := 0; + end; + Gear^.doStep := @doStepResurrectorWork; + end else begin + Gear^.Timer := 250; + Gear^.doStep := @doStepIdle; + end; +end; + diff -r d6412423da45 -r cbec77b5f706 hedgewars/GearDrawing.inc --- a/hedgewars/GearDrawing.inc Mon Oct 11 03:28:15 2010 +0200 +++ b/hedgewars/GearDrawing.inc Mon Oct 11 21:45:25 2010 +0200 @@ -277,6 +277,9 @@ 0); defaultPos:= false end; + gtResurrector: begin + // yet to come? + end; gtKamikaze: begin if CurAmmoGear^.Pos = 0 then DrawHedgehog(sx, sy, @@ -431,6 +434,10 @@ end; amBee: DrawRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, hwSign(Gear^.dX), aangle); amFlamethrower: DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, hwSign(Gear^.dX), aangle); + amResurrector: begin + DrawCircle(hwRound(Gear^.X), hwRound(Gear^.y), 100, 1.5, 0, 0, + $FF, $FF); // I'd rather not like to hardcore 100 here + end; end; case amt of diff -r d6412423da45 -r cbec77b5f706 hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Mon Oct 11 03:28:15 2010 +0200 +++ b/hedgewars/HHHandlers.inc Mon Oct 11 21:45:25 2010 +0200 @@ -69,11 +69,12 @@ inc(ammoidx); if (ammoidx > cMaxSlotAmmoIndex) then begin - ammoidx:= 0; inc(i); - TryDo(i < 2, 'Engine bug: no ammo in current slot', true) + CurAmmoType:= amNothing; + ammoidx:= -1; + //TryDo(i < 2, 'Engine bug: no ammo in current slot', true) end; - until (Ammo^[slot, ammoidx].Count > 0) and (Team^.Clan^.TurnNumber > Ammoz[Ammo^[slot, ammoidx].AmmoType].SkipTurns) + until ((Ammo^[slot, ammoidx].Count > 0) and (Team^.Clan^.TurnNumber > Ammoz[Ammo^[slot, ammoidx].AmmoType].SkipTurns)) or (i = 1) end else begin @@ -267,6 +268,9 @@ PauseMusic end; amFlamethrower: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtFlamethrower, 0, xx * _0_5, yy * _0_5, 0); + amResurrector: CurAmmoGear:= AddGear(hwRound(lx), + hwRound(ly), gtResurrector, 0, _0, + _0, 0); end; uStats.AmmoUsed(CurAmmoType); @@ -323,13 +327,14 @@ end else begin - OnUsedAmmo(CurrentHedgehog^); if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) = 0) and ((GameFlags and gfInfAttack) = 0) then begin TurnTimeLeft:= Ammoz[CurAmmoType].TimeAfterTurn; - end - else ApplyAmmoChanges(CurrentHedgehog^); + State:= State or gstAttacked + end; + if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) <> 0 then ApplyAmmoChanges(CurrentHedgehog^); if (GameFlags and gfInfAttack) <> 0 then State:= State or gstAttacked; + OnUsedAmmo(CurrentHedgehog^) end; end else diff -r d6412423da45 -r cbec77b5f706 hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Mon Oct 11 03:28:15 2010 +0200 +++ b/hedgewars/uAIAmmoTests.pas Mon Oct 11 21:45:25 2010 +0200 @@ -100,7 +100,8 @@ (proc: @TestShotgun; flags: 0), // amSineGun (proc: nil; flags: 0), // amFlamethrower (proc: @TestGrenade; flags: 0), // amSMine - (proc: @TestFirePunch; flags: 0) // amHammer + (proc: @TestFirePunch; flags: 0), // amHammer + (proc: nil; flags: 0) // amResurrector ); const BadTurn = Low(LongInt) div 4; diff -r d6412423da45 -r cbec77b5f706 hedgewars/uAmmos.pas --- a/hedgewars/uAmmos.pas Mon Oct 11 03:28:15 2010 +0200 +++ b/hedgewars/uAmmos.pas Mon Oct 11 21:45:25 2010 +0200 @@ -53,6 +53,7 @@ type TAmmoCounts = array[TAmmoType] of Longword; var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo; ammoLoadout, ammoProbability, ammoDelay, ammoReinforcement: shortstring; + InitialCounts: array[0..Pred(cMaxHHs)] of TAmmoCounts; procedure FillAmmoStore(Ammo: PHHAmmo; var cnts: TAmmoCounts); var mi: array[0..cMaxSlotIndex] of byte; @@ -68,12 +69,11 @@ begin TryDo(mi[Ammoz[a].Slot] <= cMaxSlotAmmoIndex, 'Ammo slot overflow', true); Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo; - - Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= cnts[a]; - Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].InitialCount:= cnts[a]; - - if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then - Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= AMMO_INFINITE; + with Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]] do + begin + Count:= cnts[a]; + if (TotalRounds < 0) and ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then Count:= AMMO_INFINITE; + end; inc(mi[Ammoz[a].Slot]) end else if (TotalRounds < 0) and ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then @@ -82,7 +82,6 @@ Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo; Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= AMMO_INFINITE; - Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].InitialCount:= 0; inc(mi[Ammoz[a].Slot]) end @@ -144,10 +143,10 @@ if ((GameFlags and gfPlaceHog) <> 0) and (a <> amTeleport) and (a <> amSkip) and (Ammoz[a].SkipTurns < 10000) then inc(Ammoz[a].SkipTurns,10000) - end else - ammos[a]:= AMMO_INFINITE + end + else ammos[a]:= AMMO_INFINITE; + InitialCounts[Pred(StoreCnt)][a]:= ammos[a]; end; - FillAmmoStore(StoresList[Pred(StoreCnt)], ammos) end; @@ -384,7 +383,7 @@ if (Propz and ammoprop_NotBorder) <> 0 then begin Count:= 0; - InitialCount:= 0 + InitialCounts[i][AmmoType]:= 0 end; PackAmmo(StoresList[i], slot) @@ -416,20 +415,17 @@ // Restore indefinitely disabled weapons and initial weapon counts. Only used for hog placement right now procedure ResetWeapons; -var i, slot, a: Longword; - t: TAmmoType; +var i, t: Longword; + a: TAmmoType; begin -for i:= 0 to Pred(StoreCnt) do - for slot:= 0 to cMaxSlotIndex do - begin - for a:= 0 to cMaxSlotAmmoIndex do - with StoresList[i]^[slot, a] do - Count:= InitialCount; +for t:= 0 to Pred(TeamsCount) do + with TeamsArray[t]^ do + for i:= 0 to cMaxHHIndex do + if Hedgehogs[i].Gear <> nil then + FillAmmoStore(Hedgehogs[i].Ammo, InitialCounts[Hedgehogs[i].AmmoStore]); - PackAmmo(StoresList[i], slot) - end; -for t:= Low(TAmmoType) to High(TAmmoType) do - if Ammoz[t].SkipTurns >= 10000 then dec(Ammoz[t].SkipTurns,10000); +for a:= Low(TAmmoType) to High(TAmmoType) do + if Ammoz[a].SkipTurns >= 10000 then dec(Ammoz[a].SkipTurns,10000) end; procedure initModule; @@ -439,7 +435,8 @@ ammoLoadout:= ''; ammoProbability:= ''; ammoDelay:= ''; - ammoReinforcement:= '' + ammoReinforcement:= ''; + FillChar(InitialCounts, sizeof(InitialCounts), 0) end; procedure freeModule; diff -r d6412423da45 -r cbec77b5f706 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Mon Oct 11 03:28:15 2010 +0200 +++ b/hedgewars/uConsts.pas Mon Oct 11 21:45:25 2010 +0200 @@ -74,7 +74,7 @@ sprBigExplosion, sprSmokeRing, sprBeeTrace, sprEgg, sprTargetBee, sprHandBee, sprFeather, sprPiano, sprHandSineGun, sprPortalGun, sprPortal, sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk, sprNote, - sprSMineOff, sprSMineOn, sprHandSMine, sprHammer + sprSMineOff, sprSMineOn, sprHandSMine, sprHammer, sprResurrector ); // Gears that interact with other Gears and/or Land @@ -88,7 +88,7 @@ gtHellishBomb, gtWaterUp, gtDrill, gtBallGun, gtBall, gtRCPlane, // 40 gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy, // 45 gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 51 - gtSMine, gtPoisonCloud, gtHammer, gtHammerHit); + gtSMine, gtPoisonCloud, gtHammer, gtHammerHit, gtResurrector); // Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.) TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire, @@ -132,7 +132,8 @@ amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun, // 30 amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime, // 35 amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy, amPortalGun, // 42 - amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine, amHammer); // 48 + amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine, amHammer, // 48 + amResurrector); TCrateType = (HealthCrate, AmmoCrate, UtilityCrate); @@ -160,7 +161,6 @@ Count: LongWord; (* Using for place hedgehogs mode, but for any other situation where the initial count would be needed I guess. For example, say, a mode where the weaponset is reset each turn, or on sudden death *) - InitialCount: LongWord; NumPerTurn: LongWord; Timer: LongWord; Pos: LongWord; @@ -816,7 +816,11 @@ (FileName: 'amSMine'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandSMine (FileName: 'amHammer'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 128; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true) // sprWhip + Width: 128; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true), // sprWhip + (FileName: 'amResurrector'; Path: ptHedgehog; AltPath: ptNone; + Texture: nil; Surface: nil; Width: 128; Height: 64; + imageWidth: 0; imageHeight: 0; saveSurf: false; priority: + tpMedium; getDimensions: false; getImageDimensions: true) ); Wavez: array [TWave] of record @@ -970,7 +974,6 @@ NumberInCase: 0; Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold or ammoprop_Effect; Count: AMMO_INFINITE; - InitialCount: AMMO_INFINITE; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -994,7 +997,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse; Count: AMMO_INFINITE; - InitialCount: AMMO_INFINITE; NumPerTurn: 0; Timer: 3000; Pos: 0; @@ -1018,7 +1020,6 @@ NumberInCase: 3; Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse; Count: 5; - InitialCount: 5; NumPerTurn: 0; Timer: 3000; Pos: 0; @@ -1042,7 +1043,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_Power or ammoprop_AltUse; Count: AMMO_INFINITE; - InitialCount: AMMO_INFINITE; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1066,7 +1066,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_Power or ammoprop_NeedTarget or ammoprop_DontHold; Count: 2; - InitialCount: 2; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1090,7 +1089,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_ForwMsgs; Count: AMMO_INFINITE; - InitialCount: AMMO_INFINITE; NumPerTurn: 1; Timer: 0; Pos: 0; @@ -1114,7 +1112,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInMove or ammoprop_NoCrosshair or ammoprop_DontHold; Count: 2; - InitialCount: 2; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1138,7 +1135,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold; Count: AMMO_INFINITE; - InitialCount: AMMO_INFINITE; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1166,7 +1162,6 @@ ammoprop_Utility or ammoprop_AltAttack; Count: 5; - InitialCount: 5; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1190,7 +1185,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInMove or ammoprop_DontHold or ammoprop_AltUse; Count: 2; - InitialCount: 2; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1214,7 +1208,6 @@ NumberInCase: 2; Ammo: (Propz: 0; Count: 3; - InitialCount: 3; NumPerTurn: 3; Timer: 0; Pos: 0; @@ -1238,7 +1231,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInMove or ammoprop_DontHold or ammoprop_AltUse; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1262,7 +1254,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_ForwMsgs or ammoprop_AttackInMove; Count: AMMO_INFINITE; - InitialCount: AMMO_INFINITE; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1286,7 +1277,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_NoCrosshair; Count: AMMO_INFINITE; - InitialCount: AMMO_INFINITE; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1310,7 +1300,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_DontHold; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1340,7 +1329,6 @@ ammoprop_Utility or ammoprop_AltAttack; Count: 2; - InitialCount: 2; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1368,7 +1356,6 @@ ammoprop_DontHold or ammoprop_NotBorder; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1396,7 +1383,6 @@ ammoprop_DontHold or ammoprop_NotBorder; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1420,7 +1406,6 @@ NumberInCase: 2; Ammo: (Propz: ammoprop_ForwMsgs; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1448,7 +1433,6 @@ ammoprop_Utility or ammoprop_AttackingPut; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1477,7 +1461,6 @@ ammoprop_Utility or ammoprop_DontHold; Count: 2; - InitialCount: 2; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1505,7 +1488,6 @@ ammoprop_Utility or ammoprop_DontHold; Count: 3; - InitialCount: 3; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1529,7 +1511,6 @@ NumberInCase: 4; Ammo: (Propz: 0; Count: 4; - InitialCount: 4; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1553,7 +1534,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold or ammoprop_AttackInMove; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1577,7 +1557,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_NoCrosshair or ammoprop_DontHold; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1601,7 +1580,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1625,7 +1603,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse; Count: 0; - InitialCount: 0; NumPerTurn: 0; Timer: 3000; Pos: 0; @@ -1649,7 +1626,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_Power or ammoprop_AltUse; Count: 0; - InitialCount: 0; NumPerTurn: 0; Timer: 5000; Pos: 0; @@ -1677,7 +1653,6 @@ ammoprop_DontHold or ammoprop_NotBorder; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1701,7 +1676,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_Power or ammoprop_AltUse; Count: AMMO_INFINITE; - InitialCount: AMMO_INFINITE; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1725,7 +1699,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold; Count: AMMO_INFINITE; - InitialCount: AMMO_INFINITE; NumPerTurn: 0; Timer: 5001; Pos: 0; @@ -1751,7 +1724,6 @@ ammoprop_DontHold or ammoprop_AltAttack}; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1780,7 +1752,6 @@ ammoprop_Utility or ammoprop_Effect; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1809,7 +1780,6 @@ ammoprop_Utility or ammoprop_Effect; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1838,7 +1808,6 @@ ammoprop_Utility or ammoprop_Effect; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1867,7 +1836,6 @@ ammoprop_Utility or ammoprop_Effect; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1896,7 +1864,6 @@ ammoprop_Utility or ammoprop_Effect; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1925,7 +1892,6 @@ ammoprop_Utility or ammoprop_Effect; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -1949,7 +1915,6 @@ NumberInCase: 2; Ammo: (Propz: 0; Count: 2; - InitialCount: 2; NumPerTurn: 1; Timer: 0; Pos: 0; @@ -1979,7 +1944,6 @@ ammoprop_Utility or ammoprop_AltAttack; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -2003,7 +1967,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_Power or ammoprop_AltUse; Count: AMMO_INFINITE; - InitialCount: AMMO_INFINITE; NumPerTurn: 0; Timer: 3000; Pos: 0; @@ -2029,7 +1992,6 @@ ammoprop_NoCrosshair or ammoprop_DontHold; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -2056,7 +2018,6 @@ ammoprop_DontHold or ammoprop_Utility; Count: 1; - InitialCount: 1; NumPerTurn: 3; Timer: 0; Pos: 0; @@ -2084,7 +2045,6 @@ ammoprop_DontHold or ammoprop_NotBorder; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -2108,7 +2068,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse; Count: AMMO_INFINITE; - InitialCount: AMMO_INFINITE; NumPerTurn: 0; Timer: 3000; Pos: 0; @@ -2132,7 +2091,6 @@ NumberInCase: 2; Ammo: (Propz: ammoprop_AttackInMove; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -2156,7 +2114,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 5001; Pos: 0; @@ -2180,7 +2137,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_Power or ammoprop_AltUse; Count: 1; - InitialCount: 0; NumPerTurn: 1; Timer: 0; Pos: 0; @@ -2204,7 +2160,6 @@ NumberInCase: 1; Ammo: (Propz: ammoprop_NoCrosshair; Count: 1; - InitialCount: 1; NumPerTurn: 0; Timer: 0; Pos: 0; @@ -2219,8 +2174,31 @@ PosCount: 1; PosSprite: sprWater; ejectX: 0; + ejectY: 0), + + (NameId: sidResurrector; + NameTex: nil; + Probability: 0; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoCrosshair; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amResurrector; + AttackVoice: sndNone); + Slot: 8; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; ejectY: 0) - ); + ); + conversionFormat: TSDL_PixelFormat = ( diff -r d6412423da45 -r cbec77b5f706 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Mon Oct 11 03:28:15 2010 +0200 +++ b/hedgewars/uGears.pas Mon Oct 11 21:45:25 2010 +0200 @@ -62,6 +62,7 @@ SoundChannel: LongInt; PortalCounter: LongWord // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion. end; + TPGearArray = Array of PGear; var AllInactive: boolean; PrvInactive: boolean; @@ -120,6 +121,7 @@ procedure doMakeExplosion(X, Y, Radius: LongInt; Mask, Tint: LongWord); forward; procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward; //procedure AmmoFlameWork(Ammo: PGear); forward; +function GearsNear(Gear: PGear; Kind: TGearType; r: LongInt): TPGearArray; forward; function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; forward; procedure SpawnBoxOfSmth; forward; procedure AfterAttack; forward; @@ -206,7 +208,8 @@ @doStepSMine, @doStepPoisonCloud, @doStepHammer, - @doStepHammerHit + @doStepHammerHit, + @doStepResurrector ); procedure InsertGearToList(Gear: PGear); @@ -533,7 +536,11 @@ gear^.Timer:= 5000; gear^.dY:= int2hwfloat((-4 + getRandom(8))) / 1000; end; - end; + gtResurrector: begin + gear^.Radius := 100; + end; + end; + InsertGearToList(gear); AddGear:= gear; @@ -846,15 +853,19 @@ else if ((GameFlags and gfInfAttack) <> 0) then begin if delay2 = 0 then - delay2:= cInactDelay + delay2:= cInactDelay * 4 else + begin dec(delay2); - if delay2 = 0 then - begin - if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) then CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State and not gstAttacked; - CheckNoDamage; - CheckForWin + if ((delay2 mod cInactDelay) = 0) and (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) then + CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State and not gstAttacked; + if delay2 = 0 then + begin + SweepDirty; + CheckNoDamage; + CheckForWin + end end end; @@ -864,6 +875,7 @@ and not isInMultiShoot then begin if (TurnTimeLeft = 5000) + and (cHedgehogTurnTime >= 10000) and (not PlacingHogs) and (CurrentHedgehog^.Gear <> nil) and ((CurrentHedgehog^.Gear^.State and gstAttacked) = 0) then @@ -1507,6 +1519,25 @@ end end; +function GearsNear(Gear: PGear; Kind: TGearType; r: LongInt): TPGearArray; +var + t: PGear; +begin + GearsNear := nil; + t := GearsList; + while t <> nil do begin + if (t <> Gear) and (t^.Kind = Kind) then begin + if (Gear^.X - t^.X)*(Gear^.X - t^.X) + (Gear^.Y - + t^.Y)*(Gear^.Y-t^.Y) < int2hwFloat(r)*int2hwFloat(r) then + begin + SetLength(GearsNear, Length(GearsNear)+1); + GearsNear[High(GearsNear)] := t; + end; + end; + t := t^.NextGear; + end; +end; + function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; var t: PGear; begin diff -r d6412423da45 -r cbec77b5f706 hedgewars/uIO.pas --- a/hedgewars/uIO.pas Mon Oct 11 03:28:15 2010 +0200 +++ b/hedgewars/uIO.pas Mon Oct 11 21:45:25 2010 +0200 @@ -237,6 +237,7 @@ procedure SendIPCTimeInc; const timeinc: shortstring = '#'; begin +AddFileLog('Send #'); SendIPCRaw(@timeinc, 2) end; diff -r d6412423da45 -r cbec77b5f706 hedgewars/uLocale.pas --- a/hedgewars/uLocale.pas Mon Oct 11 03:28:15 2010 +0200 +++ b/hedgewars/uLocale.pas Mon Oct 11 21:45:25 2010 +0200 @@ -30,7 +30,7 @@ sidLowGravity, sidExtraDamage, sidInvulnerable, sidExtraTime, sidLaserSight, sidVampiric, sidSniperRifle, sidJetpack, sidMolotov, sidBirdy, sidPortalGun, sidPiano, sidGasBomb, sidSineGun, sidFlamethrower, - sidSMine, sidHammer); + sidSMine, sidHammer, sidResurrector); TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused, sidConfirm, sidSuddenDeath, sidRemaining, sidFuel, sidSync, diff -r d6412423da45 -r cbec77b5f706 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Mon Oct 11 03:28:15 2010 +0200 +++ b/hedgewars/uStore.pas Mon Oct 11 21:45:25 2010 +0200 @@ -20,7 +20,7 @@ unit uStore; interface -uses sysutils, uConsts, uTeams, SDLh, GLunit; +uses sysutils, uConsts, uTeams, SDLh, GLunit, uWorld; var PixelFormat: PSDL_PixelFormat; @@ -58,6 +58,7 @@ procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real); procedure DrawFillRect(r: TSDL_Rect); +procedure DrawCircle(X, Y, Radius: LongInt; Width: Single; r, g, b, a: Byte); procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean); function CheckCJKFont(s: ansistring; font: THWFont): THWFont; function RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture; @@ -819,6 +820,29 @@ glEnable(GL_TEXTURE_2D) end; +procedure DrawCircle(X, Y, Radius: LongInt; Width: Single; r, g, b, a: Byte); +var + i: LongInt; + CircleVertex: array [0..359] of TVertex2f; +begin + for i := 0 to 359 do begin + CircleVertex[i].X := X + Radius*cos(i*pi/180); + CircleVertex[i].Y := Y + Radius*sin(i*pi/180); + end; + glDisable(GL_TEXTURE_2D); + glEnable(GL_LINE_SMOOTH); + glPushMatrix; + glTranslatef(WorldDx, WorldDy, 0); + glLineWidth(Width); + Tint(r, g, b, a); + glVertexPointer(2, GL_FLOAT, 0, @CircleVertex[0]); + glDrawArrays(GL_LINE_LOOP, 0, 360); + Tint($FF, $FF, $FF, $FF); + glPopMatrix; + glEnable(GL_TEXTURE_2D); + glDisable(GL_LINE_SMOOTH); +end; + procedure StoreRelease; var ii: TSprite; begin diff -r d6412423da45 -r cbec77b5f706 hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Mon Oct 11 03:28:15 2010 +0200 +++ b/hedgewars/uTeams.pas Mon Oct 11 21:45:25 2010 +0200 @@ -230,6 +230,8 @@ procedure AfterSwitchHedgehog; var g: PGear; i, t: LongInt; + CurWeapon: PAmmo; + begin if PlacingHogs then begin @@ -249,7 +251,8 @@ inc(CurrentTeam^.Clan^.TurnNumber); -SwitchNotHeldAmmo(CurrentHedgehog^); +CurWeapon:= GetAmmoEntry(CurrentHedgehog^); +if CurWeapon^.Count = 0 then CurrentHedgehog^.CurAmmoType:= amNothing; with CurrentHedgehog^ do begin diff -r d6412423da45 -r cbec77b5f706 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Mon Oct 11 03:28:15 2010 +0200 +++ b/hedgewars/uWorld.pas Mon Oct 11 21:45:25 2010 +0200 @@ -248,7 +248,7 @@ for i:= 0 to cMaxSlotIndex do if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then begin - if (cScreenHeight - CursorPoint.Y >= y) and (cScreenHeight - CursorPoint.Y < y + AMSlotSize) then Slot:= i; + if (cScreenHeight - CursorPoint.Y >= y) and (cScreenHeight - CursorPoint.Y <= y + AMSlotSize) then Slot:= i; inc(SlotsNum); DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); t:= 0; @@ -304,7 +304,7 @@ for i:= cMaxSlotIndex downto 0 do if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then begin - if (cScreenHeight - CursorPoint.Y >= y - AMSlotSize) and (cScreenHeight - CursorPoint.Y < y) then Slot:= i; + if (cScreenHeight - CursorPoint.Y >= y - AMSlotSize) and (cScreenHeight - CursorPoint.Y <= y) then Slot:= i; dec(y, AMSlotSize); inc(SlotsNum); DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); diff -r d6412423da45 -r cbec77b5f706 share/hedgewars/Data/Graphics/Hedgehog/amResurrector.png Binary file share/hedgewars/Data/Graphics/Hedgehog/amResurrector.png has changed diff -r d6412423da45 -r cbec77b5f706 share/hedgewars/Data/Locale/en.txt --- a/share/hedgewars/Data/Locale/en.txt Mon Oct 11 03:28:15 2010 +0200 +++ b/share/hedgewars/Data/Locale/en.txt Mon Oct 11 21:45:25 2010 +0200 @@ -49,6 +49,7 @@ 00:46=Flamethrower 00:47=Sticky Mine 00:48=Hammer +00:49=Resurrector 01:00=Let's fight! 01:01=Round draw diff -r d6412423da45 -r cbec77b5f706 share/hedgewars/Data/Locale/hedgewars_en.ts --- a/share/hedgewars/Data/Locale/hedgewars_en.ts Mon Oct 11 03:28:15 2010 +0200 +++ b/share/hedgewars/Data/Locale/hedgewars_en.ts Mon Oct 11 21:45:25 2010 +0200 @@ -349,16 +349,16 @@ The best killer is <b>%1</b> with <b>%2</b> kills in a turn. - - - + + The best killer is <b>%1</b> with <b>%2</b> kill in a turn. + The best killer is <b>%1</b> with <b>%2</b> kills in a turn. A total of <b>%1</b> hedgehog(s) were killed during this round. - - - + + <b>%1</b> hedgehog was killed during this round. + A total of <b>%1</b> hedgehogs were killed during this round.