# HG changeset patch # User unc0rr # Date 1309371878 -14400 # Node ID d47b8833284ce7daf8839def4621e99a8e093794 # Parent e2201f71beac7606abd59982312a292854a30a11# Parent 3c5480e91951efd72e7840f7ae80d59a76ad3373 merge diff -r 3c5480e91951 -r d47b8833284c QTfrontend/gamecfgwidget.cpp --- a/QTfrontend/gamecfgwidget.cpp Wed Jun 29 17:32:05 2011 +0400 +++ b/QTfrontend/gamecfgwidget.cpp Wed Jun 29 22:24:38 2011 +0400 @@ -229,6 +229,20 @@ QList bcfg; int mapgen = pMapContainer->get_mapgen(); + QString currentMap = pMapContainer->getCurrentMap(); + if (currentMap.size() > 0) + { + bcfg << QString("emap " + currentMap).toUtf8(); + if(pMapContainer->getCurrentIsMission()) + bcfg << QString("escript Maps/%1/map.lua").arg(currentMap).toUtf8(); + } + bcfg << QString("etheme " + pMapContainer->getCurrentTheme()).toUtf8(); + + if (Scripts->currentIndex() > 0) + { + bcfg << QString("escript Scripts/Multiplayer/%1.lua").arg(Scripts->itemData(Scripts->currentIndex()).toList()[0].toString()).toUtf8(); + } + bcfg << QString("eseed " + pMapContainer->getCurrentSeed()).toUtf8(); bcfg << QString("e$gmflags %1").arg(getGameFlags()).toUtf8(); bcfg << QString("e$damagepct %1").arg(schemeData(25).toInt()).toUtf8(); @@ -270,20 +284,6 @@ default: ; } - QString currentMap = pMapContainer->getCurrentMap(); - if (currentMap.size() > 0) - { - bcfg << QString("emap " + currentMap).toUtf8(); - if(pMapContainer->getCurrentIsMission()) - bcfg << QString("escript Maps/%1/map.lua").arg(currentMap).toUtf8(); - } - bcfg << QString("etheme " + pMapContainer->getCurrentTheme()).toUtf8(); - - if (Scripts->currentIndex() > 0) - { - bcfg << QString("escript Scripts/Multiplayer/%1.lua").arg(Scripts->itemData(Scripts->currentIndex()).toList()[0].toString()).toUtf8(); - } - QByteArray result; foreach(QByteArray ba, bcfg) diff -r 3c5480e91951 -r d47b8833284c hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Wed Jun 29 17:32:05 2011 +0400 +++ b/hedgewars/GSHandlers.inc Wed Jun 29 22:24:38 2011 +0400 @@ -605,7 +605,7 @@ begin with Gear^ do begin - X:= X + cWindSpeed * 1600 + dX; + X:= X + cWindSpeed * 3200 + dX; Y:= Y + dY + cGravity * vobFallSpeed * 8; // using same value as flakes to try and get similar results xx:= hwRound(X); yy:= hwRound(Y); @@ -2565,7 +2565,6 @@ HHGear := Gear^.Hedgehog^.Gear; Msg := Gear^.Message and not gmSwitch; DeleteGear(Gear); - OnUsedAmmo(HHGear^.Hedgehog^); ApplyAmmoChanges(HHGear^.Hedgehog^); HHGear := CurrentHedgehog^.Gear; @@ -2614,6 +2613,7 @@ Gear^.doStep := @doStepSwitcherWork; HHGear := Gear^.Hedgehog^.Gear; + OnUsedAmmo(HHGear^.Hedgehog^); with HHGear^ do begin State := State and not gstAttacking; diff -r 3c5480e91951 -r d47b8833284c hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Wed Jun 29 17:32:05 2011 +0400 +++ b/hedgewars/HHHandlers.inc Wed Jun 29 22:24:38 2011 +0400 @@ -533,7 +533,13 @@ begin Gear^.Message:= gmDestroy; PlaySound(sndShotgunReload); -if (Gear^.Pos and posCaseTrap) <> 0 then doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, HH^.Hedgehog, EXPLAutoSound) +if (Gear^.Pos and posCaseExplode) <> 0 then + if (Gear^.Pos and posCasePoison) <> 0 then + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound + EXPLPoisoned) + else + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound) +else if (Gear^.Pos and posCasePoison) <> 0 then + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound + EXPLPoisoned + EXPLNoDamage) else case Gear^.Pos of posCaseUtility, diff -r 3c5480e91951 -r d47b8833284c hedgewars/VGSHandlers.inc --- a/hedgewars/VGSHandlers.inc Wed Jun 29 17:32:05 2011 +0400 +++ b/hedgewars/VGSHandlers.inc Wed Jun 29 22:24:38 2011 +0400 @@ -46,7 +46,7 @@ inc(Frame); if Frame = vobSDFramesCount then Frame:= 0 end; - X:= X + (cWindSpeedf * 600 + dX + tdX) * Steps; + X:= X + (cWindSpeedf * 400 + dX + tdX) * Steps; if SuddenDeathDmg then Y:= Y + (dY + tdY + cGravityf * vobSDFallSpeed) * Steps else diff -r 3c5480e91951 -r d47b8833284c hedgewars/uCommandHandlers.pas --- a/hedgewars/uCommandHandlers.pas Wed Jun 29 17:32:05 2011 +0400 +++ b/hedgewars/uCommandHandlers.pas Wed Jun 29 22:24:38 2011 +0400 @@ -445,7 +445,7 @@ procedure chSetMap(var s: shortstring); begin -if isDeveloperMode then +if isDeveloperMode and (s <> '') then begin UserPathz[ptMapCurrent]:= UserPathz[ptMaps] + '/' + s; Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s; diff -r 3c5480e91951 -r d47b8833284c hedgewars/uCommands.pas --- a/hedgewars/uCommands.pas Wed Jun 29 17:32:05 2011 +0400 +++ b/hedgewars/uCommands.pas Wed Jun 29 22:24:38 2011 +0400 @@ -33,7 +33,7 @@ procedure StopMessages(Message: Longword); implementation -uses Types, uConsts, uVariables, uConsole, uUtils, uDebug; +uses Types, uConsts, uVariables, uConsole, uUtils, uDebug, uScript; type PVariable = ^TVariable; TVariable = record @@ -68,7 +68,7 @@ procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); var ii: LongInt; - s: shortstring; + s, i, o: shortstring; t: PVariable; c: char; begin @@ -85,6 +85,8 @@ if t^.Name = CmdStr then begin if TrustedSource or t^.Trusted then + begin + if (c <> '$') or (s[0] <> #0) then s:= ParseCommandOverride(CmdStr, s); case t^.VType of vtCommand: if c='/' then begin @@ -94,8 +96,12 @@ if s[0]=#0 then begin str(PLongInt(t^.Handler)^, s); - WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); - end else val(s, PLongInt(t^.Handler)^); + i:= inttostr(PLongInt(t^.Handler)^); + o:= ParseCommandOverride(CmdStr, i); + if i <> o then val(o, PLongInt(t^.Handler)^) + else WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); + end + else val(s, PLongInt(t^.Handler)^); vthwFloat: if c='$' then if s[0]=#0 then begin @@ -106,13 +112,23 @@ if s[0]=#0 then begin str(ord(boolean(t^.Handler^)), s); - WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); - end else + if boolean(t^.Handler^) then i:= '1' + else i:= '0'; + o:= ParseCommandOverride(CmdStr, i); + if i <> o then + begin + val(o, ii); + boolean(t^.Handler^):= not (ii = 0) + end + else WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); + end + else begin val(s, ii); boolean(t^.Handler^):= not (ii = 0) end; end; + end; exit end else t:= t^.Next end; diff -r 3c5480e91951 -r d47b8833284c hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Wed Jun 29 17:32:05 2011 +0400 +++ b/hedgewars/uConsts.pas Wed Jun 29 22:24:38 2011 +0400 @@ -260,7 +260,8 @@ posCaseHealth = $00000002; posCaseUtility = $00000004; posCaseDummy = $00000008; - posCaseTrap = $00000010; + posCaseExplode = $00000010; + posCasePoison = $00000020; NoPointX = Low(LongInt); cTargetPointRef : TPoint = (X: NoPointX; Y: 0); diff -r 3c5480e91951 -r d47b8833284c hedgewars/uGears.pas --- a/hedgewars/uGears.pas Wed Jun 29 17:32:05 2011 +0400 +++ b/hedgewars/uGears.pas Wed Jun 29 22:24:38 2011 +0400 @@ -39,7 +39,7 @@ procedure freeModule; function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword ): PGear; -function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; trap: boolean ): PGear; +function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; explode: boolean; poison: boolean ): PGear; procedure ResurrectHedgehog(gear: PGear); procedure ProcessGears; procedure EndTurnCleanup; @@ -1685,13 +1685,14 @@ SpawnCustomCrateAt := FollowGear; end; -function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; trap: boolean): PGear; +function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; explode: boolean; poison: boolean): PGear; begin FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0); cCaseFactor := 0; + FollowGear^.Pos := posCaseDummy; - if trap then FollowGear^.Pos := posCaseTrap - else FollowGear^.Pos := posCaseDummy; + if explode then FollowGear^.Pos := FollowGear^.Pos + posCaseExplode; + if poison then FollowGear^.Pos := FollowGear^.Pos + posCasePoison; case crate of HealthCrate: begin diff -r 3c5480e91951 -r d47b8833284c hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Wed Jun 29 17:32:05 2011 +0400 +++ b/hedgewars/uLandGraphics.pas Wed Jun 29 22:24:38 2011 +0400 @@ -715,7 +715,9 @@ yy:= Y div 2; end; pixelsweep:= ((Land[Y, X] and $FF00) = 0) and (LandPixels[yy, xx] <> 0); -if (((Land[Y, X] and lfDamaged) <> 0) and ((Land[Y, X] and lfIndestructible) = 0)) or pixelsweep then +if ((((Land[Y, X] and lfDamaged) <> 0) or + (((Land[Y, X] and lfBasic) <> 0) and (LandPixels[yy,xx] <> 0) and ((LandPixels[yy,xx] and AMask) shl AShift < 255))) + and ((Land[Y, X] and lfIndestructible) = 0)) or pixelsweep then begin c:= 0; for i:= -1 to 1 do diff -r 3c5480e91951 -r d47b8833284c hedgewars/uScript.pas --- a/hedgewars/uScript.pas Wed Jun 29 17:32:05 2011 +0400 +++ b/hedgewars/uScript.pas Wed Jun 29 22:24:38 2011 +0400 @@ -43,6 +43,7 @@ function ScriptCall(fname : shortstring; par1, par2, par3: LongInt) : LongInt; function ScriptCall(fname : shortstring; par1, par2, par3, par4 : LongInt) : LongInt; function ScriptExists(fname : shortstring) : boolean; +function ParseCommandOverride(key, value : shortstring) : shortstring; procedure initModule; procedure freeModule; @@ -226,13 +227,13 @@ function lc_spawnfakehealthcrate(L: Plua_State) : LongInt; Cdecl; var gear: PGear; begin - if lua_gettop(L) <> 3 then begin + if lua_gettop(L) <> 4 then begin LuaError('Lua: Wrong number of parameters passed to SpawnFakeHealthCrate!'); lua_pushnil(L); end else begin gear := SpawnFakeCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), - HealthCrate, lua_toboolean(L, 3)); + HealthCrate, lua_toboolean(L, 3), lua_toboolean(L, 4)); lua_pushinteger(L, gear^.uid); end; lc_spawnfakehealthcrate := 1; @@ -241,13 +242,13 @@ function lc_spawnfakeammocrate(L: PLua_State): LongInt; Cdecl; var gear: PGear; begin - if lua_gettop(L) <> 3 then begin + if lua_gettop(L) <> 4 then begin LuaError('Lua: Wrong number of parameters passed to SpawnFakeAmmoCrate!'); lua_pushnil(L); end else begin gear := SpawnFakeCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), - AmmoCrate, lua_toboolean(L, 3)); + AmmoCrate, lua_toboolean(L, 3), lua_toboolean(L, 4)); lua_pushinteger(L, gear^.uid); end; lc_spawnfakeammocrate := 1; @@ -256,13 +257,13 @@ function lc_spawnfakeutilitycrate(L: PLua_State): LongInt; Cdecl; var gear: PGear; begin - if lua_gettop(L) <> 3 then begin + if lua_gettop(L) <> 4 then begin LuaError('Lua: Wrong number of parameters passed to SpawnFakeUtilityCrate!'); lua_pushnil(L); end else begin gear := SpawnFakeCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), - UtilityCrate, lua_toboolean(L, 3)); + UtilityCrate, lua_toboolean(L, 3), lua_toboolean(L, 4)); lua_pushinteger(L, gear^.uid); end; lc_spawnfakeutilitycrate := 1; @@ -1588,6 +1589,25 @@ GetGlobals; end; +function ParseCommandOverride(key, value : shortstring) : shortstring; +begin +ParseCommandOverride:= value; +if not ScriptExists('ParseCommandOverride') then exit; +lua_getglobal(luaState, Str2PChar('ParseCommandOverride')); +lua_pushstring(luaState, Str2PChar(key)); +lua_pushstring(luaState, Str2PChar(value)); +if lua_pcall(luaState, 2, 1, 0) <> 0 then + begin + LuaError('Lua: Error while calling ParseCommandOverride: ' + lua_tostring(luaState, -1)); + lua_pop(luaState, 1) + end +else + begin + ParseCommandOverride:= lua_tostring(luaState, -1); + lua_pop(luaState, 1) + end; +end; + function ScriptCall(fname : shortstring; par1: LongInt) : LongInt; begin ScriptCall:= ScriptCall(fname, par1, 0, 0, 0) @@ -1669,14 +1689,23 @@ end; procedure ScriptApplyAmmoStore; -var i : LongInt; +var i, j : LongInt; begin SetAmmoLoadout(ScriptAmmoLoadout); SetAmmoProbability(ScriptAmmoProbability); SetAmmoDelay(ScriptAmmoDelay); SetAmmoReinforcement(ScriptAmmoReinforcement); -for i:= 0 to Pred(TeamsCount) do - AddAmmoStore; + +if (GameFlags and gfSharedAmmo) <> 0 then + for i:= 0 to Pred(ClansCount) do + AddAmmoStore +else if (GameFlags and gfPerHogAmmo) <> 0 then + for i:= 0 to Pred(TeamsCount) do + for j:= 0 to Pred(TeamsArray[i]^.HedgehogsNumber) do + AddAmmoStore +else + for i:= 0 to Pred(TeamsCount) do + AddAmmoStore end; procedure initModule; diff -r 3c5480e91951 -r d47b8833284c misc/theme_editor.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/theme_editor.html Wed Jun 29 22:24:38 2011 +0400 @@ -0,0 +1,159 @@ + + + + Hedgewars Theme Editor + + + + +

Hedgewars Theme editor

+
+ + + + + + + + + + +
Sky: + +
Sky Color: + +
Clouds: + +
Horizont: + +
Land: + +
Border: + +
Water: + +
Water Top Color: + +
Water Bottom Color: + +
+ + diff -r 3c5480e91951 -r d47b8833284c share/hedgewars/Data/Scripts/Multiplayer/Random_Weapon.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/Random_Weapon.lua Wed Jun 29 17:32:05 2011 +0400 +++ b/share/hedgewars/Data/Scripts/Multiplayer/Random_Weapon.lua Wed Jun 29 22:24:38 2011 +0400 @@ -46,7 +46,7 @@ function onGameInit() -- Limit flags that can be set, but allow game schemes to be used - GameFlags = band(bor(GameFlags, gfResetWeps), bnot(gfInfAttack + gfPerHogAmmo)) + GameFlags = band(bor(GameFlags, gfResetWeps), bnot(gfInfAttack)) -- Set a custom game goal that will show together with the scheme ones Goals = loc("Each turn you get one random weapon") end