- More smooth hedgehogs physics
authorunc0rr
Mon, 03 Jul 2006 17:46:58 +0000
changeset 73 fe1c62875a19
parent 72 aeb2ac1878dc
child 74 42257fee61ae
- More smooth hedgehogs physics - Use CMake build system
CMakeLists.txt
QTfrontend/CMakeLists.txt
hedgewars/CMakeLists.txt
hedgewars/HHHandlers.inc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CMakeLists.txt	Mon Jul 03 17:46:58 2006 +0000
@@ -0,0 +1,6 @@
+project(hedgewars)
+
+cmake_minimum_required(VERSION 2.4.0)
+
+add_subdirectory(QTfrontend)
+add_subdirectory(hedgewars)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/CMakeLists.txt	Mon Jul 03 17:46:58 2006 +0000
@@ -0,0 +1,57 @@
+find_package(Qt4 REQUIRED)
+
+include_directories(${QT_INCLUDES} .)
+
+set(hwfr_src 
+	game.cpp
+	main.cpp
+	hwform.cpp 
+	team.cpp
+	rndstr.cpp
+	sha1.cpp
+	netclient.cpp
+	teamselect.cpp
+	teamselhelper.cpp
+	frameTeam.cpp
+	vertScrollArea.cpp)
+
+if (WIN32)
+	set(hwfr_src ${hwfr_src} res/hedgewars.rc)
+endif (WIN32)
+
+set(hwfr_moc_hdrs
+	game.h
+	hwform.h
+	netclient.h
+	teamselect.h
+	teamselhelper.h
+	frameTeam.h
+	vertScrollArea.h)
+
+set(hwfr_uis
+	hwform.ui)
+
+set(hwfr_rez
+	hedgewars.qrc)
+
+qt4_wrap_ui(hwfr_uis_h
+	${hwfr_uis})
+
+qt4_add_resources(hwfr_rez_src
+	${hwfr_rez})
+
+qt4_wrap_cpp(hwfr_moc_srcs
+	${hwfr_moc_hdrs})
+
+add_executable(hedgewars WIN32
+	${hwfr_src}
+	${hwfr_moc_srcs}
+	${hwfr_rez_src})
+
+target_link_libraries(hedgewars 
+	${QT_QTCORE_LIBRARY}
+	${QT_QTGUI_LIBRARY}
+	${QT_QTNETWORK_LIBRARY}
+	${QT_QTMAIN_LIBRARY})
+
+install_targets(/bin hedgewars)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/CMakeLists.txt	Mon Jul 03 17:46:58 2006 +0000
@@ -0,0 +1,43 @@
+set(dcc32_tryexe dcc32.exe)
+set(ppc386_tryexe ppc386)
+set(hwengine_project "hwengine.dpr")
+
+find_program(dcc32_executable ${dcc32_tryexe})
+find_program(ppc386_executable ${ppc386_tryexe})
+
+if (dcc32_executable)
+	 exec_program(${dcc32_executable} ARGS "--version" OUTPUT_VARIABLE dcc32_output)
+endif (dcc32_executable)
+
+if (ppc386_executable)
+	 exec_program(${ppc386_executable} ARGS "-v" OUTPUT_VARIABLE ppc386_output)
+endif (ppc386_executable)
+
+string(REGEX MATCH "[0-9]+\\.[0-9]+" dcc32version "${dcc32_output}")
+if (dcc32version)
+	set(pascal_compiler ${dcc32_executable})
+	set(pascal_compiler_flags "-B -W"${hwengine_project})
+else (dcc32version)
+	string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" ppc386_version "${ppc386_output}")
+	if (ppc386_version)
+		string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" ppc386_vers_major "${ppc386_version}")
+		string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" ppc386_vers_minor "${ppc386_version}")
+		string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" ppc386_vers_patch "${ppc386_version}")
+		math(EXPR ppc386_ver "${ppc386_vers_major}*10000 + ${ppc386_vers_minor}*100 + ${ppc386_vers_patch}")
+		if (ppc386_ver LESS "010902")
+			message("Minimum required version of FreePascal is 1.9.2")
+		else (ppc386_ver LESS "010902")
+			set(pascal_compiler ${ppc386_executable})
+			set(pascal_compiler_flags "-B -Sd -Xs -OG -Or -O2 -Cs2000000"${hwengine_project})
+		endif (ppc386_ver LESS "010902")
+	endif (ppc386_version)
+endif (dcc32version)
+
+if (NOT pascal_compiler)
+	message(FATAL_ERROR "No Pascal compiler found!")
+endif (NOT pascal_compiler)
+
+add_custom_target(hwengine ALL
+	${pascal_compiler} ${pascal_compiler_flags})
+
+install_targets(/bin hwengine)
--- a/hedgewars/HHHandlers.inc	Thu Jun 29 18:27:53 2006 +0000
+++ b/hedgewars/HHHandlers.inc	Mon Jul 03 17:46:58 2006 +0000
@@ -308,6 +308,7 @@
 begin
 //DeleteCI(Gear);
 if not TestCollisionYwithGear(Gear, 1) then
+   if TestCollisionYwithXYShift(Gear, 0, 1, 1) then Gear.Y:= Gear.Y + 1 else
    begin
    if (Gear.dY < 0) and TestCollisionYwithGear(Gear, -1) then Gear.dY:= 0;
    Gear.State:= Gear.State or gstFalling or gstMoving;
@@ -327,12 +328,12 @@
    if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then
       if ((Gear.State and gstFalling) = 0) then
          if abs(Gear.dX) > 0.01 then
-            if not TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.90; Gear.Y:= Gear.Y - 1 end else
-            if not TestCollisionXwithXYShift(Gear, 0, -2, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.88; Gear.Y:= Gear.Y - 2 end else
-            if not TestCollisionXwithXYShift(Gear, 0, -3, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.84; Gear.Y:= Gear.Y - 3 end else
-            if not TestCollisionXwithXYShift(Gear, 0, -4, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.81; Gear.Y:= Gear.Y - 4 end else
-            if not TestCollisionXwithXYShift(Gear, 0, -5, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.78; Gear.Y:= Gear.Y - 5 end else
-            if abs(Gear.dX) > 0.02 then Gear.dX:= -0.5 * Gear.dX
+            if not TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.99; Gear.Y:= Gear.Y - 1 end else
+            if not TestCollisionXwithXYShift(Gear, 0, -2, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.98; Gear.Y:= Gear.Y - 2 end else
+            if not TestCollisionXwithXYShift(Gear, 0, -3, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.97; Gear.Y:= Gear.Y - 3 end else
+            if not TestCollisionXwithXYShift(Gear, 0, -4, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.96; Gear.Y:= Gear.Y - 4 end else
+            if not TestCollisionXwithXYShift(Gear, 0, -5, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.95; Gear.Y:= Gear.Y - 5 end else
+            if abs(Gear.dX) > 0.02 then Gear.dX:= -0.3 * Gear.dX
                                    else begin
                                         Gear.State:= Gear.State and not gstMoving;
                                         Gear.dX:= 0.0000001 * Sign(Gear.dX)
@@ -349,7 +350,7 @@
    Gear.State:= Gear.State and not gstMoving;
    Gear.dX:= 0.0000001 * Sign(Gear.dX);
    Gear.dY:= 0
-   end else Gear.State:= Gear.State or      gstMoving;
+   end else Gear.State:= Gear.State or gstMoving;
 
 if (Gear.State and gstMoving) <> 0 then
    begin