# HG changeset patch # User Wolfgang Steffens # Date 1337671126 -7200 # Node ID eaef11c0d039801d4f112c1d57a9f8a9b97af586 # Parent a471de309dcc4ef1396d1e509a2fb49c780f616d# Parent 1982e702ed2fb2fef90b62e2517b407f9ba9381b Merge diff -r a471de309dcc -r eaef11c0d039 CMakeLists.txt --- a/CMakeLists.txt Mon May 14 22:14:17 2012 +0200 +++ b/CMakeLists.txt Tue May 22 09:18:46 2012 +0200 @@ -202,7 +202,7 @@ add_subdirectory(project_files/Android-build) endif() -if(NOT BUILD_ENGINE_LIBRARY) +if(NOT (BUILD_ENGINE_LIBRARY OR ANDROID)) add_subdirectory(bin) add_subdirectory(misc/quazip) add_subdirectory(QTfrontend) diff -r a471de309dcc -r eaef11c0d039 QTfrontend/binds.cpp --- a/QTfrontend/binds.cpp Mon May 14 22:14:17 2012 +0200 +++ b/QTfrontend/binds.cpp Tue May 22 09:18:46 2012 +0200 @@ -52,8 +52,8 @@ {"+cur_r", "[6]", QT_TRANSLATE_NOOP("binds", "right"), NULL, NULL}, {"+cur_d", "[2]", QT_TRANSLATE_NOOP("binds", "down"), NULL, NULL}, // {"+cur_m", "", QT_TRANSLATE_NOOP("binds", "movement key modifier"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Specify a modifier key to move camera and cursor using your default hog movement keys:")}, - {"zoomin", "wheeldown", QT_TRANSLATE_NOOP("binds", "zoom in"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Modify the camera's zoom level:")}, - {"zoomout", "wheelup", QT_TRANSLATE_NOOP("binds", "zoom out"), NULL, NULL}, + {"zoomin", "wheelup", QT_TRANSLATE_NOOP("binds", "zoom in"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Modify the camera's zoom level:")}, + {"zoomout", "wheeldown", QT_TRANSLATE_NOOP("binds", "zoom out"), NULL, NULL}, {"zoomreset", "mousem", QT_TRANSLATE_NOOP("binds", "reset zoom"), NULL, NULL}, {"chat", "t", QT_TRANSLATE_NOOP("binds", "chat"), QT_TRANSLATE_NOOP("binds (categories)", "Other"), QT_TRANSLATE_NOOP("binds (descriptions)", "Talk to your team or all participants:")}, {"history", "`", QT_TRANSLATE_NOOP("binds", "chat history"), NULL, NULL}, diff -r a471de309dcc -r eaef11c0d039 QTfrontend/game.cpp --- a/QTfrontend/game.cpp Mon May 14 22:14:17 2012 +0200 +++ b/QTfrontend/game.cpp Tue May 22 09:18:46 2012 +0200 @@ -153,7 +153,7 @@ { QByteArray traincfg; HWProto::addStringToBuffer(traincfg, "TL"); - + HWProto::addStringToBuffer(traincfg, "eseed " + QUuid::createUuid().toString()); HWProto::addStringToBuffer(traincfg, "escript " + training); RawSendIPC(traincfg); @@ -163,6 +163,7 @@ { QByteArray campaigncfg; HWProto::addStringToBuffer(campaigncfg, "TL"); + HWProto::addStringToBuffer(campaigncfg, "eseed " + QUuid::createUuid().toString()); HWProto::addStringToBuffer(campaigncfg, "escript " + campaign); diff -r a471de309dcc -r eaef11c0d039 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Mon May 14 22:14:17 2012 +0200 +++ b/hedgewars/GSHandlers.inc Tue May 22 09:18:46 2012 +0200 @@ -4285,6 +4285,8 @@ resetdy:=hwAbs(iterator^.dX*4); resetdy:= resetdy + hwPow(resetdy,3)/_6 + _3 * hwPow(resetdy,5) / _40 + _5 * hwPow(resetdy,7) / resety + resetx * hwPow(resetdy,9) / resetdx; iterator^.Angle:= hwRound(resetdy*_2048 / _PI); + if not iterator^.dY.isNegative then iterator^.Angle:= 2048-iterator^.Angle; + if iterator^.dX.isNegative then iterator^.Angle:= 4096-iterator^.Angle; end // VISUAL USE OF ANGLE ONLY else if (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtKamikaze) and (CurAmmoGear^.Hedgehog = iterator^.Hedgehog) then @@ -5346,14 +5348,8 @@ 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 - Gear^.SoundChannel := LoopSound(sndTardis); - Gear^.Pos:= 1; - Gear^.Power:= 0; - Gear^.Timer:= 0; - if HH^.GearHidden <> nil then FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH,true); @@ -5361,9 +5357,19 @@ begin Gear^.X:= HH^.GearHidden^.X; Gear^.Y:= HH^.GearHidden^.Y; - //HH^.Gear:=HH^.GearHidden; - //HH^.GearHidden:= nil; - //HH^.Gear^.State:= HH^.Gear^.State or gstInvisible; + end; + Gear^.Timer:= 0; + + if (HH^.GearHidden <> nil) and (cnt = 0) then // do an emergency jump back in this case. the team needs you! + begin + AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtExplosion); + Gear^.Pos:= 2; + Gear^.Power:= 255; + end + else begin + Gear^.SoundChannel := LoopSound(sndTardis); + Gear^.Pos:= 1; + Gear^.Power:= 0; end end else dec(Gear^.Timer); @@ -5433,16 +5439,36 @@ var HHGear, iter: PGear; ndX, ndY: hwFloat; - gX, gY: LongInt; + t, gX, gY: LongInt; begin + HHGear := Gear^.Hedgehog^.Gear; + if (Gear^.Health = 0) or (HHGear = nil) or (HHGear^.Damage <> 0) then + begin + DeleteGear(Gear); + AfterAttack; + exit + end + else + begin + t:= Gear^.Health div 10; + if (t <> Gear^.Damage) and ((GameTicks and $3F) = 0) then + begin + Gear^.Damage:= t; + FreeTexture(Gear^.Tex); + Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(t) + + '%', cWhiteColor, fntSmall) + end + end; + if GameTicks mod 10 = 0 then dec(Gear^.Health); with Gear^ do begin - HHGear := Hedgehog^.Gear; HedgehogChAngle(HHGear); - ndX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX); - ndY:= -AngleCos(HHGear^.Angle); + ndX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _4; + ndY:= -AngleCos(HHGear^.Angle) * _4; if (ndX <> dX) or (ndY <> dY) then begin + dX:= ndX; + dY:= ndY; Pos:= 0; Target.X:= NoPointX; LastDamage:= nil; @@ -5455,28 +5481,53 @@ if (iter^.Kind = gtHedgehog) and (iter^.Hedgehog^.Effects[heFrozen] < 0) then iter^.Hedgehog^.Effects[heFrozen]:= 0; - iter:= iter^.NextGear; - end; + iter:= iter^.NextGear + end end else begin - gX:= hwRound(X); - gY:= hwRound(Y); X:= X + dX; Y:= Y + dY; + gX:= hwRound(X); + gY:= hwRound(Y); + if Target.X = NoPointX then t:= hwRound(hwSqr(X-HHGear^.X)+hwSqr(Y-HHGear^.Y)); if Target.X <> NoPointX then + begin + if (abs(gX-Target.X) < 2) and (abs(gY-Target.Y) < 2) then + begin + X:= HHGear^.X; + Y:= HHGear^.Y + end; inc(Pos) - else if (gY > cWaterLine) or + end + else if (gY > cWaterLine) or (((gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0)) and ((Land[gY, gX] and $FF00 and not lfIce <> 0) or - (Land[gY, gX] and $00FF <> 0))) then + ((Land[gY, gX] and $00FF <> 0) and (t > 400)))) then begin Target.X:= gX; Target.Y:= gY; - if Land[gY, gX] and $00FF <> 0 then // locate and tag hogs + if (gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0) then begin - //GearsNear(X, Y, gtHedgehog, Radius); + LandPixels[gY, gX]:= $FFFFFFFF; // just testing + UpdateLandTexture(gX, 1, gY, 1); + if Land[gY, gX] and $00FF <> 0 then // locate and tag hogs + begin + //GearsNear(X, Y, gtHedgehog, Radius); + end end; + X:= HHGear^.X; + Y:= HHGear^.Y + end; + if (gX > LAND_WIDTH*2) or + (gX < -LAND_WIDTH) or + (gY < -LAND_HEIGHT) or + (gY > LAND_HEIGHT+512) or + (((gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0)) + and (Land[gy, gX] > $FF)) then + begin + X:= HHGear^.X; + Y:= HHGear^.Y end end end; diff -r a471de309dcc -r eaef11c0d039 hedgewars/hwLibrary.pas --- a/hedgewars/hwLibrary.pas Mon May 14 22:14:17 2012 +0200 +++ b/hedgewars/hwLibrary.pas Tue May 22 09:18:46 2012 +0200 @@ -106,7 +106,8 @@ HW_getNumberOfweapons name Java_Prefix + 'HWgetNumberOfWeapons', HW_getMaxNumberOfHogs name Java_Prefix + 'HWgetMaxNumberOfHogs', HW_getMaxNumberOfTeams name Java_Prefix + 'HWgetMaxNumberOfTeams', - HW_terminate name Java_Prefix + 'HWterminate'; + HW_terminate name Java_Prefix + 'HWterminate', + Game; {$ELSE} exports Game, diff -r a471de309dcc -r eaef11c0d039 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Mon May 14 22:14:17 2012 +0200 +++ b/hedgewars/hwengine.pas Tue May 22 09:18:46 2012 +0200 @@ -82,7 +82,6 @@ gsConfirm, gsGame: begin DrawWorld(Lag); // never place between ProcessKbd and DoGameTick - bugs due to /put cmd and isCursorVisible -// ProcessKbd; DoGameTick(Lag); ProcessVisualGears(Lag); end; diff -r a471de309dcc -r eaef11c0d039 hedgewars/uCommandHandlers.pas --- a/hedgewars/uCommandHandlers.pas Mon May 14 22:14:17 2012 +0200 +++ b/hedgewars/uCommandHandlers.pas Tue May 22 09:18:46 2012 +0200 @@ -412,12 +412,30 @@ end; procedure chNextTurn(var s: shortstring); +var checksum: Longword; + gi: PGear; begin s:= s; // avoid compiler hint + TryDo(AllInactive, '/nextturn called when not all gears are inactive', true); + checksum:= GameTicks; + gi := GearsList; + while gi <> nil do + begin + with gi^ do checksum:= checksum xor X.round xor X.frac xor dX.round xor dX.frac xor Y.round xor Y.frac xor dY.round xor dY.frac; + gi := gi^.NextGear + end; + if not CurrentTeam^.ExtDriven then - SendIPC(_S'N'); + begin + s[0]:= #5; + s[1]:= 'N'; + SDLNet_Write32(checksum, @s[2]); + SendIPC(s) + end + else + TryDo(checksum = lastTurnChecksum, 'Desync detected', true); AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks)); end; diff -r a471de309dcc -r eaef11c0d039 hedgewars/uGearsList.pas --- a/hedgewars/uGearsList.pas Mon May 14 22:14:17 2012 +0200 +++ b/hedgewars/uGearsList.pas Tue May 22 09:18:46 2012 +0200 @@ -33,7 +33,7 @@ uTextures, uScript, uRenderUtils, uAI, uCollisions, uGearsRender, uGearsUtils; -var GCounter: LongWord = 0; // this doesn't get re-initialized, but should be harmless +var GCounter: LongWord = 0; // this does not get re-initialized, but should be harmless procedure InsertGearToList(Gear: PGear); var tmp, ptmp: PGear; @@ -457,6 +457,7 @@ gear^.Tag:= TotalRounds + 3; gear^.Pos:= 1; end; + gtIceGun: gear^.Health:= 1000; end; InsertGearToList(gear); diff -r a471de309dcc -r eaef11c0d039 hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Mon May 14 22:14:17 2012 +0200 +++ b/hedgewars/uGearsRender.pas Tue May 22 09:18:46 2012 +0200 @@ -37,7 +37,7 @@ end; implementation -uses uRender, uUtils, uVariables, uAmmos, Math; +uses uRender, uUtils, uVariables, uAmmos, Math, uVisualGears; procedure DrawRopeLinesRQ(Gear: PGear); begin @@ -522,6 +522,11 @@ if CurAmmoGear^.Tex <> nil then DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex) end; + gtIceGun: + begin DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle); + if CurAmmoGear^.Tex <> nil then + DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex) + end; end; case CurAmmoGear^.Kind of @@ -648,6 +653,7 @@ amBee: DrawSpriteRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle); amFlamethrower: DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle); amLandGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle); + amIceGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle); amResurrector: DrawCircle(ox, oy, 98, 4, $F5, $DB, $35, $AA); // I'd rather not like to hardcode 100 here end; @@ -907,6 +913,7 @@ procedure RenderGear(Gear: PGear; x, y: LongInt); var HHGear: PGear; + vg: PVisualGear; i: Longword; aAngle: real; startX, endX, startY, endY: LongInt; @@ -915,7 +922,9 @@ if Gear^.AmmoType = amBee then DrawSpriteRotatedF(sprTargetBee, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360) else if Gear^.AmmoType = amIceGun then - DrawSprite(sprSnowDust, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 3) mod 360) + //DrawSprite(sprSnowDust, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 2) mod 8) + //DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1, 0, 0, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 2) mod 8, 1, 22, 22, (RealTicks shr 3) mod 360) + DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1/(1+(RealTicks shr 8) mod 5), 0, 0, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 2) mod 8, 1, 22, 22, (RealTicks shr 3) mod 360) else DrawSpriteRotatedF(sprTargetP, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360); @@ -1169,6 +1178,32 @@ Tint($FF, $FF, $FF, $FF) *) end; + gtIceGun: begin + HHGear := Gear^.Hedgehog^.Gear; + if HHGear <> nil then + begin + i:= hwRound(hwSqr(Gear^.X-HHGear^.X)+hwSqr(Gear^.Y-HHGear^.Y)); + if RealTicks mod max(1,50-(round(sqrt(i)) div 4)) = 0 then // experiment in "intensifying" might not get used + begin + vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1); + if vg <> nil then + begin + i:= random(100)+155; + vg^.Tint:= i shl 24 or i shl 16 or $FF shl 8 or ((random(200)+55)); + vg^.Angle:= random(360); + vg^.dx:= 0.001 * (random(80)); + vg^.dy:= 0.001 * (random(80)) + end + end; + if RealTicks mod 2 = 0 then + begin + i:= random(100)+100; + if Gear^.Target.X <> NoPointX then + DrawLine(Gear^.Target.X, Gear^.Target.Y, hwRound(HHGear^.X), hwRound(HHGear^.Y), 4.0, i, i, $FF, $40) + else DrawLine(hwRound(HHGear^.X), hwRound(HHGear^.Y), hwRound(Gear^.X), hwRound(Gear^.Y), 4.0, i, i, $FF, $40); + end + end + end end; diff -r a471de309dcc -r eaef11c0d039 hedgewars/uGearsUtils.pas --- a/hedgewars/uGearsUtils.pas Mon May 14 22:14:17 2012 +0200 +++ b/hedgewars/uGearsUtils.pas Tue May 22 09:18:46 2012 +0200 @@ -443,6 +443,8 @@ procedure ResurrectHedgehog(gear: PGear); var tempTeam : PTeam; + sparkles: PVisualGear; + gX, gY: LongInt; begin AttackBar:= 0; gear^.dX := _0; @@ -459,9 +461,19 @@ end; tempTeam := gear^.Hedgehog^.Team; DeleteCI(gear); + gX := hwRound(gear^.X); + gY := hwRound(gear^.Y); + // might need more sparkles for a column + sparkles:= AddVisualGear(gX, gY, vgtDust, 1); + if sparkles <> nil then + begin + sparkles^.Tint:= tempTeam^.Clan^.Color shl 8 or $FF; + //sparkles^.Angle:= random(360); + end; FindPlace(gear, false, 0, LAND_WIDTH, true); if gear <> nil then begin + AddVisualGear(hwRound(gear^.X), hwRound(gear^.Y), vgtExplosion); RenderHealth(gear^.Hedgehog^); ScriptCall('onGearResurrect', gear^.uid); gear^.State := gstWait; diff -r a471de309dcc -r eaef11c0d039 hedgewars/uIO.pas --- a/hedgewars/uIO.pas Mon May 14 22:14:17 2012 +0200 +++ b/hedgewars/uIO.pas Tue May 22 09:18:46 2012 +0200 @@ -318,6 +318,7 @@ 'F': ParseCommand('teamgone ' + copy(headcmd^.str, 2, Pred(headcmd^.len)), true); 'N': begin tmpflag:= false; + lastTurnChecksum:= SDLNet_Read32(@headcmd^.str[2]); AddFileLog('got cmd "N": time '+IntToStr(hiTicks shl 16 + headcmd^.loTime)) end; 'p': begin diff -r a471de309dcc -r eaef11c0d039 hedgewars/uInputHandler.pas --- a/hedgewars/uInputHandler.pas Mon May 14 22:14:17 2012 +0200 +++ b/hedgewars/uInputHandler.pas Tue May 22 09:18:46 2012 +0200 @@ -26,7 +26,6 @@ procedure freeModule; function KeyNameToCode(name: shortstring): word; -procedure ProcessKbd; procedure ProcessMouse(event: TSDL_MouseButtonEvent; ButtonDown: boolean); procedure ProcessKey(event: TSDL_KeyboardEvent); inline; procedure ProcessKey(code: LongInt; KeyDown: boolean); @@ -60,54 +59,6 @@ KeyNameToCode:= code; end; -procedure ProcessKbd; -//var i, j, k: LongInt; -begin - -// move cursor/camera -// TODO: Scale on screen dimensions and/or axis value (game controller)? -//TODO what is this for? -movecursor(5 * CursorMovementX, 5 * CursorMovementY); - - -(* -TODO reimplement -$IFNDEF MOBILE -// Controller(s) -k:= j; // should we test k for hitting the limit? sounds rather unlikely to ever reach it -for j:= 0 to Pred(ControllerNumControllers) do - begin - for i:= 0 to Pred(ControllerNumAxes[j]) do - begin - if ControllerAxes[j][i] > 20000 then - tkbdn[k + 0]:= 1 - else - tkbdn[k + 0]:= 0; - if ControllerAxes[j][i] < -20000 then - tkbdn[k + 1]:= 1 - else - tkbdn[k + 1]:= 0; - inc(k, 2); - end; - for i:= 0 to Pred(ControllerNumHats[j]) do - begin - tkbdn[k + 0]:= ControllerHats[j][i] and SDL_HAT_UP; - tkbdn[k + 1]:= ControllerHats[j][i] and SDL_HAT_RIGHT; - tkbdn[k + 2]:= ControllerHats[j][i] and SDL_HAT_DOWN; - tkbdn[k + 3]:= ControllerHats[j][i] and SDL_HAT_LEFT; - inc(k, 4); - end; - for i:= 0 to Pred(ControllerNumButtons[j]) do - begin - tkbdn[k]:= ControllerButtons[j][i]; - inc(k, 1); - end; - end; -$ENDIF *) - -end; - - procedure ProcessKey(code: LongInt; KeyDown: boolean); var Trusted: boolean; @@ -241,7 +192,7 @@ for i:= 6 to cKeyMaxIndex do begin s:= shortstring(sdl_getkeyname(i)); - //WriteToConsole(IntToStr(i) + ': ' + s + ' ' + IntToStr(cKeyMaxIndex)); + //WriteLnToConsole(IntToStr(i) + ': ' + s + ' ' + IntToStr(cKeyMaxIndex)); if s = 'unknown key' then KeyNames[i]:= '' else begin @@ -299,8 +250,8 @@ DefaultBinds[KeyNameToCode(_S'y')]:= 'confirm'; DefaultBinds[KeyNameToCode('mousem')]:= 'zoomreset'; -DefaultBinds[KeyNameToCode('wheelup')]:= 'zoomout'; -DefaultBinds[KeyNameToCode('wheeldown')]:= 'zoomin'; +DefaultBinds[KeyNameToCode('wheelup')]:= 'zoomin'; +DefaultBinds[KeyNameToCode('wheeldown')]:= 'zoomout'; DefaultBinds[KeyNameToCode('f12')]:= 'fullscr'; @@ -317,6 +268,11 @@ DefaultBinds[KeyNameToCode('right')]:= '+right'; DefaultBinds[KeyNameToCode('left_shift')]:= '+precise'; + +DefaultBinds[KeyNameToCode('j0a0u')]:= '+left'; +DefaultBinds[KeyNameToCode('j0a0d')]:= '+right'; +DefaultBinds[KeyNameToCode('j0a1u')]:= '+up'; +DefaultBinds[KeyNameToCode('j0a1d')]:= '+down'; for i:= 1 to 10 do DefaultBinds[KeyNameToCode('f'+IntToStr(i))]:= 'slot '+IntToStr(i); for i:= 1 to 5 do DefaultBinds[KeyNameToCode(IntToStr(i))]:= 'timer '+IntToStr(i); @@ -352,7 +308,7 @@ var i, j: Integer; begin ControllerEnabled:= 0; -{$IFDEF MOBILE} +{$IFDEF IPHONE} exit; // joystick subsystem disabled on iPhone {$ENDIF} @@ -416,21 +372,34 @@ end; procedure ControllerAxisEvent(joy, axis: Byte; value: Integer); +var + k: LongInt; begin - ControllerAxes[joy][axis]:= value; + SDL_GetKeyState(@k); + k:= k + joy * (ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + ControllerNumButtons[joy]*2); + ProcessKey(k + axis*2, value > 20000); + ProcessKey(k + (axis*2)+1, value < -20000); end; procedure ControllerHatEvent(joy, hat, value: Byte); +var + k: LongInt; begin - ControllerHats[joy][hat]:= value; + SDL_GetKeyState(@k); + k:= k + joy * (ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + ControllerNumButtons[joy]*2); + ProcessKey(k + ControllerNumAxes[joy]*2 + hat*4 + 0, (value and SDL_HAT_UP) <> 0); + ProcessKey(k + ControllerNumAxes[joy]*2 + hat*4 + 1, (value and SDL_HAT_RIGHT)<> 0); + ProcessKey(k + ControllerNumAxes[joy]*2 + hat*4 + 2, (value and SDL_HAT_DOWN) <> 0); + ProcessKey(k + ControllerNumAxes[joy]*2 + hat*4 + 3, (value and SDL_HAT_LEFT) <> 0); end; procedure ControllerButtonEvent(joy, button: Byte; pressed: Boolean); +var + k: LongInt; begin - if pressed then - ControllerButtons[joy][button]:= 1 - else - ControllerButtons[joy][button]:= 0; + SDL_GetKeyState(@k); + k:= k + joy * (ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + ControllerNumButtons[joy]*2); + ProcessKey(k + ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + button, pressed); end; procedure initModule; diff -r a471de309dcc -r eaef11c0d039 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Mon May 14 22:14:17 2012 +0200 +++ b/hedgewars/uStore.pas Tue May 22 09:18:46 2012 +0200 @@ -1048,8 +1048,10 @@ //uTextures.freeModule; //DEBUG ONLY {$ENDIF} AddFileLog('Freeing old primary surface...'); + {$IFNDEF SDL13} SDL_FreeSurface(SDLPrimSurface); SDLPrimSurface:= nil; + {$ENDIF} {$ENDIF} end; @@ -1125,7 +1127,7 @@ begin RegisterVariable('fullscr', @chFullScr, true); - cScaleFactor:= 2.0; + cScaleFactor:= 0; Step:= 0; ProgrTex:= nil; SupportNPOTT:= false; diff -r a471de309dcc -r eaef11c0d039 hedgewars/uTouch.pas --- a/hedgewars/uTouch.pas Mon May 14 22:14:17 2012 +0200 +++ b/hedgewars/uTouch.pas Tue May 22 09:18:46 2012 +0200 @@ -271,7 +271,7 @@ ParseTeamCommand('put'); targetted:= true; end - else if CurAmmoGear^.AmmoType = amSwitch then + else if (CurAmmoGear <> nil) and (CurAmmoGear^.AmmoType = amSwitch) then ParseTeamCommand('switch') else WriteLnToConsole(inttostr(ord(Ammoz[CurrentHedgehog^.CurAmmoType].NameId)) + ' ' + inttostr(ord(sidSwitch))); end; @@ -319,7 +319,7 @@ begin CursorPoint.X:= finger.x; CursorPoint.Y:= finger.y; - doPut(CursorPoint.X, CursorPoint.Y, false); + ParseTeamCommand('put'); end else bShowAmmoMenu:= false; diff -r a471de309dcc -r eaef11c0d039 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Mon May 14 22:14:17 2012 +0200 +++ b/hedgewars/uVariables.pas Tue May 22 09:18:46 2012 +0200 @@ -2286,10 +2286,10 @@ NumPerTurn: 0; Timer: 5001; Pos: 0; - AmmoType: amFlamethrower; + AmmoType: amIceGun; AttackVoice: sndNone; Bounciness: 1000); - Slot: 2; + Slot: 6; TimeAfterTurn: 0; minAngle: 0; maxAngle: 0; @@ -2462,6 +2462,8 @@ DefaultBinds : TBinds; + lastTurnChecksum : Longword; + var trammo: array[TAmmoStrId] of ansistring; // name of the weapon trammoc: array[TAmmoStrId] of ansistring; // caption of the weapon trammod: array[TAmmoStrId] of ansistring; // description of the weapon diff -r a471de309dcc -r eaef11c0d039 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Mon May 14 22:14:17 2012 +0200 +++ b/hedgewars/uWorld.pas Tue May 22 09:18:46 2012 +0200 @@ -1745,7 +1745,7 @@ procedure SetUtilityWidgetState(ammoType: TAmmoType); begin -{$IFDEF TOUCH_INTERFACE} +{$IFDEF USE_TOUCH_INTERFACE} if(ammoType = amNothing)then ammoType:= CurrentHedgehog^.CurAmmoType; diff -r a471de309dcc -r eaef11c0d039 project_files/Android-build/SDL-android-project/assets/Data/Graphics/Buttons/pause.png Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Buttons/pause.png has changed diff -r a471de309dcc -r eaef11c0d039 project_files/Android-build/SDL-android-project/assets/Data/Graphics/slider.png Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/slider.png has changed diff -r a471de309dcc -r eaef11c0d039 project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/FrontendDataUtils.java --- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/FrontendDataUtils.java Mon May 14 22:14:17 2012 +0200 +++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/FrontendDataUtils.java Tue May 22 09:18:46 2012 +0200 @@ -32,6 +32,7 @@ import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import java.nio.ByteBuffer; public class FrontendDataUtils { @@ -95,8 +96,11 @@ Bitmap b = BitmapFactory.decodeFile(pathPrefix + s + ".png");//create a full path - decode to to a bitmap int width = b.getWidth(); if(b.getHeight() > width){//some pictures contain more 'frames' underneath each other, if so we only use the first frame - Bitmap tmp = Bitmap.createBitmap(b, 0, 0, width, width); - b.recycle(); + Bitmap tmp = Bitmap.createBitmap(width, width, b.getConfig()); + int[] pixels = new int[width * width]; + b.getPixels(pixels, 0,width,0,0,width,width); + tmp.setPixels(pixels,0,width,0,0,width,width); + b.recycle(); b = tmp; } map.put("img", b); diff -r a471de309dcc -r eaef11c0d039 project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Weapon.java --- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Weapon.java Mon May 14 22:14:17 2012 +0200 +++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Weapon.java Tue May 22 09:18:46 2012 +0200 @@ -26,6 +26,7 @@ import java.util.ArrayList; import org.hedgewars.hedgeroid.EngineProtocol.EngineProtocolNetwork; +import org.hedgewars.hedgeroid.EngineProtocol.PascalExports; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserFactory; @@ -46,7 +47,7 @@ private static int maxWeapons; static{ - //maxWeapons = PascalExports.HWgetNumberOfWeapons(); + maxWeapons = PascalExports.HWgetNumberOfWeapons(); } public Weapon(String _name, String _QT, String _prob, String _delay, String _crate){ diff -r a471de309dcc -r eaef11c0d039 project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/SDLActivity.java --- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/SDLActivity.java Mon May 14 22:14:17 2012 +0200 +++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/SDLActivity.java Tue May 22 09:18:46 2012 +0200 @@ -428,7 +428,7 @@ // Runs SDL_main() with added parameters SDLActivity.nativeInit(new String[] { String.valueOf(ipc.port), String.valueOf(surfaceWidth), String.valueOf(surfaceHeight), - "0", "null", "xeli", "1", "1", "1", path, "" }); + "0", "en.txt", "xeli", "1", "1", "1", path, "" }); try { ipc.quitIPC(); diff -r a471de309dcc -r eaef11c0d039 project_files/Android-build/Templates/Makefile.android --- a/project_files/Android-build/Templates/Makefile.android Mon May 14 22:14:17 2012 +0200 +++ b/project_files/Android-build/Templates/Makefile.android Tue May 22 09:18:46 2012 +0200 @@ -1,7 +1,7 @@ SDL_ANDROID_DIR=${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project PPCROSSARM=${FPC_DIR}/ppcrossarm -PPCROSSARM_FLAGS= -Xd -O2 -g -Tlinux -XParm-linux-androideabi- -B -vwnh +PPCROSSARM_FLAGS= -Xd -O2 -g -Tlinux -XParm-linux-androideabi- -B -vwnh -n PPCROSSARM_INCLUDES= \ -FD${ANDROID_NDK_TOOLCHAINDIR}/bin \ -Fu${FPC_DIR}/../rtl/units/arm-linux \ @@ -22,9 +22,17 @@ $(PPCROSSARM) $(LINKERFLAGS) $(PPCROSSARM_FLAGS) $(PPCROSSARM_INCLUDES) $(FPC_DEFINES) -o${CMAKE_CURRENT_SOURCE_DIR}/out/libhwengine.so ${CMAKE_CURRENT_SOURCE_DIR}/../../hedgewars/hwLibrary.pas ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/out/libhwengine.so $(SDL_ANDROID_DIR)/libs/armeabi/ + +debug: build ${ANT} clean -f $(SDL_ANDROID_DIR)/build.xml ${ANT} debug -f $(SDL_ANDROID_DIR)/build.xml -install: build +unsigned: build + ${ANT} clean -f $(SDL_ANDROID_DIR)/build.xml + ${ANT} release -f $(SDL_ANDROID_DIR)/build.xml + +install/debug: debug + ${ANT} installd -f $(SDL_ANDROID_DIR)/build.xml +install/release: release ${ANT} installd -f $(SDL_ANDROID_DIR)/build.xml clean: diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/LandIce.png Binary file share/hedgewars/Data/Graphics/LandIce.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Bazooka.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Bazooka.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Bazooka@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Bazooka@2x.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Cluster_Bomb@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Cluster_Bomb@2x.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Grenade.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Grenade.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Grenade@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Grenade@2x.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Rope@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Rope@2x.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Shotgun.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Shotgun.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Shotgun@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Shotgun@2x.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Sniper_Rifle.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Sniper_Rifle.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Bamboo_Thicket.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Bamboo_Thicket.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Dangerous_Ducklings.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Dangerous_Ducklings.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Diver.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Diver.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Newton_and_the_Hammock.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Newton_and_the_Hammock.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_RCPlane_Challenge.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_RCPlane_Challenge.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_RCPlane_Challenge@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_RCPlane_Challenge@2x.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Rope_Knock_Challenge.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Rope_Knock_Challenge.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Rope_Knock_Challenge@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Rope_Knock_Challenge@2x.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Spooky_Tree.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Spooky_Tree.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Spooky_Tree@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Spooky_Tree@2x.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Teamwork.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Teamwork.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_That_Sinking_Feeling.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_That_Sinking_Feeling.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_The_Great_Escape.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_The_Great_Escape.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_The_Great_Escape@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_The_Great_Escape@2x.png has changed diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Locale/missions_en.txt --- a/share/hedgewars/Data/Locale/missions_en.txt Mon May 14 22:14:17 2012 +0200 +++ b/share/hedgewars/Data/Locale/missions_en.txt Tue May 22 09:18:46 2012 +0200 @@ -1,38 +1,47 @@ -Basic_Training_-_Bazooka.name=Basic Bazooka Training -Basic_Training_-_Bazooka.desc="Using the wind to your advantage is key!" - -Basic_Training_-_Grenade.name=Basic Grenade Training -Basic_Training_-_Grenade.desc="Remember, you pull the pin out AND throw!" - -Basic_Training_-_Cluster_Bomb.name=Basic Cluster Bomb Training -Basic_Training_-_Cluster_Bomb.desc="Someone needs hot shower!" - -Basic_Training_-_Shotgun.name=Basic Shotgun Training -Basic_Training_-_Shotgun.desc="Shoot first, ask questions later!" - -Basic_Training_-_Sniper_Rifle.name=Basic Sniper Rifle Training -Basic_Training_-_Sniper_Rifle.desc="Boom, headshot!" - -Basic_Training_-_Rope.name=Basic Rope Training -Basic_Training_-_Rope.desc="Get out there and swing!" - -User_Mission_-_Dangerous_Ducklings.name=Mission: Dangerous Ducklings -User_Mission_-_Dangerous_Ducklings.desc="Alright, rookie! Time to put what we learned in Basic Training into practice!" - -User_Mission_-_Diver.name=Mission: Diver -User_Mission_-_Diver.desc="This 'amphibious assault' thing is harder than it looks..." - -User_Mission_-_Teamwork.name=Mission: Teamwork -User_Mission_-_Teamwork.desc="Sometimes, love hurts." - -User_Mission_-_Spooky_Tree.name=Mission: Spooky Tree -User_Mission_-_Spooky_Tree.desc="Lots of crates out here. I sure hope that bird ain't feeling hungry." - -User_Mission_-_Bamboo_Thicket.name=Mission: Bamboo Thicket -User_Mission_-_Bamboo_Thicket.desc="Death comes from above." - -User_Mission_-_That_Sinking_Feeling.name=Mission: That Sinking Feeling -User_Mission_-_That_Sinking_Feeling.desc="The water is rising rapidly and time is limited. Many have tried and failed. Can you save them all?" - -User_Mission_-_Newton_and_the_Hammock.name=Mission: Newton and the Hammock -User_Mission_-_Newton_and_the_Hammock.desc="Remember hoglets: The velocity of a body remains constant unless the body is acted upon by an external force!" +Basic_Training_-_Bazooka.name=Basic Bazooka Training +Basic_Training_-_Bazooka.desc="Using the wind to your advantage is key!" + +Basic_Training_-_Grenade.name=Basic Grenade Training +Basic_Training_-_Grenade.desc="Remember, you pull the pin out AND throw!" + +Basic_Training_-_Cluster_Bomb.name=Basic Cluster Bomb Training +Basic_Training_-_Cluster_Bomb.desc="Someone needs hot shower!" + +Basic_Training_-_Shotgun.name=Basic Shotgun Training +Basic_Training_-_Shotgun.desc="Shoot first, ask questions later!" + +Basic_Training_-_Sniper_Rifle.name=Basic Sniper Rifle Training +Basic_Training_-_Sniper_Rifle.desc="Boom, headshot!" + +Basic_Training_-_Rope.name=Basic Rope Training +Basic_Training_-_Rope.desc="Get out there and swing!" + +User_Mission_-_Dangerous_Ducklings.name=Mission: Dangerous Ducklings +User_Mission_-_Dangerous_Ducklings.desc="Alright, rookie! Time to put what we learned in Basic Training into practice!" + +User_Mission_-_Diver.name=Mission: Diver +User_Mission_-_Diver.desc="This 'amphibious assault' thing is harder than it looks..." + +User_Mission_-_Teamwork.name=Mission: Teamwork +User_Mission_-_Teamwork.desc="Sometimes, love hurts." + +User_Mission_-_Spooky_Tree.name=Mission: Spooky Tree +User_Mission_-_Spooky_Tree.desc="Lots of crates out here. I sure hope that bird ain't feeling hungry." + +User_Mission_-_Bamboo_Thicket.name=Mission: Bamboo Thicket +User_Mission_-_Bamboo_Thicket.desc="Death comes from above." + +User_Mission_-_That_Sinking_Feeling.name=Mission: That Sinking Feeling +User_Mission_-_That_Sinking_Feeling.desc="The water is rising rapidly and time is limited. Many have tried and failed. Can you save them all?" + +User_Mission_-_Newton_and_the_Hammock.name=Mission: Newton and the Hammock +User_Mission_-_Newton_and_the_Hammock.desc="Remember hoglets: The velocity of a body remains constant unless the body is acted upon by an external force!" + +User_Mission_-_The_Great_Escape.name=Mission: The Great Escape +User_Mission_-_The_Great_Escape.desc="You think you can cage me!?" + +User_Mission_-_Rope_Knock_Challenge.name=Challenge: Rope Knocking +User_Mission_-_Rope_Knock_Challenge.desc="Look behind you!" + +User_Mission_-_RCPlane_Challenge.name=Challenge: RC Plane +User_Mission_-_RCPlane_Challenge.desc="Feeling pretty confident, eh, flyboy?" \ No newline at end of file diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua Tue May 22 09:18:46 2012 +0200 @@ -0,0 +1,190 @@ +-- Hedgewars Grenade Training +-- Scripting Example + +-- Lines such as this one are comments - they are ignored +-- by the game, no matter what kind of text is in there. +-- It's also possible to place a comment after some real +-- instruction as you see below. In short, everything +-- following "--" is ignored. + +--------------------------------------------------------------- +-- At first we implement the localization library using loadfile. +-- This allows us to localize strings without needing to think +-- about translations. +-- We can use the function loc(text) to localize a string. + +loadfile(GetDataPath() .. "Scripts/Locale.lua")() + +-- This variable will hold the number of destroyed targets. +local score = 0 +-- This variable represents the number of targets to destroy. +local score_goal = 5 +-- This variable controls how many milliseconds/ticks we'd +-- like to wait before we end the round once all targets +-- have been destroyed. +local end_timer = 4000 -- 5000 ms = 5 s +-- This variable is set to true if the game is lost (i.e. +-- time runs out). +local game_lost = false +-- This variable ensures that the death function isn't called +-- repeatedly when game is over. +local team_death = false +-- This variable will point to the hog's gear +local player = nil +-- This variable will grab the time left at the end of the round +local time_goal = 0 + +-- This is a custom function to make it easier to +-- spawn more targets with just one line of code +-- You may define as many custom functions as you +-- like. +function spawnTarget() + -- add a new target gear + gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0) + + -- move it to a random position within 0 and + -- LAND_WIDTH - the width of the map + FindPlace(gear, true, 0, LAND_WIDTH-1350) + + -- move the target to a higher vertical position + -- to ensure it's not somewhere down below + x, y = GetGearPosition(gear) + SetGearPosition(gear, x, 500) +end + +-- This function is called before the game loads its +-- resources. +-- It's one of the predefined function names that will +-- be called by the game. They give you entry points +-- where you're able to call your own code using either +-- provided instructions or custom functions. +function onGameInit() + -- At first we have to overwrite/set some global variables + -- that define the map, the game has to load, as well as + -- other things such as the game rules to use, etc. + -- Things we don't modify here will use their default values. + + -- The base number for the random number generator + Seed = 1 + -- Game settings and rules + GameFlags = gfInfAttack + gfOneClanMode + -- The time the player has to move each round (in ms) + TurnTime = 60000 + -- The frequency of crate drops + CaseFreq = 0 + -- The number of mines being placed + MinesNum = 0 + -- The number of explosives being placed + Explosives = 0 + -- The delay between each round + Delay = 1 + -- The map to be played + Map = "Battlefield" + -- The theme to be used + Theme = "Castle" + + -- Create the player team + AddTeam(loc("Grenadiers"), 14483456, "Simple", "Island", "Default") + -- And add a hog to it + player = AddHog(loc("Nade Boy"), 0, 1, "war_grenadier1") + SetGearPosition(player, 1530, 1100) +end + +-- This function is called when the round starts +-- it spawns the first target that has to be destroyed. +-- In addition it shows the scenario goal(s). +function onGameStart() + -- Spawn the first target. + spawnTarget() + + -- Show some nice mission goals. + -- Parameters are: caption, sub caption, description, + -- extra text, icon and time to show. + -- A negative icon parameter (-n) represents the n-th weapon icon + -- A positive icon paramter (n) represents the (n+1)-th mission icon + -- A timeframe of 0 is replaced with the default time to show. + ShowMission(loc("Grenade Training"), loc("Aiming Practice"), loc("Eliminate all targets before your time runs out.|You have unlimited ammo for this mission."), -amGrenade, 0) +end + +function onNewTurn() + ParseCommand("setweap " .. string.char(amGrenade)) +end + +-- This function is called every game tick. +-- Note that there are 1000 ticks within one second. +-- You shouldn't try to calculate too complicated +-- code here as this might slow down your game. +function onGameTick() + -- If time's up, set the game to be lost. + -- We actually check the time to be "1 ms" as it + -- will be at "0 ms" right at the start of the game. + if TurnTimeLeft == 1 and score < score_goal then + game_lost = true + -- ... and show a short message. + ShowMission(loc("Grenade Training"), loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0) + -- How about killing our poor hog due to his poor performance? + SetHealth(player, 0) + -- Just to be sure set the goal time to 1 ms + time_goal = 1 + end + -- If the goal is reached or we've lost ... + if score == score_goal or game_lost then + -- ... check to see if the time we'd like to + -- wait has passed and then ... + if end_timer == 0 then + -- Override the 'Draw' message with the appropriate message. + if game_lost then + AddCaption("Mission lost!", 0xffba00ff,capgrpGameState) + else + AddCaption("Mission won!", 0xffba00ff,capgrpGameState) + end + -- Remove the team to end the game. Only do this once. + if team_death == false then + team_death = true + ParseCommand("teamgone " .. "Grenadiers") + end + else + -- ... or just lower the timer by 1. + end_timer = end_timer - 1 + -- Reset the time left to stop the timer + TurnTimeLeft = time_goal + end + end +end + +-- This function is called when the game is initialized +-- to request the available ammo and probabilities +function onAmmoStoreInit() + -- add an unlimited supply of bazooka ammo + SetAmmo(amGrenade, 9, 0, 0, 0) +end + +-- This function is called when a new gear is added. +-- We don't need it for this training, so we can +-- keep it empty. +function onGearAdd(gear) +end + +-- This function is called before a gear is destroyed. +-- We use it to count the number of targets destroyed. +function onGearDelete(gear) + -- We're only interested in target gears. + if GetGearType(gear) == gtTarget then + -- Add one point to our score/counter + score = score + 1 + -- If we haven't reached the goal ... + if score < score_goal then + -- ... spawn another target. + spawnTarget() + else + if not game_lost then + -- Otherwise show that the goal was accomplished + ShowMission(loc("Grenade Training"), loc("Aiming Practice"), loc("Congratulations! You've eliminated all targets|within the allowed time frame."), 0, 0) + -- Also let the hogs shout "victory!" + PlaySound(sndVictory) + -- Save the time left so we may keep it. + time_goal = TurnTimeLeft + end + end + end +end diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Missions/Training/User_Mission_-_RCPlane_Challenge.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_RCPlane_Challenge.lua Tue May 22 09:18:46 2012 +0200 @@ -0,0 +1,338 @@ +loadfile(GetDataPath() .. "Scripts/Locale.lua")() + +local player = nil +local RCGear = nil +local planesUsed = 0 +local cratesLeft = 0 + +function onGameInit() + + Seed = 1 + GameFlags = gfInfAttack + gfInvulnerable + gfOneClanMode + gfSolidLand + + TurnTime = 90 * 1000 + + Map = "Ropes" + Theme = "Eyes" + + CaseFreq = 0 + MinesNum = 0 + Explosives = 0 + + AddTeam(loc("Wannabe Flyboys"), 14483456, "Simple", "Island", "Default", "Hedgewars") + player = AddHog(loc("Ace"), 0, 80, "Gasmask") --NoHat + SetGearPosition(player, 1380, 1500) + +end + + + +function onGameStart() + + ShowMission ( + loc("RC PLANE TRAINING"), + loc("a Hedgewars challenge"), + + loc("Collect or destroy all the health crates.") .. "|" .. + loc("Compete to use as few planes as possible!") .. "|" .. + "", -amRCPlane, 4000 + ) + + PlaceGirder(2192, 508, 6) + PlaceGirder(2192, 670, 6) + PlaceGirder(2193, 792, 2) + PlaceGirder(2100, 825, 4) + PlaceGirder(2009, 899, 6) + PlaceGirder(2084, 992, 4) + PlaceGirder(2145, 1087, 6) + PlaceGirder(2199, 1235, 5) + PlaceGirder(2308, 1296, 0) + PlaceGirder(2424, 1234, 7) + PlaceGirder(2473, 1129, 2) + PlaceGirder(2437, 1046, 1) + PlaceGirder(2409, 927, 6) + PlaceGirder(2408, 763, 6) + PlaceGirder(2404, 540, 6) + PlaceGirder(2426, 423, 3) + PlaceGirder(2550, 400, 4) + PlaceGirder(2668, 425, 1) + PlaceGirder(2707, 541, 6) + PlaceGirder(2706, 703, 6) + PlaceGirder(2705, 867, 6) + PlaceGirder(2779, 962, 4) + PlaceGirder(2894, 924, 3) + PlaceGirder(2908, 802, 6) + PlaceGirder(2907, 639, 6) + PlaceGirder(3052, 566, 4) + PlaceGirder(2971, 394, 4) + PlaceGirder(3103, 448, 7) + PlaceGirder(3047, 654, 0) + PlaceGirder(3043, 746, 6) + PlaceGirder(3265, 1583, 6) + PlaceGirder(3256, 1491, 4) + PlaceGirder(3187, 1401, 6) + PlaceGirder(3326, 1400, 6) + PlaceGirder(774, 530, 5) + PlaceGirder(922, 595, 4) + PlaceGirder(1079, 533, 7) + PlaceGirder(1139, 386, 6) + PlaceGirder(1074, 237, 5) + PlaceGirder(723, 381, 6) + PlaceGirder(781, 229, 7) + PlaceGirder(927, 746, 6) + PlaceGirder(874, 736, 0) + PlaceGirder(982, 737, 0) + PlaceGirder(2430, 1730, 4) + + PlaceGirder(1613, 1104, 7) + PlaceGirder(1564, 1256, 6) + PlaceGirder(1643, 1341, 5) + PlaceGirder(1780, 1372, 4) + PlaceGirder(1869, 1296, 7) + PlaceGirder(1858, 1163, 5) + PlaceGirder(1739, 1044, 5) + PlaceGirder(1621, 926, 5) + PlaceGirder(1597, 985, 5) + PlaceGirder(1449, 939, 4) + PlaceGirder(1473, 874, 4) + PlaceGirder(2092, 1352, 7) + PlaceGirder(2145, 1444, 7) + PlaceGirder(2004, 1443, 3) + PlaceGirder(1978, 1523, 2) + PlaceGirder(2021, 1596, 1) + PlaceGirder(2103, 1625, 0) + PlaceGirder(2208, 1551, 7) + PlaceGirder(2327, 1431, 7) + PlaceGirder(2395, 1478, 6) + PlaceGirder(2396, 1600, 2) + PlaceGirder(2495, 1285, 6) + PlaceGirder(2494, 1408, 2) + PlaceGirder(2547, 530, 0) + + PlaceGirder(2451, 1551, 0) + PlaceGirder(2551, 706, 6) + PlaceGirder(2551, 869, 6) + PlaceGirder(2623, 1016, 5) + PlaceGirder(2773, 1083, 4) + PlaceGirder(2924, 1019, 7) + PlaceGirder(2568, 1491, 7) + PlaceGirder(2618, 1346, 6) + PlaceGirder(2674, 1195, 7) + PlaceGirder(2822, 1142, 4) + PlaceGirder(2963, 1069, 7) + PlaceGirder(3067, 938, 5) + PlaceGirder(2803, 1373, 2) + PlaceGirder(2811, 1559, 2) + + tempG = SpawnHealthCrate(930, 557) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(979, 692) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(876, 703) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2309, 1260) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1733, 1127) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1738, 1320) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3249, 1460) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3051, 617) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2972, 353) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2548, 358) + + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2090, 1580) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1752, 1753) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1865, 1758) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1985, 1760) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2429, 1760) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2810, 1480) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2800, 1277) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2806, 1107) + SetHealth(tempG, 25) + + PlaceGirder(1897, 903, 6) + PlaceGirder(1916, 784, 3) + PlaceGirder(2010, 732, 4) + PlaceGirder(2082, 639, 6) + PlaceGirder(2081, 516, 2) + PlaceGirder(1985, 487, 4) + PlaceGirder(1862, 407, 5) + PlaceGirder(1855, 224, 7) + PlaceGirder(2006, 163, 4) + PlaceGirder(2128, 187, 1) + PlaceGirder(2251, 213, 4) + PlaceGirder(2413, 213, 4) + PlaceGirder(1952, 618, 0) + PlaceGirder(957, 1068, 4) + PlaceGirder(794, 1069, 4) + PlaceGirder(728, 1163, 6) + PlaceGirder(728, 1287, 2) + PlaceGirder(802, 1342, 4) + PlaceGirder(966, 1342, 4) + PlaceGirder(674, 1032, 1) + PlaceGirder(554, 1011, 4) + PlaceGirder(445, 1056, 3) + PlaceGirder(422, 1174, 6) + PlaceGirder(369, 1341, 5) + PlaceGirder(495, 1313, 5) + PlaceGirder(568, 1379, 3) + PlaceGirder(577, 1202, 2) + PlaceGirder(744, 1490, 5) + PlaceGirder(760, 1617, 7) + PlaceGirder(622, 1693, 4) + PlaceGirder(476, 1623, 5) + PlaceGirder(376, 1697, 1) + PlaceGirder(955, 1746, 2) + PlaceGirder(1025, 1746, 2) + PlaceGirder(1090, 1745, 2) + PlaceGirder(1156, 1746, 2) + PlaceGirder(3806, 1530, 2) + PlaceGirder(3880, 1464, 2) + PlaceGirder(3738, 1458, 2) + PlaceGirder(3806, 1390, 2) + PlaceGirder(3805, 1588, 0) + PlaceGirder(3676, 1609, 3) + PlaceGirder(3930, 1615, 1) + PlaceGirder(3719, 1295, 0) + PlaceGirder(3888, 1294, 0) + PlaceGirder(3661, 1385, 2) + PlaceGirder(3955, 1377, 2) + PlaceGirder(3982, 1518, 0) + PlaceGirder(3378, 440, 2) + PlaceGirder(3447, 492, 4) + PlaceGirder(3564, 529, 1) + PlaceGirder(3596, 647, 6) + PlaceGirder(3521, 740, 4) + PlaceGirder(3524, 838, 4) + PlaceGirder(3644, 819, 3) + PlaceGirder(3691, 708, 6) + PlaceGirder(3690, 545, 6) + PlaceGirder(3612, 433, 5) + PlaceGirder(3463, 383, 4) + PlaceGirder(2815, 122, 7) + PlaceGirder(2960, 72, 4) + PlaceGirder(3032, 123, 2) + PlaceGirder(3063, 174, 0) + PlaceGirder(3095, 124, 2) + PlaceGirder(3169, 71, 4) + PlaceGirder(3320, 124, 5) + PlaceGirder(3210, 179, 2) + PlaceGirder(2932, 181, 2) + + tempG = SpawnHealthCrate(3804, 1461) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3269, 1742) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3066, 121) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3207, 104) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2928, 103) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1997, 202) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2253, 159) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2132, 774) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2549, 490) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3527, 694) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3777, 78) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1124, 1746) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1056, 1740) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(993, 1742) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(799, 1298) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(577, 1126) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(596, 1463) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3854, 1043) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1944, 567) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(338, 1748) + SetHealth(tempG, 25) + + +end + +function onGameTick() + + --if RCGear ~= nil then + -- AddCaption(GetTimer(RCGear)) + --end + +end + +function onNewTurn() + TurnTimeLeft = -1 +end + +function onGearAdd(gear) + + if GetGearType(gear) == gtRCPlane then + RCGear = gear + planesUsed = planesUsed + 1 + end + + if GetGearType(gear) == gtCase then + cratesLeft = cratesLeft + 1 + end + +end + +function onGearDelete(gear) + + if GetGearType(gear) == gtRCPlane then + + RCGear = nil + AddCaption(loc("Planes Used:") .. " " .. planesUsed) + + elseif GetGearType(gear) == gtCase then + + AddCaption(loc("Crates Left:") .. " " .. cratesLeft) + cratesLeft = cratesLeft - 1 + + if cratesLeft == 0 then + + ShowMission ( + loc("CHALLENGE COMPLETE"), + loc("Congratulations!"), + loc("Planes Used") .. ": " .. planesUsed .. "|" .. + "", 0, 0 + ) + + + ParseCommand("teamgone Wannabe Flyboys") + end + + if RCGear ~= nil then + SetTimer(RCGear, GetTimer(RCGear) + 10000) + end + + end + +end + +function onAmmoStoreInit() + SetAmmo(amRCPlane, 9, 0, 0, 0) +end diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Missions/Training/User_Mission_-_Rope_Knock_Challenge.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_Rope_Knock_Challenge.lua Tue May 22 09:18:46 2012 +0200 @@ -0,0 +1,221 @@ +loadfile(GetDataPath() .. "Scripts/Locale.lua")() + +local hhs = {} +local missionWon = nil +local endTimer = 1000 +local hogsKilled = 0 + +local HogData = { + {"Bufon", "ShaggyYeti",false}, + {"burp", "lambda",false}, + {"Blue", "cap_blue",false}, + {"bender", "NoHat",false}, + {"Castell", "NoHat",false}, + {"cekoto", "NoHat",false}, + {"CheezeMonkey", "NoHat",false}, + {"claymore", "NoHat",false}, + {"CIA-144", "cyborg1",false}, + {"doomy ", "NoHat",false}, + {"Falkenauge", "NoHat",false}, + {"FadeOne", "NoHat",false}, + {"hayaa", "NoHat",false}, + {"Hermes", "laurel",false}, + {"HedgeKing", "NoHat",false}, + {"Izack1535", "NoHat",false}, + {"Kiofspa", "NoHat",false}, + {"Komplex", "NoHat",false}, + {"koda", "poke_mudkip",false}, + {"Lalo", "NoHat",false}, + {"Logan", "NoHat",false}, + {"lollkiller", "NoHat",false}, + {"Luelle", "NoHat",false}, + {"mikade", "Skull",false}, + {"Mushi", "sm_daisy",false}, + {"Naboo", "NoHat",false}, + {"nemo", "bb_bub",false}, + {"practice", "NoHat",false}, + {"Prof. Panic", "NoHat",false}, + {"Randy", "zoo_Sheep",false}, + {"rhino", "NinjaTriangle",false}, + {"Radissthor", "NoHat",false}, + {"Sami", "sm_peach",false}, + {"soreau", "NoHat",false}, + {"sdw195", "NoHat",false}, + {"sphrix", "TeamTopHat",false}, + {"sheepluva", "zoo_Sheep",false}, + {"Smaxx", "NoHat",false}, + {"shadowzero", "NoHat",false}, + {"Star and Moon", "SparkleSuperFun",false}, + {"The 24", "NoHat",false}, + {"TLD", "NoHat",false}, + {"Tiyuri", "sf_ryu",false}, + {"unC0Rr", "cyborg1",false}, + {"Waldsau", "cyborg1",false}, + {"wolfmarc", "knight",false}, + {"Xeli", "android",false} + + } + +function GenericEnd() + ParseCommand("teamgone " .. loc("Wannabe Shoppsta")) + ParseCommand("teamgone " .. loc("Unsuspecting Louts")) + ParseCommand("teamgone " .. loc("Unlucky Sods")) +end + +function GameOverMan() + missionWon = false + ShowMission(loc("ROPE-KNOCKING"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0) + PlaySound(sndHellish) +end + +function GG() + missionWon = true + ShowMission(loc("ROPE-KNOCKING"), loc("MISSION SUCCESS"), loc("Congratulations!") .. "|" .. loc("COMPLETION TIME") .. ": " .. (TurnTime - TurnTimeLeft) / 1000, 0, 0) + PlaySound(sndHomerun) +end + +function AssignCharacter(p) + + done = false + sanityCheck = 0 + + while(done == false) do + + i = 1+ GetRandom(#HogData) + if HogData[i][3] == false then + HogData[i][3] = true + done = true + SetHogName(hhs[p], HogData[i][1]) + SetHogHat(hhs[p], HogData[i][2]) + elseif HogData[i][3] == true then + sanityCheck = sanityCheck +1 + if sanityCheck == 100 then + done = true + SetHogName(hhs[p], "Newbie") + SetHogHat(hhs[p], "NoHat") + end + end + + end + +end + +function onGameInit() + + --Seed = 1 + GameFlags = gfBorder + gfSolidLand + + TurnTime = 180 * 1000 + Delay = 500 + Map = "Ropes" + Theme = "Eyes" + + CaseFreq = 0 + MinesNum = 0 + Explosives = 0 + + AddTeam(loc("Wannabe Shoppsta"), 1175851, "Simple", "Island", "Default", "Hedgewars") + hhs[0] = AddHog(loc("Ace"), 0, 1, "Gasmask") + SetGearPosition(player, 1380, 1500) + + AddTeam(loc("Unsuspecting Louts"), 14483456, "Simple", "Island", "Default", "Hedgewars") + for i = 1, 8 do + hhs[i] = AddHog("generic", 0, 1, "NoHat") + end + + AddTeam(loc("Unlucky Sods"), 14483456, "Simple", "Island", "Default", "Hedgewars") + for i = 9, 16 do + hhs[i] = AddHog("generic", 0, 1, "NoHat") + end + +end + + + +function onGameStart() + + ShowMission ( + loc("ROPE-KNOCKING"), + loc("a Hedgewars challenge"), + loc("Use the rope to knock your enemies to their doom.") .. "|" .. + + "", -amRope, 4000 + ) + + SetGearPosition(hhs[0], 2419, 1769) + SetGearPosition(hhs[1], 3350, 570) + SetGearPosition(hhs[2], 3039, 1300) + SetGearPosition(hhs[3], 2909, 430) + SetGearPosition(hhs[4], 2150, 879) + SetGearPosition(hhs[5], 1735, 1136) + SetGearPosition(hhs[6], 1563, 553) + SetGearPosition(hhs[7], 679, 859) + SetGearPosition(hhs[8], 1034, 251) + SetGearPosition(hhs[9], 255, 67) + SetGearPosition(hhs[10], 2671, 7) + SetGearPosition(hhs[11], 2929, 244) + SetGearPosition(hhs[12], 1946, 221) + SetGearPosition(hhs[13], 3849, 1067) + SetGearPosition(hhs[14], 3360, 659) + SetGearPosition(hhs[15], 3885, 285) + SetGearPosition(hhs[16], 935, 1160) + + for i = 1, 16 do + AssignCharacter(i) + end + +end + +function onGameTick() + + if (TurnTimeLeft == 1) and (missionWon == nil) then + GameOverMan() + end + + if missionWon ~= nil then + + endTimer = endTimer - 1 + if endTimer == 1 then + GenericEnd() + end + + if missionWon == true then + AddCaption(loc("GG!"), 0xffba00ff,capgrpGameState) + else + AddCaption(loc("Ouch!"), 0xffba00ff,capgrpGameState) + end + + end + +end + +function onGearDamage(gear, damage) + + if gear ~= hhs[0] then + + AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false) + DeleteGear(gear) + PlaySound(sndExplosion) + + hogsKilled = hogsKilled +1 + if hogsKilled == 15 then + PlaySound(sndRideOfTheValkyries) + elseif hogsKilled == 16 then + GG() + end + + end + +end + +function onGearDelete(gear) + + if (gear == hhs[0]) and (missionWon == nil) then + GameOverMan() + end + +end + +function onAmmoStoreInit() + SetAmmo(amRope, 9, 0, 0, 0) +end diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Missions/Training/User_Mission_-_The_Great_Escape.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_The_Great_Escape.lua Tue May 22 09:18:46 2012 +0200 @@ -0,0 +1,122 @@ +loadfile(GetDataPath() .. "Scripts/Locale.lua")() + +local player = nil +local enemy = nil + +function onGameInit() + + Map = "Castle" + Theme = "Nature" + Seed = 0 + GameFlags = gfInfAttack + + TurnTime = 45 * 1000 + + CaseFreq = 0 + MinesNum = 0 + Explosives = 0 + + AddTeam(loc("Hero Team"), 14483456, "Simple", "Island", "Default", "Hedgewars") + player = AddHog(loc("Good Dude"), 0, 80, "NoHat") --NoHat + + AddTeam(loc("Bad Team"), 1175851, "Simple", "Island", "Default", "Hedgewars") + enemy = AddHog("Bad Guy", 1, 40, "NoHat") + +end + +function onGameStart() + +ShowMission(loc("The Great Escape"), loc("Get out of there!"), loc("Elimate your captor."), -amGrenade, 0) + +------ GIRDER LIST ------ +PlaceGirder(2066, 1588, 0) +PlaceGirder(2052, 1498, 6) +PlaceGirder(2098, 1498, 6) +PlaceGirder(2074, 1409, 0) +PlaceGirder(2199, 1755, 7) +PlaceGirder(2476, 1929, 2) +PlaceGirder(2546, 1879, 4) +PlaceGirder(2520, 1924, 3) +PlaceGirder(2706, 1879, 4) +PlaceGirder(2797, 1911, 2) +PlaceGirder(2671, 1925, 1) +PlaceGirder(2895, 1907, 6) +PlaceGirder(2895, 1747, 6) +PlaceGirder(2798, 1792, 6) +PlaceGirder(2797, 1791, 6) +PlaceGirder(2845, 1928, 1) +PlaceGirder(2846, 1826, 3) +PlaceGirder(2844, 1747, 1) +PlaceGirder(2806, 1702, 4) +PlaceGirder(2846, 1685, 0) +PlaceGirder(2846, 1668, 0) +PlaceGirder(2766, 1668, 0) +PlaceGirder(2766, 1685, 0) +PlaceGirder(2718, 1700, 2) +PlaceGirder(2927, 1659, 0) +------ HEALTH CRATE LIST ------ +SpawnHealthCrate(2500, 1193) +SpawnHealthCrate(2575, 1201) +SpawnHealthCrate(2610, 1224) +SpawnHealthCrate(2463, 1213) +SpawnHealthCrate(2425, 1235) +SpawnHealthCrate(2657, 1234) +------ MINE LIST ------ +tempG = AddGear(2034, 1704, gtMine, 0, 0, 0, 0) +SetTimer(tempG, 1) +tempG = AddGear(2055, 1744, gtMine, 0, 0, 0, 0) +SetTimer(tempG, 1) +tempG = AddGear(2063, 1772, gtMine, 0, 0, 0, 0) +SetTimer(tempG, 1) +tempG = AddGear(2075, 1801, gtMine, 0, 0, 0, 0) +SetTimer(tempG, 1) +tempG = AddGear(2089, 1820, gtMine, 0, 0, 0, 0) +SetTimer(tempG, 1) +tempG = AddGear(2118, 1824, gtMine, 0, 0, 0, 0) +SetTimer(tempG, 1) +------ REPOSITION LIST ------ +SetGearPosition(player, 2074, 1558) +SetGearPosition(enemy, 2536, 1182) +SetHealth(player, 1) +SetHealth(enemy, 1) +------ AMMO CRATE LIST ------ +SpawnAmmoCrate(2656, 1967, 5) +SpawnAmmoCrate(2747, 1912, 12) +SpawnAmmoCrate(2939, 1623, 1) +------ UTILITY CRATE LIST ------ +SpawnUtilityCrate(2543, 1969, 15) +SpawnUtilityCrate(2251, 1664, 6) +SpawnUtilityCrate(2440, 1937, 18) +------ END LOADING DATA ------ + +end + +function onGameTick() + + if TurnTimeLeft == TurnTime-1 then + SetWind(100) + end + +end + +function onGearDelete(gear) + if (GetGearType(gear) == gtCase) and (CurrentHedgehog == player) then + if GetHealth(gear) > 0 then + AddGear(GetX(gear), GetY(gear), gtGrenade, 0, 0, 0, 1) + end + elseif gear == player then + ShowMission(loc("The Great Escape"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0) + elseif gear == enemy then + ShowMission(loc("The Great Escape"), loc("MISSION SUCCESSFUL"), loc("Congratulations!"), 0, 0) + end +end + +function onAmmoStoreInit() + SetAmmo(amGrenade, 1, 0, 0, 1) + SetAmmo(amParachute, 1, 0, 0, 1) + SetAmmo(amFirePunch, 0, 0, 0, 3) + SetAmmo(amPickHammer, 0, 0, 0, 1) + SetAmmo(amBlowTorch, 0, 0, 0, 1) + SetAmmo(amShotgun, 0, 0, 0, 1) + SetAmmo(amSkip, 9, 0, 0, 0) +end diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Scripts/Multiplayer/WxW.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Scripts/Multiplayer/WxW.cfg Tue May 22 09:18:46 2012 +0200 @@ -0,0 +1,2 @@ +Shoppa +Shoppa diff -r a471de309dcc -r eaef11c0d039 share/hedgewars/Data/Scripts/Multiplayer/WxW.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua Tue May 22 09:18:46 2012 +0200 @@ -0,0 +1,751 @@ + +---------------------- +-- WALL TO WALL 0.4 +---------------------- +-- a shoppa minigame +-- by mikade + +-- feel free to add map specific walls to LoadConfig, or post additional +-- wall suggestions on our forum at: http://www.hedgewars.org/forum + +---------------- +--0.1 +---------------- +-- concept test + +---------------- +--0.2 +---------------- +-- unhardcoded turntimeleft, now uses shoppa default of 45s +-- changed some things behind the scenes +-- fixed oooooold radar bug +-- added radar / script support for multiple crates +-- tweaked weapons tables +-- added surfing and changed crate spawn requirements a bit + +---------------- +--0.3 +---------------- +-- stuffed dirty clothes into cupboard +-- improved user feedback +-- added/improved experimental config system, input masks included :D + +---------------- +--0.4 +---------------- +-- for version 0.9.18, now detects border in correct location +-- fix 0.3 config constraint +-- remove unnecessary vars +-- oops, remove hardcoding of minesnum,explosives +-- ... and unhardcode turntime (again)... man, 30s is hard :( +-- move some initialisations around +-- numerous improvements to user feedback +-- walls disappear after being touched +-- added backwards compatibility with 0.9.17 + +---------------- +--TO DO +---------------- +-- achievements / try detect shoppa moves? :| +-- maybe add ability for the user to place zones like in Racer? +-- add more hard-coded values for specific maps + +----------------------------- +-- GO PONIES, GO PONIES, GO! +----------------------------- + +loadfile(GetDataPath() .. "Scripts/Locale.lua")() +loadfile(GetDataPath() .. "Scripts/Tracker.lua")() +loadfile(GetDataPath() .. "Scripts/Utils.lua")() + +-- experimental menu stuff +local menuIndex = 1 +local menu = {} +local preMenuCfg +local postMenuCfg +local roundN = 0 + +-- config and wall variables +local AFR = false +local allowCrazyWeps = false +local requireSurfer = true +local wX = {} +local wY = {} +local wWidth = {} +local wHeight = {} +local wTouched = {} +--local margin +local wallsLeft = 0 + +local highestY = 0 +local surferTimer = 0 +local hasSurfed = false +local allWallsHit = false + +local gTimer = 1 +local effectTimer = 1 + +local ropeG = nil +local crateG = nil +local allowCrate = true + +-- crate radar vars +local rCirc = {} +local rAlpha = 255 +local rPingTimer = 0 +local m2Count = 0 + +local weapons = {} + +--[[local unlisted = {amTardis, amLandGun,amExtraTime,amExtraDamage, + amVampiric, amSwitch, amInvulnerable, amGirder, amJetpack, + amPortalGun, amTeleport, amResurrector, amLaserSight, amLowGravity, + amAirAttack, amNapalm, amMineStrike, amDrillStrike, + amKamikaze, amSnowball, amSeduction}]] + +local crazyWeps = {amWatermelon, amHellishBomb, amBallgun, amRCPlane} + +local groundWeps = {amBee, amShotgun,amDEagle,amFirePunch, amWhip, + amPickHammer, amBaseballBat, amCake,amBallgun, + amRCPlane, amSniperRifle, amBirdy, amBlowTorch, amGasBomb, + amFlamethrower, amSMine, amMortar, amHammer} + +local ropeWeps = {amGrenade, amClusterBomb, amBazooka, amMine, amDynamite, + amWatermelon, amHellishBomb, amDrill, amMolotov} + +-- 0.9.18+ extra custom data for preset maps +local MapList = + { + --name, surfer, roof, LRwalls + {"Atlantis Shoppa", true, false, true}, + {"BambooPlinko", true, false, true}, + {"BrickShoppa", false, false, true}, + {"BubbleFlow", true, false, true}, + {"Cave", false, false, true}, + {"Glass Shoppa", true, false, true}, + {"HardIce", false, false, true}, + {"Industrial", false, false, true}, + {"Islands", true, false, true}, + {"Hedgelove", true, false, true}, + {"NeonStyle", false, false, true}, + {"Octorama", false, false, true}, + {"red vs blue - Castle", true, false, true}, + {"red vs blue - castle2", true, false, true}, + {"red vs blue - True Shoppa Sky", true, false, true}, + {"Ropes", false, false, true}, + {"Ropes Rearranged", false, false, true}, + {"RopesRevenge Flipped", true, false, true}, + {"Ropes Three", false, false, true}, + {"RopesTwo", false, false, true}, + {"ShapeShoppa1.0", true, false, true}, + {"ShappeShoppa Darkhow", true, false, true}, + {"ShoppaCave2", true, false, true}, + {"ShoppaFun", true, false, true}, + {"ShoppaGolf", false, false, true}, + {"ShoppaHell", false, true, false}, + {"ShoppaKing", false, false, false}, + {"ShoppaNeon", false, false, true}, + {"ShoppaSky", false, false, true}, + {"Shoppawall", false, false, true}, + {"SkatePark", false, false, true}, + {"SloppyShoppa", false, false, true}, + {"Sticks", true, false, true}, + {"Symmetrical Ropes ", false, false, true}, + {"Tetris", false, false, true}, + {"TransRopes2", false, false, true}, + {"Wildmap", false, false, true}, + {"Winter Shoppa", false, false, true}, + {"2Cshoppa", true, false, true} + } + +function BoolToCfgTxt(p) + if p == false then + return("Disabled") + else + return("Enabled") + end +end + +function LoadConfig(p) + + margin = 20 + mapID = nil + + -- 0.9.17 + if Map == "CHANGE_ME" then + AddCaption(loc("For improved features/stability, play 0.9.18+")) + --AddWall(10,10,4085,margin) + AddWall(10,10,margin,2025) + AddWall(4085-margin,10,margin,2025) + end + + --0.9.18+ + for i = 1, #MapList do + if Map == MapList[i][1] then + mapID = i + --AddCaption(MapList[i][1] .. " found. reqSurf is " .. BoolToCfgTxt(MapList[i][2])) + end + end + + if (p == 1) and (mapID ~= nil) then + requireSurfer = MapList[mapID][2] + end + + if mapID ~= nil then + + -- add a wall to the roof + if MapList[mapID][3] == true then + AddWall(LeftX+10,TopY+10,RightX-LeftX-20,margin) + end + + -- add walls on the left and right border + if MapList[mapID][4] == true then + AddWall(LeftX+10,TopY+10,margin,WaterLine) + AddWall(RightX-10-margin,TopY+10,margin,WaterLine) + end + + -- add map specific walls + if Map == "Ropes" then + AddWall(1092,934,54,262) + AddWall(2822,323,33,137) + elseif Map == "ShoppaKing" then + AddWall(3777,1520,50,196) + AddWall(1658,338,46,670) + elseif Map == "ShoppaHell" then + AddWall(2035,831,30,263) + AddWall(3968,1668,31,383) + elseif Map == "ShoppaNeon" then + AddWall(980,400,20,300) + AddWall(1940,400,20,300) + AddWall(3088,565,26,284) + AddWall(187,270,28,266) + end + + -- if map is unrecognized, add two walls on the side borders + -- also, if version of hw is not 0.9.17 or lower + elseif Map ~= "CHANGE_ME" then + AddWall(LeftX+10,TopY+10,margin,WaterLine) + AddWall(RightX-10-margin,TopY+10,margin,WaterLine) + end + + +end + +function AddWall(zXMin,zYMin, zWidth, zHeight) + + table.insert(wX, zXMin) + table.insert(wY, zYMin) + table.insert(wWidth, zWidth) + table.insert(wHeight, zHeight) + table.insert(wTouched, false) + +end + +function DrawBlip(gear) + SetVisualGearValues(getGearValue(gear,"CIRC"), getGearValue(gear,"RX"), getGearValue(gear,"RY"), 100, 255, 1, 10, 0, 40, 3, GetClanColor(GetHogClan(CurrentHedgehog))-rAlpha) +end + +function TrackRadarBlip(gear) + + -- work out the distance to the target + g1X, g1Y = GetGearPosition(CurrentHedgehog) + g2X, g2Y = GetX(gear), GetY(gear) + q = g1X - g2X + w = g1Y - g2Y + r = math.sqrt( (q*q) + (w*w) ) --alternate + + RCX = getGearValue(gear,"RX") + RCY = getGearValue(gear,"RY") + + rCircDistance = r -- distance to circle + + opp = w + if opp < 0 then + opp = opp*-1 + end + + -- work out the angle (theta) to the target + t = math.deg ( math.asin(opp / r) ) + + -- based on the radius of the radar, calculate what x/y displacement should be + NR = 150 -- radius at which to draw circs + NX = math.cos( math.rad(t) ) * NR + NY = math.sin( math.rad(t) ) * NR + + if rCircDistance < NR then + RCX = g2X + elseif q > 0 then + RCX = g1X - NX + else + RCX = g1X + NX + end + + if rCircDistance < NR then + RCY = g2Y + elseif w > 0 then + RCY = g1Y - NY + else + RCY = g1Y + NY + end + + setGearValue(gear, "RX", RCX) + setGearValue(gear, "RY", RCY) + +end + + +function HandleCircles() + + -- enable this if you want the radar to only show for a few seconds + -- after you spawn the crate + --[[if rAlpha ~= 255 then + + rPingTimer = rPingTimer + 1 + if rPingTimer == 100 then + rPingTimer = 0 + + rAlpha = rAlpha + 5 + if rAlpha >= 255 then + rAlpha = 255 + end + end + + end]] + + runOnGears(DrawBlip) + + m2Count = m2Count + 1 + if m2Count == 25 then + m2Count = 0 + + if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then + runOnGears(TrackRadarBlip) + end + + end + +end + + +function CheckCrateConditions() + + crateSpawn = true + + if requireSurfer == true then + if hasSurfed == false then + crateSpawn = false + end + end + + if #wTouched > 0 then + if allWallsHit == false then + crateSpawn = false + end + end + + if crateSpawn == true then + if allowCrate == true then + --if (crateG == nil) and (allowCrate == true) then + --AddCaption("") + SpawnAmmoCrate(0, 0, weapons[1+GetRandom(#weapons)] ) + rPingTimer = 0 + rAlpha = 0 + PlaySound(sndWarp) + end + end + +end + +function CheckSurfer() + + if GetY(CurrentHedgehog) > highestY then + highestY = GetY(CurrentHedgehog) + end + + if (highestY == (WaterLine-8)) and (hasSurfed == false) then + + surferTimer = surferTimer +1 + if (surferTimer == 40) then + hasSurfed = true + AddCaption(loc("Surfer!"),0xffba00ff,capgrpMessage2) + end + end + +end + + + +function WallHit(id, zXMin,zYMin, zWidth, zHeight) + + if wTouched[id] == false then + tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false) + PlaySound(sndExplosion) + wallsLeft = wallsLeft - 1 + + if wallsLeft == 0 then + AddCaption(loc("All walls touched!")) + allWallsHit = true + if (requireSurfer == true) and (hasSurfed == false) then + AddCaption(loc("Go surf!"),0xffba00ff,capgrpMessage2) + end + else + AddCaption(loc("Walls Left") .. ": " .. wallsLeft) + end + + end + + wTouched[id] = true + tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, false) + --PlaySound(sndVaporize) -- yeah, this is just annoying as shit + +end + +function CheckForWallCollision() + + for i = 1, #wTouched do + if gearIsInBox(CurrentHedgehog, wX[i],wY[i],wWidth[i],wHeight[i]) then + WallHit(i, wX[i],wY[i],wWidth[i],wHeight[i]) + end + end + +end + +function BorderSpark(zXMin,zYMin, zWidth, zHeight, bCol) + + eX = zXMin + GetRandom(zWidth+10) + eY = zYMin + GetRandom(zHeight+10) + + tempE = AddVisualGear(eX, eY, vgtDust, 0, false) + if tempE ~= 0 then + g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE) + SetVisualGearValues(tempE, eX, eY, g3, g4, g5, g6, g7, 1, g9, bCol ) + end + +end + + +function HandleBorderEffects() + + effectTimer = effectTimer + 1 + if effectTimer > 15 then --25 + + effectTimer = 1 + + for i = 1, #wTouched do + if wTouched[i] == true then + --bCol = GetClanColor(GetHogClan(CurrentHedgehog)) + else + --bCol = 0xFFFFFFFF + bCol = GetClanColor(GetHogClan(CurrentHedgehog)) + BorderSpark(wX[i],wY[i],wWidth[i],wHeight[i], bCol) + end + --BorderSpark(wX[i],wY[i],wWidth[i],wHeight[i], bCol) + end + + end + +end + +function onLJump() + if roundN < 2 then + roundN = 100 + SetInputMask(0xFFFFFFFF) + TurnTimeLeft = 1 + AddCaption(loc("Configuration accepted."),0xffba00ff,capgrpMessage) + HideMission() + end +end + +function onAttack() + + if roundN < 2 then + + if menuIndex == 1 then + + if #wTouched > 0 then + for i = 1, #wTouched do + wTouched[i] = nil + wX[i] = nil + wY[i] = nil + wWidth[i] = nil + wHeight[i] = nil + end + else + LoadConfig(2) + end + + elseif menuIndex == 2 then + requireSurfer = not(requireSurfer) + elseif menuIndex == 3 then + AFR = not(AFR) + elseif menuIndex == 4 then + allowCrazyWeps = not(allowCrazyWeps) + end + + UpdateMenu() + configureWeapons() + HandleStartingStage() + + elseif (AFR == true) then + + if (GetCurAmmoType() ~= amRope) and + (GetCurAmmoType() ~= amSkip) and + (GetCurAmmoType() ~= amNothing) + then + AddCaption(loc("You may only attack from a rope!"),0xffba00ff,capgrpMessage2) + end + + end + +end + +function onDown() + if roundN < 2 then + menuIndex = menuIndex +1 + if menuIndex > #menu then + menuIndex = 1 + end + HandleStartingStage() + end +end + +function onUp() + if roundN < 2 then + menuIndex = menuIndex -1 + if menuIndex == 0 then + menuIndex = #menu + end + HandleStartingStage() + end +end + +function onGameInit() + + GameFlags = gfRandomOrder + gfBorder + gfSolidLand --+ gfInfAttack + HealthCaseProb = 0 + CaseFreq = 0 + +end + +function configureWeapons() + + -- reset wep array + for i = 1, #weapons do + weapons[i] = nil + end + + -- add rope weps + for i, w in pairs(ropeWeps) do + table.insert(weapons, w) + end + + -- add ground weps + for i, w in pairs(groundWeps) do + table.insert(weapons, w) + end + + -- remove ground weps if attacking from rope is mandatory + if AFR == true then + for i = 1, #weapons do + for w = 1, #groundWeps do + if groundWeps[w] == weapons[i] then + table.remove(weapons, i) + end + end + end + end + + -- remove crazy weps is crazy weps aren't allowed + if allowCrazyWeps == false then + for i = 1, #weapons do + for w = 1, #crazyWeps do + if crazyWeps[w] == weapons[i] then + table.remove(weapons, i) + end + end + end + end + +end + +function onGameStart() + + LoadConfig(1) + configureWeapons() + UpdateMenu() + HandleStartingStage() + +end + +function onNewTurn() + + wallsLeft = #wTouched + + for i = 1, #wTouched do + wTouched[i] = false + end + + allowCrate = true + + surferTimer = 0 + hasSurfed = false + allWallsHit = false + highestY = 0 + + crateG = nil + + -- new config stuff + roundN = roundN + 1 + if roundN < 2 then + TurnTimeLeft = -1 + SetInputMask(band(0xFFFFFFFF, bnot(gmAnimate+gmAttack+gmDown+gmHJump+gmLeft+gmLJump+gmPrecise+gmRight+gmSlot+gmSwitch+gmTimer+gmUp+gmWeapon))) + allowCrate = false + HandleStartingStage() -- new + end + +end + +function UpdateMenu() + + preMenuCfg = loc("Spawn the crate, and attack!") .. "|" + postMenuCfg = loc("Press [Enter] to accept this configuration.") + + menu = { + loc("Walls Required") .. ": " .. #wTouched .. "|", + loc("Surf Before Crate") .. ": " .. BoolToCfgTxt(requireSurfer) .. "|", + loc("Attack From Rope") .. ": " .. BoolToCfgTxt(AFR) .. "|", + loc("Super Weapons") .. ": " .. BoolToCfgTxt(allowCrazyWeps) .. "|" + } +end + +function HandleStartingStage() + + temp = menu[menuIndex] + menu[menuIndex] = "--> " .. menu[menuIndex] + + missionComment = "" + for i = 1, #menu do + missionComment = missionComment .. menu[i] + end + + ShowMission ( + loc("WALL TO WALL") .. " 0.4", + loc("a shoppa minigame"), + preMenuCfg.. + missionComment .. + postMenuCfg .. + --" " .. "|" .. + "", 4, 300000 + ) + + menu[menuIndex] = temp + +end + +function onGameTick() + + if CurrentHedgehog ~= nil then + + --AddCaption(Map) + --AddCaption(RightX ..";" .. GetX(CurrentHedgehog)) + + CheckSurfer() + + gTimer = gTimer + 1 + if gTimer == 25 then + gTimer = 1 + + CheckForWallCollision() + CheckCrateConditions() + + if (crateG == GetFollowGear()) and (crateG ~= nil) then + FollowGear(CurrentHedgehog) + end + + -- if attackfromrope is set, forbid firing unless using rope + if (AFR == true) and (roundN >= 2) then + if (GetCurAmmoType() == amRope) or + (GetCurAmmoType() == amSkip) or + (GetCurAmmoType() == amNothing) + then + SetInputMask(0xFFFFFFFF) + elseif ropeG == nil then + SetInputMask(band(0xFFFFFFFF, bnot(gmAttack))) + end + end + + end + + HandleBorderEffects() + HandleCircles() + + end + +end + +function onGearAdd(gear) + + if GetGearType(gear) == gtRope then + ropeG = gear + elseif GetGearType(gear) == gtCase then + + crateG = gear + trackGear(gear) + + table.insert(rCirc, AddVisualGear(0,0,vgtCircle,0,true) ) + setGearValue(gear,"CIRC",rCirc[#rCirc]) + setGearValue(gear,"RX",0) + setGearValue(gear,"RY",0) + SetVisualGearValues(rCirc[#rCirc], 0, 0, 100, 255, 1, 10, 0, 40, 3, 0xff00ffff) + + allowCrate = false + + rPingTimer = 0 + rAlpha = 0 + + end + +end + +function onGearDelete(gear) + + if gear == ropeG then + ropeG = nil + elseif GetGearType(gear) == gtCase then + + if gear == crateG then + crateG = nil + -- rAlpha = 255 + end + + for i = 1, #rCirc do + if rCirc[i] == getGearValue(gear,"CIRC") then + DeleteVisualGear(rCirc[i]) + table.remove(rCirc, i) + end + end + + trackDeletion(gear) + + end + +end + +function onAmmoStoreInit() + + for i, w in pairs(ropeWeps) do + SetAmmo(w, 0, 0, 0, 1) + end + + for i, w in pairs(groundWeps) do + SetAmmo(w, 0, 0, 0, 1) + end + + for i, w in pairs(crazyWeps) do + SetAmmo(w, 0, 0, 0, 1) + end + + SetAmmo(amRope, 9, 0, 0, 0) + SetAmmo(amSkip, 9, 0, 0, 0) + +end