# HG changeset patch # User Medo # Date 1337678372 -7200 # Node ID c91d33837b0de6670bfdf932b2218737bdd19763 # Parent 846cea23aea22e96ed968879c3de4c023f4d763b# Parent 1982e702ed2fb2fef90b62e2517b407f9ba9381b Merge diff -r 846cea23aea2 -r c91d33837b0d CMakeLists.txt --- a/CMakeLists.txt Thu May 03 22:48:02 2012 +0200 +++ b/CMakeLists.txt Tue May 22 11:19:32 2012 +0200 @@ -120,8 +120,6 @@ set(pascal_compiler_flags_cmn "-Ff~/Library/Frameworks" ${pascal_compiler_flags_cmn}) #set deployment target set(pascal_compiler_flags_cmn "-k-macosx_version_min" "-k${minimum_macosx_version}" "-XR${CMAKE_OSX_SYSROOT}" ${pascal_compiler_flags_cmn}) - #link with liblua.a (which requires readline) - set(pascal_compiler_flags_cmn "-k${CMAKE_BINARY_DIR}/bin/liblua.a" "-k-lreadline" ${pascal_compiler_flags_cmn}) #link with libsdlmain.a (when building an executable) if(NOT BUILD_ENGINE_LIBRARY) set(pascal_compiler_flags_cmn "-k${CMAKE_BINARY_DIR}/bin/libSDLmain.a" ${pascal_compiler_flags_cmn}) @@ -146,7 +144,7 @@ endif() -#set default flags values for all the project +#set default flags values for all projects set(CMAKE_C_FLAGS "-pipe ${CMAKE_C_FLAGS}") set(CMAKE_C_FLAGS_RELEASE "-w -Os -fomit-frame-pointer ${CMAKE_C_FLAGS_RELEASE}") set(CMAKE_C_FLAGS_DEBUG "-Wall -O0 -g -DDEBUG ${CMAKE_C_FLAGS_DEBUG}") @@ -154,7 +152,8 @@ set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE}) set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) -set(pascal_compiler_flags_cmn "-B" "-FE../bin" "-Cs2000000" "-vewn" ${pascal_compiler_flags_cmn}) +separate_arguments(FPFLAGSINT UNIX_COMMAND ${FPFLAGS}) +set(pascal_compiler_flags_cmn ${FPFLAGSINT} "-B" "-FE../bin" "-Cs2000000" "-vewn" ${pascal_compiler_flags_cmn}) set(haskell_compiler_flags_cmn "-O2" ${haskell_compiler_flags_cmn}) if(Optz) @@ -189,7 +188,13 @@ set(HAVE_NETSERVER false) endif(WITH_SERVER) -add_subdirectory(misc/liblua) +find_package(Lua) +if(NOT ${LUA_FOUND}) + message(STATUS "Lua library not found, building bundled dependency") + add_subdirectory(misc/liblua) + #link with liblua.a (which requires readline) + set(pascal_compiler_flags_cmn "-k${CMAKE_BINARY_DIR}/bin/liblua.a" "-k-lreadline" ${pascal_compiler_flags_cmn}) +endif() add_subdirectory(hedgewars) #run cmake -DBUILD_ANDROID_PORT=1 to enable this @@ -197,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 846cea23aea2 -r c91d33837b0d QTfrontend/binds.cpp --- a/QTfrontend/binds.cpp Thu May 03 22:48:02 2012 +0200 +++ b/QTfrontend/binds.cpp Tue May 22 11:19:32 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 846cea23aea2 -r c91d33837b0d QTfrontend/game.cpp --- a/QTfrontend/game.cpp Thu May 03 22:48:02 2012 +0200 +++ b/QTfrontend/game.cpp Tue May 22 11:19:32 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 846cea23aea2 -r c91d33837b0d cmake_modules/FindLua.cmake --- a/cmake_modules/FindLua.cmake Thu May 03 22:48:02 2012 +0200 +++ b/cmake_modules/FindLua.cmake Tue May 22 11:19:32 2012 +0200 @@ -1,25 +1,34 @@ # Find the Lua library -# +# -------------------- +# On Android/Windows/OSX this just defines the name of the library that +# will be compiled from our bundled sources +# On Linux it will try to load the system library and fallback to compiling +# the bundled one when nothing is found + +set(LUA_FOUND false) if (ANDROID) - SET(LUA_DEFAULT "liblua5.1.so") + SET(LUA_DEFAULT "liblua5.1.so") else (ANDROID) - IF(WIN32) - SET(LUA_DEFAULT lua.dll) - ELSE(WIN32) - IF(APPLE) - SET(LUA_DEFAULT lua) - ELSE(APPLE) - #locate the system's lua library - FIND_LIBRARY(LUA_DEFAULT NAMES lua51 lua5.1 lua-5.1 lua PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib) - IF(${LUA_DEFAULT} MATCHES "LUA_DEFAULT-NOTFOUND") - #UNSET(LUA_DEFAULT) - MESSAGE(FATAL_ERROR "Couldn't find Lua 5.1 library!") - ENDIF() - #remove the path (fpc doesn't like it - why?) - GET_FILENAME_COMPONENT(LUA_DEFAULT ${LUA_DEFAULT} NAME) - ENDIF(APPLE) - ENDIF(WIN32) + IF(WIN32) + SET(LUA_DEFAULT lua.dll) + ELSE(WIN32) + IF(APPLE) + SET(LUA_DEFAULT lua) + ELSE(APPLE) + #locate the system's lua library + FIND_LIBRARY(LUA_DEFAULT NAMES lua51 lua5.1 lua-5.1 lua PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib) + IF(${LUA_DEFAULT} MATCHES "LUA_DEFAULT-NOTFOUND") + set(LUA_DEFAULT lua) + set(LUA_FOUND true) + ELSE() + message(STATUS "LibLua 5.1 found at ${LUA_DEFAULT}") + #remove the path (fpc doesn't like it - why?) + GET_FILENAME_COMPONENT(LUA_DEFAULT ${LUA_DEFAULT} NAME) + ENDIF() + ENDIF(APPLE) + ENDIF(WIN32) ENDIF(ANDROID) + SET(LUA_LIBRARY ${LUA_DEFAULT} CACHE STRING "Lua library to link to; file name without path only!") -#UNSET(LUA_DEFAULT) + diff -r 846cea23aea2 -r c91d33837b0d hedgewars/ArgParsers.inc --- a/hedgewars/ArgParsers.inc Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/ArgParsers.inc Tue May 22 11:19:32 2012 +0200 @@ -40,9 +40,10 @@ val(ParamStr(4), cBits); val(ParamStr(5), ipcPort); cFullScreen:= ParamStr(6) = '1'; - isSoundEnabled:= ParamStr(7) = '1'; - isMusicEnabled:= ParamStr(8) = '1'; - val(ParamStr(9), cInitVolume); + SetSound(ParamStr(7) = '1'); + SetMusic(ParamStr(8) = '1'); + val(ParamStr(9), tmp); + SetVolume(tmp); val(ParamStr(10), cTimerInterval); PathPrefix:= ParamStr(11); cShowFPS:= ParamStr(12) = '1'; @@ -101,9 +102,9 @@ procedure setAudio(initialVolume: LongInt; musicEnabled: boolean; soundEnabled: boolean); begin - cInitVolume:= initialVolume; - isMusicEnabled:= musicEnabled; - isSoundEnabled:= soundEnabled + SetVolume(initialVolume); + SetMusic(musicEnabled); + SetSound(soundEnabled); end; procedure setAudioWithParameters(initialVolumeParam: string; musicEnabledParam: string; soundEnabledParam: string); @@ -231,8 +232,8 @@ if ParamStr(paramIndex) = '--stats-only' then begin cOnlyStats:= true; - isSoundEnabled:= false; - isMusicEnabled:= false; + SetSound(false); + SetMusic(false); cReducedQuality:= $FFFFFFFF xor rqLowRes; // HACK paramIndex:= paramIndex + 1 end diff -r 846cea23aea2 -r c91d33837b0d hedgewars/CMakeLists.txt --- a/hedgewars/CMakeLists.txt Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/CMakeLists.txt Tue May 22 11:19:32 2012 +0200 @@ -3,7 +3,6 @@ find_package(SDL_net) find_package(SDL_ttf) find_package(SDL_mixer) -find_package(Lua) include(${CMAKE_MODULE_PATH}/FindSDL_Extras.cmake) @@ -91,7 +90,11 @@ endif (APPLE) endif(BUILD_ENGINE_LIBRARY) -find_program(fpc_executable fpc) +IF(FPC) + set(fpc_executable ${FPC}) +ELSE() + find_program(fpc_executable fpc) +ENDIF() if(fpc_executable) exec_program(${fpc_executable} ARGS "-iV" OUTPUT_VARIABLE fpc_output) @@ -138,7 +141,7 @@ message(FATAL_ERROR "Minimum required version of FreePascal is 2.6.0 on Mac OS X") endif() else() - message(FATAL_ERROR "No Pascal compiler found!") + message(FATAL_ERROR "No FreePascal compiler found!") endif() @@ -184,7 +187,7 @@ COMMAND "${pascal_compiler}" ARGS ${pascal_compiler_flags} -ohwengine.${build_arch} -P${build_arch} MAIN_DEPENDENCY ${hwengine_project} - DEPENDS ${engine_sources} SDLmain lua + DEPENDS ${engine_sources} SDLmain ) add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}") endforeach() @@ -198,10 +201,19 @@ add_custom_target(${engine_output_name} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}") -IF(NOT APPLE) + +#when system Lua is not found we need to compile it before engine +if(NOT ${LUA_FOUND}) + add_dependencies(${engine_output_name} lua) +endif() + +#this command is a workaround to some inlining issues present in older +# FreePascal versions and fixed in 2.6, That version is mandatory on OSX, +# hence the command is not needed there +if(NOT APPLE) add_custom_target(ENGINECLEAN COMMAND ${CMAKE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars") add_dependencies(${engine_output_name} ENGINECLEAN) -ENDIF() +endif() install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir}) diff -r 846cea23aea2 -r c91d33837b0d hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/GSHandlers.inc Tue May 22 11:19:32 2012 +0200 @@ -88,7 +88,7 @@ if (d > 1) and (not gi^.Invulnerable) and (GetRandom(2) = 0) then begin if (CurrentHedgehog^.Gear = gi) then - PlaySound(sndOops, gi^.Hedgehog^.Team^.voicepack) + PlaySoundV(sndOops, gi^.Hedgehog^.Team^.voicepack) else begin @@ -96,9 +96,9 @@ gi^.State := gi^.State or gstLoser; if d > r div 2 then - PlaySound(sndNooo, gi^.Hedgehog^.Team^.voicepack) + PlaySoundV(sndNooo, gi^.Hedgehog^.Team^.voicepack) else - PlaySound(sndUhOh, gi^.Hedgehog^.Team^.voicepack); + PlaySoundV(sndUhOh, gi^.Hedgehog^.Team^.voicepack); end; end; end; @@ -466,7 +466,7 @@ begin Frame:= 2; Tint:= $41B83ED0 - i * $10081000; - Angle:= random * 360; + Angle:= random(360); dx:= 0.0000001; dy:= 0; if random(2) = 0 then @@ -779,7 +779,7 @@ AddVisualGear(gX - 3 + Random(6), cWaterLine, vgtDroplet); AddVisualGear(gX - 3 + Random(6), cWaterLine, vgtDroplet); AddVisualGear(gX - 3 + Random(6), cWaterLine, vgtDroplet); - StopSound(Gear^.SoundChannel); + StopSoundChan(Gear^.SoundChannel); if nuw then begin Gear^.SoundChannel := LoopSound(sndBeeWater); @@ -818,7 +818,7 @@ CheckCollision(Gear); if ((Gear^.State and gstCollision) <> 0) then begin - StopSound(Gear^.SoundChannel); + StopSoundChan(Gear^.SoundChannel); doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound); for i:= 0 to 31 do begin @@ -846,7 +846,7 @@ begin if nuw then begin - StopSound(Gear^.SoundChannel); + StopSoundChan(Gear^.SoundChannel); CheckGearDrowning(Gear); end else @@ -1090,7 +1090,7 @@ begin cLaserSighting := true; HHGear^.Message := 0; - if (HHGear^.Angle - 32 >= 0) then + if (HHGear^.Angle >= 32) then dec(HHGear^.Angle,32) end; @@ -1120,7 +1120,7 @@ inc(HHGear^.Angle) end else - if (HHGear^.Angle - 1 >= 0) then + if (HHGear^.Angle >= 1) then dec(HHGear^.Angle); if (TurnTimeLeft > 0) then @@ -1156,8 +1156,8 @@ end; if Gear^.Timer = 0 then begin - SendIPC('N'); - SendIPC('q'); + SendIPC(_S'N'); + SendIPC(_S'q'); GameState := gsExit end end; @@ -1181,7 +1181,7 @@ or((Gear^.Message and gmDestroy) <> 0) or((HHGear^.State and gstHHDriven) =0) then begin - StopSound(Gear^.SoundChannel); + StopSoundChan(Gear^.SoundChannel); DeleteGear(Gear); AfterAttack; doStepHedgehogMoving(HHGear); // for gfInfAttack @@ -2453,7 +2453,7 @@ Gear^.doStep := @doStepFirePunchWork; DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5); - PlaySound(TSound(ord(sndFirePunch1) + GetRandom(6)), HHGear^.Hedgehog^.Team^.voicepack) + PlaySoundV(TSound(ord(sndFirePunch1) + GetRandom(6)), HHGear^.Hedgehog^.Team^.voicepack) end; //////////////////////////////////////////////////////////////////////////////// @@ -2543,7 +2543,7 @@ // Gear^.Tag, _0, 5000); end; Gear^.dX := Gear^.dX + int2hwFloat(30 * Gear^.Tag); - StopSound(Gear^.SoundChannel, 4000); + StopSoundChan(Gear^.SoundChannel, 4000); end; if (GameTicks and $3F) = 0 then @@ -2552,7 +2552,7 @@ if (hwRound(Gear^.X) > (LAND_WIDTH+2048)) or (hwRound(Gear^.X) < -2048) then begin // avoid to play forever (is this necessary?) - StopSound(Gear^.SoundChannel); + StopSoundChan(Gear^.SoundChannel); DeleteGear(Gear) end; end; @@ -2838,7 +2838,7 @@ if sparkles <> nil then begin sparkles^.Tint:= ((random(210)+45) shl 24) or ((random(210)+45) shl 16) or ((random(210)+45) shl 8) or $FF; - sparkles^.Angle:= random * 360; + sparkles^.Angle:= random(360); end end; @@ -2893,7 +2893,7 @@ with sparkles^ do begin Tint:= ((random(210)+45) shl 24) or ((random(210)+45) shl 16) or ((random(210)+45) shl 8) or $FF; - Angle:= random * 360; + Angle:= random(360); dx:= 0.001 * (random(200)); dy:= 0.001 * (random(200)); if random(2) = 0 then @@ -2921,7 +2921,7 @@ if Gear^.Timer = 0 then begin Gear^.Pos := 1; - PlaySound(sndKamikaze, Gear^.Hedgehog^.Team^.voicepack); + PlaySoundV(sndKamikaze, Gear^.Hedgehog^.Team^.voicepack); Gear^.doStep := @doStepKamikazeWork end end; @@ -3030,7 +3030,7 @@ procedure doStepCakeWork(Gear: PGear); -const dirs: array[0..3] of TPoint = ((x: 0; y: -1), (x: 1; y: 0),(x: 0; y: 1),(x: -1; y: 0)); +const dirs: array[0..3] of TPoint = ((X: 0; Y: -1), (X: 1; Y: 0),(X: 0; Y: 1),(X: -1; Y: 0)); var xx, yy, xxn, yyn: LongInt; dA: LongInt; @@ -3164,7 +3164,7 @@ hogs := GearsNear(Gear^.X, Gear^.Y, gtHedgehog, Gear^.Radius); if Length(hogs) > 0 then begin - for i:= 0 to High(hogs) do + for i:= 0 to Length(hogs) - 1 do begin if hogs[i] <> CurrentHedgehog^.Gear then begin @@ -3213,7 +3213,7 @@ Gear^.Timer := 0; inc(Gear^.Pos); if Gear^.Pos = 5 then - PlaySound(sndYoohoo, Gear^.Hedgehog^.Team^.voicepack) + PlaySoundV(sndYoohoo, Gear^.Hedgehog^.Team^.voicepack) end; if (Gear^.Pos = 14) and (RealTicks and $3 = 0) then @@ -3297,7 +3297,7 @@ AddVisualGear(hwRound(Gear^.X + _20 * Gear^.dX), hwRound(Gear^.Y + _20 * Gear^.dY), vgtDust); if (CheckGearDrowning(Gear)) then begin - StopSound(Gear^.SoundChannel); + StopSoundChan(Gear^.SoundChannel); exit end end; @@ -3314,7 +3314,7 @@ or (not CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y), lfIndestructible)) then begin //out of time or exited ground - StopSound(Gear^.SoundChannel); + StopSoundChan(Gear^.SoundChannel); if (Gear^.State and gsttmpFlag) <> 0 then doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound) else @@ -3325,7 +3325,7 @@ else if (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0) and (not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))) then begin - StopSound(Gear^.SoundChannel); + StopSoundChan(Gear^.SoundChannel); Gear^.Tag := 1; Gear^.doStep := @doStepDrill end; @@ -3529,7 +3529,7 @@ if ((Gear^.State and gstCollision) <> 0) or CheckGearDrowning(Gear) then begin - StopSound(Gear^.SoundChannel); + StopSoundChan(Gear^.SoundChannel); StopSound(sndRideOfTheValkyries); ResumeMusic; @@ -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 @@ -4559,7 +4561,7 @@ doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 80 + r0, Gear^.Hedgehog, EXPLAutoSound); for r0:= 0 to 4 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtNote); - Gear^.dY := odY * -1 + cGravity * 2; + Gear^.dY := cGravity * 2 - odY; Gear^.Pos := Gear^.Pos + 1; end else @@ -5054,7 +5056,7 @@ if Length(graves) = 0 then begin - StopSound(Gear^.SoundChannel); + StopSoundChan(Gear^.SoundChannel); Gear^.Timer := 250; Gear^.doStep := @doStepIdle; exit; @@ -5079,7 +5081,7 @@ else begin // now really resurrect the hogs with the hp saved in the graves - for i:= 0 to High(graves) do + for i:= 0 to Length(graves) - 1 do if graves[i]^.Health > 0 then begin resgear := AddGear(hwRound(graves[i]^.X), hwRound(graves[i]^.Y), gtHedgehog, gstWait, _0, _0, 0); @@ -5099,7 +5101,7 @@ hh^.Gear^.dY := _0; hh^.Gear^.dX := _0; doStepHedgehogMoving(hh^.Gear); - StopSound(Gear^.SoundChannel); + StopSoundChan(Gear^.SoundChannel); Gear^.Timer := 250; Gear^.doStep := @doStepIdle; end @@ -5116,7 +5118,7 @@ if Length(graves) > 0 then begin - for i:= 0 to High(graves) do + for i:= 0 to Length(graves) - 1 do begin PHedgehog(graves[i]^.Hedgehog)^.Gear := nil; graves[i]^.Health := 0; @@ -5125,7 +5127,7 @@ end else begin - StopSound(Gear^.SoundChannel); + StopSoundChan(Gear^.SoundChannel); Gear^.Timer := 250; Gear^.doStep := @doStepIdle; end @@ -5282,7 +5284,7 @@ HH:= Gear^.Hedgehog; if Gear^.Pos = 2 then begin - StopSound(Gear^.SoundChannel); + StopSoundChan(Gear^.SoundChannel); if (Gear^.Timer = 0) then begin if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible = 0) then @@ -5326,7 +5328,7 @@ Gear^.Pos:= 2; if (Gear^.Pos = 3) and (Gear^.Power = 0) then begin - StopSound(Gear^.SoundChannel); + StopSoundChan(Gear^.SoundChannel); if HH^.GearHidden = nil then begin DeleteGear(Gear); @@ -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 846cea23aea2 -r c91d33837b0d hedgewars/LuaPas.pas --- a/hedgewars/LuaPas.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/LuaPas.pas Tue May 22 11:19:32 2012 +0200 @@ -10,12 +10,13 @@ *) interface - +uses uConsts; {.$DEFINE LUA_GETHOOK} -{$INCLUDE "config.inc"} type +{$IFNDEF PAS2C} size_t = Cardinal; +{$ENDIF} Psize_t = ^size_t; PPointer = ^Pointer; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/PascalExports.pas --- a/hedgewars/PascalExports.pas Thu May 03 22:48:02 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,272 +0,0 @@ -(* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2004-2012 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - *) - -{$INCLUDE "options.inc"} - -unit PascalExports; -(* - * If the engine is compiled as library this unit will export functions - * as C declarations for convenient library usage in your application and - * language of choice. - * - * See also: C declarations on wikipedia - * http://en.wikipedia.org/wiki/X86_calling_conventions#cdecl - *) -interface -uses uTypes, uConsts, uVariables, GLunit, uInputHandler, uSound, uAmmos, uUtils, uCommands; - -{$INCLUDE "config.inc"} -procedure HW_versionInfo(netProto: PLongInt; versionStr: PPChar); cdecl; export; - -function HW_getNumberOfWeapons:LongInt; cdecl; export; - -function HW_getMaxNumberOfTeams:LongInt; cdecl; export; - -function HW_getMaxNumberOfHogs:LongInt; cdecl; export; - -procedure HW_terminate(closeFrontend: Boolean); cdecl; export; - -implementation -{$IFDEF HWLIBRARY} -var cZoomVal: GLfloat; - -// retrieve protocol information -procedure HW_versionInfo(netProto: PLongInt; versionStr: PPChar); cdecl; export; -begin - netProto^:= cNetProtoVersion; - versionStr^:= cVersionString; -end; - -procedure HW_zoomSet(value: GLfloat); cdecl; export; -begin - cZoomVal:= value; - ZoomValue:= value; -end; - -procedure HW_zoomReset; cdecl; export; -begin - ZoomValue:= cZoomVal; - // center the camera at current hog - if CurrentHedgehog <> nil then - followGear:= CurrentHedgehog^.Gear; -end; - -function HW_zoomFactor: GLfloat; cdecl; export; -begin - HW_zoomFactor:= ZoomValue / cDefaultZoomLevel; -end; - -function HW_zoomLevel: LongInt; cdecl; export; -begin - HW_zoomLevel:= trunc((ZoomValue - cDefaultZoomLevel) / cZoomDelta); -end; - -procedure HW_screenshot; cdecl; export; -begin - flagMakeCapture:= true; -end; - -function HW_isPaused: boolean; cdecl; export; -begin - HW_isPaused:= isPaused; -end; - -// equivalent to esc+y; when closeFrontend = true the game exits after memory cleanup -procedure HW_terminate(closeFrontend: boolean); cdecl; export; -begin - alsoShutdownFrontend:= closeFrontend; - ParseCommand('forcequit', true); -end; - -function HW_getSDLWindow: pointer; cdecl; export; -begin - HW_getSDLWindow:={$IFDEF SDL13}SDLwindow{$ELSE}nil{$ENDIF}; -end; - -// cursor handling -procedure HW_setCursor(x,y: LongInt); cdecl; export; -begin - CursorPoint.X:= x; - CursorPoint.Y:= y; -end; - -procedure HW_getCursor(x,y: PLongInt); cdecl; export; -begin - x^:= CursorPoint.X; - y^:= CursorPoint.Y; -end; - -// ammo menu related functions -function HW_isAmmoMenuOpen: boolean; cdecl; export; -begin - HW_isAmmoMenuOpen:= bShowAmmoMenu; -end; - -function HW_isAmmoMenuNotAllowed: boolean; cdecl; export; -begin; - HW_isAmmoMenuNotAllowed:= ( (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or - ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) ); -end; - -function HW_isWeaponRequiringClick: boolean; cdecl; export; -begin - HW_isWeaponRequiringClick:= false; - if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.BotLevel = 0) then - HW_isWeaponRequiringClick:= (CurrentHedgehog^.Gear^.State and gstHHChooseTarget) <> 0; -end; - -function HW_isWeaponTimerable: boolean; cdecl; export; -begin - HW_isWeaponTimerable:= false; - if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0) then - HW_isWeaponTimerable:= (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_Timerable) <> 0; -end; - -function HW_isWeaponSwitch: boolean cdecl; export; -begin - HW_isWeaponSwitch:= false; - if (CurAmmoGear <> nil) and (CurrentHedgehog^.BotLevel = 0) then - HW_isWeaponSwitch:= (CurAmmoGear^.AmmoType = amSwitch); -end; - -function HW_isWeaponRope: boolean cdecl; export; -begin - HW_isWeaponRope:= false; - if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0) then - HW_isWeaponRope:= (CurrentHedgehog^.CurAmmoType = amRope); -end; - -procedure HW_setGrenadeTime(time: LongInt); cdecl; export; -begin - ParseCommand('/timer ' + inttostr(time), true); -end; - -function HW_getGrenadeTime: LongInt; cdecl; export; -var CurWeapon: PAmmo; -begin - HW_getGrenadeTime:= 3; - if HW_isWeaponTimerable then - begin - CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^); - HW_getGrenadeTime:= CurWeapon^.Timer div 1000; - end; -end; - -procedure HW_setPianoSound(snd: LongInt); cdecl; export; -begin - // this most likely won't work in network game - if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Ammo <> nil) and (CurrentHedgehog^.BotLevel = 0) - and (CurrentHedgehog^.CurAmmoType = amPiano) then - case snd of - 0: PlaySound(sndPiano0); - 1: PlaySound(sndPiano1); - 2: PlaySound(sndPiano2); - 3: PlaySound(sndPiano3); - 4: PlaySound(sndPiano4); - 5: PlaySound(sndPiano5); - 6: PlaySound(sndPiano6); - 7: PlaySound(sndPiano7); - else PlaySound(sndPiano8); - end; -end; - -function HW_getWeaponNameByIndex(whichone: LongInt): PChar; cdecl; export; -begin - HW_getWeaponNameByIndex:= (str2pchar(trammo[Ammoz[TAmmoType(whichone+1)].NameId])); -end; - -function HW_getWeaponCaptionByIndex(whichone: LongInt): PChar; cdecl; export; -begin - HW_getWeaponCaptionByIndex:= (str2pchar(trammoc[Ammoz[TAmmoType(whichone+1)].NameId])); -end; - -function HW_getWeaponDescriptionByIndex(whichone: LongInt): PChar; cdecl; export; -begin - HW_getWeaponDescriptionByIndex:= (str2pchar(trammod[Ammoz[TAmmoType(whichone+1)].NameId])); -end; - -function HW_getNumberOfWeapons: LongInt; cdecl; export; -begin - HW_getNumberOfWeapons:= ord(high(TAmmoType)); -end; - -procedure HW_setWeapon(whichone: LongInt); cdecl; export; -begin - if (CurrentTeam = nil) then exit; - if (not CurrentTeam^.ExtDriven) and (CurrentTeam^.Hedgehogs[0].BotLevel = 0) then - SetWeapon(TAmmoType(whichone+1)); -end; - -function HW_isWeaponAnEffect(whichone: LongInt): boolean; cdecl; export; -begin - HW_isWeaponAnEffect:= Ammoz[TAmmoType(whichone+1)].Ammo.Propz and ammoprop_Effect <> 0; -end; - -function HW_getAmmoCounts(counts: PLongInt): LongInt; cdecl; export; -var a : PHHAmmo; - slot, index, res: LongInt; -begin - HW_getAmmoCounts:= -1; - // nil check - if (CurrentHedgehog = nil) or (CurrentHedgehog^.Ammo = nil) or (CurrentTeam = nil) then - exit; - // hog controlled by opponent (net or ai) - if (CurrentTeam^.ExtDriven) or (CurrentTeam^.Hedgehogs[0].BotLevel <> 0) then - exit; - - a:= CurrentHedgehog^.Ammo; - for slot:= 0 to cMaxSlotIndex do - for index:= 0 to cMaxSlotAmmoIndex do - if a^[slot,index].Count <> 0 then // yes, ammomenu is hell - counts[ord(a^[slot,index].AmmoType)-1]:= a^[slot,index].Count; - HW_getAmmoCounts:= 0; -end; - -procedure HW_getAmmoDelays (skipTurns: PByte); cdecl; export; -var a : TAmmoType; -begin - for a:= Low(TAmmoType) to High(TAmmoType) do - skipTurns[ord(a)-1]:= byte(Ammoz[a].SkipTurns); -end; - -function HW_getTurnsForCurrentTeam: LongInt; cdecl; export; -begin - HW_getTurnsForCurrentTeam:= 0; - if (CurrentTeam <> nil) and (CurrentTeam^.Clan <> nil) then - HW_getTurnsForCurrentTeam:= CurrentTeam^.Clan^.TurnNumber; -end; - -function HW_getMaxNumberOfHogs: LongInt; cdecl; export; -begin - HW_getMaxNumberOfHogs:= cMaxHHIndex + 1; -end; - -function HW_getMaxNumberOfTeams: LongInt; cdecl; export; -begin - HW_getMaxNumberOfTeams:= cMaxTeams; -end; - -procedure HW_memoryWarningCallback; cdecl; export; -begin - ReleaseSound(false); -end; - -{$ENDIF} - -end. - diff -r 846cea23aea2 -r c91d33837b0d hedgewars/SDLh.pas --- a/hedgewars/SDLh.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/SDLh.pas Tue May 22 11:19:32 2012 +0200 @@ -395,6 +395,7 @@ end; + PSDL_Color = ^TSDL_Color; TSDL_Color = record case Byte of 0: ( r: Byte; @@ -403,7 +404,6 @@ unused: Byte; ); 1: ( value: LongWord; ); end; - PSDL_Color = ^TSDL_Color; PSDL_RWops = ^TSDL_RWops; @@ -734,10 +734,10 @@ TSDL_EventFilter = function( event : PSDL_Event ): Integer; cdecl; + TByteArray = array[0..65535] of Byte; PByteArray = ^TByteArray; - TByteArray = array[0..65535] of Byte; + TLongWordArray = array[0..16383] of LongWord; PLongWordArray = ^TLongWordArray; - TLongWordArray = array[0..16383] of LongWord; PSDL_Thread = Pointer; PSDL_mutex = Pointer; @@ -969,7 +969,7 @@ {$ENDIF} {* Compatibility between SDL-1.2 and SDL-1.3 *} -procedure SDL_WarpMouse(x, y: Word); {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF} +procedure SDL_WarpMouse(x, y: Word); {$IFDEF SDL13}inline{$ELSE}cdecl; external SDLLibName{$ENDIF}; function SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName {$IFDEF SDL13} name 'SDL_GetKeyboardState'{$ENDIF}; function SDL_AllocFormat(format: LongWord): PSDL_PixelFormat; {$IFDEF SDL13}cdecl; external SDLLibName;{$ENDIF} procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); {$IFDEF SDL13}cdecl; external SDLLibName;{$ENDIF} @@ -1055,12 +1055,12 @@ implementation {$IFDEF SDL13} -uses strings, uVariables; +uses strings, uVariables, uStore; // compatible functions -procedure SDL_WarpMouse(x, y: Word); +procedure SDL_WarpMouse(x, y: Word); inline; begin - SDL_WarpMouseInWindow(SDLwindow, x, y); + WarpMouse(x, y); end; function SDL_VideoDriverName(namebuf: PChar; maxlen: LongInt): PChar; @@ -1077,6 +1077,7 @@ function SDL_EnableUNICODE(enable: LongInt): LongInt; begin + enable:= enable; // avoid hint SDL_StartTextInput(); SDL_EnableUNICODE:= 0; end; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/SysUtils.h diff -r 846cea23aea2 -r c91d33837b0d hedgewars/Types.h diff -r 846cea23aea2 -r c91d33837b0d hedgewars/hwLibrary.pas --- a/hedgewars/hwLibrary.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/hwLibrary.pas Tue May 22 11:19:32 2012 +0200 @@ -16,17 +16,72 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA *) -Library hwLibrary; {$INCLUDE "options.inc"} -// Add all your Pascal units to the 'uses' clause below to add them to the program. -// Mark all Pascal procedures/functions that you wish to call from C/C++/Objective-C code using -// 'cdecl; export;' (see the fpclogo.pas unit for an example), and then add C-declarations for -// these procedures/functions to the PascalImports.h file (also in the 'Pascal Sources' group) -// to make these functions available in the C/C++/Objective-C source files -// (add '#include PascalImports.h' near the top of these files if it is not there yet) -uses PascalExports, hwengine{$IFDEF ANDROID}, jni{$ENDIF}; -exports Game, HW_versionInfo; +(* + * When engine is compiled as library this unit will export functions + * as C declarations for convenient library usage in your application + * and language of choice. + * + * See also: C declarations on Wikipedia + * http://en.wikipedia.org/wiki/X86_calling_conventions#cdecl + *) + +Library hwLibrary; + +uses hwengine, uTypes, uConsts, uVariables, uSound, uCommands, uUtils, + uLocale{$IFDEF ANDROID}, jni{$ENDIF}; + +{$INCLUDE "config.inc"} + +// retrieve protocol information +procedure HW_versionInfo(netProto: PLongInt; versionStr: PPChar); cdecl; export; +begin + netProto^:= cNetProtoVersion; + versionStr^:= cVersionString; +end; + +// equivalent to esc+y; when closeFrontend = true the game exits after memory cleanup +procedure HW_terminate(closeFrontend: boolean); cdecl; export; +begin + closeFrontend:= closeFrontend; // avoid hint + ParseCommand('forcequit', true); +end; + +function HW_getWeaponNameByIndex(whichone: LongInt): PChar; cdecl; export; +begin + HW_getWeaponNameByIndex:= (str2pchar(trammo[Ammoz[TAmmoType(whichone+1)].NameId])); +end; + +(*function HW_getWeaponCaptionByIndex(whichone: LongInt): PChar; cdecl; export; +begin + HW_getWeaponCaptionByIndex:= (str2pchar(trammoc[Ammoz[TAmmoType(whichone+1)].NameId])); +end; + +function HW_getWeaponDescriptionByIndex(whichone: LongInt): PChar; cdecl; export; +begin + HW_getWeaponDescriptionByIndex:= (str2pchar(trammod[Ammoz[TAmmoType(whichone+1)].NameId])); +end;*) + +function HW_getNumberOfWeapons: LongInt; cdecl; export; +begin + HW_getNumberOfWeapons:= ord(high(TAmmoType)); +end; + +function HW_getMaxNumberOfHogs: LongInt; cdecl; export; +begin + HW_getMaxNumberOfHogs:= cMaxHHIndex + 1; +end; + +function HW_getMaxNumberOfTeams: LongInt; cdecl; export; +begin + HW_getMaxNumberOfTeams:= cMaxTeams; +end; + +procedure HW_memoryWarningCallback; cdecl; export; +begin + ReleaseSound(false); +end; {$IFDEF ANDROID} function JNI_HW_versionInfoNet(env: PJNIEnv; obj: JObject):JInt;cdecl; @@ -51,10 +106,21 @@ 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, + GenLandPreview, + LoadLocaleWrapper, + HW_versionInfo, + HW_terminate, + HW_getNumberOfWeapons, + HW_getMaxNumberOfHogs, + HW_getMaxNumberOfTeams, + HW_getWeaponNameByIndex, + HW_memoryWarningCallback; {$ENDIF} begin - end. - diff -r 846cea23aea2 -r c91d33837b0d hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/hwengine.pas Tue May 22 11:19:32 2012 +0200 @@ -31,7 +31,7 @@ uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uInputHandler, uSound, uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uRandom, uLandTexture, uCollisions, - sysutils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers, uLandPainted + SysUtils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers, uLandPainted {$IFDEF SDL13}, uTouch{$ENDIF}{$IFDEF ANDROID}, GLUnit{$ENDIF}; {$IFDEF HWLIBRARY} @@ -42,15 +42,15 @@ implementation {$ELSE} -procedure OnDestroy; forward; procedure initEverything(complete:boolean); forward; procedure freeEverything(complete:boolean); forward; {$ENDIF} //////////////////////////////// -procedure DoTimer(Lag: LongInt); +function DoTimer(Lag: LongInt): boolean; var s: shortstring; begin + DoTimer:= false; inc(RealTicks, Lag); case GameState of @@ -71,12 +71,8 @@ StoreLoad(false); InitWorld; ResetKbd; - SoundLoad; if GameType = gmtSave then - begin - isSEBackup:= isSoundEnabled; - isSoundEnabled:= false - end; + SetSound(false); FinishProgress; PlayMusic; SetScale(zoom); @@ -86,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; @@ -98,17 +93,13 @@ end; gsExit: begin - isTerminated:= true; + DoTimer:= true; end; gsSuspend: - exit; + exit(false); end; -{$IFDEF SDL13} - SDL_GL_SwapWindow(SDLwindow); -{$ELSE} - SDL_GL_SwapBuffers(); -{$ENDIF} + SwapBuffers; if flagMakeCapture then begin @@ -127,35 +118,18 @@ end; end; -//////////////////// -procedure OnDestroy; -begin - WriteLnToConsole('Freeing resources...'); - FreeActionsList(); - StoreRelease(false); - ControllerClose(); - CloseIPC(); - TTF_Quit(); -{$IFDEF SDL13} - SDL_GL_DeleteContext(SDLGLcontext); - SDL_DestroyWindow(SDLwindow); - SDLGLcontext:= nil; - SDLwindow:= nil; -{$ENDIF} - SDL_Quit(); - isTerminated:= false; -end; - /////////////////// procedure MainLoop; var event: TSDL_Event; PrevTime, CurrTime: Longword; + isTerminated: boolean; {$IFDEF SDL13} previousGameState: TGameState; {$ELSE} prevFocusState: boolean; {$ENDIF} begin + isTerminated:= false; PrevTime:= SDL_GetTicks; while isTerminated = false do begin @@ -166,40 +140,40 @@ case event.type_ of {$IFDEF SDL13} SDL_KEYDOWN: - if GameState = gsChat then + if GameState = gsChat then // sdl on iphone supports only ashii keyboards and the unicode field is deprecated in sdl 1.3 - KeyPressChat(SDL_GetKeyFromScancode(event.key.keysym.sym))//TODO correct for keymodifiers - else - ProcessKey(event.key); + KeyPressChat(SDL_GetKeyFromScancode(event.key.keysym.sym))//TODO correct for keymodifiers + else + ProcessKey(event.key); SDL_KEYUP: - if GameState <> gsChat then - ProcessKey(event.key); + if GameState <> gsChat then + ProcessKey(event.key); SDL_WINDOWEVENT: if event.window.event = SDL_WINDOWEVENT_SHOWN then - begin + begin cHasFocus:= true; onFocusStateChanged() - end + end else if event.window.event = SDL_WINDOWEVENT_MINIMIZED then - begin + begin previousGameState:= GameState; GameState:= gsSuspend; - end + end else if event.window.event = SDL_WINDOWEVENT_RESTORED then - begin + begin GameState:= previousGameState; {$IFDEF ANDROID} //This call is used to reinitialize the glcontext and reload the textures ParseCommand('fullscr '+intToStr(LongInt(cFullScreen)), true); {$ENDIF} - end + end else if event.window.event = SDL_WINDOWEVENT_RESIZED then - begin + begin cNewScreenWidth:= max(2 * (event.window.data1 div 2), cMinScreenWidth); cNewScreenHeight:= max(2 * (event.window.data2 div 2), cMinScreenHeight); cScreenResizeDelay:= RealTicks + 500{$IFDEF IPHONEOS}div 2{$ENDIF}; - end; + end; SDL_FINGERMOTION: onTouchMotion(event.tfinger.x, event.tfinger.y,event.tfinger.dx, event.tfinger.dy, event.tfinger.fingerId); @@ -216,25 +190,26 @@ else ProcessKey(event.key); SDL_KEYUP: - if GameState <> gsChat then - ProcessKey(event.key); + if GameState <> gsChat then + ProcessKey(event.key); SDL_MOUSEBUTTONDOWN: - ProcessMouse(event.button, true); + ProcessMouse(event.button, true); + SDL_MOUSEBUTTONUP: ProcessMouse(event.button, false); SDL_ACTIVEEVENT: if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then - begin + begin prevFocusState:= cHasFocus; cHasFocus:= event.active.gain = 1; if prevFocusState xor cHasFocus then onFocusStateChanged() - end; + end; SDL_VIDEORESIZE: - begin + begin // using lower values than cMinScreenWidth or cMinScreenHeight causes widget overlap and off-screen widget parts // Change by sheepluva: // Let's only use even numbers for custom width/height since I ran into scaling issues with odd width values. @@ -242,7 +217,7 @@ cNewScreenWidth:= max(2 * (event.resize.w div 2), cMinScreenWidth); cNewScreenHeight:= max(2 * (event.resize.h div 2), cMinScreenHeight); cScreenResizeDelay:= RealTicks+500; - end; + end; {$ENDIF} SDL_JOYAXISMOTION: ControllerAxisEvent(event.jaxis.which, event.jaxis.axis, event.jaxis.value); @@ -254,41 +229,37 @@ ControllerButtonEvent(event.jbutton.which, event.jbutton.button, false); SDL_QUITEV: isTerminated:= true - end; //end case event.type_ of - end; //end while SDL_PollEvent(@event) <> 0 do - - if (cScreenResizeDelay <> 0) and (cScreenResizeDelay < RealTicks) and - ((cNewScreenWidth <> cScreenWidth) or (cNewScreenHeight <> cScreenHeight)) then - begin - cScreenResizeDelay:= 0; - cScreenWidth:= cNewScreenWidth; - cScreenHeight:= cNewScreenHeight; + end; //end case event.type_ of + end; //end while SDL_PollEvent(@event) <> 0 do - ParseCommand('fullscr '+intToStr(LongInt(cFullScreen)), true); - WriteLnToConsole('window resize: ' + IntToStr(cScreenWidth) + ' x ' + IntToStr(cScreenHeight)); - ScriptOnScreenResize(); - InitCameraBorders(); - InitTouchInterface(); - end; + if (cScreenResizeDelay <> 0) and (cScreenResizeDelay < RealTicks) and + ((cNewScreenWidth <> cScreenWidth) or (cNewScreenHeight <> cScreenHeight)) then + begin + cScreenResizeDelay:= 0; + cScreenWidth:= cNewScreenWidth; + cScreenHeight:= cNewScreenHeight; - if isTerminated = false then - begin - CurrTime:= SDL_GetTicks; + ParseCommand('fullscr '+intToStr(LongInt(cFullScreen)), true); + WriteLnToConsole('window resize: ' + IntToStr(cScreenWidth) + ' x ' + IntToStr(cScreenHeight)); + ScriptOnScreenResize(); + InitCameraBorders(); + InitTouchInterface(); + end; + + CurrTime:= SDL_GetTicks(); if PrevTime + longword(cTimerInterval) <= CurrTime then begin - DoTimer(CurrTime - PrevTime); + isTerminated:= DoTimer(CurrTime - PrevTime); PrevTime:= CurrTime end else SDL_Delay(1); IPCCheckSock(); - end; end; end; /////////////// procedure Game{$IFDEF HWLIBRARY}(gameArgs: PPChar); cdecl; export{$ENDIF}; -var - p: TPathType; +var p: TPathType; s: shortstring; i: LongInt; begin @@ -310,8 +281,8 @@ cLocale := Copy(cLocaleFName,1,2); UserNick:= gameArgs[5]; - isSoundEnabled:= gameArgs[6] = '1'; - isMusicEnabled:= gameArgs[7] = '1'; + SetSound(gameArgs[6] = '1'); + SetMusic(gameArgs[7] = '1'); cAltDamage:= gameArgs[8] = '1'; PathPrefix:= gameArgs[9]; UserPathPrefix:= '../Documents'; @@ -382,61 +353,45 @@ if recordFileName = '' then begin InitIPC; - SendIPCAndWaitReply('C'); // ask for game config + SendIPCAndWaitReply(_S'C'); // ask for game config end else LoadRecordFromFile(recordFileName); ScriptOnGameInit; - s:= 'eproto ' + inttostr(cNetProtoVersion); SendIPCRaw(@s[0], Length(s) + 1); // send proto version InitTeams(); AssignStores(); - - if isSoundEnabled then - InitSound(); + InitSound(); isDeveloperMode:= false; - TryDo(InitStepsFlags = cifAllInited, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true); - ParseCommand('rotmask', true); - MainLoop(); - // clean up SDL and GL context - OnDestroy(); - // clean up all the other memory allocated + + // clean up all the memory allocated freeEverything(true); - if alsoShutdownFrontend then - halt; end; procedure initEverything (complete:boolean); begin Randomize(); - if complete then - cLogfileBase:= 'game' - else - cLogfileBase:= 'preview'; - - // uConsts does not need initialization as they are all consts - uUtils.initModule; + uUtils.initModule(complete); // this opens the debug file, must be the first uMisc.initModule; uVariables.initModule; - uConsole.initModule; // MUST happen after uMisc + uConsole.initModule; uCommands.initModule; uCommandHandlers.initModule; uLand.initModule; uLandPainted.initModule; - uIO.initModule; if complete then - begin + begin {$IFDEF ANDROID}GLUnit.init;{$ENDIF} {$IFDEF SDL13}uTouch.initModule;{$ENDIF} uAI.initModule; @@ -464,18 +419,21 @@ uVisualGears.initModule; uWorld.initModule; uCaptions.initModule; - end; + end; end; procedure freeEverything (complete:boolean); begin if complete then - begin + begin + WriteLnToConsole('Freeing resources...'); + uAI.freeModule; + uAIMisc.freeModule; //stub uCaptions.freeModule; uWorld.freeModule; uVisualGears.freeModule; uTeams.freeModule; - uStore.freeModule; //stub + uInputHandler.freeModule; uStats.freeModule; //stub uSound.freeModule; uScript.freeModule; @@ -485,20 +443,18 @@ uLandTexture.freeModule; //uLandObjects does not need to be freed //uLandGraphics does not need to be freed - uInputHandler.freeModule; //stub uGears.freeModule; //uGame does not need to be freed //uFloat does not need to be freed uCollisions.freeModule; //stub uChat.freeModule; uAmmos.freeModule; - uAIMisc.freeModule; //stub //uAIAmmoTests does not need to be freed //uAIActions does not need to be freed - uAI.freeModule; //stub - end; + uStore.freeModule; + end; - uIO.freeModule; //stub + uIO.freeModule; uLand.freeModule; uLandPainted.freeModule; @@ -512,8 +468,7 @@ ///////////////////////// procedure GenLandPreview{$IFDEF HWLIBRARY}(port: LongInt); cdecl; export{$ENDIF}; -var - Preview: TPreview; +var Preview: TPreview; begin initEverything(false); {$IFDEF HWLIBRARY} @@ -525,12 +480,11 @@ IPCWaitPongEvent; TryDo(InitStepsFlags = cifRandomize, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true); - Preview:= GenPreview(); + GenPreview(Preview); WriteLnToConsole('Sending preview...'); SendIPCRaw(@Preview, sizeof(Preview)); SendIPCRaw(@MaxHedgehogs, sizeof(byte)); WriteLnToConsole('Preview sent, disconnect'); - CloseIPC(); freeEverything(false); end; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/options.inc --- a/hedgewars/options.inc Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/options.inc Tue May 22 11:19:32 2012 +0200 @@ -48,6 +48,7 @@ {$DEFINE GLunit:=gles11} {$DEFINE MOBILE} {$DEFINE USE_LANDSCAPE_AMMOMENU} + {$DEFINE USE_TOUCH_INTERFACE} {$ENDIF} {$IFDEF WIN32} @@ -68,4 +69,12 @@ {$DEFINE USE_AM_NUMCOLUMN} {$ENDIF} -//also available LUA_DISABLED +{$DEFINE USE_LUA_SCRIPT} + +{$IFDEF PAS2C} + {$DEFINE NOCONSOLE} + {$DEFINE USE_SDLTHREADS} +{$ENDIF} + +{$DEFINE _S:=} +{$DEFINE _P:=} diff -r 846cea23aea2 -r c91d33837b0d hedgewars/pas2c.h --- a/hedgewars/pas2c.h Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/pas2c.h Tue May 22 11:19:32 2012 +0200 @@ -2,6 +2,7 @@ #include #include +#include typedef union string255_ { @@ -26,6 +27,8 @@ char s[16]; } string15; +typedef string255 shortstring; + typedef uint8_t Byte; typedef int8_t ShortInt; typedef uint16_t Word; @@ -34,18 +37,24 @@ typedef int32_t LongInt; typedef uint64_t QWord; typedef int64_t Int64; +typedef LongWord Cardinal; typedef LongInt Integer; typedef float extended; typedef float real; +typedef float single; typedef bool boolean; +typedef int LongBool; typedef void * pointer; typedef Byte * PByte; typedef char * PChar; typedef LongInt * PLongInt; +typedef LongWord * PLongWord; typedef Integer * PInteger; +typedef int PtrInt; +typedef wchar_t widechar; #ifdef __GNUG__ #define NULL __null @@ -60,10 +69,12 @@ #define new(a) __new((void **)&a, sizeof(*(a))) void __new(void ** p, int size); - #define dispose(a) __dispose(a, sizeof(*(a))) void __dispose(pointer p, int size); +void * GetMem(int size); +void FreeMem(void * p, int size); + #define FillChar(a, b, c) __FillChar(&(a), b, c) void __FillChar(pointer p, int size, char fill); @@ -71,23 +82,68 @@ string255 _strappend(string255 s, char c); string255 _strprepend(char c, string255 s); bool _strcompare(string255 a, string255 b); +bool _strcomparec(string255 a, char b); +bool _strncompare(string255 a, string255 b); char * _pchar(string255 s); int Length(string255 a); string255 copy(string255 a, int s, int l); string255 delete(string255 a, int s, int l); +string255 trim(string255 a); #define STRINIT(a) {.len = sizeof(a) - 1, .str = a} + +int length_ar(void * a); + typedef int file; +typedef int TextFile; extern int FileMode; extern int IOResult; +extern int stderr; #define assign(a, b) assign_(&(a), b) void assign_(int * f, string255 fileName); -void reset(int f, int size); +void reset_1(int f, int size); +void reset_2(int f, int size); #define BlockRead(a, b, c, d) BlockRead_(a, &(b), c, &(d)) void BlockRead_(int f, void * p, int size, int * sizeRead); +#define BlockWrite(a, b, c) BlockWrite_(a, &(b), c) +void BlockWrite_(int f, void * p, int size); void close(int f); +void write(string255 s); + +bool DirectoryExists(string255 dir); +bool FileExists(string255 filename); + bool odd(int i); + + +typedef int TThreadId; +void ThreadSwitch(); +#define InterlockedIncrement(a) __InterlockedIncrement(&(a)) +#define InterlockedDecrement(a) __InterlockedDecrement(&(a)) +void __InterlockedIncrement(int * a); +void __InterlockedDecrement(int * a); + +bool Assigned(void * a); + +void randomize(); +int random(int max); +int abs(int i); +double sqr(double n); +double sqrt(double n); +int trunc(double n); +int round(double n); + +string255 ParamStr(int n); +int ParamCount(); + +#define val(a, b) _val(a, (LongInt*)&(b)) +void _val(string255 str, LongInt * a); + +extern double pi; + +string255 EnumToStr(int a); +string255 ExtractFileName(string255 f); diff -r 846cea23aea2 -r c91d33837b0d hedgewars/pas2cSystem.pas --- a/hedgewars/pas2cSystem.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/pas2cSystem.pas Tue May 22 11:19:32 2012 +0200 @@ -13,8 +13,8 @@ QWord = integer; GLint = integer; GLuint = integer; - gl_unsigned_byte = integer; - Int = integer; + int = integer; + size_t = integer; pointer = pointer; @@ -24,7 +24,6 @@ real = float; extended = float; GLfloat = float; - gl_float = float; boolean = boolean; LongBool = boolean; @@ -63,12 +62,13 @@ new, dispose, FillChar, Move : procedure; trunc, round : function : integer; - Abs, Sqr : function : integer; + abs, sqr : function : integer; StrPas, FormatDateTime, copy, delete, str, pos, trim, LowerCase : function : shortstring; Length, StrToInt : function : integer; SetLength, val : procedure; _pchar : function : PChar; + memcpy : procedure; assign, rewrite, reset, flush, BlockWrite, BlockRead, close : procedure; IOResult : integer; @@ -82,7 +82,8 @@ ParamCount : function : integer; ParamStr : function : string; - sqrt, arctan2, pi, cos, sin, power : function : float; + sqrt, arctan2, cos, sin, power : function : float; + pi : float; TypeInfo, GetEnumName : function : shortstring; @@ -92,37 +93,36 @@ GetMem : function : pointer; FreeMem : procedure; - - gl_texture_2d, glbindtexture, gltexparameterf, gl_rgba, - glteximage2d, glvertexpointer, gltexcoordpointer, - gl_triangle_fan, gldrawarrays, glpushmatrix, glpopmatrix, - gltranslatef, glscalef, glrotatef, gldisable, glenable, - gl_line_smooth, gllinewidth, gl_lines, gl_line_loop, - glcolor4ub, gl_texture_wrap_s, gltexparameteri, - gl_texture_wrap_t, gl_texture_min_filter, - gl_linear, gl_texture_mag_filter, glgentextures, - gldeletetextures, glreadpixels, glclearcolor, - gl_line_strip, gldeleterenderbuffersext, - gldeleteframebuffersext, glext_loadextension, - gl_max_texture_size, glgetintegerv, gl_renderer, - glgetstring, gl_vendor, gl_version, glgenframebuffersext, - glbindframebufferext, glgenrenderbuffersext, - glbindrenderbufferext, glrenderbufferstorageext, - glframebufferrenderbufferext, glframebuffertexture2dext, - gl_framebuffer_ext, gl_depth_component, - gl_depth_attachment_ext, gl_renderbuffer_ext, gl_rgba8, - gl_color_attachment0_ext, gl_modelview, gl_blend, - gl_src_alpha, gl_one_minus_src_alpha, - gl_perspective_correction_hint, gl_fastest, - gl_dither, gl_vertex_array, gl_texture_coord_array, - glviewport, glloadidentity, glmatrixmode, glhint, - glblendfunc, glenableclientstate, gl_color_buffer_bit, - glclear, gldisableclientstate, gl_color_array, - glcolorpointer, gl_depth_buffer_bit, gl_quads, - glbegin, glend, gltexcoord2f, glvertex2d, - gl_true, gl_false, glcolormask, gl_projection, - gl_texture_priority, glenum, gl_clamp_to_edge, - gl_extensions, gl_bgra : procedure; + + glGetString : function : pchar; + + glBegin, glBindTexture, glBlendFunc, glClear, glClearColor, + glColor4ub, glColorMask, glColorPointer, glDeleteTextures, + glDisable, glDisableClientState, glDrawArrays, glEnable, + glEnableClientState, glEnd, glGenTextures, glGetIntegerv, + glHint, glLineWidth, glLoadIdentity, glMatrixMode, glPopMatrix, + glPushMatrix, glReadPixels, glRotatef, glScalef, glTexCoord2f, + glTexCoordPointer, glTexImage2D, glTexParameterf, + glTexParameteri, glTranslatef, glVertex2d, glVertexPointer, + glViewport, glext_LoadExtension, glDeleteRenderbuffersEXT, + glDeleteFramebuffersEXT, glGenFramebuffersEXT, + glGenRenderbuffersEXT, glBindFramebufferEXT, + glBindRenderbufferEXT, glRenderbufferStorageEXT, + glFramebufferRenderbufferEXT, glFramebufferTexture2DEXT : procedure; + + GL_BGRA, GL_BLEND, GL_CLAMP_TO_EDGE, GL_COLOR_ARRAY, + GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_DEPTH_COMPONENT, + GL_DITHER, GL_EXTENSIONS, GL_FALSE, GL_FASTEST, GL_LINEAR, + GL_LINE_LOOP, GL_LINES, GL_LINE_SMOOTH, GL_LINE_STRIP, + GL_MAX_TEXTURE_SIZE, GL_MODELVIEW, GL_ONE_MINUS_SRC_ALPHA, + GL_PERSPECTIVE_CORRECTION_HINT, GL_PROJECTION, GL_QUADS, + GL_RENDERER, GL_RGBA, GL_RGBA8, GL_SRC_ALPHA, GL_TEXTURE_2D, + GL_TEXTURE_COORD_ARRAY, GL_TEXTURE_MAG_FILTER, + GL_TEXTURE_MIN_FILTER, GL_TEXTURE_PRIORITY, GL_TEXTURE_WRAP_S, + GL_TEXTURE_WRAP_T, GL_TRIANGLE_FAN, GL_TRUE, GL_VENDOR, + GL_VERSION, GL_VERTEX_ARRAY, GLenum, GL_FRAMEBUFFER_EXT, + GL_RENDERBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, + GL_COLOR_ATTACHMENT0_EXT, GL_FLOAT, GL_UNSIGNED_BYTE : integer; TThreadId : function : integer; BeginThread, ThreadSwitch : procedure; @@ -134,7 +134,7 @@ Assigned : function : boolean; _strconcat, _strappend, _strprepend : function : string; - _strcompare, _strncompare : function : boolean; + _strcompare, _strncompare, _strcomparec : function : boolean; png_structp, png_set_write_fn, png_get_io_ptr, png_get_libpng_ver, png_create_write_struct, @@ -143,3 +143,4 @@ png_write_end : procedure; EnumToStr : function : string; + diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uAI.pas --- a/hedgewars/uAI.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uAI.pas Tue May 22 11:19:32 2012 +0200 @@ -42,26 +42,27 @@ ThinkThread: TThreadID; {$ENDIF} hasThread: LongInt; + StartTicks: Longword; procedure FreeActionsList; begin -AddFileLog('FreeActionsList called'); -if hasThread <> 0 then + AddFileLog('FreeActionsList called'); + if hasThread <> 0 then begin - AddFileLog('Waiting AI thread to finish'); - StopThinking:= true; - repeat - SDL_Delay(10) - until hasThread = 0 + AddFileLog('Waiting AI thread to finish'); + StopThinking:= true; + repeat + SDL_Delay(10) + until hasThread = 0 end; -with CurrentHedgehog^ do - if Gear <> nil then - if BotLevel <> 0 then - StopMessages(Gear^.Message); + with CurrentHedgehog^ do + if Gear <> nil then + if BotLevel <> 0 then + StopMessages(Gear^.Message); -BestActions.Count:= 0; -BestActions.Pos:= 0 + BestActions.Count:= 0; + BestActions.Pos:= 0 end; @@ -114,6 +115,7 @@ a, aa: TAmmoType; begin BotLevel:= Me^.Hedgehog^.BotLevel; +windSpeed:= hwFloat2Float(cWindSpeed); for i:= 0 to Pred(Targets.Count) do if (Targets.ar[i].Score >= 0) and (not StopThinking) then @@ -445,7 +447,7 @@ procedure freeModule; begin - + FreeActionsList(); end; end. diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uAIActions.pas --- a/hedgewars/uAIActions.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uAIActions.pas Tue May 22 11:19:32 2012 +0200 @@ -67,6 +67,9 @@ implementation uses uAIMisc, uAI, uAmmos, uVariables, uCommands, uUtils, uDebug, uIO{$IFDEF TRACEAIACTIONS}, uConsole{$ENDIF}; +var PrevX: LongInt = 0; + timedelta: Longword = 0; + const ActionIdToStr: array[0..7] of string[16] = ( {aia_none} '', {aia_Left} 'left', diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uAIAmmoTests.pas Tue May 22 11:19:32 2012 +0200 @@ -23,6 +23,8 @@ uses SDLh, uConsts, uFloat, uTypes; const amtest_OnTurn = $00000001; +var windSpeed: real; + type TAttackParams = record Time: Longword; Angle, Power: LongInt; @@ -106,7 +108,7 @@ (proc: @TestHammer; flags: 0), // amHammer (proc: nil; flags: 0), // amResurrector (proc: nil; flags: 0), // amDrillStrike - (proc: @TestSnowball; flags: 0), // amSnowball + (proc: nil; flags: 0), // amSnowball (proc: nil; flags: 0), // amTardis (proc: nil; flags: 0), // amStructure (proc: nil; flags: 0), // amLandGun @@ -140,7 +142,7 @@ valueResult:= BadTurn; repeat rTime:= rTime + 300 + Level * 50 + random(300); - Vx:= - cWindSpeedf * rTime * 0.5 + (Targ.X + AIrndSign(2) - mX) / rTime; + Vx:= - windSpeed * rTime * 0.5 + (Targ.X + AIrndSign(2) - mX) / rTime; Vy:= cGravityf * rTime * 0.5 - (Targ.Y - mY) / rTime; r:= sqr(Vx) + sqr(Vy); if not (r > 1) then @@ -153,7 +155,7 @@ repeat x:= x + dX; y:= y + dY; - dX:= dX + cWindSpeedf; + dX:= dX + windSpeed; dY:= dY + cGravityf; dec(t) until TestCollExcludingMe(Me, trunc(x), trunc(y), 5) or (t <= 0); @@ -198,7 +200,7 @@ valueResult:= BadTurn; repeat rTime:= rTime + 300 + Level * 50 + random(1000); - Vx:= - cWindSpeedf * rTime * 0.5 + ((Targ.X + AIrndSign(2)) - meX) / rTime; + Vx:= - windSpeed * rTime * 0.5 + ((Targ.X + AIrndSign(2)) - meX) / rTime; Vy:= cGravityf * rTime * 0.5 - (Targ.Y - meY) / rTime; r:= sqr(Vx) + sqr(Vy); if not (r > 1) then @@ -211,7 +213,7 @@ repeat x:= x + dX; y:= y + dY; - dX:= dX + cWindSpeedf; + dX:= dX + windSpeed; dY:= dY + cGravityf; dec(t) until TestCollExcludingMe(Me, trunc(x), trunc(y), 5) or (t <= 0); @@ -479,18 +481,18 @@ TestTime: Longword; x, y, dY, meX, meY: real; begin -TestMortar:= BadTurn; -ap.ExplR:= 0; -meX:= hwFloat2Float(Me^.X); -meY:= hwFloat2Float(Me^.Y); + TestMortar:= BadTurn; + ap.ExplR:= 0; + meX:= hwFloat2Float(Me^.X); + meY:= hwFloat2Float(Me^.Y); -if (Level > 2) then - exit; + if (Level > 2) then + exit(BadTurn); -TestTime:= Solve(Targ.X, Targ.Y, trunc(meX), trunc(meY)); + TestTime:= Solve(Targ.X, Targ.Y, trunc(meX), trunc(meY)); -if TestTime = 0 then - exit; + if TestTime = 0 then + exit(BadTurn); Vx:= (Targ.X - meX) / TestTime; Vy:= cGravityf * (TestTime div 2) - (Targ.Y - meY) / TestTime; @@ -548,7 +550,8 @@ y:= hwFloat2Float(Me^.Y); range:= Metric(trunc(x), trunc(y), Targ.X, Targ.Y); if ( range < MIN_RANGE ) or ( range > MAX_RANGE ) then - exit; + exit(BadTurn); + Vx:= (Targ.X - x) * 1 / 1024; Vy:= (Targ.Y - y) * 1 / 1024; ap.Angle:= DxDy2AttackAnglef(Vx, -Vy); @@ -568,8 +571,7 @@ else dec(valueResult, Level * 4000); // 27/20 is reuse bonus - TestShotgun:= valueResult * 27 div 20; - exit + exit(valueResult * 27 div 20) end until (Abs(Targ.X - trunc(x)) + Abs(Targ.Y - trunc(y)) < 4) or (x < 0) @@ -593,10 +595,10 @@ x:= hwFloat2Float(Me^.X); y:= hwFloat2Float(Me^.Y); if Abs(trunc(x) - Targ.X) + Abs(trunc(y) - Targ.Y) < 40 then -begin + begin TestDesertEagle:= BadTurn; - exit; -end; + exit(BadTurn); + end; t:= 0.5 / sqrt(sqr(Targ.X - x)+sqr(Targ.Y-y)); Vx:= (Targ.X - x) * t; Vy:= (Targ.Y - y) * t; @@ -638,7 +640,7 @@ x:= hwFloat2Float(Me^.X); y:= hwFloat2Float(Me^.Y); if (Level > 2) or (Abs(trunc(x) - Targ.X) + Abs(trunc(y) - Targ.Y) > 25) then - exit; + exit(BadTurn); ap.Time:= 0; ap.Power:= 1; @@ -676,8 +678,7 @@ val1:= Succ(BadTurn) else val1:= BadTurn; - TestFirePunch:= val1; - exit; + exit(val1); end; (* For some silly reason, having this enabled w/ the AI @@ -725,8 +726,7 @@ valueResult:= Succ(BadTurn) else valueResult:= BadTurn; - TestWhip:= valueResult; - exit; + exit(valueResult); end; valueResult:= 0; @@ -770,10 +770,7 @@ ap.ExplR:= 0; ap.Time:= 0; if (Level > 3) then -begin - TestAirAttack:= BadTurn; - exit; -end; + exit(BadTurn); ap.AttackPutX:= Targ.X; ap.AttackPutY:= Targ.Y; @@ -837,7 +834,7 @@ maxTop: longword; begin TestTeleport := BadTurn; - exit; + exit(BadTurn); Level:= Level; // avoid compiler hint //FillBonuses(true, [gtCase]); if bonuses.Count = 0 then diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uAIMisc.pas Tue May 22 11:19:32 2012 +0200 @@ -216,14 +216,13 @@ function TestCollExcludingMe(Me: PGear; x, y, r: LongInt): boolean; inline; var MeX, MeY: LongInt; begin - TestCollExcludingMe:= false; if ((x and LAND_WIDTH_MASK) = 0) and ((y and LAND_HEIGHT_MASK) = 0) then begin MeX:= hwRound(Me^.X); MeY:= hwRound(Me^.Y); // We are still inside the hog. Skip radius test if ((((x-MeX)*(x-MeX)) + ((y-MeY)*(y-MeY))) < 256) and ((Land[y, x] and $FF00) = 0) then - exit; + exit(false); end; TestCollExcludingMe:= TestColl(x, y, r) end; @@ -231,23 +230,21 @@ function TestColl(x, y, r: LongInt): boolean; inline; var b: boolean; begin - TestColl:= true; - b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x-r] <> 0); if b then - exit; + exit(true); b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x-r] <> 0); if b then - exit; + exit(true); b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x+r] <> 0); if b then - exit; + exit(true); b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x+r] <> 0); if b then - exit; + exit(true); TestColl:= false; end; @@ -255,23 +252,21 @@ function TestCollWithLand(x, y, r: LongInt): boolean; inline; var b: boolean; begin - TestCollWithLand:= true; - b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x-r] > 255); if b then - exit; + exit(true); b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x-r] > 255); if b then - exit; + exit(true); b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x+r] > 255); if b then - exit; + exit(true); b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x+r] > 255); if b then - exit; + exit(true); TestCollWithLand:= false; end; @@ -298,20 +293,12 @@ begin dmg := 1 + trunc((abs(dY) - 0.4) * 70); if dmg >= 1 then - begin - TraceFall:= dmg; - exit - end; + exit(dmg); end; - TraceFall:= 0; - exit + exit(0) end; if (y > cWaterLine) or (x > 4096) or (x < 0) then - begin - // returning -1 for drowning so it can be considered in the Rate routine - TraceFall:= -1; - exit; - end; + exit(-1); end; end; @@ -330,20 +317,13 @@ begin dmg := 1 + trunc((abs(dY) - 0.4) * 70); if dmg >= 1 then - begin - TraceShoveFall:= dmg; - exit - end; + exit(dmg); end; - TraceShoveFall:= 0; - exit + exit(0) end; if (y > cWaterLine) or (x > 4096) or (x < 0) then - begin // returning -1 for drowning so it can be considered in the Rate routine - TraceShoveFall:= -1; - exit; - end; + exit(-1) end; end; @@ -535,7 +515,7 @@ bX:= hwRound(Gear^.X); bY:= hwRound(Gear^.Y); case JumpType of - jmpNone: exit; + jmpNone: exit(false); jmpHJump: if TestCollisionYwithGear(Gear, -1) = 0 then @@ -545,7 +525,7 @@ Gear^.State:= Gear^.State or gstMoving or gstHHJumping; end else - exit; + exit(false); jmpLJump: begin @@ -563,13 +543,13 @@ Gear^.State:= Gear^.State or gstMoving or gstHHJumping end else - exit + exit(false) end end; repeat if not (hwRound(Gear^.Y) + cHHRadius < cWaterLine) then - exit; + exit(false); if (Gear^.State and gstMoving) <> 0 then begin if (GoInfo.Ticks = 350) then @@ -583,32 +563,32 @@ inc(GoInfo.Ticks); Gear^.dY:= Gear^.dY + cGravity; if Gear^.dY > _0_4 then - exit; + exit(false); if (Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, -1) <> 0) then Gear^.dY:= _0; Gear^.Y:= Gear^.Y + Gear^.dY; if (not Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, 1) <> 0) then - begin + begin Gear^.State:= Gear^.State and not (gstMoving or gstHHJumping); Gear^.dY:= _0; case JumpType of jmpHJump: if bY - hwRound(Gear^.Y) > 5 then - begin - HHJump:= true; + begin GoInfo.JumpType:= jmpHJump; - inc(GoInfo.Ticks, 300 + 300) // 300 before jump, 300 after - end; + inc(GoInfo.Ticks, 300 + 300); // 300 before jump, 300 after + exit(true) + end; jmpLJump: if abs(bX - hwRound(Gear^.X)) > 30 then - begin - HHJump:= true; + begin GoInfo.JumpType:= jmpLJump; - inc(GoInfo.Ticks, 300 + 300) // 300 before jump, 300 after - end + inc(GoInfo.Ticks, 300 + 300); // 300 before jump, 300 after + exit(true) + end + end; + exit(false) end; - exit - end; end; until false end; @@ -626,7 +606,7 @@ pX:= hwRound(Gear^.X); pY:= hwRound(Gear^.Y); if pY + cHHRadius >= cWaterLine then - exit; + exit(false); if (Gear^.State and gstMoving) <> 0 then begin inc(GoInfo.Ticks); @@ -635,7 +615,7 @@ begin Goinfo.FallPix:= 0; HHJump(AltGear, jmpLJump, GoInfo); // try ljump instead of fall with damage - exit + exit(false) end; Gear^.Y:= Gear^.Y + Gear^.dY; if hwRound(Gear^.Y) > pY then @@ -647,7 +627,7 @@ Gear^.dY:= _0; HHJump(AltGear, jmpLJump, GoInfo); // try ljump instead of fall HHGo:= true; - exit + exit(false) end; continue end; @@ -657,7 +637,7 @@ if (Gear^.Message and gmRight )<>0 then Gear^.dX:= cLittle else - exit; + exit(false); if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then begin if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX)) @@ -728,10 +708,7 @@ end end; if (pX <> hwRound(Gear^.X)) and ((Gear^.State and gstMoving) = 0) then -begin - HHGo:= true; - exit; -end; + exit(true) until (pX = hwRound(Gear^.X)) and (pY = hwRound(Gear^.Y)) and ((Gear^.State and gstMoving) = 0); HHJump(AltGear, jmpHJump, GoInfo); end; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uAmmos.pas --- a/hedgewars/uAmmos.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uAmmos.pas Tue May 22 11:19:32 2012 +0200 @@ -288,11 +288,9 @@ with Hedgehog.Ammo^[Slot, ami] do if (AmmoType = Ammo) then if Hedgehog.Team^.Clan^.TurnNumber > Ammoz[AmmoType].SkipTurns then - begin - HHHasAmmo:= Count; - exit; - end - else exit; + exit(Count) + else + exit(0); inc(ami) end; end; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uCommandHandlers.pas --- a/hedgewars/uCommandHandlers.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uCommandHandlers.pas Tue May 22 11:19:32 2012 +0200 @@ -28,6 +28,8 @@ implementation uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uRandom, uCaptions; +var prevGState: TGameState = gsConfirm; + procedure chGenCmd(var s: shortstring); begin case s[1] of @@ -69,7 +71,7 @@ s:= s; // avoid compiler hint if GameState = gsConfirm then begin - SendIPC('Q'); + SendIPC(_S'Q'); GameState:= gsExit end else @@ -79,21 +81,19 @@ procedure chHalt (var s: shortstring); begin s:= s; // avoid compiler hint - SendIPC('H'); + SendIPC(_S'H'); GameState:= gsExit end; procedure chCheckProto(var s: shortstring); -var i, c: LongInt; +var i: LongInt; begin if isDeveloperMode then begin - val(s, i, c); - if (c <> 0) or (i = 0) then - exit; + val(s, i); TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old (got '+intToStr(i)+', expecting '+intToStr(cNetProtoVersion)+')', true); TryDo(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new (got '+intToStr(i)+', expecting '+intToStr(cNetProtoVersion)+')', true); - end + end end; procedure chTeamLocal(var s: shortstring); @@ -218,7 +218,7 @@ if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then - SendIPC('L'); + SendIPC(_S'L'); bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmLeft and InputMask); @@ -231,7 +231,7 @@ if CheckNoTeamOrHH then exit; if not CurrentTeam^.ExtDriven then - SendIPC('l'); + SendIPC(_S'l'); with CurrentHedgehog^.Gear^ do Message:= Message and (not (gmLeft and InputMask)); ScriptCall('onLeftUp'); @@ -243,7 +243,7 @@ if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then - SendIPC('R'); + SendIPC(_S'R'); bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmRight and InputMask); @@ -256,7 +256,7 @@ if CheckNoTeamOrHH then exit; if not CurrentTeam^.ExtDriven then - SendIPC('r'); + SendIPC(_S'r'); with CurrentHedgehog^.Gear^ do Message:= Message and (not (gmRight and InputMask)); ScriptCall('onRightUp'); @@ -268,7 +268,7 @@ if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then - SendIPC('U'); + SendIPC(_S'U'); bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmUp and InputMask); @@ -281,7 +281,7 @@ if CheckNoTeamOrHH then exit; if not CurrentTeam^.ExtDriven then - SendIPC('u'); + SendIPC(_S'u'); with CurrentHedgehog^.Gear^ do Message:= Message and (not (gmUp and InputMask)); ScriptCall('onUpUp'); @@ -293,7 +293,7 @@ if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then - SendIPC('D'); + SendIPC(_S'D'); bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmDown and InputMask); @@ -306,7 +306,7 @@ if CheckNoTeamOrHH then exit; if not CurrentTeam^.ExtDriven then - SendIPC('d'); + SendIPC(_S'd'); with CurrentHedgehog^.Gear^ do Message:= Message and (not (gmDown and InputMask)); ScriptCall('onDownUp'); @@ -318,7 +318,7 @@ if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then - SendIPC('Z'); + SendIPC(_S'Z'); bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmPrecise and InputMask); @@ -331,7 +331,7 @@ if CheckNoTeamOrHH then exit; if not CurrentTeam^.ExtDriven then - SendIPC('z'); + SendIPC(_S'z'); with CurrentHedgehog^.Gear^ do Message:= Message and (not (gmPrecise and InputMask)); ScriptCall('onPreciseUp'); @@ -343,7 +343,7 @@ if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then - SendIPC('j'); + SendIPC(_S'j'); bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmLJump and InputMask); @@ -356,7 +356,7 @@ if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then - SendIPC('J'); + SendIPC(_S'J'); bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmHJump and InputMask); @@ -376,7 +376,7 @@ begin FollowGear:= CurrentHedgehog^.Gear; if not CurrentTeam^.ExtDriven then - SendIPC('A'); + SendIPC(_S'A'); Message:= Message or (gmAttack and InputMask); ScriptCall('onAttack'); end @@ -392,7 +392,7 @@ begin if not CurrentTeam^.ExtDriven and ((Message and gmAttack) <> 0) then - SendIPC('a'); + SendIPC(_S'a'); Message:= Message and (not (gmAttack and InputMask)); ScriptCall('onAttackUp'); end @@ -404,7 +404,7 @@ if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then - SendIPC('S'); + SendIPC(_S'S'); bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmSwitch and InputMask); @@ -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('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; @@ -439,6 +457,7 @@ procedure chSlot(var s: shortstring); var slot: LongWord; + ss: shortstring; begin if (s[0] <> #1) or CheckNoTeamOrHH then exit; @@ -446,7 +465,11 @@ if slot > cMaxSlotIndex then exit; if not CurrentTeam^.ExtDriven then - SendIPC(char(byte(s[1]) + 79)); + begin + ss[0]:= #1; + ss[1]:= char(byte(s[1]) + 79); + SendIPC(ss); + end; bShowFinger:= false; with CurrentHedgehog^.Gear^ do begin diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uFloat.pas --- a/hedgewars/uFloat.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uFloat.pas Tue May 22 11:19:32 2012 +0200 @@ -63,6 +63,9 @@ // The implemented operators operator = (const z1, z2: hwFloat) z : boolean; inline; +{$IFDEF PAS2C} +operator <> (const z1, z2: hwFloat) z : boolean; inline; +{$ENDIF} operator + (const z1, z2: hwFloat) z : hwFloat; inline; operator - (const z1, z2: hwFloat) z : hwFloat; inline; operator - (const z1: hwFloat) z : hwFloat; inline; @@ -212,6 +215,12 @@ z:= (z1.isNegative = z2.isNegative) and (z1.QWordValue = z2.QWordValue); end; +{$IFDEF PAS2C} +operator <> (const z1, z2: hwFloat) z : boolean; inline; +begin + z:= (z1.isNegative <> z2.isNegative) or (z1.QWordValue <> z2.QWordValue); +end; +{$ENDIF} operator + (const z1, z2: hwFloat) z : hwFloat; begin diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uGame.pas --- a/hedgewars/uGame.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uGame.pas Tue May 22 11:19:32 2012 +0200 @@ -79,7 +79,7 @@ RestoreTeamsFromSave; SetBinds(CurrentTeam^.Binds); //CurrentHedgehog^.Gear^.Message:= 0; <- produces bugs with further save restoring and demos - isSoundEnabled:= isSEBackup; + ResetSound; // restore previous sound state PlayMusic; GameType:= gmtLocal; AddVisualGear(0, 0, vgtTeamHealthSorter); diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uGears.pas --- a/hedgewars/uGears.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uGears.pas Tue May 22 11:19:32 2012 +0200 @@ -61,6 +61,7 @@ uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture, uGearsHedgehog, uGearsUtils, uGearsList; +var skipFlag: boolean; procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward; //procedure AmmoFlameWork(Ammo: PGear); forward; @@ -76,6 +77,7 @@ stAfterDelay, stChWin, stWater, stChWin2, stHealth, stSpawn, stNTurn); upd: Longword; + //SDMusic: shortstring; // For better maintainability the step handlers of gears are stored in // separate files. @@ -191,7 +193,7 @@ StepSoundChannel:= LoopSound(sndSteps) else if (StepSoundTimer = 0) and (StepSoundChannel > -1) then begin - StopSound(StepSoundChannel); + StopSoundChan(StepSoundChannel); StepSoundChannel:= -1 end; @@ -313,8 +315,7 @@ AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState); playSound(sndSuddenDeath); StopMusic //No SDMusic for now - //MusicFN:= SDMusic; - //ChangeMusic + //ChangeMusic(SDMusic) end else if (TotalRounds < cSuddenDTurns) and (not isInMultiShoot) then begin @@ -421,7 +422,7 @@ and (not PlacingHogs) and (CurrentHedgehog^.Gear <> nil) and ((CurrentHedgehog^.Gear^.State and gstAttacked) = 0) then - PlaySound(sndHurry, CurrentTeam^.voicepack); + PlaySoundV(sndHurry, CurrentTeam^.voicepack); if ReadyTimeLeft > 0 then begin if (ReadyTimeLeft = 2000) and (LastVoice.snd = sndNone) then @@ -445,7 +446,7 @@ begin if (not CurrentTeam^.ExtDriven) then begin - SendIPC('#'); + SendIPC(_S'#'); AddFileLog('hiTicks increment message sent') end; @@ -1160,7 +1161,7 @@ begin s:= s; // avoid compiler hint if not CurrentTeam^.ExtDriven then - SendIPC(','); + SendIPC(_S','); uStats.Skipped; skipFlag:= true end; @@ -1326,6 +1327,8 @@ delay2:= 0; step:= stDelay; upd:= 0; + + //SDMusic:= 'hell.ogg'; end; procedure freeModule; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uGearsHedgehog.pas --- a/hedgewars/uGearsHedgehog.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uGearsHedgehog.pas Tue May 22 11:19:32 2012 +0200 @@ -35,6 +35,8 @@ uGearsList, uGears, uCollisions, uRandom, uStore, uTeams, uGearsUtils; +var GHStepTicks: LongWord = 0; + // Shouldn't more of this ammo switching stuff be moved to uAmmos ? function ChangeAmmo(HHGear: PGear): boolean; var slot, i: Longword; @@ -138,23 +140,23 @@ color:= Gear^.Hedgehog^.Team^.Clan^.Color; case Gear^.MsgParam of 1: begin - AddCaption(format(trmsg[sidBounce], trmsg[sidBounce1]), color, capgrpAmmostate); + AddCaption(FormatA(trmsg[sidBounce], trmsg[sidBounce1]), color, capgrpAmmostate); CurWeapon^.Bounciness:= 350; end; 2: begin - AddCaption(format(trmsg[sidBounce], trmsg[sidBounce2]), color, capgrpAmmostate); + AddCaption(FormatA(trmsg[sidBounce], trmsg[sidBounce2]), color, capgrpAmmostate); CurWeapon^.Bounciness:= 700; end; 3: begin - AddCaption(format(trmsg[sidBounce], trmsg[sidBounce3]), color, capgrpAmmostate); + AddCaption(FormatA(trmsg[sidBounce], trmsg[sidBounce3]), color, capgrpAmmostate); CurWeapon^.Bounciness:= 1000; end; 4: begin - AddCaption(format(trmsg[sidBounce], trmsg[sidBounce4]), color, capgrpAmmostate); + AddCaption(FormatA(trmsg[sidBounce], trmsg[sidBounce4]), color, capgrpAmmostate); CurWeapon^.Bounciness:= 2000; end; 5: begin - AddCaption(format(trmsg[sidBounce], trmsg[sidBounce5]), color, capgrpAmmostate); + AddCaption(FormatA(trmsg[sidBounce], trmsg[sidBounce5]), color, capgrpAmmostate); CurWeapon^.Bounciness:= 4000; end end @@ -306,7 +308,7 @@ end; amRCPlane: begin newGear:= AddGear(hwRound(lx), hwRound(ly), gtRCPlane, 0, xx * cMaxPower / cPowerDivisor / 4, yy * cMaxPower / cPowerDivisor / 4, 0); - newGear^.SoundChannel:= LoopSound(sndRCPlane, nil) + newGear^.SoundChannel:= LoopSound(sndRCPlane) end; amKamikaze: newGear:= AddGear(hwRound(lx), hwRound(ly), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0); amCake: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 3, hwRound(ly), gtCake, 0, xx, _0, 0); @@ -336,7 +338,7 @@ end; amLaserSight: cLaserSighting:= true; amVampiric: begin - PlaySound(sndOw1, Team^.voicepack); + PlaySoundV(sndOw1, Team^.voicepack); cVampiric:= true; end; amPiano: begin @@ -438,7 +440,7 @@ begin if not CurrentTeam^.ExtDriven and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) <> 0) then - SendIPC('a'); + SendIPC(_S'a'); AfterAttack; end end @@ -524,7 +526,7 @@ Gear^.Z:= cCurrHHZ; RemoveGearFromList(Gear); InsertGearToList(Gear); - PlaySound(sndByeBye, Gear^.Hedgehog^.Team^.voicepack); + PlaySoundV(sndByeBye, Gear^.Hedgehog^.Team^.voicepack); Gear^.Pos:= 0; Gear^.Timer:= timertime end @@ -556,7 +558,7 @@ Gear^.Z:= cCurrHHZ; RemoveGearFromList(Gear); InsertGearToList(Gear); - PlaySound(sndByeBye, Gear^.Hedgehog^.Team^.voicepack); + PlaySoundV(sndByeBye, Gear^.Hedgehog^.Team^.voicepack); PlaySound(sndWarp); Gear^.Pos:= 0; Gear^.Timer:= timertime @@ -654,7 +656,7 @@ Pos:= (Pos + 1) mod Ammoz[AmmoType].PosCount else exit; - StepTicks:= 200; + GHStepTicks:= 200; exit end; @@ -684,7 +686,7 @@ if not cArtillery then Gear^.dX:= SignAs(_0_15, Gear^.dX); Gear^.State:= Gear^.State or gstMoving or gstHHJumping; - PlaySound(sndJump1, Gear^.Hedgehog^.Team^.voicepack); + PlaySoundV(sndJump1, Gear^.Hedgehog^.Team^.voicepack); exit end; end; @@ -697,7 +699,7 @@ Gear^.dY:= -_0_2; SetLittle(Gear^.dX); Gear^.State:= Gear^.State or gstMoving or gstHHJumping; - PlaySound(sndJump3, Gear^.Hedgehog^.Team^.voicepack); + PlaySoundV(sndJump3, Gear^.Hedgehog^.Team^.voicepack); exit end; @@ -712,7 +714,7 @@ StepSoundTimer:= cHHStepTicks; end; - StepTicks:= cHHStepTicks; + GHStepTicks:= cHHStepTicks; if PrevdX <> hwSign(Gear^.dX) then begin FollowGear:= Gear; @@ -1025,7 +1027,7 @@ begin HHGear^.Message:= 0; if (HHGear^.Pos = Wavez[TWave(HHGear^.Tag)].VoiceDelay) and (HHGear^.Timer = 0) then - PlaySound(Wavez[TWave(HHGear^.Tag)].Voice, Hedgehog^.Team^.voicepack); + PlaySoundV(Wavez[TWave(HHGear^.Tag)].Voice, Hedgehog^.Team^.voicepack); inc(HHGear^.Timer); if HHGear^.Timer = Wavez[TWave(HHGear^.Tag)].Interval then begin @@ -1038,7 +1040,7 @@ end; if ((HHGear^.State and gstMoving) <> 0) -or (StepTicks = cHHStepTicks) +or (GHStepTicks = cHHStepTicks) or (CurAmmoGear <> nil) then // we are moving begin with Hedgehog^ do @@ -1101,7 +1103,7 @@ HHGear^.dY:= -_0_25; if not cArtillery then HHGear^.dX:= -SignAs(_0_02, HHGear^.dX); - PlaySound(sndJump2, Hedgehog^.Team^.voicepack) + PlaySoundV(sndJump2, Hedgehog^.Team^.voicepack) end; HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump)); @@ -1116,18 +1118,18 @@ begin AddGearCI(HHGear); if wasJumping then - StepTicks:= 410 + GHStepTicks:= 410 else - StepTicks:= 95 + GHStepTicks:= 95 end; exit end; if not isInMultiShoot and (Hedgehog^.Gear <> nil) then begin - if StepTicks > 0 then - dec(StepTicks); - if (StepTicks = 0) then + if GHStepTicks > 0 then + dec(GHStepTicks); + if (GHStepTicks = 0) then HedgehogStep(HHGear) end end; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uGearsList.pas --- a/hedgewars/uGearsList.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uGearsList.pas Tue May 22 11:19:32 2012 +0200 @@ -33,6 +33,8 @@ uTextures, uScript, uRenderUtils, uAI, uCollisions, uGearsRender, uGearsUtils; +var GCounter: LongWord = 0; // this does not get re-initialized, but should be harmless + procedure InsertGearToList(Gear: PGear); var tmp, ptmp: PGear; begin @@ -74,8 +76,8 @@ function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; var gear: PGear; begin -inc(Counter); -AddFileLog('AddGear: #' + inttostr(Counter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind)); +inc(GCounter); +AddFileLog('AddGear: #' + inttostr(GCounter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind)); New(gear); FillChar(gear^, sizeof(TGear), 0); @@ -91,7 +93,7 @@ gear^.CollisionIndex:= -1; gear^.Timer:= Timer; gear^.FlightTime:= 0; -gear^.uid:= Counter; +gear^.uid:= GCounter; gear^.SoundChannel:= -1; gear^.ImpactSound:= sndNone; gear^.nImpactSounds:= 0; @@ -148,7 +150,7 @@ gear^.Z:= cHHZ; if (GameFlags and gfAISurvival) <> 0 then if gear^.Hedgehog^.BotLevel > 0 then - gear^.Hedgehog^.Effects[heResurrectable] := 0; + gear^.Hedgehog^.Effects[heResurrectable] := 1; end; gtShell: begin gear^.Radius:= 4; @@ -168,7 +170,7 @@ begin Pos:= 0; Radius:= 1; - DirAngle:= random * 360; + DirAngle:= random(360); if State and gstTmpFlag = 0 then begin dx.isNegative:= GetRandom(2) = 0; @@ -455,6 +457,7 @@ gear^.Tag:= TotalRounds + 3; gear^.Pos:= 1; end; + gtIceGun: gear^.Health:= 1000; end; InsertGearToList(gear); diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uGearsRender.pas Tue May 22 11:19:32 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 846cea23aea2 -r c91d33837b0d hedgewars/uGearsUtils.pas --- a/hedgewars/uGearsUtils.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uGearsUtils.pas Tue May 22 11:19:32 2012 +0200 @@ -20,7 +20,7 @@ unit uGearsUtils; interface -uses uTypes, math; +uses uTypes; procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword); inline; procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord); @@ -46,7 +46,7 @@ uses uFloat, uSound, uCollisions, uUtils, uConsts, uVisualGears, uAIMisc, uVariables, uLandGraphics, uScript, uStats, uCaptions, uTeams, uStore, uLocale, uTextures, uRenderUtils, uRandom, SDLh, uDebug, uGears, - uGearsList; + uGearsList, Math; procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword); inline; begin @@ -261,21 +261,21 @@ begin if (Source = dsFall) or (Source = dsExplosion) then case random(3) of - 0: PlaySound(sndOoff1, Hedgehog^.Team^.voicepack); - 1: PlaySound(sndOoff2, Hedgehog^.Team^.voicepack); - 2: PlaySound(sndOoff3, Hedgehog^.Team^.voicepack); + 0: PlaySoundV(sndOoff1, Hedgehog^.Team^.voicepack); + 1: PlaySoundV(sndOoff2, Hedgehog^.Team^.voicepack); + 2: PlaySoundV(sndOoff3, Hedgehog^.Team^.voicepack); end else if (Source = dsPoison) then case random(2) of - 0: PlaySound(sndPoisonCough, Hedgehog^.Team^.voicepack); - 1: PlaySound(sndPoisonMoan, Hedgehog^.Team^.voicepack); + 0: PlaySoundV(sndPoisonCough, Hedgehog^.Team^.voicepack); + 1: PlaySoundV(sndPoisonMoan, Hedgehog^.Team^.voicepack); end else case random(4) of - 0: PlaySound(sndOw1, Hedgehog^.Team^.voicepack); - 1: PlaySound(sndOw2, Hedgehog^.Team^.voicepack); - 2: PlaySound(sndOw3, Hedgehog^.Team^.voicepack); - 3: PlaySound(sndOw4, Hedgehog^.Team^.voicepack); + 0: PlaySoundV(sndOw1, Hedgehog^.Team^.voicepack); + 1: PlaySoundV(sndOw2, Hedgehog^.Team^.voicepack); + 2: PlaySoundV(sndOw3, Hedgehog^.Team^.voicepack); + 3: PlaySoundV(sndOw4, Hedgehog^.Team^.voicepack); end end; @@ -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 846cea23aea2 -r c91d33837b0d hedgewars/uIO.pas --- a/hedgewars/uIO.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uIO.pas Tue May 22 11:19:32 2012 +0200 @@ -25,8 +25,8 @@ procedure initModule; procedure freeModule; +procedure InitIPC; procedure SendIPC(s: shortstring); -procedure SendIPCc(c: char); procedure SendIPCXY(cmd: char; X, Y: SmallInt); procedure SendIPCRaw(p: pointer; len: Longword); procedure SendIPCAndWaitReply(s: shortstring); @@ -35,8 +35,6 @@ procedure SendStat(sit: TStatInfoType; s: shortstring); procedure IPCWaitPongEvent; procedure IPCCheckSock; -procedure InitIPC; -procedure CloseIPC; procedure NetGetNextCmd; procedure doPut(putX, putY: LongInt; fromAI: boolean); @@ -57,6 +55,7 @@ var IPCSock: PTCPSocket; fds: PSDLNet_SocketSet; isPonged: boolean; + SocketString: shortstring; headcmd: PCmd; lastcmd: PCmd; @@ -112,19 +111,12 @@ WriteLnToConsole(msgOK) end; -procedure CloseIPC; -begin - SDLNet_FreeSocketSet(fds); - SDLNet_TCP_Close(IPCSock); - SDLNet_Quit(); -end; - procedure ParseIPCCommand(s: shortstring); var loTicks: Word; begin case s[1] of '!': begin AddFileLog('Ping? Pong!'); isPonged:= true; end; - '?': SendIPCc('!'); + '?': SendIPC(_S'!'); 'e': ParseCommand(copy(s, 2, Length(s) - 1), true); 'E': OutError(copy(s, 2, Length(s) - 1), true); 'W': OutError(copy(s, 2, Length(s) - 1), false); @@ -229,14 +221,6 @@ end end; -procedure SendIPCc(c: char); -var s: shortstring; -begin - s[0]:= #1; - s[1]:= c; - SendIPC(s); -end; - procedure SendIPCRaw(p: pointer; len: Longword); begin if IPCSock <> nil then @@ -267,7 +251,7 @@ procedure SendIPCAndWaitReply(s: shortstring); begin SendIPC(s); -SendIPCc('?'); +SendIPC(_S'?'); IPCWaitPongEvent end; @@ -275,7 +259,7 @@ begin inc(SendEmptyPacketTicks, Lag); if (SendEmptyPacketTicks >= cSendEmptyPacketTime) then - SendIPCc('+') + SendIPC(_S'+') end; procedure NetGetNextCmd; @@ -334,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 @@ -443,7 +428,10 @@ procedure freeModule; begin -while headcmd <> nil do RemoveCmd + while headcmd <> nil do RemoveCmd; + SDLNet_FreeSocketSet(fds); + SDLNet_TCP_Close(IPCSock); + SDLNet_Quit(); end; end. diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uInputHandler.pas --- a/hedgewars/uInputHandler.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uInputHandler.pas Tue May 22 11:19:32 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); @@ -39,7 +38,6 @@ procedure SetDefaultBinds; procedure ControllerInit; -procedure ControllerClose; procedure ControllerAxisEvent(joy, axis: Byte; value: Integer); procedure ControllerHatEvent(joy, hat, value: Byte); procedure ControllerButtonEvent(joy, button: Byte; pressed: Boolean); @@ -61,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; @@ -176,12 +126,12 @@ end; procedure ResetKbd; -var j, k, t: LongInt; +var j, t: LongInt; i: LongInt; pkbd: PByteArray; begin -k:= SDL_GetMouseState(nil, nil); +//k:= SDL_GetMouseState(nil, nil); pkbd:=SDL_GetKeyState(@j); //TryDo(j < cKeyMaxIndex, 'SDL keys number is more than expected (' + IntToStr(j) + ')', true); @@ -189,7 +139,8 @@ for i:= 1 to pred(j) do tkbdn[i]:= pkbd^[i]; -{$IFNDEF MOBILE} +(* +// TODO: reimplement // 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 @@ -220,7 +171,7 @@ inc(k, 1); end; end; -{$ENDIF} +*) // what is this final loop for? for t:= 0 to cKeyMaxIndex do @@ -240,12 +191,8 @@ for i:= 6 to cKeyMaxIndex do begin -{$IFDEF SDL13} - s:= shortstring(SDL_GetScancodeName(i)); -{$ELSE} s:= shortstring(sdl_getkeyname(i)); -{$ENDIF} - WriteToConsole(IntToStr(i) + ': ' + s + ' ' + IntToStr(cKeyMaxIndex)); + //WriteLnToConsole(IntToStr(i) + ': ' + s + ' ' + IntToStr(cKeyMaxIndex)); if s = 'unknown key' then KeyNames[i]:= '' else begin @@ -256,7 +203,7 @@ end; end; -quitKeyCode:= KeyNameToCode('q'); +quitKeyCode:= KeyNameToCode(_S'q'); // get the size of keyboard array SDL_GetKeyState(@k); @@ -293,18 +240,18 @@ //DefaultBinds[265]:= '+volup'; //DefaultBinds[256]:= '+voldown'; -DefaultBinds[KeyNameToCode('0')]:= '+volup'; -DefaultBinds[KeyNameToCode('9')]:= '+voldown'; -DefaultBinds[KeyNameToCode('c')]:= 'capture'; -DefaultBinds[KeyNameToCode('h')]:= 'findhh'; -DefaultBinds[KeyNameToCode('p')]:= 'pause'; -DefaultBinds[KeyNameToCode('s')]:= '+speedup'; -DefaultBinds[KeyNameToCode('t')]:= 'chat'; -DefaultBinds[KeyNameToCode('y')]:= 'confirm'; +DefaultBinds[KeyNameToCode(_S'0')]:= '+volup'; +DefaultBinds[KeyNameToCode(_S'9')]:= '+voldown'; +DefaultBinds[KeyNameToCode(_S'c')]:= 'capture'; +DefaultBinds[KeyNameToCode(_S'h')]:= 'findhh'; +DefaultBinds[KeyNameToCode(_S'p')]:= 'pause'; +DefaultBinds[KeyNameToCode(_S's')]:= '+speedup'; +DefaultBinds[KeyNameToCode(_S't')]:= 'chat'; +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'; @@ -321,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); @@ -356,7 +308,7 @@ var i, j: Integer; begin ControllerEnabled:= 0; -{$IFDEF MOBILE} +{$IFDEF IPHONE} exit; // joystick subsystem disabled on iPhone {$ENDIF} @@ -419,30 +371,35 @@ WriteLnToConsole('Not using any game controller'); end; -procedure ControllerClose; -var j: Integer; +procedure ControllerAxisEvent(joy, axis: Byte; value: Integer); +var + k: LongInt; begin - if ControllerEnabled > 0 then - for j:= 0 to pred(ControllerNumControllers) do - SDL_JoystickClose(Controller[j]); -end; - -procedure ControllerAxisEvent(joy, axis: Byte; value: Integer); -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; @@ -452,8 +409,12 @@ end; procedure freeModule; +var j: LongInt; begin - + // close gamepad controllers + if ControllerEnabled > 0 then + for j:= 0 to pred(ControllerNumControllers) do + SDL_JoystickClose(Controller[j]); end; end. diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uLand.pas --- a/hedgewars/uLand.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uLand.pas Tue May 22 11:19:32 2012 +0200 @@ -26,13 +26,14 @@ procedure freeModule; procedure DrawBottomBorder; procedure GenMap; -function GenPreview: TPreview; +procedure GenPreview(out Preview: TPreview); implementation -uses uConsole, uStore, uRandom, uLandObjects, uIO, uLandTexture, sysutils, +uses uConsole, uStore, uRandom, uLandObjects, uIO, uLandTexture, SysUtils, uVariables, uUtils, uCommands, adler32, uDebug, uLandPainted, uTextures, uLandGenMaze, uLandOutline; +var digest: shortstring; procedure ColorizeLand(Surface: PSDL_Surface); var tmpsurf: PSDL_Surface; @@ -473,7 +474,6 @@ f: textfile; mapName: shortstring = ''; begin -isMap:= true; WriteLnToConsole('Loading land from file...'); AddProgress; tmpsurf:= LoadImage(UserPathz[ptMapCurrent] + '/map', ifAlpha or ifTransparent or ifIgnoreCaps); @@ -553,7 +553,6 @@ hasBorder:= false; LoadThemeConfig; - isMap:= false; // is this not needed any more? lets hope setlength sets also 0s //if ((GameFlags and gfForts) <> 0) or (Pathz[ptMapCurrent] <> '') then @@ -678,9 +677,8 @@ UpdateLandTexture(0, LAND_WIDTH, 0, LAND_HEIGHT); end; -function GenPreview: TPreview; +procedure GenPreview(out Preview: TPreview); var x, y, xx, yy, t, bit, cbit, lh, lw: LongInt; - Preview: TPreview; begin WriteLnToConsole('Generating preview...'); case cMapGen of @@ -709,8 +707,6 @@ Preview[y, x]:= Preview[y, x] or ($80 shr bit); end; end; - - GenPreview:= Preview end; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uLandGraphics.pas Tue May 22 11:19:32 2012 +0200 @@ -22,10 +22,10 @@ interface uses uFloat, uConsts, uTypes; -type PRangeArray = ^TRangeArray; - TRangeArray = array[0..31] of record +type TRangeArray = array[0..31] of record Left, Right: LongInt; end; + PRangeArray = ^TRangeArray; function addBgColor(OldColor, NewColor: LongWord): LongWord; function SweepDirty: boolean; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uLandObjects.pas Tue May 22 11:19:32 2012 +0200 @@ -31,14 +31,14 @@ implementation uses uStore, uConsts, uConsole, uRandom, uSound, GLunit, - uTypes, uVariables, uUtils, uDebug, sysutils; + uTypes, uVariables, uUtils, uDebug, SysUtils; const MaxRects = 512; MAXOBJECTRECTS = 16; MAXTHEMEOBJECTS = 32; -type PRectArray = ^TRectsArray; - TRectsArray = array[0..MaxRects] of TSDL_Rect; +type TRectsArray = array[0..MaxRects] of TSDL_Rect; + PRectArray = ^TRectsArray; TThemeObject = record Surf: PSDL_Surface; inland: TSDL_Rect; @@ -551,7 +551,7 @@ SDWaterOpacity:= WaterOpacity end else if key = 'music' then - MusicFN:= Trim(s) + SetMusicName(Trim(s)) else if key = 'clouds' then begin cCloudsNumber:= Word(StrToInt(Trim(s))) * cScreenSpace div LAND_WIDTH; @@ -803,17 +803,17 @@ end; procedure AddObjects(); -var i, int: Longword; +var i, g: Longword; begin InitRects; if hasGirders then begin - int:= max(playWidth div 8, 256); - i:=leftX+int; + g:= max(playWidth div 8, 256); + i:= leftX + g; repeat AddGirder(i); - i:=i+int; - until (i>rightX-int); + i:=i + g; + until (i > rightX - g); end; if (GameFlags and gfDisableLandObjects) = 0 then AddThemeObjects(ThemeObjects); diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uLandPainted.pas --- a/hedgewars/uLandPainted.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uLandPainted.pas Tue May 22 11:19:32 2012 +0200 @@ -130,7 +130,7 @@ rec.X:= SDLNet_Read16(@rec.X); rec.Y:= SDLNet_Read16(@rec.Y); - pe:= new(PPointEntry); + new(pe); if pointsListLast = nil then pointsListHead:= pe else diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uLandTemplates.pas --- a/hedgewars/uLandTemplates.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uLandTemplates.pas Tue May 22 11:19:32 2012 +0200 @@ -24,8 +24,8 @@ const NTPX = Low(SmallInt); -type PPointArray = ^TPointArray; - TPointArray = array[0..64] of TSDL_Rect; +type TPointArray = array[0..64] of TSDL_Rect; + PPointArray = ^TPointArray; TEdgeTemplate = record BasePoints: PPointArray; BasePointsCount: Longword; @@ -65,7 +65,7 @@ ); Template0FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template1Points: array[0..15] of TSDL_Rect = @@ -89,7 +89,7 @@ ); Template1FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template2Points: array[0..21] of TSDL_Rect = @@ -119,7 +119,7 @@ ); Template2FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template3Points: array[0..16] of TSDL_Rect = @@ -144,7 +144,7 @@ ); Template3FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template4Points: array[0..22] of TSDL_Rect = @@ -175,7 +175,7 @@ ); Template4FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template5Points: array[0..15] of TSDL_Rect = @@ -199,7 +199,7 @@ ); Template5FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template6Points: array[0..13] of TSDL_Rect = @@ -221,7 +221,7 @@ ); Template6FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template7Points: array[0..5] of TSDL_Rect = @@ -235,7 +235,7 @@ ); Template7FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); @@ -264,7 +264,7 @@ ); Template8FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template9Points: array[0..31] of TSDL_Rect = @@ -304,7 +304,7 @@ ); Template9FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template10Points: array[0..13] of TSDL_Rect = @@ -326,7 +326,7 @@ ); Template10FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template11Points: array[0..9] of TSDL_Rect = @@ -344,7 +344,7 @@ ); Template11FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template12Points: array[0..13] of TSDL_Rect = @@ -366,7 +366,7 @@ ); Template12FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template13Points: array[0..15] of TSDL_Rect = @@ -390,7 +390,7 @@ ); Template13FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template14Points: array[0..13] of TSDL_Rect = @@ -412,7 +412,7 @@ ); Template14FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template15Points: array[0..23] of TSDL_Rect = @@ -444,7 +444,7 @@ ); Template15FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template16Points: array[0..28] of TSDL_Rect = @@ -481,7 +481,7 @@ ); Template16FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); const Template17Points: array[0..13] of TSDL_Rect = @@ -503,7 +503,7 @@ ); Template17FPoints: array[0..0] of TPoint = ( - (x: 1023; y: 0) + (X: 1023; Y: 0) ); //////////////////// MIXING AND MATCHING ORIGINAL ////////////////////////////////////// const Template18Points: array[0..32] of TSDL_Rect = @@ -544,7 +544,7 @@ ); Template18FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template19Points: array[0..44] of TSDL_Rect = @@ -597,7 +597,7 @@ ); Template19FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template20Points: array[0..45] of TSDL_Rect = @@ -651,7 +651,7 @@ ); Template20FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template21Points: array[0..30] of TSDL_Rect = @@ -690,7 +690,7 @@ ); Template21FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template22Points: array[0..38] of TSDL_Rect = @@ -737,7 +737,7 @@ ); Template22FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template23Points: array[0..29] of TSDL_Rect = @@ -775,7 +775,7 @@ ); Template23FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template24Points: array[0..23] of TSDL_Rect = @@ -807,7 +807,7 @@ ); Template24FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template25Points: array[0..19] of TSDL_Rect = @@ -835,7 +835,7 @@ ); Template25FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); @@ -896,7 +896,7 @@ ); Template26FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template27Points: array[0..42] of TSDL_Rect = @@ -947,7 +947,7 @@ ); Template27FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template28Points: array[0..29] of TSDL_Rect = @@ -985,7 +985,7 @@ ); Template28FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template29Points: array[0..37] of TSDL_Rect = @@ -1031,7 +1031,7 @@ ); Template29FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template30Points: array[0..30] of TSDL_Rect = @@ -1070,7 +1070,7 @@ ); Template30FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template31Points: array[0..32] of TSDL_Rect = @@ -1111,7 +1111,7 @@ ); Template31FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template32Points: array[0..29] of TSDL_Rect = @@ -1149,7 +1149,7 @@ ); Template32FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template33Points: array[0..45] of TSDL_Rect = @@ -1203,7 +1203,7 @@ ); Template33FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template34Points: array[0..25] of TSDL_Rect = @@ -1237,7 +1237,7 @@ ); Template34FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); const Template35Points: array[0..48] of TSDL_Rect = @@ -1294,7 +1294,7 @@ ); Template35FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); ///////////////////////// CAVERNS /////////////////////////////////// @@ -1322,7 +1322,7 @@ ); Template36FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); ////////////////////////////// ... Silly ... //////////////////////////////// /// Ok. Tiy does not care for these. Perhaps they could be saved. @@ -1363,7 +1363,7 @@ ); Template37FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); // attempt to make a series of moderate hills/valleys - was before I really figured out the whole probabilities thing const Template38Points: array[0..16] of TSDL_Rect = @@ -1388,7 +1388,7 @@ ); Template38FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); // 8 tiny islands @@ -1437,7 +1437,7 @@ ); Template39FPoints: array[0..0] of TPoint = ( - (x: 512; y: 0) + (X: 512; Y: 0) ); const Template40Points: array[0..7] of TSDL_Rect = ( @@ -1452,7 +1452,7 @@ ); Template40FPoints: array[0..0] of TPoint = ( - (x: 512; y: 0) + (X: 512; Y: 0) ); // Many islands const Template41Points: array[0..86] of TSDL_Rect = @@ -1547,7 +1547,7 @@ ); Template41FPoints: array[0..0] of TPoint = ( - (x: 2047; y: 0) + (X: 2047; Y: 0) ); // 2 tiny islands const Template42Points: array[0..13] of TSDL_Rect = @@ -1569,7 +1569,7 @@ ); Template42FPoints: array[0..0] of TPoint = ( - (x: 512; y: 0) + (X: 512; Y: 0) ); //////////////////////////////////////////////////////////////////////// @@ -1584,7 +1584,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template1Points; BasePointsCount: Succ(High(Template1Points)); @@ -1595,7 +1595,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template2Points; BasePointsCount: Succ(High(Template2Points)); @@ -1606,7 +1606,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template3Points; BasePointsCount: Succ(High(Template3Points)); @@ -1617,7 +1617,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template4Points; BasePointsCount: Succ(High(Template4Points)); @@ -1628,7 +1628,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template5Points; BasePointsCount: Succ(High(Template5Points)); @@ -1639,7 +1639,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template6Points; BasePointsCount: Succ(High(Template6Points)); @@ -1650,7 +1650,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template7Points; BasePointsCount: Succ(High(Template7Points)); @@ -1661,7 +1661,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template8Points; BasePointsCount: Succ(High(Template8Points)); @@ -1672,7 +1672,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template9Points; BasePointsCount: Succ(High(Template9Points)); @@ -1683,7 +1683,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template10Points; BasePointsCount: Succ(High(Template10Points)); @@ -1694,7 +1694,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template11Points; BasePointsCount: Succ(High(Template11Points)); @@ -1705,7 +1705,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template12Points; BasePointsCount: Succ(High(Template12Points)); @@ -1716,7 +1716,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template13Points; BasePointsCount: Succ(High(Template13Points)); @@ -1727,7 +1727,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template14Points; BasePointsCount: Succ(High(Template14Points)); @@ -1738,7 +1738,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template15Points; BasePointsCount: Succ(High(Template15Points)); @@ -1749,7 +1749,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template16Points; BasePointsCount: Succ(High(Template16Points)); @@ -1760,7 +1760,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template17Points; BasePointsCount: Succ(High(Template17Points)); @@ -1771,7 +1771,7 @@ TemplateHeight: 1424; TemplateWidth: 2848; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 18; + MaxHedgeHogs: 18; ), (BasePoints: @Template18Points; BasePointsCount: Succ(High(Template18Points)); @@ -1782,7 +1782,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template19Points; BasePointsCount: Succ(High(Template19Points)); @@ -1793,7 +1793,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template20Points; BasePointsCount: Succ(High(Template20Points)); @@ -1804,7 +1804,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template21Points; BasePointsCount: Succ(High(Template21Points)); @@ -1815,7 +1815,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template22Points; BasePointsCount: Succ(High(Template22Points)); @@ -1826,7 +1826,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template23Points; BasePointsCount: Succ(High(Template23Points)); @@ -1837,7 +1837,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template24Points; BasePointsCount: Succ(High(Template24Points)); @@ -1848,7 +1848,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template25Points; BasePointsCount: Succ(High(Template25Points)); @@ -1859,7 +1859,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template26Points; BasePointsCount: Succ(High(Template26Points)); @@ -1870,7 +1870,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template27Points; BasePointsCount: Succ(High(Template27Points)); @@ -1881,7 +1881,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template28Points; BasePointsCount: Succ(High(Template28Points)); @@ -1892,7 +1892,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template29Points; BasePointsCount: Succ(High(Template29Points)); @@ -1903,7 +1903,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template30Points; BasePointsCount: Succ(High(Template30Points)); @@ -1914,7 +1914,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template31Points; BasePointsCount: Succ(High(Template31Points)); @@ -1925,7 +1925,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template32Points; BasePointsCount: Succ(High(Template32Points)); @@ -1936,7 +1936,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template33Points; BasePointsCount: Succ(High(Template33Points)); @@ -1947,7 +1947,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template34Points; BasePointsCount: Succ(High(Template34Points)); @@ -1958,7 +1958,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template35Points; BasePointsCount: Succ(High(Template35Points)); @@ -1969,7 +1969,7 @@ TemplateHeight: 1424; TemplateWidth: 3900; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 36; + MaxHedgeHogs: 36; ), (BasePoints: @Template36Points; BasePointsCount: Succ(High(Template36Points)); @@ -1980,7 +1980,7 @@ TemplateHeight: 1024; TemplateWidth: 4096; canMirror: true; canFlip: false; isNegative: true; canInvert: false; hasGirders: false; - MaxHedgehogs: 32; + MaxHedgeHogs: 32; ), (BasePoints: @Template37Points; BasePointsCount: Succ(High(Template37Points)); @@ -1991,7 +1991,7 @@ TemplateHeight: 2048; TemplateWidth: 4096; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 48; + MaxHedgeHogs: 48; ), (BasePoints: @Template38Points; BasePointsCount: Succ(High(Template38Points)); @@ -2002,7 +2002,7 @@ TemplateHeight: 2048; TemplateWidth: 4096; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 48; + MaxHedgeHogs: 48; ), (BasePoints: @Template39Points; BasePointsCount: Succ(High(Template39Points)); @@ -2013,7 +2013,7 @@ TemplateHeight: 512; TemplateWidth: 1536; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: false; - MaxHedgehogs: 8; + MaxHedgeHogs: 8; ), (BasePoints: @Template40Points; BasePointsCount: Succ(High(Template40Points)); @@ -2024,7 +2024,7 @@ TemplateHeight: 1024; TemplateWidth: 1024; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: false; - MaxHedgehogs: 8; + MaxHedgeHogs: 8; ), (BasePoints: @Template41Points; BasePointsCount: Succ(High(Template41Points)); @@ -2035,7 +2035,7 @@ TemplateHeight: 2048; TemplateWidth: 4096; canMirror: true; canFlip: true; isNegative: false; canInvert: false; hasGirders: true; - MaxHedgehogs: 48; + MaxHedgeHogs: 48; ), (BasePoints: @Template42Points; BasePointsCount: Succ(High(Template42Points)); @@ -2046,7 +2046,7 @@ TemplateHeight: 512; TemplateWidth: 1536; canMirror: true; canFlip: false; isNegative: false; canInvert: false; hasGirders: false; - MaxHedgehogs: 8; + MaxHedgeHogs: 8; ) ); const SmallTemplates: array[0..2] of Longword = ( 39, 40, 42 ); diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uLocale.pas --- a/hedgewars/uLocale.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uLocale.pas Tue May 22 11:19:32 2012 +0200 @@ -26,11 +26,15 @@ procedure LoadLocale(FileName: shortstring); function Format(fmt: shortstring; var arg: shortstring): shortstring; -function Format(fmt: ansistring; var arg: ansistring): ansistring; +function FormatA(fmt: ansistring; var arg: ansistring): ansistring; function GetEventString(e: TEventId): ansistring; +{$IFDEF HWLIBRARY} +procedure LoadLocaleWrapper(str: pchar); cdecl; export; +{$ENDIF} + implementation -uses uRandom, uUtils, uVariables, uDebug, uConsole; +uses uRandom, uUtils, uVariables, uDebug; var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring; trevt_n: array[TEventId] of integer; @@ -96,7 +100,6 @@ end; end; Close(f); - {$IFNDEF HWLIBRARY}WriteLnToConsole('Locale loaded "' + FileName + '"');{$ENDIF} end; {$I+} end; @@ -119,19 +122,21 @@ Format:= copy(fmt, 1, i - 1) + arg + Format(copy(fmt, i + 2, Length(fmt) - i - 1), arg) end; -function Format(fmt: ansistring; var arg: ansistring): ansistring; +function FormatA(fmt: ansistring; var arg: ansistring): ansistring; var i: LongInt; begin i:= Pos('%1', fmt); if i = 0 then - Format:= fmt + FormatA:= fmt else - Format:= copy(fmt, 1, i - 1) + arg + Format(copy(fmt, i + 2, Length(fmt) - i - 1), arg) + FormatA:= copy(fmt, 1, i - 1) + arg + FormatA(copy(fmt, i + 2, Length(fmt) - i - 1), arg) end; +{$IFDEF HWLIBRARY} procedure LoadLocaleWrapper(str: pchar); cdecl; export; begin LoadLocale(Strpas(str)); end; +{$ENDIF} end. diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uMisc.pas Tue May 22 11:19:32 2012 +0200 @@ -37,7 +37,7 @@ {$ENDIF} implementation -uses typinfo, sysutils, uVariables, uUtils +uses SysUtils, uVariables, uUtils {$IFDEF PNG_SCREENSHOTS}, PNGh, png {$ENDIF} {$IFNDEF USE_SDLTHREADS} {$IFDEF UNIX}, cthreads{$ENDIF} {$ENDIF}; @@ -49,6 +49,8 @@ size: QWord; end; +var conversionFormat: PSDL_PixelFormat; + procedure movecursor(dx, dy: LongInt); var x, y: LongInt; begin @@ -242,11 +244,11 @@ doSurfaceConversion:= tmpsurf; if ((tmpsurf^.format^.bitsperpixel = 32) and (tmpsurf^.format^.rshift > tmpsurf^.format^.bshift)) or (tmpsurf^.format^.bitsperpixel = 24) then - begin + begin convertedSurf:= SDL_ConvertSurface(tmpsurf, conversionFormat, SDL_SWSURFACE); SDL_FreeSurface(tmpsurf); doSurfaceConversion:= convertedSurf; - end; + end; end; {$IFDEF SDL13} diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uMobile.pas --- a/hedgewars/uMobile.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uMobile.pas Tue May 22 11:19:32 2012 +0200 @@ -18,28 +18,34 @@ {$INCLUDE "options.inc"} +(* + * This unit contains a lot of useful functions when hw is running on mobile + * Unlike HwLibrary when you declare functions that you will call from your code, + * here you need to provide functions that Pascall code will call. + *) + unit uMobile; interface +function isPhone: Boolean; inline; +procedure performRumble; inline; + +procedure GameLoading; inline; +procedure GameLoaded; inline; +procedure SaveLoadingEnded; inline; + +implementation +uses uVariables, uConsole; + +// add here any external call that you need {$IFDEF IPHONEOS} (* iOS calls written in ObjcExports.m *) -procedure clearView; cdecl; external; procedure startLoadingIndicator; cdecl; external; procedure stopLoadingIndicator; cdecl; external; procedure saveFinishedSynching; cdecl; external; function isApplePhone: Boolean; cdecl; external; procedure AudioServicesPlaySystemSound(num: LongInt); cdecl; external; {$ENDIF} -function isPhone: Boolean; inline; -procedure performRumble; inline; - -procedure GameLoading; inline; -procedure GameLoaded; inline; -procedure NewTurnBeginning; inline; -procedure SaveLoadingEnded; inline; - -implementation -uses uVariables, uConsole; // this function is just to determine whether we are running on a limited screen device function isPhone: Boolean; inline; @@ -56,16 +62,16 @@ end; // this function should make the device vibrate in some way -procedure performRumble; inline; -const kSystemSoundID_Vibrate = $00000FFF; +procedure PerformRumble; inline; +{$IFDEF IPHONEOS}const kSystemSoundID_Vibrate = $00000FFF;{$ENDIF} begin // do not vibrate while synchronising a demo/save if not fastUntilLag then - begin + begin {$IFDEF IPHONEOS} AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); {$ENDIF} - end; + end; end; procedure GameLoading; inline; @@ -82,13 +88,6 @@ {$ENDIF} end; -procedure NewTurnBeginning; inline; -begin -{$IFDEF IPHONEOS} - clearView(); -{$ENDIF} -end; - procedure SaveLoadingEnded; inline; begin {$IFDEF IPHONEOS} diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uRandom.pas --- a/hedgewars/uRandom.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uRandom.pas Tue May 22 11:19:32 2012 +0200 @@ -29,7 +29,6 @@ *) interface uses uFloat; -{$INCLUDE "config.inc"} procedure initModule; procedure freeModule; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uRender.pas --- a/hedgewars/uRender.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uRender.pas Tue May 22 11:19:32 2012 +0200 @@ -55,6 +55,8 @@ implementation uses uVariables; +var LastTint: LongWord = 0; + procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt); begin r.y:= r.y + Height * Position; @@ -406,10 +408,10 @@ procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real); const VertexBuffer: array [0..3] of TVertex2f = ( - (x: -16; y: -16), - (x: 16; y: -16), - (x: 16; y: 16), - (x: -16; y: 16)); + (X: -16; Y: -16), + (X: 16; Y: -16), + (X: 16; Y: 16), + (X: -16; Y: 16)); var l, r, t, b: real; TextureBuffer: array [0..3] of TVertex2f; begin diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uRenderUtils.pas --- a/hedgewars/uRenderUtils.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uRenderUtils.pas Tue May 22 11:19:32 2012 +0200 @@ -39,7 +39,7 @@ function RenderSpeechBubbleTex(s: ansistring; SpeechType: Longword; font: THWFont): PTexture; implementation -uses uUtils, uVariables, uConsts, uTextures, sysutils, uDebug; +uses uUtils, uVariables, uConsts, uTextures, SysUtils, uDebug; procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean); var r: TSDL_Rect; @@ -257,7 +257,7 @@ var w, h: LongInt; finalSurface: PSDL_Surface; begin - if length(s) = 0 then s:= ' '; + if length(s) = 0 then s:= _S' '; font:= CheckCJKFont(s, font); w:= 0; h:= 0; // avoid compiler hints TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(s), @w, @h); diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uScript.pas --- a/hedgewars/uScript.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uScript.pas Tue May 22 11:19:32 2012 +0200 @@ -36,7 +36,7 @@ procedure ScriptLoad(name : shortstring); procedure ScriptOnGameInit; -procedure ScriptOnScreenResize(); +procedure ScriptOnScreenResize; procedure ScriptCall(fname : shortstring); function ScriptCall(fname : shortstring; par1: LongInt) : LongInt; @@ -52,7 +52,7 @@ procedure freeModule; implementation -{$IFNDEF LUA_DISABLED} +{$IFDEF USE_LUA_SCRIPT} uses LuaPas, uConsole, uConsts, @@ -80,7 +80,7 @@ uTextures, uLandGraphics, SDLh, - sysutils; + SysUtils; var luaState : Plua_State; ScriptAmmoLoadout : shortstring; @@ -2055,7 +2055,7 @@ // import some variables ScriptSetInteger('LAND_WIDTH', LAND_WIDTH); ScriptSetInteger('LAND_HEIGHT', LAND_HEIGHT); -ScriptSetString('L', cLocale); +ScriptSetString(_S'L', cLocale); // import game flags ScriptSetInteger('gfForts', gfForts); @@ -2149,90 +2149,90 @@ ScriptSetInteger('gstInvisible' ,$00200000); // register functions -lua_register(luaState, 'band', @lc_band); -lua_register(luaState, 'bor', @lc_bor); -lua_register(luaState, 'bnot', @lc_bnot); -lua_register(luaState, 'div', @lc_div); -lua_register(luaState, 'GetInputMask', @lc_getinputmask); -lua_register(luaState, 'SetInputMask', @lc_setinputmask); -lua_register(luaState, 'AddGear', @lc_addgear); -lua_register(luaState, 'DeleteGear', @lc_deletegear); -lua_register(luaState, 'AddVisualGear', @lc_addvisualgear); -lua_register(luaState, 'DeleteVisualGear', @lc_deletevisualgear); -lua_register(luaState, 'GetVisualGearValues', @lc_getvisualgearvalues); -lua_register(luaState, 'SetVisualGearValues', @lc_setvisualgearvalues); -lua_register(luaState, 'SpawnHealthCrate', @lc_spawnhealthcrate); -lua_register(luaState, 'SpawnAmmoCrate', @lc_spawnammocrate); -lua_register(luaState, 'SpawnUtilityCrate', @lc_spawnutilitycrate); -lua_register(luaState, 'SpawnFakeHealthCrate', @lc_spawnfakehealthcrate); -lua_register(luaState, 'SpawnFakeAmmoCrate', @lc_spawnfakeammocrate); -lua_register(luaState, 'SpawnFakeUtilityCrate', @lc_spawnfakeutilitycrate); -lua_register(luaState, 'WriteLnToConsole', @lc_writelntoconsole); -lua_register(luaState, 'GetGearType', @lc_getgeartype); -lua_register(luaState, 'EndGame', @lc_endgame); -lua_register(luaState, 'FindPlace', @lc_findplace); -lua_register(luaState, 'SetGearPosition', @lc_setgearposition); -lua_register(luaState, 'GetGearPosition', @lc_getgearposition); -lua_register(luaState, 'SetGearTarget', @lc_setgeartarget); -lua_register(luaState, 'GetGearTarget', @lc_getgeartarget); -lua_register(luaState, 'SetGearVelocity', @lc_setgearvelocity); -lua_register(luaState, 'GetGearVelocity', @lc_getgearvelocity); -lua_register(luaState, 'ParseCommand', @lc_parsecommand); -lua_register(luaState, 'ShowMission', @lc_showmission); -lua_register(luaState, 'HideMission', @lc_hidemission); -lua_register(luaState, 'AddCaption', @lc_addcaption); -lua_register(luaState, 'SetAmmo', @lc_setammo); -lua_register(luaState, 'SetAmmoStore', @lc_setammostore); -lua_register(luaState, 'PlaySound', @lc_playsound); -lua_register(luaState, 'AddTeam', @lc_addteam); -lua_register(luaState, 'AddHog', @lc_addhog); -lua_register(luaState, 'AddAmmo', @lc_addammo); -lua_register(luaState, 'GetAmmoCount', @lc_getammocount); -lua_register(luaState, 'SetHealth', @lc_sethealth); -lua_register(luaState, 'GetHealth', @lc_gethealth); -lua_register(luaState, 'SetEffect', @lc_seteffect); -lua_register(luaState, 'GetEffect', @lc_geteffect); -lua_register(luaState, 'GetHogClan', @lc_gethogclan); -lua_register(luaState, 'GetClanColor', @lc_getclancolor); -lua_register(luaState, 'SetClanColor', @lc_setclancolor); -lua_register(luaState, 'GetHogTeamName', @lc_gethogteamname); -lua_register(luaState, 'GetHogName', @lc_gethogname); -lua_register(luaState, 'SetHogName', @lc_sethogname); -lua_register(luaState, 'GetHogLevel', @lc_gethoglevel); -lua_register(luaState, 'SetHogLevel', @lc_sethoglevel); -lua_register(luaState, 'GetX', @lc_getx); -lua_register(luaState, 'GetY', @lc_gety); -lua_register(luaState, 'CopyPV', @lc_copypv); -lua_register(luaState, 'FollowGear', @lc_followgear); -lua_register(luaState, 'GetFollowGear', @lc_getfollowgear); -lua_register(luaState, 'SetState', @lc_setstate); -lua_register(luaState, 'GetState', @lc_getstate); -lua_register(luaState, 'SetTag', @lc_settag); -lua_register(luaState, 'SetTimer', @lc_settimer); -lua_register(luaState, 'GetTimer', @lc_gettimer); -lua_register(luaState, 'SetZoom', @lc_setzoom); -lua_register(luaState, 'GetZoom', @lc_getzoom); -lua_register(luaState, 'HogSay', @lc_hogsay); -lua_register(luaState, 'SwitchHog', @lc_switchhog); -lua_register(luaState, 'HogTurnLeft', @lc_hogturnleft); -lua_register(luaState, 'CampaignLock', @lc_campaignlock); -lua_register(luaState, 'CampaignUnlock', @lc_campaignunlock); -lua_register(luaState, 'GetGearElasticity', @lc_getgearelasticity); -lua_register(luaState, 'GetGearRadius', @lc_getgearradius); -lua_register(luaState, 'GetGearMessage', @lc_getgearmessage); -lua_register(luaState, 'SetGearMessage', @lc_setgearmessage); -lua_register(luaState, 'GetGearPos', @lc_getgearpos); -lua_register(luaState, 'SetGearPos', @lc_setgearpos); -lua_register(luaState, 'GetRandom', @lc_getrandom); -lua_register(luaState, 'SetWind', @lc_setwind); -lua_register(luaState, 'GetDataPath', @lc_getdatapath); -lua_register(luaState, 'GetUserDataPath', @lc_getuserdatapath); -lua_register(luaState, 'MapHasBorder', @lc_maphasborder); -lua_register(luaState, 'GetHogHat', @lc_gethoghat); -lua_register(luaState, 'SetHogHat', @lc_sethoghat); -lua_register(luaState, 'PlaceGirder', @lc_placegirder); -lua_register(luaState, 'GetCurAmmoType', @lc_getcurammotype); -lua_register(luaState, 'TestRectForObstacle', @lc_testrectforobstacle); +lua_register(luaState, _P'band', @lc_band); +lua_register(luaState, _P'bor', @lc_bor); +lua_register(luaState, _P'bnot', @lc_bnot); +lua_register(luaState, _P'div', @lc_div); +lua_register(luaState, _P'GetInputMask', @lc_getinputmask); +lua_register(luaState, _P'SetInputMask', @lc_setinputmask); +lua_register(luaState, _P'AddGear', @lc_addgear); +lua_register(luaState, _P'DeleteGear', @lc_deletegear); +lua_register(luaState, _P'AddVisualGear', @lc_addvisualgear); +lua_register(luaState, _P'DeleteVisualGear', @lc_deletevisualgear); +lua_register(luaState, _P'GetVisualGearValues', @lc_getvisualgearvalues); +lua_register(luaState, _P'SetVisualGearValues', @lc_setvisualgearvalues); +lua_register(luaState, _P'SpawnHealthCrate', @lc_spawnhealthcrate); +lua_register(luaState, _P'SpawnAmmoCrate', @lc_spawnammocrate); +lua_register(luaState, _P'SpawnUtilityCrate', @lc_spawnutilitycrate); +lua_register(luaState, _P'SpawnFakeHealthCrate', @lc_spawnfakehealthcrate); +lua_register(luaState, _P'SpawnFakeAmmoCrate', @lc_spawnfakeammocrate); +lua_register(luaState, _P'SpawnFakeUtilityCrate', @lc_spawnfakeutilitycrate); +lua_register(luaState, _P'WriteLnToConsole', @lc_writelntoconsole); +lua_register(luaState, _P'GetGearType', @lc_getgeartype); +lua_register(luaState, _P'EndGame', @lc_endgame); +lua_register(luaState, _P'FindPlace', @lc_findplace); +lua_register(luaState, _P'SetGearPosition', @lc_setgearposition); +lua_register(luaState, _P'GetGearPosition', @lc_getgearposition); +lua_register(luaState, _P'SetGearTarget', @lc_setgeartarget); +lua_register(luaState, _P'GetGearTarget', @lc_getgeartarget); +lua_register(luaState, _P'SetGearVelocity', @lc_setgearvelocity); +lua_register(luaState, _P'GetGearVelocity', @lc_getgearvelocity); +lua_register(luaState, _P'ParseCommand', @lc_parsecommand); +lua_register(luaState, _P'ShowMission', @lc_showmission); +lua_register(luaState, _P'HideMission', @lc_hidemission); +lua_register(luaState, _P'AddCaption', @lc_addcaption); +lua_register(luaState, _P'SetAmmo', @lc_setammo); +lua_register(luaState, _P'SetAmmoStore', @lc_setammostore); +lua_register(luaState, _P'PlaySound', @lc_playsound); +lua_register(luaState, _P'AddTeam', @lc_addteam); +lua_register(luaState, _P'AddHog', @lc_addhog); +lua_register(luaState, _P'AddAmmo', @lc_addammo); +lua_register(luaState, _P'GetAmmoCount', @lc_getammocount); +lua_register(luaState, _P'SetHealth', @lc_sethealth); +lua_register(luaState, _P'GetHealth', @lc_gethealth); +lua_register(luaState, _P'SetEffect', @lc_seteffect); +lua_register(luaState, _P'GetEffect', @lc_geteffect); +lua_register(luaState, _P'GetHogClan', @lc_gethogclan); +lua_register(luaState, _P'GetClanColor', @lc_getclancolor); +lua_register(luaState, _P'SetClanColor', @lc_setclancolor); +lua_register(luaState, _P'GetHogTeamName', @lc_gethogteamname); +lua_register(luaState, _P'GetHogName', @lc_gethogname); +lua_register(luaState, _P'SetHogName', @lc_sethogname); +lua_register(luaState, _P'GetHogLevel', @lc_gethoglevel); +lua_register(luaState, _P'SetHogLevel', @lc_sethoglevel); +lua_register(luaState, _P'GetX', @lc_getx); +lua_register(luaState, _P'GetY', @lc_gety); +lua_register(luaState, _P'CopyPV', @lc_copypv); +lua_register(luaState, _P'FollowGear', @lc_followgear); +lua_register(luaState, _P'GetFollowGear', @lc_getfollowgear); +lua_register(luaState, _P'SetState', @lc_setstate); +lua_register(luaState, _P'GetState', @lc_getstate); +lua_register(luaState, _P'SetTag', @lc_settag); +lua_register(luaState, _P'SetTimer', @lc_settimer); +lua_register(luaState, _P'GetTimer', @lc_gettimer); +lua_register(luaState, _P'SetZoom', @lc_setzoom); +lua_register(luaState, _P'GetZoom', @lc_getzoom); +lua_register(luaState, _P'HogSay', @lc_hogsay); +lua_register(luaState, _P'SwitchHog', @lc_switchhog); +lua_register(luaState, _P'HogTurnLeft', @lc_hogturnleft); +lua_register(luaState, _P'CampaignLock', @lc_campaignlock); +lua_register(luaState, _P'CampaignUnlock', @lc_campaignunlock); +lua_register(luaState, _P'GetGearElasticity', @lc_getgearelasticity); +lua_register(luaState, _P'GetGearRadius', @lc_getgearradius); +lua_register(luaState, _P'GetGearMessage', @lc_getgearmessage); +lua_register(luaState, _P'SetGearMessage', @lc_setgearmessage); +lua_register(luaState, _P'GetGearPos', @lc_getgearpos); +lua_register(luaState, _P'SetGearPos', @lc_setgearpos); +lua_register(luaState, _P'GetRandom', @lc_getrandom); +lua_register(luaState, _P'SetWind', @lc_setwind); +lua_register(luaState, _P'GetDataPath', @lc_getdatapath); +lua_register(luaState, _P'GetUserDataPath', @lc_getuserdatapath); +lua_register(luaState, _P'MapHasBorder', @lc_maphasborder); +lua_register(luaState, _P'GetHogHat', @lc_gethoghat); +lua_register(luaState, _P'SetHogHat', @lc_sethoghat); +lua_register(luaState, _P'PlaceGirder', @lc_placegirder); +lua_register(luaState, _P'GetCurAmmoType', @lc_getcurammotype); +lua_register(luaState, _P'TestRectForObstacle', @lc_testrectforobstacle); ScriptClearStack; // just to be sure stack is empty @@ -2255,6 +2255,7 @@ procedure ScriptLoad(name : shortstring); begin + name:= name; // avoid hint end; procedure ScriptOnGameInit; @@ -2263,36 +2264,59 @@ procedure ScriptCall(fname : shortstring); begin + fname:= fname; // avoid hint end; function ScriptCall(fname : shortstring; par1, par2, par3, par4 : LongInt) : LongInt; begin -ScriptCall:= 0 + // avoid hints + fname:= fname; + par1:= par1; + par2:= par2; + par3:= par3; + par4:= par4; + ScriptCall:= 0 end; function ScriptCall(fname : shortstring; par1: LongInt) : LongInt; begin -ScriptCall:= 0 + // avoid hints + fname:= fname; + par1:= par1; + ScriptCall:= 0 end; function ScriptCall(fname : shortstring; par1, par2: LongInt) : LongInt; begin -ScriptCall:= 0 + // avoid hints + fname:= fname; + par1:= par1; + par2:= par2; + ScriptCall:= 0 end; function ScriptCall(fname : shortstring; par1, par2, par3: LongInt) : LongInt; begin -ScriptCall:= 0 + // avoid hints + fname:= fname; + par1:= par1; + par2:= par2; + par3:= par3; + ScriptCall:= 0 end; function ScriptExists(fname : shortstring) : boolean; begin -ScriptExists:= false + fname:= fname; // avoid hint + ScriptExists:= false end; function ParseCommandOverride(key, value : shortstring) : shortstring; begin -ParseCommandOverride:= value + // avoid hints + key:= key; + value:= value; + ParseCommandOverride:= '' end; procedure ScriptOnScreenResize; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uSound.pas --- a/hedgewars/uSound.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uSound.pas Tue May 22 11:19:32 2012 +0200 @@ -33,27 +33,26 @@ * The channel id can be used to stop a specific sound loop. *) interface -uses SDLh, uConsts, uTypes, sysutils; - -var MusicFN: shortstring; // music file name - previousVolume: LongInt; // cached volume value +uses SDLh, uConsts, uTypes, SysUtils; procedure initModule; procedure freeModule; -procedure InitSound; // Initiates sound-system if isSoundEnabled. -procedure ReleaseSound(complete: boolean); // Releases sound-system and used resources. -procedure SoundLoad; // Preloads some sounds for performance reasons. - +procedure InitSound; // Initiates sound-system if isSoundEnabled. +procedure ReleaseSound(complete: boolean); // Releases sound-system and used resources. +procedure ResetSound; // Reset sound state to the previous state. +procedure SetSound(enabled: boolean); // Enable/disable sound-system and backup status. // MUSIC -// Obvious music commands for music track specified in MusicFN. -procedure PlayMusic; -procedure PauseMusic; -procedure ResumeMusic; -procedure ChangeMusic; // Replaces music track with current MusicFN and plays it. -procedure StopMusic; // Stops and releases the current track +// Obvious music commands for music track +procedure SetMusic(enabled: boolean); // Enable/disable music. +procedure SetMusicName(musicname: shortstring); // Enable/disable music and set name of musicfile to play. +procedure PlayMusic; // Play music from the start. +procedure PauseMusic; // Pause music. +procedure ResumeMusic; // Resume music from pause point. +procedure ChangeMusic(musicname: shortstring); // Replaces music track with musicname and plays it. +procedure StopMusic; // Stops and releases the current track. // SOUNDS @@ -63,21 +62,21 @@ // then the sound's playback won't be interrupted if asked to play again. procedure PlaySound(snd: TSound); procedure PlaySound(snd: TSound; keepPlaying: boolean); -procedure PlaySound(snd: TSound; voicepack: PVoicepack); -procedure PlaySound(snd: TSound; voicepack: PVoicepack; keepPlaying: boolean); +procedure PlaySoundV(snd: TSound; voicepack: PVoicepack); +procedure PlaySoundV(snd: TSound; voicepack: PVoicepack; keepPlaying: boolean); // Plays sound snd [of voicepack] in a loop, but starts with fadems milliseconds of fade-in. // Returns sound channel of the looped sound. function LoopSound(snd: TSound): LongInt; function LoopSound(snd: TSound; fadems: LongInt): LongInt; -function LoopSound(snd: TSound; voicepack: PVoicepack): LongInt; // WTF? -function LoopSound(snd: TSound; voicepack: PVoicepack; fadems: LongInt): LongInt; +function LoopSoundV(snd: TSound; voicepack: PVoicepack): LongInt; // WTF? +function LoopSoundV(snd: TSound; voicepack: PVoicepack; fadems: LongInt): LongInt; // Stops the normal/looped sound of the given type/in the given channel // [with a fade-out effect for fadems milliseconds]. procedure StopSound(snd: TSound); -procedure StopSound(chn: LongInt); -procedure StopSound(chn, fadems: LongInt); +procedure StopSoundChan(chn: LongInt); +procedure StopSoundChan(chn, fadems: LongInt); procedure AddVoice(snd: TSound; voicepack: PVoicepack); procedure PlayNextVoice; @@ -85,13 +84,16 @@ // MISC +// Set the initial volume +procedure SetVolume(volume: LongInt); + // Modifies the sound volume of the game by voldelta and returns the new volume level. function ChangeVolume(voldelta: LongInt): LongInt; // Returns a pointer to the voicepack with the given name. function AskForVoicepack(name: shortstring): Pointer; -// Drastically lower the volume when we lose focus (and restore the previous value) +// Drastically lower the volume when we lose focus (and restore the previous value). procedure DampenAudio; procedure UndampenAudio; @@ -104,6 +106,13 @@ voicepacks: array[0..cMaxTeams] of TVoicepack; defVoicepack: PVoicepack; Mus: PMixMusic = nil; + MusicFN: shortstring; // music file name + previousVolume: LongInt; // cached volume value + isMusicEnabled: boolean; + isSoundEnabled: boolean; + isSEBackup: boolean; + cInitVolume: LongInt; + function AskForVoicepack(name: shortstring): Pointer; var i: Longword; @@ -151,44 +160,42 @@ end; procedure InitSound; -var i: TSound; - channels: LongInt; +const channels: LongInt = {$IFDEF MOBILE}1{$ELSE}2{$ENDIF}; begin if not isSoundEnabled then exit; WriteToConsole('Init sound...'); isSoundEnabled:= SDL_InitSubSystem(SDL_INIT_AUDIO) >= 0; -{$IFDEF MOBILE} - channels:= 1; -{$ELSE} - channels:= 2; -{$ENDIF} - if isSoundEnabled then isSoundEnabled:= Mix_OpenAudio(44100, $8010, channels, 1024) = 0; - WriteToConsole('Init SDL_mixer... '); - SDLTry(Mix_Init(MIX_INIT_OGG) <> 0, true); - WriteLnToConsole(msgOK); - if isSoundEnabled then WriteLnToConsole(msgOK) else WriteLnToConsole(msgFailed); + WriteToConsole('Init SDL_mixer... '); + SDLTry(Mix_Init(MIX_INIT_OGG) <> 0, true); + WriteLnToConsole(msgOK); + Mix_AllocateChannels(Succ(chanTPU)); - if isMusicEnabled then - Mix_VolumeMusic(50); - for i:= Low(TSound) to High(TSound) do - lastChan[i]:= -1; + ChangeVolume(cInitVolume); +end; - Volume:= 0; - ChangeVolume(cInitVolume) +procedure ResetSound; +begin + isSoundEnabled:= isSEBackup; +end; + +procedure SetSound(enabled: boolean); +begin + isSEBackup:= isSoundEnabled; + isSoundEnabled:= enabled; end; // when complete is false, this procedure just releases some of the chucks on inactive channels -// this way music is not stopped, nor are chucks currently being plauyed +// in this way music is not stopped, nor are chucks currently being played procedure ReleaseSound(complete: boolean); var i: TSound; t: Longword; @@ -224,57 +231,22 @@ end; end; -procedure SoundLoad; -var i: TSound; - t: Longword; -begin - if not isSoundEnabled then - exit; - - defVoicepack:= AskForVoicepack('Default'); - - // initialize all voices to nil so that they can be loaded when needed - for t:= 0 to cMaxTeams do - if voicepacks[t].name <> '' then - for i:= Low(TSound) to High(TSound) do - voicepacks[t].chunks[i]:= nil; - - for i:= Low(TSound) to High(TSound) do - begin - defVoicepack^.chunks[i]:= nil; - (* this is not necessary when SDL_mixer is compiled with USE_OGG_TREMOR - // preload all the big sound files (>32k) that would otherwise lockup the game - if (i in [sndBeeWater, sndBee, sndCake, sndHellishImpact1, sndHellish, sndHomerun, - sndMolotov, sndMortar, sndRideOfTheValkyries, sndYoohoo]) - and (Soundz[i].Path <> ptVoices) and (Soundz[i].FileName <> '') then - begin - s:= UserPathz[Soundz[i].Path] + '/' + Soundz[i].FileName; - if not FileExists(s) then s:= Pathz[Soundz[i].Path] + '/' + Soundz[i].FileName; - WriteToConsole(msgLoading + s + ' '); - defVoicepack^.chunks[i]:= Mix_LoadWAV_RW(SDL_RWFromFile(Str2PChar(s), 'rb'), 1); - SDLTry(defVoicepack^.chunks[i] <> nil, true); - WriteLnToConsole(msgOK); - end;*) - end; - -end; - procedure PlaySound(snd: TSound); begin - PlaySound(snd, nil, false); + PlaySoundV(snd, nil, false); end; procedure PlaySound(snd: TSound; keepPlaying: boolean); begin - PlaySound(snd, nil, keepPlaying); + PlaySoundV(snd, nil, keepPlaying); end; -procedure PlaySound(snd: TSound; voicepack: PVoicepack); +procedure PlaySoundV(snd: TSound; voicepack: PVoicepack); begin - PlaySound(snd, voicepack, false); + PlaySoundV(snd, voicepack, false); end; -procedure PlaySound(snd: TSound; voicepack: PVoicepack; keepPlaying: boolean); +procedure PlaySoundV(snd: TSound; voicepack: PVoicepack; keepPlaying: boolean); var s:shortstring; begin if (not isSoundEnabled) or fastUntilLag then @@ -353,33 +325,33 @@ LastVoice.snd:= VoiceList[i].snd; LastVoice.voicepack:= VoiceList[i].voicepack; VoiceList[i].snd:= sndNone; - PlaySound(LastVoice.snd, LastVoice.voicepack) + PlaySoundV(LastVoice.snd, LastVoice.voicepack) end else LastVoice.snd:= sndNone; end; function LoopSound(snd: TSound): LongInt; begin - LoopSound:= LoopSound(snd, nil) + LoopSound:= LoopSoundV(snd, nil) end; function LoopSound(snd: TSound; fadems: LongInt): LongInt; begin - LoopSound:= LoopSound(snd, nil, fadems) + LoopSound:= LoopSoundV(snd, nil, fadems) end; -function LoopSound(snd: TSound; voicepack: PVoicepack): LongInt; +function LoopSoundV(snd: TSound; voicepack: PVoicepack): LongInt; begin voicepack:= voicepack; // avoid compiler hint - LoopSound:= LoopSound(snd, nil, 0) + LoopSoundV:= LoopSoundV(snd, nil, 0) end; -function LoopSound(snd: TSound; voicepack: PVoicepack; fadems: LongInt): LongInt; +function LoopSoundV(snd: TSound; voicepack: PVoicepack; fadems: LongInt): LongInt; var s: shortstring; begin if (not isSoundEnabled) or fastUntilLag then begin - LoopSound:= -1; + LoopSoundV:= -1; exit end; @@ -397,7 +369,7 @@ else WriteLnToConsole(msgOK) end; - LoopSound:= Mix_PlayChannelTimed(-1, voicepack^.chunks[snd], -1, -1) + LoopSoundV:= Mix_PlayChannelTimed(-1, voicepack^.chunks[snd], -1, -1) end else begin @@ -412,9 +384,9 @@ WriteLnToConsole(msgOK); end; if fadems > 0 then - LoopSound:= Mix_FadeInChannelTimed(-1, defVoicepack^.chunks[snd], -1, fadems, -1) + LoopSoundV:= Mix_FadeInChannelTimed(-1, defVoicepack^.chunks[snd], -1, fadems, -1) else - LoopSound:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], -1, -1); + LoopSoundV:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], -1, -1); end; end; @@ -430,7 +402,7 @@ end; end; -procedure StopSound(chn: LongInt); +procedure StopSoundChan(chn: LongInt); begin if not isSoundEnabled then exit; @@ -439,7 +411,7 @@ Mix_HaltChannel(chn); end; -procedure StopSound(chn, fadems: LongInt); +procedure StopSoundChan(chn, fadems: LongInt); begin if not isSoundEnabled then exit; @@ -466,6 +438,11 @@ SDLTry(Mix_FadeInMusic(Mus, -1, 3000) <> -1, false) end; +procedure SetVolume(volume: LongInt); +begin + cInitVolume:= volume; +end; + function ChangeVolume(voldelta: LongInt): LongInt; begin ChangeVolume:= 0; @@ -475,7 +452,9 @@ inc(Volume, voldelta); if Volume < 0 then Volume:= 0; + // apply Volume to all channels Mix_Volume(-1, Volume); + // get assigned Volume Volume:= Mix_Volume(-1, -1); if isMusicEnabled then Mix_VolumeMusic(Volume * 4 div 8); @@ -490,7 +469,19 @@ procedure UndampenAudio; begin -ChangeVolume(previousVolume - Volume); + ChangeVolume(previousVolume - Volume); +end; + +procedure SetMusic(enabled: boolean); +begin + isMusicEnabled:= enabled; + MusicFN:= ''; +end; + +procedure SetMusicName(musicname: shortstring); +begin + isMusicEnabled:= not (musicname = ''); + MusicFN:= musicname; end; procedure PauseMusic; @@ -511,8 +502,9 @@ Mix_ResumeMusic(Mus); end; -procedure ChangeMusic; +procedure ChangeMusic(musicname: shortstring); begin + MusicFN:= musicname; if (MusicFN = '') or (not isMusicEnabled) then exit; @@ -543,9 +535,33 @@ end; procedure initModule; +var t: LongInt; + i: TSound; begin RegisterVariable('voicepack', @chVoicepack, false); + MusicFN:=''; + isMusicEnabled:= true; + isSoundEnabled:= true; + isSEBackup:= isSoundEnabled; + cInitVolume:= 100; + Volume:= 0; + defVoicepack:= AskForVoicepack('Default'); + + for i:= Low(TSound) to High(TSound) do + lastChan[i]:= -1; + + // initialize all voices to nil so that they can be loaded lazily + for t:= 0 to cMaxTeams do + if voicepacks[t].name <> '' then + for i:= Low(TSound) to High(TSound) do + voicepacks[t].chunks[i]:= nil; + + (* on MOBILE SDL_mixer has to be compiled against Tremor (USE_OGG_TREMOR) + or sound files bigger than 32k will lockup the game*) + for i:= Low(TSound) to High(TSound) do + defVoicepack^.chunks[i]:= nil; + end; procedure freeModule; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uStore.pas --- a/hedgewars/uStore.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uStore.pas Tue May 22 11:19:32 2012 +0200 @@ -21,7 +21,7 @@ unit uStore; interface -uses sysutils, uConsts, SDLh, GLunit, uTypes, uLandTexture, uCaptions, uChat; +uses SysUtils, uConsts, SDLh, GLunit, uTypes, uLandTexture, uCaptions, uChat; procedure initModule; procedure freeModule; @@ -41,13 +41,22 @@ procedure FreeWeaponTooltip; procedure MakeCrossHairs; +procedure WarpMouse(x, y: Word); inline; +procedure SwapBuffers; inline; + implementation -uses uMisc, uConsole, uMobile, uVariables, uUtils, uTextures, uRender, uRenderUtils, uCommands, uDebug, uWorld; +uses uMisc, uConsole, uMobile, uVariables, uUtils, uTextures, uRender, uRenderUtils, uCommands, + uDebug{$IFDEF USE_CONTEXT_RESTORE}, uWorld{$ENDIF}; //type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple); var MaxTextureSize: LongInt; -// cGPUVendor: TGPUVendor; +{$IFDEF SDL13} + SDLwindow: PSDL_Window; + SDLGLcontext: PSDL_GLContext; +{$ELSE} + SDLPrimSurface: PSDL_Surface; +{$ENDIF} function WriteInRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: ansistring): TSDL_Rect; var w, h: LongInt; @@ -791,11 +800,7 @@ DrawTextureFromRect( -squaresize div 2, (cScreenHeight - squaresize) shr 1, @r, ProgrTex); -{$IFDEF SDL13} - SDL_GL_SwapWindow(SDLwindow); -{$ELSE} - SDL_GL_SwapBuffers(); -{$ENDIF} + SwapBuffers; inc(Step); end; @@ -1044,8 +1049,10 @@ //uTextures.freeModule; //DEBUG ONLY {$ENDIF} AddFileLog('Freeing old primary surface...'); + {$IFNDEF SDL13} SDL_FreeSurface(SDLPrimSurface); SDLPrimSurface:= nil; + {$ENDIF} {$ENDIF} end; @@ -1121,13 +1128,10 @@ begin RegisterVariable('fullscr', @chFullScr, true); - SDLPrimSurface:= nil; - - cScaleFactor:= 2.0; + cScaleFactor:= 0; Step:= 0; ProgrTex:= nil; SupportNPOTT:= false; -// cGPUVendor:= gvUnknown; // init all ammo name texture pointers for ai:= Low(TAmmoType) to High(TAmmoType) do @@ -1137,10 +1141,41 @@ // init all count texture pointers for i:= Low(CountTexz) to High(CountTexz) do CountTexz[i] := nil; +{$IFDEF SDL13} + SDLwindow:= nil; + SDLGLcontext:= nil; +{$ELSE} + SDLPrimSurface:= nil; +{$ENDIF} end; procedure freeModule; begin + StoreRelease(false); + TTF_Quit(); +{$IFDEF SDL13} + SDL_GL_DeleteContext(SDLGLcontext); + SDL_DestroyWindow(SDLwindow); +{$ENDIF} + SDL_Quit(); +end; + +procedure WarpMouse(x, y: Word); inline; +begin +{$IFDEF SDL13} + SDL_WarpMouseInWindow(SDLwindow, x, y); +{$ELSE} + x:= x; y:= y; // avoid hints +{$ENDIF} +end; + +procedure SwapBuffers; inline; +begin +{$IFDEF SDL13} + SDL_GL_SwapWindow(SDLwindow); +{$ELSE} + SDL_GL_SwapBuffers(); +{$ENDIF} end; end. diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uTeams.pas Tue May 22 11:19:32 2012 +0200 @@ -20,7 +20,8 @@ unit uTeams; interface -uses uConsts, uInputHandler, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, GLunit, uSound, uTypes{$IFDEF USE_TOUCH_INTERFACE}, uWorld{$ENDIF}; +uses uConsts, uInputHandler, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, GLunit, uSound, + uTypes{$IFDEF USE_TOUCH_INTERFACE}, uWorld{$ENDIF}; procedure initModule; procedure freeModule; @@ -36,10 +37,11 @@ procedure TeamGoneEffect(var Team: TTeam); implementation -uses uLocale, uAmmos, uChat, uMobile, uVariables, uUtils, uIO, uCaptions, uCommands, uDebug, uScript, +uses uLocale, uAmmos, uChat, uVariables, uUtils, uIO, uCaptions, uCommands, uDebug, uScript, uGearsUtils, uGearsList{$IFDEF SDL13}, uTouch{$ENDIF}; var MaxTeamHealth: LongInt; + GameOver: boolean; function CheckForWin: boolean; var AliveClan: PClan; @@ -299,7 +301,6 @@ ReadyTimeLeft:= 0 end; -uMobile.NewTurnBeginning(); {$IFDEF SDL13} uTouch.NewTurnBeginning(); {$ENDIF} diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uTouch.pas --- a/hedgewars/uTouch.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uTouch.pas Tue May 22 11:19:32 2012 +0200 @@ -22,7 +22,7 @@ interface -uses sysutils, uConsole, uVariables, SDLh, uFloat, uConsts, uCommands, uIO, GLUnit, uTypes, uCaptions, uAmmos, uWorld; +uses SysUtils, uConsole, uVariables, SDLh, uFloat, uConsts, uCommands, uIO, GLUnit, uTypes, uCaptions, uAmmos, uWorld; procedure initModule; @@ -239,8 +239,8 @@ if aimingCrosshair then begin aimingCrosshair:= false; - upKey:= false; - downKey:= false; + ParseTeamCommand('-up'); + ParseTeamCommand('-down'); dec(buttonsDown); end; @@ -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; @@ -418,7 +418,7 @@ begin targetted:= false; targetting:= false; -SetUtilityWidgetState; +SetUtilityWidgetState(amNothing); end; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uTypes.pas --- a/hedgewars/uTypes.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uTypes.pas Tue May 22 11:19:32 2012 +0200 @@ -322,8 +322,8 @@ voicepack: PVoicePack; end; + THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo; PHHAmmo = ^THHAmmo; - THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo; THedgehog = record Name: shortstring; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uUtils.pas --- a/hedgewars/uUtils.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uUtils.pas Tue May 22 11:19:32 2012 +0200 @@ -65,16 +65,17 @@ function GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt; function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt; -procedure initModule; +procedure initModule(isGame: boolean); procedure freeModule; implementation -uses typinfo, Math, uConsts, uVariables, SysUtils; +uses {$IFNDEF PAS2C}typinfo, {$ENDIF}Math, uConsts, uVariables, SysUtils; {$IFDEF DEBUGFILE} var f: textfile; {$ENDIF} +var CharArray: array[byte] of Char; // should this include "strtolower()" for the split string? procedure SplitBySpace(var a, b: shortstring); @@ -87,7 +88,7 @@ if (a[t] >= 'A')and(a[t] <= 'Z') then Inc(a[t], 32); b:= copy(a, i + 1, Length(a) - i); - byte(a[0]):= Pred(i) + a[0]:= char(Pred(i)) end else b:= ''; @@ -236,9 +237,9 @@ if s[i] = '=' then inc(c); if t > 0 then - byte(s[i]):= t - 1 + s[i]:= char(t - 1) else - byte(s[i]):= 0 + s[i]:= #0 end; i:= 1; @@ -255,11 +256,10 @@ if c < 3 then t:= t - c; -byte(DecodeBase64[0]):= t - 1 +DecodeBase64[0]:= char(t - 1) end; -var CharArray: array[byte] of Char; function Str2PChar(const s: shortstring): PChar; begin CharArray:= s; @@ -359,14 +359,21 @@ CheckNoTeamOrHH:= (CurrentTeam = nil) or (CurrentHedgehog^.Gear = nil); end; -procedure initModule; -{$IFDEF DEBUGFILE}{$IFNDEF MOBILE}var i: LongInt;{$ENDIF}{$ENDIF} +procedure initModule(isGame: boolean); +{$IFDEF DEBUGFILE} +var logfileBase: shortstring; +{$IFNDEF MOBILE}var i: LongInt;{$ENDIF} +{$ENDIF} begin {$IFDEF DEBUGFILE} + if isGame then + logfileBase:= 'game' + else + logfileBase:= 'preview'; {$I-} {$IFDEF MOBILE} - {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + cLogfileBase + '.log'); {$ENDIF} - {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + cLogfileBase + '.log'); {$ENDIF} + {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + logfileBase + '.log'); {$ENDIF} + {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + logfileBase + '.log'); {$ENDIF} Rewrite(f); {$ELSE} if (UserPathPrefix <> '') then @@ -374,7 +381,7 @@ i:= 0; while(i < 7) do begin - assign(f, UserPathPrefix + '/Logs/' + cLogfileBase + inttostr(i) + '.log'); + assign(f, UserPathPrefix + '/Logs/' + logfileBase + inttostr(i) + '.log'); rewrite(f); if IOResult = 0 then break; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uVariables.pas Tue May 22 11:19:32 2012 +0200 @@ -37,11 +37,8 @@ cBits : LongInt = 32; ipcPort : Word = 0; cFullScreen : boolean = false; - isSoundEnabled : boolean = true; - isMusicEnabled : boolean = false; cLocaleFName : shortstring = 'en.txt'; cLocale : shortstring = 'en'; - cInitVolume : LongInt = 100; cTimerInterval : LongInt = 8; PathPrefix : shortstring = './'; UserPathPrefix : shortstring = './'; @@ -53,27 +50,21 @@ UserNick : shortstring = ''; recordFileName : shortstring = ''; cReadyDelay : Longword = 5000; - cLogfileBase : shortstring = 'debug'; cStereoMode : TStereoMode = smNone; cOnlyStats : boolean = False; ////////////////////////// cMapName : shortstring = ''; - alsoShutdownFrontend: boolean = false; - isCursorVisible : boolean; - isTerminated : boolean; isInLag : boolean; isPaused : boolean; - - isSEBackup : boolean; isInMultiShoot : boolean; isSpeed : boolean; - isFirstFrame : boolean; fastUntilLag : boolean; autoCameraOn : boolean; + GameTicks : LongWord; GameState : TGameState; GameType : TGameType; InputMask : LongWord; @@ -108,22 +99,10 @@ cWaterLine : Word; cGearScrEdgesDist: LongInt; - GameTicks : LongWord; - // originally typed consts - CharArray: array[byte] of Char; - LastTint: Longword; - SocketString: shortstring; - VGCounter: Longword; - PrevX: LongInt; - timedelta: Longword; - StartTicks: Longword; - Counter: Longword; - StepTicks: LongWord; ExplosionBorderColor: LongWord; WaterOpacity: byte; SDWaterOpacity: byte; - prevGState: TGameState; GrayScale: Boolean; // originally from uConsts @@ -134,7 +113,6 @@ LAND_HEIGHT : Word; LAND_WIDTH_MASK : LongWord; LAND_HEIGHT_MASK : LongWord; - cMaxCaptions : LongInt; cLeftScreenBorder : LongInt; cRightScreenBorder : LongInt; @@ -153,7 +131,6 @@ bBetweenTurns : boolean; bWaterRising : boolean; - //ShowCrosshair : boolean; This variable is inconvenient to set. Easier to decide when rendering CrosshairX : LongInt; CrosshairY : LongInt; CursorMovementX : LongInt; @@ -184,7 +161,6 @@ WaterColorArray : array[0..3] of HwColor4f; SDWaterColorArray : array[0..3] of HwColor4f; - SDMusic : shortstring; SDTint : LongInt; CursorPoint : TPoint; @@ -196,12 +172,6 @@ Theme : shortstring; disableLandBack : boolean; - conversionFormat: PSDL_PixelFormat; - -{$IFDEF SDL13} - SDLwindow : PSDL_Window; - SDLGLcontext : PSDL_GLContext; -{$ENDIF} WorldDx: LongInt; WorldDy: LongInt; @@ -230,10 +200,9 @@ firebutton, jumpWidget, AMWidget : TOnScreenWidget; pauseButton, utilityWidget : TOnScreenWidget; {$ENDIF} - AMAnimType : LongInt; -const +var // these consts are here because they would cause circular dependencies in uConsts/uTypes cPathz: array[TPathType] of shortstring = ( '', // ptNone @@ -2287,7 +2256,6 @@ Probability: 20; NumberInCase: 1; Ammo: (Propz: ammoprop_NoRoundEnd or - ammoprop_NeedTarget or ammoprop_Utility; Count: 1; NumPerTurn: 0; @@ -2318,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; @@ -2406,10 +2374,8 @@ LandDirty: TDirtyTag; hasBorder: boolean; hasGirders: boolean; - isMap: boolean; playHeight, playWidth, leftX, rightX, topY, MaxHedgehogs: Longword; // idea is that a template can specify height/width. Or, a map, a height/width by the dimensions of the image. If the map has pixels near top of image, it triggers border. LandBackSurface: PSDL_Surface; - digest: shortstring; CurAmmoGear: PGear; lastGearByUID: PGear; GearsList: PGear; @@ -2420,7 +2386,6 @@ SuddenDeathDmg: Boolean; SpeechType: Longword; SpeechText: shortstring; - skipFlag: boolean; PlacingHogs: boolean; // a convenience flag to indicate placement of hogs is still in progress StepSoundTimer: LongInt; StepSoundChannel: LongInt; @@ -2436,7 +2401,6 @@ LocalTeam: LongInt; // last non-bot, non-extdriven clan first team LocalAmmo: LongInt; // last non-bot, non-extdriven clan's first team's ammo index, updated to next upcoming hog for per-hog-ammo CurMinAngle, CurMaxAngle: Longword; - GameOver: boolean; NextClan: boolean; FollowGear: PGear; @@ -2457,7 +2421,6 @@ bAFRRight: Boolean; - SDLPrimSurface: PSDL_Surface; PauseTexture, SyncTexture, ConfirmTexture: PTexture; @@ -2498,6 +2461,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 @@ -2547,7 +2512,6 @@ SDWaterColorArray[1]:= SDWaterColorArray[0]; SDWaterColorArray[3]:= SDWaterColorArray[2]; - SDMusic:= 'hell.ogg'; SDTint:= $80; cDrownSpeed.QWordValue := 257698038; // 0.06 @@ -2608,14 +2572,11 @@ bBetweenTurns := false; bWaterRising := false; isCursorVisible := false; - isTerminated := false; isInLag := false; isPaused := false; isInMultiShoot := false; isSpeed := false; fastUntilLag := false; - isFirstFrame := true; - isSEBackup := true; autoCameraOn := true; cScriptName := ''; cSeed := ''; @@ -2628,21 +2589,11 @@ ScreenFade := sfNone; -{$IFDEF SDL13} - SDLwindow := nil; - SDLGLcontext := nil; -{$ENDIF} - // those values still are not perfect cLeftScreenBorder:= round(-cMinZoomLevel * cScreenWidth); cRightScreenBorder:= round(cMinZoomLevel * cScreenWidth + LAND_WIDTH); cScreenSpace:= cRightScreenBorder - cLeftScreenBorder; - if isPhone() then - cMaxCaptions:= 3 - else - cMaxCaptions:= 4; - vobFrameTicks:= 99999; vobFramesCount:= 4; vobCount:= 0; @@ -2655,14 +2606,9 @@ vobSDVelocity:= 15; vobSDFallSpeed:= 250; - PrevX:= 0; - timedelta:= 0; - Counter:= 0; - StepTicks:= 0; ExplosionBorderColor:= $FF808080; WaterOpacity:= $80; SDWaterOpacity:= $80; - prevGState:= gsConfirm; GrayScale:= false; LuaGoals:= ''; @@ -2676,10 +2622,7 @@ cBits := 32; ipcPort := 0; cFullScreen := false; - isSoundEnabled := true; - isMusicEnabled := false; cLocaleFName := 'en.txt'; - cInitVolume := 100; cTimerInterval := 8; PathPrefix := './'; UserPathPrefix := './'; diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uVisualGears.pas Tue May 22 11:19:32 2012 +0200 @@ -56,6 +56,7 @@ uses uSound, uMobile, uVariables, uTextures, uRender, Math, uRenderUtils, uStore, uUtils; const cExplFrameTicks = 110; +var VGCounter: LongWord; // For better maintainability the step handlers of visual gears are stored // in a separate file. diff -r 846cea23aea2 -r c91d33837b0d hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Thu May 03 22:48:02 2012 +0200 +++ b/hedgewars/uWorld.pas Tue May 22 11:19:32 2012 +0200 @@ -78,6 +78,8 @@ missionTex: PTexture; missionTimer: LongInt; stereoDepth: GLfloat; + isFirstFrame: boolean; + AMAnimType: LongInt; const cStereo_Sky = 0.0500; cStereo_Horizon = 0.0250; @@ -94,7 +96,7 @@ if (GameFlags and gf) <> 0 then begin t:= inttostr(i); - s:= s + format(trgoal[si], t) + '|' + s:= s + FormatA(trgoal[si], t) + '|' end; AddGoal:= s; end; @@ -382,7 +384,7 @@ STurns: LongInt; amSurface: PSDL_Surface; AMRect: TSDL_Rect; - tmpsurf: PSDL_Surface; +{$IFDEF USE_AM_NUMCOLUMN}tmpsurf: PSDL_Surface;{$ENDIF} begin SlotsNum:= 0; for i:= 0 to cMaxSlotIndex do @@ -1751,7 +1753,7 @@ procedure SetUtilityWidgetState(ammoType: TAmmoType); begin -{$IFDEF TOUCH_INTERFACE} +{$IFDEF USE_TOUCH_INTERFACE} if(ammoType = amNothing)then ammoType:= CurrentHedgehog^.CurAmmoType; @@ -1802,37 +1804,38 @@ procedure initModule; begin -fpsTexture:= nil; -FollowGear:= nil; -WindBarWidth:= 0; -bShowAmmoMenu:= false; -bSelected:= false; -bShowFinger:= false; -Frames:= 0; -WorldDx:= -512; -WorldDy:= -256; + fpsTexture:= nil; + FollowGear:= nil; + WindBarWidth:= 0; + bShowAmmoMenu:= false; + bSelected:= false; + bShowFinger:= false; + Frames:= 0; + WorldDx:= -512; + WorldDy:= -256; -FPS:= 0; -CountTicks:= 0; -SoundTimerTicks:= 0; -prevPoint.X:= 0; -prevPoint.Y:= 0; -missionTimer:= 0; -missionTex:= nil; -cOffsetY:= 0; -stereoDepth:= 0; -AMState:= AMHidden; + FPS:= 0; + CountTicks:= 0; + SoundTimerTicks:= 0; + prevPoint.X:= 0; + prevPoint.Y:= 0; + missionTimer:= 0; + missionTex:= nil; + cOffsetY:= 0; + stereoDepth:= 0; + AMState:= AMHidden; + isFirstFrame:= true; end; procedure freeModule; begin -stereoDepth:= stereoDepth; // avoid hint -FreeTexture(fpsTexture); -fpsTexture:= nil; -FreeTexture(timeTexture); -timeTexture:= nil; -FreeTexture(missionTex); -missionTex:= nil + stereoDepth:= stereoDepth; // avoid hint + FreeTexture(fpsTexture); + fpsTexture:= nil; + FreeTexture(timeTexture); + timeTexture:= nil; + FreeTexture(missionTex); + missionTex:= nil end; end. diff -r 846cea23aea2 -r c91d33837b0d misc/liblua/CMakeLists.txt --- a/misc/liblua/CMakeLists.txt Thu May 03 22:48:02 2012 +0200 +++ b/misc/liblua/CMakeLists.txt Tue May 22 11:19:32 2012 +0200 @@ -1,19 +1,17 @@ +#this file is included only when system Lua library is not found + file(GLOB lua_src *.c *.h) set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) -IF(APPLE) - set(build_type STATIC) - add_definitions(-DLUA_USE_LINUX) - add_library (lua ${build_type} ${lua_src}) -ENDIF(APPLE) +if(WIN32) + add_definitions(-DLUA_BUILD_AS_DLL) + add_library(lua SHARED ${lua_src}) -IF(WIN32) - set(build_type SHARED) - add_definitions(-DLUA_BUILD_AS_DLL) - add_library (lua ${build_type} ${lua_src}) - - SET_TARGET_PROPERTIES(lua PROPERTIES PREFIX "") - install(TARGETS lua RUNTIME DESTINATION ${target_dir}) + set_target_properties(lua PROPERTIES PREFIX "") + install(TARGETS lua RUNTIME DESTINATION ${target_dir}) +else(WIN32) + add_definitions(-DLUA_USE_LINUX) + add_library(lua STATIC ${lua_src}) endif(WIN32) diff -r 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 Thu May 03 22:48:02 2012 +0200 +++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/FrontendDataUtils.java Tue May 22 11:19:32 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 846cea23aea2 -r c91d33837b0d 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 Thu May 03 22:48:02 2012 +0200 +++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Weapon.java Tue May 22 11:19:32 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 846cea23aea2 -r c91d33837b0d 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 Thu May 03 22:48:02 2012 +0200 +++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/SDLActivity.java Tue May 22 11:19:32 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 846cea23aea2 -r c91d33837b0d project_files/Android-build/Templates/Makefile.android --- a/project_files/Android-build/Templates/Makefile.android Thu May 03 22:48:02 2012 +0200 +++ b/project_files/Android-build/Templates/Makefile.android Tue May 22 11:19:32 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 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/GameConfigViewController.h --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.h Thu May 03 22:48:02 2012 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.h Tue May 22 11:19:32 2012 +0200 @@ -23,7 +23,7 @@ @class SchemeWeaponConfigViewController; @class TeamConfigViewController; @class MapConfigViewController; -@class HelpPageLobbyViewController; +//@class HelpPageLobbyViewController; @interface GameConfigViewController : UIViewController { UIView *imgContainer; @@ -33,7 +33,7 @@ SchemeWeaponConfigViewController *schemeWeaponConfigViewController; TeamConfigViewController *teamConfigViewController; MapConfigViewController *mapConfigViewController; - HelpPageLobbyViewController *helpPage; + //HelpPageLobbyViewController *helpPage; } @property (retain) UIView *imgContainer; @@ -42,7 +42,7 @@ @property (nonatomic,retain) IBOutlet SchemeWeaponConfigViewController *schemeWeaponConfigViewController; @property (nonatomic,retain) IBOutlet TeamConfigViewController *teamConfigViewController; @property (nonatomic,retain) IBOutlet MapConfigViewController *mapConfigViewController; -@property (nonatomic,retain) HelpPageLobbyViewController *helpPage; +//@property (nonatomic,retain) HelpPageLobbyViewController *helpPage; -(IBAction) buttonPressed:(id) sender; -(IBAction) segmentPressed:(id) sender; diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/GameConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Thu May 03 22:48:02 2012 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Tue May 22 11:19:32 2012 +0200 @@ -21,12 +21,11 @@ #import "MapConfigViewController.h" #import "TeamConfigViewController.h" #import "SchemeWeaponConfigViewController.h" -#import "HelpPageLobbyViewController.h" #import "GameInterfaceBridge.h" @implementation GameConfigViewController -@synthesize imgContainer, helpPage, titleImage, sliderBackground, +@synthesize imgContainer, titleImage, sliderBackground, //helpPage, mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController; -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { @@ -67,6 +66,7 @@ break; case 2: [[AudioManagerController mainManager] playClickSound]; + /* if (self.helpPage == nil) self.helpPage = [[HelpPageLobbyViewController alloc] initWithNibName:@"HelpPageLobbyViewController-iPad" bundle:nil]; self.helpPage.view.alpha = 0; @@ -74,6 +74,7 @@ [UIView beginAnimations:@"helplobby" context:NULL]; self.helpPage.view.alpha = 1; [UIView commitAnimations]; + */ break; default: DLog(@"Nope"); @@ -103,6 +104,7 @@ [self.view bringSubviewToFront:schemeWeaponConfigViewController.view]; break; case 3: + /* if (helpPage == nil) { helpPage = [[HelpPageLobbyViewController alloc] initWithNibName:@"HelpPageLobbyViewController-iPhone" bundle:nil]; [self.view addSubview:helpPage.view]; @@ -110,6 +112,7 @@ // this message is compulsory otherwise the table won't be loaded at all [helpPage viewWillAppear:NO]; [self.view bringSubviewToFront:helpPage.view]; + */ break; default: DLog(@"Nope"); @@ -394,8 +397,8 @@ self.teamConfigViewController = nil; if (self.schemeWeaponConfigViewController.view.superview == nil) self.schemeWeaponConfigViewController = nil; - if (self.helpPage.view.superview == nil) - self.helpPage = nil; + //if (self.helpPage.view.superview == nil) + // self.helpPage = nil; MSG_MEMCLEAN(); [super didReceiveMemoryWarning]; } @@ -407,7 +410,7 @@ self.schemeWeaponConfigViewController = nil; self.teamConfigViewController = nil; self.mapConfigViewController = nil; - self.helpPage = nil; + //self.helpPage = nil; MSG_DIDUNLOAD(); [super viewDidUnload]; } @@ -419,7 +422,7 @@ releaseAndNil(schemeWeaponConfigViewController); releaseAndNil(teamConfigViewController); releaseAndNil(mapConfigViewController); - releaseAndNil(helpPage); + //releaseAndNil(helpPage); [super dealloc]; } diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/HWUtils.h --- a/project_files/HedgewarsMobile/Classes/HWUtils.h Thu May 03 22:48:02 2012 +0200 +++ b/project_files/HedgewarsMobile/Classes/HWUtils.h Tue May 22 11:19:32 2012 +0200 @@ -41,7 +41,7 @@ +(NSInteger) randomPort; +(void) freePort:(NSInteger) port; +(BOOL) isNetworkReachable; -+(UIView *)mainSDLViewInstance; +//+(UIView *)mainSDLViewInstance; @end diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/HWUtils.m --- a/project_files/HedgewarsMobile/Classes/HWUtils.m Thu May 03 22:48:02 2012 +0200 +++ b/project_files/HedgewarsMobile/Classes/HWUtils.m Tue May 22 11:19:32 2012 +0200 @@ -157,6 +157,7 @@ return ((isReachable && !needsConnection) || nonWiFi) ? testResult : NO; } +/* +(UIView *)mainSDLViewInstance { SDL_Window *window = HW_getSDLWindow(); if (window == NULL) { @@ -167,5 +168,6 @@ SDL_uikitview *view = data != NULL ? data->view : nil; return view; } +*/ @end diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/HelpPageInGameViewController-iPad.xib --- a/project_files/HedgewarsMobile/Classes/HelpPageInGameViewController-iPad.xib Thu May 03 22:48:02 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,922 +0,0 @@ - - - - 1056 - 10K549 - 823 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 292 - - YES - - - 292 - {{0, -1}, {1024, 768}} - - NO - NO - IBIPadFramework - - NSImage - helpingame.png - - - - - 292 - {{79, 473}, {150, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Direction buttons - - Helvetica-Bold - 18 - 16 - - - 1 - MCAwIDAAA - - - 1 - 10 - - - - 292 - {{79, 491}, {203, 85}} - - NO - YES - 7 - NO - IBIPadFramework - With these buttons you can move your hog, aim and control certain weapons. - - Helvetica - 16 - 16 - - - - 1 - 10 - 0 - - - - 292 - {{53, 97}, {186, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Timer - - - - 1 - 10 - - - - 292 - {{53, 118}, {187, 43}} - - NO - YES - 7 - NO - IBIPadFramework - Don't let your turn time run out! - - - - 1 - 10 - 0 - - - - 292 - {{780, 248}, {240, 128}} - - NO - NO - IBIPadFramework - - NSImage - helpright.png - - - - - 292 - {{790, 256}, {109, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Ammo Menu - - - - 1 - 10 - - - - 292 - {{790, 282}, {214, 84}} - - NO - YES - 7 - NO - IBIPadFramework - This menu contains all the weapons you can use. Drag your finger on a weapon for more details on what it does! - - - - 1 - 10 - 0 - - - - 292 - {{780, 97}, {186, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Pause / Open ammos - - - - 1 - 10 - - - - 292 - {{782, 118}, {187, 43}} - - NO - YES - 7 - NO - IBIPadFramework - Tap to pause or open the ammo menu. - - - - 1 - 10 - 0 - - - - 292 - {{418, 73}, {186, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Wind bar - - - - 1 - 10 - - - - 292 - {{418, 89}, {191, 63}} - - NO - YES - 7 - NO - IBIPadFramework - Some weapons are affected by the wind and their direction may shift. - - - - 1 - 10 - 0 - - - - 292 - {{447, 573}, {203, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Teams flags and health - - - - 1 - 10 - - - - 292 - {{447, 592}, {203, 85}} - - NO - YES - 7 - NO - IBIPadFramework - These bars report the team name, the team flags and the global health status of every hog. - - - - 1 - 10 - 4 - - - - 292 - {{741, 501}, {135, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Joypad buttons - - - - 1 - 10 - - - - 292 - {{741, 520}, {211, 85}} - - NO - YES - 7 - NO - IBIPadFramework - Press X to jump forward, Y to jump backwards (double tap to jump twice) and Missile to attack or use items. - - - - 1 - 10 - 0 - - - - 292 - {{67, 238}, {240, 128}} - - NO - NO - IBIPadFramework - - NSImage - helpplain.png - - - - - 292 - {{72, 246}, {229, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Tap to return to game - - - - 1 - 10 - 1 - - - - 292 - {{72, 268}, {229, 87}} - - NO - YES - 7 - NO - IBIPadFramework - Pan to move camera, pinch to zoom, double tap to center hog, and a single touch to interact with weapons and much more! - - - - 1 - 10 - 0 - - - {1024, 768} - - - 3 - MCAwLjQAA - - NO - NO - - 3 - - IBIPadFramework - - - - - YES - - - view - - - - 3 - - - - dismiss - - - 7 - - 16 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - YES - - - - - - - - - - - - - - - - - - - - - - - - 5 - - - - - 6 - - - - - 7 - - - - - 8 - - - - - 9 - - - - - 10 - - - - - 11 - - - - - 12 - - - - - 13 - - - - - 14 - - - - - 17 - - - - - 18 - - - - - 21 - - - - - 22 - - - - - 23 - - - - - 24 - - - - - 25 - - - - - 26 - - - - - 27 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 10.IBPluginDependency - 11.IBPluginDependency - 12.IBPluginDependency - 13.IBPluginDependency - 14.IBPluginDependency - 17.IBPluginDependency - 18.IBPluginDependency - 2.CustomClassName - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - 21.IBPluginDependency - 22.IBPluginDependency - 23.IBPluginDependency - 24.IBPluginDependency - 25.IBPluginDependency - 26.IBPluginDependency - 27.IBPluginDependency - 5.IBPluginDependency - 6.IBPluginDependency - 7.IBPluginDependency - 8.IBPluginDependency - 9.IBPluginDependency - - - YES - HelpPageInGameViewController - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIControl - {{288, 355}, {1024, 768}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 27 - - - - YES - - HelpPageInGameViewController - UIViewController - - dismiss - id - - - dismiss - - dismiss - id - - - - scrollView - UIScrollView - - - scrollView - - scrollView - UIScrollView - - - - IBProjectSource - Classes/HelpPageInGameViewController.h - - - - UILabel - - IBProjectSource - Classes/ExtraCategories.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIImageView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIImageView.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - - YES - - YES - helpingame.png - helpplain.png - helpright.png - - - YES - {1024, 768} - {296, 138} - {308, 144} - - - 132 - - diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/HelpPageInGameViewController-iPhone.xib --- a/project_files/HedgewarsMobile/Classes/HelpPageInGameViewController-iPhone.xib Thu May 03 22:48:02 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1021 +0,0 @@ - - - - 1056 - 10K549 - 823 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 292 - - YES - - - 274 - - YES - - - 292 - {{20, 283}, {150, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Direction buttons - - Helvetica-Bold - 18 - 16 - - - 1 - MCAwIDAAA - - - 1 - 10 - - - - 292 - {{20, 292}, {203, 85}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - With these buttons you can move your hog, aim and control certain weapons. - - Helvetica - 16 - 16 - - - - 1 - 10 - 0 - - - - 292 - {{20, 13}, {186, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Timer - - - - 1 - 10 - - - - 292 - {{20, 34}, {187, 43}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Don't let your turn time run out! - - - - 1 - 10 - 0 - - - - 292 - {{217, 308}, {243, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Touch interface - - - - 1 - 10 - 2 - - - - 292 - {{231, 328}, {229, 87}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Pan to move camera, pinch to zoom, double tap to center hog, and a single touch to interact with weapons and much more! - - - - 1 - 10 - 0 - 2 - - - - 292 - {{20, 85}, {186, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Wind bar - - - - 1 - 10 - - - - 292 - {{20, 101}, {191, 63}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Some weapons are affected by the wind and their direction may shift. - - - - 1 - 10 - 0 - - - - 292 - {{20, 172}, {203, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Teams flags and health - - - - 1 - 10 - - - - 292 - {{20, 191}, {203, 85}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - These bars report the team name, the team flags and the global health status of every hog. - - - - 1 - 10 - 4 - - - - 292 - {{274, 13}, {186, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Pause / Open ammos - - - - 1 - 10 - 2 - - - - 292 - {{273, 35}, {187, 43}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Tap to pause or open the ammo menu. - - - - 1 - 10 - 0 - 2 - - - - 292 - {{351, 82}, {109, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Ammo Menu - - - - 1 - 10 - 2 - - - - 292 - {{246, 105}, {214, 84}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - This menu contains all the weapons you can use. Drag your finger on a weapon for more details on what it does! - - - - 1 - 10 - 0 - 2 - - - - 292 - {{325, 197}, {135, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Joypad buttons - - - - 1 - 10 - 2 - - - - 292 - {{249, 217}, {211, 85}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Press X to jump forward, Y to jump backwards (double tap to jump twice) and Missile to attack or use items. - - - - 1 - 10 - 0 - 2 - - - {{-5, 44}, {489, 332}} - - YES - YES - 1 - IBCocoaTouchFramework - - - - 290 - {{-1, 0}, {481, 44}} - - IBCocoaTouchFramework - - YES - - - Help page - - Back - IBCocoaTouchFramework - 1 - - - IBCocoaTouchFramework - - - - - {480, 320} - - - 2 - MC45OTYwNzg0OTEyIDAuOTg4MjM1MzU0NCAxAA - - NO - - 3 - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - dismiss - - - - 141 - - - - scrollView - - - - 142 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - YES - - - - - - - 118 - - - YES - - - - - - 121 - - - YES - - - - - - - - - - - - - - - - - - - - - 122 - - - - - 124 - - - - - 125 - - - - - 126 - - - - - 127 - - - - - 128 - - - - - 129 - - - - - 130 - - - - - 131 - - - - - 132 - - - - - 133 - - - - - 134 - - - - - 135 - - - - - 136 - - - - - 137 - - - - - 138 - - - - - 119 - - - YES - - - - - - 140 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 118.IBPluginDependency - 118.IBViewBoundsToFrameTransform - 119.IBPluginDependency - 121.IBEditorWindowLastContentRect - 121.IBPluginDependency - 121.IBViewBoundsToFrameTransform - 122.IBPluginDependency - 122.IBViewBoundsToFrameTransform - 124.IBPluginDependency - 124.IBViewBoundsToFrameTransform - 125.IBPluginDependency - 125.IBViewBoundsToFrameTransform - 126.IBPluginDependency - 126.IBViewBoundsToFrameTransform - 127.IBPluginDependency - 127.IBViewBoundsToFrameTransform - 128.IBPluginDependency - 128.IBViewBoundsToFrameTransform - 129.IBPluginDependency - 129.IBViewBoundsToFrameTransform - 130.IBPluginDependency - 130.IBViewBoundsToFrameTransform - 131.IBPluginDependency - 131.IBViewBoundsToFrameTransform - 132.IBPluginDependency - 132.IBViewBoundsToFrameTransform - 133.IBPluginDependency - 133.IBViewBoundsToFrameTransform - 134.IBPluginDependency - 134.IBViewBoundsToFrameTransform - 135.IBPluginDependency - 135.IBViewBoundsToFrameTransform - 136.IBPluginDependency - 136.IBViewBoundsToFrameTransform - 137.IBPluginDependency - 137.IBViewBoundsToFrameTransform - 138.IBPluginDependency - 138.IBViewBoundsToFrameTransform - 140.IBPluginDependency - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - 2.IBViewBoundsToFrameTransform - - - YES - HelpPageInGameViewController - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - AQAAAADAQAAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{589, 578}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - AcCgAABCMAAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDZwAAw7aAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABCVAAAwx8AAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAwnQAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABCxgAAwtYAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABCxgAAwyQAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw+SAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAxARAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw6aAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw8+AAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDZwAAw+EAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDiQAAwmwAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDiIAAwswAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDr4AAwwUAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDdgAAw1oAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDooAAw3gAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDeQAAw6aAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{165, 514}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAAAAAAAAw4kAAA - - - - - YES - - - YES - - - - - YES - - - YES - - - - 142 - - - - YES - - HelpPageInGameViewController - UIViewController - - dismiss - id - - - dismiss - - dismiss - id - - - - scrollView - UIScrollView - - - scrollView - - scrollView - UIScrollView - - - - IBProjectSource - Classes/HelpPageInGameViewController.h - - - - UILabel - - IBProjectSource - Classes/ExtraCategories.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIBarButtonItem - UIBarItem - - IBFrameworkSource - UIKit.framework/Headers/UIBarButtonItem.h - - - - UIBarItem - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIBarItem.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UINavigationBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UINavigationBar.h - - - - UINavigationItem - NSObject - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - 132 - - diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/HelpPageInGameViewController.h --- a/project_files/HedgewarsMobile/Classes/HelpPageInGameViewController.h Thu May 03 22:48:02 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2012 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - - -#import - - -@interface HelpPageInGameViewController : UIViewController { - UIScrollView *scrollView; -} - -@property (nonatomic, retain) IBOutlet UIScrollView *scrollView; - --(IBAction) dismiss; - -@end diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/HelpPageInGameViewController.m --- a/project_files/HedgewarsMobile/Classes/HelpPageInGameViewController.m Thu May 03 22:48:02 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2012 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - - -#import "HelpPageInGameViewController.h" - - -@implementation HelpPageInGameViewController -@synthesize scrollView; - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - --(void) didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - self.scrollView = nil; -} - -// on iPhone the XIBs contain UIScrollView --(void) viewDidLoad { - if (IS_IPAD() == NO) { - scrollView.contentSize = CGSizeMake(480,470); - scrollView.maximumZoomScale = 4.0; - scrollView.minimumZoomScale = 0.75; - scrollView.clipsToBounds = YES; - scrollView.delegate = self; - } - [super viewDidLoad]; -} - --(void) viewDidUnload { - [super viewDidUnload]; - self.scrollView = nil; -} - --(void) dealloc { - releaseAndNil(scrollView); - [super dealloc]; -} - --(IBAction) dismiss { - [UIView beginAnimations:@"dismiss help" context:NULL]; - self.view.alpha = 0; - [UIView commitAnimations]; - [self.view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1]; -} - -@end diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController-iPad.xib --- a/project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController-iPad.xib Thu May 03 22:48:02 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1137 +0,0 @@ - - - - 1056 - 10K549 - 823 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 292 - - YES - - - 292 - {{742, 389}, {240, 102}} - - NO - NO - IBIPadFramework - - NSImage - helpabove.png - - - - - 292 - {{753, 408}, {109, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Map theme - - Helvetica-Bold - 18 - 16 - - - 1 - MCAwIDAAA - - - 1 - 10 - - - - 292 - {{753, 425}, {218, 66}} - - NO - YES - 7 - NO - IBIPadFramework - Here you can choose how your map will appear in game. - - Helvetica - 16 - 16 - - - - 1 - 10 - 0 - - - - 292 - {{653, 202}, {240, 146}} - - NO - NO - IBIPadFramework - - - - - 292 - {{664, 223}, {109, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Map type - - - - 1 - 10 - - - - 292 - {{664, 244}, {218, 99}} - - NO - YES - 7 - NO - IBIPadFramework - Choose between a static map or a randomly generated one (might require more time). In a mission you need to perfom some action to win. - - - - 1 - 10 - 0 - - - - 292 - {{494, 20}, {240, 101}} - - NO - NO - IBIPadFramework - - NSImage - helpright.png - - - - - 292 - {{502, 25}, {109, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Map preview - - - - 1 - 10 - - - - 292 - {{502, 46}, {218, 65}} - - NO - YES - 7 - NO - IBIPadFramework - This is a small preview of your next map. Tap to select / generate a new map. - - - - 1 - 10 - 0 - - - - 292 - {{391, 389}, {242, 171}} - - NO - NO - IBIPadFramework - - - - - 292 - {{401, 413}, {109, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Teams - - - - 1 - 10 - - - - 292 - {{400, 434}, {232, 120}} - - NO - YES - 7 - NO - IBIPadFramework - Select which teams are playing! Add hogs by tapping on them and set their color to figure friend and foe teams out. AI teams will appear with a small robot badge next their name. - - - - 1 - 10 - 0 - - - - 292 - {{142, 125}, {240, 104}} - - NO - NO - IBIPadFramework - - NSImage - helpleft.png - - - - - 292 - {{162, 133}, {204, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Schemes and Weapons - - - - 1 - 10 - - - - 292 - {{162, 152}, {210, 71}} - - NO - YES - 7 - NO - IBIPadFramework - Here you can choose which rules and which weapon set will be applied in game. - - - - 1 - 10 - 0 - - - - 292 - {{155, 8}, {278, 50}} - - NO - NO - IBIPadFramework - - - - - 292 - {{177, 6}, {248, 54}} - - NO - YES - 7 - NO - IBIPadFramework - Did you know you can customize almost everything in the settings page? - - Helvetica-Oblique - 14 - 16 - - - - 1 - 10 - 0 - - - - 292 - {{686, 583}, {240, 117}} - - NO - NO - IBIPadFramework - - NSImage - helpbottom.png - - - - - 292 - {{697, 592}, {138, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Max hedgehogs - - - - 1 - 10 - - - - 292 - {{697, 609}, {218, 73}} - - NO - YES - 7 - NO - IBIPadFramework - This number is the maximum size for all the hogs playing (in every team). - - - - 1 - 10 - 0 - - - - 292 - {{20, 587}, {240, 109}} - - NO - NO - IBIPadFramework - - - - - 292 - {{30, 592}, {138, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Size slider - - - - 1 - 10 - - - - 292 - {{30, 608}, {218, 73}} - - NO - YES - 7 - NO - IBIPadFramework - For Random and Maze maps you can decide to generate only maps of a certain size. - - - - 1 - 10 - 0 - - - - 292 - {{45, 318}, {240, 128}} - - NO - NO - IBIPadFramework - - NSImage - helpplain.png - - - - - 292 - {{50, 326}, {229, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Tap anywhere to dismiss - - - - 1 - 10 - 1 - - - - 292 - {{52, 348}, {224, 87}} - - NO - YES - 7 - NO - IBIPadFramework - Still confused? Don't worry, it's really simple! Try a couple of games and everything will become clear to you. - - - - 1 - 10 - 0 - - - - 292 - {{344, 635}, {240, 61}} - - NO - NO - IBIPadFramework - - - - - 292 - {{353, 637}, {138, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Start button - - - - 1 - 10 - - - - 292 - {{354, 650}, {218, 46}} - - NO - YES - 7 - NO - IBIPadFramework - This button starts the game. - - - - 1 - 10 - 0 - - - {1024, 768} - - 3 - MCAwLjQAA - - NO - NO - - 3 - - IBIPadFramework - - - - - YES - - - view - - - - 3 - - - - dismiss - - - 7 - - 16 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - YES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6 - - - - - 7 - - - - - 8 - - - - - 25 - - - - - 26 - - - - - 27 - - - - - 28 - - - - - 29 - - - - - 30 - - - - - 34 - - - - - 35 - - - - - 36 - - - - - 37 - - - - - 38 - - - - - 39 - - - - - 40 - - - - - 41 - - - - - 42 - - - - - 43 - - - - - 44 - - - - - 45 - - - - - 49 - - - - - 50 - - - - - 51 - - - - - 52 - - - - - 53 - - - - - 54 - - - - - 58 - - - - - 59 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 2.CustomClassName - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - 25.IBPluginDependency - 26.IBPluginDependency - 27.IBPluginDependency - 28.IBPluginDependency - 29.IBPluginDependency - 30.IBPluginDependency - 34.IBPluginDependency - 35.IBPluginDependency - 36.IBPluginDependency - 37.IBPluginDependency - 38.IBPluginDependency - 39.IBPluginDependency - 40.IBPluginDependency - 41.IBPluginDependency - 42.IBPluginDependency - 43.IBPluginDependency - 44.IBPluginDependency - 45.IBPluginDependency - 49.IBPluginDependency - 50.IBPluginDependency - 51.IBPluginDependency - 52.IBPluginDependency - 53.IBPluginDependency - 54.IBPluginDependency - 58.IBPluginDependency - 59.IBPluginDependency - 6.IBPluginDependency - 7.IBPluginDependency - 8.IBPluginDependency - - - YES - HelpPageLobbyViewController - UIResponder - UIControl - {{273, 125}, {1024, 768}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 59 - - - - YES - - HelpPageLobbyViewController - UIViewController - - dismiss - id - - - dismiss - - dismiss - id - - - - scrollView - UIScrollView - - - scrollView - - scrollView - UIScrollView - - - - IBProjectSource - Classes/HelpPageLobbyViewController.h - - - - UILabel - - IBProjectSource - Classes/ExtraCategories.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIImageView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIImageView.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - - YES - - YES - helpabove.png - helpbottom.png - helpleft.png - helpplain.png - helpright.png - - - YES - {295, 156} - {295, 156} - {308, 144} - {296, 138} - {308, 144} - - - 132 - - diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController-iPhone.xib --- a/project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController-iPhone.xib Thu May 03 22:48:02 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,921 +0,0 @@ - - - - 1056 - 10K549 - 823 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 292 - - YES - - - 268 - - YES - - - 292 - {{20, 587}, {440, 52}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Still confused? Don't worry, it's really simple! Try a couple of games and everything will become clear to you. - - Helvetica - 16 - 16 - - - 1 - MCAwIDAAA - - - 1 - 10 - 0 - 1 - - - - 292 - {{20, 279}, {138, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Size slider - - Helvetica-Bold - 18 - 16 - - - - 1 - 10 - - - - 292 - {{20, 298}, {440, 44}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - For Random and Maze maps you can decide to generate only maps of a certain size. - - - - 1 - 10 - 0 - - - - 292 - {{20, 511}, {204, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Schemes and Weapons - - - - 1 - 10 - - - - 292 - {{20, 530}, {433, 45}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Here you can choose which rules and which weapon set will be applied in game. - - - - 1 - 10 - 0 - - - - 292 - {{20, 68}, {109, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Map preview - - - - 1 - 10 - - - - 292 - {{20, 88}, {440, 44}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - This is a small preview of your next map. Tap to select / generate a new map. - - - - 1 - 10 - 0 - - - - 292 - {{20, 140}, {109, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Map type - - - - 1 - 10 - - - - 292 - {{20, 164}, {440, 58}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Choose between a static map or a randomly generated one (might require more time). In a mission you need to perfom some action to win. - - - - 1 - 10 - 0 - - - - 292 - {{20, 229}, {109, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Map theme - - - - 1 - 10 - - - - 292 - {{20, 244}, {440, 33}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Here you can choose how your map will appear in game. - - - - 1 - 10 - 0 - - - - 292 - {{20, 347}, {138, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Max hedgehogs - - - - 1 - 10 - - - - 292 - {{20, 367}, {440, 41}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - This number is the maximum size for all the hogs playing (in every team). - - - - 1 - 10 - 0 - - - - 292 - {{20, 418}, {109, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Teams - - - - 1 - 10 - - - - 292 - {{20, 436}, {433, 66}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Select which teams are playing! Add hogs by tapping on them and set their color to figure friend and foe teams out. AI teams will appear with a small robot badge next their name. - - - - 1 - 10 - 0 - - - - 292 - {{13, 3}, {440, 60}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Here you can find help for the game configuration options. You can customize almost everything in the settings page. - - Helvetica-Oblique - 16 - 16 - - - - 1 - 10 - 0 - 1 - - - {480, 276} - - YES - YES - IBCocoaTouchFramework - - - {480, 276} - - - 2 - MC45OTYwNzg0OTEyIDAuOTg4MjM1MzU0NCAxAA - - NO - NO - - - 3 - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - scrollView - - - - 95 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - YES - - - - - - 60 - - - YES - - - - - - - - - - - - - - - - - - - - - 61 - - - - - 62 - - - - - 63 - - - - - 64 - - - - - 65 - - - - - 66 - - - - - 67 - - - - - 68 - - - - - 69 - - - - - 70 - - - - - 71 - - - - - 72 - - - - - 73 - - - - - 74 - - - - - 75 - - - - - 76 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - 60.IBPluginDependency - 60.IBViewBoundsToFrameTransform - 61.IBPluginDependency - 61.IBViewBoundsToFrameTransform - 62.IBPluginDependency - 62.IBViewBoundsToFrameTransform - 63.IBPluginDependency - 63.IBViewBoundsToFrameTransform - 64.IBPluginDependency - 64.IBViewBoundsToFrameTransform - 65.IBPluginDependency - 65.IBViewBoundsToFrameTransform - 66.IBPluginDependency - 66.IBViewBoundsToFrameTransform - 67.IBPluginDependency - 67.IBViewBoundsToFrameTransform - 68.IBPluginDependency - 68.IBViewBoundsToFrameTransform - 69.IBPluginDependency - 69.IBViewBoundsToFrameTransform - 70.IBPluginDependency - 70.IBViewBoundsToFrameTransform - 71.IBPluginDependency - 71.IBViewBoundsToFrameTransform - 72.IBPluginDependency - 72.IBViewBoundsToFrameTransform - 73.IBPluginDependency - 73.IBViewBoundsToFrameTransform - 74.IBPluginDependency - 74.IBViewBoundsToFrameTransform - 75.IBPluginDependency - 75.IBViewBoundsToFrameTransform - 76.IBPluginDependency - 76.IBViewBoundsToFrameTransform - - - YES - HelpPageLobbyViewController - UIResponder - {{16, 775}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - AUGgAABEDIAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABC+AAAw0kAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw14AAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw9mAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw+6AAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABByAAAwqYAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAwxMAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAADCQAAAwqYAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAADCQAAAwzcAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDAAAAw3AAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDAAAAw5aAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDOwAAw6OAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDOwAAw8WAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDDgAAw7UAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDDQAAw/CAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAADBAAAAwlQAAA - - - - - YES - - - YES - - - - - YES - - - YES - - - - 95 - - - - YES - - HelpPageLobbyViewController - UIViewController - - dismiss - id - - - dismiss - - dismiss - id - - - - scrollView - UIScrollView - - - scrollView - - scrollView - UIScrollView - - - - IBProjectSource - Classes/HelpPageLobbyViewController.h - - - - UILabel - - IBProjectSource - Classes/ExtraCategories.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - 132 - - diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController.h --- a/project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController.h Thu May 03 22:48:02 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2012 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - - -#import - - -@interface HelpPageLobbyViewController : UIViewController { - UIScrollView *scrollView; -} - -@property (nonatomic, retain) IBOutlet UIScrollView *scrollView; - --(IBAction) dismiss; - -@end diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController.m --- a/project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController.m Thu May 03 22:48:02 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2012 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - - -#import "HelpPageLobbyViewController.h" - - -@implementation HelpPageLobbyViewController -@synthesize scrollView; - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - --(void) didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - self.scrollView = nil; -} - -// on iPhone the XIBs contain UIScrollView --(void) viewDidLoad { - if (IS_IPAD() == NO){ - scrollView.contentSize = CGSizeMake(480,650); - scrollView.maximumZoomScale = 4.0; - scrollView.minimumZoomScale = 0.75; - scrollView.clipsToBounds = YES; - scrollView.delegate = self; - } - [super viewDidLoad]; -} - --(void) viewDidUnload { - [super viewDidUnload]; - self.scrollView = nil; -} - --(void) dealloc { - releaseAndNil(scrollView); - [super dealloc]; -} - --(IBAction) dismiss { - [UIView beginAnimations:@"dismiss help" context:NULL]; - self.view.alpha = 0; - [UIView commitAnimations]; - [self.view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1]; -} - -@end diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/InGameMenuViewController.h --- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.h Thu May 03 22:48:02 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2012 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - - -#import - - -@interface InGameMenuViewController : UITableViewController { - -} - - --(void) present; --(void) dismiss; - -@end diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/InGameMenuViewController.m --- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m Thu May 03 22:48:02 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2012 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - - -#import "InGameMenuViewController.h" -#import "SDL_sysvideo.h" -#import "SDL_uikitkeyboard.h" - - -#define VIEW_HEIGHT 200 - -@implementation InGameMenuViewController - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - -#pragma mark - -#pragma mark animating --(void) present { - CGRect screen = [[UIScreen mainScreen] bounds]; - self.view.backgroundColor = [UIColor clearColor]; - self.view.frame = CGRectMake(screen.size.height, 0, 200, VIEW_HEIGHT); - - [UIView beginAnimations:@"showing popover" context:NULL]; - [UIView setAnimationDuration:0.35]; - self.view.frame = CGRectMake(screen.size.height-200, 0, 200, VIEW_HEIGHT); - [UIView commitAnimations]; -} - --(void) dismiss { - if (IS_IPAD() == NO) { - CGRect screen = [[UIScreen mainScreen] bounds]; - [UIView beginAnimations:@"hiding popover" context:NULL]; - [UIView setAnimationDuration:0.35]; - self.view.frame = CGRectMake(screen.size.height, 0, 200, VIEW_HEIGHT); - [UIView commitAnimations]; - [self.view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:0.35]; - } - - SDL_iPhoneKeyboardHide((SDL_Window *)HW_getSDLWindow()); -} - -#pragma mark - -#pragma mark tableView methods --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return 3; -} - --(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *cellIdentifier = @"CellIdentifier"; - - NSInteger row = [indexPath row]; - NSString *cellTitle; - if (row == 0) - cellTitle = NSLocalizedString(@"Show Help", @""); - else if (row == 1) - cellTitle = NSLocalizedString(@"Tag", @""); - else - cellTitle = NSLocalizedString(@"End Game", @""); - - UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:cellIdentifier]; - if (nil == cell) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault - reuseIdentifier:cellIdentifier] autorelease]; - } - cell.textLabel.text = cellTitle; - - if (IS_IPAD()) - cell.textLabel.textAlignment = UITextAlignmentCenter; - - return cell; -} - --(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - UIActionSheet *actionSheet; - - switch ([indexPath row]) { - case 0: - [[NSNotificationCenter defaultCenter] postNotificationName:@"show help ingame" object:nil]; - - break; - case 1: - HW_chat(); - SDL_iPhoneKeyboardShow((SDL_Window *)HW_getSDLWindow()); - - break; - case 2: - actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Are you reeeeeally sure?", @"") - delegate:self - cancelButtonTitle:NSLocalizedString(@"Well, maybe not...", @"") - destructiveButtonTitle:NSLocalizedString(@"Of course!", @"") - otherButtonTitles:nil]; - [actionSheet showInView:(IS_IPAD() ? self.view : [HWUtils mainSDLViewInstance])]; - [actionSheet release]; - - break; - default: - DLog(@"Warning: unset case value in section!"); - break; - } - - [aTableView deselectRowAtIndexPath:indexPath animated:YES]; -} - -#pragma mark - -#pragma mark actionSheet methods --(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex { - if ([actionSheet cancelButtonIndex] != buttonIndex) { - SDL_iPhoneKeyboardHide((SDL_Window *)HW_getSDLWindow()); - HW_terminate(NO); - } -} - -@end diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/ObjcExports.m --- a/project_files/HedgewarsMobile/Classes/ObjcExports.m Thu May 03 22:48:02 2012 +0200 +++ b/project_files/HedgewarsMobile/Classes/ObjcExports.m Tue May 22 11:19:32 2012 +0200 @@ -18,10 +18,6 @@ #import "ObjcExports.h" -#import "OverlayViewController.h" - -// the reference to the newMenu instance -static OverlayViewController *overlay_instance; #pragma mark - #pragma mark functions called by pascal code @@ -31,17 +27,17 @@ void startLoadingIndicator(void) { // this is the first ojbc function called by engine, so we have to initialize some variables here - overlay_instance = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil]; - // in order to get rotation events we have to insert the view inside the first view of the second window - [[HWUtils mainSDLViewInstance] addSubview:overlay_instance.view]; if ([HWUtils gameType] == gtSave) { [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; + /* overlay_instance.view.backgroundColor = [UIColor blackColor]; overlay_instance.view.alpha = 0.75; overlay_instance.view.userInteractionEnabled = NO; + */ } + /* CGPoint center = overlay_instance.view.center; CGPoint loaderCenter = ([HWUtils gameType] == gtSave) ? center : CGPointMake(center.x, center.y * 5/3); @@ -55,13 +51,14 @@ [overlay_instance.loadingIndicator startAnimating]; [overlay_instance.view addSubview:overlay_instance.loadingIndicator]; [overlay_instance.loadingIndicator release]; + */ } void stopLoadingIndicator(void) { - HW_zoomSet(1.7); + //HW_zoomSet(1.7); if ([HWUtils gameType] != gtSave) { - [overlay_instance.loadingIndicator stopAnimating]; - [overlay_instance.loadingIndicator removeFromSuperview]; + //[overlay_instance.loadingIndicator stopAnimating]; + //[overlay_instance.loadingIndicator removeFromSuperview]; [HWUtils setGameStatus:gsInGame]; } // mark the savefile as valid, eg it's been loaded correctly @@ -70,6 +67,7 @@ } void saveFinishedSynching(void) { + /* [UIView beginAnimations:@"fading from save synch" context:NULL]; [UIView setAnimationDuration:1]; overlay_instance.view.backgroundColor = [UIColor clearColor]; @@ -79,14 +77,12 @@ [overlay_instance.loadingIndicator stopAnimating]; [overlay_instance.loadingIndicator performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1]; + */ [[UIApplication sharedApplication] setIdleTimerDisabled:NO]; [HWUtils setGameStatus:gsInGame]; } -void clearView(void) { - [overlay_instance clearOverlay]; -} // dummy function to prevent linkage fail int SDL_main(int argc, char **argv) { diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/OverlayViewController.h --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.h Thu May 03 22:48:02 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2012 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - - -#import - - -@class InGameMenuViewController; -@class HelpPageInGameViewController; - -@interface OverlayViewController : UIViewController { - // the timer that dims the overlay - NSTimer *dimTimer; - - // the in-game menu - UIPopoverController *popoverController; // iPad only, never set on iPhone - InGameMenuViewController *popupMenu; - BOOL isPopoverVisible; - - // the help menu - HelpPageInGameViewController *helpPage; - - // ths touch section - CGFloat initialDistanceForPinching; - CGPoint startingPoint; - BOOL isAttacking; - - // various other widgets - UIActivityIndicatorView *loadingIndicator; - UIButton *confirmButton; - UISegmentedControl *grenadeTimeSegment; -} - -@property (nonatomic,retain) id popoverController; -@property (nonatomic,retain) InGameMenuViewController *popupMenu; -@property (nonatomic,retain) HelpPageInGameViewController *helpPage; -@property (nonatomic,retain) UIActivityIndicatorView *loadingIndicator; -@property (nonatomic,retain) UIButton *confirmButton; -@property (nonatomic,retain) UISegmentedControl *grenadeTimeSegment; - --(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; --(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; --(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; --(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; - --(IBAction) buttonReleased:(id) sender; --(IBAction) buttonPressed:(id) sender; - --(void) showPopover; --(void) dismissPopover; - --(void) dimOverlay; --(void) activateOverlay; --(void) clearOverlay; - -#define ANIMATION_DURATION 0.25 -#define CONFIRMATION_TAG 5959 -#define GRENADE_TAG 9595 - -@end diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/OverlayViewController.m --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m Thu May 03 22:48:02 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,527 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2012 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - - -#import "OverlayViewController.h" -#import "InGameMenuViewController.h" -#import "HelpPageInGameViewController.h" -#import "CGPointUtils.h" - - -#define HIDING_TIME_DEFAULT [NSDate dateWithTimeIntervalSinceNow:2.7] -#define HIDING_TIME_NEVER [NSDate dateWithTimeIntervalSinceNow:10000] -#define doDim() [dimTimer setFireDate:HIDING_TIME_DEFAULT] -#define doNotDim() [dimTimer setFireDate:HIDING_TIME_NEVER] - -@implementation OverlayViewController -@synthesize popoverController, popupMenu, helpPage, loadingIndicator, confirmButton, grenadeTimeSegment; - -#pragma mark - -#pragma mark rotation --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - -#pragma mark - -#pragma mark View Management --(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { - if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { - isAttacking = NO; - isPopoverVisible = NO; - loadingIndicator = nil; - } - return self; -} - --(void) viewDidLoad { - // fill all the screen available as sdlview disables autoresizing - self.view.frame = [[UIScreen mainScreen] safeBounds]; - // the timer used to dim the overlay - dimTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:6] - interval:1000 - target:self - selector:@selector(dimOverlay) - userInfo:nil - repeats:YES]; - // add timer to runloop, otherwise it doesn't work - [[NSRunLoop currentRunLoop] addTimer:dimTimer forMode:NSDefaultRunLoopMode]; - - // display the help page, required by the popover on ipad - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(showHelp:) - name:@"show help ingame" - object:nil]; - - // present the overlay - self.view.alpha = 0; - [UIView beginAnimations:@"showing overlay" context:NULL]; - [UIView setAnimationDuration:2]; - self.view.alpha = 1; - [UIView commitAnimations]; -} - --(void) viewDidUnload { - [[NSNotificationCenter defaultCenter] removeObserver:self]; - - [NSObject cancelPreviousPerformRequestsWithTarget:self - selector:@selector(unsetPreciseStatus) - object:nil]; - - // only objects initialized in viewDidLoad should be here - dimTimer = nil; - self.helpPage = nil; - [self dismissPopover]; - self.popoverController = nil; - self.loadingIndicator = nil; - MSG_DIDUNLOAD(); - [super viewDidUnload]; -} - --(void) didReceiveMemoryWarning { - if (self.popupMenu.view.superview == nil) - self.popupMenu = nil; - if (self.helpPage.view.superview == nil) - self.helpPage = nil; - if (self.loadingIndicator.superview == nil) - self.loadingIndicator = nil; - if (self.confirmButton.superview == nil) - self.confirmButton = nil; - if (self.grenadeTimeSegment.superview == nil) - self.grenadeTimeSegment = nil; - if (IS_IPAD()) - if (((UIPopoverController *)self.popoverController).contentViewController.view.superview == nil) - self.popoverController = nil; - - MSG_MEMCLEAN(); - [super didReceiveMemoryWarning]; -} - --(void) dealloc { - releaseAndNil(popupMenu); - releaseAndNil(helpPage); - releaseAndNil(popoverController); - releaseAndNil(loadingIndicator); - releaseAndNil(confirmButton); - releaseAndNil(grenadeTimeSegment); - // dimTimer is autoreleased - [super dealloc]; -} - -#pragma mark - -#pragma mark overlay appearance -// nice transition for dimming, should be called only by the timer himself --(void) dimOverlay { - if ([HWUtils isGameRunning]) { - [UIView beginAnimations:@"overlay dim" context:NULL]; - [UIView setAnimationDuration:0.6]; - self.view.alpha = 0.2; - [UIView commitAnimations]; - } -} - -// set the overlay visible and put off the timer for enough time --(void) activateOverlay { - self.view.alpha = 1; - doNotDim(); -} - --(void) clearOverlay { - [UIView beginAnimations:@"remove button" context:NULL]; - [UIView setAnimationDuration:ANIMATION_DURATION]; - self.confirmButton.alpha = 0; - self.grenadeTimeSegment.alpha = 0; - [UIView commitAnimations]; - - if (self.confirmButton) - [self.confirmButton performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:ANIMATION_DURATION]; - if (self.grenadeTimeSegment) - [self.grenadeTimeSegment performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:ANIMATION_DURATION]; -} - -#pragma mark - -#pragma mark overlay user interaction -// dim the overlay when there's no more input for a certain amount of time --(IBAction) buttonReleased:(id) sender { - if ([HWUtils isGameRunning] == NO) - return; - - UIButton *theButton = (UIButton *)sender; - - switch (theButton.tag) { - case 0: - case 1: - case 2: - case 3: - [NSObject cancelPreviousPerformRequestsWithTarget:self - selector:@selector(unsetPreciseStatus) - object:nil]; - HW_walkingKeysUp(); - break; - case 4: - case 5: - case 6: - HW_otherKeysUp(); - break; - default: - DLog(@"Nope"); - break; - } - - isAttacking = NO; - doDim(); -} - -// issue certain action based on the tag of the button --(IBAction) buttonPressed:(id) sender { - [self activateOverlay]; - - if ([HWUtils isGameRunning] == NO) - return; - - if (isPopoverVisible) - [self dismissPopover]; - - UIButton *theButton = (UIButton *)sender; - switch (theButton.tag) { - case 0: - if (isAttacking == NO) - HW_walkLeft(); - break; - case 1: - if (isAttacking == NO) - HW_walkRight(); - break; - case 2: - [self performSelector:@selector(unsetPreciseStatus) withObject:nil afterDelay:0.8]; - HW_preciseSet(!HW_isWeaponRope()); - HW_aimUp(); - break; - case 3: - [self performSelector:@selector(unsetPreciseStatus) withObject:nil afterDelay:0.8]; - HW_preciseSet(!HW_isWeaponRope()); - HW_aimDown(); - break; - case 4: - HW_shoot(); - isAttacking = YES; - break; - case 5: - HW_jump(); - break; - case 6: - HW_backjump(); - break; - case 10: - [[AudioManagerController mainManager] playClickSound]; - HW_pause(); - [self clearOverlay]; - [self showPopover]; - break; - case 11: - [[AudioManagerController mainManager] playClickSound]; - [self clearOverlay]; - HW_ammoMenu(); - break; - default: - DLog(@"Nope"); - break; - } -} - --(void) unsetPreciseStatus { - HW_preciseSet(NO); -} - --(void) sendHWClick { - [self clearOverlay]; - HW_click(); - doDim(); -} - --(void) setGrenadeTime:(id) sender { - UISegmentedControl *theSegment = (UISegmentedControl *)sender; - NSInteger timeIndex = theSegment.selectedSegmentIndex + 1; - if (HW_getGrenadeTime() != timeIndex) - HW_setGrenadeTime(timeIndex); -} - -#pragma mark - -#pragma mark in-game menu and help page --(void) showHelp:(id) sender { - if (self.helpPage == nil) { - NSString *xibName = (IS_IPAD() ? @"HelpPageInGameViewController-iPad" : @"HelpPageInGameViewController-iPhone"); - self.helpPage = [[HelpPageInGameViewController alloc] initWithNibName:xibName bundle:nil]; - } - self.helpPage.view.alpha = 0; - [self.view addSubview:helpPage.view]; - [UIView beginAnimations:@"helpingame" context:NULL]; - self.helpPage.view.alpha = 1; - [UIView commitAnimations]; - doNotDim(); -} - -// show up a popover containing a popupMenuViewController; we hook it with setPopoverContentSize -// on iphone instead just use the tableViewController directly (and implement manually all animations) --(IBAction) showPopover{ - CGRect screen = [[UIScreen mainScreen] safeBounds]; - isPopoverVisible = YES; - - if (IS_IPAD()) { - if (self.popupMenu == nil) - self.popupMenu = [[InGameMenuViewController alloc] initWithStyle:UITableViewStylePlain]; - if (self.popoverController == nil) { - self.popoverController = [[UIPopoverController alloc] initWithContentViewController:self.popupMenu]; - [self.popoverController setPopoverContentSize:CGSizeMake(220, 200) animated:YES]; - [self.popoverController setPassthroughViews:[NSArray arrayWithObject:self.view]]; - } - - [self.popoverController presentPopoverFromRect:CGRectMake(screen.size.width / 2, screen.size.height / 2, 1, 1) - inView:self.view - permittedArrowDirections:UIPopoverArrowDirectionAny - animated:YES]; - } else { - if (self.popupMenu == nil) - self.popupMenu = [[InGameMenuViewController alloc] initWithStyle:UITableViewStyleGrouped]; - - [self.view addSubview:popupMenu.view]; - [self.popupMenu present]; - } - self.popupMenu.tableView.scrollEnabled = NO; -} - -// on ipad just dismiss it, on iphone transtion to the right --(void) dismissPopover { - if (YES == isPopoverVisible) { - isPopoverVisible = NO; - if (HW_isPaused()) - HW_pauseToggle(); - - [self.popupMenu dismiss]; - if (IS_IPAD()) - [self.popoverController dismissPopoverAnimated:YES]; - - [self buttonReleased:nil]; - } -} - -#pragma mark - -#pragma mark Custom touch event handling --(BOOL) shouldIgnoreTouch:(NSSet *)allTouches { - if ([HWUtils isGameRunning] == NO) - return YES; - - // ignore activity near the dpad and buttons - CGPoint touchPoint = [[[allTouches allObjects] objectAtIndex:0] locationInView:self.view]; - CGSize screen = [[UIScreen mainScreen] safeBounds].size; - - if ((touchPoint.x < 160 && touchPoint.y > screen.height - 155 ) || - (touchPoint.x > screen.width - 135 && touchPoint.y > screen.height - 140)) - return YES; - return NO; -} - --(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { - NSSet *allTouches = [event allTouches]; - UITouch *first, *second; - - if ([self shouldIgnoreTouch:allTouches] == YES) - return; - - // hide in-game menu - if (isPopoverVisible) - [self dismissPopover]; - - // reset default dimming - doDim(); - - HW_setPianoSound([allTouches count]); - - switch ([allTouches count]) { - case 1: - startingPoint = [[[allTouches allObjects] objectAtIndex:0] locationInView:self.view]; - if (2 == [[[allTouches allObjects] objectAtIndex:0] tapCount]) - HW_zoomReset(); - break; - case 2: - if (2 == [[[allTouches allObjects] objectAtIndex:0] tapCount]) - HW_screenshot(); - else { - // pinching - first = [[allTouches allObjects] objectAtIndex:0]; - second = [[allTouches allObjects] objectAtIndex:1]; - initialDistanceForPinching = distanceBetweenPoints([first locationInView:self.view], [second locationInView:self.view]); - } - break; - default: - break; - } -} - --(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { - NSSet *allTouches = [event allTouches]; - if ([self shouldIgnoreTouch:allTouches] == YES) - return; - - CGRect screen = [[UIScreen mainScreen] safeBounds]; - CGPoint currentPosition = [[[allTouches allObjects] objectAtIndex:0] locationInView:self.view]; - - switch ([allTouches count]) { - case 1: - // if we're in the menu we just click in the point - if (HW_isAmmoMenuOpen()) { - HW_setCursor(HWXZ(currentPosition.x),HWYZ(currentPosition.y)); - // this click doesn't need any wrapping because the ammoMenu already limits the cursor - HW_click(); - } else - // if weapon requires a further click, ask for tapping again - if (HW_isWeaponRequiringClick()) { - // here don't have to wrap thanks to isCursorVisible magic - HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y)); - - // draw the button at the last touched point (which is the current position) - if (self.confirmButton == nil) { - UIButton *tapAgain = [UIButton buttonWithType:UIButtonTypeRoundedRect]; - [tapAgain addTarget:self action:@selector(sendHWClick) forControlEvents:UIControlEventTouchUpInside]; - [tapAgain setTitle:NSLocalizedString(@"Set!",@"on the overlay") forState:UIControlStateNormal]; - self.confirmButton = tapAgain; - } - self.confirmButton.alpha = 0; - self.confirmButton.frame = CGRectMake(currentPosition.x - 75, currentPosition.y + 25, 150, 40); - [self.view addSubview:self.confirmButton]; - - // animation ftw! - [UIView beginAnimations:@"inserting button" context:NULL]; - [UIView setAnimationDuration:ANIMATION_DURATION]; - self.confirmButton.alpha = 1; - [UIView commitAnimations]; - - // keep the overlay active, or the button will fade - [self activateOverlay]; - doNotDim(); - } else - if (HW_isWeaponTimerable()) { - if (self.grenadeTimeSegment.superview != nil) { - [UIView beginAnimations:@"removing segmented control" context:NULL]; - [UIView setAnimationDuration:ANIMATION_DURATION]; - self.grenadeTimeSegment.alpha = 0; - [UIView commitAnimations]; - - [self.grenadeTimeSegment performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:ANIMATION_DURATION]; - } else { - if (self.grenadeTimeSegment == nil) { - NSArray *items = [[NSArray alloc] initWithObjects:@"1",@"2",@"3",@"4",@"5",nil]; - UISegmentedControl *grenadeSegment = [[UISegmentedControl alloc] initWithItems:items]; - [items release]; - [grenadeSegment addTarget:self action:@selector(setGrenadeTime:) forControlEvents:UIControlEventValueChanged]; - self.grenadeTimeSegment = grenadeSegment; - [grenadeSegment release]; - } - self.grenadeTimeSegment.frame = CGRectMake(screen.size.width / 2 - 125, screen.size.height, 250, 50); - self.grenadeTimeSegment.selectedSegmentIndex = HW_getGrenadeTime() - 1; - self.grenadeTimeSegment.alpha = 1; - self.grenadeTimeSegment.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | - UIViewAutoresizingFlexibleRightMargin | - UIViewAutoresizingFlexibleTopMargin; - [self.view addSubview:self.grenadeTimeSegment]; - - [UIView beginAnimations:@"inserting segmented control" context:NULL]; - [UIView setAnimationDuration:ANIMATION_DURATION]; - [UIView setAnimationCurve:UIViewAnimationCurveEaseIn]; - self.grenadeTimeSegment.frame = CGRectMake(screen.size.width / 2 - 125, screen.size.height - 100, 250, 50); - [UIView commitAnimations]; - - [self activateOverlay]; - doNotDim(); - } - } else - if (HW_isWeaponSwitch()) - HW_tab(); - break; - case 2: - HW_allKeysUp(); - break; - default: - break; - } - - initialDistanceForPinching = 0; -} - --(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { - [self touchesEnded:touches withEvent:event]; -} - --(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { - NSSet *allTouches = [event allTouches]; - if ([self shouldIgnoreTouch:allTouches] == YES) - return; - - CGRect screen = [[UIScreen mainScreen] safeBounds]; - int x, y, dx, dy; - UITouch *touch, *first, *second; - - switch ([allTouches count]) { - case 1: - touch = [[allTouches allObjects] objectAtIndex:0]; - CGPoint currentPosition = [touch locationInView:self.view]; - - if (HW_isAmmoMenuOpen()) { - // no zoom consideration for this - HW_setCursor(HWXZ(currentPosition.x), HWYZ(currentPosition.y)); - } else - if (HW_isWeaponRequiringClick()) { - // moves the cursor around wrt zoom - HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y)); - } else { - // panning \o/ - dx = startingPoint.x - currentPosition.x; - dy = currentPosition.y - startingPoint.y; - HW_getCursor(&x, &y); - // momentum (or something like that) - /*if (abs(dx) > 40) - dx *= log(abs(dx)/4); - if (abs(dy) > 40) - dy *= log(abs(dy)/4);*/ - HW_setCursor(x + dx/HW_zoomFactor(), y + dy/HW_zoomFactor()); - startingPoint = currentPosition; - } - break; - case 2: - first = [[allTouches allObjects] objectAtIndex:0]; - second = [[allTouches allObjects] objectAtIndex:1]; - CGFloat currentDistanceOfPinching = distanceBetweenPoints([first locationInView:self.view], [second locationInView:self.view]); - const int pinchDelta = 40; - - if (0 != initialDistanceForPinching) { - if (currentDistanceOfPinching - initialDistanceForPinching > pinchDelta) { - HW_zoomIn(); - initialDistanceForPinching = currentDistanceOfPinching; - } - else if (initialDistanceForPinching - currentDistanceOfPinching > pinchDelta) { - HW_zoomOut(); - initialDistanceForPinching = currentDistanceOfPinching; - } - } else - initialDistanceForPinching = currentDistanceOfPinching; - break; - default: - break; - } -} - -@end diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/OverlayViewController.xib --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.xib Thu May 03 22:48:02 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1014 +0,0 @@ - - - - 1056 - 10H574 - 823 - 1038.35 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - YES - - - 268 - {{0, 229}, {50, 50}} - - NO - NO - YES - IBCocoaTouchFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - - 3 - MQA - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - 3 - MC41AA - - - NSImage - arrowLeft.png - - - - - 268 - {{87, 229}, {50, 50}} - - NO - NO - YES - 1 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - arrowRight.png - - - - - 265 - {{412, 236}, {64, 64}} - - NO - NO - YES - 5 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - joyButtonBackJump.png - - - - - 265 - {{365, 203}, {64, 64}} - - NO - NO - YES - 6 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - joyButtonForwardJump.png - - - - - 265 - {{354, 256}, {64, 64}} - - NO - NO - YES - 4 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - joyButtonAttack.png - - - - - 268 - {{44, 187}, {50, 50}} - - NO - NO - YES - 2 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - arrowUp.png - - - - - 268 - {{44, 270}, {50, 50}} - - NO - NO - YES - 3 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - arrowDown.png - - - - - 289 - {{341, 0}, {64, 50}} - - NO - YES - 10 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - NSImage - cornerButton.png - - - - - 289 - {{402, 0}, {78, 50}} - - NO - YES - 11 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - NSImage - ammoButton.png - - - - {480, 320} - - - 3 - MSAwAA - - NO - YES - NO - YES - - 3 - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - buttonPressed: - - - 1 - - 8 - - - - buttonReleased: - - - 9 - - 9 - - - - buttonReleased: - - - 7 - - 10 - - - - buttonReleased: - - - 8 - - 11 - - - - buttonReleased: - - - 8 - - 13 - - - - buttonReleased: - - - 9 - - 14 - - - - buttonPressed: - - - 1 - - 15 - - - - buttonReleased: - - - 7 - - 16 - - - - buttonReleased: - - - 9 - - 18 - - - - buttonPressed: - - - 1 - - 19 - - - - buttonReleased: - - - 8 - - 20 - - - - buttonReleased: - - - 7 - - 21 - - - - buttonReleased: - - - 8 - - 23 - - - - buttonReleased: - - - 9 - - 24 - - - - buttonPressed: - - - 1 - - 25 - - - - buttonReleased: - - - 7 - - 26 - - - - buttonReleased: - - - 9 - - 44 - - - - buttonPressed: - - - 1 - - 45 - - - - buttonReleased: - - - 8 - - 46 - - - - buttonReleased: - - - 7 - - 47 - - - - buttonReleased: - - - 8 - - 49 - - - - buttonReleased: - - - 7 - - 50 - - - - buttonReleased: - - - 9 - - 51 - - - - buttonPressed: - - - 1 - - 52 - - - - buttonReleased: - - - 9 - - 54 - - - - buttonReleased: - - - 7 - - 55 - - - - buttonPressed: - - - 1 - - 56 - - - - buttonReleased: - - - 8 - - 57 - - - - buttonPressed: - - - 7 - - 60 - - - - buttonPressed: - - - 7 - - 68 - - - - buttonReleased: - - - 9 - - 69 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 4 - - - left - - - 12 - - - right - - - 17 - - - up - - - 22 - - - down - - - 43 - - - push2 - - - 48 - - - push1 - - - 53 - - - push3 - - - 58 - - - - - 67 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 12.IBPluginDependency - 12.IBViewBoundsToFrameTransform - 17.IBPluginDependency - 22.IBPluginDependency - 4.IBPluginDependency - 43.IBPluginDependency - 48.IBPluginDependency - 53.IBPluginDependency - 58.IBPluginDependency - 67.IBPluginDependency - - - YES - OverlayViewController - UIResponder - {{690, 375}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABCkAAAw5SAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 72 - - - - YES - - OverlayViewController - UIViewController - - YES - - YES - buttonPressed: - buttonReleased: - - - YES - id - id - - - - YES - - YES - buttonPressed: - buttonReleased: - - - YES - - buttonPressed: - id - - - buttonReleased: - id - - - - - IBProjectSource - Classes/OverlayViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - - YES - - YES - ammoButton.png - arrowDown.png - arrowLeft.png - arrowRight.png - arrowUp.png - cornerButton.png - joyButtonAttack.png - joyButtonBackJump.png - joyButtonForwardJump.png - - - YES - {78, 50} - {50, 50} - {50, 50} - {50, 50} - {50, 50} - {60, 50} - {64, 64} - {64, 64} - {64, 64} - - - 132 - - diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Classes/PascalImports.h --- a/project_files/HedgewarsMobile/Classes/PascalImports.h Thu May 03 22:48:02 2012 +0200 +++ b/project_files/HedgewarsMobile/Classes/PascalImports.h Tue May 22 11:19:32 2012 +0200 @@ -25,7 +25,7 @@ #endif /* add C declarations below for all exported Pascal functions/procedure - * that you want to use + * that you want to use in your non-Pascal code */ void Game(const char *args[]); @@ -33,68 +33,13 @@ void LoadLocaleWrapper(const char *filename); void HW_versionInfo(int *protoNum, char **versionStr); - - void HW_click(void); - void HW_ammoMenu(void); - - void HW_zoomSet(float value); - void HW_zoomIn(void); - void HW_zoomOut(void); - void HW_zoomReset(void); - float HW_zoomFactor(void); - int HW_zoomLevel(void); - - void HW_walkingKeysUp(void); - void HW_otherKeysUp(void); - void HW_allKeysUp(void); - - void HW_walkLeft(void); - void HW_walkRight(void); - void HW_aimUp(void); - void HW_aimDown(void); - void HW_preciseSet(BOOL status); - - void HW_shoot(void); - void HW_jump(void); - void HW_backjump(void); - - void HW_chat(void); - void HW_chatEnd(void); - void HW_tab(void); - void HW_screenshot(void); - - void HW_pause(void); - void HW_pauseToggle(void); - BOOL HW_isPaused(void); - void *HW_getSDLWindow(void); void HW_terminate(BOOL andCloseFrontend); - void HW_setCursor(int x, int y); - void HW_getCursor(int *x, int *y); - - BOOL HW_isAmmoMenuOpen(void); - BOOL HW_isAmmoMenuNotAllowed(void); - BOOL HW_isWeaponRequiringClick(void); - BOOL HW_isWeaponTimerable(void); - BOOL HW_isWeaponSwitch(void); - BOOL HW_isWeaponRope(void); - - void HW_setGrenadeTime(int time); - int HW_getGrenadeTime(void); - - void HW_setPianoSound(int snd); - void HW_setWeapon(int whichone); - BOOL HW_isWeaponAnEffect(int whichone); char *HW_getWeaponNameByIndex(int whichone); - char *HW_getWeaponCaptionByIndex(int whichone); - char *HW_getWeaponDescriptionByIndex(int whichone); - - void HW_getAmmoDelays(unsigned char *pointer); - int HW_getAmmoCounts(int *pointer); - + //char *HW_getWeaponCaptionByIndex(int whichone); + //char *HW_getWeaponDescriptionByIndex(int whichone); int HW_getNumberOfWeapons(void); - int HW_getTurnsForCurrentTeam(void); int HW_getMaxNumberOfHogs(void); int HW_getMaxNumberOfTeams(void); diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Thu May 03 22:48:02 2012 +0200 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Tue May 22 11:19:32 2012 +0200 @@ -39,22 +39,13 @@ 61156525147F48B8006729A9 /* Scheme.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61156524147F48B8006729A9 /* Scheme.strings */; }; 61177C02148B8BB100686905 /* uLandGenMaze.pas in Sources */ = {isa = PBXBuildFile; fileRef = 61177C00148B8BB100686905 /* uLandGenMaze.pas */; }; 61177C03148B8BB100686905 /* uLandOutline.pas in Sources */ = {isa = PBXBuildFile; fileRef = 61177C01148B8BB100686905 /* uLandOutline.pas */; }; - 61188BF212A6FE530026C5DA /* ammoButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D399129B350700911D8D /* ammoButton@2x.png */; }; - 61188BF312A6FE540026C5DA /* arrowDown@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D39A129B350700911D8D /* arrowDown@2x.png */; }; - 61188BF412A6FE560026C5DA /* arrowLeft@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D39B129B350700911D8D /* arrowLeft@2x.png */; }; - 61188BF512A6FE570026C5DA /* arrowRight@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D39C129B350700911D8D /* arrowRight@2x.png */; }; - 61188BF612A6FE590026C5DA /* arrowUp@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D39D129B350700911D8D /* arrowUp@2x.png */; }; 61188BF712A6FE5A0026C5DA /* backButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6172FED31298CE6600D73365 /* backButton@2x.png */; }; 61188BF812A6FE5C0026C5DA /* background@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 6172FED61298CF9800D73365 /* background@2x~iphone.png */; }; 61188BF912A6FE5D0026C5DA /* checkbox@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 615FEAD912A2A4C10098EE92 /* checkbox@2x.png */; }; - 61188BFA12A6FE5E0026C5DA /* cornerButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D39E129B350700911D8D /* cornerButton@2x.png */; }; 61188BFB12A6FE610026C5DA /* Default-ipad-Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 6183D83C11E2BCE200A88903 /* Default-ipad-Landscape.png */; }; 61188BFC12A6FE630026C5DA /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6172FEA21298C7F900D73365 /* Default@2x.png */; }; 61188BFD12A6FE730026C5DA /* fb@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D383129B346A00911D8D /* fb@2x.png */; }; 61188BFE12A6FE7C0026C5DA /* irc@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D384129B347700911D8D /* irc@2x.png */; }; - 61188BFF12A6FE7E0026C5DA /* joyButtonAttack@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D392129B34E900911D8D /* joyButtonAttack@2x.png */; }; - 61188C0012A6FE810026C5DA /* joyButtonBackJump@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D393129B34E900911D8D /* joyButtonBackJump@2x.png */; }; - 61188C0112A6FE820026C5DA /* joyButtonForwardJump@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D394129B34E900911D8D /* joyButtonForwardJump@2x.png */; }; 61188C0212A6FE840026C5DA /* localplayButton@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 615FEADE12A2A6640098EE92 /* localplayButton@2x~iphone.png */; }; 61188C0312A6FE860026C5DA /* netplayButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F9040D11DF59D10068B24D /* netplayButton.png */; }; 61188C0412A6FE880026C5DA /* savesButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6172FEC81298CE4800D73365 /* savesButton@2x.png */; }; @@ -66,22 +57,13 @@ 611D7A50142FDCD3006E0798 /* uTouch.pas in Sources */ = {isa = PBXBuildFile; fileRef = 611D7A4F142FDCD3006E0798 /* uTouch.pas */; }; 611D9BFB12497E9800008271 /* SavedGamesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 611D9BF912497E9800008271 /* SavedGamesViewController.m */; }; 611D9BFC12497E9800008271 /* SavedGamesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 611D9BFA12497E9800008271 /* SavedGamesViewController.xib */; }; - 611E0EE711FB20610077A41E /* ammoButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 611E0EE511FB20610077A41E /* ammoButton.png */; }; - 611E0EE811FB20610077A41E /* cornerButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 611E0EE611FB20610077A41E /* cornerButton.png */; }; 611E12FF117BBBDA0044B62F /* Entitlements-Development.plist in Resources */ = {isa = PBXBuildFile; fileRef = 611E12FE117BBBDA0044B62F /* Entitlements-Development.plist */; }; 611EE974122A9C4100DF6938 /* clickSound.caf in Resources */ = {isa = PBXBuildFile; fileRef = 611EE973122A9C4100DF6938 /* clickSound.caf */; }; 611EE9DA122AA10A00DF6938 /* selSound.caf in Resources */ = {isa = PBXBuildFile; fileRef = 611EE9D8122AA10A00DF6938 /* selSound.caf */; }; - 611EEAEE122B2A4D00DF6938 /* HelpPageInGameViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 611EEAEC122B2A4D00DF6938 /* HelpPageInGameViewController.m */; }; - 611EEAEF122B2A4D00DF6938 /* HelpPageLobbyViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 611EEAED122B2A4D00DF6938 /* HelpPageLobbyViewController-iPad.xib */; }; - 611EEBC1122B34A800DF6938 /* helpingame.png in Resources */ = {isa = PBXBuildFile; fileRef = 611EEBC0122B34A800DF6938 /* helpingame.png */; }; - 611EEBC4122B355700DF6938 /* helpbottom.png in Resources */ = {isa = PBXBuildFile; fileRef = 611EEBC2122B355700DF6938 /* helpbottom.png */; }; - 611EEBC5122B355700DF6938 /* helpright.png in Resources */ = {isa = PBXBuildFile; fileRef = 611EEBC3122B355700DF6938 /* helpright.png */; }; - 611EEC31122B54D700DF6938 /* helpplain.png in Resources */ = {isa = PBXBuildFile; fileRef = 611EEC30122B54D700DF6938 /* helpplain.png */; }; 611F4D4B11B27A9900F9759A /* uScript.pas in Sources */ = {isa = PBXBuildFile; fileRef = 611F4D4A11B27A9900F9759A /* uScript.pas */; }; 61272339117DF778005B90CF /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61272338117DF778005B90CF /* MobileCoreServices.framework */; }; 6129B9F711EFB04D0017E305 /* denied.png in Resources */ = {isa = PBXBuildFile; fileRef = 6129B9F611EFB04D0017E305 /* denied.png */; }; 612CABAB1391CE68005E9596 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 612CABAA1391CE68005E9596 /* AVFoundation.framework */; }; - 612CABC81391D3CC005E9596 /* hwclassic.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 612CABC71391D3CC005E9596 /* hwclassic.mp3 */; }; 61370653117B1D50004EE44A /* Entitlements-Distribution.plist in Resources */ = {isa = PBXBuildFile; fileRef = 61370652117B1D50004EE44A /* Entitlements-Distribution.plist */; }; 61399013125D19C0003C2DC0 /* uMobile.pas in Sources */ = {isa = PBXBuildFile; fileRef = 61399012125D19C0003C2DC0 /* uMobile.pas */; }; 6147DAD31253DCDE0010357E /* savesButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 6147DAD21253DCDE0010357E /* savesButton.png */; }; @@ -89,6 +71,7 @@ 615AD96212073B4D00F2FF04 /* startGameButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 615AD96112073B4D00F2FF04 /* startGameButton.png */; }; 615AD9E9120764CA00F2FF04 /* backButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 615AD9E8120764CA00F2FF04 /* backButton.png */; }; 615AD9EB1207654E00F2FF04 /* helpButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 615AD9EA1207654E00F2FF04 /* helpButton.png */; }; + 615BE3D4155C5DDF003CA34D /* uInputHandler.pas in Sources */ = {isa = PBXBuildFile; fileRef = 615BE3D3155C5DDF003CA34D /* uInputHandler.pas */; }; 615E755A14E41E8C00FBA131 /* MXAudioPlayerFadeOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E755914E41E8C00FBA131 /* MXAudioPlayerFadeOperation.m */; }; 615E76BC14E4421200FBA131 /* MGSplitCornersView.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76B714E4421200FBA131 /* MGSplitCornersView.m */; }; 615E76BD14E4421200FBA131 /* MGSplitDividerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76B914E4421200FBA131 /* MGSplitDividerView.m */; }; @@ -108,8 +91,6 @@ 6165921511CA9BA200D6E256 /* MainMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F111CA9BA200D6E256 /* MainMenuViewController.m */; }; 6165921611CA9BA200D6E256 /* MapConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F311CA9BA200D6E256 /* MapConfigViewController.m */; }; 6165921711CA9BA200D6E256 /* SettingsBaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F511CA9BA200D6E256 /* SettingsBaseViewController.m */; }; - 6165921811CA9BA200D6E256 /* OverlayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F711CA9BA200D6E256 /* OverlayViewController.m */; }; - 6165921911CA9BA200D6E256 /* InGameMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F911CA9BA200D6E256 /* InGameMenuViewController.m */; }; 6165921A11CA9BA200D6E256 /* SchemeSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591FB11CA9BA200D6E256 /* SchemeSettingsViewController.m */; }; 6165921B11CA9BA200D6E256 /* SchemeWeaponConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591FD11CA9BA200D6E256 /* SchemeWeaponConfigViewController.m */; }; 6165921C11CA9BA200D6E256 /* SingleSchemeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591FF11CA9BA200D6E256 /* SingleSchemeViewController.m */; }; @@ -125,7 +106,6 @@ 6165923211CA9BD500D6E256 /* UIImageExtra.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165922D11CA9BD500D6E256 /* UIImageExtra.m */; }; 6165925311CA9CB400D6E256 /* MainMenuViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924B11CA9CB400D6E256 /* MainMenuViewController-iPad.xib */; }; 6165925511CA9CB400D6E256 /* MapConfigViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924D11CA9CB400D6E256 /* MapConfigViewController-iPad.xib */; }; - 6165925811CA9CB400D6E256 /* OverlayViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165925011CA9CB400D6E256 /* OverlayViewController.xib */; }; 6165929E11CA9E2F00D6E256 /* HedgewarsAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165929D11CA9E2F00D6E256 /* HedgewarsAppDelegate.m */; }; 6167A6761391514600AA6D07 /* RestoreViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6167A6741391514600AA6D07 /* RestoreViewController.m */; }; 6167A6771391514600AA6D07 /* RestoreViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6167A6751391514600AA6D07 /* RestoreViewController-iPhone.xib */; }; @@ -160,7 +140,6 @@ 6174F7C912CD62E300205D6F /* smallerTitle@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6174F7C712CD62E300205D6F /* smallerTitle@2x.png */; }; 61798816114AA34C00BA94A9 /* hwengine.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987E7114AA34C00BA94A9 /* hwengine.pas */; }; 61798818114AA34C00BA94A9 /* hwLibrary.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987E9114AA34C00BA94A9 /* hwLibrary.pas */; }; - 6179881B114AA34C00BA94A9 /* PascalExports.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987EC114AA34C00BA94A9 /* PascalExports.pas */; }; 6179881C114AA34C00BA94A9 /* SDLh.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987ED114AA34C00BA94A9 /* SDLh.pas */; }; 6179881F114AA34C00BA94A9 /* uAI.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987F1114AA34C00BA94A9 /* uAI.pas */; }; 61798820114AA34C00BA94A9 /* uAIActions.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987F2114AA34C00BA94A9 /* uAIActions.pas */; }; @@ -191,9 +170,6 @@ 6179883D114AA34C00BA94A9 /* uWorld.pas in Sources */ = {isa = PBXBuildFile; fileRef = 6179880F114AA34C00BA94A9 /* uWorld.pas */; }; 61798935114AB25F00BA94A9 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61798934114AB25F00BA94A9 /* AudioToolbox.framework */; }; 61808A5D128C930A005D0E2F /* backSound.caf in Resources */ = {isa = PBXBuildFile; fileRef = 611EE9D7122AA10A00DF6938 /* backSound.caf */; }; - 61842B24122B619D0096E335 /* HelpPageInGameViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61842B23122B619D0096E335 /* HelpPageInGameViewController-iPad.xib */; }; - 61842B3E122B65BD0096E335 /* helpabove.png in Resources */ = {isa = PBXBuildFile; fileRef = 61842B3D122B65BD0096E335 /* helpabove.png */; }; - 61842B40122B66280096E335 /* helpleft.png in Resources */ = {isa = PBXBuildFile; fileRef = 61842B3F122B66280096E335 /* helpleft.png */; }; 61889985129995B500D55FD6 /* title~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 61889984129995B500D55FD6 /* title~ipad.png */; }; 61915D5B143A4E2C00299991 /* MissionTrainingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61915D59143A4E2C00299991 /* MissionTrainingViewController.m */; }; 61915D5C143A4E2C00299991 /* MissionTrainingViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61915D5A143A4E2C00299991 /* MissionTrainingViewController-iPhone.xib */; }; @@ -205,7 +181,6 @@ 6199E86D12464A8E00DADF8C /* surprise.png in Resources */ = {isa = PBXBuildFile; fileRef = 6199E86C12464A8E00DADF8C /* surprise.png */; }; 619C5AF4124F7E3100D041AE /* LuaPas.pas in Sources */ = {isa = PBXBuildFile; fileRef = 619C5AF3124F7E3100D041AE /* LuaPas.pas */; }; 619C5BA2124FA59000D041AE /* MapPreviewButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 619C5BA1124FA59000D041AE /* MapPreviewButtonView.m */; }; - 619E173A15227E8E0016654A /* HelpPageLobbyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 619E173915227E8E0016654A /* HelpPageLobbyViewController.m */; }; 61A1188511683A8C00359010 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61A117FE1168322700359010 /* CoreGraphics.framework */; settings = {ATTRIBUTES = (Required, ); }; }; 61A19AFC14D20170004B1E6D /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61A19AEA14D2010A004B1E6D /* libSDL.a */; }; 61A19B7714D20B7A004B1E6D /* libSDL_image.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61A19B6614D20B6C004B1E6D /* libSDL_image.a */; }; @@ -229,7 +204,6 @@ 61A670C212747DBD00B06CE7 /* MapConfigViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924E11CA9CB400D6E256 /* MapConfigViewController-iPhone.xib */; }; 61A976B3136F668500DD9878 /* uCursor.pas in Sources */ = {isa = PBXBuildFile; fileRef = 61A976B2136F668500DD9878 /* uCursor.pas */; }; 61AC067412B2E32D000B52A2 /* Appirater.m in Sources */ = {isa = PBXBuildFile; fileRef = 61AC067312B2E32D000B52A2 /* Appirater.m */; }; - 61B3D71C11EA6F2700EC7420 /* uKeys.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987FE114AA34C00BA94A9 /* uKeys.pas */; }; 61B7A33812CC21080086B604 /* StatsPageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B7A33712CC21080086B604 /* StatsPageViewController.m */; }; 61B9A86814423A9D001541C1 /* GameConfigViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61B9A86714423A9D001541C1 /* GameConfigViewController-iPad.xib */; }; 61C079E411F35A300072BF46 /* EditableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 61C079E311F35A300072BF46 /* EditableCellView.m */; }; @@ -241,8 +215,6 @@ 61D0BDF91457508C0011A899 /* ExtraCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = 61D0BDF81457508C0011A899 /* ExtraCategories.m */; }; 61D205A1127CDD1100ABD83E /* ObjcExports.m in Sources */ = {isa = PBXBuildFile; fileRef = 61D205A0127CDD1100ABD83E /* ObjcExports.m */; }; 61D3D2A51290E03A003CE7C3 /* irc.png in Resources */ = {isa = PBXBuildFile; fileRef = 61D3D2A41290E03A003CE7C3 /* irc.png */; }; - 61DF0EDC1284DF2300F3F10B /* HelpPageLobbyViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61DF0EDB1284DF2300F3F10B /* HelpPageLobbyViewController-iPhone.xib */; }; - 61DF0F211284F72A00F3F10B /* HelpPageInGameViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61DF0F201284F72A00F3F10B /* HelpPageInGameViewController-iPhone.xib */; }; 61E1F4F811D004240016A5AA /* adler32.pas in Sources */ = {isa = PBXBuildFile; fileRef = 61E1F4F711D004240016A5AA /* adler32.pas */; }; 61E2E12E12BAAEE30051B659 /* ServerProtocolNetwork.m in Sources */ = {isa = PBXBuildFile; fileRef = 61E2E12D12BAAEE30051B659 /* ServerProtocolNetwork.m */; }; 61E2F7441283752C00E12521 /* fb.png in Resources */ = {isa = PBXBuildFile; fileRef = 61E2F7421283752C00E12521 /* fb.png */; }; @@ -250,13 +222,6 @@ 61E5D68D12AB006F00566F29 /* uLandPainted.pas in Sources */ = {isa = PBXBuildFile; fileRef = 61E5D68C12AB006F00566F29 /* uLandPainted.pas */; }; 61EBA62A11DFF2BC0048B68A /* title~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 61EBA62811DFF2BC0048B68A /* title~iphone.png */; }; 61EDB5B0135B3F97009B29A6 /* GameInterfaceBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EDB5AF135B3F97009B29A6 /* GameInterfaceBridge.m */; }; - 61EF920E11DF57AC003441C4 /* arrowDown.png in Resources */ = {isa = PBXBuildFile; fileRef = 61EF920511DF57AC003441C4 /* arrowDown.png */; }; - 61EF920F11DF57AC003441C4 /* arrowLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = 61EF920611DF57AC003441C4 /* arrowLeft.png */; }; - 61EF921011DF57AC003441C4 /* arrowRight.png in Resources */ = {isa = PBXBuildFile; fileRef = 61EF920711DF57AC003441C4 /* arrowRight.png */; }; - 61EF921111DF57AC003441C4 /* arrowUp.png in Resources */ = {isa = PBXBuildFile; fileRef = 61EF920811DF57AC003441C4 /* arrowUp.png */; }; - 61EF921211DF57AC003441C4 /* joyButtonAttack.png in Resources */ = {isa = PBXBuildFile; fileRef = 61EF920911DF57AC003441C4 /* joyButtonAttack.png */; }; - 61EF921311DF57AC003441C4 /* joyButtonBackJump.png in Resources */ = {isa = PBXBuildFile; fileRef = 61EF920A11DF57AC003441C4 /* joyButtonBackJump.png */; }; - 61EF921411DF57AC003441C4 /* joyButtonForwardJump.png in Resources */ = {isa = PBXBuildFile; fileRef = 61EF920B11DF57AC003441C4 /* joyButtonForwardJump.png */; }; 61F2E7CE1205EDE0005734F7 /* AboutViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61F2E7CC1205EDE0005734F7 /* AboutViewController.m */; }; 61F2E7CF1205EDE0005734F7 /* AboutViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61F2E7CD1205EDE0005734F7 /* AboutViewController.xib */; }; 61F2E7EC12060E31005734F7 /* checkbox.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F2E7EB12060E31005734F7 /* checkbox.png */; }; @@ -370,15 +335,6 @@ 6103D383129B346A00911D8D /* fb@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "fb@2x.png"; path = "Resources/Icons/fb@2x.png"; sourceTree = ""; }; 6103D384129B347700911D8D /* irc@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "irc@2x.png"; path = "Resources/Icons/irc@2x.png"; sourceTree = ""; }; 6103D385129B348200911D8D /* tw@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "tw@2x.png"; path = "Resources/Icons/tw@2x.png"; sourceTree = ""; }; - 6103D392129B34E900911D8D /* joyButtonAttack@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "joyButtonAttack@2x.png"; path = "Resources/Overlay/joyButtonAttack@2x.png"; sourceTree = ""; }; - 6103D393129B34E900911D8D /* joyButtonBackJump@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "joyButtonBackJump@2x.png"; path = "Resources/Overlay/joyButtonBackJump@2x.png"; sourceTree = ""; }; - 6103D394129B34E900911D8D /* joyButtonForwardJump@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "joyButtonForwardJump@2x.png"; path = "Resources/Overlay/joyButtonForwardJump@2x.png"; sourceTree = ""; }; - 6103D399129B350700911D8D /* ammoButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "ammoButton@2x.png"; path = "Resources/Overlay/ammoButton@2x.png"; sourceTree = ""; }; - 6103D39A129B350700911D8D /* arrowDown@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "arrowDown@2x.png"; path = "Resources/Overlay/arrowDown@2x.png"; sourceTree = ""; }; - 6103D39B129B350700911D8D /* arrowLeft@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "arrowLeft@2x.png"; path = "Resources/Overlay/arrowLeft@2x.png"; sourceTree = ""; }; - 6103D39C129B350700911D8D /* arrowRight@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "arrowRight@2x.png"; path = "Resources/Overlay/arrowRight@2x.png"; sourceTree = ""; }; - 6103D39D129B350700911D8D /* arrowUp@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "arrowUp@2x.png"; path = "Resources/Overlay/arrowUp@2x.png"; sourceTree = ""; }; - 6103D39E129B350700911D8D /* cornerButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "cornerButton@2x.png"; path = "Resources/Overlay/cornerButton@2x.png"; sourceTree = ""; }; 61077E86143FB09800645B29 /* MissionTrainingViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MissionTrainingViewController-iPad.xib"; sourceTree = ""; }; 61078029143FCCC800645B29 /* startGameButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "startGameButton@2x.png"; path = "Resources/Frontend/startGameButton@2x.png"; sourceTree = ""; }; 610782931440EE5C00645B29 /* basicFlags.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = basicFlags.plist; path = Resources/basicFlags.plist; sourceTree = ""; }; @@ -413,24 +369,14 @@ 611D9BF812497E9800008271 /* SavedGamesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SavedGamesViewController.h; sourceTree = ""; }; 611D9BF912497E9800008271 /* SavedGamesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SavedGamesViewController.m; sourceTree = ""; }; 611D9BFA12497E9800008271 /* SavedGamesViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SavedGamesViewController.xib; sourceTree = ""; }; - 611E0EE511FB20610077A41E /* ammoButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ammoButton.png; path = Resources/Overlay/ammoButton.png; sourceTree = ""; }; - 611E0EE611FB20610077A41E /* cornerButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = cornerButton.png; path = Resources/Overlay/cornerButton.png; sourceTree = ""; }; 611E12FE117BBBDA0044B62F /* Entitlements-Development.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Entitlements-Development.plist"; sourceTree = ""; }; 611EE973122A9C4100DF6938 /* clickSound.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = clickSound.caf; path = Resources/clickSound.caf; sourceTree = ""; }; 611EE9D7122AA10A00DF6938 /* backSound.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = backSound.caf; path = Resources/backSound.caf; sourceTree = ""; }; 611EE9D8122AA10A00DF6938 /* selSound.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = selSound.caf; path = Resources/selSound.caf; sourceTree = ""; }; - 611EEAEB122B2A4D00DF6938 /* HelpPageInGameViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelpPageInGameViewController.h; sourceTree = ""; }; - 611EEAEC122B2A4D00DF6938 /* HelpPageInGameViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HelpPageInGameViewController.m; sourceTree = ""; }; - 611EEAED122B2A4D00DF6938 /* HelpPageLobbyViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "HelpPageLobbyViewController-iPad.xib"; sourceTree = ""; }; - 611EEBC0122B34A800DF6938 /* helpingame.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = helpingame.png; path = Resources/Overlay/helpingame.png; sourceTree = ""; }; - 611EEBC2122B355700DF6938 /* helpbottom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = helpbottom.png; path = Resources/Overlay/helpbottom.png; sourceTree = ""; }; - 611EEBC3122B355700DF6938 /* helpright.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = helpright.png; path = Resources/Overlay/helpright.png; sourceTree = ""; }; - 611EEC30122B54D700DF6938 /* helpplain.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = helpplain.png; path = Resources/Overlay/helpplain.png; sourceTree = ""; }; 611F4D4A11B27A9900F9759A /* uScript.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uScript.pas; path = ../../hedgewars/uScript.pas; sourceTree = SOURCE_ROOT; }; 61272338117DF778005B90CF /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; 6129B9F611EFB04D0017E305 /* denied.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = denied.png; path = Resources/denied.png; sourceTree = ""; }; 612CABAA1391CE68005E9596 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; - 612CABC71391D3CC005E9596 /* hwclassic.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = hwclassic.mp3; path = Resources/hwclassic.mp3; sourceTree = ""; }; 61370652117B1D50004EE44A /* Entitlements-Distribution.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Entitlements-Distribution.plist"; sourceTree = ""; }; 61399012125D19C0003C2DC0 /* uMobile.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uMobile.pas; path = ../../hedgewars/uMobile.pas; sourceTree = SOURCE_ROOT; }; 6147DAD21253DCDE0010357E /* savesButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = savesButton.png; path = Resources/Frontend/savesButton.png; sourceTree = ""; }; @@ -442,6 +388,7 @@ 615AD96112073B4D00F2FF04 /* startGameButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = startGameButton.png; path = Resources/Frontend/startGameButton.png; sourceTree = ""; }; 615AD9E8120764CA00F2FF04 /* backButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = backButton.png; path = Resources/Frontend/backButton.png; sourceTree = ""; }; 615AD9EA1207654E00F2FF04 /* helpButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = helpButton.png; path = Resources/Frontend/helpButton.png; sourceTree = ""; }; + 615BE3D3155C5DDF003CA34D /* uInputHandler.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uInputHandler.pas; path = ../../hedgewars/uInputHandler.pas; sourceTree = SOURCE_ROOT; }; 615E755814E41E8C00FBA131 /* MXAudioPlayerFadeOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MXAudioPlayerFadeOperation.h; path = Classes/MXAudioPlayerFadeOperation.h; sourceTree = ""; }; 615E755914E41E8C00FBA131 /* MXAudioPlayerFadeOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MXAudioPlayerFadeOperation.m; path = Classes/MXAudioPlayerFadeOperation.m; sourceTree = ""; }; 615E76B514E4406400FBA131 /* LICENCE.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = LICENCE.rtf; path = Classes/MGSplitViewController/LICENCE.rtf; sourceTree = ""; }; @@ -480,10 +427,6 @@ 616591F311CA9BA200D6E256 /* MapConfigViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MapConfigViewController.m; sourceTree = ""; }; 616591F411CA9BA200D6E256 /* SettingsBaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsBaseViewController.h; sourceTree = ""; }; 616591F511CA9BA200D6E256 /* SettingsBaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SettingsBaseViewController.m; sourceTree = ""; }; - 616591F611CA9BA200D6E256 /* OverlayViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverlayViewController.h; sourceTree = ""; }; - 616591F711CA9BA200D6E256 /* OverlayViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OverlayViewController.m; sourceTree = ""; }; - 616591F811CA9BA200D6E256 /* InGameMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InGameMenuViewController.h; sourceTree = ""; }; - 616591F911CA9BA200D6E256 /* InGameMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InGameMenuViewController.m; sourceTree = ""; }; 616591FA11CA9BA200D6E256 /* SchemeSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SchemeSettingsViewController.h; sourceTree = ""; }; 616591FB11CA9BA200D6E256 /* SchemeSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SchemeSettingsViewController.m; sourceTree = ""; }; 616591FC11CA9BA200D6E256 /* SchemeWeaponConfigViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SchemeWeaponConfigViewController.h; sourceTree = ""; }; @@ -516,7 +459,6 @@ 6165924C11CA9CB400D6E256 /* MainMenuViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MainMenuViewController-iPhone.xib"; sourceTree = ""; }; 6165924D11CA9CB400D6E256 /* MapConfigViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MapConfigViewController-iPad.xib"; sourceTree = ""; }; 6165924E11CA9CB400D6E256 /* MapConfigViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MapConfigViewController-iPhone.xib"; sourceTree = ""; }; - 6165925011CA9CB400D6E256 /* OverlayViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = OverlayViewController.xib; sourceTree = ""; }; 6165929C11CA9E2F00D6E256 /* HedgewarsAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HedgewarsAppDelegate.h; path = Classes/HedgewarsAppDelegate.h; sourceTree = ""; }; 6165929D11CA9E2F00D6E256 /* HedgewarsAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HedgewarsAppDelegate.m; path = Classes/HedgewarsAppDelegate.m; sourceTree = ""; }; 6167A6731391514600AA6D07 /* RestoreViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RestoreViewController.h; sourceTree = ""; }; @@ -558,11 +500,9 @@ 6174F7C612CD62E300205D6F /* smallerTitle.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = smallerTitle.png; path = Resources/Frontend/smallerTitle.png; sourceTree = ""; }; 6174F7C712CD62E300205D6F /* smallerTitle@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "smallerTitle@2x.png"; path = "Resources/Frontend/smallerTitle@2x.png"; sourceTree = ""; }; 617987E4114AA34C00BA94A9 /* GSHandlers.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = GSHandlers.inc; path = ../../hedgewars/GSHandlers.inc; sourceTree = SOURCE_ROOT; }; - 617987E5114AA34C00BA94A9 /* HHHandlers.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = HHHandlers.inc; path = ../../hedgewars/HHHandlers.inc; sourceTree = SOURCE_ROOT; }; 617987E7114AA34C00BA94A9 /* hwengine.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = hwengine.pas; path = ../../hedgewars/hwengine.pas; sourceTree = SOURCE_ROOT; }; 617987E9114AA34C00BA94A9 /* hwLibrary.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = hwLibrary.pas; path = ../../hedgewars/hwLibrary.pas; sourceTree = SOURCE_ROOT; }; 617987EB114AA34C00BA94A9 /* options.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = options.inc; path = ../../hedgewars/options.inc; sourceTree = SOURCE_ROOT; }; - 617987EC114AA34C00BA94A9 /* PascalExports.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = PascalExports.pas; path = ../../hedgewars/PascalExports.pas; sourceTree = SOURCE_ROOT; }; 617987ED114AA34C00BA94A9 /* SDLh.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = SDLh.pas; path = ../../hedgewars/SDLh.pas; sourceTree = SOURCE_ROOT; }; 617987F1114AA34C00BA94A9 /* uAI.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uAI.pas; path = ../../hedgewars/uAI.pas; sourceTree = SOURCE_ROOT; }; 617987F2114AA34C00BA94A9 /* uAIActions.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uAIActions.pas; path = ../../hedgewars/uAIActions.pas; sourceTree = SOURCE_ROOT; }; @@ -577,7 +517,6 @@ 617987FB114AA34C00BA94A9 /* uGame.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uGame.pas; path = ../../hedgewars/uGame.pas; sourceTree = SOURCE_ROOT; }; 617987FC114AA34C00BA94A9 /* uGears.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uGears.pas; path = ../../hedgewars/uGears.pas; sourceTree = SOURCE_ROOT; }; 617987FD114AA34C00BA94A9 /* uIO.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uIO.pas; path = ../../hedgewars/uIO.pas; sourceTree = SOURCE_ROOT; }; - 617987FE114AA34C00BA94A9 /* uKeys.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uKeys.pas; path = ../../hedgewars/uKeys.pas; sourceTree = SOURCE_ROOT; }; 617987FF114AA34C00BA94A9 /* uLand.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uLand.pas; path = ../../hedgewars/uLand.pas; sourceTree = SOURCE_ROOT; }; 61798800114AA34C00BA94A9 /* uLandGraphics.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uLandGraphics.pas; path = ../../hedgewars/uLandGraphics.pas; sourceTree = SOURCE_ROOT; }; 61798801114AA34C00BA94A9 /* uLandObjects.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uLandObjects.pas; path = ../../hedgewars/uLandObjects.pas; sourceTree = SOURCE_ROOT; }; @@ -599,9 +538,6 @@ 617BC23A1490211F00E1C294 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Italian; path = Locale/Italian.lproj/Scheme.strings; sourceTree = ""; }; 6183D83C11E2BCE200A88903 /* Default-ipad-Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-ipad-Landscape.png"; path = "Resources/Icons/Default-ipad-Landscape.png"; sourceTree = ""; }; 6183D83D11E2BCE200A88903 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = Resources/Icons/Default.png; sourceTree = ""; }; - 61842B23122B619D0096E335 /* HelpPageInGameViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "HelpPageInGameViewController-iPad.xib"; sourceTree = ""; }; - 61842B3D122B65BD0096E335 /* helpabove.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = helpabove.png; path = Resources/Overlay/helpabove.png; sourceTree = ""; }; - 61842B3F122B66280096E335 /* helpleft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = helpleft.png; path = Resources/Overlay/helpleft.png; sourceTree = ""; }; 618899811299516000D55FD6 /* title@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "title@2x~iphone.png"; path = "Resources/Frontend/title@2x~iphone.png"; sourceTree = ""; }; 61889984129995B500D55FD6 /* title~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "title~ipad.png"; path = "Resources/Frontend/title~ipad.png"; sourceTree = ""; }; 61915D58143A4E2C00299991 /* MissionTrainingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MissionTrainingViewController.h; sourceTree = ""; }; @@ -621,8 +557,6 @@ 619C5AF3124F7E3100D041AE /* LuaPas.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = LuaPas.pas; path = ../../hedgewars/LuaPas.pas; sourceTree = SOURCE_ROOT; }; 619C5BA0124FA59000D041AE /* MapPreviewButtonView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MapPreviewButtonView.h; path = Classes/MapPreviewButtonView.h; sourceTree = ""; }; 619C5BA1124FA59000D041AE /* MapPreviewButtonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MapPreviewButtonView.m; path = Classes/MapPreviewButtonView.m; sourceTree = ""; }; - 619E173815227E8E0016654A /* HelpPageLobbyViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelpPageLobbyViewController.h; sourceTree = ""; }; - 619E173915227E8E0016654A /* HelpPageLobbyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HelpPageLobbyViewController.m; sourceTree = ""; }; 61A117FE1168322700359010 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 61A19AE314D2010A004B1E6D /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = "../../../Library/SDL/Xcode-iOS/SDL/SDL.xcodeproj"; sourceTree = SOURCE_ROOT; }; 61A19B6114D20B6C004B1E6D /* SDL_image.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL_image.xcodeproj; path = "../../../Library/SDL_image/Xcode-iOS/SDL_image.xcodeproj"; sourceTree = SOURCE_ROOT; }; @@ -667,8 +601,6 @@ 61D2059F127CDD1100ABD83E /* ObjcExports.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjcExports.h; path = Classes/ObjcExports.h; sourceTree = ""; }; 61D205A0127CDD1100ABD83E /* ObjcExports.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ObjcExports.m; path = Classes/ObjcExports.m; sourceTree = ""; }; 61D3D2A41290E03A003CE7C3 /* irc.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = irc.png; path = Resources/Icons/irc.png; sourceTree = ""; }; - 61DF0EDB1284DF2300F3F10B /* HelpPageLobbyViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "HelpPageLobbyViewController-iPhone.xib"; sourceTree = ""; }; - 61DF0F201284F72A00F3F10B /* HelpPageInGameViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "HelpPageInGameViewController-iPhone.xib"; sourceTree = ""; }; 61E1F4F711D004240016A5AA /* adler32.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = adler32.pas; path = ../../hedgewars/adler32.pas; sourceTree = SOURCE_ROOT; }; 61E2E12C12BAAEE30051B659 /* ServerProtocolNetwork.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServerProtocolNetwork.h; sourceTree = ""; }; 61E2E12D12BAAEE30051B659 /* ServerProtocolNetwork.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ServerProtocolNetwork.m; sourceTree = ""; }; @@ -678,13 +610,6 @@ 61EBA62811DFF2BC0048B68A /* title~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "title~iphone.png"; path = "Resources/Frontend/title~iphone.png"; sourceTree = ""; }; 61EDB5AE135B3F97009B29A6 /* GameInterfaceBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameInterfaceBridge.h; sourceTree = ""; }; 61EDB5AF135B3F97009B29A6 /* GameInterfaceBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameInterfaceBridge.m; sourceTree = ""; }; - 61EF920511DF57AC003441C4 /* arrowDown.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = arrowDown.png; path = Resources/Overlay/arrowDown.png; sourceTree = ""; }; - 61EF920611DF57AC003441C4 /* arrowLeft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = arrowLeft.png; path = Resources/Overlay/arrowLeft.png; sourceTree = ""; }; - 61EF920711DF57AC003441C4 /* arrowRight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = arrowRight.png; path = Resources/Overlay/arrowRight.png; sourceTree = ""; }; - 61EF920811DF57AC003441C4 /* arrowUp.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = arrowUp.png; path = Resources/Overlay/arrowUp.png; sourceTree = ""; }; - 61EF920911DF57AC003441C4 /* joyButtonAttack.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = joyButtonAttack.png; path = Resources/Overlay/joyButtonAttack.png; sourceTree = ""; }; - 61EF920A11DF57AC003441C4 /* joyButtonBackJump.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = joyButtonBackJump.png; path = Resources/Overlay/joyButtonBackJump.png; sourceTree = ""; }; - 61EF920B11DF57AC003441C4 /* joyButtonForwardJump.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = joyButtonForwardJump.png; path = Resources/Overlay/joyButtonForwardJump.png; sourceTree = ""; }; 61F2E7CB1205EDE0005734F7 /* AboutViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AboutViewController.h; sourceTree = ""; }; 61F2E7CC1205EDE0005734F7 /* AboutViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AboutViewController.m; sourceTree = ""; }; 61F2E7CD1205EDE0005734F7 /* AboutViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AboutViewController.xib; sourceTree = ""; }; @@ -744,7 +669,6 @@ 6163EE4D11CC247D001C0453 /* Game Configuration */, 6163EE4C11CC2478001C0453 /* Settings Page */, 611D9BF312497B7700008271 /* Satellite Controllers */, - 6163EE6C11CC253F001C0453 /* Overlay */, 616591F011CA9BA200D6E256 /* MainMenuViewController.h */, 616591F111CA9BA200D6E256 /* MainMenuViewController.m */, 6165924B11CA9CB400D6E256 /* MainMenuViewController-iPad.xib */, @@ -805,12 +729,6 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( - 611EEBC0122B34A800DF6938 /* helpingame.png */, - 611EEC30122B54D700DF6938 /* helpplain.png */, - 611EEBC2122B355700DF6938 /* helpbottom.png */, - 61842B3D122B65BD0096E335 /* helpabove.png */, - 611EEBC3122B355700DF6938 /* helpright.png */, - 61842B3F122B66280096E335 /* helpleft.png */, 6129B9F611EFB04D0017E305 /* denied.png */, 6167C88B14294738003DD50F /* denied@2x.png */, 6199E86C12464A8E00DADF8C /* surprise.png */, @@ -890,7 +808,6 @@ 612CABCA1391D3D1005E9596 /* Sounds */ = { isa = PBXGroup; children = ( - 612CABC71391D3CC005E9596 /* hwclassic.mp3 */, 611EE973122A9C4100DF6938 /* clickSound.caf */, 611EE9D7122AA10A00DF6938 /* backSound.caf */, 611EE9D8122AA10A00DF6938 /* selSound.caf */, @@ -1002,26 +919,6 @@ name = "Third Level"; sourceTree = ""; }; - 6163EE6C11CC253F001C0453 /* Overlay */ = { - isa = PBXGroup; - children = ( - 619E173815227E8E0016654A /* HelpPageLobbyViewController.h */, - 619E173915227E8E0016654A /* HelpPageLobbyViewController.m */, - 616591F811CA9BA200D6E256 /* InGameMenuViewController.h */, - 616591F911CA9BA200D6E256 /* InGameMenuViewController.m */, - 616591F611CA9BA200D6E256 /* OverlayViewController.h */, - 616591F711CA9BA200D6E256 /* OverlayViewController.m */, - 6165925011CA9CB400D6E256 /* OverlayViewController.xib */, - 611EEAEB122B2A4D00DF6938 /* HelpPageInGameViewController.h */, - 611EEAEC122B2A4D00DF6938 /* HelpPageInGameViewController.m */, - 61DF0F201284F72A00F3F10B /* HelpPageInGameViewController-iPhone.xib */, - 61842B23122B619D0096E335 /* HelpPageInGameViewController-iPad.xib */, - 61DF0EDB1284DF2300F3F10B /* HelpPageLobbyViewController-iPhone.xib */, - 611EEAED122B2A4D00DF6938 /* HelpPageLobbyViewController-iPad.xib */, - ); - name = Overlay; - sourceTree = ""; - }; 61641FE21437CD8F006E049C /* Headers */ = { isa = PBXGroup; children = ( @@ -1039,7 +936,6 @@ 61589C5A144B4322007BFAA4 /* config.inc */, 617987EB114AA34C00BA94A9 /* options.inc */, 617987E4114AA34C00BA94A9 /* GSHandlers.inc */, - 617987E5114AA34C00BA94A9 /* HHHandlers.inc */, 614E333D11DE9A93009DBA4E /* VGSHandlers.inc */, ); name = inc; @@ -1048,24 +944,6 @@ 6179936611501D1E00BA94A9 /* Overlay */ = { isa = PBXGroup; children = ( - 611E0EE511FB20610077A41E /* ammoButton.png */, - 6103D399129B350700911D8D /* ammoButton@2x.png */, - 611E0EE611FB20610077A41E /* cornerButton.png */, - 6103D39E129B350700911D8D /* cornerButton@2x.png */, - 61EF920511DF57AC003441C4 /* arrowDown.png */, - 6103D39A129B350700911D8D /* arrowDown@2x.png */, - 61EF920611DF57AC003441C4 /* arrowLeft.png */, - 6103D39B129B350700911D8D /* arrowLeft@2x.png */, - 61EF920711DF57AC003441C4 /* arrowRight.png */, - 6103D39C129B350700911D8D /* arrowRight@2x.png */, - 61EF920811DF57AC003441C4 /* arrowUp.png */, - 6103D39D129B350700911D8D /* arrowUp@2x.png */, - 61EF920911DF57AC003441C4 /* joyButtonAttack.png */, - 6103D392129B34E900911D8D /* joyButtonAttack@2x.png */, - 61EF920A11DF57AC003441C4 /* joyButtonBackJump.png */, - 6103D393129B34E900911D8D /* joyButtonBackJump@2x.png */, - 61EF920B11DF57AC003441C4 /* joyButtonForwardJump.png */, - 6103D394129B34E900911D8D /* joyButtonForwardJump@2x.png */, ); name = Overlay; sourceTree = ""; @@ -1246,6 +1124,7 @@ 9283015C0F10E48900CC5A3C /* Pascal Sources */ = { isa = PBXGroup; children = ( + 615BE3D3155C5DDF003CA34D /* uInputHandler.pas */, 61798892114AA56300BA94A9 /* inc */, 61D08D7114AEA7FE0007C078 /* uGearsHedgehog.pas */, 61D08D7214AEA7FE0007C078 /* uGearsList.pas */, @@ -1272,7 +1151,6 @@ 61E1F4F711D004240016A5AA /* adler32.pas */, 617987E7114AA34C00BA94A9 /* hwengine.pas */, 617987E9114AA34C00BA94A9 /* hwLibrary.pas */, - 617987EC114AA34C00BA94A9 /* PascalExports.pas */, 617987ED114AA34C00BA94A9 /* SDLh.pas */, 617987F1114AA34C00BA94A9 /* uAI.pas */, 617987F2114AA34C00BA94A9 /* uAIActions.pas */, @@ -1287,7 +1165,6 @@ 617987FB114AA34C00BA94A9 /* uGame.pas */, 617987FC114AA34C00BA94A9 /* uGears.pas */, 617987FD114AA34C00BA94A9 /* uIO.pas */, - 617987FE114AA34C00BA94A9 /* uKeys.pas */, 617987FF114AA34C00BA94A9 /* uLand.pas */, 61798800114AA34C00BA94A9 /* uLandGraphics.pas */, 61798801114AA34C00BA94A9 /* uLandObjects.pas */, @@ -1492,14 +1369,6 @@ 611E12FF117BBBDA0044B62F /* Entitlements-Development.plist in Resources */, 6165925311CA9CB400D6E256 /* MainMenuViewController-iPad.xib in Resources */, 6165925511CA9CB400D6E256 /* MapConfigViewController-iPad.xib in Resources */, - 6165925811CA9CB400D6E256 /* OverlayViewController.xib in Resources */, - 61EF920E11DF57AC003441C4 /* arrowDown.png in Resources */, - 61EF920F11DF57AC003441C4 /* arrowLeft.png in Resources */, - 61EF921011DF57AC003441C4 /* arrowRight.png in Resources */, - 61EF921111DF57AC003441C4 /* arrowUp.png in Resources */, - 61EF921211DF57AC003441C4 /* joyButtonAttack.png in Resources */, - 61EF921311DF57AC003441C4 /* joyButtonBackJump.png in Resources */, - 61EF921411DF57AC003441C4 /* joyButtonForwardJump.png in Resources */, 61F9040911DF58B00068B24D /* settingsButton.png in Resources */, 61F9040B11DF59370068B24D /* background.png in Resources */, 61EBA62A11DFF2BC0048B68A /* title~iphone.png in Resources */, @@ -1509,8 +1378,6 @@ 61F7A43C11E290650040BA66 /* Icon.png in Resources */, 61F7A43E11E290650040BA66 /* iTunesArtwork.png in Resources */, 6129B9F711EFB04D0017E305 /* denied.png in Resources */, - 611E0EE711FB20610077A41E /* ammoButton.png in Resources */, - 611E0EE811FB20610077A41E /* cornerButton.png in Resources */, 61F2E7CF1205EDE0005734F7 /* AboutViewController.xib in Resources */, 61F2E7EC12060E31005734F7 /* checkbox.png in Resources */, 615AD96212073B4D00F2FF04 /* startGameButton.png in Resources */, @@ -1518,14 +1385,6 @@ 615AD9EB1207654E00F2FF04 /* helpButton.png in Resources */, 611EE974122A9C4100DF6938 /* clickSound.caf in Resources */, 611EE9DA122AA10A00DF6938 /* selSound.caf in Resources */, - 611EEAEF122B2A4D00DF6938 /* HelpPageLobbyViewController-iPad.xib in Resources */, - 611EEBC1122B34A800DF6938 /* helpingame.png in Resources */, - 611EEBC4122B355700DF6938 /* helpbottom.png in Resources */, - 611EEBC5122B355700DF6938 /* helpright.png in Resources */, - 611EEC31122B54D700DF6938 /* helpplain.png in Resources */, - 61842B24122B619D0096E335 /* HelpPageInGameViewController-iPad.xib in Resources */, - 61842B3E122B65BD0096E335 /* helpabove.png in Resources */, - 61842B40122B66280096E335 /* helpleft.png in Resources */, 6199E86D12464A8E00DADF8C /* surprise.png in Resources */, 611D9BFC12497E9800008271 /* SavedGamesViewController.xib in Resources */, 6147DAD31253DCDE0010357E /* savesButton.png in Resources */, @@ -1536,8 +1395,6 @@ 61A670C212747DBD00B06CE7 /* MapConfigViewController-iPhone.xib in Resources */, 61E2F7441283752C00E12521 /* fb.png in Resources */, 61E2F7451283752C00E12521 /* tw.png in Resources */, - 61DF0EDC1284DF2300F3F10B /* HelpPageLobbyViewController-iPhone.xib in Resources */, - 61DF0F211284F72A00F3F10B /* HelpPageInGameViewController-iPhone.xib in Resources */, 61808A5D128C930A005D0E2F /* backSound.caf in Resources */, 61D3D2A51290E03A003CE7C3 /* irc.png in Resources */, 6172FED91298CF9800D73365 /* background~iphone.png in Resources */, @@ -1547,22 +1404,13 @@ 61889985129995B500D55FD6 /* title~ipad.png in Resources */, 615FEAE212A2A6640098EE92 /* localplayButton~ipad.png in Resources */, 615FEAE312A2A6640098EE92 /* localplayButton~iphone.png in Resources */, - 61188BF212A6FE530026C5DA /* ammoButton@2x.png in Resources */, - 61188BF312A6FE540026C5DA /* arrowDown@2x.png in Resources */, - 61188BF412A6FE560026C5DA /* arrowLeft@2x.png in Resources */, - 61188BF512A6FE570026C5DA /* arrowRight@2x.png in Resources */, - 61188BF612A6FE590026C5DA /* arrowUp@2x.png in Resources */, 61188BF712A6FE5A0026C5DA /* backButton@2x.png in Resources */, 61188BF812A6FE5C0026C5DA /* background@2x~iphone.png in Resources */, 61188BF912A6FE5D0026C5DA /* checkbox@2x.png in Resources */, - 61188BFA12A6FE5E0026C5DA /* cornerButton@2x.png in Resources */, 61188BFB12A6FE610026C5DA /* Default-ipad-Landscape.png in Resources */, 61188BFC12A6FE630026C5DA /* Default@2x.png in Resources */, 61188BFD12A6FE730026C5DA /* fb@2x.png in Resources */, 61188BFE12A6FE7C0026C5DA /* irc@2x.png in Resources */, - 61188BFF12A6FE7E0026C5DA /* joyButtonAttack@2x.png in Resources */, - 61188C0012A6FE810026C5DA /* joyButtonBackJump@2x.png in Resources */, - 61188C0112A6FE820026C5DA /* joyButtonForwardJump@2x.png in Resources */, 61188C0212A6FE840026C5DA /* localplayButton@2x~iphone.png in Resources */, 61188C0312A6FE860026C5DA /* netplayButton.png in Resources */, 61188C0412A6FE880026C5DA /* savesButton@2x.png in Resources */, @@ -1575,7 +1423,6 @@ 6174F7C912CD62E300205D6F /* smallerTitle@2x.png in Resources */, 6167A6771391514600AA6D07 /* RestoreViewController-iPhone.xib in Resources */, 6167A72D13919E6800AA6D07 /* RestoreViewController-iPad.xib in Resources */, - 612CABC81391D3CC005E9596 /* hwclassic.mp3 in Resources */, 6167C87414294727003DD50F /* surprise@2x.png in Resources */, 6167C88C14294738003DD50F /* denied@2x.png in Resources */, 6167C8F51429502C003DD50F /* hedgehog.png in Resources */, @@ -1668,7 +1515,6 @@ files = ( 61798816114AA34C00BA94A9 /* hwengine.pas in Sources */, 61798818114AA34C00BA94A9 /* hwLibrary.pas in Sources */, - 6179881B114AA34C00BA94A9 /* PascalExports.pas in Sources */, 6179881C114AA34C00BA94A9 /* SDLh.pas in Sources */, 6179881F114AA34C00BA94A9 /* uAI.pas in Sources */, 61798820114AA34C00BA94A9 /* uAIActions.pas in Sources */, @@ -1709,8 +1555,6 @@ 6165921511CA9BA200D6E256 /* MainMenuViewController.m in Sources */, 6165921611CA9BA200D6E256 /* MapConfigViewController.m in Sources */, 6165921711CA9BA200D6E256 /* SettingsBaseViewController.m in Sources */, - 6165921811CA9BA200D6E256 /* OverlayViewController.m in Sources */, - 6165921911CA9BA200D6E256 /* InGameMenuViewController.m in Sources */, 6165921A11CA9BA200D6E256 /* SchemeSettingsViewController.m in Sources */, 6165921B11CA9BA200D6E256 /* SchemeWeaponConfigViewController.m in Sources */, 6165921C11CA9BA200D6E256 /* SingleSchemeViewController.m in Sources */, @@ -1728,10 +1572,8 @@ 6163EE7E11CC2600001C0453 /* SingleWeaponViewController.m in Sources */, 61E1F4F811D004240016A5AA /* adler32.pas in Sources */, 61F904D711DF7DA30068B24D /* WeaponCellView.m in Sources */, - 61B3D71C11EA6F2700EC7420 /* uKeys.pas in Sources */, 61C079E411F35A300072BF46 /* EditableCellView.m in Sources */, 61F2E7CE1205EDE0005734F7 /* AboutViewController.m in Sources */, - 611EEAEE122B2A4D00DF6938 /* HelpPageInGameViewController.m in Sources */, 6199E839124647DE00DADF8C /* SupportViewController.m in Sources */, 611D9BFB12497E9800008271 /* SavedGamesViewController.m in Sources */, 619C5AF4124F7E3100D041AE /* LuaPas.pas in Sources */, @@ -1773,7 +1615,7 @@ 615E76BC14E4421200FBA131 /* MGSplitCornersView.m in Sources */, 615E76BD14E4421200FBA131 /* MGSplitDividerView.m in Sources */, 615E76BE14E4421200FBA131 /* MGSplitViewController.m in Sources */, - 619E173A15227E8E0016654A /* HelpPageLobbyViewController.m in Sources */, + 615BE3D4155C5DDF003CA34D /* uInputHandler.pas in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/ammoButton.png Binary file project_files/HedgewarsMobile/Resources/Overlay/ammoButton.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/ammoButton@2x.png Binary file project_files/HedgewarsMobile/Resources/Overlay/ammoButton@2x.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/arrowDown.png Binary file project_files/HedgewarsMobile/Resources/Overlay/arrowDown.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/arrowDown@2x.png Binary file project_files/HedgewarsMobile/Resources/Overlay/arrowDown@2x.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/arrowLeft.png Binary file project_files/HedgewarsMobile/Resources/Overlay/arrowLeft.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/arrowLeft@2x.png Binary file project_files/HedgewarsMobile/Resources/Overlay/arrowLeft@2x.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/arrowRight.png Binary file project_files/HedgewarsMobile/Resources/Overlay/arrowRight.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/arrowRight@2x.png Binary file project_files/HedgewarsMobile/Resources/Overlay/arrowRight@2x.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/arrowUp.png Binary file project_files/HedgewarsMobile/Resources/Overlay/arrowUp.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/arrowUp@2x.png Binary file project_files/HedgewarsMobile/Resources/Overlay/arrowUp@2x.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/cornerButton.png Binary file project_files/HedgewarsMobile/Resources/Overlay/cornerButton.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/cornerButton@2x.png Binary file project_files/HedgewarsMobile/Resources/Overlay/cornerButton@2x.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/helpabove.png Binary file project_files/HedgewarsMobile/Resources/Overlay/helpabove.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/helpbottom.png Binary file project_files/HedgewarsMobile/Resources/Overlay/helpbottom.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/helpingame.png Binary file project_files/HedgewarsMobile/Resources/Overlay/helpingame.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/helpleft.png Binary file project_files/HedgewarsMobile/Resources/Overlay/helpleft.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/helpplain.png Binary file project_files/HedgewarsMobile/Resources/Overlay/helpplain.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/helpright.png Binary file project_files/HedgewarsMobile/Resources/Overlay/helpright.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/joyButtonAttack.png Binary file project_files/HedgewarsMobile/Resources/Overlay/joyButtonAttack.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/joyButtonAttack@2x.png Binary file project_files/HedgewarsMobile/Resources/Overlay/joyButtonAttack@2x.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/joyButtonBackJump.png Binary file project_files/HedgewarsMobile/Resources/Overlay/joyButtonBackJump.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/joyButtonBackJump@2x.png Binary file project_files/HedgewarsMobile/Resources/Overlay/joyButtonBackJump@2x.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/joyButtonForwardJump.png Binary file project_files/HedgewarsMobile/Resources/Overlay/joyButtonForwardJump.png has changed diff -r 846cea23aea2 -r c91d33837b0d project_files/HedgewarsMobile/Resources/Overlay/joyButtonForwardJump@2x.png Binary file project_files/HedgewarsMobile/Resources/Overlay/joyButtonForwardJump@2x.png has changed diff -r 846cea23aea2 -r c91d33837b0d share/hedgewars/Data/Graphics/LandIce.png Binary file share/hedgewars/Data/Graphics/LandIce.png has changed diff -r 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d 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 846cea23aea2 -r c91d33837b0d share/hedgewars/Data/Locale/missions_en.txt --- a/share/hedgewars/Data/Locale/missions_en.txt Thu May 03 22:48:02 2012 +0200 +++ b/share/hedgewars/Data/Locale/missions_en.txt Tue May 22 11:19:32 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 846cea23aea2 -r c91d33837b0d 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 11:19:32 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 846cea23aea2 -r c91d33837b0d 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 11:19:32 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 846cea23aea2 -r c91d33837b0d 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 11:19:32 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 846cea23aea2 -r c91d33837b0d 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 11:19:32 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 846cea23aea2 -r c91d33837b0d 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 11:19:32 2012 +0200 @@ -0,0 +1,2 @@ +Shoppa +Shoppa diff -r 846cea23aea2 -r c91d33837b0d 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 11:19:32 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 diff -r 846cea23aea2 -r c91d33837b0d tools/PascalBasics.hs --- a/tools/PascalBasics.hs Thu May 03 22:48:02 2012 +0200 +++ b/tools/PascalBasics.hs Tue May 22 11:19:32 2012 +0200 @@ -8,7 +8,7 @@ import Text.Parsec.Language import Data.Char -builtin = ["succ", "pred", "low", "high", "ord", "inc", "dec", "exit"] +builtin = ["succ", "pred", "low", "high", "ord", "inc", "dec", "exit", "break", "continue", "length"] pascalLanguageDef = emptyDef diff -r 846cea23aea2 -r c91d33837b0d tools/PascalParser.hs --- a/tools/PascalParser.hs Thu May 03 22:48:02 2012 +0200 +++ b/tools/PascalParser.hs Tue May 22 11:19:32 2012 +0200 @@ -10,6 +10,7 @@ import Text.Parsec.String import Control.Monad import Data.Maybe +import Data.Char import PascalBasics import PascalUnitSyntaxTree @@ -355,7 +356,9 @@ , try $ natural pas >>= \i -> notFollowedBy (char '.') >> (return . NumberLiteral . show) i , float pas >>= return . FloatLiteral . show , natural pas >>= return . NumberLiteral . show - , stringLiteral pas >>= return . StringLiteral + , try (string "_S" >> stringLiteral pas) >>= return . StringLiteral + , try (string "_P" >> stringLiteral pas) >>= return . PCharLiteral + , stringLiteral pas >>= return . strOrChar , try (string "#$") >> many hexDigit >>= \c -> comments >> return (HexCharCode c) , char '#' >> many digit >>= \c -> comments >> return (CharCode c) , char '$' >> many hexDigit >>= \h -> comments >> return (HexNumber h) @@ -380,16 +383,20 @@ , Infix (try (string ">=") >> return (BinOp ">=")) AssocNone , Infix (char '<' >> return (BinOp "<")) AssocNone , Infix (char '>' >> return (BinOp ">")) AssocNone - , Infix (char '=' >> return (BinOp "=")) AssocNone + ] + , [ Infix (try $ string "shl" >> return (BinOp "shl")) AssocNone + , Infix (try $ string "shr" >> return (BinOp "shr")) AssocNone ] , [ Infix (try $ string "and" >> return (BinOp "and")) AssocLeft , Infix (try $ string "or" >> return (BinOp "or")) AssocLeft , Infix (try $ string "xor" >> return (BinOp "xor")) AssocLeft ] - , [ Infix (try $ string "shl" >> return (BinOp "shl")) AssocNone - , Infix (try $ string "shr" >> return (BinOp "shr")) AssocNone + , [ + Infix (char '=' >> return (BinOp "=")) AssocNone ] ] + strOrChar [a] = CharCode . show . ord $ a + strOrChar a = StringLiteral a phrasesBlock = do try $ string "begin" @@ -563,14 +570,16 @@ return (i ,e) table = [ - [ Infix (char '*' >> return (InitBinOp "*")) AssocLeft + [ + Prefix (char '-' >> return (InitPrefixOp "-")) + ] + , [ Infix (char '*' >> return (InitBinOp "*")) AssocLeft , Infix (char '/' >> return (InitBinOp "/")) AssocLeft , Infix (try (string "div") >> return (InitBinOp "div")) AssocLeft , Infix (try (string "mod") >> return (InitBinOp "mod")) AssocLeft ] , [ Infix (char '+' >> return (InitBinOp "+")) AssocLeft , Infix (char '-' >> return (InitBinOp "-")) AssocLeft - , Prefix (char '-' >> return (InitPrefixOp "-")) ] , [ Infix (try (string "<>") >> return (InitBinOp "<>")) AssocNone , Infix (try (string "<=") >> return (InitBinOp "<=")) AssocNone @@ -611,4 +620,3 @@ string "var" v <- varsDecl True return $ System (t ++ v) - \ No newline at end of file diff -r 846cea23aea2 -r c91d33837b0d tools/PascalPreprocessor.hs --- a/tools/PascalPreprocessor.hs Thu May 03 22:48:02 2012 +0200 +++ b/tools/PascalPreprocessor.hs Tue May 22 11:19:32 2012 +0200 @@ -15,7 +15,10 @@ , (try $ string "//") >> manyTill anyChar (try newline) >> return "\n" ] -initDefines = Map.fromList [("FPC", ""), ("PAS2C", "")] +initDefines = Map.fromList [ + ("FPC", "") + , ("PAS2C", "") + ] preprocess :: String -> IO String preprocess fn = do @@ -118,7 +121,7 @@ i <- identifier d <- ((string ":=" >> return ())<|> spaces) >> many (noneOf "}") char '}' - updateState $ \(m, b) -> (if and b then Map.insert i d m else m, b) + updateState $ \(m, b) -> (if (and b) && (head i /= '_') then Map.insert i d m else m, b) return "" replace s = do (m, _) <- getState diff -r 846cea23aea2 -r c91d33837b0d tools/PascalUnitSyntaxTree.hs --- a/tools/PascalUnitSyntaxTree.hs Thu May 03 22:48:02 2012 +0200 +++ b/tools/PascalUnitSyntaxTree.hs Tue May 22 11:19:32 2012 +0200 @@ -61,6 +61,7 @@ | PostfixOp String Expression | BinOp String Expression Expression | StringLiteral String + | PCharLiteral String | CharCode String | HexCharCode String | NumberLiteral String @@ -103,10 +104,9 @@ | BTInt | BTBool | BTFloat - | BTRecord [(String, BaseType)] + | BTRecord String [(String, BaseType)] | BTArray Range BaseType BaseType - | BTFunction BaseType - | BTFunctionReturn String BaseType + | BTFunction Int BaseType | BTPointerTo BaseType | BTUnresolved String | BTSet BaseType diff -r 846cea23aea2 -r c91d33837b0d tools/pas2c.hs --- a/tools/pas2c.hs Thu May 03 22:48:02 2012 +0200 +++ b/tools/pas2c.hs Tue May 22 11:19:32 2012 +0200 @@ -13,6 +13,7 @@ import Control.Exception import System.IO.Error import qualified Data.Map as Map +import qualified Data.Set as Set import Data.List (find) import Numeric @@ -23,20 +24,25 @@ data InsertOption = IOInsert | IOLookup + | IOLookupLast + | IOLookupFunction Int | IODeferred -type Record = (String, (String, BaseType)) +type Record = (String, BaseType) +type Records = Map.Map String [Record] data RenderState = RenderState { - currentScope :: [Record], + currentScope :: Records, lastIdentifier :: String, lastType :: BaseType, stringConsts :: [(String, String)], uniqCounter :: Int, - namespaces :: Map.Map String [Record] + toMangle :: Set.Set String, + currentUnit :: String, + namespaces :: Map.Map String Records } -emptyState = RenderState [] "" BTUnknown [] 0 +emptyState = RenderState Map.empty "" BTUnknown [] 0 Set.empty "" getUniq :: State RenderState Int getUniq = do @@ -115,16 +121,20 @@ renderCFiles units = do let u = Map.toList units let nss = Map.map (toNamespace nss) units - hPutStrLn stderr $ "Units: " ++ (show . Map.keys . Map.filter (not . null) $ nss) + hPutStrLn stderr $ "Units: " ++ (show . Map.keys . Map.filter (not . Map.null) $ nss) --writeFile "pas2c.log" $ unlines . map (\t -> show (fst t) ++ "\n" ++ (unlines . map ((:) '\t' . show) . snd $ t)) . Map.toList $ nss mapM_ (toCFiles nss) u where - toNamespace :: Map.Map String [Record] -> PascalUnit -> [Record] + toNamespace :: Map.Map String Records -> PascalUnit -> Records toNamespace nss (System tvs) = - currentScope $ execState (mapM_ (tvar2C True) tvs) (emptyState nss) - toNamespace _ (Program {}) = [] - toNamespace nss (Unit _ interface _ _ _) = - currentScope $ execState (interface2C interface) (emptyState nss) + currentScope $ execState f (emptyState nss) + where + f = do + checkDuplicateFunDecls tvs + mapM_ (tvar2C True) tvs + toNamespace _ (Program {}) = Map.empty + toNamespace nss (Unit (Identifier i _) interface _ _ _) = + currentScope $ execState (interface2C interface) (emptyState nss){currentUnit = map toLower i ++ "_"} withState' :: (RenderState -> RenderState) -> State RenderState a -> State RenderState a @@ -142,24 +152,25 @@ withLastIdNamespace f = do li <- gets lastIdentifier nss <- gets namespaces - withState' (\st -> st{currentScope = fromMaybe [] $ Map.lookup li (namespaces st)}) f + withState' (\st -> st{currentScope = fromMaybe Map.empty $ Map.lookup li (namespaces st)}) f withRecordNamespace :: String -> [(String, BaseType)] -> State RenderState Doc -> State RenderState Doc withRecordNamespace _ [] = error "withRecordNamespace: empty record" withRecordNamespace prefix recs = withState' f where - f st = st{currentScope = records ++ currentScope st} - records = map (\(a, b) -> (map toLower a, (prefix ++ a, b))) recs + f st = st{currentScope = Map.unionWith un records (currentScope st), currentUnit = ""} + records = Map.fromList $ map (\(a, b) -> (map toLower a, [(prefix ++ a, b)])) recs + un [a] b = a : b -toCFiles :: Map.Map String [Record] -> (String, PascalUnit) -> IO () +toCFiles :: Map.Map String Records -> (String, PascalUnit) -> IO () toCFiles _ (_, System _) = return () toCFiles ns p@(fn, pu) = do hPutStrLn stderr $ "Rendering '" ++ fn ++ "'..." toCFiles' p where toCFiles' (fn, p@(Program {})) = writeFile (fn ++ ".c") $ (render2C initialState . pascal2C) p - toCFiles' (fn, (Unit unitId interface implementation _ _)) = do - let (a, s) = runState (id2C IOInsert (setBaseType BTUnit unitId) >> interface2C interface) initialState + toCFiles' (fn, (Unit unitId@(Identifier i _) interface implementation _ _)) = do + let (a, s) = runState (id2C IOInsert (setBaseType BTUnit unitId) >> interface2C interface) initialState{currentUnit = map toLower i ++ "_"} writeFile (fn ++ ".h") $ "#pragma once\n\n#include \"pas2c.h\"\n\n" ++ (render (a $+$ text "")) writeFile (fn ++ ".c") $ "#include \"" ++ fn ++ ".h\"\n" ++ (render2C s . implementation2C) implementation initialState = emptyState ns @@ -199,9 +210,19 @@ r <- renderStringConsts return (u $+$ r $+$ tv) +checkDuplicateFunDecls :: [TypeVarDeclaration] -> State RenderState () +checkDuplicateFunDecls tvs = + modify $ \s -> s{toMangle = Map.keysSet . Map.filter (> 1) . foldr ins initMap $ tvs} + where + initMap = Map.empty + --initMap = Map.fromList [("reset", 2)] + ins (FunctionDeclaration (Identifier i _) _ _ _) m = Map.insertWith (+) (map toLower i) 1 m + ins _ m = m typesAndVars2C :: Bool -> TypesAndVars -> State RenderState Doc -typesAndVars2C b (TypesAndVars ts) = liftM (vcat . map (<> semi) . concat) $ mapM (tvar2C b) ts +typesAndVars2C b (TypesAndVars ts) = do + checkDuplicateFunDecls ts + liftM (vcat . map (<> semi) . concat) $ mapM (tvar2C b) ts setBaseType :: BaseType -> Identifier -> Identifier setBaseType bt (Identifier i _) = Identifier i bt @@ -214,8 +235,7 @@ where injectNamespace (Identifier i _) = do getNS <- gets (flip Map.lookup . namespaces) - let f = flip (foldl (flip (:))) (fromMaybe [] (getNS i)) - modify (\s -> s{currentScope = f $ currentScope s}) + modify (\s -> s{currentScope = Map.unionWith (++) (fromMaybe Map.empty (getNS i)) $ currentScope s}) uses2List :: Uses -> [String] uses2List (Uses ids) = map (\(Identifier i _) -> i) ids @@ -224,49 +244,70 @@ id2C :: InsertOption -> Identifier -> State RenderState Doc id2C IOInsert (Identifier i t) = do ns <- gets currentScope -{-- case t of - BTUnknown -> do - ns <- gets currentScope - error $ "id2C IOInsert: type BTUnknown for " ++ show i ++ "\nnamespace: " ++ show (take 100 ns) - _ -> do --} - modify (\s -> s{currentScope = (n, (i, t)) : currentScope s, lastIdentifier = n}) - return $ text i + tom <- gets (Set.member n . toMangle) + cu <- gets currentUnit + let i' = case (t, tom) of + (BTFunction p _, True) -> cu ++ i ++ ('_' : show p) + (BTFunction _ _, _) -> cu ++ i + _ -> i + modify (\s -> s{currentScope = Map.insertWith (++) n [(i', t)] (currentScope s), lastIdentifier = n}) + return $ text i' where n = map toLower i -id2C IOLookup (Identifier i t) = do +id2C IOLookup i = id2CLookup head i +id2C IOLookupLast i = id2CLookup last i +id2C (IOLookupFunction params) (Identifier i t) = do let i' = map toLower i - v <- gets $ find (\(a, _) -> a == i') . currentScope - ns <- gets currentScope + v <- gets $ Map.lookup i' . currentScope lt <- gets lastType if isNothing v then - error $ "Not defined: '" ++ i' ++ "'\n" ++ show lt ++ "\n" ++ show (take 100 ns) + error $ "Not defined: '" ++ i' ++ "'\n" ++ show lt ++ "\nwith num of params = " ++ show params ++ "\n" ++ show v else - let vv = snd $ fromJust v in modify (\s -> s{lastType = snd vv, lastIdentifier = fst vv}) >> (return . text . fst $ vv) + let vv = fromMaybe (head $ fromJust v) . find checkParam $ fromJust v in + modify (\s -> s{lastType = snd vv, lastIdentifier = fst vv}) >> (return . text . fst $ vv) + where + checkParam (_, BTFunction p _) = p == params + checkParam _ = False id2C IODeferred (Identifier i t) = do let i' = map toLower i - v <- gets $ find (\(a, _) -> a == i') . currentScope + v <- gets $ Map.lookup i' . currentScope if (isNothing v) then - return $ text i + modify (\s -> s{lastType = BTUnknown, lastIdentifier = i}) >> return (text i) else - return . text . fst . snd . fromJust $ v + let vv = head $ fromJust v in modify (\s -> s{lastType = snd vv, lastIdentifier = fst vv}) >> (return . text . fst $ vv) +id2CLookup :: ([Record] -> Record) -> Identifier -> State RenderState Doc +id2CLookup f (Identifier i _) = do + let i' = map toLower i + v <- gets $ Map.lookup i' . currentScope + lt <- gets lastType + if isNothing v then + error $ "Not defined: '" ++ i' ++ "'\n" ++ show lt + else + let vv = f $ fromJust v in modify (\s -> s{lastType = snd vv, lastIdentifier = fst vv}) >> (return . text . fst $ vv) + + id2CTyped :: TypeDecl -> Identifier -> State RenderState Doc id2CTyped t (Identifier i _) = do tb <- resolveType t - ns <- gets currentScope - case tb of - BTUnknown -> do - ns <- gets currentScope - error $ "id2CTyped: type BTUnknown for " ++ show i ++ "\ntype: " ++ show t ++ "\nnamespace: " ++ show (take 100 ns) - _ -> return () - id2C IOInsert (Identifier i tb) + case (t, tb) of + (_, BTUnknown) -> do + error $ "id2CTyped: type BTUnknown for " ++ show i ++ "\ntype: " ++ show t + (SimpleType {}, BTRecord _ r) -> do + ts <- type2C t + id2C IOInsert (Identifier i (BTRecord (render $ ts empty) r)) + (_, BTRecord _ r) -> do + ts <- type2C t + id2C IOInsert (Identifier i (BTRecord i r)) + _ -> id2C IOInsert (Identifier i tb) + resolveType :: TypeDecl -> State RenderState BaseType resolveType st@(SimpleType (Identifier i _)) = do let i' = map toLower i - v <- gets $ find (\(a, _) -> a == i') . currentScope - if isJust v then return . snd . snd $ fromJust v else return $ f i' + v <- gets $ Map.lookup i' . currentScope + if isJust v then return . snd . head $ fromJust v else return $ f i' where f "integer" = BTInt f "pointer" = BTPointerTo BTVoid @@ -279,7 +320,7 @@ resolveType (PointerTo t) = liftM BTPointerTo $ resolveType t resolveType (RecordType tv mtvs) = do tvs <- mapM f (concat $ tv : fromMaybe [] mtvs) - return . BTRecord . concat $ tvs + return . BTRecord "" . concat $ tvs where f :: TypeVarDeclaration -> State RenderState [(String, BaseType)] f (VarDeclaration _ (ids, td) _) = mapM (\(Identifier i _) -> liftM ((,) i) $ resolveType td) ids @@ -287,7 +328,7 @@ t' <- resolveType t return $ BTArray i BTInt t' resolveType (ArrayDecl Nothing t) = liftM (BTArray RangeInfinite BTInt) $ resolveType t -resolveType (FunctionType t _) = liftM BTFunction $ resolveType t +resolveType (FunctionType t a) = liftM (BTFunction (length a)) $ resolveType t resolveType (DeriveType (InitHexNumber _)) = return BTInt resolveType (DeriveType (InitNumber _)) = return BTInt resolveType (DeriveType (InitFloat _)) = return BTFloat @@ -306,37 +347,41 @@ resolve :: String -> BaseType -> State RenderState BaseType resolve s (BTUnresolved t) = do - v <- gets $ find (\(a, _) -> a == t) . currentScope + v <- gets $ Map.lookup t . currentScope if isJust v then - resolve s . snd . snd . fromJust $ v + resolve s . snd . head . fromJust $ v else error $ "Unknown type " ++ show t ++ "\n" ++ s resolve _ t = return t fromPointer :: String -> BaseType -> State RenderState BaseType fromPointer s (BTPointerTo t) = resolve s t -fromPointer s (BTFunctionReturn _ (BTPointerTo t)) = resolve s t fromPointer s t = do - ns <- gets currentScope - error $ "Dereferencing from non-pointer type " ++ show t ++ "\n" ++ s ++ "\n\n" ++ show (take 100 ns) + error $ "Dereferencing from non-pointer type " ++ show t ++ "\n" ++ s functionParams2C params = liftM (hcat . punctuate comma . concat) $ mapM (tvar2C False) params +numberOfDeclarations :: [TypeVarDeclaration] -> Int +numberOfDeclarations = sum . map cnt + where + cnt (VarDeclaration _ (ids, _) _) = length ids + cnt _ = 1 + fun2C :: Bool -> String -> TypeVarDeclaration -> State RenderState [Doc] fun2C _ _ (FunctionDeclaration name returnType params Nothing) = do t <- type2C returnType t'<- gets lastType p <- withState' id $ functionParams2C params - n <- id2C IOInsert $ setBaseType (BTFunction t') name + n <- id2C IOInsert $ setBaseType (BTFunction (numberOfDeclarations params) t') name return [t empty <+> n <> parens p] fun2C True rv (FunctionDeclaration name returnType params (Just (tvars, phrase))) = do let res = docToLower $ text rv <> text "_result" t <- type2C returnType t'<- gets lastType - n <- id2C IOInsert $ setBaseType (BTFunction t') name - (p, ph) <- withState' (\st -> st{currentScope = (map toLower rv, (render res, BTFunctionReturn (render n) t')) : currentScope st}) $ do + n <- id2C IOInsert $ setBaseType (BTFunction (numberOfDeclarations params) t') name + (p, ph) <- withState' (\st -> st{currentScope = Map.insertWith un (map toLower rv) [(render res, t')] $ currentScope st}) $ do p <- functionParams2C params ph <- liftM2 ($+$) (typesAndVars2C False tvars) (phrase2C' phrase) return (p, ph) @@ -354,6 +399,7 @@ where phrase2C' (Phrases p) = liftM vcat $ mapM phrase2C p phrase2C' p = phrase2C p + un [a] b = a : b fun2C False _ (FunctionDeclaration (Identifier name _) _ _ _) = error $ "nested functions not allowed: " ++ name fun2C _ tv _ = error $ "fun2C: I don't render " ++ show tv @@ -363,9 +409,7 @@ fun2C b name f tvar2C _ td@(TypeDeclaration i' t) = do i <- id2CTyped t i' - tp <- case t of - FunctionType {} -> type2C (PointerTo t) - _ -> type2C t + tp <- type2C t return [text "typedef" <+> tp i] tvar2C _ (VarDeclaration isConst (ids, t) mInitExpr) = do @@ -380,6 +424,7 @@ i' <- id2CTyped t i ie <- initExpr2C e return [text "#define" <+> i' <+> parens ie <> text "\n"] + (_, BTFunction{}, _, Nothing) -> liftM (map(\i -> t' $ text "*" <+> i)) $ mapM (id2CTyped t) ids _ -> liftM (map(\i -> t' i <+> ie)) $ mapM (id2CTyped t) ids where initExpr Nothing = return $ empty @@ -394,9 +439,7 @@ op2CTyped op t = do t' <- liftM (render . hcat . punctuate (char '_') . map (\t -> t empty)) $ mapM type2C t bt <- gets lastType - return $ case bt of - BTRecord {} -> Identifier (t' ++ "_op_" ++ opStr) bt - _ -> Identifier t' bt + return $ Identifier (t' ++ "_op_" ++ opStr) bt where opStr = case op of "+" -> "add" @@ -406,6 +449,7 @@ "=" -> "eq" "<" -> "lt" ">" -> "gt" + "<>" -> "neq" _ -> error $ "op2CTyped: unknown op '" ++ op ++ "'" extractTypes :: [TypeVarDeclaration] -> [TypeDecl] @@ -414,27 +458,28 @@ f (VarDeclaration _ (ids, t) _) = replicate (length ids) t f a = error $ "extractTypes: can't extract from " ++ show a -initExpr2C :: InitExpression -> State RenderState Doc -initExpr2C InitNull = return $ text "NULL" -initExpr2C (InitAddress expr) = liftM ((<>) (text "&")) (initExpr2C expr) -initExpr2C (InitPrefixOp op expr) = liftM (text (op2C op) <>) (initExpr2C expr) -initExpr2C (InitBinOp op expr1 expr2) = do - e1 <- initExpr2C expr1 - e2 <- initExpr2C expr2 +initExpr2C, initExpr2C' :: InitExpression -> State RenderState Doc +initExpr2C (InitArray values) = liftM (braces . vcat . punctuate comma) $ mapM initExpr2C values +initExpr2C a = initExpr2C' a +initExpr2C' InitNull = return $ text "NULL" +initExpr2C' (InitAddress expr) = liftM ((<>) (text "&")) (initExpr2C' expr) +initExpr2C' (InitPrefixOp op expr) = liftM (text (op2C op) <>) (initExpr2C' expr) +initExpr2C' (InitBinOp op expr1 expr2) = do + e1 <- initExpr2C' expr1 + e2 <- initExpr2C' expr2 return $ parens $ e1 <+> text (op2C op) <+> e2 -initExpr2C (InitNumber s) = return $ text s -initExpr2C (InitFloat s) = return $ text s -initExpr2C (InitHexNumber s) = return $ text "0x" <> (text . map toLower $ s) -initExpr2C (InitString [a]) = return . quotes $ text [a] -initExpr2C (InitString s) = return $ strInit s -initExpr2C (InitChar a) = return $ quotes $ text "\\x" <> text (showHex (read a) "") -initExpr2C (InitReference i) = id2C IOLookup i -initExpr2C (InitRecord fields) = do +initExpr2C' (InitNumber s) = return $ text s +initExpr2C' (InitFloat s) = return $ text s +initExpr2C' (InitHexNumber s) = return $ text "0x" <> (text . map toLower $ s) +initExpr2C' (InitString [a]) = return . quotes $ text [a] +initExpr2C' (InitString s) = return $ strInit s +initExpr2C' (InitChar a) = return $ quotes $ text "\\x" <> text (showHex (read a) "") +initExpr2C' (InitReference i) = id2C IOLookup i +initExpr2C' (InitRecord fields) = do (fs :: [Doc]) <- mapM (\(Identifier a _, b) -> liftM (text "." <> text a <+> equals <+>) $ initExpr2C b) fields return $ lbrace $+$ (nest 4 . vcat . punctuate comma $ fs) $+$ rbrace -initExpr2C (InitArray [value]) = initExpr2C value -initExpr2C (InitArray values) = liftM (braces . vcat . punctuate comma) $ mapM initExpr2C values -initExpr2C r@(InitRange (Range i@(Identifier i' _))) = do +initExpr2C' (InitArray [value]) = initExpr2C value +initExpr2C' r@(InitRange (Range i@(Identifier i' _))) = do id2C IOLookup i t <- gets lastType case t of @@ -443,28 +488,28 @@ "byte" -> return $ int 256 _ -> error $ "InitRange identifier: " ++ i' _ -> error $ "InitRange: " ++ show r -initExpr2C (InitRange (RangeFromTo (InitNumber "0") r)) = initExpr2C $ BuiltInFunction "succ" [r] -initExpr2C (InitRange (RangeFromTo (InitChar "0") (InitChar r))) = initExpr2C $ BuiltInFunction "succ" [InitNumber r] -initExpr2C (InitRange a) = error $ show a --return $ text "<>" -initExpr2C (InitSet []) = return $ text "0" -initExpr2C (InitSet a) = return $ text "<>" -initExpr2C (BuiltInFunction "low" [InitReference e]) = return $ +initExpr2C' (InitRange (RangeFromTo (InitNumber "0") r)) = initExpr2C $ BuiltInFunction "succ" [r] +initExpr2C' (InitRange (RangeFromTo (InitChar "0") (InitChar r))) = initExpr2C $ BuiltInFunction "succ" [InitNumber r] +initExpr2C' (InitRange a) = error $ show a --return $ text "<>" +initExpr2C' (InitSet []) = return $ text "0" +initExpr2C' (InitSet a) = return $ text "<>" +initExpr2C' (BuiltInFunction "low" [InitReference e]) = return $ case e of (Identifier "LongInt" _) -> int (-2^31) (Identifier "SmallInt" _) -> int (-2^15) _ -> error $ "BuiltInFunction 'low': " ++ show e -initExpr2C (BuiltInFunction "high" [e]) = do +initExpr2C' (BuiltInFunction "high" [e]) = do initExpr2C e t <- gets lastType case t of - (BTArray i _ _) -> initExpr2C $ BuiltInFunction "pred" [InitRange i] + (BTArray i _ _) -> initExpr2C' $ BuiltInFunction "pred" [InitRange i] a -> error $ "BuiltInFunction 'high': " ++ show a -initExpr2C (BuiltInFunction "succ" [BuiltInFunction "pred" [e]]) = initExpr2C e -initExpr2C (BuiltInFunction "pred" [BuiltInFunction "succ" [e]]) = initExpr2C e -initExpr2C (BuiltInFunction "succ" [e]) = liftM (<> text " + 1") $ initExpr2C e -initExpr2C (BuiltInFunction "pred" [e]) = liftM (<> text " - 1") $ initExpr2C e -initExpr2C b@(BuiltInFunction _ _) = error $ show b -initExpr2C a = error $ "initExpr2C: don't know how to render " ++ show a +initExpr2C' (BuiltInFunction "succ" [BuiltInFunction "pred" [e]]) = initExpr2C' e +initExpr2C' (BuiltInFunction "pred" [BuiltInFunction "succ" [e]]) = initExpr2C' e +initExpr2C' (BuiltInFunction "succ" [e]) = liftM (<> text " + 1") $ initExpr2C' e +initExpr2C' (BuiltInFunction "pred" [e]) = liftM (<> text " - 1") $ initExpr2C' e +initExpr2C' b@(BuiltInFunction _ _) = error $ show b +initExpr2C' a = error $ "initExpr2C: don't know how to render " ++ show a range2C :: InitExpression -> State RenderState [Doc] @@ -489,32 +534,43 @@ where type2C' VoidType = return (text "void" <+>) type2C' (String l) = return (text "string255" <+>)--return (text ("string" ++ show l) <+>) - type2C' (PointerTo (SimpleType i)) = liftM (\i a -> text "struct __" <> i <+> text "*" <+> a) $ id2C IODeferred i + type2C' (PointerTo (SimpleType i)) = do + i' <- id2C IODeferred i + lt <- gets lastType + case lt of + BTRecord _ _ -> return $ \a -> text "struct __" <> i' <+> text "*" <+> a + BTUnknown -> return $ \a -> text "struct __" <> i' <+> text "*" <+> a + _ -> return $ \a -> i' <+> text "*" <+> a type2C' (PointerTo t) = liftM (\t a -> t (parens $ text "*" <> a)) $ type2C t type2C' (RecordType tvs union) = do - t <- withState' id $ mapM (tvar2C False) tvs + t <- withState' f $ mapM (tvar2C False) tvs u <- unions return $ \i -> text "struct __" <> i <+> lbrace $+$ nest 4 ((vcat . map (<> semi) . concat $ t) $$ u) $+$ rbrace <+> i where + f s = s{currentUnit = ""} unions = case union of Nothing -> return empty Just a -> do structs <- mapM struct2C a return $ text "union" $+$ braces (nest 4 $ vcat structs) <> semi struct2C tvs = do - t <- withState' id $ mapM (tvar2C False) tvs + t <- withState' f $ mapM (tvar2C False) tvs return $ text "struct" $+$ braces (nest 4 (vcat . map (<> semi) . concat $ t)) <> semi type2C' (RangeType r) = return (text "int" <+>) type2C' (Sequence ids) = do is <- mapM (id2C IOInsert . setBaseType bt) ids - return (text "enum" <+> (braces . vcat . punctuate comma . map (\(a, b) -> a <+> equals <+> text "0x" <> text (showHex b "")) $ zip is [1..]) <+>) + return (text "enum" <+> (braces . vcat . punctuate comma . map (\(a, b) -> a <+> equals <+> text "0x" <> text (showHex b "")) $ zip is [0..]) <+>) where bt = BTEnum $ map (\(Identifier i _) -> map toLower i) ids type2C' (ArrayDecl Nothing t) = type2C (PointerTo t) type2C' (ArrayDecl (Just r) t) = do t' <- type2C t + lt <- gets lastType + ft <- case lt of + BTFunction {} -> type2C (PointerTo t) + _ -> return t' r' <- initExpr2C (InitRange r) - return $ \i -> t' i <> brackets r' + return $ \i -> ft i <> brackets r' type2C' (Set t) = return (text "<>" <+>) type2C' (FunctionType returnType params) = do t <- type2C returnType @@ -555,10 +611,22 @@ phrase2C (Assignment ref expr) = do r <- ref2C ref t <- gets lastType - e <- case (t, expr) of - (BTFunction _, (Reference r')) -> ref2C r' - _ -> expr2C expr - return $ r <+> text "=" <+> e <> semi + case (t, expr) of + (BTFunction {}, (Reference r')) -> do + e <- ref2C r' + return $ r <+> text "=" <+> e <> semi + (BTArray (Range _) _ _, _) -> phrase2C $ + ProcCall (FunCall + [ + Reference $ Address ref + , Reference $ Address $ RefExpression expr + , Reference $ FunCall [expr] (SimpleReference (Identifier "sizeof" BTUnknown)) + ] + (SimpleReference (Identifier "memcpy" BTUnknown)) + ) [] + _ -> do + e <- expr2C expr + return $ r <+> text "=" <+> e <> semi phrase2C (WhileCycle expr phrase) = do e <- expr2C expr p <- phrase2C $ wrapPhrase phrase @@ -585,10 +653,9 @@ r <- ref2C ref t <- gets lastType case t of - (BTRecord rs) -> withRecordNamespace (render r ++ ".") rs $ phrase2C $ wrapPhrase p + (BTRecord _ rs) -> withRecordNamespace (render r ++ ".") rs $ phrase2C $ wrapPhrase p a -> do - ns <- gets currentScope - error $ "'with' block referencing non-record type " ++ show a ++ "\n" ++ show wb ++ "\nnamespace: " ++ show (take 100 ns) + error $ "'with' block referencing non-record type " ++ show a ++ "\n" ++ show wb phrase2C (ForCycle i' e1' e2' p) = do i <- id2C IOLookup i' e1 <- expr2C e1' @@ -605,7 +672,9 @@ phrase2C NOP = return $ text ";" phrase2C (BuiltInFunctionCall [] (SimpleReference (Identifier "exit" BTUnknown))) = return $ text "return" <> semi -phrase2C (BuiltInFunctionCall [e] (SimpleReference (Identifier "exit" BTUnknown))) = liftM (\e -> text "return" <> e <> semi) $ expr2C e +phrase2C (BuiltInFunctionCall [] (SimpleReference (Identifier "break" BTUnknown))) = return $ text "break" <> semi +phrase2C (BuiltInFunctionCall [] (SimpleReference (Identifier "continue" BTUnknown))) = return $ text "continue" <> semi +phrase2C (BuiltInFunctionCall [e] (SimpleReference (Identifier "exit" BTUnknown))) = liftM (\e -> text "return" <+> e <> semi) $ expr2C e phrase2C (BuiltInFunctionCall [e] (SimpleReference (Identifier "dec" BTUnknown))) = liftM (\e -> text "--" <> e <> semi) $ expr2C e phrase2C (BuiltInFunctionCall [e1, e2] (SimpleReference (Identifier "dec" BTUnknown))) = liftM2 (\a b -> a <> text " -= " <> b <> semi) (expr2C e1) (expr2C e2) phrase2C (BuiltInFunctionCall [e] (SimpleReference (Identifier "inc" BTUnknown))) = liftM (\e -> text "++" <> e <> semi) $ expr2C e @@ -617,50 +686,104 @@ expr2C :: Expression -> State RenderState Doc expr2C (Expression s) = return $ text s -expr2C (BinOp op expr1 expr2) = do +expr2C b@(BinOp op expr1 expr2) = do e1 <- expr2C expr1 t1 <- gets lastType e2 <- expr2C expr2 t2 <- gets lastType case (op2C op, t1, t2) of - ("+", BTString, BTString) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strconcat" (BTFunction BTString)) - ("+", BTString, BTChar) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strappend" (BTFunction BTString)) - ("+", BTChar, BTString) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strprepend" (BTFunction BTString)) - ("==", BTString, _) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strcompare" (BTFunction BTBool)) - ("!=", BTString, _) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strncompare" (BTFunction BTBool)) + ("+", BTString, BTString) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strconcat" (BTFunction 2 BTString)) + ("+", BTString, BTChar) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strappend" (BTFunction 2 BTString)) + ("+", BTChar, BTString) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strprepend" (BTFunction 2 BTString)) + ("==", BTString, BTChar) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strcomparec" (BTFunction 2 BTBool)) + ("==", BTString, BTString) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strcompare" (BTFunction 2 BTBool)) + ("!=", BTString, _) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strncompare" (BTFunction 2 BTBool)) ("&", BTBool, _) -> return $ parens e1 <+> text "&&" <+> parens e2 ("|", BTBool, _) -> return $ parens e1 <+> text "||" <+> parens e2 + (_, BTRecord t1 _, BTRecord t2 _) -> do + i <- op2CTyped op [SimpleType (Identifier t1 undefined), SimpleType (Identifier t2 undefined)] + ref2C $ FunCall [expr1, expr2] (SimpleReference i) + (_, BTRecord t1 _, BTInt) -> do + -- aw, "LongInt" here is hwengine-specific hack + i <- op2CTyped op [SimpleType (Identifier t1 undefined), SimpleType (Identifier "LongInt" undefined)] + ref2C $ FunCall [expr1, expr2] (SimpleReference i) + ("in", _, _) -> + case expr2 of + SetExpression set -> do + ids <- mapM (id2C IOLookup) set + return . parens . hcat . punctuate (text " || ") . map (\i -> parens $ e1 <+> text "==" <+> i) $ ids + _ -> error "'in' against not set expression" (o, _, _) | o `elem` boolOps -> do modify(\s -> s{lastType = BTBool}) return $ parens e1 <+> text o <+> parens e2 | otherwise -> return $ parens e1 <+> text o <+> parens e2 where boolOps = ["==", "!=", "<", ">", "<=", ">="] -expr2C (NumberLiteral s) = return $ text s +expr2C (NumberLiteral s) = do + modify(\s -> s{lastType = BTInt}) + return $ text s expr2C (FloatLiteral s) = return $ text s expr2C (HexNumber s) = return $ text "0x" <> (text . map toLower $ s) -expr2C (StringLiteral [a]) = do +{-expr2C (StringLiteral [a]) = do modify(\s -> s{lastType = BTChar}) - return . quotes $ text [a] + return . quotes . text $ escape a + where + escape '\'' = "\\\'" + escape a = [a]-} expr2C (StringLiteral s) = addStringConst s +expr2C (PCharLiteral s) = return . doubleQuotes $ text s expr2C (Reference ref) = ref2CF ref -expr2C (PrefixOp op expr) = liftM (text (op2C op) <>) (expr2C expr) +expr2C (PrefixOp op expr) = do + e <- expr2C expr + lt <- gets lastType + case lt of + BTRecord t _ -> do + i <- op2CTyped op [SimpleType (Identifier t undefined)] + ref2C $ FunCall [expr] (SimpleReference i) + _ -> return $ text (op2C op) <> e expr2C Null = return $ text "NULL" expr2C (CharCode a) = do modify(\s -> s{lastType = BTChar}) return $ quotes $ text "\\x" <> text (showHex (read a) "") -expr2C (HexCharCode a) = return $ quotes $ text "\\x" <> text (map toLower a) +expr2C (HexCharCode a) = if length a <= 2 then return $ quotes $ text "\\x" <> text (map toLower a) else expr2C $ HexNumber a expr2C (SetExpression ids) = mapM (id2C IOLookup) ids >>= return . parens . hcat . punctuate (text " | ") +expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "low" _))) = do + e' <- liftM (map toLower . render) $ expr2C e + lt <- gets lastType + case lt of + BTEnum a -> return $ int 0 + BTInt -> case e' of + "longint" -> return $ int (-2147483648) + BTArray {} -> return $ int 0 + _ -> error $ "BuiltInFunCall 'low' from " ++ show e ++ "\ntype: " ++ show lt +expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "high" _))) = do + e' <- liftM (map toLower . render) $ expr2C e + lt <- gets lastType + case lt of + BTEnum a -> return . int $ length a - 1 + BTInt -> case e' of + "longint" -> return $ int (2147483647) + BTString -> return $ int 255 + BTArray (RangeFromTo _ n) _ _ -> initExpr2C n + _ -> error $ "BuiltInFunCall 'high' from " ++ show e ++ "\ntype: " ++ show lt expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "ord" _))) = liftM parens $ expr2C e expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "succ" _))) = liftM (<> text " + 1") $ expr2C e expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "pred" _))) = liftM (<> text " - 1") $ expr2C e +expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "length" _))) = do + e' <- expr2C e + lt <- gets lastType + modify (\s -> s{lastType = BTInt}) + case lt of + BTString -> return $ text "Length" <> parens e' + BTArray {} -> return $ text "length_ar" <> parens e' + _ -> error $ "length() called on " ++ show lt expr2C (BuiltInFunCall params ref) = do r <- ref2C ref t <- gets lastType ps <- mapM expr2C params case t of - BTFunction t' -> do + BTFunction _ t' -> do modify (\s -> s{lastType = t'}) _ -> error $ "BuiltInFunCall lastType: " ++ show t return $ @@ -672,7 +795,17 @@ i <- id2C IOLookup name t <- gets lastType case t of - BTFunction _ -> return $ i <> parens empty + BTFunction _ rt -> do + modify(\s -> s{lastType = rt}) + return $ i <> parens empty + _ -> return $ i +ref2CF r@(RecordField (SimpleReference _) (SimpleReference _)) = do + i <- ref2C r + t <- gets lastType + case t of + BTFunction _ rt -> do + modify(\s -> s{lastType = rt}) + return $ i <> parens empty _ -> return $ i ref2CF r = ref2C r @@ -688,18 +821,17 @@ e <- expr2C expr r <- ref2C ref t <- gets lastType - ns <- gets currentScope case t of (BTArray _ _ t') -> modify (\st -> st{lastType = t'}) - (BTFunctionReturn _ (BTArray _ _ t')) -> modify (\st -> st{lastType = t'}) - (BTFunctionReturn _ (BTString)) -> modify (\st -> st{lastType = BTChar}) +-- (BTFunctionReturn _ (BTArray _ _ t')) -> modify (\st -> st{lastType = t'}) +-- (BTFunctionReturn _ (BTString)) -> modify (\st -> st{lastType = BTChar}) (BTString) -> modify (\st -> st{lastType = BTChar}) (BTPointerTo t) -> do t'' <- fromPointer (show t) =<< gets lastType case t'' of BTChar -> modify (\st -> st{lastType = BTChar}) - a -> error $ "Getting element of " ++ show a ++ "\nReference: " ++ show ae ++ "\n" ++ show (take 100 ns) - a -> error $ "Getting element of " ++ show a ++ "\nReference: " ++ show ae ++ "\n" ++ show (take 100 ns) + a -> error $ "Getting element of " ++ show a ++ "\nReference: " ++ show ae + a -> error $ "Getting element of " ++ show a ++ "\nReference: " ++ show ae case t of BTString -> return $ r <> text ".s" <> brackets e _ -> return $ r <> brackets e @@ -707,44 +839,40 @@ ref2C rf@(RecordField (Dereference ref1) ref2) = do r1 <- ref2C ref1 t <- fromPointer (show ref1) =<< gets lastType - ns <- gets currentScope r2 <- case t of - BTRecord rs -> withRecordNamespace "" rs $ ref2C ref2 - BTUnit -> withLastIdNamespace $ ref2C ref2 - a -> error $ "dereferencing from " ++ show a ++ "\n" ++ show rf ++ "\n" ++ show (take 100 ns) + BTRecord _ rs -> withRecordNamespace "" rs $ ref2C ref2 + BTUnit -> error "What??" + a -> error $ "dereferencing from " ++ show a ++ "\n" ++ show rf return $ r1 <> text "->" <> r2 ref2C rf@(RecordField ref1 ref2) = do r1 <- ref2C ref1 t <- gets lastType - ns <- gets currentScope - r2 <- case t of - BTFunctionReturn s (BTRecord rs) -> withRecordNamespace "" rs $ ref2C ref2 - BTRecord rs -> withRecordNamespace "" rs $ ref2C ref2 - BTUnit -> withLastIdNamespace $ ref2C ref2 - a -> error $ "dereferencing from " ++ show a ++ "\n" ++ show rf ++ "\n" ++ show (take 100 ns) - return $ - r1 <> text "." <> r2 + case t of + BTRecord _ rs -> do + r2 <- withRecordNamespace "" rs $ ref2C ref2 + return $ r1 <> text "." <> r2 + BTUnit -> withLastIdNamespace $ ref2C ref2 + a -> error $ "dereferencing from " ++ show a ++ "\n" ++ show rf ref2C d@(Dereference ref) = do r <- ref2C ref t <- fromPointer (show d) =<< gets lastType modify (\st -> st{lastType = t}) return $ (parens $ text "*" <> r) ref2C f@(FunCall params ref) = do - r <- ref2C ref + r <- fref2C ref t <- gets lastType case t of - BTFunction t' -> do + BTFunction _ t' -> do ps <- liftM (parens . hsep . punctuate (char ',')) $ mapM expr2C params modify (\s -> s{lastType = t'}) return $ r <> ps - BTFunctionReturn r t' -> do - ps <- liftM (parens . hsep . punctuate (char ',')) $ mapM expr2C params - modify (\s -> s{lastType = t'}) - return $ text r <> ps _ -> case (ref, params) of (SimpleReference i, [p]) -> ref2C $ TypeCast i p _ -> error $ "ref2C FunCall erroneous type cast detected: " ++ show f ++ "\nType detected: " ++ show t + where + fref2C (SimpleReference name) = id2C (IOLookupFunction $ length params) name + fref2C a = ref2C a ref2C (Address ref) = do r <- ref2C ref @@ -755,7 +883,7 @@ a -> do e <- expr2C expr t <- id2C IOLookup t' - return $ parens t <> e + return . parens $ parens t <> e ref2C (RefExpression expr) = expr2C expr