# HG changeset patch # User nemo # Date 1290117488 18000 # Node ID 0a7158f26ffa42c5e5b37393715fe7c82dd5fff6 # Parent 935de6cd5ea300d56578a73de6cb593300de9a20# Parent cdb3d7a39fa2eb41c8c8bcc1cbe6bdb0e90b7f26 merge diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/CCHandlers.inc --- a/hedgewars/CCHandlers.inc Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/CCHandlers.inc Thu Nov 18 16:58:08 2010 -0500 @@ -160,7 +160,7 @@ SplitBySpace(s, id); val(s, Gear^.Health); TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true); - PHedgehog(Gear^.Hedgehog)^.Team:= CurrentTeam; + Gear^.Hedgehog^.Team:= CurrentTeam; if (GameFlags and gfSharedAmmo) <> 0 then CurrentHedgehog^.AmmoStore:= Clan^.ClanIndex else if (GameFlags and gfPerHogAmmo) <> 0 then begin diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/CMakeLists.txt --- a/hedgewars/CMakeLists.txt Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/CMakeLists.txt Thu Nov 18 16:58:08 2010 -0500 @@ -11,24 +11,24 @@ #if the headers are not installed, the newer apis won't be activated find_file(sdlmixer_h SDL_mixer.h ${SDLMIXER_INCLUDE_DIR}) if(sdlmixer_h) - file(STRINGS ${sdlmixer_h} sdlmixer_version_tmp REGEX "SDL_MIXER_PATCHLEVEL[\t' ']+[0-9]+") - string(REGEX MATCH ".([0-9]+)" sdlmixer_version "${sdlmixer_version_tmp}") + file(STRINGS ${sdlmixer_h} sdlmixer_version_tmp REGEX "SDL_MIXER_PATCHLEVEL[\t' ']+[0-9]+") + string(REGEX MATCH ".([0-9]+)" sdlmixer_version "${sdlmixer_version_tmp}") - if(sdlmixer_version GREATER 9) - message(STATUS "Enabling enhanced SDL_Mixer calls") - set(pascal_compiler_flags_cmn "-dSDL_MIXER_NEWER" ${pascal_compiler_flags_cmn}) - endif() + if(sdlmixer_version GREATER 9) + message(STATUS "Enabling enhanced SDL_Mixer calls") + set(pascal_compiler_flags_cmn "-dSDL_MIXER_NEWER" ${pascal_compiler_flags_cmn}) + endif() endif() find_file(sdlimage_h SDL_image.h ${SDLIMAGE_INCLUDE_DIR}) if(sdlimage_h) - file(STRINGS ${sdlimage_h} sdlimage_version_tmp REGEX "SDL_IMAGE_PATCHLEVEL[\t' ']+[0-9]+") - string(REGEX MATCH ".([0-9]+)" sdlimage_version "${sdlimage_version_tmp}") + file(STRINGS ${sdlimage_h} sdlimage_version_tmp REGEX "SDL_IMAGE_PATCHLEVEL[\t' ']+[0-9]+") + string(REGEX MATCH ".([0-9]+)" sdlimage_version "${sdlimage_version_tmp}") - if(sdlimage_version GREATER 7) - message(STATUS "Enabling enhanced SDL_Image calls") - set(pascal_compiler_flags_cmn "-dSDL_IMAGE_NEWER" ${pascal_compiler_flags_cmn}) - endif() + if(sdlimage_version GREATER 7) + message(STATUS "Enabling enhanced SDL_Image calls") + set(pascal_compiler_flags_cmn "-dSDL_IMAGE_NEWER" ${pascal_compiler_flags_cmn}) + endif() endif() #SOURCE AND PROGRAMS SECTION @@ -36,86 +36,92 @@ set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas) set(engine_sources - ${hwengine_project} - SDLh.pas - uAI.pas - uAIActions.pas - uAIAmmoTests.pas - uAIMisc.pas - uAmmos.pas - uChat.pas - uCollisions.pas - uConsole.pas - uConsts.pas - uFloat.pas - uGame.pas - uGears.pas - uIO.pas - uKeys.pas - uLand.pas - uLandGraphics.pas - uLandObjects.pas - uLandTemplates.pas - uLandTexture.pas - uLocale.pas - uMisc.pas - uMobile.pas - uRandom.pas - uScript.pas - adler32.pas - uSound.pas - uStats.pas - uStore.pas - uTeams.pas - uVisualGears.pas - uWorld.pas - CCHandlers.inc - GSHandlers.inc - VGSHandlers.inc - GearDrawing.inc - HHHandlers.inc - SinTable.inc - ArgParsers.inc - options.inc - ${CMAKE_CURRENT_BINARY_DIR}/config.inc - ) + ${hwengine_project} + SDLh.pas + uAI.pas + uAIActions.pas + uAIAmmoTests.pas + uAIMisc.pas + uAmmos.pas + uChat.pas + uCollisions.pas + uCommands.pas + uConsole.pas + uConsts.pas + uFloat.pas + uGame.pas + uGears.pas + uIO.pas + uKeys.pas + uLand.pas + uLandGraphics.pas + uLandObjects.pas + uLandTemplates.pas + uLandTexture.pas + uLocale.pas + uMisc.pas + uMobile.pas + uRandom.pas + uRender.pas + uRenderUtils.pas + uScript.pas + uSound.pas + uStats.pas + uStore.pas + uTeams.pas + uTextures.pas + uTypes.pas + uUtils.pas + uVisualGears.pas + uWorld.pas + CCHandlers.inc + GSHandlers.inc + VGSHandlers.inc + GearDrawing.inc + HHHandlers.inc + SinTable.inc + ArgParsers.inc + options.inc + adler32.pas + ${CMAKE_CURRENT_BINARY_DIR}/config.inc + ) if(BUILD_ENGINE_LIBRARY) - message(STATUS "Engine will be built as library (experimental)") - set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwLibrary.pas) - set(engine_sources ${hwengine_project} PascalExports.pas ${engine_sources}) - set(pascal_compiler_flags_cmn "-dHWLIBRARY" "-k-no_order_inits" "-fPIC" ${pascal_compiler_flags_cmn}) + message(STATUS "Engine will be built as library (experimental)") + set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwLibrary.pas) + set(engine_sources ${hwengine_project} PascalExports.pas ${engine_sources}) + set(pascal_compiler_flags_cmn "-dHWLIBRARY" "-k-no_order_inits" "-fPIC" ${pascal_compiler_flags_cmn}) endif(BUILD_ENGINE_LIBRARY) find_program(fpc_executable ${fpc_tryexe}) if(fpc_executable) - exec_program(${fpc_executable} ARGS "-iV" OUTPUT_VARIABLE fpc_output) + exec_program(${fpc_executable} ARGS "-iV" OUTPUT_VARIABLE fpc_output) endif(fpc_executable) set(noexecstack_flags "-k-z" "-knoexecstack") file(WRITE ${EXECUTABLE_OUTPUT_PATH}/checkstack.pas "begin end.") exec_program(${fpc_executable} ${EXECUTABLE_OUTPUT_PATH} - ARGS ${noexecstack_flags} checkstack.pas - OUTPUT_VARIABLE noout - RETURN_VALUE testnoexecstack - ) + ARGS ${noexecstack_flags} checkstack.pas + OUTPUT_VARIABLE noout + RETURN_VALUE testnoexecstack + ) if(${testnoexecstack}) - set (noexecstack_flags "") + set (noexecstack_flags "") endif(${testnoexecstack}) if(APPLE) - string(REGEX MATCH "[pP][pP][cC]+" powerpc_build "${CMAKE_OSX_ARCHITECTURES}") - string(REGEX MATCH "[iI]386+" i386_build "${CMAKE_OSX_ARCHITECTURES}") - string(REGEX MATCH "[xX]86_64+" x86_64_build "${CMAKE_OSX_ARCHITECTURES}") + string(REGEX MATCH "[pP][pP][cC]+" powerpc_build "${CMAKE_OSX_ARCHITECTURES}") + string(REGEX MATCH "[iI]386+" i386_build "${CMAKE_OSX_ARCHITECTURES}") + string(REGEX MATCH "[xX]86_64+" x86_64_build "${CMAKE_OSX_ARCHITECTURES}") - if(powerpc_build) - set(powerpc_build "powerpc") - endif() + if(powerpc_build) + set(powerpc_build "powerpc") + endif() endif(APPLE) @@ -123,19 +129,19 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}") if(fpc_version) - string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}") - string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}") - string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}") - message(STATUS "Freepascal version detected: ${fpc_vers_major}.${fpc_vers_minor}") - math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}") + string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}") + string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}") + string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}") + message(STATUS "Freepascal version detected: ${fpc_vers_major}.${fpc_vers_minor}") + math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}") - if(fpc_ver LESS "020200") - message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0") - elseif(APPLE AND x86_64_build AND fpc_ver LESS "020400") - message(FATAL_ERROR "Minimum required version of FreePascal is 2.4.0 for building 64 bit applications!") - endif() + if(fpc_ver LESS "020200") + message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0") + elseif(APPLE AND x86_64_build AND fpc_ver LESS "020400") + message(FATAL_ERROR "Minimum required version of FreePascal is 2.4.0 for building 64 bit applications!") + endif() else() - message(FATAL_ERROR "No Pascal compiler found!") + message(FATAL_ERROR "No Pascal compiler found!") endif() set(pascal_compiler ${fpc_executable}) @@ -144,40 +150,40 @@ #DEPENDECIES AND EXECUTABLES SECTION IF(NOT APPLE OR BUILD_ENGINE_LIBRARY) - #here is the command for standard executables or for shared library - add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" - COMMAND "${pascal_compiler}" - ARGS ${pascal_compiler_flags} - MAIN_DEPENDENCY ${hwengine_project} - DEPENDS ${engine_sources} - ) + #here is the command for standard executables or for shared library + add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" + COMMAND "${pascal_compiler}" + ARGS ${pascal_compiler_flags} + MAIN_DEPENDENCY ${hwengine_project} + DEPENDS ${engine_sources} + ) ELSE() - #let's build sdlmain, which is absent from the framework - find_package(SDL REQUIRED) + #let's build sdlmain, which is absent from the framework + find_package(SDL REQUIRED) - set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) - include_directories(${SDL_INCLUDE_DIR}) + set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) + include_directories(${SDL_INCLUDE_DIR}) - add_library (SDLmain STATIC SDLMain.m) + add_library (SDLmain STATIC SDLMain.m) - #these are the dependencies for building a universal binary on Mac OS X - foreach (build_arch ${powerpc_build} ${i386_build} ${x86_64_build}) - set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" ${lipo_args_list}) - add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" - COMMAND "${pascal_compiler}" - ARGS ${pascal_compiler_flags} -ohwengine.${build_arch} -P${build_arch} - MAIN_DEPENDENCY ${hwengine_project} - DEPENDS ${engine_sources} SDLmain lua - ) - add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}") - endforeach() + #these are the dependencies for building a universal binary on Mac OS X + foreach (build_arch ${powerpc_build} ${i386_build} ${x86_64_build}) + set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" ${lipo_args_list}) + add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" + COMMAND "${pascal_compiler}" + ARGS ${pascal_compiler_flags} -ohwengine.${build_arch} -P${build_arch} + MAIN_DEPENDENCY ${hwengine_project} + DEPENDS ${engine_sources} SDLmain lua + ) + add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}") + endforeach() - add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine" - COMMAND "lipo" - ARGS ${lipo_args_list} -create -output ${EXECUTABLE_OUTPUT_PATH}/hwengine - DEPENDS ${lipo_args_list} - ) + add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine" + COMMAND "lipo" + ARGS ${lipo_args_list} -create -output ${EXECUTABLE_OUTPUT_PATH}/hwengine + DEPENDS ${lipo_args_list} + ) ENDIF() diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/GSHandlers.inc Thu Nov 18 16:58:08 2010 -0500 @@ -78,15 +78,15 @@ if (d > 1) and not gi^.Invulnerable and (GetRandom(2) = 0) then begin if (CurrentHedgehog^.Gear = gi) then - PlaySound(sndOops, PHedgehog(gi^.Hedgehog)^.Team^.voicepack) + PlaySound(sndOops, gi^.Hedgehog^.Team^.voicepack) else begin if (gi^.State and gstMoving) = 0 then gi^.State := gi^.State or gstLoser; if d > r div 2 then - PlaySound(sndNooo, PHedgehog(gi^.Hedgehog)^.Team^.voicepack) + PlaySound(sndNooo, gi^.Hedgehog^.Team^.voicepack) else - PlaySound(sndUhOh, PHedgehog(gi^.Hedgehog)^.Team^.voicepack); + PlaySound(sndUhOh, gi^.Hedgehog^.Team^.voicepack); end; end; end; @@ -131,13 +131,13 @@ if (Gear^.Kind <> gtSniperRifleShot) and (Gear^.Kind <> gtShotgunShot) and (Gear^.Kind <> gtDEagleShot) and (Gear^.Kind <> gtSineGunShot) then if Gear^.Kind = gtHedgehog then begin - if PHedgehog(Gear^.Hedgehog)^.Effects[heResurrectable] then + if Gear^.Hedgehog^.Effects[heResurrectable] then ResurrectHedgehog(Gear) else begin Gear^.doStep := @doStepDrowningGear; Gear^.State := Gear^.State and (not gstHHDriven); - AddCaption(Format(GetEventString(eidDrowned), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage); + AddCaption(Format(GetEventString(eidDrowned), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage); end end else @@ -203,9 +203,9 @@ if (Gear^.Invulnerable) then exit; //if _0_6 < Gear^.dY then - // PlaySound(sndOw4, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) + // PlaySound(sndOw4, Gear^.Hedgehog^.Team^.voicepack) //else - // PlaySound(sndOw1, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); + // PlaySound(sndOw1, Gear^.Hedgehog^.Team^.voicepack); ApplyDamage(Gear, dmg, dsFall); end @@ -626,8 +626,8 @@ dec(Gear^.Timer); if Gear^.Timer = 0 then begin - PHedgehog(Gear^.Hedgehog)^.Gear^.Message:= PHedgehog(Gear^.Hedgehog)^.Gear^.Message and not gmAttack; - PHedgehog(Gear^.Hedgehog)^.Gear^.State:= PHedgehog(Gear^.Hedgehog)^.Gear^.State and not gstAttacking; + Gear^.Hedgehog^.Gear^.Message:= Gear^.Hedgehog^.Gear^.Message and not gmAttack; + Gear^.Hedgehog^.Gear^.State:= Gear^.Hedgehog^.Gear^.State and not gstAttacking; AttackBar:= 0; Gear^.SoundChannel := LoopSound(sndBee); @@ -806,7 +806,7 @@ shell: PVisualGear; begin cArtillery := true; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.State := HHGear^.State or gstNotKickable; HedgehogChAngle(HHGear); if not cLaserSighting then @@ -899,7 +899,7 @@ HHGear: PGear; begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; dec(Gear^.Timer); if (Gear^.Timer = 0)or((Gear^.Message and gmDestroy) <> 0)or((HHGear^.State and gstHHDriven) = 0) then @@ -973,7 +973,7 @@ HHGear: PGear; begin i := 0; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; y := hwRound(Gear^.Y) - cHHRadius * 2; while y < hwRound(Gear^.Y) do @@ -1005,7 +1005,7 @@ begin AllInactive := false; dec(Gear^.Timer); - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HedgehogChAngle(HHGear); @@ -1087,7 +1087,7 @@ begin BTPrevAngle := High(LongInt); BTSteps := 0; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.Message := 0; HHGear^.State := HHGear^.State or gstNotKickable; Gear^.doStep := @doStepBlowTorchWork @@ -1102,14 +1102,14 @@ var HHGear: PGear; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; if ((HHGear^.State and gstHHDriven) = 0) or (CheckGearDrowning(HHGear)) or TestCollisionYwithGear(HHGear, 1) then begin DeleteGear(Gear); isCursorVisible := false; - ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); + ApplyAmmoChanges(HHGear^.Hedgehog^); exit end; @@ -1128,7 +1128,7 @@ Gear^.X := HHGear^.X; Gear^.Y := HHGear^.Y; - ApplyAngleBounds(PHedgehog(Gear^.Hedgehog)^, amRope); + ApplyAngleBounds(Gear^.Hedgehog^, amRope); Gear^.dX := SignAs(AngleSin(HHGear^.Angle), HHGear^.dX); Gear^.dY := -AngleCos(HHGear^.Angle); @@ -1170,7 +1170,7 @@ end; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; if ((HHGear^.State and gstHHDriven) = 0) or (CheckGearDrowning(HHGear)) then @@ -1333,7 +1333,7 @@ if (Gear^.Message and gmAttack) <> 0 then if (Gear^.State and gsttmpFlag) <> 0 then - with PHedgehog(Gear^.Hedgehog)^ do + with Gear^.Hedgehog^ do begin PlaySound(sndRopeRelease); if CurAmmoType <> amParachute then @@ -1356,10 +1356,10 @@ begin if (Gear^.State and gstAttacked) = 0 then begin - OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); + OnUsedAmmo(HHGear^.Hedgehog^); Gear^.State := Gear^.State or gstAttacked end; - ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^) + ApplyAmmoChanges(HHGear^.Hedgehog^) end; begin @@ -1367,7 +1367,7 @@ Gear^.Y := Gear^.Y - Gear^.dY; Gear^.Elasticity := Gear^.Elasticity + _1; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; DeleteCI(HHGear); if (HHGear^.State and gstMoving) <> 0 then @@ -1447,7 +1447,7 @@ or ((HHGear^.State and gstHHDriven) = 0) or (HHGear^.Damage > 0) then begin - with PHedgehog(Gear^.Hedgehog)^.Gear^ do + with Gear^.Hedgehog^.Gear^ do begin State := State and not gstAttacking; Message := Message and not gmAttack @@ -1808,7 +1808,7 @@ var HHGear: PGear; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.State := HHGear^.State or gstNoDamage; DeleteCI(HHGear); @@ -1825,7 +1825,7 @@ HHGear: PGear; i: LongInt; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.State := HHGear^.State or gstNoDamage; DeleteCI(HHGear); @@ -1978,7 +1978,7 @@ exit end; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; if hwRound(HHGear^.Y) <= Gear^.Tag - 2 then begin Gear^.Tag := hwRound(HHGear^.Y); @@ -2008,7 +2008,7 @@ HHGear: PGear; begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; DeleteCI(HHGear); HHGear^.X := int2hwFloat(hwRound(HHGear^.X)) - _0_5; HHGear^.dX := SignAs(cLittle, Gear^.dX); @@ -2021,7 +2021,7 @@ Gear^.doStep := @doStepFirePunchWork; DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5); - PlaySound(TSound(ord(sndFirePunch1) + GetRandom(6)), PHedgehog(HHGear^.Hedgehog)^.Team^. + PlaySound(TSound(ord(sndFirePunch1) + GetRandom(6)), HHGear^.Hedgehog^.Team^. voicepack) end; @@ -2031,7 +2031,7 @@ var HHGear: PGear; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; inc(Gear^.Timer); @@ -2049,7 +2049,7 @@ end; DeleteGear(Gear); isCursorVisible := false; - ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); + ApplyAmmoChanges(HHGear^.Hedgehog^); exit end; @@ -2070,7 +2070,7 @@ var HHGear: PGear; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; DeleteCI(HHGear); @@ -2167,7 +2167,7 @@ begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; tx := int2hwFloat(TargetPoint.X); ty := int2hwFloat(TargetPoint.Y); x := HHGear^.X; @@ -2202,8 +2202,8 @@ var HHGear: PGear; begin - PHedgehog(Gear^.Hedgehog)^.Unplaced := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + Gear^.Hedgehog^.Unplaced := false; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.Y := HHGear^.Y + HHGear^.dY; // hedgehog falling to collect cases HHGear^.dY := HHGear^.dY + cGravity; @@ -2233,7 +2233,7 @@ begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2, TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2, sprHHTelepMask, 0, false) then @@ -2275,14 +2275,14 @@ if ((Gear^.Message and not gmSwitch) <> 0) or (TurnTimeLeft = 0) then begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; Msg := Gear^.Message and not gmSwitch; DeleteGear(Gear); - OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); - ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); + OnUsedAmmo(HHGear^.Hedgehog^); + ApplyAmmoChanges(HHGear^.Hedgehog^); HHGear := CurrentHedgehog^.Gear; - ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); + ApplyAmmoChanges(HHGear^.Hedgehog^); HHGear^.Message := Msg; exit end; @@ -2326,7 +2326,7 @@ begin Gear^.doStep := @doStepSwitcherWork; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; with HHGear^ do begin State := State and not gstAttacking; @@ -2377,7 +2377,7 @@ begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.State := HHGear^.State or gstNoDamage; DeleteCI(HHGear); @@ -2437,7 +2437,7 @@ if Gear^.Timer = 0 then begin Gear^.Pos := 1; - PlaySound(sndKamikaze, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); + PlaySound(sndKamikaze, Gear^.Hedgehog^.Team^.voicepack); Gear^.doStep := @doStepKamikazeWork end end; @@ -2448,7 +2448,7 @@ begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.dX := Gear^.dX; HHGear^.dY := Gear^.dY; @@ -2637,7 +2637,7 @@ begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.Message := HHGear^.Message and (not gmAttack); DeleteCI(HHGear); Gear^.IntersectGear:= nil; @@ -2687,7 +2687,7 @@ Gear^.Timer := 0; inc(Gear^.Pos); if Gear^.Pos = 5 then - PlaySound(sndYoohoo, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) + PlaySound(sndYoohoo, Gear^.Hedgehog^.Team^.voicepack) end; if Gear^.Pos = 14 then @@ -2697,7 +2697,7 @@ procedure doStepSeduction(Gear: PGear); begin AllInactive := false; - DeleteCI(PHedgehog(Gear^.Hedgehog)^.Gear); + DeleteCI(Gear^.Hedgehog^.Gear); Gear^.doStep := @doStepSeductionWear end; @@ -2836,7 +2836,7 @@ begin AllInactive := false; dec(Gear^.Timer); - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HedgehogChAngle(HHGear); gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle); gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle); @@ -2864,7 +2864,7 @@ var HHGear: PGear; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.Message := HHGear^.Message and not (gmUp or gmDown); HHGear^.State := HHGear^.State or gstNotKickable; Gear^.doStep := @doStepBallgunWork @@ -2889,7 +2889,7 @@ if ((TrainingFlags and tfRCPlane) <> 0) and ((TrainingFlags and tfTimeTrial) <> 0 ) and ( TimeTrialStartTime = 0) then TimeTrialStartTime := RealTicks; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; FollowGear := Gear; fChanged := false; @@ -3025,7 +3025,7 @@ var HHGear: PGear; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.Message := 0; HHGear^.State := HHGear^.State or gstNotKickable; Gear^.Angle := HHGear^.Angle; @@ -3045,7 +3045,7 @@ isUnderwater:= cWaterLine < hwRound(Gear^.Y) + Gear^.Radius; if Gear^.Pos > 0 then dec(Gear^.Pos); AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; //dec(Gear^.Timer); move := _0_2; fuel := 50; @@ -3152,7 +3152,7 @@ end; DeleteGear(Gear); isCursorVisible := false; - ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); + ApplyAmmoChanges(HHGear^.Hedgehog^); // if Gear^.Tex <> nil then FreeTexture(Gear^.Tex); // Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', cWhiteColor, fntSmall) @@ -3169,7 +3169,7 @@ Gear^.Pos:= 0; Gear^.doStep := @doStepJetpackWork; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; FollowGear := HHGear; AfterAttack; with HHGear^ do @@ -3427,7 +3427,7 @@ // destroy portal if ground it was attached too is gone if ((Land[hwRound(Gear^.Y), hwRound(Gear^.X)] and $FF00) = 0) or (Gear^.Timer < 1) - or (PHedgehog(Gear^.Hedgehog) <> CurrentHedgehog) + or (Gear^.Hedgehog <> CurrentHedgehog) or (hwRound(Gear^.Y) > cWaterLine) then begin deleteGear(Gear); @@ -3754,7 +3754,7 @@ doPortalColorSwitch(); doStepPerPixel(Gear, @doStepMovingPortal_real, true); if (Gear^.Timer < 1) - or (PHedgehog(Gear^.Hedgehog) <> CurrentHedgehog) then + or (Gear^.Hedgehog <> CurrentHedgehog) then deleteGear(Gear); end; @@ -4047,7 +4047,7 @@ Fire: PGear; begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HedgehogChAngle(HHGear); gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle); gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle); @@ -4111,7 +4111,7 @@ var HHGear: PGear; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.Message := HHGear^.Message and not (gmUp or gmDown or gmLeft or gmRight); HHGear^.State := HHGear^.State or gstNotKickable; Gear^.doStep := @doStepFlamethrowerWork @@ -4140,7 +4140,7 @@ t: PGearArray; i: LongInt; begin -HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; +HHGear:= Gear^.Hedgehog^.Gear; HHGear^.State:= HHGear^.State or gstNoDamage; DeleteCI(HHGear); @@ -4181,7 +4181,7 @@ HHGear: PGear; begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; dec(Gear^.Timer); if (HHGear = nil) or (Gear^.Timer = 0) or ((Gear^.Message and gmDestroy) <> 0) then begin @@ -4234,7 +4234,7 @@ HHGear: PGear; begin i := 0; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; y := hwRound(Gear^.Y) - cHHRadius * 2; while y < hwRound(Gear^.Y) do @@ -4265,7 +4265,7 @@ dec(TurnTimeLeft); AllInactive := false; - hh := PHedgehog(Gear^.Hedgehog); + hh := Gear^.Hedgehog; DrawCentered(hwRound(hh^.Gear^.X) + WorldDx, hwRound(hh^.Gear^.Y) + WorldDy - cHHRadius - 14 - hh^.HealthTagTex^.h, hh^.HealthTagTex); (*DrawCircle(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, 1.5, 0, 0, $FF, @@ -4321,13 +4321,13 @@ resgear^.Health := graves[i]^.Health; PHedgehog(graves[i]^.Hedgehog)^.Gear := resgear; DeleteGear(graves[i]); - RenderHealth(PHedgehog(resgear^.Hedgehog)^); - RecountTeamHealth(Phedgehog(resgear^.Hedgehog)^.Team); - PHedgehog(resgear^.Hedgehog)^.Effects[heResurrected]:= true; - if PHedgehog(resgear^.Hedgehog)^.Hat = 'NoHat' then + RenderHealth(resgear^.Hedgehog^); + RecountTeamHealth(resgear^.Hedgehog^.Team); + resgear^.Hedgehog^.Effects[heResurrected]:= true; + if resgear^.Hedgehog^.Hat = 'NoHat' then begin - FreeTexture(PHedgehog(resgear^.Hedgehog)^.HatTex); - PHedgehog(resgear^.Hedgehog)^.HatTex := Surface2Tex( + FreeTexture(resgear^.Hedgehog^.HatTex); + resgear^.Hedgehog^.HatTex := Surface2Tex( LoadImage(Pathz[ptHats] + '/Reserved/Zombie', ifNone), True) end diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/GearDrawing.inc --- a/hedgewars/GearDrawing.inc Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/GearDrawing.inc Thu Nov 18 16:58:08 2010 -0500 @@ -7,7 +7,7 @@ HH: PHedgehog; CurWeapon: PAmmo; begin -HH:= PHedgehog(Gear^.Hedgehog); +HH:= Gear^.Hedgehog; if HH^.Unplaced then exit; m:= 1; if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then m:= -1; @@ -706,7 +706,7 @@ gtShell: DrawRotated(sprBazookaShell, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); gtGrave: begin - DrawTextureF(PHedgehog(Gear^.Hedgehog)^.Team^.GraveTex, 1, x, y, (GameTicks shr 7+Gear^.uid) and 7, 1, 32, 32); + DrawTextureF(Gear^.Hedgehog^.Team^.GraveTex, 1, x, y, (GameTicks shr 7+Gear^.uid) and 7, 1, 32, 32); if Gear^.Health > 0 then begin //Tint($33, $33, $FF, max($40, floor($FF * abs(1 - (GameTicks mod (6000 div Gear^.Health)) / 750)))); @@ -771,8 +771,8 @@ else DrawSprite(sprAirplane, x - SpritesData[sprAirplane].Width div 2, y - SpritesData[sprAirplane].Height div 2, 1); gtAirBomb: DrawRotated(sprAirBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); gtTeleport: begin - HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; - if not PHedgehog(Gear^.Hedgehog)^.Unplaced then DrawRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0); + HHGear:= Gear^.Hedgehog^.Gear; + if not Gear^.Hedgehog^.Unplaced then DrawRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0); DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0); end; gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12); diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/HHHandlers.inc Thu Nov 18 16:58:08 2010 -0500 @@ -48,7 +48,7 @@ ChangeAmmo:= false; slot:= Gear^.MsgParam; -with PHedgehog(Gear^.Hedgehog)^ do +with Gear^.Hedgehog^ do begin Gear^.Message:= Gear^.Message and not gmSlot; ammoidx:= 0; @@ -60,7 +60,7 @@ while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do inc(ammoidx); - if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) and (MultiShootAttacks > 0) then OnUsedAmmo(PHedgehog(Gear^.Hedgehog)^); + if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) and (MultiShootAttacks > 0) then OnUsedAmmo(Gear^.Hedgehog^); MultiShootAttacks:= 0; Gear^.Message:= Gear^.Message and not (gmLJump or gmHJump); @@ -101,7 +101,7 @@ s: boolean; begin weap:= TAmmoType(Gear^.MsgParam); -Hedgehog:= PHedgehog(Gear^.Hedgehog); +Hedgehog:= Gear^.Hedgehog; if Hedgehog^.Team^.Clan^.TurnNumber <= Ammoz[weap].SkipTurns then exit; // weapon is not activated yet @@ -118,15 +118,15 @@ dec(t) end; -if s then ApplyAmmoChanges(PHedgehog(Gear^.Hedgehog)^) +if s then ApplyAmmoChanges(Gear^.Hedgehog^) end; procedure HHSetTimer(Gear: PGear); var CurWeapon: PAmmo; begin Gear^.Message:= Gear^.Message and not gmTimer; -CurWeapon:= GetAmmoEntry(PHedgehog(Gear^.Hedgehog)^); -with PHedgehog(Gear^.Hedgehog)^ do +CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^); +with Gear^.Hedgehog^ do if (CurWeapon^.Propz and ammoprop_Timerable) <> 0 then begin CurWeapon^.Timer:= 1000 * Gear^.MsgParam; @@ -143,9 +143,9 @@ altUse: boolean; begin bShowFinger:= false; -CurWeapon:= GetAmmoEntry(PHedgehog(Gear^.Hedgehog)^); +CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^); with Gear^, - PHedgehog(Gear^.Hedgehog)^ do + Gear^.Hedgehog^ do begin if ((State and gstHHDriven) <> 0)and ((State and (gstAttacked or gstHHChooseTarget)) = 0) and @@ -386,7 +386,7 @@ const frametime = 200; timertime = frametime * 6; begin -if PHedgehog(Gear^.Hedgehog)^.Unplaced then exit; +if Gear^.Hedgehog^.Unplaced then exit; if Gear^.Timer > 1 then begin AllInactive:= false; @@ -406,7 +406,7 @@ Gear^.Z:= cCurrHHZ; RemoveGearFromList(Gear); InsertGearToList(Gear); - PlaySound(sndByeBye, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); + PlaySound(sndByeBye, Gear^.Hedgehog^.Team^.voicepack); Gear^.Pos:= 0; Gear^.Timer:= timertime end @@ -417,7 +417,7 @@ const frametime = 65; timertime = frametime * 11; begin -if PHedgehog(Gear^.Hedgehog)^.Unplaced then exit; +if Gear^.Hedgehog^.Unplaced then exit; if Gear^.Timer > 1 then begin AllInactive:= false; @@ -434,7 +434,7 @@ Gear^.Z:= cCurrHHZ; RemoveGearFromList(Gear); InsertGearToList(Gear); - PlaySound(sndByeBye, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); + PlaySound(sndByeBye, Gear^.Hedgehog^.Team^.voicepack); PlaySound(sndWarp); Gear^.Pos:= 0; Gear^.Timer:= timertime @@ -454,16 +454,16 @@ posCaseUtility, posCaseAmmo: begin a:= Gear^.AmmoType; - AddAmmo(PHedgehog(HH^.Hedgehog)^, a); + AddAmmo(HH^.Hedgehog^, a); // Possibly needs to check shared clan ammo game flag once added. // On the other hand, no obvious reason that clan members shouldn't know what ammo another clan member picked up - if (not (PHedgehog(HH^.Hedgehog)^.Team^.ExtDriven - or (PHedgehog(HH^.Hedgehog)^.BotLevel > 0))) - or (PHedgehog(HH^.Hedgehog)^.Team^.Clan^.ClanIndex = LocalClan) + if (not (HH^.Hedgehog^.Team^.ExtDriven + or (HH^.Hedgehog^.BotLevel > 0))) + or (HH^.Hedgehog^.Team^.Clan^.ClanIndex = LocalClan) or (GameType = gmtDemo) then begin s:= trammo[Ammoz[a].NameId] + ' (+' + IntToStr(Ammoz[a].NumberInCase) + ')'; - AddCaption(s, PHedgehog(HH^.Hedgehog)^.Team^.Clan^.Color, capgrpAmmoinfo); + AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo); // show ammo icon vga:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtAmmo); @@ -474,12 +474,12 @@ end; posCaseHealth: begin inc(HH^.Health, Gear^.Health); - PHedgehog(HH^.Hedgehog)^.Effects[hePoisoned] := false; + HH^.Hedgehog^.Effects[hePoisoned] := false; str(Gear^.Health, s); s:= '+' + s; - AddCaption(s, PHedgehog(HH^.Hedgehog)^.Team^.Clan^.Color, capgrpAmmoinfo); - RenderHealth(PHedgehog(HH^.Hedgehog)^); - RecountTeamHealth(PHedgehog(HH^.Hedgehog)^.Team); + AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo); + RenderHealth(HH^.Hedgehog^); + RecountTeamHealth(HH^.Hedgehog^.Team); i:= 0; while i < Gear^.Health do @@ -497,11 +497,11 @@ var PrevdX: LongInt; CurWeapon: PAmmo; begin -CurWeapon:= GetAmmoEntry(PHedgehog(Gear^.Hedgehog)^); +CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^); if ((Gear^.State and (gstAttacking or gstMoving)) = 0) then begin if isCursorVisible then - with PHedgehog(Gear^.Hedgehog)^ do + with Gear^.Hedgehog^ do with CurWeapon^ do begin if (Gear^.Message and gmLeft ) <> 0 then @@ -536,7 +536,7 @@ Gear^.dY:= -_0_15; if not cArtillery then Gear^.dX:= SignAs(_0_15, Gear^.dX); Gear^.State:= Gear^.State or gstMoving or gstHHJumping; - PlaySound(sndJump1, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); + PlaySound(sndJump1, Gear^.Hedgehog^.Team^.voicepack); exit end; end; @@ -549,7 +549,7 @@ Gear^.dY:= -_0_2; SetLittle(Gear^.dX); Gear^.State:= Gear^.State or gstMoving or gstHHJumping; - PlaySound(sndJump3, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); + PlaySound(sndJump3, Gear^.Hedgehog^.Team^.voicepack); exit end; @@ -570,7 +570,7 @@ end; DeleteCI(Gear); // must be after exit!! (see previous line) - PHedgehog(Gear^.Hedgehog)^.visStepPos:= (PHedgehog(Gear^.Hedgehog)^.visStepPos + 1) and 7; + Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7; if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then begin if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX)) @@ -630,7 +630,7 @@ procedure HedgehogChAngle(Gear: PGear); var da: LongWord; begin -with PHedgehog(Gear^.Hedgehog)^ do +with Gear^.Hedgehog^ do if (CurAmmoType = amRope) and ((Gear^.State and (gstMoving or gstHHJumping)) = gstMoving) then da:= 2 else da:= 1; @@ -649,7 +649,7 @@ if Gear^.dX.QWordValue > 8160437862 then Gear^.dX.QWordValue:= 8160437862; if Gear^.dY.QWordValue > 8160437862 then Gear^.dY.QWordValue:= 8160437862; -if PHedgehog(Gear^.Hedgehog)^.Unplaced then +if Gear^.Hedgehog^.Unplaced then begin Gear^.dY:= _0; Gear^.dX:= _0; @@ -773,7 +773,7 @@ wasJumping: boolean; Hedgehog: PHedgehog; begin -Hedgehog:= PHedgehog(Gear^.Hedgehog); +Hedgehog:= Gear^.Hedgehog; if not isInMultiShoot then AllInactive:= false else @@ -919,16 +919,16 @@ PrvInactive:= false; AllInactive:= false; - if not PHedgehog(Gear^.Hedgehog)^.Team^.hasGone then + if not Gear^.Hedgehog^.Team^.hasGone then begin - PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] := false; - if PHedgehog(Gear^.Hedgehog)^.Effects[heResurrectable] then begin + Gear^.Hedgehog^.Effects[hePoisoned] := false; + if Gear^.Hedgehog^.Effects[heResurrectable] then begin ResurrectHedgehog(Gear); end else begin Gear^.State:= Gear^.State or gstHHDeath; Gear^.doStep:= @doStepHedgehogDead; // Death message - AddCaption(Format(GetEventString(eidDied), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage); + AddCaption(Format(GetEventString(eidDied), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage); end; end else @@ -936,7 +936,7 @@ Gear^.State:= Gear^.State or gstHHGone; Gear^.doStep:= @doStepHedgehogGone; // Gone message - AddCaption(Format(GetEventString(eidGone), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage); + AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage); end end; exit @@ -974,7 +974,7 @@ doStepHedgehogFree(Gear) else begin - with PHedgehog(Gear^.Hedgehog)^ do + with Gear^.Hedgehog^ do if Team^.hasGone then TeamGoneEffect(Team^); doStepHedgehogDriven(Gear) end; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/SDLh.pas --- a/hedgewars/SDLh.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/SDLh.pas Thu Nov 18 16:58:08 2010 -0500 @@ -774,7 +774,7 @@ function TTF_Init: LongInt; cdecl; external SDL_TTFLibName; procedure TTF_Quit; cdecl; external SDL_TTFLibName; -function TTF_SizeUTF8(font: PTTF_Font; const text: PChar; var w, h: LongInt): LongInt; cdecl; external SDL_TTFLibName; +function TTF_SizeUTF8(font: PTTF_Font; const text: PChar; out w, h: LongInt): LongInt; cdecl; external SDL_TTFLibName; function TTF_RenderUTF8_Solid(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName; function TTF_RenderUTF8_Blended(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/VGSHandlers.inc --- a/hedgewars/VGSHandlers.inc Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/VGSHandlers.inc Thu Nov 18 16:58:08 2010 -0500 @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA *) procedure doStepFlake(Gear: PVisualGear; Steps: Longword); -var sign: float; +var sign: real; begin if vobCount = 0 then exit; @@ -59,8 +59,8 @@ begin if round(X) < cLeftScreenBorder then X:= X + cScreenSpace else if round(X) > cRightScreenBorder then X:= X - cScreenSpace; - // if round(Y) < (LAND_HEIGHT - 1024 - 75) then Y:= Y + float(25); // For if flag is set for flakes rising upwards? - if round(Y) - 75 > LAND_HEIGHT then Y:= Y - float(1024 + 150); // TODO - configure in theme (jellies for example could use limited range) + // if round(Y) < (LAND_HEIGHT - 1024 - 75) then Y:= Y + 25.0; // For if flag is set for flakes rising upwards? + if round(Y) - 75 > LAND_HEIGHT then Y:= Y - (1024 + 150); // TODO - configure in theme (jellies for example could use limited range) Timer:= 0; tdX:= 0; tdY:= 0 @@ -81,7 +81,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepCloud(Gear: PVisualGear; Steps: Longword); var s: Longword; - t: float; + t: real; begin Gear^.X:= Gear^.X + (cWindSpeedf * 750 * Gear^.dX) * Steps; @@ -444,16 +444,16 @@ begin if Gear^.Timer > Steps then dec(Gear^.Timer, Steps) else Gear^.Timer:= 0; -if (PHedgehog(Gear^.Hedgehog)^.Gear <> nil) then +if (Gear^.Hedgehog^.Gear <> nil) then begin - Gear^.X:= PHedgehog(Gear^.Hedgehog)^.Gear^.X.QWordValue/4294967296 + (Gear^.Tex^.w div 2 - Gear^.FrameTicks); - Gear^.Y:= PHedgehog(Gear^.Hedgehog)^.Gear^.Y.QWordValue/4294967296 - (16 + Gear^.Tex^.h); + Gear^.X:= Gear^.Hedgehog^.Gear^.X.QWordValue/4294967296 + (Gear^.Tex^.w div 2 - Gear^.FrameTicks); + Gear^.Y:= Gear^.Hedgehog^.Gear^.Y.QWordValue/4294967296 - (16 + Gear^.Tex^.h); end; if Gear^.Timer = 0 then begin - if PHedgehog(Gear^.Hedgehog)^.SpeechGear = Gear then - PHedgehog(Gear^.Hedgehog)^.SpeechGear:= nil; + if Gear^.Hedgehog^.SpeechGear = Gear then + Gear^.Hedgehog^.SpeechGear:= nil; DeleteVisualGear(Gear) end; end; @@ -462,10 +462,10 @@ begin Steps:= Steps; // avoid compiler hint -with PHedgehog(Gear^.Hedgehog)^ do +with Gear^.Hedgehog^ do if SpeechGear <> nil then SpeechGear^.Timer:= 0; -PHedgehog(Gear^.Hedgehog)^.SpeechGear:= Gear; +Gear^.Hedgehog^.SpeechGear:= Gear; Gear^.Timer:= max(Length(Gear^.Text) * 150, 3000); @@ -479,7 +479,7 @@ Gear^.doStep:= @doStepSpeechBubbleWork; -Gear^.Y:= Gear^.Y - float(Gear^.Tex^.h) +Gear^.Y:= Gear^.Y - Gear^.Tex^.h end; //////////////////////////////////////////////////////////////////////////////// @@ -512,7 +512,7 @@ str(Gear^.State, s); if Gear^.Hedgehog <> nil then - Gear^.Tex:= RenderStringTex(s, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color, fnt16) + Gear^.Tex:= RenderStringTex(s, Gear^.Hedgehog^.Team^.Clan^.Color, fnt16) else Gear^.Tex:= RenderStringTex(s, cWhiteColor, fnt16); @@ -521,7 +521,7 @@ else Gear^.doStep:= @doStepHealthTagWorkUnderWater; -Gear^.Y:= Gear^.Y - float(Gear^.Tex^.h); +Gear^.Y:= Gear^.Y - Gear^.Tex^.h; if Steps > 1 then Gear^.doStep(Gear, Steps-1); end; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/hwengine.pas Thu Nov 18 16:58:08 2010 -0500 @@ -30,7 +30,8 @@ {$ENDIF} uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uKeys, uSound, - uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uRandom, uLandTexture, uCollisions, uMobile, sysutils; + uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uRandom, uLandTexture, uCollisions, uMobile, + sysutils, uTypes, uVariables, uCommands, uUtils; var isTerminated: boolean = false; alsoShutdownFrontend: boolean = false; @@ -111,6 +112,7 @@ flagMakeCapture:= false; s:= 'hw_' + FormatDateTime('YYYY-MM-DD_HH-mm-ss', Now()) + inttostr(GameTicks); WriteLnToConsole('Saving ' + s + '...'); + playSound(sndShutter); MakeScreenshot(s); //SDL_SaveBMP_RW(SDLPrimSurface, SDL_RWFromFile(Str2PChar(s), 'wb'), 1) end; @@ -123,7 +125,6 @@ FreeActionsList(); StoreRelease(); ControllerClose(); - SendKB(); CloseIPC(); TTF_Quit(); {$IFDEF SDL13} @@ -317,8 +318,11 @@ Randomize(); // uConsts does not need initialization as they are all consts + uUtils.initModule; uMisc.initModule; + uVariables.initModule; uConsole.initModule; // MUST happen after uMisc + uCommands.initModule; uLand.initModule; uIO.initModule; @@ -385,7 +389,10 @@ uIO.freeModule; //stub uLand.freeModule; + uCommands.freeModule; uConsole.freeModule; + uVariables.freeModule; + uUtils.freeModule; uMisc.freeModule; // uMisc closes the debug log. end; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uAI.pas --- a/hedgewars/uAI.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uAI.pas Thu Nov 18 16:58:08 2010 -0500 @@ -29,8 +29,9 @@ procedure FreeActionsList; implementation -uses uTeams, uConsts, SDLh, uAIMisc, uGears, uAIAmmoTests, uAIActions, uMisc, - uAmmos, uConsole, SysUtils{$IFDEF UNIX}, cthreads{$ENDIF}; +uses uConsts, SDLh, uAIMisc, uAIAmmoTests, uAIActions, + uAmmos, SysUtils{$IFDEF UNIX}, cthreads{$ENDIF}, uTypes, + uVariables, uCommands, uUtils, uIO; var BestActions: TActions; CanUseAmmo: array [TAmmoType] of boolean; @@ -65,7 +66,7 @@ Score, i: LongInt; a, aa: TAmmoType; begin -BotLevel:= PHedgehog(Me^.Hedgehog)^.BotLevel; +BotLevel:= Me^.Hedgehog^.BotLevel; for i:= 0 to Pred(Targets.Count) do if (Targets.ar[i].Score >= 0) and (not StopThinking) then @@ -194,18 +195,18 @@ Actions.Pos:= 0; Actions.Score:= 0; Stack.Count:= 0; -BotLevel:= PHedgehog(Me^.Hedgehog)^.BotLevel; +BotLevel:= Me^.Hedgehog^.BotLevel; tmp:= random(2) + 1; Push(0, Actions, Me^, tmp); Push(0, Actions, Me^, tmp xor 3); -if (Me^.State and gstAttacked) = 0 then maxticks:= max(0, TurnTimeLeft - 5000 - LongWord(4000 * BotLevel)) +if (Me^.State and gstAttacked) = 0 then maxticks:= Max(0, TurnTimeLeft - 5000 - LongWord(4000 * BotLevel)) else maxticks:= TurnTimeLeft; if (Me^.State and gstAttacked) = 0 then TestAmmos(Actions, Me, false); BestRate:= RatePlace(Me); -BaseRate:= max(BestRate, 0); +BaseRate:= Max(BestRate, 0); while (Stack.Count > 0) and (not StopThinking) and (GameFlags and gfArtillery = 0) do begin @@ -321,7 +322,7 @@ FillBonuses((Me^.State and gstAttacked) <> 0); for a:= Low(TAmmoType) to High(TAmmoType) do - CanUseAmmo[a]:= Assigned(AmmoTests[a].proc) and HHHasAmmo(PHedgehog(Me^.Hedgehog)^, a); + CanUseAmmo[a]:= Assigned(AmmoTests[a].proc) and HHHasAmmo(Me^.Hedgehog^, a); {$IFDEF DEBUGFILE}AddFileLog('Enter Think Thread');{$ENDIF} BeginThread(@Think, Me, ThinkThread) end; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uAIActions.pas --- a/hedgewars/uAIActions.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uAIActions.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,7 +20,7 @@ unit uAIActions; interface -uses uGears, uFloat; +uses uFloat, uTypes; const MAXACTIONS = 96; aia_none = 0; @@ -62,7 +62,7 @@ procedure ProcessAction(var Actions: TActions; Me: PGear); implementation -uses uMisc, uConsts, uConsole, uAIMisc, uAI, uAmmos; +uses uAIMisc, uAI, uAmmos, uVariables, uCommands, uUtils, uIO; const ActionIdToStr: array[0..6] of string[16] = ( {aia_none} '', @@ -95,8 +95,8 @@ else begin WriteLnToConsole('AI action: '+SpecActionIdToStr[Action.Action]); if (Action.Action = aia_WaitXL) or (Action.Action = aia_WaitXR) then - WriteLnToConsole('AI action Wait X = '+inttostr(Action.Param)+', current X = '+inttostr(hwRound(Me^.X))) - else if (Action.Action = aia_AwareExpl) then WriteLnToConsole('Aware X = ' + inttostr(Action.X) + ', Y = ' + inttostr(Action.Y)); + WriteLnToConsole('AI action Wait X = '+IntToStr(Action.Param)+', current X = '+IntToStr(hwRound(Me^.X))) + else if (Action.Action = aia_AwareExpl) then WriteLnToConsole('Aware X = ' + IntToStr(Action.X) + ', Y = ' + IntToStr(Action.Y)); end end; {$ENDIF} @@ -199,7 +199,7 @@ aim_push: s:= '+' + s; aim_release: s:= '-' + s; end - else if Param <> 0 then s:= s + ' ' + inttostr(Param); + else if Param <> 0 then s:= s + ' ' + IntToStr(Param); ParseCommand(s, true) end end; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uAIAmmoTests.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,7 +20,7 @@ unit uAIAmmoTests; interface -uses SDLh, uGears, uConsts, uFloat; +uses SDLh, uConsts, uFloat, uTypes; const amtest_OnTurn = $00000001; type TAttackParams = record @@ -108,7 +108,7 @@ const BadTurn = Low(LongInt) div 4; implementation -uses uMisc, uAIMisc, uLand; +uses uAIMisc, uVariables, uUtils; function Metric(x1, y1, x2, y2: LongInt): LongInt; begin @@ -539,7 +539,7 @@ or (y.Round > LongWord(LAND_HEIGHT)) or (d > 200); -if Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 3 then valueResult:= max(0, (4 - d div 50) * 7 * 1024) +if Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 3 then valueResult:= Max(0, (4 - d div 50) * 7 * 1024) else valueResult:= BadTurn; TestDesertEagle:= valueResult end; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uAIMisc.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,7 +20,7 @@ unit uAIMisc; interface -uses SDLh, uConsts, uGears, uFloat; +uses SDLh, uConsts, uFloat, uTypes; const MAXBONUS = 1024; @@ -68,8 +68,7 @@ end; implementation -uses uTeams, uMisc, uLand, uCollisions; - +uses uCollisions, uVariables, uUtils, uIO; const KillScore = 200; @@ -131,7 +130,7 @@ begin bonuses.Count:= 0; -MyClan:= PHedgehog(ThinkingHH^.Hedgehog)^.Team^.Clan; +MyClan:= ThinkingHH^.Hedgehog^.Team^.Clan; Gear:= GearsList; while Gear <> nil do begin @@ -150,7 +149,7 @@ AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 60, -25) else if isAfterAttack and (ThinkingHH^.Hedgehog <> Gear^.Hedgehog) then - if (MyClan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan) then + if (MyClan = Gear^.Hedgehog^.Team^.Clan) then AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 150, -3) // hedgehog-friend else AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 100, 3) diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uAmmos.pas --- a/hedgewars/uAmmos.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uAmmos.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,7 +20,7 @@ unit uAmmos; interface -uses uConsts, uTeams, uStats; +uses uConsts, uTypes; procedure initModule; procedure freeModule; @@ -47,7 +47,7 @@ var StoreCnt: Longword; implementation -uses uMisc, uGears, uWorld, uLocale, uConsole, uMobile; +uses uWorld, uLocale, uMobile, uVariables, uCommands, uUtils, uIO; type TAmmoCounts = array[TAmmoType] of Longword; var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo; @@ -326,7 +326,7 @@ if (Count <> AMMO_INFINITE) and not (Hedgehog.Team^.ExtDriven or (Hedgehog.BotLevel > 0)) then s:= s + ' (' + IntToStr(Count) + ')'; if (Propz and ammoprop_Timerable) <> 0 then - s:= s + ', ' + inttostr(Timer div 1000) + ' ' + trammo[sidSeconds]; + s:= s + ', ' + IntToStr(Timer div 1000) + ' ' + trammo[sidSeconds]; AddCaption(s, Team^.Clan^.Color, capgrpAmmoinfo); end; if (Propz and ammoprop_NeedTarget) <> 0 diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uChat.pas --- a/hedgewars/uChat.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uChat.pas Thu Nov 18 16:58:08 2010 -0500 @@ -34,7 +34,7 @@ showAll: boolean; implementation -uses uMisc, uStore, uConsts, SDLh, uConsole, uKeys, uTeams; +uses uStore, SDLh, uKeys, uTypes, uVariables, uCommands, uUtils, uTextures, uRender; const MaxStrIndex = 27; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uCollisions.pas --- a/hedgewars/uCollisions.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uCollisions.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,7 +20,7 @@ unit uCollisions; interface -uses uGears, uFloat; +uses uFloat, uTypes; const cMaxGearArrayInd = 255; @@ -52,7 +52,7 @@ function calcSlopeTangent(Gear: PGear; collisionX, collisionY: LongInt; var outDeltaX, outDeltaY: LongInt; TestWord: LongWord): Boolean; implementation -uses uMisc, uConsts, uLand, uLandGraphics; +uses uConsts, uLandGraphics, uVariables, uIO; type TCollisionEntry = record X, Y, Radius: LongInt; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uCommands.pas --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hedgewars/uCommands.pas Thu Nov 18 16:58:08 2010 -0500 @@ -0,0 +1,235 @@ +{$INCLUDE "options.inc"} + +unit uCommands; + +interface + +var isDeveloperMode: boolean; +type TVariableType = (vtCommand, vtLongInt, vthwFloat, vtBoolean); + TCommandHandler = procedure (var params: shortstring); + +procedure initModule; +procedure freeModule; +procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); +procedure StopMessages(Message: Longword); +procedure doPut(putX, putY: LongInt; fromAI: boolean); + +implementation +uses uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uMobile, + uRandom, uAmmos, uStats, uChat, SDLh, uSound, uVisualGears, uScript, uTypes, + uVariables, uConsole, uFloat, uUtils; + +type PVariable = ^TVariable; + TVariable = record + Next: PVariable; + Name: string[15]; + VType: TVariableType; + Handler: pointer; + Trusted: boolean; + end; + +var + Variables: PVariable; + +function RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean): PVariable; +var value: PVariable; +begin +New(value); +TryDo(value <> nil, 'RegisterVariable: value = nil', true); +FillChar(value^, sizeof(TVariable), 0); +value^.Name:= Name; +value^.VType:= VType; +value^.Handler:= p; +value^.Trusted:= Trusted; + +if Variables = nil then Variables:= value + else begin + value^.Next:= Variables; + Variables:= value + end; + +RegisterVariable:= value; +end; + + +procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); +var ii: LongInt; + s: shortstring; + t: PVariable; + c: char; +begin +//WriteLnToConsole(CmdStr); +if CmdStr[0]=#0 then exit; +{$IFDEF DEBUGFILE}AddFileLog('ParseCommand "' + CmdStr + '"');{$ENDIF} +c:= CmdStr[1]; +if c in ['/', '$'] then Delete(CmdStr, 1, 1) else c:= '/'; +s:= ''; +SplitBySpace(CmdStr, s); +t:= Variables; +while t <> nil do + begin + if t^.Name = CmdStr then + begin + if TrustedSource or t^.Trusted then + case t^.VType of + vtCommand: if c='/' then + begin + TCommandHandler(t^.Handler)(s); + end; + vtLongInt: if c='$' then + if s[0]=#0 then + begin + str(PLongInt(t^.Handler)^, s); + WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); + end else val(s, PLongInt(t^.Handler)^); + vthwFloat: if c='$' then + if s[0]=#0 then + begin + //str(PhwFloat(t^.Handler)^:4:6, s); + WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); + end else; //val(s, PhwFloat(t^.Handler)^, i); + vtBoolean: if c='$' then + if s[0]=#0 then + begin + str(ord(boolean(t^.Handler^)), s); + WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); + end else + begin + val(s, ii); + boolean(t^.Handler^):= not (ii = 0) + end; + end; + exit + end else t:= t^.Next + end; +case c of + '$': WriteLnToConsole(errmsgUnknownVariable + ': "$' + CmdStr + '"') + else WriteLnToConsole(errmsgUnknownCommand + ': "/' + CmdStr + '"') end +end; + + +procedure StopMessages(Message: Longword); +begin +if (Message and gmLeft) <> 0 then ParseCommand('/-left', true) else +if (Message and gmRight) <> 0 then ParseCommand('/-right', true) else +if (Message and gmUp) <> 0 then ParseCommand('/-up', true) else +if (Message and gmDown) <> 0 then ParseCommand('/-down', true) else +if (Message and gmAttack) <> 0 then ParseCommand('/-attack', true) +end; + +{$INCLUDE "CCHandlers.inc"} + +procedure initModule; +begin + Variables:= nil; + isDeveloperMode:= true; + + // NOTE: please, keep most frequently used commands on bottom + RegisterVariable('flag' , vtCommand, @chFlag , false); + RegisterVariable('script' , vtCommand, @chScript , false); + RegisterVariable('proto' , vtCommand, @chCheckProto , true ); + RegisterVariable('spectate', vtBoolean, @fastUntilLag , false); + RegisterVariable('capture' , vtCommand, @chCapture , true ); + RegisterVariable('rotmask' , vtCommand, @chRotateMask , true ); + RegisterVariable('addteam' , vtCommand, @chAddTeam , false); + RegisterVariable('rdriven' , vtCommand, @chTeamLocal , false); + RegisterVariable('map' , vtCommand, @chSetMap , false); + RegisterVariable('theme' , vtCommand, @chSetTheme , false); + RegisterVariable('seed' , vtCommand, @chSetSeed , false); + RegisterVariable('template_filter', vtLongInt, @cTemplateFilter, false); + RegisterVariable('mapgen' , vtLongInt, @cMapGen , false); + RegisterVariable('maze_size',vtLongInt, @cMazeSize , false); + RegisterVariable('delay' , vtLongInt, @cInactDelay , false); + RegisterVariable('ready' , vtLongInt, @cReadyDelay , false); + RegisterVariable('casefreq', vtLongInt, @cCaseFactor , false); + RegisterVariable('healthprob', vtLongInt, @cHealthCaseProb, false); + RegisterVariable('hcaseamount', vtLongInt, @cHealthCaseAmount, false); + RegisterVariable('sd_turns', vtLongInt, @cSuddenDTurns , false); + RegisterVariable('waterrise', vtLongInt, @cWaterRise , false); + RegisterVariable('healthdec', vtLongInt, @cHealthDecrease, false); + RegisterVariable('damagepct',vtLongInt, @cDamagePercent , false); + RegisterVariable('minedudpct',vtLongInt,@cMineDudPercent, false); + RegisterVariable('minesnum', vtLongInt, @cLandMines , false); + RegisterVariable('explosives',vtLongInt,@cExplosives , false); + RegisterVariable('gmflags' , vtLongInt, @GameFlags , false); + RegisterVariable('trflags' , vtLongInt, @TrainingFlags , false); + RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false); + RegisterVariable('minestime',vtLongInt, @cMinesTime , false); + RegisterVariable('fort' , vtCommand, @chFort , false); + RegisterVariable('voicepack',vtCommand, @chVoicepack , false); + RegisterVariable('grave' , vtCommand, @chGrave , false); + RegisterVariable('bind' , vtCommand, @chBind , true ); + RegisterVariable('addhh' , vtCommand, @chAddHH , false); + RegisterVariable('hat' , vtCommand, @chSetHat , false); + RegisterVariable('hhcoords', vtCommand, @chSetHHCoords , false); + RegisterVariable('ammloadt', vtCommand, @chSetAmmoLoadout, false); + RegisterVariable('ammdelay', vtCommand, @chSetAmmoDelay, false); + RegisterVariable('ammprob', vtCommand, @chSetAmmoProbability, false); + RegisterVariable('ammreinf', vtCommand, @chSetAmmoReinforcement, false); + RegisterVariable('ammstore', vtCommand, @chAddAmmoStore , false); + RegisterVariable('quit' , vtCommand, @chQuit , true ); + RegisterVariable('confirm' , vtCommand, @chConfirm , true ); + RegisterVariable('+speedup', vtCommand, @chSpeedup_p , true ); + RegisterVariable('-speedup', vtCommand, @chSpeedup_m , true ); + RegisterVariable('zoomin' , vtCommand, @chZoomIn , true ); + RegisterVariable('zoomout' , vtCommand, @chZoomOut , true ); + RegisterVariable('zoomreset',vtCommand, @chZoomReset , true ); + RegisterVariable('skip' , vtCommand, @chSkip , false); + RegisterVariable('history' , vtCommand, @chHistory , true ); + RegisterVariable('chat' , vtCommand, @chChat , true ); + RegisterVariable('say' , vtCommand, @chSay , true ); + RegisterVariable('hogsay' , vtCommand, @chHogSay , true ); + RegisterVariable('team' , vtCommand, @chTeamSay , true ); + RegisterVariable('ammomenu', vtCommand, @chAmmoMenu , true); + RegisterVariable('+precise', vtCommand, @chPrecise_p , false); + RegisterVariable('-precise', vtCommand, @chPrecise_m , false); + RegisterVariable('+left' , vtCommand, @chLeft_p , false); + RegisterVariable('-left' , vtCommand, @chLeft_m , false); + RegisterVariable('+right' , vtCommand, @chRight_p , false); + RegisterVariable('-right' , vtCommand, @chRight_m , false); + RegisterVariable('+up' , vtCommand, @chUp_p , false); + RegisterVariable('-up' , vtCommand, @chUp_m , false); + RegisterVariable('+down' , vtCommand, @chDown_p , false); + RegisterVariable('-down' , vtCommand, @chDown_m , false); + RegisterVariable('+attack' , vtCommand, @chAttack_p , false); + RegisterVariable('-attack' , vtCommand, @chAttack_m , false); + RegisterVariable('switch' , vtCommand, @chSwitch , false); + RegisterVariable('nextturn', vtCommand, @chNextTurn , false); + RegisterVariable('timer' , vtCommand, @chTimer , false); + RegisterVariable('taunt' , vtCommand, @chTaunt , false); + RegisterVariable('setweap' , vtCommand, @chSetWeapon , false); + RegisterVariable('slot' , vtCommand, @chSlot , false); + RegisterVariable('put' , vtCommand, @chPut , false); + RegisterVariable('ljump' , vtCommand, @chLJump , false); + RegisterVariable('hjump' , vtCommand, @chHJump , false); + RegisterVariable('fullscr' , vtCommand, @chFullScr , true ); + RegisterVariable('+volup' , vtCommand, @chVol_p , true ); + RegisterVariable('-volup' , vtCommand, @chVol_m , true ); + RegisterVariable('+voldown', vtCommand, @chVol_m , true ); + RegisterVariable('-voldown', vtCommand, @chVol_p , true ); + RegisterVariable('findhh' , vtCommand, @chFindhh , true ); + RegisterVariable('pause' , vtCommand, @chPause , true ); + RegisterVariable('+cur_u' , vtCommand, @chCurU_p , true ); + RegisterVariable('-cur_u' , vtCommand, @chCurU_m , true ); + RegisterVariable('+cur_d' , vtCommand, @chCurD_p , true ); + RegisterVariable('-cur_d' , vtCommand, @chCurD_m , true ); + RegisterVariable('+cur_l' , vtCommand, @chCurL_p , true ); + RegisterVariable('-cur_l' , vtCommand, @chCurL_m , true ); + RegisterVariable('+cur_r' , vtCommand, @chCurR_p , true ); + RegisterVariable('-cur_r' , vtCommand, @chCurR_m , true ); +end; + +procedure freeModule; +var t, tt: PVariable; +begin + tt:= Variables; + Variables:= nil; + while tt <> nil do + begin + t:= tt; + tt:= tt^.Next; + Dispose(t) + end; +end; + +end. \ No newline at end of file diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uConsole.pas --- a/hedgewars/uConsole.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uConsole.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,44 +20,26 @@ unit uConsole; interface -uses uFloat; - -var isDeveloperMode: boolean; -type TVariableType = (vtCommand, vtLongInt, vthwFloat, vtBoolean); - TCommandHandler = procedure (var params: shortstring); procedure initModule; procedure freeModule; procedure WriteToConsole(s: shortstring); procedure WriteLnToConsole(s: shortstring); -procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); -procedure StopMessages(Message: Longword); function GetLastConsoleLine: shortstring; -procedure doPut(putX, putY: LongInt; fromAI: boolean); - implementation -uses uMisc, uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uWorld, uMobile, - uRandom, uAmmos, uStats, uChat, SDLh, uSound, uVisualGears, uScript; +uses uMisc, Types, uVariables, uUtils; const cLineWidth: LongInt = 0; cLinesCount = 256; -type PVariable = ^TVariable; - TVariable = record - Next: PVariable; - Name: string[15]; - VType: TVariableType; - Handler: pointer; - Trusted: boolean; - end; +type TTextLine = record s: shortstring; end; var ConsoleLines: array[byte] of TTextLine; CurrLine: LongInt; - Variables: PVariable; procedure SetLine(var tl: TTextLine; str: shortstring); begin @@ -65,26 +47,6 @@ s:= str; end; -function RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean): PVariable; -var value: PVariable; -begin -New(value); -TryDo(value <> nil, 'RegisterVariable: value = nil', true); -FillChar(value^, sizeof(TVariable), 0); -value^.Name:= Name; -value^.VType:= VType; -value^.Handler:= p; -value^.Trusted:= Trusted; - -if Variables = nil then Variables:= value - else begin - value^.Next:= Variables; - Variables:= value - end; - -RegisterVariable:= value; -end; - procedure WriteToConsole(s: shortstring); var Len: LongInt; done: boolean; @@ -122,60 +84,6 @@ {$ENDIF} end; -procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); -var ii: LongInt; - s: shortstring; - t: PVariable; - c: char; -begin -//WriteLnToConsole(CmdStr); -if CmdStr[0]=#0 then exit; -{$IFDEF DEBUGFILE}AddFileLog('ParseCommand "' + CmdStr + '"');{$ENDIF} -c:= CmdStr[1]; -if c in ['/', '$'] then Delete(CmdStr, 1, 1) else c:= '/'; -s:= ''; -SplitBySpace(CmdStr, s); -t:= Variables; -while t <> nil do - begin - if t^.Name = CmdStr then - begin - if TrustedSource or t^.Trusted then - case t^.VType of - vtCommand: if c='/' then - begin - TCommandHandler(t^.Handler)(s); - end; - vtLongInt: if c='$' then - if s[0]=#0 then - begin - str(PLongInt(t^.Handler)^, s); - WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); - end else val(s, PLongInt(t^.Handler)^); - vthwFloat: if c='$' then - if s[0]=#0 then - begin - //str(PhwFloat(t^.Handler)^:4:6, s); - WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); - end else; //val(s, PhwFloat(t^.Handler)^, i); - vtBoolean: if c='$' then - if s[0]=#0 then - begin - str(ord(boolean(t^.Handler^)), s); - WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); - end else - begin - val(s, ii); - boolean(t^.Handler^):= not (ii = 0) - end; - end; - exit - end else t:= t^.Next - end; -case c of - '$': WriteLnToConsole(errmsgUnknownVariable + ': "$' + CmdStr + '"') - else WriteLnToConsole(errmsgUnknownCommand + ': "/' + CmdStr + '"') end -end; function GetLastConsoleLine: shortstring; var valueStr: shortstring; @@ -192,22 +100,10 @@ GetLastConsoleLine:= valueStr; end; -procedure StopMessages(Message: Longword); -begin -if (Message and gmLeft) <> 0 then ParseCommand('/-left', true) else -if (Message and gmRight) <> 0 then ParseCommand('/-right', true) else -if (Message and gmUp) <> 0 then ParseCommand('/-up', true) else -if (Message and gmDown) <> 0 then ParseCommand('/-down', true) else -if (Message and gmAttack) <> 0 then ParseCommand('/-attack', true) -end; - -{$INCLUDE "CCHandlers.inc"} procedure initModule; var i: LongInt; begin CurrLine:= 0; - Variables:= nil; - isDeveloperMode:= true; // initConsole cLineWidth:= cScreenWidth div 10; @@ -215,113 +111,11 @@ cLineWidth:= 255; for i:= 0 to Pred(cLinesCount) do PByte(@ConsoleLines[i])^:= 0; - - // NOTE: please, keep most frequently used commands on bottom - RegisterVariable('flag' , vtCommand, @chFlag , false); - RegisterVariable('script' , vtCommand, @chScript , false); - RegisterVariable('proto' , vtCommand, @chCheckProto , true ); - RegisterVariable('spectate', vtBoolean, @fastUntilLag , false); - RegisterVariable('capture' , vtCommand, @chCapture , true ); - RegisterVariable('rotmask' , vtCommand, @chRotateMask , true ); - RegisterVariable('addteam' , vtCommand, @chAddTeam , false); - RegisterVariable('rdriven' , vtCommand, @chTeamLocal , false); - RegisterVariable('map' , vtCommand, @chSetMap , false); - RegisterVariable('theme' , vtCommand, @chSetTheme , false); - RegisterVariable('seed' , vtCommand, @chSetSeed , false); - RegisterVariable('template_filter', vtLongInt, @cTemplateFilter, false); - RegisterVariable('mapgen' , vtLongInt, @cMapGen , false); - RegisterVariable('maze_size',vtLongInt, @cMazeSize , false); - RegisterVariable('delay' , vtLongInt, @cInactDelay , false); - RegisterVariable('ready' , vtLongInt, @cReadyDelay , false); - RegisterVariable('casefreq', vtLongInt, @cCaseFactor , false); - RegisterVariable('healthprob', vtLongInt, @cHealthCaseProb, false); - RegisterVariable('hcaseamount', vtLongInt, @cHealthCaseAmount, false); - RegisterVariable('sd_turns', vtLongInt, @cSuddenDTurns , false); - RegisterVariable('waterrise', vtLongInt, @cWaterRise , false); - RegisterVariable('healthdec', vtLongInt, @cHealthDecrease, false); - RegisterVariable('damagepct',vtLongInt, @cDamagePercent , false); - RegisterVariable('minedudpct',vtLongInt,@cMineDudPercent, false); - RegisterVariable('minesnum', vtLongInt, @cLandMines , false); - RegisterVariable('explosives',vtLongInt,@cExplosives , false); - RegisterVariable('gmflags' , vtLongInt, @GameFlags , false); - RegisterVariable('trflags' , vtLongInt, @TrainingFlags , false); - RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false); - RegisterVariable('minestime',vtLongInt, @cMinesTime , false); - RegisterVariable('fort' , vtCommand, @chFort , false); - RegisterVariable('voicepack',vtCommand, @chVoicepack , false); - RegisterVariable('grave' , vtCommand, @chGrave , false); - RegisterVariable('bind' , vtCommand, @chBind , true ); - RegisterVariable('addhh' , vtCommand, @chAddHH , false); - RegisterVariable('hat' , vtCommand, @chSetHat , false); - RegisterVariable('hhcoords', vtCommand, @chSetHHCoords , false); - RegisterVariable('ammloadt', vtCommand, @chSetAmmoLoadout, false); - RegisterVariable('ammdelay', vtCommand, @chSetAmmoDelay, false); - RegisterVariable('ammprob', vtCommand, @chSetAmmoProbability, false); - RegisterVariable('ammreinf', vtCommand, @chSetAmmoReinforcement, false); - RegisterVariable('ammstore', vtCommand, @chAddAmmoStore , false); - RegisterVariable('quit' , vtCommand, @chQuit , true ); - RegisterVariable('confirm' , vtCommand, @chConfirm , true ); - RegisterVariable('+speedup', vtCommand, @chSpeedup_p , true ); - RegisterVariable('-speedup', vtCommand, @chSpeedup_m , true ); - RegisterVariable('zoomin' , vtCommand, @chZoomIn , true ); - RegisterVariable('zoomout' , vtCommand, @chZoomOut , true ); - RegisterVariable('zoomreset',vtCommand, @chZoomReset , true ); - RegisterVariable('skip' , vtCommand, @chSkip , false); - RegisterVariable('history' , vtCommand, @chHistory , true ); - RegisterVariable('chat' , vtCommand, @chChat , true ); - RegisterVariable('say' , vtCommand, @chSay , true ); - RegisterVariable('hogsay' , vtCommand, @chHogSay , true ); - RegisterVariable('team' , vtCommand, @chTeamSay , true ); - RegisterVariable('ammomenu', vtCommand, @chAmmoMenu , true); - RegisterVariable('+precise', vtCommand, @chPrecise_p , false); - RegisterVariable('-precise', vtCommand, @chPrecise_m , false); - RegisterVariable('+left' , vtCommand, @chLeft_p , false); - RegisterVariable('-left' , vtCommand, @chLeft_m , false); - RegisterVariable('+right' , vtCommand, @chRight_p , false); - RegisterVariable('-right' , vtCommand, @chRight_m , false); - RegisterVariable('+up' , vtCommand, @chUp_p , false); - RegisterVariable('-up' , vtCommand, @chUp_m , false); - RegisterVariable('+down' , vtCommand, @chDown_p , false); - RegisterVariable('-down' , vtCommand, @chDown_m , false); - RegisterVariable('+attack' , vtCommand, @chAttack_p , false); - RegisterVariable('-attack' , vtCommand, @chAttack_m , false); - RegisterVariable('switch' , vtCommand, @chSwitch , false); - RegisterVariable('nextturn', vtCommand, @chNextTurn , false); - RegisterVariable('timer' , vtCommand, @chTimer , false); - RegisterVariable('taunt' , vtCommand, @chTaunt , false); - RegisterVariable('setweap' , vtCommand, @chSetWeapon , false); - RegisterVariable('slot' , vtCommand, @chSlot , false); - RegisterVariable('put' , vtCommand, @chPut , false); - RegisterVariable('ljump' , vtCommand, @chLJump , false); - RegisterVariable('hjump' , vtCommand, @chHJump , false); - RegisterVariable('fullscr' , vtCommand, @chFullScr , true ); - RegisterVariable('+volup' , vtCommand, @chVol_p , true ); - RegisterVariable('-volup' , vtCommand, @chVol_m , true ); - RegisterVariable('+voldown', vtCommand, @chVol_m , true ); - RegisterVariable('-voldown', vtCommand, @chVol_p , true ); - RegisterVariable('findhh' , vtCommand, @chFindhh , true ); - RegisterVariable('pause' , vtCommand, @chPause , true ); - RegisterVariable('+cur_u' , vtCommand, @chCurU_p , true ); - RegisterVariable('-cur_u' , vtCommand, @chCurU_m , true ); - RegisterVariable('+cur_d' , vtCommand, @chCurD_p , true ); - RegisterVariable('-cur_d' , vtCommand, @chCurD_m , true ); - RegisterVariable('+cur_l' , vtCommand, @chCurL_p , true ); - RegisterVariable('-cur_l' , vtCommand, @chCurL_m , true ); - RegisterVariable('+cur_r' , vtCommand, @chCurR_p , true ); - RegisterVariable('-cur_r' , vtCommand, @chCurR_m , true ); end; procedure freeModule; -var t, tt: PVariable; begin - tt:= Variables; - Variables:= nil; - while tt <> nil do - begin - t:= tt; - tt:= tt^.Next; - Dispose(t) - end; + end; end. diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uConsts.pas Thu Nov 18 16:58:08 2010 -0500 @@ -21,7 +21,7 @@ unit uConsts; interface -uses SDLh, uFloat, uLocale, GLunit; +uses SDLh, uFloat, GLunit; {$INCLUDE "config.inc"} @@ -29,170 +29,6 @@ // typed const is a variable despite const qualifier // in freepascal you may actually use var for the same purpose -type - HwColor4f = record - r, g, b, a: byte - end; - - TGameState = (gsLandGen, gsStart, gsGame, gsChat, gsConfirm, gsExit); - - TGameType = (gmtLocal, gmtDemo, gmtNet, gmtSave, gmtLandPreview, gmtSyntax); - - TPathType = (ptNone, ptData, ptGraphics, ptThemes, ptCurrTheme, ptTeams, ptMaps, - ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts, - ptLocale, ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps); - - TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame, - sprLag, sprArrow, sprBazookaShell, sprTargetP, sprBee, - sprSmokeTrace, sprRopeHook, sprExplosion50, sprMineOff, - sprMineOn, sprMineDead, sprCase, sprFAid, sprDynamite, sprPower, - sprClusterBomb, sprClusterParticle, sprFlame, sprHorizont, - sprHorizontL, sprHorizontR, sprSky, sprSkyL, - sprSkyR, sprAMBorderHorizontal, sprAMBorderVertical, sprAMSlot, sprAMAmmos, - sprAMSlotKeys, sprAMCorners, sprFinger, sprAirBomb, - sprAirplane, sprAmAirplane, sprAmGirder, sprHHTelepMask, - sprSwitch, sprParachute, sprTarget, sprRopeNode, - sprQuestion, sprPowerBar, sprWindBar, sprWindL, sprWindR, - sprFlake, sprHandRope, sprHandBazooka, sprHandShotgun, - sprHandDEagle, sprHandAirAttack, sprHandBaseball, sprPHammer, - sprHandBlowTorch, sprBlowTorch, sprTeleport, sprHHDeath, - sprShotgun, sprDEagle, sprHHIdle, sprMortar, sprTurnsLeft, - sprKamikaze, sprWhip, sprKowtow, sprSad, sprWave, - sprHurrah, sprLemonade, sprShrug, sprJuggle, sprExplPart, sprExplPart2, - sprCakeWalk, sprCakeDown, sprAMAmmosBW, sprWatermelon, - sprEvilTrace, sprHellishBomb, sprSeduction, sprDress, - sprCensored, sprDrill, sprHandDrill, sprHandBallgun, sprBalls, - sprPlane, sprHandPlane, sprUtility, sprInvulnerable, sprVampiric, sprGirder, - sprSpeechCorner, sprSpeechEdge, sprSpeechTail, - sprThoughtCorner, sprThoughtEdge, sprThoughtTail, - sprShoutCorner, sprShoutEdge, sprShoutTail, - sprSniperRifle, sprBubbles, sprJetpack, sprHealth, sprHandMolotov, sprMolotov, - sprSmoke, sprSmokeWhite, sprShell, sprDust, sprExplosives, sprExplosivesRoll, - sprAmTeleport, sprSplash, sprDroplet, sprBirdy, sprHandCake, sprHandConstruction, - sprHandGrenade, sprHandMelon, sprHandMortar, sprHandSkip, sprHandCluster, - sprHandDynamite, sprHandHellish, sprHandMine, sprHandSeduction, sprHandVamp, - sprBigExplosion, sprSmokeRing, sprBeeTrace, sprEgg, sprTargetBee, sprHandBee, - sprFeather, sprPiano, sprHandSineGun, sprPortalGun, sprPortal, - sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk, sprNote, - sprSMineOff, sprSMineOn, sprHandSMine, sprHammer, - sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb, - sprBulletHit - ); - - // Gears that interact with other Gears and/or Land - TGearType = (gtBomb, gtHedgehog, gtShell, gtGrave, gtBee, // 4 - gtShotgunShot, gtPickHammer, gtRope, gtMine, gtCase, // 9 - gtDEagleShot, gtDynamite, gtClusterBomb, gtCluster, gtShover, // 14 - gtFlame, gtFirePunch, gtATStartGame, gtATSmoothWindCh, // 18 - gtATFinishGame, gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, // 23 - gtGirder, gtTeleport, gtSwitcher, gtTarget, gtMortar, // 28 - gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 34 - gtHellishBomb, gtWaterUp, gtDrill, gtBallGun, gtBall, gtRCPlane, // 40 - gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy, // 45 - gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 51 - gtSMine, gtPoisonCloud, gtHammer, gtHammerHit, gtResurrector, // 56 - gtNapalmBomb); // 57 - - // Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.) - TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire, - vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble, - vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtHealth, vgtShell, - vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing, vgtBeeTrace, vgtEgg, - vgtFeather, vgtHealthTag, vgtSmokeTrace, vgtEvilTrace, vgtExplosion, - vgtBigExplosion, vgtChunk, vgtNote, vgtLineTrail, - vgtBulletHit); - - TGearsType = set of TGearType; - - TDamageSource = (dsUnknown, dsFall, dsBullet, dsExplosion, dsShove, dsPoison); - - TSound = (sndNone, - sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, - sndSplash, sndShotgunReload, sndShotgunFire, sndGraveImpact, - sndMineTick, sndPickhammer, sndGun, sndBee, sndJump1, sndJump2, - sndJump3, sndYesSir, sndLaugh, sndIllGetYou, sndIncoming, - sndMissed, sndStupid, sndFirstBlood, sndBoring, sndByeBye, - sndSameTeam, sndNutter, sndReinforce, sndTraitor, sndRegret, - sndEnemyDown, sndCoward, sndHurry, sndWatchIt, sndKamikaze, - sndCake, sndOw1, sndOw2, sndOw3, sndOw4, sndFirePunch1, sndFirePunch2, - sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6, - sndMelon, sndHellish, sndYoohoo, sndRCPlane, sndWhipCrack, - sndRideOfTheValkyries, sndDenied, sndPlaced, sndBaseballBat, - sndVaporize, sndWarp, sndSuddenDeath, sndMortar, sndShutter, - sndHomerun, sndMolotov, sndCover, sndUhOh, sndOops, - sndNooo, sndHello, sndRopeShot, sndRopeAttach, sndRopeRelease, - sndSwitchHog, sndVictory, sndSniperReload, sndSteps, sndLowGravity, - sndHellishImpact1, sndHellishImpact2, sndHellishImpact3, sndHellishImpact4, - sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3, sndEggBreak, sndDrillRocket, - sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater, - sndPiano0, sndPiano1, sndPiano2, sndPiano3, sndPiano4, sndPiano5, sndPiano6, sndPiano7, sndPiano8, - sndSkip, sndSineGun, sndOoff1, sndOoff2, sndOoff3, sndWhack, - sndComeonthen, sndParachute, sndBump, sndResurrector); - - TAmmoType = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6 - amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip, // 13 - amBaseballBat, amParachute, amAirAttack, amMineStrike, amBlowTorch, // 18 - amGirder, amTeleport, amSwitch, amMortar, amKamikaze, amCake, // 24 - amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun, // 30 - amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime, // 35 - amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy, amPortalGun, // 42 - amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine, amHammer, // 48 - amResurrector, amDrillStrike); - - TCrateType = (HealthCrate, AmmoCrate, UtilityCrate); - - THWFont = (fnt16, fntBig, fntSmall {$IFNDEF IPHONEOS}, CJKfnt16, CJKfntBig, CJKfntSmall{$ENDIF}); - - TCapGroup = (capgrpGameState, capgrpAmmoinfo, capgrpVolume, - capgrpMessage, capgrpAmmostate); - - TStatInfoType = (siGameResult, siMaxStepDamage, siMaxStepKills, siKilledHHs, - siClanHealth, siTeamStats, siPlayerKills, siMaxTeamDamage, - siMaxTeamKills, siMaxTurnSkips ); - - TWave = (waveRollup, waveSad, waveWave, waveHurrah, waveLemonade, waveShrug, waveJuggle); - - THHFont = record - Handle: PTTF_Font; - Height: LongInt; - style: LongInt; - Name: string[21]; - end; - - PAmmo = ^TAmmo; - TAmmo = record - Propz: LongWord; - Count: LongWord; -(* Using for place hedgehogs mode, but for any other situation where the initial count would be needed I guess. -For example, say, a mode where the weaponset is reset each turn, or on sudden death *) - NumPerTurn: LongWord; - Timer: LongWord; - Pos: LongWord; - AmmoType: TAmmoType; - AttackVoice: TSound; - end; - - TVertex2f = record - X, Y: GLfloat; - end; - - TVertex2i = record - X, Y: GLint; - end; - - PTexture = ^TTexture; - TTexture = record - id: GLuint; - w, h, scale: LongInt; - rx, ry: GLfloat; - priority: GLfloat; - vb, tb: array [0..3] of TVertex2f; - PrevTexture, NextTexture: PTexture; - end; - - THogEffect = (heInvulnerable, heResurrectable, hePoisoned, heResurrected); - - TScreenFade = (sfNone, sfInit, sfToBlack, sfFromBlack, sfToWhite, sfFromWhite); const sfMax = 1000; cDefaultParamNum = 16; @@ -442,1847 +278,7 @@ htHealth = $04; htTransparent = $08; - cHHFileName = 'Hedgehog'; - cCHFileName = 'Crosshair'; - cThemeCFGFilename = 'theme.cfg'; - FontBorder = 2; - cPathz: array[TPathType] of shortstring = ( - '', // ptNone - '', // ptData - 'Graphics', // ptGraphics - 'Themes', // ptThemes - 'Themes/avematan', // ptCurrTheme - 'Teams', // ptTeams - 'Maps', // ptMaps - '', // ptMapCurrent - 'Demos', // ptDemos - 'Sounds', // ptSounds - 'Graphics/Graves', // ptGraves - 'Fonts', // ptFonts - 'Forts', // ptForts - 'Locale', // ptLocale - 'Graphics/AmmoMenu', // ptAmmoMenu - 'Graphics/Hedgehog', // ptHedgehog - 'Sounds/voices', // ptVoices - 'Graphics/Hats', // ptHats - 'Graphics/Flags', // ptFlags - 'Missions/Maps' // ptMissionMaps - ); - - cTagsMasks : array[0..15] of byte = (7, 0, 0, 0, 15, 6, 4, 5, 0, 0, 0, 0, 0, 14, 12, 13); - cTagsMasksNoHealth: array[0..15] of byte = (3, 2, 11, 1, 0, 0, 0, 0, 0, 10, 0, 9, 0, 0, 0, 0); - - Fontz: array[THWFont] of THHFont = ( - (Handle: nil; - Height: 12; - style: TTF_STYLE_NORMAL; - Name: 'DejaVuSans-Bold.ttf'), - (Handle: nil; - Height: 24; - style: TTF_STYLE_NORMAL; - Name: 'DejaVuSans-Bold.ttf'), - (Handle: nil; - Height: 10; - style: TTF_STYLE_NORMAL; - Name: 'DejaVuSans-Bold.ttf') - {$IFNDEF IPHONEOS}, // remove chinese fonts for now - (Handle: nil; - Height: 12; - style: TTF_STYLE_NORMAL; - Name: 'wqy-zenhei.ttc'), - (Handle: nil; - Height: 24; - style: TTF_STYLE_NORMAL; - Name: 'wqy-zenhei.ttc'), - (Handle: nil; - Height: 10; - style: TTF_STYLE_NORMAL; - Name: 'wqy-zenhei.ttc') - {$ENDIF} - ); - - SpritesData: array[TSprite] of record - FileName: String[16]; - Path, AltPath: TPathType; - Texture: PTexture; - Surface: PSDL_Surface; - Width, Height, imageWidth, imageHeight: LongInt; - saveSurf: boolean; - priority: GLfloat; - getDimensions, getImageDimensions: boolean; - end = ( - (FileName: 'BlueWater'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil; - Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: true; getImageDimensions: true),// sprWater - (FileName: 'Clouds'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil; - Width: 256; Height:128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprCloud - (FileName: 'Bomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBomb - (FileName: 'BigDigits'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBigDigit - (FileName: 'Frame'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 4; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprFrame - (FileName: 'Lag'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 65; Height: 65; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprLag - (FileName: 'Arrow'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprCursor - (FileName:'BazookaShell'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBazookaShell - (FileName: 'Targetp'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprTargetP - (FileName: 'Bee'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBee - (FileName: 'SmokeTrace'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprSmokeTrace - (FileName: 'RopeHook'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprRopeHook - (FileName: 'Expl50'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprExplosion50 - (FileName: 'MineOff'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMineOff - (FileName: 'MineOn'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMineOn - (FileName: 'MineDead'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMineDead - (FileName: 'Case'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprCase - (FileName: 'FirstAid'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprFAid - (FileName: 'dynamite'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprDynamite - (FileName: 'Power'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprPower - (FileName: 'ClBomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprClusterBomb - (FileName: 'ClParticle'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprClusterParticle - (FileName: 'Flame'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprFlame - (FileName: 'horizont'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil; - Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprHorizont - (FileName: 'horizontL'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil; - Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprHorizont - (FileName: 'horizontR'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil; - Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprHorizont - (FileName: 'Sky'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil; - Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSky - (FileName: 'SkyL'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil; - Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSky - (FileName: 'SkyR'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil; - Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSky - (FileName: 'BorderHorizontal'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 33; Height: 2; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: true),// sprAMBorderHorizontal - (FileName: 'BorderVertical'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 2; Height: 33; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: true),// sprAMBorderVertical - (FileName: 'Slot'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 33; Height: 33; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMSlot - (FileName: 'Ammos'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMAmmos - (FileName: 'SlotKeys'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMSlotKeys - (FileName: 'Corners'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 2; Height: 2; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMCorners - (FileName: 'Finger'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprFinger - (FileName: 'AirBomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAirBomb - (FileName: 'Airplane'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 254; Height: 101; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAirplane - (FileName: 'amAirplane'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAmAirplane - (FileName: 'amGirder'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 160; Height:160; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAmGirder - (FileName: 'hhMask'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHHTelepMask - (FileName: 'Switch'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSwitch - (FileName: 'Parachute'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprParachute - (FileName: 'Target'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprTarget - (FileName: 'RopeNode'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 6; Height: 6; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprRopeNode - (FileName: 'thinking'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprQuestion - (FileName: 'PowerBar'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 256; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPowerBar - (FileName: 'WindBar'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 151; Height: 17; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWindBar - (FileName: 'WindL'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 80; Height: 13; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWindL - (FileName: 'WindR'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 80; Height: 13; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWindR - (FileName: 'Flake'; Path:ptCurrTheme; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprFlake - (FileName: 'amRope'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandRope - (FileName: 'amBazooka'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandBazooka - (FileName: 'amShotgun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandShotgun - (FileName: 'amDEagle'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandDEagle - (FileName:'amAirAttack'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandAirAttack - (FileName: 'amBaseball'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandBaseball - (FileName: 'Hammer'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPHammer - (FileName: 'amBTorch_i'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandBlowTorch - (FileName: 'amBTorch_w'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBlowTorch - (FileName: 'Teleport'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprTeleport - (FileName: 'HHDeath'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprHHDeath - (FileName:'amShotgun_w'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprShotgun - (FileName: 'amDEagle_w'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprDEagle - (FileName: 'Idle'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprHHIdle - (FileName: 'Mortar'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMortar - (FileName: 'TurnsLeft'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprTurnsLeft - (FileName: 'amKamikaze'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 256; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprKamikaze - (FileName: 'amWhip'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 128; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWhip - (FileName: 'Kowtow'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprKowtow - (FileName: 'Sad'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprSad - (FileName: 'Wave'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprWave - (FileName: 'Hurrah'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprHurrah - (FileName:'ILoveLemonade';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 128; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprLemonade - (FileName: 'Shrug'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprShrug - (FileName: 'Juggle'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprJuggle - (FileName: 'ExplPart'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprExplPart - (FileName: 'ExplPart2'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprExplPart2 - (FileName: 'Cake_walk'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprCakeWalk - (FileName: 'Cake_down'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprCakeDown - (FileName: 'Ammos_bw'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprAMAmmosBW - (FileName: 'Watermelon'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWatermelon - (FileName: 'EvilTrace'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprEvilTrace - (FileName:'HellishBomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHellishBomb - (FileName: 'Seduction'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSeduction - (FileName: 'HHDress'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprDress - (FileName: 'Censored'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprCensored - (FileName: 'Drill'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprDrill - (FileName: 'amDrill'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandDrill - (FileName: 'amBallgun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandBallgun - (FileName: 'Balls'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 20; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprBalls - (FileName: 'RCPlane'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPlane - (FileName: 'amRCPlane'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandPlane - (FileName: 'Utility'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprUtility - (FileName:'Invulnerable';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprInvulnerable - (FileName: 'Vampiric'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprVampiric - (FileName: 'amGirder'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 512; Height:512; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprGirder - (FileName:'SpeechCorner';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 12; Height: 9; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprSpeechCorner - (FileName: 'SpeechEdge'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 25; Height: 9; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprSpeechEdge - (FileName: 'SpeechTail'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 25; Height: 26; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprSpeechTail - (FileName:'ThoughtCorner';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 49; Height: 37; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprThoughtCorner - (FileName:'ThoughtEdge'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 23; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprThoughtEdge - (FileName:'ThoughtTail'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 45; Height: 65; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprThoughtTail - (FileName:'ShoutCorner'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 34; Height: 23; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprShoutCorner - (FileName: 'ShoutEdge'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 30; Height: 20; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprShoutEdge - (FileName: 'ShoutTail'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 30; Height: 37; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprShoutTail - (FileName:'amSniperRifle';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 128; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSniperRifle - (FileName: 'Bubbles'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprBubbles - (FileName: 'amJetpack'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprJetpack - (FileName: 'Health'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprHealth - (FileName: 'amMolotov'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),//sprHandMolotov - (FileName: 'Molotov'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMolotov - (FileName: 'Smoke'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 22; Height: 22; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprSmoke - (FileName: 'SmokeWhite'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 22; Height: 22; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprSmokeWhite - (FileName: 'Shells'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLow; getDimensions: false; getImageDimensions: true),// sprShell - (FileName: 'Dust'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil; - Width: 22; Height: 22; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprDust - (FileName: 'Explosives'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprExplosives - (FileName: 'ExplosivesRoll'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprExplosivesRoll - (FileName: 'amTeleport'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAmTeleport - (FileName: 'Splash'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil; - Width: 80; Height: 50; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSplash - (FileName: 'Droplet'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprDroplet - (FileName: 'Birdy'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 75; Height: 75; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBirdy - (FileName: 'amCake'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandCake - (FileName: 'amConstruction'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandConstruction - (FileName: 'amGrenade'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandGrenade - (FileName: 'amMelon'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandMelon - (FileName: 'amMortar'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandMortar - (FileName: 'amSkip'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandSkip - (FileName: 'amCluster'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandCluster - (FileName: 'amDynamite'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandDynamite - (FileName: 'amHellish'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandHellish - (FileName: 'amMine'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandMine - (FileName: 'amSeduction'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandSeduction - (FileName: 'amVamp'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandVamp - (FileName: 'BigExplosion'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 385; Height: 385; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBigExplosion - (FileName: 'SmokeRing'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 200; Height: 200; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSmokeRing - (FileName: 'BeeTrace'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprBeeTrace - (FileName: 'Egg'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprEgg - (FileName: 'TargetBee'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprTargetBee - (FileName: 'amBee'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandBee - (FileName: 'Feather'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 15; Height: 25; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprFeather - (FileName: 'Piano'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPiano - (FileName: 'amSineGun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandSineGun - (FileName: 'amPortalGun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 128; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPortalGun - (FileName: 'Portal'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPortal - (FileName: 'cheese'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprCheese - (FileName: 'amCheese'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandCheese - (FileName: 'amFlamethrower'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandFlamethrower - (FileName: 'Chunk'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprChunk - (FileName: 'Note'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprNote - (FileName: 'SMineOff'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSMineOff - (FileName: 'SMineOn'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSMineOn - (FileName: 'amSMine'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandSMine - (FileName: 'amHammer'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 128; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true), // sprWhip - (FileName: 'amResurrector'; Path: ptHedgehog; AltPath: ptNone; - Texture: nil; Surface: nil; Width: 32; Height: 32; - imageWidth: 0; imageHeight: 0; saveSurf: false; priority: - tpMedium; getDimensions: false; getImageDimensions: true), - //sprHandResurrector - (FileName: 'Cross'; Path: ptGraphics; altPath: ptNone; - Texture: nil; Surface: nil; Width: 108; Height: 138; - imageWidth: 0; imageHeight: 0; saveSurf: false; priority: - tpMedium; getDimensions: false; getImageDimensions: true), - //sprCross - (FileName: 'AirDrill'; Path: ptGraphics; AltPath: ptNone; - Texture: nil; Surface: nil; Width: 16; Height: 16; - imageWidth: 0; imageHeight: 0; saveSurf: false; priority: - tpMedium; getDimensions: false; getImageDimensions: true), - // sprAirDrill - (FileName: 'NapalmBomb'; Path: ptGraphics; AltPath: ptNone; - Texture: nil; Surface: nil; Width: 16; Height: 16; - imageWidth: 0; imageHeight: 0; saveSurf: false; priority: - tpMedium; getDimensions: false; getImageDimensions: true), - // sprNapalmBomb - (FileName: 'BulletHit'; Path: ptGraphics; AltPath: ptNone; - Texture: nil; Surface: nil; Width: 32; Height: 32; - imageWidth: 0; imageHeight: 0; saveSurf: false; priority: - tpMedium; getDimensions: false; getImageDimensions: true) - // sprNapalmBomb - ); - - - Wavez: array [TWave] of record - Sprite: TSprite; - FramesCount: Longword; - Interval: Longword; - cmd: String[20]; - Voice: TSound; - VoiceDelay: LongWord; - end = ( - (Sprite: sprKowtow; FramesCount: 12; Interval: 125; cmd: '/rollup'; Voice: sndNone; VoiceDelay: 0), - (Sprite: sprSad; FramesCount: 14; Interval: 125; cmd: '/sad'; Voice: sndNone; VoiceDelay: 0), - (Sprite: sprWave; FramesCount: 16; Interval: 125; cmd: '/wave'; Voice: sndHello; VoiceDelay: 5), - (Sprite: sprHurrah; FramesCount: 14; Interval: 125; cmd: '/hurrah'; Voice: sndNone; VoiceDelay: 0), - (Sprite: sprLemonade; FramesCount: 24; Interval: 125; cmd: '/ilovelotsoflemonade'; Voice: sndNone; VoiceDelay: 0), - (Sprite: sprShrug; FramesCount: 24; Interval: 125; cmd: '/shrug'; Voice: sndNone; VoiceDelay: 0), - (Sprite: sprJuggle; FramesCount: 49; Interval: 38; cmd: '/juggle'; Voice: sndNone; VoiceDelay: 0) - ); - - Soundz: array[TSound] of record - FileName: String[25]; - Path : TPathType; - end = ( - (FileName: ''; Path: ptNone ),// sndNone - (FileName: 'grenadeimpact.ogg'; Path: ptSounds),// sndGrenadeImpact - (FileName: 'explosion.ogg'; Path: ptSounds),// sndExplosion - (FileName: 'throwpowerup.ogg'; Path: ptSounds),// sndThrowPowerUp - (FileName: 'throwrelease.ogg'; Path: ptSounds),// sndThrowRelease - (FileName: 'splash.ogg'; Path: ptSounds),// sndSplash - (FileName: 'shotgunreload.ogg'; Path: ptSounds),// sndShotgunReload - (FileName: 'shotgunfire.ogg'; Path: ptSounds),// sndShotgunFire - (FileName: 'graveimpact.ogg'; Path: ptSounds),// sndGraveImpact - (FileName: 'minetick.ogg'; Path: ptSounds),// sndMineTicks - (FileName: 'pickhammer.ogg'; Path: ptSounds),// sndPickhammer - (FileName: 'gun.ogg'; Path: ptSounds),// sndGun - (FileName: 'bee.ogg'; Path: ptSounds),// sndBee - (FileName: 'Jump1.ogg'; Path: ptVoices),// sndJump1 - (FileName: 'Jump2.ogg'; Path: ptVoices),// sndJump2 - (FileName: 'Jump3.ogg'; Path: ptVoices),// sndJump3 - (FileName: 'Yessir.ogg'; Path: ptVoices),// sndYesSir - (FileName: 'Laugh.ogg'; Path: ptVoices),// sndLaugh - (FileName: 'Illgetyou.ogg'; Path: ptVoices),// sndIllGetYou - (FileName: 'Incoming.ogg'; Path: ptVoices),// sndIncoming - (FileName: 'Missed.ogg'; Path: ptVoices),// sndMissed - (FileName: 'Stupid.ogg'; Path: ptVoices),// sndStupid - (FileName: 'Firstblood.ogg'; Path: ptVoices),// sndFirstBlood - (FileName: 'Boring.ogg'; Path: ptVoices),// sndBoring - (FileName: 'Byebye.ogg'; Path: ptVoices),// sndByeBye - (FileName: 'Sameteam.ogg'; Path: ptVoices),// sndSameTeam - (FileName: 'Nutter.ogg'; Path: ptVoices),// sndNutter - (FileName: 'Reinforcements.ogg'; Path: ptVoices),// sndReinforce - (FileName: 'Traitor.ogg'; Path: ptVoices),// sndTraitor - (FileName: 'Youllregretthat.ogg'; Path: ptVoices),// sndRegret - (FileName: 'Enemydown.ogg'; Path: ptVoices),// sndEnemyDown - (FileName: 'Coward.ogg'; Path: ptVoices),// sndCoward - (FileName: 'Hurry.ogg'; Path: ptVoices),// sndHurry - (FileName: 'Watchit.ogg'; Path: ptVoices),// sndWatchIt - (FileName: 'Kamikaze.ogg'; Path: ptVoices),// sndKamikaze - (FileName: 'cake2.ogg'; Path: ptSounds),// sndCake - (FileName: 'Ow1.ogg'; Path: ptVoices),// sndOw1 - (FileName: 'Ow2.ogg'; Path: ptVoices),// sndOw2 - (FileName: 'Ow3.ogg'; Path: ptVoices),// sndOw3 - (FileName: 'Ow4.ogg'; Path: ptVoices),// sndOw4 - (FileName: 'Firepunch1.ogg'; Path: ptVoices),// sndFirepunch1 - (FileName: 'Firepunch2.ogg'; Path: ptVoices),// sndFirepunch2 - (FileName: 'Firepunch3.ogg'; Path: ptVoices),// sndFirepunch3 - (FileName: 'Firepunch4.ogg'; Path: ptVoices),// sndFirepunch4 - (FileName: 'Firepunch5.ogg'; Path: ptVoices),// sndFirepunch5 - (FileName: 'Firepunch6.ogg'; Path: ptVoices),// sndFirepunch6 - (FileName: 'Melon.ogg'; Path: ptVoices),// sndMelon - (FileName: 'Hellish.ogg'; Path: ptSounds),// sndHellish - (FileName: 'Yoohoo.ogg'; Path: ptSounds),// sndYoohoo - (FileName: 'rcplane.ogg'; Path: ptSounds),// sndRCPlane - (FileName: 'whipcrack.ogg'; Path: ptSounds),// sndWhipCrack - (FileName:'ride_of_the_valkyries.ogg'; Path: ptSounds),// sndRideOfTheValkyries - (FileName: 'denied.ogg'; Path: ptSounds),// sndDenied - (FileName: 'placed.ogg'; Path: ptSounds),// sndPlaced - (FileName: 'baseballbat.ogg'; Path: ptSounds),// sndBaseballBat - (FileName: 'steam.ogg'; Path: ptSounds),// sndVaporize - (FileName: 'warp.ogg'; Path: ptSounds),// sndWarp - (FileName: 'suddendeath.ogg'; Path: ptSounds),// sndSuddenDeath - (FileName: 'mortar.ogg'; Path: ptSounds),// sndMortar - (FileName: 'shutterclick.ogg'; Path: ptSounds),// sndShutter - (FileName: 'homerun.ogg'; Path: ptSounds),// sndHomerun - (FileName: 'molotov.ogg'; Path: ptSounds),// sndMolotov - (FileName: 'Takecover.ogg'; Path: ptVoices),// sndCover - (FileName: 'Uh-oh.ogg'; Path: ptVoices),// sndUhOh - (FileName: 'Oops.ogg'; Path: ptVoices),// sndOops - (FileName: 'Nooo.ogg'; Path: ptVoices),// sndNooo - (FileName: 'Hello.ogg'; Path: ptVoices),// sndHello - (FileName: 'ropeshot.ogg'; Path: ptSounds),// sndRopeShot - (FileName: 'ropeattach.ogg'; Path: ptSounds),// sndRopeAttach - (FileName: 'roperelease.ogg'; Path: ptSounds),// sndRopeRelease - (FileName: 'switchhog.ogg'; Path: ptSounds),// sndSwitchHog - (FileName: 'victory.ogg'; Path: ptVoices),// sndVictory - (FileName: 'sniperreload.ogg'; Path: ptSounds),// sndSniperReload - (FileName: 'steps.ogg'; Path: ptSounds),// sndSteps - (FileName: 'lowgravity.ogg'; Path: ptSounds),// sndLowGravity - (FileName: 'hell_growl.ogg'; Path: ptSounds),// sndHellishImpact1 - (FileName: 'hell_ooff.ogg'; Path: ptSounds),// sndHellishImpact2 - (FileName: 'hell_ow.ogg'; Path: ptSounds),// sndHellishImpact3 - (FileName: 'hell_ugh.ogg'; Path: ptSounds),// sndHellishImpact4 - (FileName: 'melonimpact.ogg'; Path: ptSounds),// sndMelonImpact - (FileName: 'Droplet1.ogg'; Path: ptSounds),// sndDroplet1 - (FileName: 'Droplet2.ogg'; Path: ptSounds),// sndDroplet2 - (FileName: 'Droplet3.ogg'; Path: ptSounds),// sndDroplet3 - (FileName: 'egg.ogg'; Path: ptSounds),// sndEggBreak - (FileName: 'drillgun.ogg'; Path: ptSounds),// sndDrillRocket - (FileName: 'PoisonCough.ogg'; Path: ptVoices),// sndPoisonCough - (FileName: 'PoisonMoan.ogg'; Path: ptVoices),// sndPoisonMoan - (FileName: 'BirdyLay.ogg'; Path: ptSounds),// sndBirdyLay - (FileName: 'Whistle.ogg'; Path: ptSounds),// sndWhistle - (FileName: 'beewater.ogg'; Path: ptSounds),// sndBeeWater - (FileName: '1C.ogg'; Path: ptSounds),// sndPiano0 - (FileName: '2D.ogg'; Path: ptSounds),// sndPiano1 - (FileName: '3E.ogg'; Path: ptSounds),// sndPiano2 - (FileName: '4F.ogg'; Path: ptSounds),// sndPiano3 - (FileName: '5G.ogg'; Path: ptSounds),// sndPiano4 - (FileName: '6A.ogg'; Path: ptSounds),// sndPiano5 - (FileName: '7B.ogg'; Path: ptSounds),// sndPiano6 - (FileName: '8C.ogg'; Path: ptSounds),// sndPiano7 - (FileName: '9D.ogg'; Path: ptSounds),// sndPiano8 - (FileName: 'skip.ogg'; Path: ptSounds),// sndSkip - (FileName: 'shotgunfire.ogg'; Path: ptSounds),// sndSineGun - (FileName: 'Ooff1.ogg'; Path: ptVoices),// sndOoff1 - (FileName: 'Ooff2.ogg'; Path: ptVoices),// sndOoff2 - (FileName: 'Ooff3.ogg'; Path: ptVoices),// sndOoff3 - (FileName: 'whipcrack.ogg'; Path: ptSounds),// sndWhack - (FileName: 'Comeonthen.ogg'; Path: ptVoices),// sndComeonthen - (FileName: 'parachute.ogg'; Path: ptSounds),// sndParachute - (FileName: 'bump.ogg'; Path: ptSounds),// sndBump - (FileName: 'hogchant3.ogg'; Path: ptSounds) // sndResurrector - ); - - Ammoz: array [TAmmoType] of record - NameId: TAmmoStrId; - NameTex: PTexture; - Probability, NumberInCase: Longword; - Ammo: TAmmo; - Slot: 0..cMaxSlotIndex; - TimeAfterTurn: Longword; - minAngle, maxAngle: Longword; - isDamaging: boolean; - SkipTurns: Longword; - PosCount: Longword; - PosSprite: TSprite; - ejectX, ejectY: Longint; - end = ( - (NameId: sidNothing; - NameTex: nil; - Probability: 0; - NumberInCase: 0; - Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold or ammoprop_Effect; - Count: AMMO_INFINITE; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amNothing; - AttackVoice: sndNone); - Slot: 0; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 9999; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Grenade - (NameId: sidGrenade; - NameTex: nil; - Probability: 0; - NumberInCase: 1; - Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse; - Count: AMMO_INFINITE; - NumPerTurn: 0; - Timer: 3000; - Pos: 0; - AmmoType: amGrenade; - AttackVoice: sndCover); - Slot: 1; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// ClusterBomb - (NameId: sidClusterBomb; - NameTex: nil; - Probability: 100; - NumberInCase: 3; - Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse; - Count: 5; - NumPerTurn: 0; - Timer: 3000; - Pos: 0; - AmmoType: amClusterBomb; - AttackVoice: sndCover); - Slot: 1; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Bazooka - (NameId: sidBazooka; - NameTex: nil; - Probability: 0; - NumberInCase: 1; - Ammo: (Propz: ammoprop_Power or ammoprop_AltUse; - Count: AMMO_INFINITE; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amBazooka; - AttackVoice: sndNone); - Slot: 0; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; //20; - ejectY: -6), - -// Bee - (NameId: sidBee; - NameTex: nil; - Probability: 100; - NumberInCase: 1; - Ammo: (Propz: ammoprop_Power or ammoprop_NeedTarget or ammoprop_DontHold; - Count: 2; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amBee; - AttackVoice: sndNone); - Slot: 0; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; //16; - ejectY: 0), - -// Shotgun - (NameId: sidShotgun; - NameTex: nil; - Probability: 0; - NumberInCase: 1; - Ammo: (Propz: ammoprop_ForwMsgs; - Count: AMMO_INFINITE; - NumPerTurn: 1; - Timer: 0; - Pos: 0; - AmmoType: amShotgun; - AttackVoice: sndNone); - Slot: 2; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; //26; - ejectY: -6), - -// PickHammer - (NameId: sidPickHammer; - NameTex: nil; - Probability: 0; - NumberInCase: 1; - Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInMove or ammoprop_NoCrosshair or ammoprop_DontHold; - Count: 2; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amPickHammer; - AttackVoice: sndNone); - Slot: 6; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Skip - (NameId: sidSkip; - NameTex: nil; - Probability: 0; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold; - Count: AMMO_INFINITE; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amSkip; - AttackVoice: sndNone); - Slot: 9; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Rope - (NameId: sidRope; - NameTex: nil; - Probability: 100; - NumberInCase: 3; - Ammo: (Propz: ammoprop_NoRoundEnd or - ammoprop_ForwMsgs or - ammoprop_AttackInMove or - ammoprop_Utility or - ammoprop_AltAttack; - Count: 5; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amRope; - AttackVoice: sndNone); - Slot: 7; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: cMaxAngle div 2; - isDamaging: false; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Mine - (NameId: sidMine; - NameTex: nil; - Probability: 100; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInMove or ammoprop_DontHold or ammoprop_AltUse; - Count: 2; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amMine; - AttackVoice: sndLaugh); - Slot: 4; - TimeAfterTurn: 5000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// DEagle - (NameId: sidDEagle; - NameTex: nil; - Probability: 20; - NumberInCase: 2; - Ammo: (Propz: 0; - Count: 3; - NumPerTurn: 3; - Timer: 0; - Pos: 0; - AmmoType: amDEagle; - AttackVoice: sndNone); - Slot: 2; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; //23; - ejectY: -6), - -// Dynamite - (NameId: sidDynamite; - NameTex: nil; - Probability: 100; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInMove or ammoprop_DontHold or ammoprop_AltUse; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amDynamite; - AttackVoice: sndLaugh); - Slot: 4; - TimeAfterTurn: 5000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// FirePunch - (NameId: sidFirePunch; - NameTex: nil; - Probability: 0; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_ForwMsgs or ammoprop_AttackInMove; - Count: AMMO_INFINITE; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amFirePunch; - AttackVoice: sndNone); - Slot: 3; - TimeAfterTurn: 3000; - MinAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Whip - (NameId: sidWhip; - NameTex: nil; - Probability: 0; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoCrosshair; - Count: AMMO_INFINITE; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amWhip; - AttackVoice: sndNone); - Slot: 3; - TimeAfterTurn: 3000; - MinAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// BaseballBat - (NameId: sidBaseballBat; - NameTex: nil; - Probability: 100; - NumberInCase: 1; - Ammo: (Propz: ammoprop_DontHold; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amBaseballBat; - AttackVoice: sndNone); - Slot: 3; - TimeAfterTurn: 5000; - minAngle: 0; - maxAngle: cMaxAngle div 2; - isDamaging: true; - SkipTurns: 2; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Parachute - (NameId: sidParachute; - NameTex: nil; - Probability: 100; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoRoundEnd or - ammoprop_ForwMsgs or - ammoprop_AttackInMove or - ammoprop_NoCrosshair or - ammoprop_DontHold or - ammoprop_Utility or - ammoprop_AltAttack; - Count: 2; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amParachute; - AttackVoice: sndNone); - Slot: 7; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// AirAttack - (NameId: sidAirAttack; - NameTex: nil; - Probability: 100; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoCrosshair or - ammoprop_NeedTarget or - ammoprop_AttackingPut or - ammoprop_DontHold or - ammoprop_NotBorder; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amAirAttack; - AttackVoice: sndIncoming); - Slot: 5; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 5; - PosCount: 2; - PosSprite: sprAmAirplane; - ejectX: 0; - ejectY: 0), - -// MineStrike - (NameId: sidMineStrike; - NameTex: nil; - Probability: 200; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoCrosshair or - ammoprop_NeedTarget or - ammoprop_AttackingPut or - ammoprop_DontHold or - ammoprop_NotBorder; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amMineStrike; - AttackVoice: sndIncoming); - Slot: 5; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 5; - PosCount: 2; - PosSprite: sprAmAirplane; - ejectX: 0; - ejectY: 0), - -// BlowTorch - (NameId: sidBlowTorch; - NameTex: nil; - Probability: 100; - NumberInCase: 2; - Ammo: (Propz: ammoprop_ForwMsgs; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amBlowTorch; - AttackVoice: sndNone); - Slot: 6; - TimeAfterTurn: 3000; - minAngle: 768; - maxAngle: 1280; - isDamaging: false; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Girder - (NameId: sidGirder; - NameTex: nil; - Probability: 150; - NumberInCase: 3; - Ammo: (Propz: ammoprop_NoRoundEnd or - ammoprop_NoCrosshair or - ammoprop_NeedTarget or - ammoprop_Utility or - ammoprop_AttackingPut; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amGirder; - AttackVoice: sndNone); - Slot: 6; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 0; - PosCount: 8; - PosSprite: sprAmGirder; - ejectX: 0; - ejectY: 0), - -// Teleport - (NameId: sidTeleport; - NameTex: nil; - Probability: 200; - NumberInCase: 1; - Ammo: (Propz: ammoprop_ForwMsgs or - ammoprop_NoCrosshair or - ammoprop_NeedTarget or - ammoprop_AttackingPut or - ammoprop_Utility or - ammoprop_DontHold; - Count: 2; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amTeleport; - AttackVoice: sndNone); - Slot: 7; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 0; - PosCount: 2; - PosSprite: sprAmTeleport; - ejectX: 0; - ejectY: 0), - -// Switch - (NameId: sidSwitch; - NameTex: nil; - Probability: 100; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoRoundEnd or - ammoprop_ForwMsgs or - ammoprop_NoCrosshair or - ammoprop_Utility or - ammoprop_DontHold; - Count: 3; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amSwitch; - AttackVoice: sndNone); - Slot: 9; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Mortar - (NameId: sidMortar; - NameTex: nil; - Probability: 100; - NumberInCase: 4; - Ammo: (Propz: 0; - Count: 4; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amMortar; - AttackVoice: sndNone); - Slot: 0; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; //20; - ejectY: -6), - -// Kamikaze - (NameId: sidKamikaze; - NameTex: nil; - Probability: 100; - NumberInCase: 1; - Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold or ammoprop_AttackInMove; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amKamikaze; - AttackVoice: sndNone); - Slot: 3; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Cake - (NameId: sidCake; - NameTex: nil; - Probability: 100; - NumberInCase: 1; - Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_NoCrosshair or ammoprop_DontHold; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amCake; - AttackVoice: sndLaugh); - Slot: 4; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 4; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Seduction - (NameId: sidSeduction; - NameTex: nil; - Probability: 100; - NumberInCase: 1; - Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amSeduction; - AttackVoice: sndNone); - Slot: 3; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Watermelon - (NameId: sidWatermelon; - NameTex: nil; - Probability: 400; - NumberInCase: 1; - Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse; - Count: 0; - NumPerTurn: 0; - Timer: 3000; - Pos: 0; - AmmoType: amWatermelon; - AttackVoice: sndMelon); - Slot: 1; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// HellishBomb ("Hellish Hand-Grenade") - (NameId: sidHellishBomb; - NameTex: nil; - Probability: 400; - NumberInCase: 1; - Ammo: (Propz: ammoprop_Power or ammoprop_AltUse; - Count: 0; - NumPerTurn: 0; - Timer: 5000; - Pos: 0; - AmmoType: amHellishBomb; - AttackVoice: sndNone); - Slot: 1; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Napalm - (NameId: sidNapalm; - NameTex: nil; - Probability: 100; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoCrosshair or - ammoprop_NeedTarget or - ammoprop_AttackingPut or - ammoprop_DontHold or - ammoprop_NotBorder; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amNapalm; - AttackVoice: sndIncoming); - Slot: 5; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 7; - PosCount: 2; - PosSprite: sprAmAirplane; - ejectX: 0; - ejectY: 0), - -// Drill ("Drill Rocket") - (NameId: sidDrill; - NameTex: nil; - Probability: 300; - NumberInCase: 1; - Ammo: (Propz: ammoprop_Power or ammoprop_AltUse; - Count: AMMO_INFINITE; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amDrill; - AttackVoice: sndNone); - Slot: 0; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprDrill; - ejectX: 0; //20; - ejectY: -6), - -// Ballgun - (NameId: sidBallgun; - NameTex: nil; - Probability: 400; - NumberInCase: 1; - Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold; - Count: AMMO_INFINITE; - NumPerTurn: 0; - Timer: 5001; - Pos: 0; - AmmoType: amBallgun; - AttackVoice: sndNone); - Slot: 4; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; //20; - ejectY: -3), - -// RC-Plane - (NameId: sidRCPlane; - NameTex: nil; - Probability: 200; - NumberInCase: 1; - Ammo: (Propz: ammoprop_ForwMsgs{ or - ammoprop_DontHold or - ammoprop_AltAttack}; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amRCPlane; - AttackVoice: sndNone); - Slot: 4; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 4; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// LowGravity - (NameId: sidLowGravity; - NameTex: nil; - Probability: 20; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoRoundEnd or - ammoprop_NoCrosshair or - ammoprop_DontHold or - ammoprop_AltUse or - ammoprop_Utility or - ammoprop_Effect; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amLowGravity; - AttackVoice: sndNone); - Slot: 9; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// ExtraDamage - (NameId: sidExtraDamage; - NameTex: nil; - Probability: 15; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoRoundEnd or - ammoprop_NoCrosshair or - ammoprop_DontHold or - ammoprop_AltUse or - ammoprop_Utility or - ammoprop_Effect; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amExtraDamage; - AttackVoice: sndNone); - Slot: 9; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Invulnerable - (NameId: sidInvulnerable; - NameTex: nil; - Probability: 20; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoRoundEnd or - ammoprop_NoCrosshair or - ammoprop_DontHold or - ammoprop_AltUse or - ammoprop_Utility or - ammoprop_Effect; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amInvulnerable; - AttackVoice: sndNone); - Slot: 8; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// ExtraTime - (NameId: sidExtraTime; - NameTex: nil; - Probability: 30; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoRoundEnd or - ammoprop_NoCrosshair or - ammoprop_DontHold or - ammoprop_AltUse or - ammoprop_Utility or - ammoprop_Effect; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amExtraTime; - AttackVoice: sndNone); - Slot: 9; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// LaserSight - (NameId: sidLaserSight; - NameTex: nil; - Probability: 15; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoRoundEnd or - ammoprop_NoCrosshair or - ammoprop_DontHold or - ammoprop_AltUse or - ammoprop_Utility or - ammoprop_Effect; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amLaserSight; - AttackVoice: sndNone); - Slot: 8; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Vampiric - (NameId: sidVampiric; - NameTex: nil; - Probability: 15; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoRoundEnd or - ammoprop_NoCrosshair or - ammoprop_DontHold or - ammoprop_AltUse or - ammoprop_Utility or - ammoprop_Effect; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amVampiric; - AttackVoice: sndNone); - Slot: 8; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// SniperRifle - (NameId: sidSniperRifle; - NameTex: nil; - Probability: 20; - NumberInCase: 2; - Ammo: (Propz: 0; - Count: 2; - NumPerTurn: 1; - Timer: 0; - Pos: 0; - AmmoType: amSniperRifle; - AttackVoice: sndNone); - Slot: 2; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; //40; - ejectY: -5), - -// Jetpack ("Flying Saucer") - (NameId: sidJetpack; - NameTex: nil; - Probability: 20; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoRoundEnd or - ammoprop_ForwMsgs or - ammoprop_AttackInMove or - ammoprop_NoCrosshair or - ammoprop_DontHold or - ammoprop_Utility or - ammoprop_AltAttack; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amJetpack; - AttackVoice: sndNone); - Slot: 7; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Molotov - (NameId: sidMolotov; - NameTex: nil; - Probability: 0; - NumberInCase: 1; - Ammo: (Propz: ammoprop_Power or ammoprop_AltUse; - Count: AMMO_INFINITE; - NumPerTurn: 0; - Timer: 3000; - Pos: 0; - AmmoType: amMolotov; - AttackVoice: sndNone); - Slot: 1; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Birdy - (NameId: sidBirdy; - NameTex: nil; - Probability: 20; - NumberInCase: 1; - Ammo: (Propz: ammoprop_ForwMsgs or - ammoprop_NoCrosshair or - ammoprop_DontHold; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amBirdy; - AttackVoice: sndNone); - Slot: 7; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// PortalGun - (NameId: sidPortalGun; - NameTex: nil; - Probability: 20; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoRoundEnd or - ammoprop_AttackInMove or - ammoprop_DontHold or - ammoprop_Utility; - Count: 1; - NumPerTurn: 3; - Timer: 0; - Pos: 0; - AmmoType: amPortalGun; - AttackVoice: sndNone); - Slot: 6; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: false; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: -5; //29; - ejectY: -7), - -// Piano - (NameId: sidPiano; - NameTex: nil; - Probability: 100; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoCrosshair or - ammoprop_NeedTarget or - ammoprop_AttackingPut or - ammoprop_DontHold or - ammoprop_NotBorder; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amPiano; - AttackVoice: sndIncoming); - Slot: 5; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 7; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// GasBomb - (NameId: sidGasBomb; - NameTex: nil; - Probability: 0; - NumberInCase: 1; - Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse; - Count: AMMO_INFINITE; - NumPerTurn: 0; - Timer: 3000; - Pos: 0; - AmmoType: amGasBomb; - AttackVoice: sndCover); - Slot: 1; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// SineGun - (NameId: sidSineGun; - NameTex: nil; - Probability: 20; - NumberInCase: 2; - Ammo: (Propz: ammoprop_AttackInMove; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amSineGun; - AttackVoice: sndNone); - Slot: 2; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Flamethrower - (NameId: sidFlamethrower; - NameTex: nil; - Probability: 20; - NumberInCase: 1; - Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold; - Count: 1; - NumPerTurn: 0; - Timer: 5001; - Pos: 0; - AmmoType: amFlamethrower; - AttackVoice: sndNone); - Slot: 2; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; //20; - ejectY: -3), - -// Sticky Mine - (NameId: sidSMine; - NameTex: nil; - Probability: 100; - NumberInCase: 1; - Ammo: (Propz: ammoprop_Power; //FIXME: enable multishoot at altuse, until then removed ammoprop_AltUse - Count: 1; - NumPerTurn: 1; - Timer: 0; - Pos: 0; - AmmoType: amSMine; - AttackVoice: sndLaugh); - Slot: 4; - TimeAfterTurn: 5000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Hammer - (NameId: sidHammer; - NameTex: nil; - Probability: 0; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoCrosshair; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amHammer; - AttackVoice: sndNone); - Slot: 3; - TimeAfterTurn: 1000; - MinAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// Ressurrector - (NameId: sidResurrector; - NameTex: nil; - Probability: 0; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoCrosshair or - ammoprop_Utility or - ammoprop_NoRoundEnd; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amResurrector; - AttackVoice: sndNone); - Slot: 8; - TimeAfterTurn: 3000; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 0; - PosCount: 1; - PosSprite: sprWater; - ejectX: 0; - ejectY: 0), - -// DrillStrike - (NameId: sidDrillStrike; - NameTex: nil; - Probability: 200; - NumberInCase: 1; - Ammo: (Propz: ammoprop_NoCrosshair or - ammoprop_NeedTarget or - ammoprop_AttackingPut or - ammoprop_DontHold or - ammoprop_NotBorder; - Count: 1; - NumPerTurn: 0; - Timer: 0; - Pos: 0; - AmmoType: amDrillStrike; - AttackVoice: sndIncoming); - Slot: 5; - TimeAfterTurn: 0; - minAngle: 0; - maxAngle: 0; - isDamaging: true; - SkipTurns: 6; - PosCount: 2; - PosSprite: sprAmAirplane; - ejectX: 0; - ejectY: 0) - ); - - - - conversionFormat: TSDL_PixelFormat = ( - palette: nil; - BitsPerPixel : 32; - BytesPerPixel: 4; - Rloss : 0; - Gloss : 0; - Bloss : 0; - Aloss : 0; -{$IFDEF ENDIAN_LITTLE} - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; -{$ELSE} - Rshift: 24; - Gshift: 16; - Bshift: 8; - Ashift: 0; -{$ENDIF} - RMask : RMask; - GMask : GMask; - BMask : BMask; - AMask : AMask; - colorkey: 0; - alpha : 255 - ); implementation diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uFloat.pas --- a/hedgewars/uFloat.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uFloat.pas Thu Nov 18 16:58:08 2010 -0500 @@ -62,6 +62,7 @@ function AngleSin(const Angle: Longword): hwFloat; function AngleCos(const Angle: Longword): hwFloat; function SignAs(const num, signum: hwFloat): hwFloat; inline; +function hwSign(r: hwFloat): LongInt; inline; {$IFDEF FPC} {$J-} @@ -342,6 +343,12 @@ SignAs.isNegative:= signum.isNegative end; +function hwSign(r: hwFloat): LongInt; +begin +// yes, we have negative zero for a reason +if r.isNegative then hwSign:= -1 else hwSign:= 1 +end; + {$INCLUDE "SinTable.inc"} function AngleSin(const Angle: Longword): hwFloat; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uGame.pas --- a/hedgewars/uGame.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uGame.pas Thu Nov 18 16:58:08 2010 -0500 @@ -26,7 +26,7 @@ //////////////////// implementation //////////////////// -uses uMisc, uConsts, uKeys, uTeams, uIO, uAI, uGears, uScript, uSound, uMobile, uVisualGears; +uses uKeys, uTeams, uIO, uAI, uGears, uScript, uSound, uMobile, uVisualGears, uTypes, uVariables; procedure DoGameTick(Lag: LongInt); var i: LongInt; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uGears.pas --- a/hedgewars/uGears.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uGears.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,63 +20,7 @@ unit uGears; interface -uses SDLh, uConsts, uFloat, Math; - - -type - PGear = ^TGear; - TGearStepProcedure = procedure (Gear: PGear); - TGear = record - NextGear, PrevGear: PGear; - Active: Boolean; - AdvBounce: Longword; - Invulnerable: Boolean; - RenderTimer: Boolean; - AmmoType : TAmmoType; - State : Longword; - X : hwFloat; - Y : hwFloat; - dX: hwFloat; - dY: hwFloat; - Kind: TGearType; - Pos: Longword; - doStep: TGearStepProcedure; - Radius: LongInt; - Angle, Power : Longword; - DirAngle: real; - Timer : LongWord; - Elasticity: hwFloat; - Friction : hwFloat; - Message, MsgParam : Longword; - Hedgehog: pointer; - Health, Damage, Karma: LongInt; - CollisionIndex: LongInt; - Tag: LongInt; - Tex: PTexture; - Z: Longword; - IntersectGear: PGear; - FlightTime: Longword; - uid: Longword; - ImpactSound: TSound; // first sound, others have to be after it in the sounds def. - nImpactSounds: Word; // count of ImpactSounds - SoundChannel: LongInt; - PortalCounter: LongWord // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion. - end; - TPGearArray = Array of PGear; - -var AllInactive: boolean; - PrvInactive: boolean; - CurAmmoGear: PGear; - GearsList: PGear; - KilledHHs: Longword; - SuddenDeathDmg: Boolean; - SpeechType: Longword; - SpeechText: shortstring; - TrainingTargetGear: PGear; - skipFlag: boolean; - PlacingHogs: boolean; // a convenience flag to indicate placement of hogs is still in progress - StepSoundTimer: LongInt; - StepSoundChannel: LongInt; +uses SDLh, uConsts, uFloat, Math, uTypes; procedure initModule; procedure freeModule; @@ -101,8 +45,9 @@ function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt; implementation -uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uLand, uIO, uLandGraphics, - uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile; +uses uWorld, uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics, + uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables, + uCommands, uUtils, uTextures, uRender, uRenderUtils; const MAXROPEPOINTS = 384; var RopePoints: record @@ -253,7 +198,7 @@ begin tag:= AddVisualGear(hwRound(HHGear^.X), hwRound(HHGear^.Y), vgtHealthTag, dmg); if (tag <> nil) then - tag^.Hedgehog:= PHedgehog(HHGear^.Hedgehog); // the tag needs the tag to determine the text color + tag^.Hedgehog:= HHGear^.Hedgehog; // the tag needs the tag to determine the text color AllInactive:= false; HHGear^.Active:= true; end; @@ -323,8 +268,8 @@ gear^.Angle:= cMaxAngle div 2; gear^.Z:= cHHZ; if (GameFlags and gfAISurvival) <> 0 then - if PHedgehog(gear^.Hedgehog)^.BotLevel > 0 then - PHedgehog(gear^.Hedgehog)^.Effects[heResurrectable] := true; + if gear^.Hedgehog^.BotLevel > 0 then + gear^.Hedgehog^.Effects[heResurrectable] := true; end; gtShell: begin gear^.Radius:= 4; @@ -599,12 +544,12 @@ uStats.HedgehogDamaged(Gear) end; - team:= PHedgehog(Gear^.Hedgehog)^.Team; + team:= Gear^.Hedgehog^.Team; if CurrentHedgehog^.Gear = Gear then FreeActionsList; // to avoid ThinkThread on drawned gear - PHedgehog(Gear^.Hedgehog)^.Gear:= nil; - if PHedgehog(Gear^.Hedgehog)^.King then + Gear^.Hedgehog^.Gear:= nil; + if Gear^.Hedgehog^.King then begin // are there any other kings left? Just doing nil check. Presumably a mortally wounded king will get reaped soon enough k:= false; @@ -655,17 +600,17 @@ else dec(Gear^.Health, dmg); - if (PHedgehog(Gear^.Hedgehog)^.Team = CurrentTeam) and + if (Gear^.Hedgehog^.Team = CurrentTeam) and (Gear^.Damage <> Gear^.Karma) and - not PHedgehog(Gear^.Hedgehog)^.King and - not PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] and + not Gear^.Hedgehog^.King and + not Gear^.Hedgehog^.Effects[hePoisoned] and not SuddenDeathDmg then Gear^.State:= Gear^.State or gstLoser; spawnHealthTagForHH(Gear, dmg); - RenderHealth(PHedgehog(Gear^.Hedgehog)^); - RecountTeamHealth(PHedgehog(Gear^.Hedgehog)^.Team); + RenderHealth(Gear^.Hedgehog^); + RecountTeamHealth(Gear^.Hedgehog^.Team); end; if (not isInMultiShoot) then Gear^.Karma:= 0; @@ -689,20 +634,20 @@ if Gear^.Kind = gtHedgehog then begin tmp:= 0; - if PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] then + if Gear^.Hedgehog^.Effects[hePoisoned] then begin inc(tmp, ModifyDamage(5, Gear)); - if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth) // does not need a minimum check since <= 1 basically disables it + if (GameFlags and gfResetHealth) <> 0 then dec(Gear^.Hedgehog^.InitialHealth) // does not need a minimum check since <= 1 basically disables it end; if (TotalRounds > cSuddenDTurns - 1) then begin inc(tmp, cHealthDecrease); - if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth, cHealthDecrease) + if (GameFlags and gfResetHealth) <> 0 then dec(Gear^.Hedgehog^.InitialHealth, cHealthDecrease) end; - if PHedgehog(Gear^.Hedgehog)^.King then + if Gear^.Hedgehog^.King then begin flag:= false; - team:= PHedgehog(Gear^.Hedgehog)^.Team; + team:= Gear^.Hedgehog^.Team; for i:= 0 to Pred(team^.HedgehogsNumber) do if (team^.Hedgehogs[i].Gear <> nil) and (not team^.Hedgehogs[i].King) and @@ -711,7 +656,7 @@ if not flag then begin inc(tmp, 5); - if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth, 5) + if (GameFlags and gfResetHealth) <> 0 then dec(Gear^.Hedgehog^.InitialHealth, 5) end end; if tmp > 0 then @@ -985,10 +930,10 @@ while t <> nil do begin t^.PortalCounter:= 0; - if ((GameFlags and gfResetHealth) <> 0) and (t^.Kind = gtHedgehog) and (t^.Health < PHedgehog(t^.Hedgehog)^.InitialHealth) then + if ((GameFlags and gfResetHealth) <> 0) and (t^.Kind = gtHedgehog) and (t^.Health < t^.Hedgehog^.InitialHealth) then begin - t^.Health:= PHedgehog(t^.Hedgehog)^.InitialHealth; - RenderHealth(PHedgehog(t^.Hedgehog)^); + t^.Health:= t^.Hedgehog^.InitialHealth; + RenderHealth(t^.Hedgehog^); end; t:= t^.NextGear end; @@ -1009,7 +954,7 @@ if (Gear^.Kind = gtHedgehog) and (Damage>=1) then begin HHHurt(Gear^.Hedgehog, Source); - AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color); + AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color); tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage)); if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (tmpDmg >= 1) then begin @@ -1074,7 +1019,7 @@ procedure DrawAltWeapon(Gear: PGear; sx, sy: LongInt); begin -with PHedgehog(Gear^.Hedgehog)^ do +with Gear^.Hedgehog^ do begin if not (((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and ((Gear^.State and gstAttacked) = 0)) then exit; @@ -1089,8 +1034,8 @@ begin rounded[Count].X:= hwRound(Gear^.X); rounded[Count].Y:= hwRound(Gear^.Y); - rounded[Count + 1].X:= hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X); - rounded[Count + 1].Y:= hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y); + rounded[Count + 1].X:= hwRound(Gear^.Hedgehog^.Gear^.X); + rounded[Count + 1].Y:= hwRound(Gear^.Hedgehog^.Gear^.Y); end; if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then @@ -1200,11 +1145,11 @@ DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy); DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, - hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); + hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy); end else if Gear^.Elasticity.QWordValue > 0 then DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, - hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); + hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy); end; @@ -1349,7 +1294,7 @@ if Gear^.Kind <> gtFlame then FollowGear:= Gear end; if ((Mask and EXPLPoisoned) <> 0) and (Gear^.Kind = gtHedgehog) then - PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] := true; + Gear^.Hedgehog^.Effects[hePoisoned] := true; end; end; @@ -1473,7 +1418,7 @@ if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then ApplyDamage(Gear, tmpDmg * 100, dsUnknown); // crank up damage for explosives + blowtorch DeleteCI(Gear); - if (Gear^.Kind = gtHedgehog) and PHedgehog(Gear^.Hedgehog)^.King then + if (Gear^.Kind = gtHedgehog) and Gear^.Hedgehog^.King then begin Gear^.dX:= Ammo^.dX * Power * _0_005; Gear^.dY:= Ammo^.dY * Power * _0_005 @@ -1669,11 +1614,11 @@ if Team^.AIKillsTex <> nil then FreeTexture(Team^.AIKillsTex); Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16); end; - tempTeam := PHedgehog(gear^.Hedgehog)^.Team; + tempTeam := gear^.Hedgehog^.Team; DeleteCI(gear); FindPlace(gear, false, 0, LAND_WIDTH); if gear <> nil then begin - RenderHealth(PHedgehog(gear^.Hedgehog)^); + RenderHealth(gear^.Hedgehog^); ScriptCall('onGearResurrect', gear^.uid); end; RecountTeamHealth(tempTeam); @@ -1887,7 +1832,7 @@ else begin OutError('Can''t find place for Gear', false); - if Gear^.Kind = gtHedgehog then PHedgehog(Gear^.Hedgehog)^.Effects[heResurrectable] := false; + if Gear^.Kind = gtHedgehog then Gear^.Hedgehog^.Effects[heResurrectable] := false; DeleteGear(Gear); Gear:= nil end @@ -1902,7 +1847,7 @@ *) i:= _1; if (CurrentHedgehog <> nil) and CurrentHedgehog^.King then i:= _1_5; -if (Gear^.Hedgehog <> nil) and (PHedgehog(Gear^.Hedgehog)^.King) then +if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.King) then ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * i * cDamagePercent * _0_5) else ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * i * cDamagePercent) diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uIO.pas --- a/hedgewars/uIO.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uIO.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,7 +20,7 @@ unit uIO; interface -uses SDLh; +uses SDLh, uTypes; var ipcPort: Word = 0; hiTicks: Word; @@ -28,6 +28,10 @@ procedure initModule; procedure freeModule; +procedure OutError(Msg: shortstring; isFatalError: boolean); +procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline; +procedure SDLTry(Assert: boolean; isFatal: boolean); + procedure SendIPC(s: shortstring); procedure SendIPCXY(cmd: char; X, Y: SmallInt); procedure SendIPCRaw(p: pointer; len: Longword); @@ -35,6 +39,7 @@ procedure SendIPCTimeInc; procedure SendKeepAliveMessage(Lag: Longword); procedure LoadRecordFromFile(fileName: shortstring); +procedure SendStat(sit: TStatInfoType; s: shortstring); procedure IPCWaitPongEvent; procedure IPCCheckSock; procedure InitIPC; @@ -42,7 +47,7 @@ procedure NetGetNextCmd; implementation -uses uConsole, uConsts, uWorld, uMisc, uLand, uChat, uTeams; +uses uConsole, uConsts, uLand, uChat, uTeams, uVariables, uCommands, uUtils; type PCmd = ^TCmd; TCmd = packed record @@ -65,6 +70,27 @@ SendEmptyPacketTicks: LongWord; +procedure OutError(Msg: shortstring; isFatalError: boolean); +begin +WriteLnToConsole(Msg); +if isFatalError then + begin + SendIPC('E' + GetLastConsoleLine); + SDL_Quit; + halt(1) + end +end; + +procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); +begin +if not Assert then OutError(Msg, isFatal) +end; + +procedure SDLTry(Assert: boolean; isFatal: boolean); +begin +if not Assert then OutError(SDL_GetError, isFatal) +end; + function AddCmd(Time: Word; str: shortstring): PCmd; var command: PCmd; begin @@ -138,7 +164,7 @@ else loTicks:= SDLNet_Read16(@s[byte(s[0]) - 1]); AddCmd(loTicks, s); - {$IFDEF DEBUGFILE}AddFileLog('IPC in: '+s[1]+' ticks '+inttostr(lastcmd^.loTime));{$ENDIF} + {$IFDEF DEBUGFILE}AddFileLog('IPC in: '+s[1]+' ticks '+IntToStr(lastcmd^.loTime));{$ENDIF} end end; @@ -203,6 +229,15 @@ close(f) end; +procedure SendStat(sit: TStatInfoType; s: shortstring); +const stc: array [TStatInfoType] of char = 'rDkKHTPsSB'; +var buf: shortstring; +begin +buf:= 'i' + stc[sit] + s; +SendIPCRaw(@buf[0], length(buf) + 1) +end; + + procedure SendIPC(s: shortstring); begin if IPCSock <> nil then @@ -311,7 +346,7 @@ 'F': TeamGone(copy(headcmd^.str, 2, Pred(headcmd^.len))); 'N': begin tmpflag:= false; - {$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+inttostr(hiTicks shl 16 + headcmd^.loTime)){$ENDIF} + {$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+IntToStr(hiTicks shl 16 + headcmd^.loTime)){$ENDIF} end; 'p': begin x16:= SDLNet_Read16(@(headcmd^.X)); @@ -342,8 +377,8 @@ if (headcmd <> nil) and tmpflag and (not CurrentTeam^.hasGone) then TryDo(GameTicks < hiTicks shl 16 + headcmd^.loTime, 'oops, queue error. in buffer: ' + headcmd^.cmd + - ' (' + inttostr(GameTicks) + ' > ' + - inttostr(hiTicks shl 16 + headcmd^.loTime) + ')', + ' (' + IntToStr(GameTicks) + ' > ' + + IntToStr(hiTicks shl 16 + headcmd^.loTime) + ')', true); isInLag:= (headcmd = nil) and tmpflag and (not CurrentTeam^.hasGone); diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uKeys.pas --- a/hedgewars/uKeys.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uKeys.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,10 +20,7 @@ unit uKeys; interface -uses uConsts, SDLh; - -type TBinds = array[0..cKeyMaxIndex] of shortstring; -type TKeyboardState = array[0..cKeyMaxIndex] of Byte; +uses SDLh, uTypes; procedure initModule; procedure freeModule; @@ -85,8 +82,7 @@ {$ENDIF} {$ENDIF} implementation -uses uTeams, uConsole, uMisc; -//const KeyNumber = 1024; +uses uConsole, uCommands, uMisc, uVariables, uConsts, uUtils, uIO; var tkbd, tkbdn: TKeyboardState; KeyNames: array [0..cKeyMaxIndex] of string[15]; @@ -196,7 +192,7 @@ k:= SDL_GetMouseState(nil, nil); {$IFNDEF IPHONEOS}pkbd:={$ENDIF}SDL_GetKeyState(@j); -TryDo(j < cKeyMaxIndex, 'SDL keys number is more than expected (' + inttostr(j) + ')', true); +TryDo(j < cKeyMaxIndex, 'SDL keys number is more than expected (' + IntToStr(j) + ')', true); {$IFNDEF IPHONEOS} for i:= 1 to pred(j) do @@ -265,7 +261,7 @@ for i:= 6 to cKeyMaxIndex do begin s:= shortstring(sdl_getkeyname(i)); - //writeln(stdout,inttostr(i) + ': ' + s); + //writeln(stdout,IntToStr(i) + ': ' + s); if s = 'unknown key' then KeyNames[i]:= '' else begin @@ -275,7 +271,7 @@ end; end; -//for i:= 0 to cKeyMaxIndex do writeln(stdout,inttostr(i) + ': ' + KeyNames[i]); +//for i:= 0 to cKeyMaxIndex do writeln(stdout,IntToStr(i) + ': ' + KeyNames[i]); // get the size of keyboard array SDL_GetKeyState(@k); @@ -285,21 +281,21 @@ begin for i:= 0 to Pred(ControllerNumAxes[j]) do begin - keynames[k + 0]:= 'j' + inttostr(j) + 'a' + inttostr(i) + 'u'; - keynames[k + 1]:= 'j' + inttostr(j) + 'a' + inttostr(i) + 'd'; + keynames[k + 0]:= 'j' + IntToStr(j) + 'a' + IntToStr(i) + 'u'; + keynames[k + 1]:= 'j' + IntToStr(j) + 'a' + IntToStr(i) + 'd'; inc(k, 2); end; for i:= 0 to Pred(ControllerNumHats[j]) do begin - keynames[k + 0]:= 'j' + inttostr(j) + 'h' + inttostr(i) + 'u'; - keynames[k + 1]:= 'j' + inttostr(j) + 'h' + inttostr(i) + 'r'; - keynames[k + 2]:= 'j' + inttostr(j) + 'h' + inttostr(i) + 'd'; - keynames[k + 3]:= 'j' + inttostr(j) + 'h' + inttostr(i) + 'l'; + keynames[k + 0]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'u'; + keynames[k + 1]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'r'; + keynames[k + 2]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'd'; + keynames[k + 3]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'l'; inc(k, 4); end; for i:= 0 to Pred(ControllerNumButtons[j]) do begin - keynames[k]:= 'j' + inttostr(j) + 'b' + inttostr(i); + keynames[k]:= 'j' + IntToStr(j) + 'b' + IntToStr(i); inc(k, 1); end; end; @@ -350,7 +346,7 @@ DefaultBinds[KeyNameToCode('left_shift')]:= '+precise'; {$ENDIF} -for i:= 1 to 10 do DefaultBinds[KeyNameToCode('f'+inttostr(i))]:= 'slot '+inttostr(i); +for i:= 1 to 10 do DefaultBinds[KeyNameToCode('f'+IntToStr(i))]:= 'slot '+IntToStr(i); SetDefaultBinds(); end; @@ -425,7 +421,7 @@ ControllerNumControllers:= SDL_NumJoysticks(); if ControllerNumControllers > 6 then ControllerNumControllers:= 6; -WriteLnToConsole('Number of game controllers: ' + inttostr(ControllerNumControllers)); +WriteLnToConsole('Number of game controllers: ' + IntToStr(ControllerNumControllers)); if ControllerNumControllers > 0 then begin @@ -441,10 +437,10 @@ //ControllerNumBalls[j]:= SDL_JoystickNumBalls(Controller[j]); ControllerNumHats[j]:= SDL_JoystickNumHats(Controller[j]); ControllerNumButtons[j]:= SDL_JoystickNumButtons(Controller[j]); - WriteLnToConsole('* Number of axes: ' + inttostr(ControllerNumAxes[j])); - //WriteLnToConsole('* Number of balls: ' + inttostr(ControllerNumBalls[j])); - WriteLnToConsole('* Number of hats: ' + inttostr(ControllerNumHats[j])); - WriteLnToConsole('* Number of buttons: ' + inttostr(ControllerNumButtons[j])); + WriteLnToConsole('* Number of axes: ' + IntToStr(ControllerNumAxes[j])); + //WriteLnToConsole('* Number of balls: ' + IntToStr(ControllerNumBalls[j])); + WriteLnToConsole('* Number of hats: ' + IntToStr(ControllerNumHats[j])); + WriteLnToConsole('* Number of buttons: ' + IntToStr(ControllerNumButtons[j])); ControllerEnabled:= 1; if ControllerNumAxes[j] > 20 then ControllerNumAxes[j]:= 20; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uLand.pas --- a/hedgewars/uLand.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uLand.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,23 +20,7 @@ unit uLand; interface -uses SDLh, uLandTemplates, uFloat, uConsts, GLunit; - -type - TLandArray = packed array of array of LongWord; - TCollisionArray = packed array of array of Word; - TPreview = packed array[0..127, 0..31] of byte; - TDirtyTag = packed array of array of byte; - -var Land: TCollisionArray; - LandPixels: TLandArray; - 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; +uses SDLh, uLandTemplates, uFloat, uConsts, GLunit, uTypes; type direction = record x, y: LongInt; end; const DIR_N: direction = (x: 0; y: -1); @@ -49,10 +33,10 @@ procedure GenMap; function GenPreview: TPreview; procedure CheckLandDigest(s: shortstring); -function LandBackPixel(x, y: LongInt): LongWord; implementation -uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, Adler32, uIO, uLandTexture, sysutils; +uses uConsole, uStore, uRandom, uLandObjects, Adler32, uIO, uLandTexture, sysutils, + uVariables, uUtils; operator=(const a, b: direction) c: Boolean; begin @@ -319,17 +303,6 @@ end; end; -function LandBackPixel(x, y: LongInt): LongWord; -var p: PLongWordArray; -begin - if LandBackSurface = nil then LandBackPixel:= 0 - else - begin - p:= LandBackSurface^.pixels; - LandBackPixel:= p^[LandBackSurface^.w * (y mod LandBackSurface^.h) + (x mod LandBackSurface^.w)];// or $FF000000; - end -end; - procedure ColorizeLand(Surface: PSDL_Surface); var tmpsurf: PSDL_Surface; r, rr: TSDL_Rect; @@ -385,7 +358,7 @@ r.x:= x mod tmpsurf^.w; r.y:= 0; r.w:= 1; - r.h:= min(16, yd - yu + 1); + r.h:= Min(16, yd - yu + 1); SDL_UpperBlit(tmpsurf, @r, Surface, @rr); end; yd:= yu - 1; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uLandGraphics.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,7 +20,7 @@ unit uLandGraphics; interface -uses uFloat, uConsts; +uses uFloat, uConsts, uTypes; type PRangeArray = ^TRangeArray; TRangeArray = array[0..31] of record @@ -30,34 +30,35 @@ function SweepDirty: boolean; function Despeckle(X, Y: LongInt): boolean; function CheckLandValue(X, Y: LongInt; LandFlag: Word): boolean; -function DrawExplosion(X, Y, Radius: LongInt): Longword; +function DrawExplosion(X, Y, Radius: LongInt): Longword; procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte); procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt); procedure FillRoundInLand(X, Y, Radius: LongInt; Value: Longword); procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet: boolean); +function LandBackPixel(x, y: LongInt): LongWord; function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean): boolean; implementation -uses SDLh, uMisc, uLand, uLandTexture; +uses SDLh, uLandTexture, uVariables, uUtils, uIO; procedure FillCircleLines(x, y, dx, dy: LongInt; Value: Longword); var i: LongInt; begin if ((y + dy) and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do + for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do if (Land[y + dy, i] and lfIndestructible) = 0 then Land[y + dy, i]:= Value; if ((y - dy) and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do + for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do if (Land[y - dy, i] and lfIndestructible) = 0 then Land[y - dy, i]:= Value; if ((y + dx) and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do + for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do if (Land[y + dx, i] and lfIndestructible) = 0 then Land[y + dx, i]:= Value; if ((y - dx) and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do + for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do if (Land[y - dx, i] and lfIndestructible) = 0 then Land[y - dx, i]:= Value; end; @@ -68,33 +69,33 @@ if not doSet then begin if ((y + dy) and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do + for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do if (Land[y + dy, i] > 0) and (Land[y + dy, i] < 256) then dec(Land[y + dy, i]); // check > 0 because explosion can erase collision data if ((y - dy) and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do + for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do if (Land[y - dy, i] > 0) and (Land[y - dy, i] < 256) then dec(Land[y - dy, i]); if ((y + dx) and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do + for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do if (Land[y + dx, i] > 0) and (Land[y + dx, i] < 256) then dec(Land[y + dx, i]); if ((y - dx) and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do + for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do if (Land[y - dx, i] > 0) and (Land[y - dx, i] < 256) then dec(Land[y - dx, i]); end else begin if ((y + dy) and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do + for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do if (Land[y + dy, i] < 256) then inc(Land[y + dy, i]); if ((y - dy) and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do + for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do if (Land[y - dy, i] < 256) then inc(Land[y - dy, i]); if ((y + dx) and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do + for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do if (Land[y + dx, i] < 256) then inc(Land[y + dx, i]); if ((y - dx) and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do + for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do if (Land[y - dx, i] < 256) then inc(Land[y - dx, i]); end @@ -145,7 +146,7 @@ begin t:= y + dy; if (t and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do + for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do if (not isMap and ((Land[t, i] and lfIndestructible) = 0)) or ((Land[t, i] and lfBasic) <> 0) then if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= 0 @@ -154,7 +155,7 @@ t:= y - dy; if (t and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do + for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do if (not isMap and ((Land[t, i] and lfIndestructible) = 0)) or ((Land[t, i] and lfBasic) <> 0) then if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= 0 @@ -163,7 +164,7 @@ t:= y + dx; if (t and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do + for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do if (not isMap and ((Land[t, i] and lfIndestructible) = 0)) or ((Land[t, i] and lfBasic) <> 0) then if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= 0 @@ -172,7 +173,7 @@ t:= y - dx; if (t and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do + for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do if (not isMap and ((Land[t, i] and lfIndestructible) = 0)) or ((Land[t, i] and lfBasic) <> 0) then if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= 0 @@ -188,7 +189,7 @@ cnt:= 0; t:= y + dy; if (t and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do + for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do if ((Land[t, i] and lfBasic) <> 0) then begin inc(cnt); @@ -206,7 +207,7 @@ t:= y - dy; if (t and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do + for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do if ((Land[t, i] and lfBasic) <> 0) then begin inc(cnt); @@ -224,7 +225,7 @@ t:= y + dx; if (t and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do + for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do if ((Land[t, i] and lfBasic) <> 0) then begin inc(cnt); @@ -242,7 +243,7 @@ t:= y - dx; if (t and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do + for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do if ((Land[t, i] and lfBasic) <> 0) then begin inc(cnt); @@ -265,7 +266,7 @@ begin t:= y + dy; if (t and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do + for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then begin if (cReducedQuality and rqBlurryLand) = 0 then @@ -280,7 +281,7 @@ t:= y - dy; if (t and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do + for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then begin if (cReducedQuality and rqBlurryLand) = 0 then @@ -294,7 +295,7 @@ t:= y + dx; if (t and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do + for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then begin if (cReducedQuality and rqBlurryLand) = 0 then @@ -309,7 +310,7 @@ t:= y - dx; if (t and LAND_HEIGHT_MASK) = 0 then - for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do + for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then begin if (cReducedQuality and rqBlurryLand) = 0 then @@ -393,10 +394,10 @@ if (dx = dy) then FillLandCircleLinesEBC(x, y, dx, dy); end; -tx:= max(X - Radius - 1, 0); -dx:= min(X + Radius + 1, LAND_WIDTH) - tx; -ty:= max(Y - Radius - 1, 0); -dy:= min(Y + Radius + 1, LAND_HEIGHT) - ty; +tx:= Max(X - Radius - 1, 0); +dx:= Min(X + Radius + 1, LAND_WIDTH) - tx; +ty:= Max(Y - Radius - 1, 0); +dy:= Min(Y + Radius + 1, LAND_HEIGHT) - ty; UpdateLandTexture(tx, dx, ty, dy); DrawExplosion:= cnt end; @@ -406,8 +407,8 @@ begin for i:= 0 to Pred(Count) do begin - for ty:= max(y - Radius, 0) to min(y + Radius, LAND_HEIGHT) do - for tx:= max(0, ar^[i].Left - Radius) to min(LAND_WIDTH, ar^[i].Right + Radius) do + for ty:= Max(y - Radius, 0) to Min(y + Radius, LAND_HEIGHT) do + for tx:= Max(0, ar^[i].Left - Radius) to Min(LAND_WIDTH, ar^[i].Right + Radius) do if (Land[ty, tx] and lfBasic) <> 0 then if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[ty, tx]:= LandBackPixel(tx, ty) @@ -427,8 +428,8 @@ for i:= 0 to Pred(Count) do begin - for ty:= max(y - Radius, 0) to min(y + Radius, LAND_HEIGHT) do - for tx:= max(0, ar^[i].Left - Radius) to min(LAND_WIDTH, ar^[i].Right + Radius) do + for ty:= Max(y - Radius, 0) to Min(y + Radius, LAND_HEIGHT) do + for tx:= Max(0, ar^[i].Left - Radius) to Min(LAND_WIDTH, ar^[i].Right + Radius) do if ((Land[ty, tx] and lfBasic) <> 0) or ((Land[ty, tx] and lfObject) <> 0) then begin if (cReducedQuality and rqBlurryLand) = 0 then @@ -584,10 +585,10 @@ ny:= ny + dX; end; -tx:= max(stX - HalfWidth * 2 - 4 - abs(hwRound(dX * ticks)), 0); -ty:= max(stY - HalfWidth * 2 - 4 - abs(hwRound(dY * ticks)), 0); -ddx:= min(stX + HalfWidth * 2 + 4 + abs(hwRound(dX * ticks)), LAND_WIDTH) - tx; -ddy:= min(stY + HalfWidth * 2 + 4 + abs(hwRound(dY * ticks)), LAND_HEIGHT) - ty; +tx:= Max(stX - HalfWidth * 2 - 4 - abs(hwRound(dX * ticks)), 0); +ty:= Max(stY - HalfWidth * 2 - 4 - abs(hwRound(dY * ticks)), 0); +ddx:= Min(stX + HalfWidth * 2 + 4 + abs(hwRound(dX * ticks)), LAND_WIDTH) - tx; +ddy:= Min(stY + HalfWidth * 2 + 4 + abs(hwRound(dY * ticks)), LAND_HEIGHT) - ty; UpdateLandTexture(tx, ddx, ty, ddy) end; @@ -660,10 +661,10 @@ if SDL_MustLock(Image) then SDL_UnlockSurface(Image); -x:= max(cpX, leftX); -w:= min(cpX + Image^.w, LAND_WIDTH) - x; -y:= max(cpY, topY); -h:= min(cpY + Image^.h, LAND_HEIGHT) - y; +x:= Max(cpX, leftX); +w:= Min(cpX + Image^.w, LAND_WIDTH) - x; +y:= Max(cpY, topY); +h:= Min(cpY + Image^.h, LAND_HEIGHT) - y; UpdateLandTexture(x, w, y, h) end; @@ -772,4 +773,17 @@ begin CheckLandValue:= ((X and LAND_WIDTH_MASK <> 0) or (Y and LAND_HEIGHT_MASK <> 0)) or ((Land[Y, X] and LandFlag) = 0) end; + +function LandBackPixel(x, y: LongInt): LongWord; +var p: PLongWordArray; +begin + if LandBackSurface = nil then LandBackPixel:= 0 + else + begin + p:= LandBackSurface^.pixels; + LandBackPixel:= p^[LandBackSurface^.w * (y mod LandBackSurface^.h) + (x mod LandBackSurface^.w)];// or $FF000000; + end +end; + + end. diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uLandObjects.pas Thu Nov 18 16:58:08 2010 -0500 @@ -29,7 +29,8 @@ procedure AddOnLandObjects(Surface: PSDL_Surface); implementation -uses uLand, uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uSound, GLunit; +uses uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uSound, GLunit, + uTypes, uVariables, uUtils, uIO; const MaxRects = 512; MAXOBJECTRECTS = 16; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uLandTexture.pas --- a/hedgewars/uLandTexture.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uLandTexture.pas Thu Nov 18 16:58:08 2010 -0500 @@ -28,8 +28,7 @@ procedure DrawLand(dX, dY: LongInt); implementation -uses uMisc, uLand, uStore, uConsts, GLunit; - +uses uMisc, uStore, uConsts, GLunit, uTypes, uVariables, uTextures, uIO, uRender; const TEXSIZE = 256; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uLocale.pas --- a/hedgewars/uLocale.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uLocale.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,30 +20,7 @@ unit uLocale; interface -type TAmmoStrId = (sidNothing, sidGrenade, sidClusterBomb, sidBazooka, sidBee, sidShotgun, - sidPickHammer, sidSkip, sidRope, sidMine, sidDEagle, - sidDynamite, sidBaseballBat, sidFirePunch, sidSeconds, - sidParachute, sidAirAttack, sidMineStrike, sidBlowTorch, - sidGirder, sidTeleport, sidSwitch, sidMortar, sidWhip, - sidKamikaze, sidCake, sidSeduction, sidWatermelon, - sidHellishBomb, sidDrill, sidBallgun, sidNapalm, sidRCPlane, - sidLowGravity, sidExtraDamage, sidInvulnerable, sidExtraTime, - sidLaserSight, sidVampiric, sidSniperRifle, sidJetpack, - sidMolotov, sidBirdy, sidPortalGun, sidPiano, sidGasBomb, sidSineGun, sidFlamethrower, - sidSMine, sidHammer, sidResurrector, sidDrillStrike); - - TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused, - sidConfirm, sidSuddenDeath, sidRemaining, sidFuel, sidSync, - sidNoEndTurn, sidNotYetAvailable, sidRoundSD, sidRoundsSD, sidReady); - - TEventId = (eidDied, eidDrowned, eidRoundStart, eidRoundWin, eidRoundDraw, - eidNewHealthPack, eidNewAmmoPack, eidNewUtilityPack, eidTurnSkipped, eidHurtSelf, - eidHomerun, eidGone); - - TGoalStrId = (gidCaption, gidSubCaption, gidForts, gidLowGravity, gidInvulnerable, - gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery, - gidSolidLand, gidSharedAmmo, gidMineTimer, gidNoMineTimer, gidRandomMineTimer, - gidDamageModifier, gidResetHealth, gidAISurvival, gidInfAttack, gidResetWeps, gidPerHogAmmo); +uses uTypes; const MAX_EVENT_STRINGS = 100; var trammo: array[TAmmoStrId] of ansistring; // name of the weapon @@ -58,7 +35,7 @@ function GetEventString(e: TEventId): ansistring; implementation -uses uMisc, uRandom; +uses uRandom, uUtils, uIO; var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring; trevt_n: array[TEventId] of integer; @@ -100,7 +77,7 @@ 0: if (b >=0) and (b <= ord(High(TAmmoStrId))) then trammo[TAmmoStrId(b+1)]:= s; 1: if (b >=0) and (b <= ord(High(TMsgStrId))) then trmsg[TMsgStrId(b)]:= s; 2: if (b >=0) and (b <= ord(High(TEventId))) then begin - TryDo(trevt_n[TEventId(b)] < MAX_EVENT_STRINGS, 'Too many event strings in ' + inttostr(a) + ':' + inttostr(b), false); + TryDo(trevt_n[TEventId(b)] < MAX_EVENT_STRINGS, 'Too many event strings in ' + IntToStr(a) + ':' + IntToStr(b), false); if first[TEventId(b)] then begin trevt_n[TEventId(b)]:= 0; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uMisc.pas Thu Nov 18 16:58:08 2010 -0500 @@ -21,237 +21,18 @@ unit uMisc; interface -uses SDLh, uConsts, uFloat, GLunit, Math; - -var -/////// init flags /////// - cScreenWidth : LongInt = 1024; - cScreenHeight : LongInt = 768; - cBits : LongInt = 32; - //ipcPort is in uIO - cFullScreen : boolean = false; - isSoundEnabled : boolean = true; - isMusicEnabled : boolean = false; - cLocaleFName : shortstring = 'en.txt'; - cInitVolume : LongInt = 100; - cTimerInterval : LongInt = 8; - PathPrefix : shortstring = './'; - cShowFPS : boolean = false; - cAltDamage : boolean = true; - cReducedQuality : LongWord = rqNone; - //userNick is in uChat - recordFileName : shortstring = ''; - cReadyDelay : Longword = 0; - cLogfileBase : shortstring = 'debug'; -////////////////////////// - - isCursorVisible : boolean; - isTerminated : boolean; - isInLag : boolean; - isPaused : boolean; +uses SDLh, uConsts, GLunit, uTypes; - isSEBackup : boolean; - isInMultiShoot : boolean; - isSpeed : boolean; - isFirstFrame : boolean; - - fastUntilLag : boolean; - - GameState : TGameState; - GameType : TGameType; - GameFlags : Longword; - TrainingFlags : Longword; - TurnTimeLeft : Longword; - ReadyTimeLeft : Longword; - cSuddenDTurns : LongInt; - cDamagePercent : LongInt; - cMineDudPercent : LongWord; - cTemplateFilter : LongInt; - cMapGen : LongInt; - cMazeSize : LongInt; - - cHedgehogTurnTime: Longword; - cMinesTime : LongInt; - cMaxAIThinkTime : Longword; - - cHealthCaseProb : LongInt; - cHealthCaseAmount: LongInt; - cWaterRise : LongInt; - cHealthDecrease : LongInt; - - cCloudsNumber : LongInt; - - cTagsMask : byte; - zoom : GLfloat; - ZoomValue : GLfloat; - - cWaterLine : LongInt; - cGearScrEdgesDist: LongInt; - GameTicks : LongWord; - TrainingTimeInc : Longword; - TrainingTimeInD : Longword; - TrainingTimeInM : Longword; - TrainingTimeMax : Longword; - - TimeTrialStartTime: Longword; - TimeTrialStopTime : Longword; - - // originally from uConsts - Pathz: array[TPathType] of shortstring; - CountTexz: array[1..Pred(AMMO_INFINITE)] of PTexture; - LAND_WIDTH : LongInt; - LAND_HEIGHT : LongInt; - LAND_WIDTH_MASK : LongWord; - LAND_HEIGHT_MASK : LongWord; - cMaxCaptions : LongInt; - - cLeftScreenBorder : LongInt; - cRightScreenBorder : LongInt; - cScreenSpace : LongInt; - - cCaseFactor : Longword; - cLandMines : Longword; - cExplosives : Longword; - - cSeed : shortstring; - cVolumeDelta : LongInt; - cHasFocus : boolean; - cInactDelay : Longword; - - bBetweenTurns : boolean; - bWaterRising : boolean; - - ShowCrosshair : boolean; - CursorMovementX : LongInt; - CursorMovementY : LongInt; - cDrownSpeed : hwFloat; - cDrownSpeedf : float; - cMaxWindSpeed : hwFloat; - cWindSpeed : hwFloat; - cWindSpeedf : float; - cGravity : hwFloat; - cGravityf : float; - cDamageModifier : hwFloat; - cLaserSighting : boolean; - cVampiric : boolean; - cArtillery : boolean; - WeaponTooltipTex : PTexture; - - flagMakeCapture : boolean; - - InitStepsFlags : Longword; - RealTicks : Longword; - AttackBar : LongInt; - - WaterColorArray : array[0..3] of HwColor4f; - - CursorPoint : TPoint; - TargetPoint : TPoint; - - TextureList : PTexture; - - ScreenFade : TScreenFade; - ScreenFadeValue : LongInt; - ScreenFadeSpeed : LongInt; - -{$IFDEF SDL13} - SDLwindow : PSDL_Window; -{$ENDIF} +procedure movecursor(dx, dy: LongInt); +function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; +procedure MakeScreenshot(filename: shortstring); procedure initModule; procedure freeModule; -procedure SplitBySpace(var a, b: shortstring); -procedure SplitByChar(var a, b: ansistring; c: char); -function EnumToStr(const en : TGearType) : shortstring; overload; -function EnumToStr(const en : TSound) : shortstring; overload; -function EnumToStr(const en : TAmmoType) : shortstring; overload; -function EnumToStr(const en : THogEffect) : shortstring; overload; -procedure movecursor(dx, dy: LongInt); -function hwSign(r: hwFloat): LongInt; inline; -function Min(a, b: LongInt): LongInt; inline; -function Max(a, b: LongInt): LongInt; inline; -procedure OutError(Msg: shortstring; isFatalError: boolean); -procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline; -procedure SDLTry(Assert: boolean; isFatal: boolean); -function IntToStr(n: LongInt): shortstring; -function FloatToStr(n: hwFloat): shortstring; -function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat; -function DxDy2Angle32(const _dY, _dX: hwFloat): LongInt; -function DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt; -(* -procedure AdjustColor(var Color: Longword); -procedure SetKB(n: Longword); -*) -procedure SendKB; -procedure SetLittle(var r: hwFloat); -procedure SendStat(sit: TStatInfoType; s: shortstring); -function Str2PChar(const s: shortstring): PChar; -function NewTexture(width, height: Longword; buf: Pointer): PTexture; -function Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture; -procedure FreeTexture(tex: PTexture); -function toPowerOf2(i: Longword): Longword; inline; -function DecodeBase64(s: shortstring): shortstring; -function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; -function endian(independent: LongWord): LongWord; inline; -{$IFDEF DEBUGFILE} -procedure AddFileLog(s: shortstring); -(* function RectToStr(Rect: TSDL_Rect): shortstring; *) -{$ENDIF} -procedure MakeScreenshot(filename: shortstring); implementation -uses uConsole, uStore, uIO, uSound, typinfo, sysutils, uMobile; - -var KBnum: Longword; -{$IFDEF DEBUGFILE} - f: textfile; -{$ENDIF} - -// should this include "strtolower()" for the split string? -procedure SplitBySpace(var a, b: shortstring); -var i, t: LongInt; -begin -i:= Pos(' ', a); -if i > 0 then - begin - for t:= 1 to Pred(i) do - 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) - end else b:= ''; -end; - -procedure SplitByChar(var a, b: ansistring; c: char); -var i: LongInt; -begin -i:= Pos(c, a); -if i > 0 then - begin - b:= copy(a, i + 1, Length(a) - i); - setlength(a, Pred(i)); - end else b:= ''; -end; - -function EnumToStr(const en : TGearType) : shortstring; overload; -begin -EnumToStr:= GetEnumName(TypeInfo(TGearType), ord(en)) -end; - -function EnumToStr(const en : TSound) : shortstring; overload; -begin -EnumToStr:= GetEnumName(TypeInfo(TSound), ord(en)) -end; - -function EnumToStr(const en : TAmmoType) : shortstring; overload; -begin -EnumToStr:= GetEnumName(TypeInfo(TAmmoType), ord(en)) -end; - -function EnumToStr(const en: THogEffect) : shortstring; overload; -begin - EnumToStr := GetEnumName(TypeInfo(THogEffect), ord(en)) -end; +uses typinfo, sysutils, uVariables; procedure movecursor(dx, dy: LongInt); var x, y: LongInt; @@ -264,328 +45,6 @@ SDL_WarpMouse(x, y); end; -function hwSign(r: hwFloat): LongInt; -begin -// yes, we have negative zero for a reason -if r.isNegative then hwSign:= -1 else hwSign:= 1 -end; - -function Min(a, b: LongInt): LongInt; -begin -if a < b then Min:= a else Min:= b -end; - -function Max(a, b: LongInt): LongInt; -begin -if a > b then Max:= a else Max:= b -end; - -procedure OutError(Msg: shortstring; isFatalError: boolean); -begin -// obsolete? written in WriteLnToConsole() anyway -// {$IFDEF DEBUGFILE}AddFileLog(Msg);{$ENDIF} -WriteLnToConsole(Msg); -if isFatalError then - begin - SendIPC('E' + GetLastConsoleLine); - SDL_Quit; - halt(1) - end -end; - -procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); -begin -if not Assert then OutError(Msg, isFatal) -end; - -procedure SDLTry(Assert: boolean; isFatal: boolean); -begin -if not Assert then OutError(SDL_GetError, isFatal) -end; - -(* -procedure AdjustColor(var Color: Longword); -begin -Color:= SDL_MapRGB(PixelFormat, (Color shr 16) and $FF, (Color shr 8) and $FF, Color and $FF) -end; - -procedure SetKB(n: Longword); -begin -KBnum:= n -end; -*) - - -function IntToStr(n: LongInt): shortstring; -begin -str(n, IntToStr) -end; - -function FloatToStr(n: hwFloat): shortstring; -begin -FloatToStr:= cstr(n) + '_' + inttostr(Lo(n.QWordValue)) -end; - -procedure SetTextureParameters(enableClamp: Boolean); -begin - if enableClamp and ((cReducedQuality and rqClampLess) = 0) then - begin - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) - end; - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) -end; - -function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat; -var dY, dX: Extended; -begin -dY:= _dY.QWordValue / $100000000; -if _dY.isNegative then dY:= - dY; -dX:= _dX.QWordValue / $100000000; -if _dX.isNegative then dX:= - dX; -DxDy2Angle:= arctan2(dY, dX) * 180 / pi -end; - -function DxDy2Angle32(const _dY, _dX: hwFloat): LongInt; -const _16divPI: Extended = 16/pi; -var dY, dX: Extended; -begin -dY:= _dY.QWordValue / $100000000; -if _dY.isNegative then dY:= - dY; -dX:= _dX.QWordValue / $100000000; -if _dX.isNegative then dX:= - dX; -DxDy2Angle32:= trunc(arctan2(dY, dX) * _16divPI) and $1f -end; - -function DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt; -const MaxAngleDivPI: Extended = cMaxAngle/pi; -var dY, dX: Extended; -begin -dY:= _dY.QWordValue / $100000000; -if _dY.isNegative then dY:= - dY; -dX:= _dX.QWordValue / $100000000; -if _dX.isNegative then dX:= - dX; -DxDy2AttackAngle:= trunc(arctan2(dY, dX) * MaxAngleDivPI) -end; - -procedure SendKB; -var s: shortstring; -begin -if KBnum <> 0 then -begin -s:= 'K' + inttostr(KBnum); -SendIPCRaw(@s, Length(s) + 1) -end -end; - -procedure SetLittle(var r: hwFloat); -begin -r:= SignAs(cLittle, r) -end; - -procedure SendStat(sit: TStatInfoType; s: shortstring); -const stc: array [TStatInfoType] of char = 'rDkKHTPsSB'; -var buf: shortstring; -begin -buf:= 'i' + stc[sit] + s; -SendIPCRaw(@buf[0], length(buf) + 1) -end; - -function Str2PChar(const s: shortstring): PChar; -const CharArray: array[byte] of Char = ''; -begin -CharArray:= s; -CharArray[Length(s)]:= #0; -Str2PChar:= @CharArray -end; - -function isPowerOf2(i: Longword): boolean; -begin -if i = 0 then exit(true); -while (i and 1) = 0 do i:= i shr 1; -isPowerOf2:= (i = 1) -end; - -function toPowerOf2(i: Longword): Longword; -begin -toPowerOf2:= 1; -while (toPowerOf2 < i) do toPowerOf2:= toPowerOf2 shl 1 -end; - -procedure ResetVertexArrays(texture: PTexture); -begin -with texture^ do - begin - vb[0].X:= 0; - vb[0].Y:= 0; - vb[1].X:= w; - vb[1].Y:= 0; - vb[2].X:= w; - vb[2].Y:= h; - vb[3].X:= 0; - vb[3].Y:= h; - - tb[0].X:= 0; - tb[0].Y:= 0; - tb[1].X:= rx; - tb[1].Y:= 0; - tb[2].X:= rx; - tb[2].Y:= ry; - tb[3].X:= 0; - tb[3].Y:= ry - end; -end; - -function NewTexture(width, height: Longword; buf: Pointer): PTexture; -begin -new(NewTexture); -NewTexture^.PrevTexture:= nil; -NewTexture^.NextTexture:= nil; -NewTexture^.Scale:= 1; -if TextureList <> nil then - begin - TextureList^.PrevTexture:= NewTexture; - NewTexture^.NextTexture:= TextureList - end; -TextureList:= NewTexture; - -NewTexture^.w:= width; -NewTexture^.h:= height; -NewTexture^.rx:= 1.0; -NewTexture^.ry:= 1.0; - -ResetVertexArrays(NewTexture); - -glGenTextures(1, @NewTexture^.id); - -glBindTexture(GL_TEXTURE_2D, NewTexture^.id); -glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf); - -SetTextureParameters(true); -end; - -function Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture; -var tw, th, x, y: Longword; - tmpp: pointer; - fromP4, toP4: PLongWordArray; -begin -new(Surface2Tex); -Surface2Tex^.PrevTexture:= nil; -Surface2Tex^.NextTexture:= nil; -if TextureList <> nil then - begin - TextureList^.PrevTexture:= Surface2Tex; - Surface2Tex^.NextTexture:= TextureList - end; -TextureList:= Surface2Tex; - -Surface2Tex^.w:= surf^.w; -Surface2Tex^.h:= surf^.h; - -if (surf^.format^.BytesPerPixel <> 4) then - begin - TryDo(false, 'Surface2Tex failed, expecting 32 bit surface', true); - Surface2Tex^.id:= 0; - exit - end; - - -glGenTextures(1, @Surface2Tex^.id); - -glBindTexture(GL_TEXTURE_2D, Surface2Tex^.id); - -if SDL_MustLock(surf) then - SDLTry(SDL_LockSurface(surf) >= 0, true); - -if (not SupportNPOTT) and (not (isPowerOf2(Surf^.w) and isPowerOf2(Surf^.h))) then - begin - tw:= toPowerOf2(Surf^.w); - th:= toPowerOf2(Surf^.h); - - Surface2Tex^.rx:= Surf^.w / tw; - Surface2Tex^.ry:= Surf^.h / th; - - GetMem(tmpp, tw * th * surf^.format^.BytesPerPixel); - - fromP4:= Surf^.pixels; - toP4:= tmpp; - - for y:= 0 to Pred(Surf^.h) do - begin - for x:= 0 to Pred(Surf^.w) do toP4^[x]:= fromP4^[x]; - for x:= Surf^.w to Pred(tw) do toP4^[x]:= 0; - toP4:= @(toP4^[tw]); - fromP4:= @(fromP4^[Surf^.pitch div 4]) - end; - - for y:= Surf^.h to Pred(th) do - begin - for x:= 0 to Pred(tw) do toP4^[x]:= 0; - toP4:= @(toP4^[tw]) - end; - - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tw, th, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmpp); - - FreeMem(tmpp, tw * th * surf^.format^.BytesPerPixel) - end -else - begin - Surface2Tex^.rx:= 1.0; - Surface2Tex^.ry:= 1.0; - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surf^.w, surf^.h, 0, GL_RGBA, GL_UNSIGNED_BYTE, surf^.pixels); - end; - -ResetVertexArrays(Surface2Tex); - -if SDL_MustLock(surf) then - SDL_UnlockSurface(surf); - -SetTextureParameters(enableClamp); -end; - -procedure FreeTexture(tex: PTexture); -begin - if tex <> nil then - begin - if tex^.NextTexture <> nil then - tex^.NextTexture^.PrevTexture:= tex^.PrevTexture; - if tex^.PrevTexture <> nil then - tex^.PrevTexture^.NextTexture:= tex^.NextTexture - else - TextureList:= tex^.NextTexture; - glDeleteTextures(1, @tex^.id); - Dispose(tex); - end -end; - -function DecodeBase64(s: shortstring): shortstring; -const table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -var i, t, c: Longword; -begin -c:= 0; -for i:= 1 to Length(s) do - begin - t:= Pos(s[i], table); - if s[i] = '=' then inc(c); - if t > 0 then byte(s[i]):= t - 1 else byte(s[i]):= 0 - end; - -i:= 1; -t:= 1; -while i <= length(s) do - begin - DecodeBase64[t ]:= char((byte(s[i ]) shl 2) or (byte(s[i + 1]) shr 4)); - DecodeBase64[t + 1]:= char((byte(s[i + 1]) shl 4) or (byte(s[i + 2]) shr 2)); - DecodeBase64[t + 2]:= char((byte(s[i + 2]) shl 6) or (byte(s[i + 3]) )); - inc(t, 3); - inc(i, 4) - end; - -if c < 3 then t:= t - c; - -byte(DecodeBase64[0]):= t - 1 -end; procedure MakeScreenshot(filename: shortstring); var p: Pointer; @@ -610,8 +69,6 @@ 0, 0, 0, 0 // number of important colors ); begin -playSound(sndShutter); - // flash ScreenFade:= sfFromWhite; ScreenFadeValue:= sfMax; @@ -659,20 +116,6 @@ FreeMem(p) end; -{$IFDEF DEBUGFILE} -procedure AddFileLog(s: shortstring); -begin -writeln(f, GameTicks: 6, ': ', s); -flush(f) -end; -(* -function RectToStr(Rect: TSDL_Rect): shortstring; -begin -RectToStr:= '(x: ' + inttostr(rect.x) + '; y: ' + inttostr(rect.y) + '; w: ' + inttostr(rect.w) + '; h: ' + inttostr(rect.h) + ')' -end; -*) -{$ENDIF} - function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; {* for more information http://www.idevgames.com/forum/showpost.php?p=85864&postcount=7 *} var convertedSurf: PSDL_Surface = nil; @@ -687,200 +130,14 @@ exit(tmpsurf); end; -function endian(independent: LongWord): LongWord; inline; -begin -{$IFDEF ENDIAN_LITTLE} -endian:= independent; -{$ELSE} -endian:= (((independent and $FF000000) shr 24) or - ((independent and $00FF0000) shr 8) or - ((independent and $0000FF00) shl 8) or - ((independent and $000000FF) shl 24)) -{$ENDIF} -end; - procedure initModule; -{$IFDEF DEBUGFILE}{$IFNDEF IPHONEOS}var i: LongInt;{$ENDIF}{$ENDIF} begin - Pathz:= cPathz; - {* REFERENCE - 4096 -> $FFFFF000 - 2048 -> $FFFFF800 - 1024 -> $FFFFFC00 - 512 -> $FFFFFE00 *} - if (cReducedQuality and rqLowRes) <> 0 then - begin - LAND_WIDTH:= 2048; - LAND_HEIGHT:= 1024; - LAND_WIDTH_MASK:= $FFFFF800; - LAND_HEIGHT_MASK:= $FFFFFC00; - end - else - begin - LAND_WIDTH:= 4096; - LAND_HEIGHT:= 2048; - LAND_WIDTH_MASK:= $FFFFF000; - LAND_HEIGHT_MASK:= $FFFFF800 - end; - - cDrownSpeed.QWordValue := 257698038; // 0.06 - cDrownSpeedf := 0.06; - cMaxWindSpeed.QWordValue:= 1073742; // 0.00025 - cWindSpeed.QWordValue := 429496; // 0.0001 - cWindSpeedf := 0.0001; - cGravity := cMaxWindSpeed * 2; - cGravityf := 0.00025 * 2; - cDamageModifier := _1; - TargetPoint := cTargetPointRef; - TextureList := nil; - - // int, longint longword and byte - CursorMovementX := 0; - CursorMovementY := 0; - GameTicks := 0; - TrainingTimeInc := 10000; - TrainingTimeInD := 500; - TrainingTimeInM := 5000; - TrainingTimeMax := 60000; - TimeTrialStartTime := 0; - TimeTrialStopTime := 0; - cWaterLine := LAND_HEIGHT; - cGearScrEdgesDist := 240; - - GameFlags := 0; - TrainingFlags := 0; - TurnTimeLeft := 0; - cSuddenDTurns := 15; - cDamagePercent := 100; - cMineDudPercent := 0; - cTemplateFilter := 0; - cMapGen := 0; // MAPGEN_REGULAR - cMazeSize := 0; - cHedgehogTurnTime := 45000; - cMinesTime := 3; - cMaxAIThinkTime := 9000; - cCloudsNumber := 9; - cHealthCaseProb := 35; - cHealthCaseAmount := 25; - cWaterRise := 47; - cHealthDecrease := 5; - - cTagsMask := 0; - KBnum := 0; - InitStepsFlags := 0; - RealTicks := 0; - AttackBar := 0; // 0 - none, 1 - just bar at the right-down corner, 2 - from weapon - cCaseFactor := 5; {0..9} - cLandMines := 4; - cExplosives := 2; - - GameState := Low(TGameState); - GameType := gmtLocal; - zoom := cDefaultZoomLevel; - ZoomValue := cDefaultZoomLevel; - WeaponTooltipTex:= nil; - cLaserSighting := false; - cVampiric := false; - cArtillery := false; - flagMakeCapture := false; - bBetweenTurns := false; - bWaterRising := false; - isCursorVisible := false; - isTerminated := false; - isInLag := false; - isPaused := false; - isInMultiShoot := false; - isSpeed := false; - fastUntilLag := false; - isFirstFrame := true; - isSEBackup := true; - cSeed := ''; - cVolumeDelta := 0; - cHasFocus := true; - cInactDelay := 1250; - ReadyTimeLeft := 0; - - ScreenFade := sfNone; - -{$IFDEF SDL13} - SDLwindow := nil; -{$ENDIF} - - // those values still aren't perfect - cLeftScreenBorder:= round(-cMinZoomLevel * cScreenWidth); - cRightScreenBorder:= round(cMinZoomLevel * cScreenWidth + LAND_WIDTH); - cScreenSpace:= cRightScreenBorder - cLeftScreenBorder; - - if isPhone() then - cMaxCaptions:= 3 - else - cMaxCaptions:= 4; - -{$IFDEF DEBUGFILE} -{$I-} -{$IFDEF IPHONEOS} - Assign(f,'../Documents/hw-' + cLogfileBase + '.log'); - Rewrite(f); -{$ELSE} - if (ParamStr(1) <> '') and (ParamStr(2) <> '') then - if (ParamCount <> 3) and (ParamCount <> cDefaultParamNum) then - begin - for i:= 0 to 7 do - begin - assign(f, ExtractFileDir(ParamStr(2)) + '/' + cLogfileBase + inttostr(i) + '.log'); - rewrite(f); - if IOResult = 0 then break; - end; - if IOResult <> 0 then f:= stderr; // if everything fails, write to stderr - end - else - begin - for i:= 0 to 7 do - begin - assign(f, ParamStr(1) + '/Logs/' + cLogfileBase + inttostr(i) + '.log'); - rewrite(f); - if IOResult = 0 then break; - end; - if IOResult <> 0 then f:= stderr; // if everything fails, write to stderr - end - else - f:= stderr; -{$ENDIF} -{$I+} -{$ENDIF} - end; procedure freeModule; begin recordFileName:= ''; - while TextureList <> nil do FreeTexture(TextureList); - -{$IFDEF DEBUGFILE} - writeln(f, 'halt at ', GameTicks, ' ticks. TurnTimeLeft = ', TurnTimeLeft); - flush(f); - close(f); -{$ENDIF} - - // re-init flags so they will always contain safe values - cScreenWidth := 1024; - cScreenHeight := 768; - cBits := 32; - //ipcPort is in uIO - cFullScreen := false; - isSoundEnabled := true; - isMusicEnabled := false; - cLocaleFName := 'en.txt'; - cInitVolume := 100; - cTimerInterval := 8; - PathPrefix := './'; - cShowFPS := false; - cAltDamage := true; - cReducedQuality := rqNone; - //userNick is in uChat - recordFileName := ''; - cReadyDelay := 0; end; end. diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uMobile.pas --- a/hedgewars/uMobile.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uMobile.pas Thu Nov 18 16:58:08 2010 -0500 @@ -42,7 +42,6 @@ procedure perfExt_SaveFinishedSynching; inline; implementation -uses uTeams, uConsole; function isPhone: Boolean; inline; begin diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uRandom.pas --- a/hedgewars/uRandom.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uRandom.pas Thu Nov 18 16:58:08 2010 -0500 @@ -30,12 +30,8 @@ function GetRandom: hwFloat; overload; function GetRandom(m: LongWord): LongWord; overload; function rndSign(num: hwFloat): hwFloat; -{$IFDEF DEBUGFILE} -procedure DumpBuffer; -{$ENDIF} implementation -uses uMisc; var cirbuf: array[0..63] of Longword; n: byte; @@ -76,7 +72,6 @@ function GetRandom(m: LongWord): LongWord; begin -TryDo((m > 0),'GetRandom(0) called! Please report this to the developers!',true); GetNext; GetRandom:= GetNext mod m end; @@ -87,15 +82,6 @@ rndSign:= num end; -{$IFDEF DEBUGFILE} -procedure DumpBuffer; -var i: LongInt; -begin -for i:= 0 to 63 do - AddFileLog('[' + inttostr(i) + '] = ' + inttostr(cirbuf[i])) -end; -{$ENDIF} - procedure initModule; begin n:= 54; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uRender.pas --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hedgewars/uRender.pas Thu Nov 18 16:58:08 2010 -0500 @@ -0,0 +1,388 @@ +{$INCLUDE "options.inc"} +unit uRender; + +interface + +uses SDLh, uTypes, GLunit; + +procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt); +procedure DrawFromRect(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture); +procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); +procedure DrawSprite (Sprite: TSprite; X, Y, Frame: LongInt); +procedure DrawSprite2(Sprite: TSprite; X, Y, FrameX, FrameY: LongInt); +procedure DrawSpriteClipped(Sprite: TSprite; X, Y, TopY, RightX, BottomY, LeftX: LongInt); +procedure DrawTexture(X, Y: LongInt; Texture: PTexture; Scale: GLfloat = 1.0); +procedure DrawTextureF(Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt); +procedure DrawRotatedTextureF(Texture: PTexture; Scale, OffsetX, OffsetY: GLfloat; X, Y, Frame, Dir, w, h: LongInt; Angle: real); +procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real); +procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real); +procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real); +procedure DrawCentered(X, Top: LongInt; Source: PTexture); +procedure DrawLine(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte); +procedure DrawFillRect(r: TSDL_Rect); +procedure DrawCircle(X, Y, Radius: LongInt; Width: Single; r, g, b, a: Byte); +procedure Tint(r, g, b, a: Byte); inline; +procedure Tint(c: Longword); inline; + +implementation +uses uVariables; +var + lastTint: Longword; + +procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt); +begin +r.y:= r.y + Height * Position; +r.h:= Height; +DrawFromRect(X, Y, @r, SpritesData[Sprite].Texture) +end; + +procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); +begin +DrawFromRect(X, Y, r^.w, r^.h, r, SourceTexture) +end; + +procedure DrawFromRect(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture); +var rr: TSDL_Rect; + _l, _r, _t, _b: real; + VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; +begin +if (SourceTexture^.h = 0) or (SourceTexture^.w = 0) then exit; + +// don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) +if (abs(X) > W) and ((abs(X + W / 2) - W / 2) > cScreenWidth / cScaleFactor) then + exit; +if (abs(Y) > H) and ((abs(Y + H / 2 - (0.5 * cScreenHeight)) - H / 2) > cScreenHeight / cScaleFactor) then + exit; + +rr.x:= X; +rr.y:= Y; +rr.w:= W; +rr.h:= H; + +_l:= r^.x / SourceTexture^.w * SourceTexture^.rx; +_r:= (r^.x + r^.w) / SourceTexture^.w * SourceTexture^.rx; +_t:= r^.y / SourceTexture^.h * SourceTexture^.ry; +_b:= (r^.y + r^.h) / SourceTexture^.h * SourceTexture^.ry; + +glBindTexture(GL_TEXTURE_2D, SourceTexture^.id); + +VertexBuffer[0].X:= X; +VertexBuffer[0].Y:= Y; +VertexBuffer[1].X:= rr.w + X; +VertexBuffer[1].Y:= Y; +VertexBuffer[2].X:= rr.w + X; +VertexBuffer[2].Y:= rr.h + Y; +VertexBuffer[3].X:= X; +VertexBuffer[3].Y:= rr.h + Y; + +TextureBuffer[0].X:= _l; +TextureBuffer[0].Y:= _t; +TextureBuffer[1].X:= _r; +TextureBuffer[1].Y:= _t; +TextureBuffer[2].X:= _r; +TextureBuffer[2].Y:= _b; +TextureBuffer[3].X:= _l; +TextureBuffer[3].Y:= _b; + + +glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); +glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]); +glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); +end; + + +procedure DrawTexture(X, Y: LongInt; Texture: PTexture; Scale: GLfloat); +begin + +glPushMatrix; +glTranslatef(X, Y, 0); +glScalef(Scale, Scale, 1); + +glBindTexture(GL_TEXTURE_2D, Texture^.id); + +glVertexPointer(2, GL_FLOAT, 0, @Texture^.vb); +glTexCoordPointer(2, GL_FLOAT, 0, @Texture^.tb); +glDrawArrays(GL_TRIANGLE_FAN, 0, Length(Texture^.vb)); + +glPopMatrix +end; + +procedure DrawTextureF(Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt); +begin + DrawRotatedTextureF(Texture, Scale, 0, 0, X, Y, Frame, Dir, w, h, 0) +end; + +procedure DrawRotatedTextureF(Texture: PTexture; Scale, OffsetX, OffsetY: GLfloat; X, Y, Frame, Dir, w, h: LongInt; Angle: real); +var ft, fb, fl, fr: GLfloat; + hw, nx, ny: LongInt; + VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; +begin +// don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) +if (abs(X) > W) and ((abs(X + dir * OffsetX) - W / 2) * cScaleFactor > cScreenWidth) then + exit; +if (abs(Y) > H) and ((abs(Y + OffsetY - (0.5 * cScreenHeight)) - W / 2) * cScaleFactor > cScreenHeight) then + exit; + +glPushMatrix; +glTranslatef(X, Y, 0); + +if Dir < 0 then + glRotatef(Angle, 0, 0, -1) +else + glRotatef(Angle, 0, 0, 1); + +glTranslatef(Dir*OffsetX, OffsetY, 0); +glScalef(Scale, Scale, 1); + +// Any reason for this call? And why only in t direction, not s? +//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + +if Dir < 0 then + hw:= w div -2 +else + hw:= w div 2; + +nx:= round(Texture^.w / w); // number of horizontal frames +ny:= round(Texture^.h / h); // number of vertical frames + +ft:= (Frame mod ny) * Texture^.ry / ny; +fb:= ((Frame mod ny) + 1) * Texture^.ry / ny; +fl:= (Frame div ny) * Texture^.rx / nx; +fr:= ((Frame div ny) + 1) * Texture^.rx / nx; + +glBindTexture(GL_TEXTURE_2D, Texture^.id); + +VertexBuffer[0].X:= -hw; +VertexBuffer[0].Y:= w / -2; +VertexBuffer[1].X:= hw; +VertexBuffer[1].Y:= w / -2; +VertexBuffer[2].X:= hw; +VertexBuffer[2].Y:= w / 2; +VertexBuffer[3].X:= -hw; +VertexBuffer[3].Y:= w / 2; + +TextureBuffer[0].X:= fl; +TextureBuffer[0].Y:= ft; +TextureBuffer[1].X:= fr; +TextureBuffer[1].Y:= ft; +TextureBuffer[2].X:= fr; +TextureBuffer[2].Y:= fb; +TextureBuffer[3].X:= fl; +TextureBuffer[3].Y:= fb; + +glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); +glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]); +glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); + +glPopMatrix +end; + +procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real); +begin + DrawRotatedTex(SpritesData[Sprite].Texture, + SpritesData[Sprite].Width, + SpritesData[Sprite].Height, + X, Y, Dir, Angle) +end; + +procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real); +begin +glPushMatrix; +glTranslatef(X, Y, 0); + +if Dir < 0 then + glRotatef(Angle, 0, 0, -1) +else + glRotatef(Angle, 0, 0, 1); +if Dir < 0 then glScalef(-1.0, 1.0, 1.0); + +DrawSprite(Sprite, -SpritesData[Sprite].Width div 2, -SpritesData[Sprite].Height div 2, Frame); + +glPopMatrix +end; + +procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real); +var VertexBuffer: array [0..3] of TVertex2f; +begin +// don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) +if (abs(X) > 2 * hw) and ((abs(X) - hw) > cScreenWidth / cScaleFactor) then + exit; +if (abs(Y) > 2 * hh) and ((abs(Y - 0.5 * cScreenHeight) - hh) > cScreenHeight / cScaleFactor) then + exit; + +glPushMatrix; +glTranslatef(X, Y, 0); + +if Dir < 0 then + begin + hw:= - hw; + glRotatef(Angle, 0, 0, -1); + end else + glRotatef(Angle, 0, 0, 1); + + +glBindTexture(GL_TEXTURE_2D, Tex^.id); + +VertexBuffer[0].X:= -hw; +VertexBuffer[0].Y:= -hh; +VertexBuffer[1].X:= hw; +VertexBuffer[1].Y:= -hh; +VertexBuffer[2].X:= hw; +VertexBuffer[2].Y:= hh; +VertexBuffer[3].X:= -hw; +VertexBuffer[3].Y:= hh; + +glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); +glTexCoordPointer(2, GL_FLOAT, 0, @Tex^.tb); +glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); + +glPopMatrix +end; + +procedure DrawSprite (Sprite: TSprite; X, Y, Frame: LongInt); +var row, col, numFramesFirstCol: LongInt; +begin +numFramesFirstCol:= SpritesData[Sprite].imageHeight div SpritesData[Sprite].Height; +row:= Frame mod numFramesFirstCol; +col:= Frame div numFramesFirstCol; +DrawSprite2 (Sprite, X, Y, col, row); +end; + +procedure DrawSpriteClipped(Sprite: TSprite; X, Y, TopY, RightX, BottomY, LeftX: LongInt); +var r: TSDL_Rect; +begin +r.x:= 0; +r.y:= 0; +r.w:= SpritesData[Sprite].Width; +r.h:= SpritesData[Sprite].Height; + +if (X < LeftX) then + r.x:= LeftX - X; +if (Y < TopY) then + r.y:= TopY - Y; + +if (Y + SpritesData[Sprite].Height > BottomY) then + r.h:= BottomY - Y + 1; +if (X + SpritesData[Sprite].Width > RightX) then + r.w:= RightX - X + 1; + +dec(r.h, r.y); +dec(r.w, r.x); + +DrawFromRect(X + r.x, Y + r.y, @r, SpritesData[Sprite].Texture) +end; + +procedure DrawSprite2(Sprite: TSprite; X, Y, FrameX, FrameY: LongInt); +var r: TSDL_Rect; +begin + r.x:= FrameX * SpritesData[Sprite].Width; + r.w:= SpritesData[Sprite].Width; + r.y:= FrameY * SpritesData[Sprite].Height; + r.h:= SpritesData[Sprite].Height; + DrawFromRect(X, Y, @r, SpritesData[Sprite].Texture) +end; + +procedure DrawCentered(X, Top: LongInt; Source: PTexture); +var scale: GLfloat; +begin + if (Source^.w + 20) > cScreenWidth then + scale:= cScreenWidth / (Source^.w + 20) + else + scale:= 1.0; + DrawTexture(X - round(Source^.w * scale) div 2, Top, Source, scale) +end; + +procedure DrawLine(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte); +var VertexBuffer: array [0..3] of TVertex2f; +begin + glDisable(GL_TEXTURE_2D); + glEnable(GL_LINE_SMOOTH); + + glPushMatrix; + glTranslatef(WorldDx, WorldDy, 0); + glLineWidth(Width); + + Tint(r, g, b, a); + VertexBuffer[0].X:= X0; + VertexBuffer[0].Y:= Y0; + VertexBuffer[1].X:= X1; + VertexBuffer[1].Y:= Y1; + + glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); + glDrawArrays(GL_LINES, 0, Length(VertexBuffer)); + Tint($FF, $FF, $FF, $FF); + + glPopMatrix; + + glEnable(GL_TEXTURE_2D); + glDisable(GL_LINE_SMOOTH); +end; + +procedure DrawFillRect(r: TSDL_Rect); +var VertexBuffer: array [0..3] of TVertex2f; +begin +// don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) +if (abs(r.x) > r.w) and ((abs(r.x + r.w / 2) - r.w / 2) * cScaleFactor > cScreenWidth) then + exit; +if (abs(r.y) > r.h) and ((abs(r.y + r.h / 2 - (0.5 * cScreenHeight)) - r.h / 2) * cScaleFactor > cScreenHeight) then + exit; + +glDisable(GL_TEXTURE_2D); + +Tint($00, $00, $00, $80); + +VertexBuffer[0].X:= r.x; +VertexBuffer[0].Y:= r.y; +VertexBuffer[1].X:= r.x + r.w; +VertexBuffer[1].Y:= r.y; +VertexBuffer[2].X:= r.x + r.w; +VertexBuffer[2].Y:= r.y + r.h; +VertexBuffer[3].X:= r.x; +VertexBuffer[3].Y:= r.y + r.h; + +glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); +glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); + +Tint($FF, $FF, $FF, $FF); +glEnable(GL_TEXTURE_2D) +end; + +procedure DrawCircle(X, Y, Radius: LongInt; Width: Single; r, g, b, a: Byte); +var + i: LongInt; + CircleVertex: array [0..359] of TVertex2f; +begin + for i := 0 to 359 do begin + CircleVertex[i].X := X + Radius*cos(i*pi/180); + CircleVertex[i].Y := Y + Radius*sin(i*pi/180); + end; + glDisable(GL_TEXTURE_2D); + glEnable(GL_LINE_SMOOTH); + glPushMatrix; + glLineWidth(Width); + Tint(r, g, b, a); + glVertexPointer(2, GL_FLOAT, 0, @CircleVertex[0]); + glDrawArrays(GL_LINE_LOOP, 0, 360); + Tint($FF, $FF, $FF, $FF); + glPopMatrix; + glEnable(GL_TEXTURE_2D); + glDisable(GL_LINE_SMOOTH); +end; + + +procedure Tint(r, g, b, a: Byte); inline; +var nc: Longword; +begin +nc:= (a shl 24) or (b shl 16) or (g shl 8) or r; +if nc = lastTint then + exit; +glColor4ub(r, g, b, a); +lastTint:= nc; +end; + +procedure Tint(c: Longword); inline; +begin +Tint(((c shr 16) and $FF), ((c shr 8) and $FF), (c and $FF), $FF); +end; + +end. diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uRenderUtils.pas --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hedgewars/uRenderUtils.pas Thu Nov 18 16:58:08 2010 -0500 @@ -0,0 +1,356 @@ +{$INCLUDE "options.inc"} +unit uRenderUtils; + +interface +uses SDLh, uTypes; + +procedure flipSurface(Surface: PSDL_Surface; Vertical: Boolean); +procedure copyRotatedSurface(src, dest: PSDL_Surface); // this is necessary since width/height are read only in SDL +procedure copyToXY(src, dest: PSDL_Surface; destX, destY: LongInt); +function RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture; +function RenderSpeechBubbleTex(s: ansistring; SpeechType: Longword; font: THWFont): PTexture; +procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean); + +implementation +uses uIO, uUtils, uVariables, uConsts, uTextures, sysutils; + +procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean); +var r: TSDL_Rect; +begin + r:= rect^; + if Clear then SDL_FillRect(Surface, @r, 0); + + BorderColor:= SDL_MapRGB(Surface^.format, BorderColor shr 16, BorderColor shr 8, BorderColor and $FF); + FillColor:= SDL_MapRGB(Surface^.format, FillColor shr 16, FillColor shr 8, FillColor and $FF); + + r.y:= rect^.y + 1; + r.h:= rect^.h - 2; + SDL_FillRect(Surface, @r, BorderColor); + r.x:= rect^.x + 1; + r.w:= rect^.w - 2; + r.y:= rect^.y; + r.h:= rect^.h; + SDL_FillRect(Surface, @r, BorderColor); + r.x:= rect^.x + 2; + r.y:= rect^.y + 1; + r.w:= rect^.w - 4; + r.h:= rect^.h - 2; + SDL_FillRect(Surface, @r, FillColor); + r.x:= rect^.x + 1; + r.y:= rect^.y + 2; + r.w:= rect^.w - 2; + r.h:= rect^.h - 4; + SDL_FillRect(Surface, @r, FillColor) +end; + +function WriteInRoundRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: ansistring): TSDL_Rect; +var w, h: LongInt; + tmpsurf: PSDL_Surface; + clr: TSDL_Color; + finalRect: TSDL_Rect; +begin + TTF_SizeUTF8(Fontz[Font].Handle, Str2PChar(s), w, h); + finalRect.x:= X; + finalRect.y:= Y; + finalRect.w:= w + FontBorder * 2 + 4; + finalRect.h:= h + FontBorder * 2; + DrawRoundRect(@finalRect, cWhiteColor, endian(cNearBlackColorChannels.value), Surface, true); + clr.r:= (Color shr 16) and $FF; + clr.g:= (Color shr 8) and $FF; + clr.b:= Color and $FF; + tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(s), clr); + finalRect.x:= X + FontBorder + 2; + finalRect.y:= Y + FontBorder; + SDLTry(tmpsurf <> nil, true); + SDL_UpperBlit(tmpsurf, nil, Surface, @finalRect); + SDL_FreeSurface(tmpsurf); + finalRect.x:= X; + finalRect.y:= Y; + finalRect.w:= w + FontBorder * 2 + 4; + finalRect.h:= h + FontBorder * 2; + WriteInRoundRect:= finalRect; +end; + +procedure flipSurface(Surface: PSDL_Surface; Vertical: Boolean); +var y, x, i, j: LongInt; + tmpPixel: Longword; + pixels: PLongWordArray; +begin + TryDo(Surface^.format^.BytesPerPixel = 4, 'flipSurface failed, expecting 32 bit surface', true); + pixels:= Surface^.pixels; + if Vertical then + for y := 0 to (Surface^.h div 2) - 1 do + for x := 0 to Surface^.w - 1 do + begin + i:= y * Surface^.w + x; + j:= (Surface^.h - y - 1) * Surface^.w + x; + tmpPixel:= pixels^[i]; + pixels^[i]:= pixels^[j]; + pixels^[j]:= tmpPixel; + end + else + for x := 0 to (Surface^.w div 2) - 1 do + for y := 0 to Surface^.h -1 do + begin + i:= y*Surface^.w + x; + j:= y*Surface^.w + (Surface^.w - x - 1); + tmpPixel:= pixels^[i]; + pixels^[i]:= pixels^[j]; + pixels^[j]:= tmpPixel; + end; +end; + +procedure copyToXY(src, dest: PSDL_Surface; destX, destY: LongInt); +var srcX, srcY, i, j, maxDest: LongInt; + srcPixels, destPixels: PLongWordArray; + r0, g0, b0, a0, r1, g1, b1, a1: Byte; +begin + maxDest:= (dest^.pitch div 4) * dest^.h; + srcPixels:= src^.pixels; + destPixels:= dest^.pixels; + + for srcX:= 0 to src^.w - 1 do + for srcY:= 0 to src^.h - 1 do + begin + i:= (destY + srcY) * (dest^.pitch div 4) + destX + srcX; + j:= srcY * (src^.pitch div 4) + srcX; + if (i < maxDest) and (srcPixels^[j] and AMask <> 0) then + begin + SDL_GetRGBA(destPixels^[i], dest^.format, @r0, @g0, @b0, @a0); + SDL_GetRGBA(srcPixels^[j], src^.format, @r1, @g1, @b1, @a1); + r0:= (r0 * (255 - LongInt(a1)) + r1 * LongInt(a1)) div 255; + g0:= (g0 * (255 - LongInt(a1)) + g1 * LongInt(a1)) div 255; + b0:= (b0 * (255 - LongInt(a1)) + b1 * LongInt(a1)) div 255; + a0:= (a0 * (255 - LongInt(a1)) + a1 * LongInt(a1)) div 255; + destPixels^[i]:= SDL_MapRGBA(dest^.format, r0, g0, b0, a0); + end; + end; +end; + +procedure copyRotatedSurface(src, dest: PSDL_Surface); // this is necessary since width/height are read only in SDL, apparently +var y, x, i, j: LongInt; + srcPixels, destPixels: PLongWordArray; +begin + TryDo(src^.format^.BytesPerPixel = 4, 'rotateSurface failed, expecting 32 bit surface', true); + TryDo(dest^.format^.BytesPerPixel = 4, 'rotateSurface failed, expecting 32 bit surface', true); + + srcPixels:= src^.pixels; + destPixels:= dest^.pixels; + + j:= 0; + for x := 0 to src^.w - 1 do + for y := 0 to src^.h - 1 do + begin + i:= (src^.h - 1 - y) * (src^.pitch div 4) + x; + destPixels^[j]:= srcPixels^[i]; + inc(j) + end; +end; + +function RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture; +var w, h: LongInt; + finalSurface: PSDL_Surface; +begin + if length(s) = 0 then s:= ' '; + font:= CheckCJKFont(s, font); + w:= 0; h:= 0; // avoid compiler hints + TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(s), w, h); + + finalSurface:= SDL_CreateRGBSurface(SDL_SWSURFACE, w + FontBorder * 2 + 4, h + FontBorder * 2, + 32, RMask, GMask, BMask, AMask); + + TryDo(finalSurface <> nil, 'RenderString: fail to create surface', true); + + WriteInRoundRect(finalSurface, 0, 0, Color, font, s); + + TryDo(SDL_SetColorKey(finalSurface, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); + + RenderStringTex:= Surface2Tex(finalSurface, false); + + SDL_FreeSurface(finalSurface); +end; + + +function RenderSpeechBubbleTex(s: ansistring; SpeechType: Longword; font: THWFont): PTexture; +var textWidth, textHeight, x, y, w, h, i, j, pos, prevpos, line, numLines, edgeWidth, edgeHeight, cornerWidth, cornerHeight: LongInt; + finalSurface, tmpsurf, rotatedEdge: PSDL_Surface; + rect: TSDL_Rect; + chars: set of char = [#9,' ','.',';',':','?','!',',']; + substr: shortstring; + edge, corner, tail: TSPrite; +begin + case SpeechType of + 1: begin; + edge:= sprSpeechEdge; + corner:= sprSpeechCorner; + tail:= sprSpeechTail; + end; + 2: begin; + edge:= sprThoughtEdge; + corner:= sprThoughtCorner; + tail:= sprThoughtTail; + end; + 3: begin; + edge:= sprShoutEdge; + corner:= sprShoutCorner; + tail:= sprShoutTail; + end; + end; + edgeHeight:= SpritesData[edge].Height; + edgeWidth:= SpritesData[edge].Width; + cornerWidth:= SpritesData[corner].Width; + cornerHeight:= SpritesData[corner].Height; + // This one screws up WrapText + //s:= 'This is the song that never ends. ''cause it goes on and on my friends. Some people, started singing it not knowing what it was. And they''ll just go on singing it forever just because... This is the song that never ends...'; + // This one does not + //s:= 'This is the song that never ends. cause it goes on and on my friends. Some people, started singing it not knowing what it was. And they will go on singing it forever just because... This is the song that never ends... '; + + numLines:= 0; + + if length(s) = 0 then s:= '...'; + font:= CheckCJKFont(s, font); + w:= 0; h:= 0; // avoid compiler hints + TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(s), w, h); + if w<8 then w:= 8; + j:= 0; + if (length(s) > 20) then + begin + w:= 0; + i:= round(Sqrt(length(s)) * 2); + s:= WrapText(s, #1, chars, i); + pos:= 1; prevpos:= 0; line:= 0; + // Find the longest line for the purposes of centring the text. Font dependant. + while pos <= length(s) do + begin + if (s[pos] = #1) or (pos = length(s)) then + begin + inc(numlines); + if s[pos] <> #1 then inc(pos); + while s[prevpos+1] = ' ' do inc(prevpos); + substr:= copy(s, prevpos+1, pos-prevpos-1); + i:= 0; j:= 0; + TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(substr), i, j); + if i > w then w:= i; + prevpos:= pos; + end; + inc(pos); + end; + end + else numLines := 1; + + textWidth:=((w-(cornerWidth-edgeWidth)*2) div edgeWidth)*edgeWidth+edgeWidth; + textHeight:=(((numlines * h + 2)-((cornerHeight-edgeWidth)*2)) div edgeWidth)*edgeWidth; + + textHeight:=max(textHeight,edgeWidth); + //textWidth:=max(textWidth,SpritesData[tail].Width); + rect.x:= 0; + rect.y:= 0; + rect.w:= textWidth + (cornerWidth * 2); + rect.h:= textHeight + cornerHeight*2 - edgeHeight + SpritesData[tail].Height; + //s:= inttostr(w) + ' ' + inttostr(numlines) + ' ' + inttostr(rect.x) + ' '+inttostr(rect.y) + ' ' + inttostr(rect.w) + ' ' + inttostr(rect.h); + + finalSurface:= SDL_CreateRGBSurface(SDL_SWSURFACE, rect.w, rect.h, 32, RMask, GMask, BMask, AMask); + + TryDo(finalSurface <> nil, 'RenderString: fail to create surface', true); + + //////////////////////////////// CORNERS /////////////////////////////// + copyToXY(SpritesData[corner].Surface, finalSurface, 0, 0); /////////////////// NW + + flipSurface(SpritesData[corner].Surface, true); // store all 4 versions in memory to avoid repeated flips? + x:= 0; + y:= textHeight + cornerHeight -1; + copyToXY(SpritesData[corner].Surface, finalSurface, x, y); /////////////////// SW + + flipSurface(SpritesData[corner].Surface, false); + x:= rect.w-cornerWidth-1; + y:= textHeight + cornerHeight -1; + copyToXY(SpritesData[corner].Surface, finalSurface, x, y); /////////////////// SE + + flipSurface(SpritesData[corner].Surface, true); + x:= rect.w-cornerWidth-1; + y:= 0; + copyToXY(SpritesData[corner].Surface, finalSurface, x, y); /////////////////// NE + flipSurface(SpritesData[corner].Surface, false); // restore original position + //////////////////////////////// END CORNERS /////////////////////////////// + + //////////////////////////////// EDGES ////////////////////////////////////// + x:= cornerWidth; + y:= 0; + while x < rect.w-cornerWidth-1 do + begin + copyToXY(SpritesData[edge].Surface, finalSurface, x, y); ///////////////// top edge + inc(x,edgeWidth); + end; + flipSurface(SpritesData[edge].Surface, true); + x:= cornerWidth; + y:= textHeight + cornerHeight*2 - edgeHeight-1; + while x < rect.w-cornerWidth-1 do + begin + copyToXY(SpritesData[edge].Surface, finalSurface, x, y); ///////////////// bottom edge + inc(x,edgeWidth); + end; + flipSurface(SpritesData[edge].Surface, true); // restore original position + + rotatedEdge:= SDL_CreateRGBSurface(SDL_SWSURFACE, edgeHeight, edgeWidth, 32, RMask, GMask, BMask, AMask); + x:= rect.w - edgeHeight - 1; + y:= cornerHeight; + //// initially was going to rotate in place, but the SDL spec claims width/height are read only + copyRotatedSurface(SpritesData[edge].Surface,rotatedEdge); + while y < textHeight + cornerHeight do + begin + copyToXY(rotatedEdge, finalSurface, x, y); + inc(y,edgeWidth); + end; + flipSurface(rotatedEdge, false); // restore original position + x:= 0; + y:= cornerHeight; + while y < textHeight + cornerHeight do + begin + copyToXY(rotatedEdge, finalSurface, x, y); + inc(y,edgeWidth); + end; + //////////////////////////////// END EDGES ////////////////////////////////////// + + x:= cornerWidth; + y:= textHeight + cornerHeight * 2 - edgeHeight - 1; + copyToXY(SpritesData[tail].Surface, finalSurface, x, y); + + rect.x:= edgeHeight; + rect.y:= edgeHeight; + rect.w:= rect.w - edgeHeight * 2; + rect.h:= textHeight + cornerHeight * 2 - edgeHeight * 2; + i:= rect.w; + j:= rect.h; + SDL_FillRect(finalSurface, @rect, cWhiteColor); + + pos:= 1; prevpos:= 0; line:= 0; + while pos <= length(s) do + begin + if (s[pos] = #1) or (pos = length(s)) then + begin + if s[pos] <> #1 then inc(pos); + while s[prevpos+1] = ' 'do inc(prevpos); + substr:= copy(s, prevpos+1, pos-prevpos-1); + if Length(substr) <> 0 then + begin + tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(substr), cNearBlackColorChannels); + rect.x:= edgeHeight + 1 + ((i - w) div 2); + // trying to more evenly position the text, vertically + rect.y:= edgeHeight + ((j-(numLines*h)) div 2) + line * h; + SDLTry(tmpsurf <> nil, true); + SDL_UpperBlit(tmpsurf, nil, finalSurface, @rect); + SDL_FreeSurface(tmpsurf); + inc(line); + prevpos:= pos; + end; + end; + inc(pos); + end; + + RenderSpeechBubbleTex:= Surface2Tex(finalSurface, true); + + SDL_FreeSurface(rotatedEdge); + SDL_FreeSurface(finalSurface); +end; + +end. \ No newline at end of file diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uScript.pas --- a/hedgewars/uScript.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uScript.pas Thu Nov 18 16:58:08 2010 -0500 @@ -41,7 +41,6 @@ {$IFNDEF LUA_DISABLED} uses LuaPas in 'LuaPas.pas', uConsole, - uMisc, uConsts, uVisualGears, uGears, @@ -49,11 +48,14 @@ uWorld, uAmmos, uSound, - uTeams, - uKeys, uChat, uStats, - uRandom; + uRandom, + uTypes, + uVariables, + uCommands, + uUtils, + uIO; var luaState : Plua_State; ScriptAmmoLoadout : shortstring; @@ -299,7 +301,7 @@ else begin gear := GearByUID(lua_tointeger(L, 1)); if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then - lua_pushinteger(L, PHedgehog(gear^.Hedgehog)^.BotLevel) + lua_pushinteger(L, gear^.Hedgehog^.BotLevel) else lua_pushnil(L); end; @@ -319,7 +321,7 @@ gear:= GearByUID(lua_tointeger(L, 1)); if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then begin - lua_pushinteger(L, PHedgehog(gear^.Hedgehog)^.Team^.Clan^.ClanIndex) + lua_pushinteger(L, gear^.Hedgehog^.Team^.Clan^.ClanIndex) end else lua_pushnil(L); @@ -340,7 +342,7 @@ gear:= GearByUID(lua_tointeger(L, 1)); if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then begin - lua_pushstring(L, str2pchar(PHedgehog(gear^.Hedgehog)^.Team^.TeamName)) + lua_pushstring(L, str2pchar(gear^.Hedgehog^.Team^.TeamName)) end else lua_pushnil(L); @@ -361,7 +363,7 @@ gear:= GearByUID(lua_tointeger(L, 1)); if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then begin - lua_pushstring(L, str2pchar(PHedgehog(gear^.Hedgehog)^.Name)) + lua_pushstring(L, str2pchar(gear^.Hedgehog^.Name)) end else lua_pushnil(L); @@ -570,7 +572,7 @@ else begin gear := GearByUID(lua_tointeger(L, 1)); if gear <> nil then - PHedgehog(gear^.Hedgehog)^.Effects[THogEffect(lua_tointeger(L, 2))]:= lua_tointeger(L, 3) <> 0; + gear^.Hedgehog^.Effects[THogEffect(lua_tointeger(L, 2))]:= lua_tointeger(L, 3) <> 0; end; lc_seteffect := 0; end; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uSound.pas --- a/hedgewars/uSound.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uSound.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,13 +20,7 @@ unit uSound; interface -uses SDLh, uConsts; - -type PVoicepack = ^TVoicepack; - TVoicepack = record - name: shortstring; - chunks: array [TSound] of PMixChunk; - end; +uses SDLh, uConsts, uTypes; var MusicFN: shortstring; @@ -52,7 +46,7 @@ implementation -uses uMisc, uConsole; +uses uMisc, uVariables, uConsole, uUtils, uIO; const chanTPU = 32; var Volume: LongInt; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uStats.pas --- a/hedgewars/uStats.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uStats.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,27 +20,7 @@ unit uStats; interface -uses uGears, uConsts; - -type TStatistics = record - DamageRecv, - DamageGiven: Longword; - StepDamageRecv, - StepDamageGiven, - StepKills: Longword; - MaxStepDamageRecv, - MaxStepDamageGiven, - MaxStepKills: Longword; - FinishedTurns: Longword; - end; - -type TTeamStats = record - Kills : Longword; - AIKills : Longword; - TeamKills : Longword; - TurnSkips : Longword; - TeamDamage : Longword; -end; +uses uConsts, uTypes; var TotalRounds: LongInt; FinishedTurnsTotal: LongInt; @@ -55,7 +35,8 @@ procedure SendStats; implementation -uses uTeams, uSound, uMisc, uLocale, uWorld; +uses uTeams, uSound, uLocale, uWorld, uVariables, uUtils, uIO; + var DamageGiven : Longword = 0; DamageClan : Longword = 0; DamageTotal : Longword = 0; @@ -71,10 +52,10 @@ procedure HedgehogDamaged(Gear: PGear); begin -if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then +if CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then vpHurtSameClan:= CurrentHedgehog^.Team^.voicepack else - vpHurtEnemy:= PHedgehog(Gear^.Hedgehog)^.Team^.voicepack; + vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack; if bBetweenTurns then exit; @@ -83,7 +64,7 @@ if Gear <> CurrentHedgehog^.Gear then inc(CurrentHedgehog^.stats.StepDamageGiven, Gear^.Damage); -if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then inc(DamageClan, Gear^.Damage); +if CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(DamageClan, Gear^.Damage); if Gear^.Health <= Gear^.Damage then begin @@ -92,14 +73,14 @@ inc(KillsTotal); inc(CurrentHedgehog^.Team^.stats.Kills); if (CurrentHedgehog^.Team^.TeamName = - PHedgehog(Gear^.Hedgehog)^.Team^.TeamName) then begin + Gear^.Hedgehog^.Team^.TeamName) then begin inc(CurrentHedgehog^.Team^.stats.TeamKills); inc(CurrentHedgehog^.Team^.stats.TeamDamage, Gear^.Damage); end; - if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then inc(KillsClan); + if CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(KillsClan); end; -inc(PHedgehog(Gear^.Hedgehog)^.stats.StepDamageRecv, Gear^.Damage); +inc(Gear^.Hedgehog^.stats.StepDamageRecv, Gear^.Damage); inc(DamageGiven, Gear^.Damage); inc(DamageTotal, Gear^.Damage) end; @@ -177,7 +158,7 @@ for t:= 0 to Pred(ClansCount) do with ClansArray[t]^ do begin - SendStat(siClanHealth, inttostr(Color) + ' ' + inttostr(ClanHealth)); + SendStat(siClanHealth, IntToStr(Color) + ' ' + IntToStr(ClanHealth)); end; Kills:= 0; @@ -237,8 +218,8 @@ { send player stats for winner teams } if Clan^.ClanHealth > 0 then begin - SendStat(siPlayerKills, inttostr(Clan^.Color) + ' ' + - inttostr(stats.Kills) + ' ' + TeamName); + SendStat(siPlayerKills, IntToStr(Clan^.Color) + ' ' + + IntToStr(stats.Kills) + ' ' + TeamName); end; { determine maximum values of TeamKills, TurnSkips, TeamDamage } @@ -261,25 +242,25 @@ for t:= 0 to Pred(TeamsCount) do begin with TeamsArray[t]^ do begin if Clan^.ClanHealth = 0 then begin - SendStat(siPlayerKills, inttostr(Clan^.Color) + ' ' + - inttostr(stats.Kills) + ' ' + TeamName); + SendStat(siPlayerKills, IntToStr(Clan^.Color) + ' ' + + IntToStr(stats.Kills) + ' ' + TeamName); end; end; end; if msdhh <> nil then - SendStat(siMaxStepDamage, inttostr(msd) + ' ' + msdhh^.Name + ' (' + msdhh^.Team^.TeamName + ')'); + SendStat(siMaxStepDamage, IntToStr(msd) + ' ' + msdhh^.Name + ' (' + msdhh^.Team^.TeamName + ')'); if mskcnt = 1 then - SendStat(siMaxStepKills, inttostr(msk) + ' ' + mskhh^.Name + ' (' + mskhh^.Team^.TeamName + ')'); + SendStat(siMaxStepKills, IntToStr(msk) + ' ' + mskhh^.Name + ' (' + mskhh^.Team^.TeamName + ')'); if maxTeamKills > 1 then - SendStat(siMaxTeamKills, inttostr(maxTeamKills) + ' ' + maxTeamKillsName); + SendStat(siMaxTeamKills, IntToStr(maxTeamKills) + ' ' + maxTeamKillsName); if maxTurnSkips > 2 then - SendStat(siMaxTurnSkips, inttostr(maxTurnSkips) + ' ' + maxTurnSkipsName); + SendStat(siMaxTurnSkips, IntToStr(maxTurnSkips) + ' ' + maxTurnSkipsName); if maxTeamDamage > 30 then - SendStat(siMaxTeamDamage, inttostr(maxTeamDamage) + ' ' + maxTeamDamageName); + SendStat(siMaxTeamDamage, IntToStr(maxTeamDamage) + ' ' + maxTeamDamageName); -if KilledHHs > 0 then SendStat(siKilledHHs, inttostr(KilledHHs)); +if KilledHHs > 0 then SendStat(siKilledHHs, IntToStr(KilledHHs)); end; procedure initModule; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uStore.pas --- a/hedgewars/uStore.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uStore.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,54 +20,14 @@ unit uStore; interface -uses sysutils, uConsts, uTeams, SDLh, GLunit, uWorld; - - -var PixelFormat: PSDL_PixelFormat; - SDLPrimSurface: PSDL_Surface; - PauseTexture, - SyncTexture, - ConfirmTexture: PTexture; - cScaleFactor: GLfloat; - SupportNPOTT: Boolean; - Step: LongInt; - squaresize : LongInt; - numsquares : LongInt; - ProgrTex: PTexture; - MissionIcons: PSDL_Surface; - ropeIconTex: PTexture; - rotationQt: GLfloat; +uses sysutils, uConsts, SDLh, GLunit, uTypes; procedure initModule; procedure freeModule; procedure StoreLoad; procedure StoreRelease; -procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt); -procedure DrawSprite (Sprite: TSprite; X, Y, Frame: LongInt); -procedure DrawSprite2(Sprite: TSprite; X, Y, FrameX, FrameY: LongInt); -procedure DrawSpriteClipped(Sprite: TSprite; X, Y, TopY, RightX, BottomY, LeftX: LongInt); -procedure DrawTexture(X, Y: LongInt; Texture: PTexture; Scale: GLfloat = 1.0); -procedure DrawTextureF(Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt); -procedure DrawRotatedTextureF(Texture: PTexture; Scale, OffsetX, OffsetY: GLfloat; X, Y, Frame, Dir, w, h: LongInt; Angle: real); -procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real); -procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real); -procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real); -procedure DrawCentered(X, Top: LongInt; Source: PTexture); -procedure DrawFromRect(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture); -procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real); -procedure DrawLine(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte); -procedure DrawFillRect(r: TSDL_Rect); -procedure DrawCircle(X, Y, Radius: LongInt; Width: Single; r, g, b, a: Byte); -procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean); -function CheckCJKFont(s: ansistring; font: THWFont): THWFont; -function RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture; -function RenderSpeechBubbleTex(s: ansistring; SpeechType: Longword; font: THWFont): PTexture; -procedure flipSurface(Surface: PSDL_Surface; Vertical: Boolean); -//procedure rotateSurface(Surface: PSDL_Surface); -procedure copyRotatedSurface(src, dest: PSDL_Surface); // this is necessary since width/height are read only in SDL -procedure copyToXY(src, dest: PSDL_Surface; destX, destY: LongInt); procedure RenderHealth(var Hedgehog: THedgehog); procedure AddProgress; procedure FinishProgress; @@ -78,91 +38,15 @@ procedure RenderWeaponTooltip(atype: TAmmoType); procedure ShowWeaponTooltip(x, y: LongInt); procedure FreeWeaponTooltip; -procedure Tint(r, g, b, a: Byte); inline; -procedure Tint(c: Longword); inline; implementation -uses uMisc, uConsole, uLocale, uMobile; +uses uMisc, uConsole, uLocale, uMobile, uVariables, uUtils, uTextures, uIO, uRender, uRenderUtils; type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple); var HHTexture: PTexture; MaxTextureSize: LongInt; cGPUVendor: TGPUVendor; - lastTint: Longword; - -procedure Tint(r, g, b, a: Byte); inline; -var nc: Longword; -begin -nc:= (a shl 24) or (b shl 16) or (g shl 8) or r; -if nc = lastTint then - exit; -glColor4ub(r, g, b, a); -lastTint:= nc; -end; - -procedure Tint(c: Longword); inline; -begin -Tint(((c shr 16) and $FF), ((c shr 8) and $FF), (c and $FF), $FF); -end; - -procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean); -var r: TSDL_Rect; -begin -r:= rect^; -if Clear then SDL_FillRect(Surface, @r, 0); - -BorderColor:= SDL_MapRGB(Surface^.format, BorderColor shr 16, BorderColor shr 8, BorderColor and $FF); -FillColor:= SDL_MapRGB(Surface^.format, FillColor shr 16, FillColor shr 8, FillColor and $FF); - -r.y:= rect^.y + 1; -r.h:= rect^.h - 2; -SDL_FillRect(Surface, @r, BorderColor); -r.x:= rect^.x + 1; -r.w:= rect^.w - 2; -r.y:= rect^.y; -r.h:= rect^.h; -SDL_FillRect(Surface, @r, BorderColor); -r.x:= rect^.x + 2; -r.y:= rect^.y + 1; -r.w:= rect^.w - 4; -r.h:= rect^.h - 2; -SDL_FillRect(Surface, @r, FillColor); -r.x:= rect^.x + 1; -r.y:= rect^.y + 2; -r.w:= rect^.w - 2; -r.h:= rect^.h - 4; -SDL_FillRect(Surface, @r, FillColor) -end; - -function WriteInRoundRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: ansistring): TSDL_Rect; -var w, h: LongInt; - tmpsurf: PSDL_Surface; - clr: TSDL_Color; - finalRect: TSDL_Rect; -begin -w:= 0; h:= 0; // avoid compiler hints -TTF_SizeUTF8(Fontz[Font].Handle, Str2PChar(s), w, h); -finalRect.x:= X; -finalRect.y:= Y; -finalRect.w:= w + FontBorder * 2 + 4; -finalRect.h:= h + FontBorder * 2; -DrawRoundRect(@finalRect, cWhiteColor, endian(cNearBlackColorChannels.value), Surface, true); -clr.r:= (Color shr 16) and $FF; -clr.g:= (Color shr 8) and $FF; -clr.b:= Color and $FF; -tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(s), clr); -finalRect.x:= X + FontBorder + 2; -finalRect.y:= Y + FontBorder; -SDLTry(tmpsurf <> nil, true); -SDL_UpperBlit(tmpsurf, nil, Surface, @finalRect); -SDL_FreeSurface(tmpsurf); -finalRect.x:= X; -finalRect.y:= Y; -finalRect.w:= w + FontBorder * 2 + 4; -finalRect.h:= h + FontBorder * 2; -WriteInRoundRect:= finalRect; -end; function WriteInRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: ansistring): TSDL_Rect; var w, h: LongInt; @@ -479,268 +363,6 @@ {$ENDIF} end; -procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); -begin -DrawFromRect(X, Y, r^.w, r^.h, r, SourceTexture) -end; - -procedure DrawFromRect(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture); -var rr: TSDL_Rect; - _l, _r, _t, _b: real; - VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; -begin -if (SourceTexture^.h = 0) or (SourceTexture^.w = 0) then exit; - -// don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) -if (abs(X) > W) and ((abs(X + W / 2) - W / 2) > cScreenWidth / cScaleFactor) then - exit; -if (abs(Y) > H) and ((abs(Y + H / 2 - (0.5 * cScreenHeight)) - H / 2) > cScreenHeight / cScaleFactor) then - exit; - -rr.x:= X; -rr.y:= Y; -rr.w:= W; -rr.h:= H; - -_l:= r^.x / SourceTexture^.w * SourceTexture^.rx; -_r:= (r^.x + r^.w) / SourceTexture^.w * SourceTexture^.rx; -_t:= r^.y / SourceTexture^.h * SourceTexture^.ry; -_b:= (r^.y + r^.h) / SourceTexture^.h * SourceTexture^.ry; - -glBindTexture(GL_TEXTURE_2D, SourceTexture^.id); - -VertexBuffer[0].X:= X; -VertexBuffer[0].Y:= Y; -VertexBuffer[1].X:= rr.w + X; -VertexBuffer[1].Y:= Y; -VertexBuffer[2].X:= rr.w + X; -VertexBuffer[2].Y:= rr.h + Y; -VertexBuffer[3].X:= X; -VertexBuffer[3].Y:= rr.h + Y; - -TextureBuffer[0].X:= _l; -TextureBuffer[0].Y:= _t; -TextureBuffer[1].X:= _r; -TextureBuffer[1].Y:= _t; -TextureBuffer[2].X:= _r; -TextureBuffer[2].Y:= _b; -TextureBuffer[3].X:= _l; -TextureBuffer[3].Y:= _b; - - -glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); -glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]); -glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); -end; - -procedure DrawTexture(X, Y: LongInt; Texture: PTexture; Scale: GLfloat); -begin - -glPushMatrix; -glTranslatef(X, Y, 0); -glScalef(Scale, Scale, 1); - -glBindTexture(GL_TEXTURE_2D, Texture^.id); - -glVertexPointer(2, GL_FLOAT, 0, @Texture^.vb); -glTexCoordPointer(2, GL_FLOAT, 0, @Texture^.tb); -glDrawArrays(GL_TRIANGLE_FAN, 0, Length(Texture^.vb)); - -glPopMatrix -end; - -procedure DrawTextureF(Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt); -begin - DrawRotatedTextureF(Texture, Scale, 0, 0, X, Y, Frame, Dir, w, h, 0) -end; - -procedure DrawRotatedTextureF(Texture: PTexture; Scale, OffsetX, OffsetY: GLfloat; X, Y, Frame, Dir, w, h: LongInt; Angle: real); -var ft, fb, fl, fr: GLfloat; - hw, nx, ny: LongInt; - VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; -begin -// don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) -if (abs(X) > W) and ((abs(X + dir * OffsetX) - W / 2) * cScaleFactor > cScreenWidth) then - exit; -if (abs(Y) > H) and ((abs(Y + OffsetY - (0.5 * cScreenHeight)) - W / 2) * cScaleFactor > cScreenHeight) then - exit; - -glPushMatrix; -glTranslatef(X, Y, 0); - -if Dir < 0 then - glRotatef(Angle, 0, 0, -1) -else - glRotatef(Angle, 0, 0, 1); - -glTranslatef(Dir*OffsetX, OffsetY, 0); -glScalef(Scale, Scale, 1); - -// Any reason for this call? And why only in t direction, not s? -//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - -if Dir < 0 then - hw:= w div -2 -else - hw:= w div 2; - -nx:= round(Texture^.w / w); // number of horizontal frames -ny:= round(Texture^.h / h); // number of vertical frames - -ft:= (Frame mod ny) * Texture^.ry / ny; -fb:= ((Frame mod ny) + 1) * Texture^.ry / ny; -fl:= (Frame div ny) * Texture^.rx / nx; -fr:= ((Frame div ny) + 1) * Texture^.rx / nx; - -glBindTexture(GL_TEXTURE_2D, Texture^.id); - -VertexBuffer[0].X:= -hw; -VertexBuffer[0].Y:= w / -2; -VertexBuffer[1].X:= hw; -VertexBuffer[1].Y:= w / -2; -VertexBuffer[2].X:= hw; -VertexBuffer[2].Y:= w / 2; -VertexBuffer[3].X:= -hw; -VertexBuffer[3].Y:= w / 2; - -TextureBuffer[0].X:= fl; -TextureBuffer[0].Y:= ft; -TextureBuffer[1].X:= fr; -TextureBuffer[1].Y:= ft; -TextureBuffer[2].X:= fr; -TextureBuffer[2].Y:= fb; -TextureBuffer[3].X:= fl; -TextureBuffer[3].Y:= fb; - -glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); -glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]); -glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); - -glPopMatrix -end; - -procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real); -begin - DrawRotatedTex(SpritesData[Sprite].Texture, - SpritesData[Sprite].Width, - SpritesData[Sprite].Height, - X, Y, Dir, Angle) -end; - -procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real); -begin -glPushMatrix; -glTranslatef(X, Y, 0); - -if Dir < 0 then - glRotatef(Angle, 0, 0, -1) -else - glRotatef(Angle, 0, 0, 1); -if Dir < 0 then glScalef(-1.0, 1.0, 1.0); - -DrawSprite(Sprite, -SpritesData[Sprite].Width div 2, -SpritesData[Sprite].Height div 2, Frame); - -glPopMatrix -end; - -procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real); -var VertexBuffer: array [0..3] of TVertex2f; -begin -// don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) -if (abs(X) > 2 * hw) and ((abs(X) - hw) > cScreenWidth / cScaleFactor) then - exit; -if (abs(Y) > 2 * hh) and ((abs(Y - 0.5 * cScreenHeight) - hh) > cScreenHeight / cScaleFactor) then - exit; - -glPushMatrix; -glTranslatef(X, Y, 0); - -if Dir < 0 then - begin - hw:= - hw; - glRotatef(Angle, 0, 0, -1); - end else - glRotatef(Angle, 0, 0, 1); - - -glBindTexture(GL_TEXTURE_2D, Tex^.id); - -VertexBuffer[0].X:= -hw; -VertexBuffer[0].Y:= -hh; -VertexBuffer[1].X:= hw; -VertexBuffer[1].Y:= -hh; -VertexBuffer[2].X:= hw; -VertexBuffer[2].Y:= hh; -VertexBuffer[3].X:= -hw; -VertexBuffer[3].Y:= hh; - -glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); -glTexCoordPointer(2, GL_FLOAT, 0, @Tex^.tb); -glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); - -glPopMatrix -end; - -procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt); -begin -r.y:= r.y + Height * Position; -r.h:= Height; -DrawFromRect(X, Y, @r, SpritesData[Sprite].Texture) -end; - -procedure DrawSprite (Sprite: TSprite; X, Y, Frame: LongInt); -var row, col, numFramesFirstCol: LongInt; -begin -numFramesFirstCol:= SpritesData[Sprite].imageHeight div SpritesData[Sprite].Height; -row:= Frame mod numFramesFirstCol; -col:= Frame div numFramesFirstCol; -DrawSprite2 (Sprite, X, Y, col, row); -end; - -procedure DrawSpriteClipped(Sprite: TSprite; X, Y, TopY, RightX, BottomY, LeftX: LongInt); -var r: TSDL_Rect; -begin -r.x:= 0; -r.y:= 0; -r.w:= SpritesData[Sprite].Width; -r.h:= SpritesData[Sprite].Height; - -if (X < LeftX) then - r.x:= LeftX - X; -if (Y < TopY) then - r.y:= TopY - Y; - -if (Y + SpritesData[Sprite].Height > BottomY) then - r.h:= BottomY - Y + 1; -if (X + SpritesData[Sprite].Width > RightX) then - r.w:= RightX - X + 1; - -dec(r.h, r.y); -dec(r.w, r.x); - -DrawFromRect(X + r.x, Y + r.y, @r, SpritesData[Sprite].Texture) -end; - -procedure DrawSprite2(Sprite: TSprite; X, Y, FrameX, FrameY: LongInt); -var r: TSDL_Rect; -begin - r.x:= FrameX * SpritesData[Sprite].Width; - r.w:= SpritesData[Sprite].Width; - r.y:= FrameY * SpritesData[Sprite].Height; - r.h:= SpritesData[Sprite].Height; - DrawFromRect(X, Y, @r, SpritesData[Sprite].Texture) -end; - -procedure DrawCentered(X, Top: LongInt; Source: PTexture); -var scale: GLfloat; -begin - if (Source^.w + 20) > cScreenWidth then - scale:= cScreenWidth / (Source^.w + 20) - else - scale:= 1.0; - DrawTexture(X - round(Source^.w * scale) div 2, Top, Source, scale) -end; - procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real); const VertexBuffer: array [0..3] of TVertex2f = ( (x: -16; y: -16), @@ -792,83 +414,6 @@ glPopMatrix end; -procedure DrawLine(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte); -var VertexBuffer: array [0..3] of TVertex2f; -begin - glDisable(GL_TEXTURE_2D); - glEnable(GL_LINE_SMOOTH); - - glPushMatrix; - glTranslatef(WorldDx, WorldDy, 0); - glLineWidth(Width); - - Tint(r, g, b, a); - VertexBuffer[0].X:= X0; - VertexBuffer[0].Y:= Y0; - VertexBuffer[1].X:= X1; - VertexBuffer[1].Y:= Y1; - - glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); - glDrawArrays(GL_LINES, 0, Length(VertexBuffer)); - Tint($FF, $FF, $FF, $FF); - - glPopMatrix; - - glEnable(GL_TEXTURE_2D); - glDisable(GL_LINE_SMOOTH); -end; - -procedure DrawFillRect(r: TSDL_Rect); -var VertexBuffer: array [0..3] of TVertex2f; -begin -// don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) -if (abs(r.x) > r.w) and ((abs(r.x + r.w / 2) - r.w / 2) * cScaleFactor > cScreenWidth) then - exit; -if (abs(r.y) > r.h) and ((abs(r.y + r.h / 2 - (0.5 * cScreenHeight)) - r.h / 2) * cScaleFactor > cScreenHeight) then - exit; - -glDisable(GL_TEXTURE_2D); - -Tint($00, $00, $00, $80); - -VertexBuffer[0].X:= r.x; -VertexBuffer[0].Y:= r.y; -VertexBuffer[1].X:= r.x + r.w; -VertexBuffer[1].Y:= r.y; -VertexBuffer[2].X:= r.x + r.w; -VertexBuffer[2].Y:= r.y + r.h; -VertexBuffer[3].X:= r.x; -VertexBuffer[3].Y:= r.y + r.h; - -glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); -glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); - -Tint($FF, $FF, $FF, $FF); -glEnable(GL_TEXTURE_2D) -end; - -procedure DrawCircle(X, Y, Radius: LongInt; Width: Single; r, g, b, a: Byte); -var - i: LongInt; - CircleVertex: array [0..359] of TVertex2f; -begin - for i := 0 to 359 do begin - CircleVertex[i].X := X + Radius*cos(i*pi/180); - CircleVertex[i].Y := Y + Radius*sin(i*pi/180); - end; - glDisable(GL_TEXTURE_2D); - glEnable(GL_LINE_SMOOTH); - glPushMatrix; - glLineWidth(Width); - Tint(r, g, b, a); - glVertexPointer(2, GL_FLOAT, 0, @CircleVertex[0]); - glDrawArrays(GL_LINE_LOOP, 0, 360); - Tint($FF, $FF, $FF, $FF); - glPopMatrix; - glEnable(GL_TEXTURE_2D); - glDisable(GL_LINE_SMOOTH); -end; - procedure StoreRelease; var ii: TSprite; begin @@ -886,247 +431,6 @@ end; -function CheckCJKFont(s: ansistring; font: THWFont): THWFont; -var l, i : LongInt; - u: WideChar; - tmpstr: array[0..256] of WideChar; -begin - -{$IFNDEF IPHONEOS} -// remove chinese fonts for now -if (font >= CJKfnt16) or (length(s) = 0) then -{$ENDIF} - exit(font); - -l:= Utf8ToUnicode(@tmpstr, Str2PChar(s), length(s))-1; -i:= 0; -while i < l do - begin - u:= tmpstr[i]; - if (#$2E80 <= u) and ( - (u <= #$2FDF ) or // CJK Radicals Supplement / Kangxi Radicals - ((#$2FF0 <= u) and (u <= #$303F)) or // Ideographic Description Characters / CJK Radicals Supplement - ((#$31C0 <= u) and (u <= #$31EF)) or // CJK Strokes - ((#$3200 <= u) and (u <= #$4DBF)) or // Enclosed CJK Letters and Months / CJK Compatibility / CJK Unified Ideographs Extension A - ((#$4E00 <= u) and (u <= #$9FFF)) or // CJK Unified Ideographs - ((#$F900 <= u) and (u <= #$FAFF)) or // CJK Compatibility Ideographs - ((#$FE30 <= u) and (u <= #$FE4F))) // CJK Compatibility Forms - then exit(THWFont( ord(font) + ((ord(High(THWFont))+1) div 2) )); - inc(i) - end; -exit(font); -(* two more to check. pascal WideChar is only 16 bit though - ((#$20000 <= u) and (u >= #$2A6DF)) or // CJK Unified Ideographs Extension B - ((#$2F800 <= u) and (u >= #$2FA1F))) // CJK Compatibility Ideographs Supplement *) -end; - -function RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture; -var w, h: LongInt; - finalSurface: PSDL_Surface; -begin -if length(s) = 0 then s:= ' '; -font:= CheckCJKFont(s, font); -w:= 0; h:= 0; // avoid compiler hints -TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(s), w, h); - -finalSurface:= SDL_CreateRGBSurface(SDL_SWSURFACE, w + FontBorder * 2 + 4, h + FontBorder * 2, - 32, RMask, GMask, BMask, AMask); - -TryDo(finalSurface <> nil, 'RenderString: fail to create surface', true); - -WriteInRoundRect(finalSurface, 0, 0, Color, font, s); - -TryDo(SDL_SetColorKey(finalSurface, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); - -RenderStringTex:= Surface2Tex(finalSurface, false); - -SDL_FreeSurface(finalSurface); -end; - -function RenderSpeechBubbleTex(s: ansistring; SpeechType: Longword; font: THWFont): PTexture; -var textWidth, textHeight, x, y, w, h, i, j, pos, prevpos, line, numLines, edgeWidth, edgeHeight, cornerWidth, cornerHeight: LongInt; - finalSurface, tmpsurf, rotatedEdge: PSDL_Surface; - rect: TSDL_Rect; - chars: TSysCharSet = [#9,' ','.',';',':','?','!',',']; - substr: shortstring; - edge, corner, tail: TSPrite; -begin - -case SpeechType of - 1: begin; - edge:= sprSpeechEdge; - corner:= sprSpeechCorner; - tail:= sprSpeechTail; - end; - 2: begin; - edge:= sprThoughtEdge; - corner:= sprThoughtCorner; - tail:= sprThoughtTail; - end; - 3: begin; - edge:= sprShoutEdge; - corner:= sprShoutCorner; - tail:= sprShoutTail; - end; - end; -edgeHeight:= SpritesData[edge].Height; -edgeWidth:= SpritesData[edge].Width; -cornerWidth:= SpritesData[corner].Width; -cornerHeight:= SpritesData[corner].Height; -// This one screws up WrapText -//s:= 'This is the song that never ends. ''cause it goes on and on my friends. Some people, started singing it not knowing what it was. And they''ll just go on singing it forever just because... This is the song that never ends...'; -// This one does not -//s:= 'This is the song that never ends. cause it goes on and on my friends. Some people, started singing it not knowing what it was. And they will go on singing it forever just because... This is the song that never ends... '; - -numLines:= 0; - -if length(s) = 0 then s:= '...'; -font:= CheckCJKFont(s, font); -w:= 0; h:= 0; // avoid compiler hints -TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(s), w, h); -if w<8 then w:= 8; -j:= 0; -if (length(s) > 20) then - begin - w:= 0; - i:= round(Sqrt(length(s)) * 2); - s:= WrapText(s, #1, chars, i); - pos:= 1; prevpos:= 0; line:= 0; -// Find the longest line for the purposes of centring the text. Font dependant. - while pos <= length(s) do - begin - if (s[pos] = #1) or (pos = length(s)) then - begin - inc(numlines); - if s[pos] <> #1 then inc(pos); - while s[prevpos+1] = ' ' do inc(prevpos); - substr:= copy(s, prevpos+1, pos-prevpos-1); - i:= 0; j:= 0; - TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(substr), i, j); - if i > w then w:= i; - prevpos:= pos; - end; - inc(pos); - end; - end -else numLines := 1; - -textWidth:=((w-(cornerWidth-edgeWidth)*2) div edgeWidth)*edgeWidth+edgeWidth; -textHeight:=(((numlines * h + 2)-((cornerHeight-edgeWidth)*2)) div edgeWidth)*edgeWidth; - -textHeight:=max(textHeight,edgeWidth); -//textWidth:=max(textWidth,SpritesData[tail].Width); -rect.x:= 0; -rect.y:= 0; -rect.w:= textWidth + (cornerWidth * 2); -rect.h:= textHeight + cornerHeight*2 - edgeHeight + SpritesData[tail].Height; -//s:= inttostr(w) + ' ' + inttostr(numlines) + ' ' + inttostr(rect.x) + ' '+inttostr(rect.y) + ' ' + inttostr(rect.w) + ' ' + inttostr(rect.h); - -finalSurface:= SDL_CreateRGBSurface(SDL_SWSURFACE, rect.w, rect.h, 32, RMask, GMask, BMask, AMask); - -TryDo(finalSurface <> nil, 'RenderString: fail to create surface', true); - -//////////////////////////////// CORNERS /////////////////////////////// -copyToXY(SpritesData[corner].Surface, finalSurface, 0, 0); /////////////////// NW - -flipSurface(SpritesData[corner].Surface, true); // store all 4 versions in memory to avoid repeated flips? -x:= 0; -y:= textHeight + cornerHeight -1; -copyToXY(SpritesData[corner].Surface, finalSurface, x, y); /////////////////// SW - -flipSurface(SpritesData[corner].Surface, false); -x:= rect.w-cornerWidth-1; -y:= textHeight + cornerHeight -1; -copyToXY(SpritesData[corner].Surface, finalSurface, x, y); /////////////////// SE - -flipSurface(SpritesData[corner].Surface, true); -x:= rect.w-cornerWidth-1; -y:= 0; -copyToXY(SpritesData[corner].Surface, finalSurface, x, y); /////////////////// NE -flipSurface(SpritesData[corner].Surface, false); // restore original position -//////////////////////////////// END CORNERS /////////////////////////////// - -//////////////////////////////// EDGES ////////////////////////////////////// -x:= cornerWidth; -y:= 0; -while x < rect.w-cornerWidth-1 do - begin - copyToXY(SpritesData[edge].Surface, finalSurface, x, y); ///////////////// top edge - inc(x,edgeWidth); - end; -flipSurface(SpritesData[edge].Surface, true); -x:= cornerWidth; -y:= textHeight + cornerHeight*2 - edgeHeight-1; -while x < rect.w-cornerWidth-1 do - begin - copyToXY(SpritesData[edge].Surface, finalSurface, x, y); ///////////////// bottom edge - inc(x,edgeWidth); - end; -flipSurface(SpritesData[edge].Surface, true); // restore original position - -rotatedEdge:= SDL_CreateRGBSurface(SDL_SWSURFACE, edgeHeight, edgeWidth, 32, RMask, GMask, BMask, AMask); -x:= rect.w - edgeHeight - 1; -y:= cornerHeight; -//// initially was going to rotate in place, but the SDL spec claims width/height are read only -copyRotatedSurface(SpritesData[edge].Surface,rotatedEdge); -while y < textHeight + cornerHeight do - begin - copyToXY(rotatedEdge, finalSurface, x, y); - inc(y,edgeWidth); - end; -flipSurface(rotatedEdge, false); // restore original position -x:= 0; -y:= cornerHeight; -while y < textHeight + cornerHeight do - begin - copyToXY(rotatedEdge, finalSurface, x, y); - inc(y,edgeWidth); - end; -//////////////////////////////// END EDGES ////////////////////////////////////// - -x:= cornerWidth; -y:= textHeight + cornerHeight * 2 - edgeHeight - 1; -copyToXY(SpritesData[tail].Surface, finalSurface, x, y); - -rect.x:= edgeHeight; -rect.y:= edgeHeight; -rect.w:= rect.w - edgeHeight * 2; -rect.h:= textHeight + cornerHeight * 2 - edgeHeight * 2; -i:= rect.w; -j:= rect.h; -SDL_FillRect(finalSurface, @rect, cWhiteColor); - -pos:= 1; prevpos:= 0; line:= 0; -while pos <= length(s) do - begin - if (s[pos] = #1) or (pos = length(s)) then - begin - if s[pos] <> #1 then inc(pos); - while s[prevpos+1] = ' 'do inc(prevpos); - substr:= copy(s, prevpos+1, pos-prevpos-1); - if Length(substr) <> 0 then - begin - tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(substr), cNearBlackColorChannels); - rect.x:= edgeHeight + 1 + ((i - w) div 2); - // trying to more evenly position the text, vertically - rect.y:= edgeHeight + ((j-(numLines*h)) div 2) + line * h; - SDLTry(tmpsurf <> nil, true); - SDL_UpperBlit(tmpsurf, nil, finalSurface, @rect); - SDL_FreeSurface(tmpsurf); - inc(line); - prevpos:= pos; - end; - end; - inc(pos); - end; - -//TryDo(SDL_SetColorKey(finalSurface, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); -RenderSpeechBubbleTex:= Surface2Tex(finalSurface, true); - -SDL_FreeSurface(rotatedEdge); -SDL_FreeSurface(finalSurface); -end; - procedure RenderHealth(var Hedgehog: THedgehog); var s: shortstring; begin @@ -1352,82 +656,6 @@ perfExt_FinishProgress(); end; -procedure flipSurface(Surface: PSDL_Surface; Vertical: Boolean); -var y, x, i, j: LongInt; - tmpPixel: Longword; - pixels: PLongWordArray; -begin -TryDo(Surface^.format^.BytesPerPixel = 4, 'flipSurface failed, expecting 32 bit surface', true); -pixels:= Surface^.pixels; -if Vertical then - for y := 0 to (Surface^.h div 2) - 1 do - for x := 0 to Surface^.w - 1 do - begin - i:= y * Surface^.w + x; - j:= (Surface^.h - y - 1) * Surface^.w + x; - tmpPixel:= pixels^[i]; - pixels^[i]:= pixels^[j]; - pixels^[j]:= tmpPixel; - end -else - for x := 0 to (Surface^.w div 2) - 1 do - for y := 0 to Surface^.h -1 do - begin - i:= y*Surface^.w + x; - j:= y*Surface^.w + (Surface^.w - x - 1); - tmpPixel:= pixels^[i]; - pixels^[i]:= pixels^[j]; - pixels^[j]:= tmpPixel; - end; -end; - -procedure copyToXY(src, dest: PSDL_Surface; destX, destY: LongInt); -var srcX, srcY, i, j, maxDest: LongInt; - srcPixels, destPixels: PLongWordArray; - r0, g0, b0, a0, r1, g1, b1, a1: Byte; -begin -maxDest:= (dest^.pitch div 4) * dest^.h; -srcPixels:= src^.pixels; -destPixels:= dest^.pixels; - -for srcX:= 0 to src^.w - 1 do - for srcY:= 0 to src^.h - 1 do - begin - i:= (destY + srcY) * (dest^.pitch div 4) + destX + srcX; - j:= srcY * (src^.pitch div 4) + srcX; - if (i < maxDest) and (srcPixels^[j] and AMask <> 0) then - begin - SDL_GetRGBA(destPixels^[i], dest^.format, @r0, @g0, @b0, @a0); - SDL_GetRGBA(srcPixels^[j], src^.format, @r1, @g1, @b1, @a1); - r0:= (r0 * (255 - LongInt(a1)) + r1 * LongInt(a1)) div 255; - g0:= (g0 * (255 - LongInt(a1)) + g1 * LongInt(a1)) div 255; - b0:= (b0 * (255 - LongInt(a1)) + b1 * LongInt(a1)) div 255; - a0:= (a0 * (255 - LongInt(a1)) + a1 * LongInt(a1)) div 255; - destPixels^[i]:= SDL_MapRGBA(dest^.format, r0, g0, b0, a0); - end; - end; -end; - -procedure copyRotatedSurface(src, dest: PSDL_Surface); // this is necessary since width/height are read only in SDL, apparently -var y, x, i, j: LongInt; - srcPixels, destPixels: PLongWordArray; -begin -TryDo(src^.format^.BytesPerPixel = 4, 'rotateSurface failed, expecting 32 bit surface', true); -TryDo(dest^.format^.BytesPerPixel = 4, 'rotateSurface failed, expecting 32 bit surface', true); - -srcPixels:= src^.pixels; -destPixels:= dest^.pixels; - -j:= 0; -for x := 0 to src^.w - 1 do - for y := 0 to src^.h - 1 do - begin - i:= (src^.h - 1 - y) * (src^.pitch div 4) + x; - destPixels^[j]:= srcPixels^[i]; - inc(j) - end; -end; - function RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture; var tmpsurf: PSDL_SURFACE; w, h, i, j: LongInt; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uTeams.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,89 +20,7 @@ unit uTeams; interface -uses uConsts, uKeys, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, GLunit, uSound; - -type - PHHAmmo = ^THHAmmo; - THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo; - - PHedgehog = ^THedgehog; - PTeam = ^TTeam; - PClan = ^TClan; - - THedgehog = record - Name: string[MAXNAMELEN]; - Gear: PGear; - SpeechGear: PVisualGear; - NameTagTex, - HealthTagTex, - HatTex: PTexture; - Ammo: PHHAmmo; - CurAmmoType: TAmmoType; - AmmoStore: Longword; - Team: PTeam; - MultiShootAttacks: Longword; - visStepPos: LongWord; - BotLevel : Byte; // 0 - Human player - HatVisibility: GLfloat; - stats: TStatistics; - Hat: shortstring; - InitialHealth: LongInt; // used for gfResetHealth - King: boolean; // Flag for a bunch of hedgehog attributes - Unplaced: boolean; // Flag for hog placing mode - Timer: Longword; - Effects: Array[THogEffect] of boolean; - end; - - TTeam = record - Clan: PClan; - TeamName: string[MAXNAMELEN]; - ExtDriven: boolean; - Binds: TBinds; - Hedgehogs: array[0..cMaxHHIndex] of THedgehog; - CurrHedgehog: LongWord; - NameTagTex: PTexture; - CrosshairTex, - GraveTex, - HealthTex, - AIKillsTex, - FlagTex: PTexture; - Flag: shortstring; - GraveName: shortstring; - FortName: shortstring; - TeamHealth: LongInt; - TeamHealthBarWidth, - NewTeamHealthBarWidth: LongInt; - DrawHealthY: LongInt; - AttackBar: LongWord; - HedgehogsNumber: Longword; - hasGone: boolean; - voicepack: PVoicepack; - PlayerHash: shortstring; // md5 hash of player name. For temporary enabling of hats as thank you. Hashed for privacy of players - stats: TTeamStats; - end; - - TClan = record - Color: Longword; - Teams: array[0..Pred(cMaxTeams)] of PTeam; - TeamsNumber: Longword; - CurrTeam: LongWord; - ClanHealth: LongInt; - ClanIndex: LongInt; - TurnNumber: LongWord; - end; - -var CurrentTeam: PTeam; - PreviousTeam: PTeam; - CurrentHedgehog: PHedgehog; - TeamsArray: array[0..Pred(cMaxTeams)] of PTeam; - TeamsCount: Longword; - ClansArray: array[0..Pred(cMaxTeams)] of PClan; - ClansCount: Longword; - LocalClan: LongInt; // last non-bot, non-extdriven clan - LocalAmmo: LongInt; // last non-bot, non-extdriven clan's first team's ammo index - CurMinAngle, CurMaxAngle: Longword; - GameOver: boolean; +uses uConsts, uKeys, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, GLunit, uSound, uTypes; procedure initModule; procedure freeModule; @@ -119,7 +37,8 @@ function GetTeamStatString(p: PTeam): shortstring; implementation -uses uMisc, uWorld, uLocale, uAmmos, uChat, uMobile; +uses uWorld, uLocale, uAmmos, uChat, uMobile, uVariables, uUtils, uIO; + const MaxTeamHealth: LongInt = 0; function CheckForWin: boolean; @@ -495,7 +414,7 @@ function GetTeamStatString(p: PTeam): shortstring; var s: ansistring; begin - s:= p^.TeamName + ':' + inttostr(p^.TeamHealth) + ':'; + s:= p^.TeamName + ':' + IntToStr(p^.TeamHealth) + ':'; GetTeamStatString:= s; end; diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uTextures.pas --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hedgewars/uTextures.pas Thu Nov 18 16:58:08 2010 -0500 @@ -0,0 +1,187 @@ +{$INCLUDE "options.inc"} + +unit uTextures; +interface +uses SDLh, uTypes; + +function NewTexture(width, height: Longword; buf: Pointer): PTexture; +function Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture; +procedure FreeTexture(tex: PTexture); + +procedure initModule; +procedure freeModule; + +implementation +uses GLunit, uUtils, uVariables, uConsts, uIO; + +var TextureList: PTexture; + + +procedure SetTextureParameters(enableClamp: Boolean); +begin + if enableClamp and ((cReducedQuality and rqClampLess) = 0) then + begin + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) + end; + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) +end; + +procedure ResetVertexArrays(texture: PTexture); +begin +with texture^ do + begin + vb[0].X:= 0; + vb[0].Y:= 0; + vb[1].X:= w; + vb[1].Y:= 0; + vb[2].X:= w; + vb[2].Y:= h; + vb[3].X:= 0; + vb[3].Y:= h; + + tb[0].X:= 0; + tb[0].Y:= 0; + tb[1].X:= rx; + tb[1].Y:= 0; + tb[2].X:= rx; + tb[2].Y:= ry; + tb[3].X:= 0; + tb[3].Y:= ry + end; +end; + +function NewTexture(width, height: Longword; buf: Pointer): PTexture; +begin +new(NewTexture); +NewTexture^.PrevTexture:= nil; +NewTexture^.NextTexture:= nil; +NewTexture^.Scale:= 1; +if TextureList <> nil then + begin + TextureList^.PrevTexture:= NewTexture; + NewTexture^.NextTexture:= TextureList + end; +TextureList:= NewTexture; + +NewTexture^.w:= width; +NewTexture^.h:= height; +NewTexture^.rx:= 1.0; +NewTexture^.ry:= 1.0; + +ResetVertexArrays(NewTexture); + +glGenTextures(1, @NewTexture^.id); + +glBindTexture(GL_TEXTURE_2D, NewTexture^.id); +glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf); + +SetTextureParameters(true); +end; + +function Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture; +var tw, th, x, y: Longword; + tmpp: pointer; + fromP4, toP4: PLongWordArray; +begin +new(Surface2Tex); +Surface2Tex^.PrevTexture:= nil; +Surface2Tex^.NextTexture:= nil; +if TextureList <> nil then + begin + TextureList^.PrevTexture:= Surface2Tex; + Surface2Tex^.NextTexture:= TextureList + end; +TextureList:= Surface2Tex; + +Surface2Tex^.w:= surf^.w; +Surface2Tex^.h:= surf^.h; + +if (surf^.format^.BytesPerPixel <> 4) then + begin + TryDo(false, 'Surface2Tex failed, expecting 32 bit surface', true); + Surface2Tex^.id:= 0; + exit + end; + + +glGenTextures(1, @Surface2Tex^.id); + +glBindTexture(GL_TEXTURE_2D, Surface2Tex^.id); + +if SDL_MustLock(surf) then + SDLTry(SDL_LockSurface(surf) >= 0, true); + +if (not SupportNPOTT) and (not (isPowerOf2(Surf^.w) and isPowerOf2(Surf^.h))) then + begin + tw:= toPowerOf2(Surf^.w); + th:= toPowerOf2(Surf^.h); + + Surface2Tex^.rx:= Surf^.w / tw; + Surface2Tex^.ry:= Surf^.h / th; + + GetMem(tmpp, tw * th * surf^.format^.BytesPerPixel); + + fromP4:= Surf^.pixels; + toP4:= tmpp; + + for y:= 0 to Pred(Surf^.h) do + begin + for x:= 0 to Pred(Surf^.w) do toP4^[x]:= fromP4^[x]; + for x:= Surf^.w to Pred(tw) do toP4^[x]:= 0; + toP4:= @(toP4^[tw]); + fromP4:= @(fromP4^[Surf^.pitch div 4]) + end; + + for y:= Surf^.h to Pred(th) do + begin + for x:= 0 to Pred(tw) do toP4^[x]:= 0; + toP4:= @(toP4^[tw]) + end; + + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tw, th, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmpp); + + FreeMem(tmpp, tw * th * surf^.format^.BytesPerPixel) + end +else + begin + Surface2Tex^.rx:= 1.0; + Surface2Tex^.ry:= 1.0; + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surf^.w, surf^.h, 0, GL_RGBA, GL_UNSIGNED_BYTE, surf^.pixels); + end; + +ResetVertexArrays(Surface2Tex); + +if SDL_MustLock(surf) then + SDL_UnlockSurface(surf); + +SetTextureParameters(enableClamp); +end; + +procedure FreeTexture(tex: PTexture); +begin + if tex <> nil then + begin + if tex^.NextTexture <> nil then + tex^.NextTexture^.PrevTexture:= tex^.PrevTexture; + if tex^.PrevTexture <> nil then + tex^.PrevTexture^.NextTexture:= tex^.NextTexture + else + TextureList:= tex^.NextTexture; + glDeleteTextures(1, @tex^.id); + Dispose(tex); + end +end; + +procedure initModule; +begin +TextureList:= nil; +end; + +procedure freeModule; +begin + while TextureList <> nil do FreeTexture(TextureList); +end; + +end. \ No newline at end of file diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uTypes.pas --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hedgewars/uTypes.pas Thu Nov 18 16:58:08 2010 -0500 @@ -0,0 +1,368 @@ +{$INCLUDE "options.inc"} + +unit uTypes; +interface + +uses SDLh, uFloat, GLunit, uConsts, Math; + +type + HwColor4f = record + r, g, b, a: byte + end; + + TGameState = (gsLandGen, gsStart, gsGame, gsChat, gsConfirm, gsExit); + + TGameType = (gmtLocal, gmtDemo, gmtNet, gmtSave, gmtLandPreview, gmtSyntax); + + TPathType = (ptNone, ptData, ptGraphics, ptThemes, ptCurrTheme, ptTeams, ptMaps, + ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts, + ptLocale, ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps); + + TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame, + sprLag, sprArrow, sprBazookaShell, sprTargetP, sprBee, + sprSmokeTrace, sprRopeHook, sprExplosion50, sprMineOff, + sprMineOn, sprMineDead, sprCase, sprFAid, sprDynamite, sprPower, + sprClusterBomb, sprClusterParticle, sprFlame, sprHorizont, + sprHorizontL, sprHorizontR, sprSky, sprSkyL, + sprSkyR, sprAMBorderHorizontal, sprAMBorderVertical, sprAMSlot, sprAMAmmos, + sprAMSlotKeys, sprAMCorners, sprFinger, sprAirBomb, + sprAirplane, sprAmAirplane, sprAmGirder, sprHHTelepMask, + sprSwitch, sprParachute, sprTarget, sprRopeNode, + sprQuestion, sprPowerBar, sprWindBar, sprWindL, sprWindR, + sprFlake, sprHandRope, sprHandBazooka, sprHandShotgun, + sprHandDEagle, sprHandAirAttack, sprHandBaseball, sprPHammer, + sprHandBlowTorch, sprBlowTorch, sprTeleport, sprHHDeath, + sprShotgun, sprDEagle, sprHHIdle, sprMortar, sprTurnsLeft, + sprKamikaze, sprWhip, sprKowtow, sprSad, sprWave, + sprHurrah, sprLemonade, sprShrug, sprJuggle, sprExplPart, sprExplPart2, + sprCakeWalk, sprCakeDown, sprAMAmmosBW, sprWatermelon, + sprEvilTrace, sprHellishBomb, sprSeduction, sprDress, + sprCensored, sprDrill, sprHandDrill, sprHandBallgun, sprBalls, + sprPlane, sprHandPlane, sprUtility, sprInvulnerable, sprVampiric, sprGirder, + sprSpeechCorner, sprSpeechEdge, sprSpeechTail, + sprThoughtCorner, sprThoughtEdge, sprThoughtTail, + sprShoutCorner, sprShoutEdge, sprShoutTail, + sprSniperRifle, sprBubbles, sprJetpack, sprHealth, sprHandMolotov, sprMolotov, + sprSmoke, sprSmokeWhite, sprShell, sprDust, sprExplosives, sprExplosivesRoll, + sprAmTeleport, sprSplash, sprDroplet, sprBirdy, sprHandCake, sprHandConstruction, + sprHandGrenade, sprHandMelon, sprHandMortar, sprHandSkip, sprHandCluster, + sprHandDynamite, sprHandHellish, sprHandMine, sprHandSeduction, sprHandVamp, + sprBigExplosion, sprSmokeRing, sprBeeTrace, sprEgg, sprTargetBee, sprHandBee, + sprFeather, sprPiano, sprHandSineGun, sprPortalGun, sprPortal, + sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk, sprNote, + sprSMineOff, sprSMineOn, sprHandSMine, sprHammer, + sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb, + sprBulletHit + ); + + // Gears that interact with other Gears and/or Land + TGearType = (gtBomb, gtHedgehog, gtShell, gtGrave, gtBee, // 4 + gtShotgunShot, gtPickHammer, gtRope, gtMine, gtCase, // 9 + gtDEagleShot, gtDynamite, gtClusterBomb, gtCluster, gtShover, // 14 + gtFlame, gtFirePunch, gtATStartGame, gtATSmoothWindCh, // 18 + gtATFinishGame, gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, // 23 + gtGirder, gtTeleport, gtSwitcher, gtTarget, gtMortar, // 28 + gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 34 + gtHellishBomb, gtWaterUp, gtDrill, gtBallGun, gtBall, gtRCPlane, // 40 + gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy, // 45 + gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 51 + gtSMine, gtPoisonCloud, gtHammer, gtHammerHit, gtResurrector, // 56 + gtNapalmBomb); // 57 + + // Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.) + TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire, + vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble, + vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtHealth, vgtShell, + vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing, vgtBeeTrace, vgtEgg, + vgtFeather, vgtHealthTag, vgtSmokeTrace, vgtEvilTrace, vgtExplosion, + vgtBigExplosion, vgtChunk, vgtNote, vgtLineTrail, + vgtBulletHit); + + TGearsType = set of TGearType; + + TDamageSource = (dsUnknown, dsFall, dsBullet, dsExplosion, dsShove, dsPoison); + + TSound = (sndNone, + sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, + sndSplash, sndShotgunReload, sndShotgunFire, sndGraveImpact, + sndMineTick, sndPickhammer, sndGun, sndBee, sndJump1, sndJump2, + sndJump3, sndYesSir, sndLaugh, sndIllGetYou, sndIncoming, + sndMissed, sndStupid, sndFirstBlood, sndBoring, sndByeBye, + sndSameTeam, sndNutter, sndReinforce, sndTraitor, sndRegret, + sndEnemyDown, sndCoward, sndHurry, sndWatchIt, sndKamikaze, + sndCake, sndOw1, sndOw2, sndOw3, sndOw4, sndFirePunch1, sndFirePunch2, + sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6, + sndMelon, sndHellish, sndYoohoo, sndRCPlane, sndWhipCrack, + sndRideOfTheValkyries, sndDenied, sndPlaced, sndBaseballBat, + sndVaporize, sndWarp, sndSuddenDeath, sndMortar, sndShutter, + sndHomerun, sndMolotov, sndCover, sndUhOh, sndOops, + sndNooo, sndHello, sndRopeShot, sndRopeAttach, sndRopeRelease, + sndSwitchHog, sndVictory, sndSniperReload, sndSteps, sndLowGravity, + sndHellishImpact1, sndHellishImpact2, sndHellishImpact3, sndHellishImpact4, + sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3, sndEggBreak, sndDrillRocket, + sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater, + sndPiano0, sndPiano1, sndPiano2, sndPiano3, sndPiano4, sndPiano5, sndPiano6, sndPiano7, sndPiano8, + sndSkip, sndSineGun, sndOoff1, sndOoff2, sndOoff3, sndWhack, + sndComeonthen, sndParachute, sndBump, sndResurrector); + + TAmmoType = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6 + amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip, // 13 + amBaseballBat, amParachute, amAirAttack, amMineStrike, amBlowTorch, // 18 + amGirder, amTeleport, amSwitch, amMortar, amKamikaze, amCake, // 24 + amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun, // 30 + amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime, // 35 + amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy, amPortalGun, // 42 + amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine, amHammer, // 48 + amResurrector, amDrillStrike); + + TCrateType = (HealthCrate, AmmoCrate, UtilityCrate); + + THWFont = (fnt16, fntBig, fntSmall {$IFNDEF IPHONEOS}, CJKfnt16, CJKfntBig, CJKfntSmall{$ENDIF}); + + TCapGroup = (capgrpGameState, capgrpAmmoinfo, capgrpVolume, + capgrpMessage, capgrpAmmostate); + + TStatInfoType = (siGameResult, siMaxStepDamage, siMaxStepKills, siKilledHHs, + siClanHealth, siTeamStats, siPlayerKills, siMaxTeamDamage, + siMaxTeamKills, siMaxTurnSkips ); + + TWave = (waveRollup, waveSad, waveWave, waveHurrah, waveLemonade, waveShrug, waveJuggle); + + THHFont = record + Handle: PTTF_Font; + Height: LongInt; + style: LongInt; + Name: string[21]; + end; + + PAmmo = ^TAmmo; + TAmmo = record + Propz: LongWord; + Count: LongWord; +(* Using for place hedgehogs mode, but for any other situation where the initial count would be needed I guess. +For example, say, a mode where the weaponset is reset each turn, or on sudden death *) + NumPerTurn: LongWord; + Timer: LongWord; + Pos: LongWord; + AmmoType: TAmmoType; + AttackVoice: TSound; + end; + + TVertex2f = record + X, Y: GLfloat; + end; + + TVertex2i = record + X, Y: GLint; + end; + + PTexture = ^TTexture; + TTexture = record + id: GLuint; + w, h, scale: LongInt; + rx, ry: GLfloat; + priority: GLfloat; + vb, tb: array [0..3] of TVertex2f; + PrevTexture, NextTexture: PTexture; + end; + + THogEffect = (heInvulnerable, heResurrectable, hePoisoned, heResurrected); + + TScreenFade = (sfNone, sfInit, sfToBlack, sfFromBlack, sfToWhite, sfFromWhite); + + PGear = ^TGear; + PHedgehog = ^THedgehog; + PTeam = ^TTeam; + PClan = ^TClan; + + TGearStepProcedure = procedure (Gear: PGear); + TGear = record + NextGear, PrevGear: PGear; + Active: Boolean; + AdvBounce: Longword; + Invulnerable: Boolean; + RenderTimer: Boolean; + AmmoType : TAmmoType; + State : Longword; + X : hwFloat; + Y : hwFloat; + dX: hwFloat; + dY: hwFloat; + Kind: TGearType; + Pos: Longword; + doStep: TGearStepProcedure; + Radius: LongInt; + Angle, Power : Longword; + DirAngle: real; + Timer : LongWord; + Elasticity: hwFloat; + Friction : hwFloat; + Message, MsgParam : Longword; + Hedgehog: PHedgehog; + Health, Damage, Karma: LongInt; + CollisionIndex: LongInt; + Tag: LongInt; + Tex: PTexture; + Z: Longword; + IntersectGear: PGear; + FlightTime: Longword; + uid: Longword; + ImpactSound: TSound; // first sound, others have to be after it in the sounds def. + nImpactSounds: Word; // count of ImpactSounds + SoundChannel: LongInt; + PortalCounter: LongWord // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion. + end; + TPGearArray = Array of PGear; + + PVisualGear = ^TVisualGear; + TVGearStepProcedure = procedure (Gear: PVisualGear; Steps: Longword); + TVisualGear = record + NextGear, PrevGear: PVisualGear; + Frame, + FrameTicks: Longword; + X : real; + Y : real; + dX: real; + dY: real; + tdX: real; + tdY: real; + State : Longword; + Timer: Longword; + Angle, dAngle: real; + Kind: TVisualGearType; + doStep: TVGearStepProcedure; + Tex: PTexture; + alpha, scale: GLfloat; + Hedgehog: PHedgehog; + Text: shortstring; + Tint: Longword; + end; + + TStatistics = record + DamageRecv, + DamageGiven: Longword; + StepDamageRecv, + StepDamageGiven, + StepKills: Longword; + MaxStepDamageRecv, + MaxStepDamageGiven, + MaxStepKills: Longword; + FinishedTurns: Longword; + end; + + TTeamStats = record + Kills : Longword; + AIKills : Longword; + TeamKills : Longword; + TurnSkips : Longword; + TeamDamage : Longword; + end; + + TBinds = array[0..cKeyMaxIndex] of shortstring; + TKeyboardState = array[0..cKeyMaxIndex] of Byte; + + PVoicepack = ^TVoicepack; + TVoicepack = record + name: shortstring; + chunks: array [TSound] of PMixChunk; + end; + + PHHAmmo = ^THHAmmo; + THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo; + + THedgehog = record + Name: string[MAXNAMELEN]; + Gear: PGear; + SpeechGear: PVisualGear; + NameTagTex, + HealthTagTex, + HatTex: PTexture; + Ammo: PHHAmmo; + CurAmmoType: TAmmoType; + AmmoStore: Longword; + Team: PTeam; + MultiShootAttacks: Longword; + visStepPos: LongWord; + BotLevel : Byte; // 0 - Human player + HatVisibility: GLfloat; + stats: TStatistics; + Hat: shortstring; + InitialHealth: LongInt; // used for gfResetHealth + King: boolean; // Flag for a bunch of hedgehog attributes + Unplaced: boolean; // Flag for hog placing mode + Timer: Longword; + Effects: Array[THogEffect] of boolean; + end; + + TTeam = record + Clan: PClan; + TeamName: string[MAXNAMELEN]; + ExtDriven: boolean; + Binds: TBinds; + Hedgehogs: array[0..cMaxHHIndex] of THedgehog; + CurrHedgehog: LongWord; + NameTagTex: PTexture; + CrosshairTex, + GraveTex, + HealthTex, + AIKillsTex, + FlagTex: PTexture; + Flag: shortstring; + GraveName: shortstring; + FortName: shortstring; + TeamHealth: LongInt; + TeamHealthBarWidth, + NewTeamHealthBarWidth: LongInt; + DrawHealthY: LongInt; + AttackBar: LongWord; + HedgehogsNumber: Longword; + hasGone: boolean; + voicepack: PVoicepack; + PlayerHash: shortstring; // md5 hash of player name. For temporary enabling of hats as thank you. Hashed for privacy of players + stats: TTeamStats; + end; + + TClan = record + Color: Longword; + Teams: array[0..Pred(cMaxTeams)] of PTeam; + TeamsNumber: Longword; + CurrTeam: LongWord; + ClanHealth: LongInt; + ClanIndex: LongInt; + TurnNumber: LongWord; + end; + + TAmmoStrId = (sidNothing, sidGrenade, sidClusterBomb, sidBazooka, sidBee, sidShotgun, + sidPickHammer, sidSkip, sidRope, sidMine, sidDEagle, + sidDynamite, sidBaseballBat, sidFirePunch, sidSeconds, + sidParachute, sidAirAttack, sidMineStrike, sidBlowTorch, + sidGirder, sidTeleport, sidSwitch, sidMortar, sidWhip, + sidKamikaze, sidCake, sidSeduction, sidWatermelon, + sidHellishBomb, sidDrill, sidBallgun, sidNapalm, sidRCPlane, + sidLowGravity, sidExtraDamage, sidInvulnerable, sidExtraTime, + sidLaserSight, sidVampiric, sidSniperRifle, sidJetpack, + sidMolotov, sidBirdy, sidPortalGun, sidPiano, sidGasBomb, sidSineGun, sidFlamethrower, + sidSMine, sidHammer, sidResurrector, sidDrillStrike); + + TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused, + sidConfirm, sidSuddenDeath, sidRemaining, sidFuel, sidSync, + sidNoEndTurn, sidNotYetAvailable, sidRoundSD, sidRoundsSD, sidReady); + + TEventId = (eidDied, eidDrowned, eidRoundStart, eidRoundWin, eidRoundDraw, + eidNewHealthPack, eidNewAmmoPack, eidNewUtilityPack, eidTurnSkipped, eidHurtSelf, + eidHomerun, eidGone); + + TGoalStrId = (gidCaption, gidSubCaption, gidForts, gidLowGravity, gidInvulnerable, + gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery, + gidSolidLand, gidSharedAmmo, gidMineTimer, gidNoMineTimer, gidRandomMineTimer, + gidDamageModifier, gidResetHealth, gidAISurvival, gidInfAttack, gidResetWeps, gidPerHogAmmo); + + TLandArray = packed array of array of LongWord; + TCollisionArray = packed array of array of Word; + TPreview = packed array[0..127, 0..31] of byte; + TDirtyTag = packed array of array of byte; + + +implementation + +end. \ No newline at end of file diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uUtils.pas --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hedgewars/uUtils.pas Thu Nov 18 16:58:08 2010 -0500 @@ -0,0 +1,316 @@ +{$INCLUDE "options.inc"} +unit uUtils; + +interface +uses uTypes, uFloat, GLunit; + +procedure SplitBySpace(var a, b: shortstring); +procedure SplitByChar(var a, b: ansistring; c: char); + +function EnumToStr(const en : TGearType) : shortstring; overload; +function EnumToStr(const en : TSound) : shortstring; overload; +function EnumToStr(const en : TAmmoType) : shortstring; overload; +function EnumToStr(const en : THogEffect) : shortstring; overload; + +function Min(a, b: LongInt): LongInt; inline; +function Max(a, b: LongInt): LongInt; inline; + +function IntToStr(n: LongInt): shortstring; +function FloatToStr(n: hwFloat): shortstring; + +function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat; +function DxDy2Angle32(const _dY, _dX: hwFloat): LongInt; +function DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt; + +procedure SetLittle(var r: hwFloat); + +function Str2PChar(const s: shortstring): PChar; +function DecodeBase64(s: shortstring): shortstring; + +function isPowerOf2(i: Longword): boolean; +function toPowerOf2(i: Longword): Longword; inline; + +function endian(independent: LongWord): LongWord; inline; + +function CheckCJKFont(s: ansistring; font: THWFont): THWFont; + +{$IFDEF DEBUGFILE} +procedure AddFileLog(s: shortstring); +{$ENDIF} + +procedure initModule; +procedure freeModule; + +implementation +uses typinfo, Math, uConsts, uVariables, SysUtils; + +var +{$IFDEF DEBUGFILE} + f: textfile; +{$ENDIF} + +// should this include "strtolower()" for the split string? +procedure SplitBySpace(var a, b: shortstring); +var i, t: LongInt; +begin +i:= Pos(' ', a); +if i > 0 then + begin + for t:= 1 to Pred(i) do + 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) + end else b:= ''; +end; + +procedure SplitByChar(var a, b: ansistring; c: char); +var i: LongInt; +begin +i:= Pos(c, a); +if i > 0 then + begin + b:= copy(a, i + 1, Length(a) - i); + setlength(a, Pred(i)); + end else b:= ''; +end; + +function EnumToStr(const en : TGearType) : shortstring; overload; +begin +EnumToStr:= GetEnumName(TypeInfo(TGearType), ord(en)) +end; + +function EnumToStr(const en : TSound) : shortstring; overload; +begin +EnumToStr:= GetEnumName(TypeInfo(TSound), ord(en)) +end; + +function EnumToStr(const en : TAmmoType) : shortstring; overload; +begin +EnumToStr:= GetEnumName(TypeInfo(TAmmoType), ord(en)) +end; + +function EnumToStr(const en: THogEffect) : shortstring; overload; +begin + EnumToStr := GetEnumName(TypeInfo(THogEffect), ord(en)) +end; + + +function Min(a, b: LongInt): LongInt; +begin +if a < b then Min:= a else Min:= b +end; + +function Max(a, b: LongInt): LongInt; +begin +if a > b then Max:= a else Max:= b +end; + + +function IntToStr(n: LongInt): shortstring; +begin +str(n, IntToStr) +end; + +function FloatToStr(n: hwFloat): shortstring; +begin +FloatToStr:= cstr(n) + '_' + inttostr(Lo(n.QWordValue)) +end; + + +function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat; +var dY, dX: Extended; +begin +dY:= _dY.QWordValue / $100000000; +if _dY.isNegative then dY:= - dY; +dX:= _dX.QWordValue / $100000000; +if _dX.isNegative then dX:= - dX; +DxDy2Angle:= arctan2(dY, dX) * 180 / pi +end; + +function DxDy2Angle32(const _dY, _dX: hwFloat): LongInt; +const _16divPI: Extended = 16/pi; +var dY, dX: Extended; +begin +dY:= _dY.QWordValue / $100000000; +if _dY.isNegative then dY:= - dY; +dX:= _dX.QWordValue / $100000000; +if _dX.isNegative then dX:= - dX; +DxDy2Angle32:= trunc(arctan2(dY, dX) * _16divPI) and $1f +end; + +function DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt; +const MaxAngleDivPI: Extended = cMaxAngle/pi; +var dY, dX: Extended; +begin +dY:= _dY.QWordValue / $100000000; +if _dY.isNegative then dY:= - dY; +dX:= _dX.QWordValue / $100000000; +if _dX.isNegative then dX:= - dX; +DxDy2AttackAngle:= trunc(arctan2(dY, dX) * MaxAngleDivPI) +end; + + +procedure SetLittle(var r: hwFloat); +begin +r:= SignAs(cLittle, r) +end; + + +function isPowerOf2(i: Longword): boolean; +begin +if i = 0 then exit(true); +while not odd(i) do i:= i shr 1; +isPowerOf2:= (i = 1) +end; + +function toPowerOf2(i: Longword): Longword; +begin +toPowerOf2:= 1; +while (toPowerOf2 < i) do toPowerOf2:= toPowerOf2 shl 1 +end; + + +function DecodeBase64(s: shortstring): shortstring; +const table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; +var i, t, c: Longword; +begin +c:= 0; +for i:= 1 to Length(s) do + begin + t:= Pos(s[i], table); + if s[i] = '=' then inc(c); + if t > 0 then byte(s[i]):= t - 1 else byte(s[i]):= 0 + end; + +i:= 1; +t:= 1; +while i <= length(s) do + begin + DecodeBase64[t ]:= char((byte(s[i ]) shl 2) or (byte(s[i + 1]) shr 4)); + DecodeBase64[t + 1]:= char((byte(s[i + 1]) shl 4) or (byte(s[i + 2]) shr 2)); + DecodeBase64[t + 2]:= char((byte(s[i + 2]) shl 6) or (byte(s[i + 3]) )); + inc(t, 3); + inc(i, 4) + end; + +if c < 3 then t:= t - c; + +byte(DecodeBase64[0]):= t - 1 +end; + + +function Str2PChar(const s: shortstring): PChar; +const CharArray: array[byte] of Char = ''; +begin +CharArray:= s; +CharArray[Length(s)]:= #0; +Str2PChar:= @CharArray +end; + + +function endian(independent: LongWord): LongWord; inline; +begin +{$IFDEF ENDIAN_LITTLE} +endian:= independent; +{$ELSE} +endian:= (((independent and $FF000000) shr 24) or + ((independent and $00FF0000) shr 8) or + ((independent and $0000FF00) shl 8) or + ((independent and $000000FF) shl 24)) +{$ENDIF} +end; + + +{$IFDEF DEBUGFILE} +procedure AddFileLog(s: shortstring); +begin +writeln(f, GameTicks: 6, ': ', s); +flush(f) +end; +{$ENDIF} + + +function CheckCJKFont(s: ansistring; font: THWFont): THWFont; +var l, i : LongInt; + u: WideChar; + tmpstr: array[0..256] of WideChar; +begin + +{$IFNDEF IPHONEOS} +// remove chinese fonts for now +if (font >= CJKfnt16) or (length(s) = 0) then +{$ENDIF} + exit(font); + +l:= Utf8ToUnicode(@tmpstr, Str2PChar(s), length(s))-1; +i:= 0; +while i < l do + begin + u:= tmpstr[i]; + if (#$2E80 <= u) and ( + (u <= #$2FDF ) or // CJK Radicals Supplement / Kangxi Radicals + ((#$2FF0 <= u) and (u <= #$303F)) or // Ideographic Description Characters / CJK Radicals Supplement + ((#$31C0 <= u) and (u <= #$31EF)) or // CJK Strokes + ((#$3200 <= u) and (u <= #$4DBF)) or // Enclosed CJK Letters and Months / CJK Compatibility / CJK Unified Ideographs Extension A + ((#$4E00 <= u) and (u <= #$9FFF)) or // CJK Unified Ideographs + ((#$F900 <= u) and (u <= #$FAFF)) or // CJK Compatibility Ideographs + ((#$FE30 <= u) and (u <= #$FE4F))) // CJK Compatibility Forms + then exit(THWFont( ord(font) + ((ord(High(THWFont))+1) div 2) )); + inc(i) + end; +exit(font); +(* two more to check. pascal WideChar is only 16 bit though + ((#$20000 <= u) and (u >= #$2A6DF)) or // CJK Unified Ideographs Extension B + ((#$2F800 <= u) and (u >= #$2FA1F))) // CJK Compatibility Ideographs Supplement *) +end; + +procedure initModule; +{$IFDEF DEBUGFILE}{$IFNDEF IPHONEOS}var i: LongInt;{$ENDIF}{$ENDIF} +begin +{$IFDEF DEBUGFILE} +{$I-} +{$IFDEF IPHONEOS} + Assign(f,'../Documents/hw-' + cLogfileBase + '.log'); + Rewrite(f); +{$ELSE} + if (ParamStr(1) <> '') and (ParamStr(2) <> '') then + if (ParamCount <> 3) and (ParamCount <> cDefaultParamNum) then + begin + for i:= 0 to 7 do + begin + assign(f, ExtractFileDir(ParamStr(2)) + '/' + cLogfileBase + inttostr(i) + '.log'); + rewrite(f); + if IOResult = 0 then break; + end; + if IOResult <> 0 then f:= stderr; // if everything fails, write to stderr + end + else + begin + for i:= 0 to 7 do + begin + assign(f, ParamStr(1) + '/Logs/' + cLogfileBase + inttostr(i) + '.log'); + rewrite(f); + if IOResult = 0 then break; + end; + if IOResult <> 0 then f:= stderr; // if everything fails, write to stderr + end + else + f:= stderr; +{$ENDIF} +{$I+} +{$ENDIF} + +end; + +procedure freeModule; +begin + recordFileName:= ''; + +{$IFDEF DEBUGFILE} + writeln(f, 'halt at ', GameTicks, ' ticks. TurnTimeLeft = ', TurnTimeLeft); + flush(f); + close(f); +{$ENDIF} +end; + +end. \ No newline at end of file diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uVariables.pas --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hedgewars/uVariables.pas Thu Nov 18 16:58:08 2010 -0500 @@ -0,0 +1,2241 @@ +{$INCLUDE options.inc} + +unit uVariables; +interface + +uses SDLh, uTypes, uFloat, GLunit, uConsts, Math, uMobile; + +var +/////// init flags /////// + cScreenWidth : LongInt = 1024; + cScreenHeight : LongInt = 768; + cBits : LongInt = 32; + //ipcPort is in uIO + cFullScreen : boolean = false; + isSoundEnabled : boolean = true; + isMusicEnabled : boolean = false; + cLocaleFName : shortstring = 'en.txt'; + cInitVolume : LongInt = 100; + cTimerInterval : LongInt = 8; + PathPrefix : shortstring = './'; + cShowFPS : boolean = false; + cAltDamage : boolean = true; + cReducedQuality : LongWord = rqNone; + //userNick is in uChat + recordFileName : shortstring = ''; + cReadyDelay : Longword = 0; + cLogfileBase : shortstring = 'debug'; +////////////////////////// + + isCursorVisible : boolean; + isTerminated : boolean; + isInLag : boolean; + isPaused : boolean; + + isSEBackup : boolean; + isInMultiShoot : boolean; + isSpeed : boolean; + isFirstFrame : boolean; + + fastUntilLag : boolean; + + GameState : TGameState; + GameType : TGameType; + GameFlags : Longword; + TrainingFlags : Longword; + TurnTimeLeft : Longword; + ReadyTimeLeft : Longword; + cSuddenDTurns : LongInt; + cDamagePercent : LongInt; + cMineDudPercent : LongWord; + cTemplateFilter : LongInt; + cMapGen : LongInt; + cMazeSize : LongInt; + + cHedgehogTurnTime: Longword; + cMinesTime : LongInt; + cMaxAIThinkTime : Longword; + + cHealthCaseProb : LongInt; + cHealthCaseAmount: LongInt; + cWaterRise : LongInt; + cHealthDecrease : LongInt; + + cCloudsNumber : LongInt; + + cTagsMask : byte; + zoom : GLfloat; + ZoomValue : GLfloat; + + cWaterLine : LongInt; + cGearScrEdgesDist: LongInt; + + GameTicks : LongWord; + TrainingTimeInc : Longword; + TrainingTimeInD : Longword; + TrainingTimeInM : Longword; + TrainingTimeMax : Longword; + + TimeTrialStartTime: Longword; + TimeTrialStopTime : Longword; + + // originally from uConsts + Pathz: array[TPathType] of shortstring; + CountTexz: array[1..Pred(AMMO_INFINITE)] of PTexture; + LAND_WIDTH : LongInt; + LAND_HEIGHT : LongInt; + LAND_WIDTH_MASK : LongWord; + LAND_HEIGHT_MASK : LongWord; + cMaxCaptions : LongInt; + + cLeftScreenBorder : LongInt; + cRightScreenBorder : LongInt; + cScreenSpace : LongInt; + + cCaseFactor : Longword; + cLandMines : Longword; + cExplosives : Longword; + + cSeed : shortstring; + cVolumeDelta : LongInt; + cHasFocus : boolean; + cInactDelay : Longword; + + bBetweenTurns : boolean; + bWaterRising : boolean; + + ShowCrosshair : boolean; + CursorMovementX : LongInt; + CursorMovementY : LongInt; + cDrownSpeed : hwFloat; + cDrownSpeedf : real; + cMaxWindSpeed : hwFloat; + cWindSpeed : hwFloat; + cWindSpeedf : real; + cGravity : hwFloat; + cGravityf : real; + cDamageModifier : hwFloat; + cLaserSighting : boolean; + cVampiric : boolean; + cArtillery : boolean; + WeaponTooltipTex : PTexture; + + flagMakeCapture : boolean; + + InitStepsFlags : Longword; + RealTicks : Longword; + AttackBar : LongInt; + + WaterColorArray : array[0..3] of HwColor4f; + + CursorPoint : TPoint; + TargetPoint : TPoint; + + ScreenFade : TScreenFade; + ScreenFadeValue : LongInt; + ScreenFadeSpeed : LongInt; + +{$IFDEF SDL13} + SDLwindow : PSDL_Window; +{$ENDIF} + + WorldDx: LongInt; + WorldDy: LongInt; + +const + cHHFileName = 'Hedgehog'; + cCHFileName = 'Crosshair'; + cThemeCFGFilename = 'theme.cfg'; + + FontBorder = 2; + cPathz: array[TPathType] of shortstring = ( + '', // ptNone + '', // ptData + 'Graphics', // ptGraphics + 'Themes', // ptThemes + 'Themes/avematan', // ptCurrTheme + 'Teams', // ptTeams + 'Maps', // ptMaps + '', // ptMapCurrent + 'Demos', // ptDemos + 'Sounds', // ptSounds + 'Graphics/Graves', // ptGraves + 'Fonts', // ptFonts + 'Forts', // ptForts + 'Locale', // ptLocale + 'Graphics/AmmoMenu', // ptAmmoMenu + 'Graphics/Hedgehog', // ptHedgehog + 'Sounds/voices', // ptVoices + 'Graphics/Hats', // ptHats + 'Graphics/Flags', // ptFlags + 'Missions/Maps' // ptMissionMaps + ); + + cTagsMasks : array[0..15] of byte = (7, 0, 0, 0, 15, 6, 4, 5, 0, 0, 0, 0, 0, 14, 12, 13); + cTagsMasksNoHealth: array[0..15] of byte = (3, 2, 11, 1, 0, 0, 0, 0, 0, 10, 0, 9, 0, 0, 0, 0); + + Fontz: array[THWFont] of THHFont = ( + (Handle: nil; + Height: 12; + style: TTF_STYLE_NORMAL; + Name: 'DejaVuSans-Bold.ttf'), + (Handle: nil; + Height: 24; + style: TTF_STYLE_NORMAL; + Name: 'DejaVuSans-Bold.ttf'), + (Handle: nil; + Height: 10; + style: TTF_STYLE_NORMAL; + Name: 'DejaVuSans-Bold.ttf') + {$IFNDEF IPHONEOS}, // remove chinese fonts for now + (Handle: nil; + Height: 12; + style: TTF_STYLE_NORMAL; + Name: 'wqy-zenhei.ttc'), + (Handle: nil; + Height: 24; + style: TTF_STYLE_NORMAL; + Name: 'wqy-zenhei.ttc'), + (Handle: nil; + Height: 10; + style: TTF_STYLE_NORMAL; + Name: 'wqy-zenhei.ttc') + {$ENDIF} + ); + + SpritesData: array[TSprite] of record + FileName: String[16]; + Path, AltPath: TPathType; + Texture: PTexture; + Surface: PSDL_Surface; + Width, Height, imageWidth, imageHeight: LongInt; + saveSurf: boolean; + priority: GLfloat; + getDimensions, getImageDimensions: boolean; + end = ( + (FileName: 'BlueWater'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil; + Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: true; getImageDimensions: true),// sprWater + (FileName: 'Clouds'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil; + Width: 256; Height:128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprCloud + (FileName: 'Bomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBomb + (FileName: 'BigDigits'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBigDigit + (FileName: 'Frame'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 4; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprFrame + (FileName: 'Lag'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 65; Height: 65; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprLag + (FileName: 'Arrow'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprCursor + (FileName:'BazookaShell'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBazookaShell + (FileName: 'Targetp'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprTargetP + (FileName: 'Bee'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBee + (FileName: 'SmokeTrace'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprSmokeTrace + (FileName: 'RopeHook'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprRopeHook + (FileName: 'Expl50'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprExplosion50 + (FileName: 'MineOff'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMineOff + (FileName: 'MineOn'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMineOn + (FileName: 'MineDead'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMineDead + (FileName: 'Case'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprCase + (FileName: 'FirstAid'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprFAid + (FileName: 'dynamite'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprDynamite + (FileName: 'Power'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprPower + (FileName: 'ClBomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprClusterBomb + (FileName: 'ClParticle'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprClusterParticle + (FileName: 'Flame'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprFlame + (FileName: 'horizont'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil; + Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprHorizont + (FileName: 'horizontL'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil; + Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprHorizont + (FileName: 'horizontR'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil; + Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprHorizont + (FileName: 'Sky'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil; + Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSky + (FileName: 'SkyL'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil; + Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSky + (FileName: 'SkyR'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil; + Width: 0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSky + (FileName: 'BorderHorizontal'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 33; Height: 2; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: true),// sprAMBorderHorizontal + (FileName: 'BorderVertical'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 2; Height: 33; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: true),// sprAMBorderVertical + (FileName: 'Slot'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 33; Height: 33; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMSlot + (FileName: 'Ammos'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMAmmos + (FileName: 'SlotKeys'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMSlotKeys + (FileName: 'Corners'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 2; Height: 2; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMCorners + (FileName: 'Finger'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprFinger + (FileName: 'AirBomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAirBomb + (FileName: 'Airplane'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 254; Height: 101; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAirplane + (FileName: 'amAirplane'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAmAirplane + (FileName: 'amGirder'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 160; Height:160; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAmGirder + (FileName: 'hhMask'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHHTelepMask + (FileName: 'Switch'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSwitch + (FileName: 'Parachute'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprParachute + (FileName: 'Target'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprTarget + (FileName: 'RopeNode'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 6; Height: 6; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprRopeNode + (FileName: 'thinking'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprQuestion + (FileName: 'PowerBar'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 256; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPowerBar + (FileName: 'WindBar'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 151; Height: 17; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWindBar + (FileName: 'WindL'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 80; Height: 13; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWindL + (FileName: 'WindR'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 80; Height: 13; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWindR + (FileName: 'Flake'; Path:ptCurrTheme; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprFlake + (FileName: 'amRope'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandRope + (FileName: 'amBazooka'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandBazooka + (FileName: 'amShotgun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandShotgun + (FileName: 'amDEagle'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandDEagle + (FileName:'amAirAttack'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandAirAttack + (FileName: 'amBaseball'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandBaseball + (FileName: 'Hammer'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPHammer + (FileName: 'amBTorch_i'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandBlowTorch + (FileName: 'amBTorch_w'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBlowTorch + (FileName: 'Teleport'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprTeleport + (FileName: 'HHDeath'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprHHDeath + (FileName:'amShotgun_w'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprShotgun + (FileName: 'amDEagle_w'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprDEagle + (FileName: 'Idle'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprHHIdle + (FileName: 'Mortar'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMortar + (FileName: 'TurnsLeft'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprTurnsLeft + (FileName: 'amKamikaze'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 256; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprKamikaze + (FileName: 'amWhip'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 128; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWhip + (FileName: 'Kowtow'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprKowtow + (FileName: 'Sad'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprSad + (FileName: 'Wave'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprWave + (FileName: 'Hurrah'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprHurrah + (FileName:'ILoveLemonade';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 128; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprLemonade + (FileName: 'Shrug'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprShrug + (FileName: 'Juggle'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprJuggle + (FileName: 'ExplPart'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprExplPart + (FileName: 'ExplPart2'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprExplPart2 + (FileName: 'Cake_walk'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprCakeWalk + (FileName: 'Cake_down'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprCakeDown + (FileName: 'Ammos_bw'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprAMAmmosBW + (FileName: 'Watermelon'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWatermelon + (FileName: 'EvilTrace'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprEvilTrace + (FileName:'HellishBomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHellishBomb + (FileName: 'Seduction'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSeduction + (FileName: 'HHDress'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprDress + (FileName: 'Censored'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprCensored + (FileName: 'Drill'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprDrill + (FileName: 'amDrill'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandDrill + (FileName: 'amBallgun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandBallgun + (FileName: 'Balls'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 20; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprBalls + (FileName: 'RCPlane'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPlane + (FileName: 'amRCPlane'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandPlane + (FileName: 'Utility'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprUtility + (FileName:'Invulnerable';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprInvulnerable + (FileName: 'Vampiric'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprVampiric + (FileName: 'amGirder'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 512; Height:512; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprGirder + (FileName:'SpeechCorner';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 12; Height: 9; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprSpeechCorner + (FileName: 'SpeechEdge'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 25; Height: 9; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprSpeechEdge + (FileName: 'SpeechTail'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 25; Height: 26; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprSpeechTail + (FileName:'ThoughtCorner';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 49; Height: 37; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprThoughtCorner + (FileName:'ThoughtEdge'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 23; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprThoughtEdge + (FileName:'ThoughtTail'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 45; Height: 65; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprThoughtTail + (FileName:'ShoutCorner'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 34; Height: 23; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprShoutCorner + (FileName: 'ShoutEdge'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 30; Height: 20; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprShoutEdge + (FileName: 'ShoutTail'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 30; Height: 37; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprShoutTail + (FileName:'amSniperRifle';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 128; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSniperRifle + (FileName: 'Bubbles'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprBubbles + (FileName: 'amJetpack'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprJetpack + (FileName: 'Health'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprHealth + (FileName: 'amMolotov'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),//sprHandMolotov + (FileName: 'Molotov'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMolotov + (FileName: 'Smoke'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 22; Height: 22; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprSmoke + (FileName: 'SmokeWhite'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 22; Height: 22; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprSmokeWhite + (FileName: 'Shells'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLow; getDimensions: false; getImageDimensions: true),// sprShell + (FileName: 'Dust'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil; + Width: 22; Height: 22; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprDust + (FileName: 'Explosives'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprExplosives + (FileName: 'ExplosivesRoll'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprExplosivesRoll + (FileName: 'amTeleport'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAmTeleport + (FileName: 'Splash'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil; + Width: 80; Height: 50; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSplash + (FileName: 'Droplet'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprDroplet + (FileName: 'Birdy'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 75; Height: 75; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBirdy + (FileName: 'amCake'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandCake + (FileName: 'amConstruction'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandConstruction + (FileName: 'amGrenade'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandGrenade + (FileName: 'amMelon'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandMelon + (FileName: 'amMortar'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandMortar + (FileName: 'amSkip'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandSkip + (FileName: 'amCluster'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandCluster + (FileName: 'amDynamite'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandDynamite + (FileName: 'amHellish'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandHellish + (FileName: 'amMine'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandMine + (FileName: 'amSeduction'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandSeduction + (FileName: 'amVamp'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandVamp + (FileName: 'BigExplosion'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 385; Height: 385; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBigExplosion + (FileName: 'SmokeRing'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 200; Height: 200; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSmokeRing + (FileName: 'BeeTrace'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprBeeTrace + (FileName: 'Egg'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprEgg + (FileName: 'TargetBee'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprTargetBee + (FileName: 'amBee'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandBee + (FileName: 'Feather'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 15; Height: 25; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprFeather + (FileName: 'Piano'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPiano + (FileName: 'amSineGun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandSineGun + (FileName: 'amPortalGun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 128; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPortalGun + (FileName: 'Portal'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPortal + (FileName: 'cheese'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprCheese + (FileName: 'amCheese'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandCheese + (FileName: 'amFlamethrower'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandFlamethrower + (FileName: 'Chunk'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprChunk + (FileName: 'Note'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprNote + (FileName: 'SMineOff'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSMineOff + (FileName: 'SMineOn'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSMineOn + (FileName: 'amSMine'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandSMine + (FileName: 'amHammer'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 128; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true), // sprWhip + (FileName: 'amResurrector'; Path: ptHedgehog; AltPath: ptNone; + Texture: nil; Surface: nil; Width: 32; Height: 32; + imageWidth: 0; imageHeight: 0; saveSurf: false; priority: + tpMedium; getDimensions: false; getImageDimensions: true), + //sprHandResurrector + (FileName: 'Cross'; Path: ptGraphics; altPath: ptNone; + Texture: nil; Surface: nil; Width: 108; Height: 138; + imageWidth: 0; imageHeight: 0; saveSurf: false; priority: + tpMedium; getDimensions: false; getImageDimensions: true), + //sprCross + (FileName: 'AirDrill'; Path: ptGraphics; AltPath: ptNone; + Texture: nil; Surface: nil; Width: 16; Height: 16; + imageWidth: 0; imageHeight: 0; saveSurf: false; priority: + tpMedium; getDimensions: false; getImageDimensions: true), + // sprAirDrill + (FileName: 'NapalmBomb'; Path: ptGraphics; AltPath: ptNone; + Texture: nil; Surface: nil; Width: 16; Height: 16; + imageWidth: 0; imageHeight: 0; saveSurf: false; priority: + tpMedium; getDimensions: false; getImageDimensions: true), + // sprNapalmBomb + (FileName: 'BulletHit'; Path: ptGraphics; AltPath: ptNone; + Texture: nil; Surface: nil; Width: 32; Height: 32; + imageWidth: 0; imageHeight: 0; saveSurf: false; priority: + tpMedium; getDimensions: false; getImageDimensions: true) + // sprNapalmBomb + ); + + + Wavez: array [TWave] of record + Sprite: TSprite; + FramesCount: Longword; + Interval: Longword; + cmd: String[20]; + Voice: TSound; + VoiceDelay: LongWord; + end = ( + (Sprite: sprKowtow; FramesCount: 12; Interval: 125; cmd: '/rollup'; Voice: sndNone; VoiceDelay: 0), + (Sprite: sprSad; FramesCount: 14; Interval: 125; cmd: '/sad'; Voice: sndNone; VoiceDelay: 0), + (Sprite: sprWave; FramesCount: 16; Interval: 125; cmd: '/wave'; Voice: sndHello; VoiceDelay: 5), + (Sprite: sprHurrah; FramesCount: 14; Interval: 125; cmd: '/hurrah'; Voice: sndNone; VoiceDelay: 0), + (Sprite: sprLemonade; FramesCount: 24; Interval: 125; cmd: '/ilovelotsoflemonade'; Voice: sndNone; VoiceDelay: 0), + (Sprite: sprShrug; FramesCount: 24; Interval: 125; cmd: '/shrug'; Voice: sndNone; VoiceDelay: 0), + (Sprite: sprJuggle; FramesCount: 49; Interval: 38; cmd: '/juggle'; Voice: sndNone; VoiceDelay: 0) + ); + + Soundz: array[TSound] of record + FileName: String[25]; + Path : TPathType; + end = ( + (FileName: ''; Path: ptNone ),// sndNone + (FileName: 'grenadeimpact.ogg'; Path: ptSounds),// sndGrenadeImpact + (FileName: 'explosion.ogg'; Path: ptSounds),// sndExplosion + (FileName: 'throwpowerup.ogg'; Path: ptSounds),// sndThrowPowerUp + (FileName: 'throwrelease.ogg'; Path: ptSounds),// sndThrowRelease + (FileName: 'splash.ogg'; Path: ptSounds),// sndSplash + (FileName: 'shotgunreload.ogg'; Path: ptSounds),// sndShotgunReload + (FileName: 'shotgunfire.ogg'; Path: ptSounds),// sndShotgunFire + (FileName: 'graveimpact.ogg'; Path: ptSounds),// sndGraveImpact + (FileName: 'minetick.ogg'; Path: ptSounds),// sndMineTicks + (FileName: 'pickhammer.ogg'; Path: ptSounds),// sndPickhammer + (FileName: 'gun.ogg'; Path: ptSounds),// sndGun + (FileName: 'bee.ogg'; Path: ptSounds),// sndBee + (FileName: 'Jump1.ogg'; Path: ptVoices),// sndJump1 + (FileName: 'Jump2.ogg'; Path: ptVoices),// sndJump2 + (FileName: 'Jump3.ogg'; Path: ptVoices),// sndJump3 + (FileName: 'Yessir.ogg'; Path: ptVoices),// sndYesSir + (FileName: 'Laugh.ogg'; Path: ptVoices),// sndLaugh + (FileName: 'Illgetyou.ogg'; Path: ptVoices),// sndIllGetYou + (FileName: 'Incoming.ogg'; Path: ptVoices),// sndIncoming + (FileName: 'Missed.ogg'; Path: ptVoices),// sndMissed + (FileName: 'Stupid.ogg'; Path: ptVoices),// sndStupid + (FileName: 'Firstblood.ogg'; Path: ptVoices),// sndFirstBlood + (FileName: 'Boring.ogg'; Path: ptVoices),// sndBoring + (FileName: 'Byebye.ogg'; Path: ptVoices),// sndByeBye + (FileName: 'Sameteam.ogg'; Path: ptVoices),// sndSameTeam + (FileName: 'Nutter.ogg'; Path: ptVoices),// sndNutter + (FileName: 'Reinforcements.ogg'; Path: ptVoices),// sndReinforce + (FileName: 'Traitor.ogg'; Path: ptVoices),// sndTraitor + (FileName: 'Youllregretthat.ogg'; Path: ptVoices),// sndRegret + (FileName: 'Enemydown.ogg'; Path: ptVoices),// sndEnemyDown + (FileName: 'Coward.ogg'; Path: ptVoices),// sndCoward + (FileName: 'Hurry.ogg'; Path: ptVoices),// sndHurry + (FileName: 'Watchit.ogg'; Path: ptVoices),// sndWatchIt + (FileName: 'Kamikaze.ogg'; Path: ptVoices),// sndKamikaze + (FileName: 'cake2.ogg'; Path: ptSounds),// sndCake + (FileName: 'Ow1.ogg'; Path: ptVoices),// sndOw1 + (FileName: 'Ow2.ogg'; Path: ptVoices),// sndOw2 + (FileName: 'Ow3.ogg'; Path: ptVoices),// sndOw3 + (FileName: 'Ow4.ogg'; Path: ptVoices),// sndOw4 + (FileName: 'Firepunch1.ogg'; Path: ptVoices),// sndFirepunch1 + (FileName: 'Firepunch2.ogg'; Path: ptVoices),// sndFirepunch2 + (FileName: 'Firepunch3.ogg'; Path: ptVoices),// sndFirepunch3 + (FileName: 'Firepunch4.ogg'; Path: ptVoices),// sndFirepunch4 + (FileName: 'Firepunch5.ogg'; Path: ptVoices),// sndFirepunch5 + (FileName: 'Firepunch6.ogg'; Path: ptVoices),// sndFirepunch6 + (FileName: 'Melon.ogg'; Path: ptVoices),// sndMelon + (FileName: 'Hellish.ogg'; Path: ptSounds),// sndHellish + (FileName: 'Yoohoo.ogg'; Path: ptSounds),// sndYoohoo + (FileName: 'rcplane.ogg'; Path: ptSounds),// sndRCPlane + (FileName: 'whipcrack.ogg'; Path: ptSounds),// sndWhipCrack + (FileName:'ride_of_the_valkyries.ogg'; Path: ptSounds),// sndRideOfTheValkyries + (FileName: 'denied.ogg'; Path: ptSounds),// sndDenied + (FileName: 'placed.ogg'; Path: ptSounds),// sndPlaced + (FileName: 'baseballbat.ogg'; Path: ptSounds),// sndBaseballBat + (FileName: 'steam.ogg'; Path: ptSounds),// sndVaporize + (FileName: 'warp.ogg'; Path: ptSounds),// sndWarp + (FileName: 'suddendeath.ogg'; Path: ptSounds),// sndSuddenDeath + (FileName: 'mortar.ogg'; Path: ptSounds),// sndMortar + (FileName: 'shutterclick.ogg'; Path: ptSounds),// sndShutter + (FileName: 'homerun.ogg'; Path: ptSounds),// sndHomerun + (FileName: 'molotov.ogg'; Path: ptSounds),// sndMolotov + (FileName: 'Takecover.ogg'; Path: ptVoices),// sndCover + (FileName: 'Uh-oh.ogg'; Path: ptVoices),// sndUhOh + (FileName: 'Oops.ogg'; Path: ptVoices),// sndOops + (FileName: 'Nooo.ogg'; Path: ptVoices),// sndNooo + (FileName: 'Hello.ogg'; Path: ptVoices),// sndHello + (FileName: 'ropeshot.ogg'; Path: ptSounds),// sndRopeShot + (FileName: 'ropeattach.ogg'; Path: ptSounds),// sndRopeAttach + (FileName: 'roperelease.ogg'; Path: ptSounds),// sndRopeRelease + (FileName: 'switchhog.ogg'; Path: ptSounds),// sndSwitchHog + (FileName: 'victory.ogg'; Path: ptVoices),// sndVictory + (FileName: 'sniperreload.ogg'; Path: ptSounds),// sndSniperReload + (FileName: 'steps.ogg'; Path: ptSounds),// sndSteps + (FileName: 'lowgravity.ogg'; Path: ptSounds),// sndLowGravity + (FileName: 'hell_growl.ogg'; Path: ptSounds),// sndHellishImpact1 + (FileName: 'hell_ooff.ogg'; Path: ptSounds),// sndHellishImpact2 + (FileName: 'hell_ow.ogg'; Path: ptSounds),// sndHellishImpact3 + (FileName: 'hell_ugh.ogg'; Path: ptSounds),// sndHellishImpact4 + (FileName: 'melonimpact.ogg'; Path: ptSounds),// sndMelonImpact + (FileName: 'Droplet1.ogg'; Path: ptSounds),// sndDroplet1 + (FileName: 'Droplet2.ogg'; Path: ptSounds),// sndDroplet2 + (FileName: 'Droplet3.ogg'; Path: ptSounds),// sndDroplet3 + (FileName: 'egg.ogg'; Path: ptSounds),// sndEggBreak + (FileName: 'drillgun.ogg'; Path: ptSounds),// sndDrillRocket + (FileName: 'PoisonCough.ogg'; Path: ptVoices),// sndPoisonCough + (FileName: 'PoisonMoan.ogg'; Path: ptVoices),// sndPoisonMoan + (FileName: 'BirdyLay.ogg'; Path: ptSounds),// sndBirdyLay + (FileName: 'Whistle.ogg'; Path: ptSounds),// sndWhistle + (FileName: 'beewater.ogg'; Path: ptSounds),// sndBeeWater + (FileName: '1C.ogg'; Path: ptSounds),// sndPiano0 + (FileName: '2D.ogg'; Path: ptSounds),// sndPiano1 + (FileName: '3E.ogg'; Path: ptSounds),// sndPiano2 + (FileName: '4F.ogg'; Path: ptSounds),// sndPiano3 + (FileName: '5G.ogg'; Path: ptSounds),// sndPiano4 + (FileName: '6A.ogg'; Path: ptSounds),// sndPiano5 + (FileName: '7B.ogg'; Path: ptSounds),// sndPiano6 + (FileName: '8C.ogg'; Path: ptSounds),// sndPiano7 + (FileName: '9D.ogg'; Path: ptSounds),// sndPiano8 + (FileName: 'skip.ogg'; Path: ptSounds),// sndSkip + (FileName: 'shotgunfire.ogg'; Path: ptSounds),// sndSineGun + (FileName: 'Ooff1.ogg'; Path: ptVoices),// sndOoff1 + (FileName: 'Ooff2.ogg'; Path: ptVoices),// sndOoff2 + (FileName: 'Ooff3.ogg'; Path: ptVoices),// sndOoff3 + (FileName: 'whipcrack.ogg'; Path: ptSounds),// sndWhack + (FileName: 'Comeonthen.ogg'; Path: ptVoices),// sndComeonthen + (FileName: 'parachute.ogg'; Path: ptSounds),// sndParachute + (FileName: 'bump.ogg'; Path: ptSounds),// sndBump + (FileName: 'hogchant3.ogg'; Path: ptSounds) // sndResurrector + ); + + Ammoz: array [TAmmoType] of record + NameId: TAmmoStrId; + NameTex: PTexture; + Probability, NumberInCase: Longword; + Ammo: TAmmo; + Slot: 0..cMaxSlotIndex; + TimeAfterTurn: Longword; + minAngle, maxAngle: Longword; + isDamaging: boolean; + SkipTurns: Longword; + PosCount: Longword; + PosSprite: TSprite; + ejectX, ejectY: Longint; + end = ( + (NameId: sidNothing; + NameTex: nil; + Probability: 0; + NumberInCase: 0; + Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold or ammoprop_Effect; + Count: AMMO_INFINITE; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amNothing; + AttackVoice: sndNone); + Slot: 0; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 9999; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Grenade + (NameId: sidGrenade; + NameTex: nil; + Probability: 0; + NumberInCase: 1; + Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse; + Count: AMMO_INFINITE; + NumPerTurn: 0; + Timer: 3000; + Pos: 0; + AmmoType: amGrenade; + AttackVoice: sndCover); + Slot: 1; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// ClusterBomb + (NameId: sidClusterBomb; + NameTex: nil; + Probability: 100; + NumberInCase: 3; + Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse; + Count: 5; + NumPerTurn: 0; + Timer: 3000; + Pos: 0; + AmmoType: amClusterBomb; + AttackVoice: sndCover); + Slot: 1; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Bazooka + (NameId: sidBazooka; + NameTex: nil; + Probability: 0; + NumberInCase: 1; + Ammo: (Propz: ammoprop_Power or ammoprop_AltUse; + Count: AMMO_INFINITE; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amBazooka; + AttackVoice: sndNone); + Slot: 0; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; //20; + ejectY: -6), + +// Bee + (NameId: sidBee; + NameTex: nil; + Probability: 100; + NumberInCase: 1; + Ammo: (Propz: ammoprop_Power or ammoprop_NeedTarget or ammoprop_DontHold; + Count: 2; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amBee; + AttackVoice: sndNone); + Slot: 0; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; //16; + ejectY: 0), + +// Shotgun + (NameId: sidShotgun; + NameTex: nil; + Probability: 0; + NumberInCase: 1; + Ammo: (Propz: ammoprop_ForwMsgs; + Count: AMMO_INFINITE; + NumPerTurn: 1; + Timer: 0; + Pos: 0; + AmmoType: amShotgun; + AttackVoice: sndNone); + Slot: 2; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; //26; + ejectY: -6), + +// PickHammer + (NameId: sidPickHammer; + NameTex: nil; + Probability: 0; + NumberInCase: 1; + Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInMove or ammoprop_NoCrosshair or ammoprop_DontHold; + Count: 2; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amPickHammer; + AttackVoice: sndNone); + Slot: 6; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Skip + (NameId: sidSkip; + NameTex: nil; + Probability: 0; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold; + Count: AMMO_INFINITE; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amSkip; + AttackVoice: sndNone); + Slot: 9; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Rope + (NameId: sidRope; + NameTex: nil; + Probability: 100; + NumberInCase: 3; + Ammo: (Propz: ammoprop_NoRoundEnd or + ammoprop_ForwMsgs or + ammoprop_AttackInMove or + ammoprop_Utility or + ammoprop_AltAttack; + Count: 5; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amRope; + AttackVoice: sndNone); + Slot: 7; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: cMaxAngle div 2; + isDamaging: false; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Mine + (NameId: sidMine; + NameTex: nil; + Probability: 100; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInMove or ammoprop_DontHold or ammoprop_AltUse; + Count: 2; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amMine; + AttackVoice: sndLaugh); + Slot: 4; + TimeAfterTurn: 5000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// DEagle + (NameId: sidDEagle; + NameTex: nil; + Probability: 20; + NumberInCase: 2; + Ammo: (Propz: 0; + Count: 3; + NumPerTurn: 3; + Timer: 0; + Pos: 0; + AmmoType: amDEagle; + AttackVoice: sndNone); + Slot: 2; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; //23; + ejectY: -6), + +// Dynamite + (NameId: sidDynamite; + NameTex: nil; + Probability: 100; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInMove or ammoprop_DontHold or ammoprop_AltUse; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amDynamite; + AttackVoice: sndLaugh); + Slot: 4; + TimeAfterTurn: 5000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// FirePunch + (NameId: sidFirePunch; + NameTex: nil; + Probability: 0; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_ForwMsgs or ammoprop_AttackInMove; + Count: AMMO_INFINITE; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amFirePunch; + AttackVoice: sndNone); + Slot: 3; + TimeAfterTurn: 3000; + MinAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Whip + (NameId: sidWhip; + NameTex: nil; + Probability: 0; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoCrosshair; + Count: AMMO_INFINITE; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amWhip; + AttackVoice: sndNone); + Slot: 3; + TimeAfterTurn: 3000; + MinAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// BaseballBat + (NameId: sidBaseballBat; + NameTex: nil; + Probability: 100; + NumberInCase: 1; + Ammo: (Propz: ammoprop_DontHold; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amBaseballBat; + AttackVoice: sndNone); + Slot: 3; + TimeAfterTurn: 5000; + minAngle: 0; + maxAngle: cMaxAngle div 2; + isDamaging: true; + SkipTurns: 2; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Parachute + (NameId: sidParachute; + NameTex: nil; + Probability: 100; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoRoundEnd or + ammoprop_ForwMsgs or + ammoprop_AttackInMove or + ammoprop_NoCrosshair or + ammoprop_DontHold or + ammoprop_Utility or + ammoprop_AltAttack; + Count: 2; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amParachute; + AttackVoice: sndNone); + Slot: 7; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// AirAttack + (NameId: sidAirAttack; + NameTex: nil; + Probability: 100; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoCrosshair or + ammoprop_NeedTarget or + ammoprop_AttackingPut or + ammoprop_DontHold or + ammoprop_NotBorder; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amAirAttack; + AttackVoice: sndIncoming); + Slot: 5; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 5; + PosCount: 2; + PosSprite: sprAmAirplane; + ejectX: 0; + ejectY: 0), + +// MineStrike + (NameId: sidMineStrike; + NameTex: nil; + Probability: 200; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoCrosshair or + ammoprop_NeedTarget or + ammoprop_AttackingPut or + ammoprop_DontHold or + ammoprop_NotBorder; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amMineStrike; + AttackVoice: sndIncoming); + Slot: 5; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 5; + PosCount: 2; + PosSprite: sprAmAirplane; + ejectX: 0; + ejectY: 0), + +// BlowTorch + (NameId: sidBlowTorch; + NameTex: nil; + Probability: 100; + NumberInCase: 2; + Ammo: (Propz: ammoprop_ForwMsgs; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amBlowTorch; + AttackVoice: sndNone); + Slot: 6; + TimeAfterTurn: 3000; + minAngle: 768; + maxAngle: 1280; + isDamaging: false; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Girder + (NameId: sidGirder; + NameTex: nil; + Probability: 150; + NumberInCase: 3; + Ammo: (Propz: ammoprop_NoRoundEnd or + ammoprop_NoCrosshair or + ammoprop_NeedTarget or + ammoprop_Utility or + ammoprop_AttackingPut; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amGirder; + AttackVoice: sndNone); + Slot: 6; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 0; + PosCount: 8; + PosSprite: sprAmGirder; + ejectX: 0; + ejectY: 0), + +// Teleport + (NameId: sidTeleport; + NameTex: nil; + Probability: 200; + NumberInCase: 1; + Ammo: (Propz: ammoprop_ForwMsgs or + ammoprop_NoCrosshair or + ammoprop_NeedTarget or + ammoprop_AttackingPut or + ammoprop_Utility or + ammoprop_DontHold; + Count: 2; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amTeleport; + AttackVoice: sndNone); + Slot: 7; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 0; + PosCount: 2; + PosSprite: sprAmTeleport; + ejectX: 0; + ejectY: 0), + +// Switch + (NameId: sidSwitch; + NameTex: nil; + Probability: 100; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoRoundEnd or + ammoprop_ForwMsgs or + ammoprop_NoCrosshair or + ammoprop_Utility or + ammoprop_DontHold; + Count: 3; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amSwitch; + AttackVoice: sndNone); + Slot: 9; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Mortar + (NameId: sidMortar; + NameTex: nil; + Probability: 100; + NumberInCase: 4; + Ammo: (Propz: 0; + Count: 4; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amMortar; + AttackVoice: sndNone); + Slot: 0; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; //20; + ejectY: -6), + +// Kamikaze + (NameId: sidKamikaze; + NameTex: nil; + Probability: 100; + NumberInCase: 1; + Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold or ammoprop_AttackInMove; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amKamikaze; + AttackVoice: sndNone); + Slot: 3; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Cake + (NameId: sidCake; + NameTex: nil; + Probability: 100; + NumberInCase: 1; + Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_NoCrosshair or ammoprop_DontHold; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amCake; + AttackVoice: sndLaugh); + Slot: 4; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 4; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Seduction + (NameId: sidSeduction; + NameTex: nil; + Probability: 100; + NumberInCase: 1; + Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amSeduction; + AttackVoice: sndNone); + Slot: 3; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Watermelon + (NameId: sidWatermelon; + NameTex: nil; + Probability: 400; + NumberInCase: 1; + Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse; + Count: 0; + NumPerTurn: 0; + Timer: 3000; + Pos: 0; + AmmoType: amWatermelon; + AttackVoice: sndMelon); + Slot: 1; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// HellishBomb ("Hellish Hand-Grenade") + (NameId: sidHellishBomb; + NameTex: nil; + Probability: 400; + NumberInCase: 1; + Ammo: (Propz: ammoprop_Power or ammoprop_AltUse; + Count: 0; + NumPerTurn: 0; + Timer: 5000; + Pos: 0; + AmmoType: amHellishBomb; + AttackVoice: sndNone); + Slot: 1; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Napalm + (NameId: sidNapalm; + NameTex: nil; + Probability: 100; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoCrosshair or + ammoprop_NeedTarget or + ammoprop_AttackingPut or + ammoprop_DontHold or + ammoprop_NotBorder; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amNapalm; + AttackVoice: sndIncoming); + Slot: 5; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 7; + PosCount: 2; + PosSprite: sprAmAirplane; + ejectX: 0; + ejectY: 0), + +// Drill ("Drill Rocket") + (NameId: sidDrill; + NameTex: nil; + Probability: 300; + NumberInCase: 1; + Ammo: (Propz: ammoprop_Power or ammoprop_AltUse; + Count: AMMO_INFINITE; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amDrill; + AttackVoice: sndNone); + Slot: 0; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprDrill; + ejectX: 0; //20; + ejectY: -6), + +// Ballgun + (NameId: sidBallgun; + NameTex: nil; + Probability: 400; + NumberInCase: 1; + Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold; + Count: AMMO_INFINITE; + NumPerTurn: 0; + Timer: 5001; + Pos: 0; + AmmoType: amBallgun; + AttackVoice: sndNone); + Slot: 4; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; //20; + ejectY: -3), + +// RC-Plane + (NameId: sidRCPlane; + NameTex: nil; + Probability: 200; + NumberInCase: 1; + Ammo: (Propz: ammoprop_ForwMsgs{ or + ammoprop_DontHold or + ammoprop_AltAttack}; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amRCPlane; + AttackVoice: sndNone); + Slot: 4; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 4; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// LowGravity + (NameId: sidLowGravity; + NameTex: nil; + Probability: 20; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoRoundEnd or + ammoprop_NoCrosshair or + ammoprop_DontHold or + ammoprop_AltUse or + ammoprop_Utility or + ammoprop_Effect; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amLowGravity; + AttackVoice: sndNone); + Slot: 9; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// ExtraDamage + (NameId: sidExtraDamage; + NameTex: nil; + Probability: 15; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoRoundEnd or + ammoprop_NoCrosshair or + ammoprop_DontHold or + ammoprop_AltUse or + ammoprop_Utility or + ammoprop_Effect; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amExtraDamage; + AttackVoice: sndNone); + Slot: 9; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Invulnerable + (NameId: sidInvulnerable; + NameTex: nil; + Probability: 20; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoRoundEnd or + ammoprop_NoCrosshair or + ammoprop_DontHold or + ammoprop_AltUse or + ammoprop_Utility or + ammoprop_Effect; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amInvulnerable; + AttackVoice: sndNone); + Slot: 8; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// ExtraTime + (NameId: sidExtraTime; + NameTex: nil; + Probability: 30; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoRoundEnd or + ammoprop_NoCrosshair or + ammoprop_DontHold or + ammoprop_AltUse or + ammoprop_Utility or + ammoprop_Effect; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amExtraTime; + AttackVoice: sndNone); + Slot: 9; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// LaserSight + (NameId: sidLaserSight; + NameTex: nil; + Probability: 15; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoRoundEnd or + ammoprop_NoCrosshair or + ammoprop_DontHold or + ammoprop_AltUse or + ammoprop_Utility or + ammoprop_Effect; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amLaserSight; + AttackVoice: sndNone); + Slot: 8; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Vampiric + (NameId: sidVampiric; + NameTex: nil; + Probability: 15; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoRoundEnd or + ammoprop_NoCrosshair or + ammoprop_DontHold or + ammoprop_AltUse or + ammoprop_Utility or + ammoprop_Effect; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amVampiric; + AttackVoice: sndNone); + Slot: 8; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// SniperRifle + (NameId: sidSniperRifle; + NameTex: nil; + Probability: 20; + NumberInCase: 2; + Ammo: (Propz: 0; + Count: 2; + NumPerTurn: 1; + Timer: 0; + Pos: 0; + AmmoType: amSniperRifle; + AttackVoice: sndNone); + Slot: 2; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; //40; + ejectY: -5), + +// Jetpack ("Flying Saucer") + (NameId: sidJetpack; + NameTex: nil; + Probability: 20; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoRoundEnd or + ammoprop_ForwMsgs or + ammoprop_AttackInMove or + ammoprop_NoCrosshair or + ammoprop_DontHold or + ammoprop_Utility or + ammoprop_AltAttack; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amJetpack; + AttackVoice: sndNone); + Slot: 7; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Molotov + (NameId: sidMolotov; + NameTex: nil; + Probability: 0; + NumberInCase: 1; + Ammo: (Propz: ammoprop_Power or ammoprop_AltUse; + Count: AMMO_INFINITE; + NumPerTurn: 0; + Timer: 3000; + Pos: 0; + AmmoType: amMolotov; + AttackVoice: sndNone); + Slot: 1; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Birdy + (NameId: sidBirdy; + NameTex: nil; + Probability: 20; + NumberInCase: 1; + Ammo: (Propz: ammoprop_ForwMsgs or + ammoprop_NoCrosshair or + ammoprop_DontHold; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amBirdy; + AttackVoice: sndNone); + Slot: 7; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// PortalGun + (NameId: sidPortalGun; + NameTex: nil; + Probability: 20; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoRoundEnd or + ammoprop_AttackInMove or + ammoprop_DontHold or + ammoprop_Utility; + Count: 1; + NumPerTurn: 3; + Timer: 0; + Pos: 0; + AmmoType: amPortalGun; + AttackVoice: sndNone); + Slot: 6; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: false; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: -5; //29; + ejectY: -7), + +// Piano + (NameId: sidPiano; + NameTex: nil; + Probability: 100; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoCrosshair or + ammoprop_NeedTarget or + ammoprop_AttackingPut or + ammoprop_DontHold or + ammoprop_NotBorder; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amPiano; + AttackVoice: sndIncoming); + Slot: 5; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 7; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// GasBomb + (NameId: sidGasBomb; + NameTex: nil; + Probability: 0; + NumberInCase: 1; + Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse; + Count: AMMO_INFINITE; + NumPerTurn: 0; + Timer: 3000; + Pos: 0; + AmmoType: amGasBomb; + AttackVoice: sndCover); + Slot: 1; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// SineGun + (NameId: sidSineGun; + NameTex: nil; + Probability: 20; + NumberInCase: 2; + Ammo: (Propz: ammoprop_AttackInMove; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amSineGun; + AttackVoice: sndNone); + Slot: 2; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Flamethrower + (NameId: sidFlamethrower; + NameTex: nil; + Probability: 20; + NumberInCase: 1; + Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold; + Count: 1; + NumPerTurn: 0; + Timer: 5001; + Pos: 0; + AmmoType: amFlamethrower; + AttackVoice: sndNone); + Slot: 2; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; //20; + ejectY: -3), + +// Sticky Mine + (NameId: sidSMine; + NameTex: nil; + Probability: 100; + NumberInCase: 1; + Ammo: (Propz: ammoprop_Power; //FIXME: enable multishoot at altuse, until then removed ammoprop_AltUse + Count: 1; + NumPerTurn: 1; + Timer: 0; + Pos: 0; + AmmoType: amSMine; + AttackVoice: sndLaugh); + Slot: 4; + TimeAfterTurn: 5000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Hammer + (NameId: sidHammer; + NameTex: nil; + Probability: 0; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoCrosshair; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amHammer; + AttackVoice: sndNone); + Slot: 3; + TimeAfterTurn: 1000; + MinAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// Ressurrector + (NameId: sidResurrector; + NameTex: nil; + Probability: 0; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoCrosshair or + ammoprop_Utility or + ammoprop_NoRoundEnd; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amResurrector; + AttackVoice: sndNone); + Slot: 8; + TimeAfterTurn: 3000; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 0; + PosCount: 1; + PosSprite: sprWater; + ejectX: 0; + ejectY: 0), + +// DrillStrike + (NameId: sidDrillStrike; + NameTex: nil; + Probability: 200; + NumberInCase: 1; + Ammo: (Propz: ammoprop_NoCrosshair or + ammoprop_NeedTarget or + ammoprop_AttackingPut or + ammoprop_DontHold or + ammoprop_NotBorder; + Count: 1; + NumPerTurn: 0; + Timer: 0; + Pos: 0; + AmmoType: amDrillStrike; + AttackVoice: sndIncoming); + Slot: 5; + TimeAfterTurn: 0; + minAngle: 0; + maxAngle: 0; + isDamaging: true; + SkipTurns: 6; + PosCount: 2; + PosSprite: sprAmAirplane; + ejectX: 0; + ejectY: 0) + ); + + + + conversionFormat: TSDL_PixelFormat = ( + palette: nil; + BitsPerPixel : 32; + BytesPerPixel: 4; + Rloss : 0; + Gloss : 0; + Bloss : 0; + Aloss : 0; +{$IFDEF ENDIAN_LITTLE} + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; +{$ELSE} + Rshift: 24; + Gshift: 16; + Bshift: 8; + Ashift: 0; +{$ENDIF} + RMask : RMask; + GMask : GMask; + BMask : BMask; + AMask : AMask; + colorkey: 0; + alpha : 255 + ); + + +var + Land: TCollisionArray; + LandPixels: TLandArray; + 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; + GearsList: PGear; + AllInactive: boolean; + PrvInactive: boolean; + KilledHHs: Longword; + SuddenDeathDmg: Boolean; + SpeechType: Longword; + SpeechText: shortstring; + TrainingTargetGear: PGear; + skipFlag: boolean; + PlacingHogs: boolean; // a convenience flag to indicate placement of hogs is still in progress + StepSoundTimer: LongInt; + StepSoundChannel: LongInt; + + CurrentTeam: PTeam; + PreviousTeam: PTeam; + CurrentHedgehog: PHedgehog; + TeamsArray: array[0..Pred(cMaxTeams)] of PTeam; + TeamsCount: Longword; + ClansArray: array[0..Pred(cMaxTeams)] of PClan; + ClansCount: Longword; + LocalClan: LongInt; // last non-bot, non-extdriven clan + LocalAmmo: LongInt; // last non-bot, non-extdriven clan's first team's ammo index + CurMinAngle, CurMaxAngle: Longword; + GameOver: boolean; + + FollowGear: PGear; + WindBarWidth: LongInt; + bShowAmmoMenu: boolean; + bSelected: boolean; + bShowFinger: boolean; + Frames: Longword; + WaterColor, DeepWaterColor: TSDL_Color; + SkyOffset: LongInt; + HorizontOffset: LongInt; +{$IFDEF COUNTTICKS} + cntTicks: LongWord; +{$ENDIF} + cOffsetY: LongInt; + + PixelFormat: PSDL_PixelFormat; + SDLPrimSurface: PSDL_Surface; + PauseTexture, + SyncTexture, + ConfirmTexture: PTexture; + cScaleFactor: GLfloat; + SupportNPOTT: Boolean; + Step: LongInt; + squaresize : LongInt; + numsquares : LongInt; + ProgrTex: PTexture; + MissionIcons: PSDL_Surface; + ropeIconTex: PTexture; + rotationQt: GLfloat; + + + VisualGearsList: PVisualGear; + vobFrameTicks, vobFramesCount, vobCount: Longword; + vobVelocity, vobFallSpeed: LongInt; + + + hideAmmoMenu: boolean; + wheelUp: boolean; + wheelDown: boolean; + + ControllerNumControllers: Integer; + ControllerEnabled: Integer; + ControllerNumAxes: array[0..5] of Integer; + //ControllerNumBalls: array[0..5] of Integer; + ControllerNumHats: array[0..5] of Integer; + ControllerNumButtons: array[0..5] of Integer; + ControllerAxes: array[0..5] of array[0..19] of Integer; + //ControllerBalls: array[0..5] of array[0..19] of array[0..1] of Integer; + ControllerHats: array[0..5] of array[0..19] of Byte; + ControllerButtons: array[0..5] of array[0..19] of Byte; + + DefaultBinds, CurrentBinds: TBinds; + + coeff: LongInt; +{$IFDEF HWLIBRARY} + leftClick: boolean; + middleClick: boolean; + rightClick: boolean; + + upKey: boolean; + downKey: boolean; + rightKey: boolean; + leftKey: boolean; + preciseKey: boolean; + + backspaceKey: boolean; + spaceKey: boolean; + enterKey: boolean; + tabKey: boolean; + + chatAction: boolean; + pauseAction: boolean; +{$ENDIF} + +procedure initModule; +procedure freeModule; + +implementation + + +procedure initModule; +begin + Pathz:= cPathz; + {* REFERENCE + 4096 -> $FFFFF000 + 2048 -> $FFFFF800 + 1024 -> $FFFFFC00 + 512 -> $FFFFFE00 *} + if (cReducedQuality and rqLowRes) <> 0 then + begin + LAND_WIDTH:= 2048; + LAND_HEIGHT:= 1024; + LAND_WIDTH_MASK:= $FFFFF800; + LAND_HEIGHT_MASK:= $FFFFFC00; + end + else + begin + LAND_WIDTH:= 4096; + LAND_HEIGHT:= 2048; + LAND_WIDTH_MASK:= $FFFFF000; + LAND_HEIGHT_MASK:= $FFFFF800 + end; + + cDrownSpeed.QWordValue := 257698038; // 0.06 + cDrownSpeedf := 0.06; + cMaxWindSpeed.QWordValue:= 1073742; // 0.00025 + cWindSpeed.QWordValue := 429496; // 0.0001 + cWindSpeedf := 0.0001; + cGravity := cMaxWindSpeed * 2; + cGravityf := 0.00025 * 2; + cDamageModifier := _1; + TargetPoint := cTargetPointRef; + + // int, longint longword and byte + CursorMovementX := 0; + CursorMovementY := 0; + GameTicks := 0; + TrainingTimeInc := 10000; + TrainingTimeInD := 500; + TrainingTimeInM := 5000; + TrainingTimeMax := 60000; + TimeTrialStartTime := 0; + TimeTrialStopTime := 0; + cWaterLine := LAND_HEIGHT; + cGearScrEdgesDist := 240; + + GameFlags := 0; + TrainingFlags := 0; + TurnTimeLeft := 0; + cSuddenDTurns := 15; + cDamagePercent := 100; + cMineDudPercent := 0; + cTemplateFilter := 0; + cMapGen := 0; // MAPGEN_REGULAR + cMazeSize := 0; + cHedgehogTurnTime := 45000; + cMinesTime := 3; + cMaxAIThinkTime := 9000; + cCloudsNumber := 9; + cHealthCaseProb := 35; + cHealthCaseAmount := 25; + cWaterRise := 47; + cHealthDecrease := 5; + + cTagsMask := 0; + InitStepsFlags := 0; + RealTicks := 0; + AttackBar := 0; // 0 - none, 1 - just bar at the right-down corner, 2 - from weapon + cCaseFactor := 5; {0..9} + cLandMines := 4; + cExplosives := 2; + + GameState := Low(TGameState); + GameType := gmtLocal; + zoom := cDefaultZoomLevel; + ZoomValue := cDefaultZoomLevel; + WeaponTooltipTex:= nil; + cLaserSighting := false; + cVampiric := false; + cArtillery := false; + flagMakeCapture := false; + bBetweenTurns := false; + bWaterRising := false; + isCursorVisible := false; + isTerminated := false; + isInLag := false; + isPaused := false; + isInMultiShoot := false; + isSpeed := false; + fastUntilLag := false; + isFirstFrame := true; + isSEBackup := true; + cSeed := ''; + cVolumeDelta := 0; + cHasFocus := true; + cInactDelay := 1250; + ReadyTimeLeft := 0; + + ScreenFade := sfNone; + +{$IFDEF SDL13} + SDLwindow := nil; +{$ENDIF} + + // those values still aren't perfect + cLeftScreenBorder:= round(-cMinZoomLevel * cScreenWidth); + cRightScreenBorder:= round(cMinZoomLevel * cScreenWidth + LAND_WIDTH); + cScreenSpace:= cRightScreenBorder - cLeftScreenBorder; + + if isPhone() then + cMaxCaptions:= 3 + else + cMaxCaptions:= 4; +end; + +procedure freeModule; +begin + // re-init flags so they will always contain safe values + cScreenWidth := 1024; + cScreenHeight := 768; + cBits := 32; + //ipcPort is in uIO + cFullScreen := false; + isSoundEnabled := true; + isMusicEnabled := false; + cLocaleFName := 'en.txt'; + cInitVolume := 100; + cTimerInterval := 8; + PathPrefix := './'; + cShowFPS := false; + cAltDamage := true; + cReducedQuality := rqNone; + //userNick is in uChat + recordFileName := ''; + cReadyDelay := 0; +end; + +end. diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uVisualGears.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,31 +20,7 @@ unit uVisualGears; interface -uses uConsts, uFloat, Math, GLunit; - -type PVisualGear = ^TVisualGear; - TVGearStepProcedure = procedure (Gear: PVisualGear; Steps: Longword); - TVisualGear = record - NextGear, PrevGear: PVisualGear; - Frame, - FrameTicks: Longword; - X : float; - Y : float; - dX: float; - dY: float; - tdX: float; - tdY: float; - State : Longword; - Timer: Longword; - Angle, dAngle: real; - Kind: TVisualGearType; - doStep: TVGearStepProcedure; - Tex: PTexture; - alpha, scale: GLfloat; - Hedgehog: pointer; - Text: shortstring; - Tint: Longword; - end; +uses uConsts, uFloat, GLunit, uTypes; procedure initModule; procedure freeModule; @@ -57,12 +33,9 @@ procedure AddClouds; procedure AddDamageTag(X, Y, Damage, Color: LongWord); -var VisualGearsList: PVisualGear; - vobFrameTicks, vobFramesCount, vobCount: Longword; - vobVelocity, vobFallSpeed: LongInt; +implementation +uses uMisc, uStore, uSound, uMobile, uVariables, uTextures, uRender, uUtils, Math, uRenderUtils; -implementation -uses uWorld, uMisc, uStore, uTeams, uSound, uMobile; const cExplFrameTicks = 110; {$INCLUDE "VGSHandlers.inc"} @@ -125,7 +98,7 @@ function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord = 0): PVisualGear; var gear: PVisualGear; t: Longword; - sp: float; + sp: real; begin if (GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) then // we are scrolling now if Kind <> vgtCloud then @@ -151,8 +124,8 @@ New(gear); FillChar(gear^, sizeof(TVisualGear), 0); -gear^.X:= float(X); -gear^.Y:= float(Y); +gear^.X:= real(X); +gear^.Y:= real(Y); gear^.Kind := Kind; gear^.doStep:= doStepHandlers[Kind]; gear^.State:= 0; @@ -378,7 +351,7 @@ if Gear^.Kind = vgtFlake then begin // Damage calc from doMakeExplosion - dmg:= min(101, Radius + cHHRadius div 2 - LongInt(abs(round(Gear^.X) - X) + abs(round(Gear^.Y) - Y)) div 5); + dmg:= Min(101, Radius + cHHRadius div 2 - LongInt(abs(round(Gear^.X) - X) + abs(round(Gear^.Y) - Y)) div 5); if dmg > 1 then begin Gear^.tdX:= 0.02 * dmg + 0.01; @@ -436,7 +409,7 @@ case Gear^.Kind of vgtExplosion: DrawSprite(sprExplosion50, round(Gear^.X) - 32 + WorldDx, round(Gear^.Y) - 32 + WorldDy, Gear^.State); vgtBigExplosion: begin - Tint($FF, $FF, $FF, floor($FF * (1 - power(Gear^.Timer / 250, 4)))); + Tint($FF, $FF, $FF, round($FF * (1 - power(Gear^.Timer / 250, 4)))); DrawRotatedTextureF(SpritesData[sprBigExplosion].Texture, 0.85 * (-power(2, -10 * Int(Gear^.Timer)/250) + 1) + 0.4, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 385, 385, Gear^.Angle); end; end; @@ -451,14 +424,14 @@ vgtBubble: DrawSprite(sprBubbles, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8); vgtSteam: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame); vgtAmmo: begin - Tint($FF, $FF, $FF, floor(Gear^.alpha * $FF)); + Tint($FF, $FF, $FF, round(Gear^.alpha * $FF)); DrawTextureF(ropeIconTex, Gear^.scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 32, 32); DrawTextureF(SpritesData[sprAMAmmos].Texture, Gear^.scale * 0.90, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame - 1, 1, 32, 32); end; vgtHealth: begin case Gear^.Frame div 10 of - 0:Tint(0, $FF, 0, floor(Gear^.FrameTicks * $FF / 1000)); - 1:Tint($FF, 0, 0, floor(Gear^.FrameTicks * $FF / 1000)); + 0:Tint(0, $FF, 0, round(Gear^.FrameTicks * $FF / 1000)); + 1:Tint($FF, 0, 0, round(Gear^.FrameTicks * $FF / 1000)); end; DrawSprite(sprHealth, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, 0); end; @@ -482,7 +455,7 @@ DrawRotatedF(sprBeeTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, (RealTicks shr 4) mod cMaxAngle); end; vgtSmokeRing: begin - Tint($FF, $FF, $FF, floor(Gear^.alpha * $FF)); + Tint($FF, $FF, $FF, round(Gear^.alpha * $FF)); DrawRotatedTextureF(SpritesData[sprSmokeRing].Texture, Gear^.scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 200, 200, Gear^.Angle); end; vgtChunk: DrawRotatedF(sprChunk, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle); diff -r cdb3d7a39fa2 -r 0a7158f26ffa hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Tue Nov 16 20:55:39 2010 +0100 +++ b/hedgewars/uWorld.pas Thu Nov 18 16:58:08 2010 -0500 @@ -20,24 +20,7 @@ unit uWorld; interface -uses SDLh, uGears, uConsts, uFloat, uRandom; - - -var FollowGear: PGear; - WindBarWidth: LongInt; - bShowAmmoMenu: boolean; - bSelected: boolean; - bShowFinger: boolean; - Frames: Longword; - WaterColor, DeepWaterColor: TSDL_Color; - WorldDx: LongInt; - WorldDy: LongInt; - SkyOffset: LongInt; - HorizontOffset: LongInt; -{$IFDEF COUNTTICKS} - cntTicks: LongWord; -{$ENDIF} - cOffsetY: LongInt; +uses SDLh, uGears, uConsts, uFloat, uRandom, uTypes; procedure initModule; procedure freeModule; @@ -51,7 +34,23 @@ procedure MoveCamera; implementation -uses uStore, uMisc, uTeams, uIO, uKeys, uLocale, uSound, uAmmos, uVisualGears, uChat, uLandTexture, uLand, GLunit; +uses + uStore, + uMisc, + uIO, + uLocale, + uSound, + uAmmos, + uVisualGears, + uChat, + uLandTexture, + GLunit, + uVariables, + uUtils, + uTextures, + uRender, + uRenderUtils + ; type TCaptionStr = record Tex: PTexture; @@ -390,7 +389,7 @@ {$IFDEF IPHONEOS} ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, AMyOffset - 1); {$ELSE} - ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, min(y + 1, cScreenHeight - WeaponTooltipTex^.h - 40)); + ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, Min(y + 1, cScreenHeight - WeaponTooltipTex^.h - 40)); {$ENDIF} bSelected:= false; @@ -575,7 +574,7 @@ begin // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine); - offsetY:= 10 * min(0, -145 - ScreenBottom); + offsetY:= 10 * Min(0, -145 - ScreenBottom); SkyOffset:= offsetY div 35 + cWaveHeight; HorizontOffset:= SkyOffset; if ScreenBottom > SkyOffset then @@ -869,7 +868,7 @@ if (ReadyTimeLeft = 0) and (missionTimer > 0) then dec(missionTimer, Lag); if missionTimer < 0 then missionTimer:= 0; // avoid subtracting below 0 if missionTex <> nil then - DrawCentered(0, min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex); + DrawCentered(0, Min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex); end; // fps @@ -1160,7 +1159,7 @@ procedure ShakeCamera(amount: LongWord); begin - amount:= max(1, amount); + amount:= Max(1, amount); WorldDx:= WorldDx - amount + LongInt(getRandom(1 + amount * 2)); WorldDy:= WorldDy - amount + LongInt(getRandom(1 + amount * 2)); end; diff -r cdb3d7a39fa2 -r 0a7158f26ffa project_files/HedgewarsMobile/Classes/GameConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Tue Nov 16 20:55:39 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Thu Nov 18 16:58:08 2010 -0500 @@ -157,7 +157,6 @@ int hogs = 0; for (NSDictionary *teamData in teamConfigViewController.listOfSelectedTeams) hogs += [[teamData objectForKey:@"number"] intValue]; - if (hogs > self.mapConfigViewController.maxHogs) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Too many hogs",@"") message:NSLocalizedString(@"The map is too small for that many hogs",@"") @@ -193,7 +192,7 @@ return NO; } - // play if the gameflags are set correctly (divideteam works only with 2 teams + // play if the gameflags are set correctly (divideteam works only with 2 teams) NSString *schemePath = [[NSString alloc] initWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),self.schemeWeaponConfigViewController.selectedScheme]; NSArray *gameFlags = [[NSDictionary dictionaryWithContentsOfFile:schemePath] objectForKey:@"gamemod"]; [schemePath release]; @@ -367,6 +366,7 @@ [self.view addSubview:self.schemeWeaponConfigViewController.view]; } [self.view addSubview:self.mapConfigViewController.view]; + self.mapConfigViewController.externalController = schemeWeaponConfigViewController; [super viewDidLoad]; } diff -r cdb3d7a39fa2 -r 0a7158f26ffa project_files/HedgewarsMobile/Classes/MapConfigViewController.h --- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.h Tue Nov 16 20:55:39 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.h Thu Nov 18 16:58:08 2010 -0500 @@ -22,10 +22,12 @@ #import #import "MapPreviewButtonView.h" +@class SchemeWeaponConfigViewController; + @interface MapConfigViewController : UIViewController { - NSInteger oldValue; //slider - NSInteger oldPage; //segmented control - BOOL busy; + NSInteger oldValue; // for the slider + NSInteger oldPage; // for the segmented control + BOOL busy; // for the preview button // objects read (mostly) by parent view NSInteger maxHogs; @@ -48,6 +50,9 @@ // internal objects NSIndexPath *lastIndexPath; NSArray *dataSourceArray; + + // controller for mission state + SchemeWeaponConfigViewController *externalController; } @@ -71,6 +76,9 @@ @property (nonatomic,retain) NSIndexPath *lastIndexPath; @property (nonatomic,retain) NSArray *dataSourceArray; +@property (nonatomic,assign) SchemeWeaponConfigViewController *externalController; + + -(IBAction) buttonPressed:(id) sender; -(IBAction) mapButtonPressed; diff -r cdb3d7a39fa2 -r 0a7158f26ffa project_files/HedgewarsMobile/Classes/MapConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Tue Nov 16 20:55:39 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Thu Nov 18 16:58:08 2010 -0500 @@ -23,13 +23,14 @@ #import "PascalImports.h" #import "CommodityFunctions.h" #import "UIImageExtra.h" +#import "SchemeWeaponConfigViewController.h" #define scIndex self.segmentedControl.selectedSegmentIndex #define isRandomness() (segmentedControl.selectedSegmentIndex == 0 || segmentedControl.selectedSegmentIndex == 2) @implementation MapConfigViewController @synthesize previewButton, maxHogs, seedCommand, templateFilterCommand, mapGenCommand, mazeSizeCommand, themeCommand, staticMapCommand, - missionCommand, tableView, maxLabel, sizeLabel, segmentedControl, slider, lastIndexPath, dataSourceArray, busy; + missionCommand, tableView, maxLabel, sizeLabel, segmentedControl, slider, lastIndexPath, dataSourceArray, busy, externalController; -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { @@ -320,16 +321,17 @@ mission = @""; [self sliderChanged:nil]; self.slider.enabled = YES; + [externalController fillSections]; break; case 1: // Map - case 3: // Mission mapgen = @"e$mapgen 0"; // dummy values, these are set by -updatePreview -> -didSelectRowAtIndexPath -> -setDetailsForStaticMap staticmap = @"map Bamboo"; mission = @""; self.slider.enabled = NO; self.sizeLabel.text = NSLocalizedString(@"No filter",@""); + [externalController fillSections]; break; case 2: // Maze @@ -338,6 +340,17 @@ mission = @""; [self sliderChanged:nil]; self.slider.enabled = YES; + [externalController fillSections]; + break; + + case 3: // Mission + mapgen = @"e$mapgen 0"; + // dummy values, these are set by -updatePreview -> -didSelectRowAtIndexPath -> -setDetailsForStaticMap + staticmap = @"map Bamboo"; + mission = @""; + self.slider.enabled = NO; + self.sizeLabel.text = NSLocalizedString(@"No filter",@""); + [externalController emptySections]; break; default: diff -r cdb3d7a39fa2 -r 0a7158f26ffa project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h --- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h Tue Nov 16 20:55:39 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h Thu Nov 18 16:58:08 2010 -0500 @@ -33,6 +33,7 @@ NSString *selectedWeapon; UISwitch *syncSwitch; + BOOL hideSections; } @property (nonatomic,retain) NSArray *listOfSchemes; @@ -43,4 +44,7 @@ @property (nonatomic,retain) NSString *selectedWeapon; @property (nonatomic,retain) UISwitch *syncSwitch; +-(void) fillSections; +-(void) emptySections; + @end diff -r cdb3d7a39fa2 -r 0a7158f26ffa project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Tue Nov 16 20:55:39 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Thu Nov 18 16:58:08 2010 -0500 @@ -23,6 +23,8 @@ #import "CommodityFunctions.h" #import "SDL_uikitappdelegate.h" +#define LABEL_TAG 57423 + @implementation SchemeWeaponConfigViewController @synthesize listOfSchemes, listOfWeapons, lastIndexPath_sc, lastIndexPath_we, selectedScheme, selectedWeapon, syncSwitch; @@ -81,7 +83,10 @@ #pragma mark - #pragma mark Table view data source -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 3; + if (hideSections) + return 0; + else + return 3; } -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { @@ -215,6 +220,45 @@ [aTableView deselectRowAtIndexPath:indexPath animated:YES]; } +-(void) fillSections { + if (hideSections == YES) { + hideSections = NO; + NSRange range; + range.location = 0; + range.length = 3; + NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range]; + [self.tableView insertSections:sections withRowAnimation:UITableViewRowAnimationFade]; + self.selectedScheme = @"Default.plist"; + self.selectedWeapon = @"Default.plist"; + + self.tableView.scrollEnabled = YES; + + [[self.view viewWithTag:LABEL_TAG] removeFromSuperview]; + } +} + +-(void) emptySections { + hideSections = YES; + NSRange range; + range.location = 0; + range.length = 3; + NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range]; + [self.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade]; + self.selectedScheme = @"Default.plist"; + self.selectedWeapon = @"Default.plist"; + + self.tableView.scrollEnabled = NO; + + CGRect frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 60); + UILabel *theLabel = createBlueLabel(NSLocalizedString(@"Missions don't need further configuration",@""), frame); + theLabel.center = CGPointMake(self.view.frame.size.width/2, self.view.frame.size.height/2); + theLabel.numberOfLines = 2; + theLabel.tag = LABEL_TAG; + + [self.view addSubview:theLabel]; + [theLabel release]; +} + #pragma mark - #pragma mark Memory management -(void) didReceiveMemoryWarning { diff -r cdb3d7a39fa2 -r 0a7158f26ffa tools/PascalParser.hs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/PascalParser.hs Thu Nov 18 16:58:08 2010 -0500 @@ -0,0 +1,98 @@ +module PascalParser where + +import Text.ParserCombinators.Parsec +import Control.Monad + +data PascalUnit = + Program Identificator Implementation FunctionBody + | Unit Identificator Interface Implementation (Maybe Initialize) (Maybe Finalize) + deriving Show + +data Interface = Interface Uses TypesAndVars + deriving Show +data Implementation = Implementation Uses TypesAndVars Functions + deriving Show +data Functions = Functions [Function] + deriving Show +data Function = Function String + deriving Show +data Identificator = Identificator String + deriving Show +data FunctionBody = FunctionBody String + deriving Show +data TypesAndVars = TypesAndVars String + deriving Show +data Initialize = Initialize Functions + deriving Show +data Finalize = Finalize Functions + deriving Show +data Uses = Uses [Identificator] + deriving Show + +parsePascalUnit :: String -> Either ParseError PascalUnit +parsePascalUnit = parse pascalUnit "unit" + where + comments = skipMany (comment >> spaces) + identificator = do + spaces + l <- letter <|> oneOf "_" + ls <- many (alphaNum <|> oneOf "_") + spaces + return $ Identificator (l:ls) + + pascalUnit = do + spaces + comments + u <- choice [program, unit] + comments + spaces + return u + + comment = choice [ + char '{' >> manyTill anyChar (try $ char '}') + , string "(*" >> manyTill anyChar (try $ string "*)") + , string "//" >> manyTill anyChar (try newline) + ] + + unit = do + name <- unitName + spaces + comments + int <- string "interface" >> interface + manyTill anyChar (try $ string "implementation") + spaces + comments + impl <- implementation + return $ Unit name int impl Nothing Nothing + where + unitName = between (string "unit") (char ';') identificator + + interface = do + spaces + comments + u <- uses + return $ Interface u (TypesAndVars "") + + program = do + name <- programName + spaces + comments + impl <- implementation + return $ Program name impl (FunctionBody "") + where + programName = between (string "program") (char ';') identificator + + implementation = do + u <- uses + manyTill anyChar (try $ string "end.") + return $ Implementation u (TypesAndVars "") (Functions []) + + uses = liftM Uses (option [] u) + where + u = do + string "uses" + spaces + u <- (identificator >>= \i -> spaces >> return i) `sepBy1` (char ',' >> spaces) + char ';' + spaces + return u diff -r cdb3d7a39fa2 -r 0a7158f26ffa tools/unitCycles.hs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/unitCycles.hs Thu Nov 18 16:58:08 2010 -0500 @@ -0,0 +1,46 @@ +module Main where + +import PascalParser +import System +import Control.Monad +import Data.Either +import Data.List +import Data.Graph +import Data.Maybe + +unident :: Identificator -> String +unident (Identificator s) = s + +extractUnits :: PascalUnit -> (String, [String]) +extractUnits (Program (Identificator name) (Implementation (Uses idents) _ _) _) = ("program " ++ name, map unident idents) +extractUnits (Unit (Identificator name) (Interface (Uses idents1) _) (Implementation (Uses idents2) _ _) _ _) = (name, map unident $ idents1 ++ idents2) + +f :: [(String, [String])] -> String +f = unlines . map showSCC . stronglyConnComp . map (\(a, b) -> (a, a, b)) + where + showSCC (AcyclicSCC v) = v + showSCC (CyclicSCC vs) = intercalate ", " vs + +myf :: [(String, [String])] -> String +myf d = unlines . map (findCycle . fst) $ d + where + findCycle :: String -> String + findCycle searched = intercalate ", " $ fc searched [searched] + where + fc :: String -> [String] -> [String] + fc curSearch visited = let uses = curSearch `lookup` d in if isNothing uses then [] else concatMap t $ fromJust uses + where + t u = + if u == searched then + [u] + else + if u `elem` visited then + [] + else + let chain = fc u (u:visited) in if null chain then [] else u:chain + + +main = do + fileNames <- getArgs + files <- mapM readFile fileNames + putStrLn . myf . map extractUnits . rights . map parsePascalUnit $ files