# HG changeset patch # User unc0rr # Date 1309502280 -14400 # Node ID bfdd925e89a5c7cdc71de7432cabfa89d208aa47 # Parent ec36f3d53f3c666aa37b0a9ab76d63a0be06868e# Parent 30752b2e99b32498e49ab63bf6482e4416f346a5 Merge diff -r ec36f3d53f3c -r bfdd925e89a5 QTfrontend/gamecfgwidget.cpp --- a/QTfrontend/gamecfgwidget.cpp Thu Jun 30 15:09:10 2011 +0400 +++ b/QTfrontend/gamecfgwidget.cpp Fri Jul 01 10:38:00 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 ec36f3d53f3c -r bfdd925e89a5 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Thu Jun 30 15:09:10 2011 +0400 +++ b/hedgewars/GSHandlers.inc Fri Jul 01 10:38:00 2011 +0400 @@ -606,7 +606,7 @@ with Gear^ do begin State:= State and not gstInvisible; - 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); @@ -726,14 +726,15 @@ end; if move then + begin if gun then - DeleteGear(Gear) - else begin - Gear^.X:= int2hwFloat(GetRandom(LAND_WIDTH+1024)-512); - Gear^.Y:= int2hwFloat(750+(GetRandom(50)-25)); - Gear^.State:= Gear^.State or gstInvisible; - end + DeleteGear(Gear); + exit + end; + Gear^.X:= int2hwFloat(GetRandom(LAND_WIDTH+1024)-512); + Gear^.Y:= int2hwFloat(750+(GetRandom(50)-25)) + end end; //////////////////////////////////////////////////////////////////////////////// @@ -1072,30 +1073,39 @@ dec(Gear^.Timer); case Gear^.Kind of gtATStartGame: - begin + begin AllInactive := false; if Gear^.Timer = 0 then - begin + begin AddCaption(trmsg[sidStartFight], cWhiteColor, capgrpGameState); - end - end; - gtATFinishGame: - begin - AllInactive := false; - if Gear^.Timer = 1000 then - begin - ScreenFade := sfToBlack; - ScreenFadeValue := 0; - ScreenFadeSpeed := 1; - end; - if Gear^.Timer = 0 then - begin - SendIPC('N'); - SendIPC('q'); - GameState := gsExit - end - end; + end end; + gtATSmoothWindCh: +begin + if Gear^.Timer = 0 then + begin + if WindBarWidth < Gear^.Tag then inc(WindBarWidth) + else if WindBarWidth > Gear^.Tag then dec(WindBarWidth); + if WindBarWidth <> Gear^.Tag then Gear^.Timer := 10; + end +end; +gtATFinishGame: +begin + AllInactive := false; + if Gear^.Timer = 1000 then + begin + ScreenFade := sfToBlack; + ScreenFadeValue := 0; + ScreenFadeSpeed := 1; + end; + if Gear^.Timer = 0 then + begin + SendIPC('N'); + SendIPC('q'); + GameState := gsExit + end +end; +end; if Gear^.Timer = 0 then DeleteGear(Gear) end; @@ -2556,7 +2566,6 @@ HHGear := Gear^.Hedgehog^.Gear; Msg := Gear^.Message and not gmSwitch; DeleteGear(Gear); - OnUsedAmmo(HHGear^.Hedgehog^); ApplyAmmoChanges(HHGear^.Hedgehog^); HHGear := CurrentHedgehog^.Gear; @@ -2605,6 +2614,7 @@ Gear^.doStep := @doStepSwitcherWork; HHGear := Gear^.Hedgehog^.Gear; + OnUsedAmmo(HHGear^.Hedgehog^); with HHGear^ do begin State := State and not gstAttacking; diff -r ec36f3d53f3c -r bfdd925e89a5 hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Thu Jun 30 15:09:10 2011 +0400 +++ b/hedgewars/HHHandlers.inc Fri Jul 01 10:38:00 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 ec36f3d53f3c -r bfdd925e89a5 hedgewars/VGSHandlers.inc --- a/hedgewars/VGSHandlers.inc Thu Jun 30 15:09:10 2011 +0400 +++ b/hedgewars/VGSHandlers.inc Fri Jul 01 10:38:00 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 ec36f3d53f3c -r bfdd925e89a5 hedgewars/uCommandHandlers.pas --- a/hedgewars/uCommandHandlers.pas Thu Jun 30 15:09:10 2011 +0400 +++ b/hedgewars/uCommandHandlers.pas Fri Jul 01 10:38:00 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 ec36f3d53f3c -r bfdd925e89a5 hedgewars/uCommands.pas --- a/hedgewars/uCommands.pas Thu Jun 30 15:09:10 2011 +0400 +++ b/hedgewars/uCommands.pas Fri Jul 01 10:38:00 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 ec36f3d53f3c -r bfdd925e89a5 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Thu Jun 30 15:09:10 2011 +0400 +++ b/hedgewars/uConsts.pas Fri Jul 01 10:38:00 2011 +0400 @@ -261,7 +261,8 @@ posCaseHealth = $00000002; posCaseUtility = $00000004; posCaseDummy = $00000008; - posCaseTrap = $00000010; + posCaseExplode = $00000010; + posCasePoison = $00000020; NoPointX = Low(LongInt); cTargetPointRef : TPoint = (X: NoPointX; Y: 0); diff -r ec36f3d53f3c -r bfdd925e89a5 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Thu Jun 30 15:09:10 2011 +0400 +++ b/hedgewars/uGears.pas Fri Jul 01 10:38:00 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; @@ -1638,13 +1638,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 ec36f3d53f3c -r bfdd925e89a5 hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Thu Jun 30 15:09:10 2011 +0400 +++ b/hedgewars/uLandGraphics.pas Fri Jul 01 10:38:00 2011 +0400 @@ -715,7 +715,7 @@ 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] > 255) and ((Land[Y, X] and lfIndestructible) = 0)) or pixelsweep then begin c:= 0; for i:= -1 to 1 do @@ -738,8 +738,8 @@ else if Land[ny, nx] > 255 then inc(c); end end; - - if c < 4 then // 0-3 neighbours + if (c < 2) or + ((c < 4) and (((Land[Y, X] and lfDamaged) <> 0) or pixelsweep)) then begin if ((Land[Y, X] and lfBasic) <> 0) and not disableLandBack then LandPixels[yy, xx]:= LandBackPixel(X, Y) diff -r ec36f3d53f3c -r bfdd925e89a5 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Thu Jun 30 15:09:10 2011 +0400 +++ b/hedgewars/uScript.pas Fri Jul 01 10:38:00 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 ec36f3d53f3c -r bfdd925e89a5 misc/theme_editor.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/theme_editor.html Fri Jul 01 10:38:00 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 ec36f3d53f3c -r bfdd925e89a5 share/hedgewars/Data/Scripts/Multiplayer/Random_Weapon.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/Random_Weapon.lua Thu Jun 30 15:09:10 2011 +0400 +++ b/share/hedgewars/Data/Scripts/Multiplayer/Random_Weapon.lua Fri Jul 01 10:38:00 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 diff -r ec36f3d53f3c -r bfdd925e89a5 share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua Thu Jun 30 15:09:10 2011 +0400 +++ b/share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua Fri Jul 01 10:38:00 2011 +0400 @@ -1,5 +1,5 @@ ---------------------------------- --- THE SPECIALISTS MODE 0.2 +-- THE SPECIALISTS MODE 0.3 -- by mikade ---------------------------------- @@ -16,13 +16,19 @@ -- removed some deprecated variables/methods -- fixed lack of portal reset +---------------- +-- version 0.3 +---------------- +-- added switching on start +-- removed switch from engineer weaponset + -------------------- --TO DO -------------------- -- add proper gameflag checking, maybe -- set crate drops etc. --- assuming place hog mode + gfinfattack doesn't get the fix: somehow end turn after teleport +-- add alternative switch loadfile(GetDataPath() .. "Scripts/Locale.lua")() @@ -31,6 +37,8 @@ local currName local lastName +local started = false +local switchStage = 0 function CreateTeam() @@ -155,7 +163,7 @@ AddAmmo(CurrentHedgehog, amGirder, 2) AddAmmo(CurrentHedgehog, amBlowTorch, 1) AddAmmo(CurrentHedgehog, amPickHammer, 1) - AddAmmo(CurrentHedgehog, amSwitch, 2) + --AddAmmo(CurrentHedgehog, amSwitch, 2) elseif n == "Ninja" then AddAmmo(CurrentHedgehog, amRope, 100) AddAmmo(CurrentHedgehog, amParachute, 100) @@ -215,7 +223,13 @@ currName = GetHogName(CurrentHedgehog) lastName = GetHogName(CurrentHedgehog) AssignAmmo() - AddAmmo(CurrentHedgehog, amSwitch, 1) + + --AddAmmo(CurrentHedgehog, amSwitch, 1) + --------------- + --switch + started = false + switchStage = 0 + --------------- end function onGameTick() @@ -229,6 +243,22 @@ AssignAmmo() end + if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) and (switchStage < 100) then + + switchStage = switchStage + 1 + + if switchStage == 10 then + AddAmmo(CurrentHedgehog, amSwitch, 1) + elseif switchStage == 20 then + ParseCommand("setweap " .. string.char(amSwitch)) + elseif switchStage == 30 then + SetGearMessage(CurrentHedgehog,gmAttack) + switchStage = 110 + end + end + + -------------------------------------------------------------------------------------- + lastName = currName end @@ -249,7 +279,7 @@ end function onAmmoStoreInit() - +-- end