oh yeah. And merge again, I always forget to update first
--- a/QTfrontend/hwconsts.cpp.in Sat Aug 07 23:04:43 2010 -0400
+++ b/QTfrontend/hwconsts.cpp.in Sat Aug 07 23:32:43 2010 -0400
@@ -34,7 +34,7 @@
"939192942219912103223511100120100000021111011101"
"040504054160065554655446477657666666615551011111"
"000000000000020550000004000700400000000020000000"
- "131111031211111112311411111111111111121111111121"
+ "131111031211111112311411111111111111121111111111"
);
int cAmmoNumber = cDefaultAmmoStore->size() / 4;
@@ -50,7 +50,7 @@
"909000900000000000000900000000000000000000090000"
"000000000000000000000000000000000000000000000000"
"000000000000020550000004000700400000000020000000"
- "111111111111111111111111111111111111111110011121"))
+ "111111111111111111111111111111111111111110011111"))
<< qMakePair(QString("Shoppa"), QString(
"000000990000000000000000000000000000000000000000"
"444441004424440221011212122242200000000200040001"
--- a/hedgewars/GSHandlers.inc Sat Aug 07 23:04:43 2010 -0400
+++ b/hedgewars/GSHandlers.inc Sat Aug 07 23:32:43 2010 -0400
@@ -854,6 +854,8 @@
if (Gear^.Timer mod 47) = 0 then
begin
+ for i:= 0 to 1 do
+ AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
i := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2));
ei := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2));
while i <= ei do
@@ -1473,7 +1475,7 @@
if (Gear^.Timer and $FF) = 0 then PlaySound(sndMineTick);
if Gear^.Timer = 0 then
begin
- doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
+ doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound);
DeleteGear(Gear);
exit
end;
@@ -3579,6 +3581,7 @@
procedure doStepPiano(Gear: PGear);
var
r0, r1: LongInt;
+ odY: hwFloat;
begin
AllInactive := false;
if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and ((CurrentHedgehog^.Gear^.
@@ -3600,10 +3603,10 @@
CurrentHedgehog^.Gear^.Message := CurrentHedgehog^.Gear^.Message and not gm_Slot;
end;
- if ((Gear^.Pos = 3) and ((GameFlags and gfSolidLand) <> 0)) or (Gear^.Pos = 20) then
- // bounce up to 20 times (3 times on gameflagged solid land) before dropping past landscape
+ if (*((Gear^.Pos = 3) and ((GameFlags and gfSolidLand) <> 0)) or*) (Gear^.Pos = 5) then
+ // bounce up to 10 times (3 times on gameflagged solid land) before dropping past landscape
begin
- Gear^.dY := Gear^.dY + cGravity * 3;
+ Gear^.dY := Gear^.dY + cGravity * 2;
Gear^.Y := Gear^.Y + Gear^.dY;
CheckGearDrowning(Gear);
if (Gear^.State and gstDrowning) <> 0 then
@@ -3621,6 +3624,7 @@
exit
end;
+ odY:= Gear^.dY;
doStepFallingGear(Gear);
if (Gear^.State and gstDrowning) <> 0 then
@@ -3644,7 +3648,7 @@
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 80 + r0, EXPLAutoSound);
for r0:= 0 to 4 do
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtNote);
- Gear^.dY := -_1;
+ Gear^.dY := odY * -1 + cGravity * 2;
Gear^.Pos := Gear^.Pos + 1;
end
else
@@ -3882,16 +3886,19 @@
////////////////////////////////////////////////////////////////////////////////
procedure doStepHammer(Gear: PGear);
-var HHGear, tmp: PGear;
+var HHGear, tmp, tmp2: PGear;
t: PGearArray;
i: LongInt;
- dust: PVisualGear;
begin
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
HHGear^.State:= HHGear^.State or gstNoDamage;
DeleteCI(HHGear);
t:= CheckGearsCollision(Gear);
+
+for i:= 5 downto 0 do
+ AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
+
i:= t^.Count;
while i > 0 do
begin
@@ -3901,10 +3908,10 @@
if (tmp^.Kind = gtHedgehog) then
begin
//tmp^.State:= tmp^.State or gstFlatened;
- ApplyDamage(tmp, tmp^.Health div 2, dsUnknown);
- DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3);
- for i:= 5 downto 0 do
- dust := AddVisualGear(hwRound(tmp^.X) - 5 + Random(10), hwRound(tmp^.Y) + 12, vgtDust);
+ ApplyDamage(tmp, tmp^.Health div 3, dsUnknown);
+ //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3);
+ tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0);
+ tmp2^.Hedgehog:= tmp^.Hedgehog;
SetAllToActive
end
else
@@ -3916,3 +3923,92 @@
Gear^.Timer:= 250;
Gear^.doStep:= @doStepIdle
end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepHammerHitWork(Gear: PGear);
+var
+ i, ei: LongInt;
+ HHGear: PGear;
+begin
+ AllInactive := false;
+ HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+ dec(Gear^.Timer);
+ if (Gear^.Timer = 0)or((Gear^.Message and gm_Destroy) <> 0) then
+ begin
+ DeleteGear(Gear);
+ exit
+ end;
+
+ if (Gear^.Timer mod 5) = 0 then
+ begin
+ AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
+
+ i := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2));
+ ei := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2));
+ while i <= ei do
+ begin
+ DrawExplosion(i, hwRound(Gear^.Y) + 3, 3);
+ inc(i, 1)
+ end;
+
+ if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9)
+ , lfIndestructible) then
+ begin
+ Gear^.X := Gear^.X + Gear^.dX;
+ Gear^.Y := Gear^.Y + _1_9;
+ end;
+ SetAllHHToActive;
+ end;
+ if TestCollisionYwithGear(Gear, 1) then
+ begin
+ Gear^.dY := _0;
+ SetLittle(HHGear^.dX);
+ HHGear^.dY := _0;
+ end
+ else
+ begin
+ Gear^.dY := Gear^.dY + cGravity;
+ Gear^.Y := Gear^.Y + Gear^.dY;
+ if hwRound(Gear^.Y) > cWaterLine then Gear^.Timer := 1
+ end;
+
+ Gear^.X := Gear^.X + HHGear^.dX;
+ HHGear^.X := Gear^.X;
+ HHGear^.Y := Gear^.Y - int2hwFloat(cHHRadius);
+
+ if (Gear^.Message and gm_Attack) <> 0 then
+ if (Gear^.State and gsttmpFlag) <> 0 then Gear^.Timer := 1
+ else
+ else
+ if (Gear^.State and gsttmpFlag) = 0 then Gear^.State := Gear^.State or gsttmpFlag;
+ if ((Gear^.Message and gm_Left) <> 0) then Gear^.dX := - _0_3
+ else
+ if ((Gear^.Message and gm_Right) <> 0) then Gear^.dX := _0_3
+ else Gear^.dX := _0;
+end;
+
+procedure doStepHammerHit(Gear: PGear);
+var
+ i, y: LongInt;
+ ar: TRangeArray;
+ HHGear: PGear;
+begin
+ i := 0;
+ HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+
+ y := hwRound(Gear^.Y) - cHHRadius * 2;
+ while y < hwRound(Gear^.Y) do
+ begin
+ ar[i].Left := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2));
+ ar[i].Right := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2));
+ inc(y, 2);
+ inc(i)
+ end;
+
+ DrawHLinesExplosions(@ar, 3, hwRound(Gear^.Y) - cHHRadius * 2, 2, Pred(i));
+ Gear^.dY := HHGear^.dY;
+ DeleteCI(HHGear);
+
+ doStepHammerHitWork(Gear);
+ Gear^.doStep := @doStepHammerHit
+end;
--- a/hedgewars/uConsts.pas Sat Aug 07 23:04:43 2010 -0400
+++ b/hedgewars/uConsts.pas Sat Aug 07 23:32:43 2010 -0400
@@ -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);
+ gtSMine, gtPoisonCloud, gtHammer, gtHammerHit);
// Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.)
TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
@@ -2164,9 +2164,9 @@
Probability: 100;
NumberInCase: 1;
Ammo: (Propz: ammoprop_Power or ammoprop_AltUse;
- Count: 2;
+ Count: 1;
InitialCount: 0;
- NumPerTurn: 0;
+ NumPerTurn: 1;
Timer: 0;
Pos: 0;
AmmoType: amSMine;
@@ -2196,7 +2196,7 @@
AmmoType: amHammer;
AttackVoice: sndNone);
Slot: 3;
- TimeAfterTurn: 3000;
+ TimeAfterTurn: 1000;
MinAngle: 0;
maxAngle: 0;
isDamaging: true;
--- a/hedgewars/uGears.pas Sat Aug 07 23:04:43 2010 -0400
+++ b/hedgewars/uGears.pas Sat Aug 07 23:32:43 2010 -0400
@@ -81,6 +81,7 @@
procedure initModule;
procedure freeModule;
function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
+procedure SpawnHealthCrate(x, y: LongInt);
procedure ProcessGears;
procedure EndTurnCleanup;
procedure ApplyDamage(Gear: PGear; Damage: Longword; Source: TDamageSource);
@@ -204,7 +205,8 @@
@doStepFlamethrower,
@doStepSMine,
@doStepPoisonCloud,
- @doStepHammer
+ @doStepHammer,
+ @doStepHammerHit
);
procedure InsertGearToList(Gear: PGear);
@@ -341,6 +343,10 @@
gear^.Radius:= 10;
gear^.Timer:= 4000
end;
+ gtHammerHit: begin
+ gear^.Radius:= 8;
+ gear^.Timer:= 125
+ end;
gtRope: begin
gear^.Radius:= 3;
gear^.Friction:= _450;
@@ -1533,6 +1539,14 @@
CountGears:= count;
end;
+procedure SpawnHealthCrate(x, y: LongInt);
+begin
+ FollowGear:= AddGear(x, y, gtCase, 0, _0, _0, 0);
+ FollowGear^.Health:= 25;
+ FollowGear^.Pos:= posCaseHealth;
+ AddCaption(GetEventString(eidNewHealthPack), cWhiteColor, capgrpAmmoInfo);
+end;
+
procedure SpawnBoxOfSmth;
var t, aTot, uTot, a, h: LongInt;
i: TAmmoType;
--- a/hedgewars/uScript.pas Sat Aug 07 23:04:43 2010 -0400
+++ b/hedgewars/uScript.pas Sat Aug 07 23:32:43 2010 -0400
@@ -117,6 +117,22 @@
lc_hidemission:= 0;
end;
+function lc_spawnhealthcrate(L: Plua_State) : LongInt; Cdecl;
+var x, y: LongInt;
+begin
+ if lua_gettop(L) <> 2 then begin
+ LuaError('Lua: Wrong number of parameters passed to SpawnHealthCrate!');
+ lua_pushnil(L);
+ end
+ else begin
+ x:= lua_tointeger(L, 1);
+ y:= lua_tointeger(L, 2);
+ cCaseFactor := 0;
+ SpawnHealthCrate(x, y);
+ end;
+ lc_spawnhealthCrate := 1;
+end;
+
function lc_addgear(L : Plua_State) : LongInt; Cdecl;
var gear : PGear;
x, y, s, t: LongInt;
@@ -220,6 +236,44 @@
lc_gethogname:= 1
end;
+function lc_gettimer(L : Plua_State) : LongInt; Cdecl;
+var gear : PGear;
+begin
+ if lua_gettop(L) <> 1 then
+ begin
+ LuaError('Lua: Wrong number of parameters passed to GetTimer!');
+ lua_pushnil(L); // return value on stack (nil)
+ end
+ else
+ begin
+ gear:= GearByUID(lua_tointeger(L, 1));
+ if gear <> nil then
+ lua_pushnumber(L, gear^.Timer)
+ else
+ lua_pushnil(L);
+ end;
+ lc_gettimer:= 1
+end;
+
+function lc_gethealth(L : Plua_State) : LongInt; Cdecl;
+var gear : PGear;
+begin
+ if lua_gettop(L) <> 1 then
+ begin
+ LuaError('Lua: Wrong number of parameters passed to GetHealth!');
+ lua_pushnil(L); // return value on stack (nil)
+ end
+ else
+ begin
+ gear:= GearByUID(lua_tointeger(L, 1));
+ if gear <> nil then
+ lua_pushnumber(L, gear^.Health)
+ else
+ lua_pushnil(L);
+ end;
+ lc_gethealth:= 1
+end;
+
function lc_getx(L : Plua_State) : LongInt; Cdecl;
var gear : PGear;
begin
@@ -325,11 +379,30 @@
else
begin
gear:= GearByUID(lua_tointeger(L, 1));
- if gear <> nil then gear^.Health:= lua_tointeger(L, 2)
+ if gear <> nil then
+ begin
+ gear^.Health:= lua_tointeger(L, 2);
+ SetAllToActive;
+ end
end;
lc_sethealth:= 0
end;
+function lc_settimer(L : Plua_State) : LongInt; Cdecl;
+var gear : PGear;
+begin
+ if lua_gettop(L) <> 2 then
+ begin
+ LuaError('Lua: Wrong number of parameters passed to SetTimer!');
+ end
+ else
+ begin
+ gear:= GearByUID(lua_tointeger(L, 1));
+ if gear <> nil then gear^.Timer:= lua_tointeger(L, 2)
+ end;
+ lc_settimer:= 0
+end;
+
function lc_setstate(L : Plua_State) : LongInt; Cdecl;
var gear : PGear;
begin
@@ -340,7 +413,11 @@
else
begin
gear:= GearByUID(lua_tointeger(L, 1));
- if gear <> nil then gear^.State:= lua_tointeger(L, 2)
+ if gear <> nil then
+ begin
+ gear^.State:= lua_tointeger(L, 2);
+ SetAllToActive;
+ end
end;
lc_setstate:= 0
end;
@@ -373,7 +450,11 @@
else
begin
gear:= GearByUID(lua_tointeger(L, 1));
- if gear <> nil then gear^.Tag:= lua_tointeger(L, 2)
+ if gear <> nil then
+ begin
+ gear^.Tag:= lua_tointeger(L, 2);
+ SetAllToActive;
+ end
end;
lc_settag:= 0
end;
@@ -487,6 +568,7 @@
y:= lua_tointeger(L, 3);
gear^.X:= int2hwfloat(x);
gear^.Y:= int2hwfloat(y);
+ SetAllToActive;
end
end;
lc_setgearposition:= 0
@@ -755,6 +837,7 @@
luaopen_base(luaState);
luaopen_string(luaState);
luaopen_math(luaState);
+luaopen_table(luaState);
// import some variables
ScriptSetInteger('LAND_WIDTH', LAND_WIDTH);
@@ -795,6 +878,7 @@
// register functions
lua_register(luaState, 'AddGear', @lc_addgear);
+lua_register(luaState, 'SpawnHealthCrate', @lc_spawnhealthcrate);
lua_register(luaState, 'WriteLnToConsole', @lc_writelntoconsole);
lua_register(luaState, 'GetGearType', @lc_getgeartype);
lua_register(luaState, 'EndGame', @lc_endgame);
@@ -820,6 +904,9 @@
lua_register(luaState, 'SetState', @lc_setstate);
lua_register(luaState, 'GetState', @lc_getstate);
lua_register(luaState, 'SetTag', @lc_settag);
+lua_register(luaState, 'SetTimer', @lc_settimer);
+lua_register(luaState, 'GetTimer', @lc_gettimer);
+lua_register(luaState, 'GetHealth', @lc_gethealth);
ScriptClearStack; // just to be sure stack is empty
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Maps/FlightJoust/map.cfg Sat Aug 07 23:32:43 2010 -0400
@@ -0,0 +1,2 @@
+Nature
+4
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Maps/FlightJoust/map.lua Sat Aug 07 23:32:43 2010 -0400
@@ -0,0 +1,79 @@
+local hogs = {}
+local spawncrate = 0
+
+function mapM_(func, tbl)
+ for i,v in pairs(tbl) do
+ func(v)
+ end
+end
+
+function map(func, tbl)
+ local newtbl = {}
+ for i,v in pairs(tbl) do
+ newtbl[i] = func(v)
+ end
+ return newtbl
+end
+
+function filter(func, tbl)
+ local newtbl = {}
+ for i,v in pairs(tbl) do
+ if func(v) then
+ table.insert(newtbl, v)
+ end
+ end
+ return newtbl
+end
+
+function onGameInit()
+ GameFlags = gfSolidLand + gfDivideTeams
+ TurnTime = 10000
+ CaseFreq = 0
+ LandAdds = 0
+ Explosives = 0
+ Delay = 500
+ SuddenDeathTurns = 99999 -- "disable" sudden death
+ Theme = Compost
+end
+
+function onGameStart()
+ local offset = 50
+ local team1hh = filter(function(h) return GetHogClan(h) == 0 end, hogs)
+ local team2hh = filter(function(h) return GetHogClan(h) == 1 end, hogs)
+
+ for i,h in ipairs(team1hh) do
+ SetGearPosition(h, 250+(i-1)*offset, 1000)
+ end
+ for i,h in ipairs(team2hh) do
+ SetGearPosition(h, 3500-(i-1)*offset, 1000)
+ end
+
+ SpawnHealthCrate(1800, 1150)
+end
+
+function onAmmoStoreInit()
+ SetAmmo(amRCPlane, 9, 0, 0, 0)
+ SetAmmo(amSkip, 9, 0, 0, 0)
+end
+
+function onGearAdd(gear)
+ if GetGearType(gear) == gtRCPlane then
+ SetTimer(gear,60000)
+ end
+ if GetGearType(gear) == gtHedgehog then
+ table.insert(hogs, gear)
+ end
+end
+
+function onGameTick()
+ if (TurnTimeLeft == 9999 and spawncrate == 1) then
+ SpawnHealthCrate(1800, 1150)
+ spawncrate = 0
+ end
+end
+
+function onGearDelete(gear)
+ if GetGearType(gear) == gtCase then
+ spawncrate = 1
+ end
+end
\ No newline at end of file
Binary file share/hedgewars/Data/Maps/FlightJoust/map.png has changed
Binary file share/hedgewars/Data/Maps/FlightJoust/preview.png has changed
Binary file share/hedgewars/Data/Themes/Stage/icon.png has changed