diff --git a/.gitignore b/.gitignore
index 2d3f476..d22b02d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,6 +30,17 @@ gmon.out
*.ncb
*.user
-msvc/Debug
-msvc/Release
-build/msvc
\ No newline at end of file
+build/*
+
+#cmake cache files
+CMakeFiles
+CmakeCache.txt
+cmake_install.cmake
+src/iceball.dir
+src/iceball-soft.dir
+src/iceded.dir
+ZERO_CHECK.dir
+
+#some cmake generated shit that will vs.net notify of cmake file changes.
+ALL_BUILD.vcproj
+ZERO_CHECK.vcproj
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..13c7e67
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,41 @@
+#/CMakeLists.txt
+cmake_minimum_required (VERSION 2.8)
+project (iceball)
+
+#set(CMAKE_BINARY_DIR build)
+set(CMAKE_SOURCE_DIR src)
+set(OUTDIR ../build)
+
+# First for the generic no-config case (e.g. with mingw)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTDIR} )
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTDIR} )
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTDIR} )
+# Second, for multi-config builds (e.g. msvc)
+foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
+ string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
+ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${OUTDIR} )
+ set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${OUTDIR} )
+ set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${OUTDIR} )
+endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
+
+
+IF(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv|nmake)")
+ add_definitions(/W4) # warning level
+ add_definitions(/TP) # compile as c++
+ELSEIF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
+ add_definitions(-Wall -g) # keep debugging symbols even in Release builds
+ENDIF()
+
+include_directories(include)
+if (WIN32)
+ if (MSVC)
+ set_source_files_properties(filename.c PROPERTIES LANGUAGE CXX )
+ endif (MSVC)
+ LINK_DIRECTORIES(../winlibs)
+ include_directories(winlibs/glew)
+ include_directories(winlibs/lua)
+ include_directories(winlibs/SDL)
+ include_directories(winlibs/zlib)
+endif (WIN32)
+
+add_subdirectory(src)
diff --git a/README.txt b/README.txt
index fc4a2f9..44fb08a 100644
--- a/README.txt
+++ b/README.txt
@@ -70,4 +70,12 @@ MSVC readme (wip):
'-c iceballga.me 20737' (connect to srv)
'-s 0 pkg/base' (make local srv)
- edit clsave/pub/user.json
-- now run it from vs.net debugger :)
\ No newline at end of file
+- now run it from vs.net debugger :)
+
+for the git starters:
+- git update-index --assume-unchanged clsave\pub\user.json
+
+and to get updates from the main repo:
+- git remote add upstream git://github.com/iamgreaser/buldthensnip.git
+- git pull --rebase upstream master
+- git push origin master
diff --git a/buildenv/vs2k10.bat b/buildenv/vs2k10.bat
new file mode 100644
index 0000000..27fa9fd
--- /dev/null
+++ b/buildenv/vs2k10.bat
@@ -0,0 +1,7 @@
+@echo off
+cls
+echo Generating Visual Studio 2010 files...
+echo .
+pushd ..
+cmake -Wno-dev -G "Visual Studio 10" .
+popd
\ No newline at end of file
diff --git a/buildenv/vs2k8.bat b/buildenv/vs2k8.bat
new file mode 100644
index 0000000..2c710f0
--- /dev/null
+++ b/buildenv/vs2k8.bat
@@ -0,0 +1,7 @@
+@echo off
+cls
+echo Generating Visual Studio 2008 files...
+echo .
+pushd ..
+cmake -Wno-dev -G "Visual Studio 9 2008" .
+popd
\ No newline at end of file
diff --git a/include/common.h b/include/common.h
index 45aa8ce..404511a 100644
--- a/include/common.h
+++ b/include/common.h
@@ -49,7 +49,14 @@
#define __attribute__(x)
#define PACK_START __pragma( pack(push, 1) )
#define PACK_END __pragma( pack(pop) )
-typedef unsigned int uint32_t;
+typedef signed __int8 int8_t;
+typedef unsigned __int8 uint8_t;
+typedef signed __int16 int16_t;
+typedef unsigned __int16 uint16_t;
+typedef signed __int32 int32_t;
+typedef unsigned __int32 uint32_t;
+typedef signed __int64 int64_t;
+typedef unsigned __int64 uint64_t;
#define snprintf sprintf_s
#define _USE_MATH_DEFINES //M_PI and whatnot from math.h
#pragma warning( disable: 4200 4244 4996)
diff --git a/msvc/iceball.sln b/msvc/iceball.sln
deleted file mode 100644
index 8127238..0000000
--- a/msvc/iceball.sln
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iceball", "iceball.vcproj", "{CD5FA57E-F7A1-4CC0-B8B0-043E78858D90}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {CD5FA57E-F7A1-4CC0-B8B0-043E78858D90}.Debug|Win32.ActiveCfg = Debug|Win32
- {CD5FA57E-F7A1-4CC0-B8B0-043E78858D90}.Debug|Win32.Build.0 = Debug|Win32
- {CD5FA57E-F7A1-4CC0-B8B0-043E78858D90}.Release|Win32.ActiveCfg = Release|Win32
- {CD5FA57E-F7A1-4CC0-B8B0-043E78858D90}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/msvc/iceball.vcproj b/msvc/iceball.vcproj
deleted file mode 100644
index 80cb6b2..0000000
--- a/msvc/iceball.vcproj
+++ /dev/null
@@ -1,305 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..646788f
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,43 @@
+#/src/CMakeLists.txt
+
+file(GLOB LUA_FILES lua*)
+set(MAIN_FILES dsp.c img.c json.c logtxt.c main.c map.c model.c network.c path.c vecmath.c wav.c)
+
+set(GL_FILES gl/render.c gl/render_img.c)
+source_group(gl FILES ${GL_FILES})
+
+set(SOFT_FILES softgm/render.c softgm/render_img.c)
+source_group(softgm FILES ${SOFT_FILES})
+
+source_group(lua FILES ${LUA_FILES})
+
+add_executable(iceball ${MAIN_FILES} ${LUA_FILES} ${GL_FILES})
+target_link_libraries(iceball lua5.1 SDL SDLmain opengl32 glew32)
+set_target_properties(iceball PROPERTIES COMPILE_DEFINITIONS "USE_OPENGL")
+
+add_executable(iceball-soft ${MAIN_FILES} ${LUA_FILES} ${SOFT_FILES})
+target_link_libraries(iceball-soft lua5.1 SDL SDLmain)
+
+add_executable(iceded ${MAIN_FILES} ${LUA_FILES})
+target_link_libraries(iceded lua5.1 SDL SDLmain)
+set_target_properties(iceded PROPERTIES COMPILE_DEFINITIONS "DEDI")
+
+macro(add_dll DLLNAME)
+ add_custom_command(TARGET iceball POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ../winlibs/${DLLNAME} $)
+ add_custom_command(TARGET iceball-soft POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ../winlibs/${DLLNAME} $)
+ add_custom_command(TARGET iceded POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ../winlibs/${DLLNAME} $)
+endmacro(add_dll)
+
+
+if (WIN32)
+ target_link_libraries(iceball ws2_32 zdll)
+ target_link_libraries(iceball-soft ws2_32 zdll)
+ target_link_libraries(iceded ws2_32 zdll)
+ add_dll("lua5.1.dll")
+ add_dll("SDL.dll")
+ add_dll("glew32.dll")
+ add_dll("zlib1.dll")
+else()
+ #target_link_libraries(iceball zlib)
+ #target_link_libraries(iceball-soft zlib)
+endif (WIN32)
\ No newline at end of file
diff --git a/src/lua_camera.h b/src/lua_camera.h
index 666bc19..62d5fd3 100644
--- a/src/lua_camera.h
+++ b/src/lua_camera.h
@@ -146,7 +146,10 @@ int icelua_fn_client_camera_shading_set(lua_State *L)
{
/* sides are: east, bottom, south, west, top, north */
int top = icelua_assert_stack(L, 6, 6);
-
+
+#ifdef DEDI
+ return luaL_error(L, "lm: why the hell is this being called in the dedi version?");
+#else
int i;
for(i = 0; i < 6; i++)
{
@@ -157,7 +160,8 @@ int icelua_fn_client_camera_shading_set(lua_State *L)
if(s >= 128) s++;
cam_shading[i] = s;
}
-
+#endif
+
return 0;
}
diff --git a/src/lua_image.h b/src/lua_image.h
index 9a086c8..a97c3ed 100644
--- a/src/lua_image.h
+++ b/src/lua_image.h
@@ -65,10 +65,14 @@ int icelua_fn_client_img_blit_to(lua_State *L)
sy = (top < 8 ? 0 : lua_tointeger(L, 8));
color = (top < 9 ? 0xFFFFFFFF : (uint32_t)lua_tointeger(L, 9));
+#ifdef DEDI
+ return luaL_error(L, "lm: why the hell is this being called in the dedi version?");
+#else
render_blit_img(dest->pixels, dest->head.width, dest->head.height,
dest->head.width,
source, dx, dy, bw, bh, sx, sy, color);
-
+#endif
+
#ifdef USE_OPENGL
dest->tex_dirty = 1;
#endif
diff --git a/src/lua_map.h b/src/lua_map.h
index 23dadf1..1cec6d2 100644
--- a/src/lua_map.h
+++ b/src/lua_map.h
@@ -340,10 +340,14 @@ int icelua_fn_client_map_fog_get(lua_State *L)
{
int top = icelua_assert_stack(L, 0, 0);
+#ifdef DEDI
+ return luaL_error(L, "lm: why the hell is this being called in the dedi version?");
+#else
lua_pushinteger(L, (fog_color>>16)&255);
lua_pushinteger(L, (fog_color>>8)&255);
lua_pushinteger(L, (fog_color)&255);
lua_pushnumber(L, fog_distance);
+#endif
return 4;
}
@@ -352,6 +356,9 @@ int icelua_fn_client_map_fog_set(lua_State *L)
{
int top = icelua_assert_stack(L, 4, 4);
+#ifdef DEDI
+ return luaL_error(L, "lm: why the hell is this being called in the dedi version?");
+#else
int r = lua_tointeger(L, 1)&255;
int g = lua_tointeger(L, 2)&255;
int b = lua_tointeger(L, 3)&255;
@@ -363,6 +370,7 @@ int icelua_fn_client_map_fog_set(lua_State *L)
fog_color = (r<<16)|(g<<8)|b;
force_redraw = 1;
-
+#endif
+
return 4;
}