Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
LiquidityC committed Sep 2, 2018
2 parents 30ab6af + 1dadb2d commit 89168de
Show file tree
Hide file tree
Showing 26 changed files with 705 additions and 75 deletions.
38 changes: 19 additions & 19 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,24 @@ build_script:
- |-
mingw32-make
ctest -V
mingw32-make package
artifacts:
- path: package/breakhack-*.zip
name: breakhack_zip

- path: package/breakhack-*.exe
name: breakhack_exe

deploy:
provider: GitHub
description: 'Alpha pre-release'
auth_token:
secure: IlMEyGp0AuDI8/MkFAY2KpRr70c3p8eVEMdcqC1EcgyCCbvoMOppBQ0gY44ao0gq
draft: false
prerelease: true
on:
branch: master
appveyor_repo_tag: true
# mingw32-make package

# artifacts:
# - path: package/breakhack-*.zip
# name: breakhack_zip

# - path: package/breakhack-*.exe
# name: breakhack_exe

# deploy:
# provider: GitHub
# description: 'Alpha pre-release'
# auth_token:
# secure: IlMEyGp0AuDI8/MkFAY2KpRr70c3p8eVEMdcqC1EcgyCCbvoMOppBQ0gY44ao0gq
# draft: false
# prerelease: true
# on:
# branch: master
# appveyor_repo_tag: true


2 changes: 2 additions & 0 deletions .clang_complete
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
-DDEBUG
-I./steamworks_c_api/src/
-I./src/steam/
-I./build/config.h
-I/usr/include/SDL2/
-I/usr/include/lua5.2/
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
/data.pack
/.vs/
/.data.db
/steamworks_c_wrapper/_build
/steamworks_c_wrapper/sdk
*.swp
*~
/steam_appid.txt
29 changes: 14 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,18 @@ addons:
build_command: "make"
branch_pattern: coverity_scan

before_deploy:
- make package
# before_deploy:
# - make package

deploy:
provider: releases
api_key:
secure: "KeT/BC2ck2eqs1q4keoLe/Y9KIk+AR5shiAnA2oMQzbLWoZmxUx3Kol7rLPJ0Hfgb+aCpSpTM1njX6Kw7Nl8j4NrOkgadb3ZmfqRthFazzb93reRt+0dZZcurilHpWtMeteaZLWGWaG0j09xnI3CPPjmth6BB+/roGRsQyo1QKk0pZYsQD6ZKfGAUR1576dFyRzvsIrnfLd7rZVSNZ8HtPwN2rmSLD/cGxMCf+IafcBInPyv9p6bCoVLIDFnDdCr+kwBuSlGudT15EtDx3d9Abab3ZIS3NUpnXr2s0BmknCpyb59YsG9V0YXIQsIkwioEWiJskcAznXT/yB4XqDCq693b+0sxldsUVPw2JkMU+40V5ay2itH3SeP/LyXVFUARdWB+nn6avaFRVaZ1nHYP95CrBXC8JGB1bd7ejeEm9+cOvBOgvsZp71uRJ2OdEXN5Z3i373cyvWXPFHVbQRJS5l1dRBJR0sozYcPe8BMQ4Pv+xahFWIeyDAErUwJSiOf1Uv/x6PNxJaZTTZKCYGSRo6Ywb15bw4YnlOzDXllBxNg3IsJjJes1qFBJGR1eRMq/U9Ne+eHLk7cn2r7Fa77DtFsbONTDHftXDFHk46LDLF+HlL2wHIoTJVzLl/tXyBm3MJuaghGEvvZSwalWS3UnvMTQOBlDG0qC/ww6mlkv+Y="
skip_cleanup: true
file_glob: true
file:
- "package/breakhack*.tar.gz"
- "package/breakhack*.tar.Z"
on:
tags: true
condition: $CC = gcc
condition: $BUILD_TYPE = Release
# deploy:
# provider: releases
# api_key:
# secure: "KeT/BC2ck2eqs1q4keoLe/Y9KIk+AR5shiAnA2oMQzbLWoZmxUx3Kol7rLPJ0Hfgb+aCpSpTM1njX6Kw7Nl8j4NrOkgadb3ZmfqRthFazzb93reRt+0dZZcurilHpWtMeteaZLWGWaG0j09xnI3CPPjmth6BB+/roGRsQyo1QKk0pZYsQD6ZKfGAUR1576dFyRzvsIrnfLd7rZVSNZ8HtPwN2rmSLD/cGxMCf+IafcBInPyv9p6bCoVLIDFnDdCr+kwBuSlGudT15EtDx3d9Abab3ZIS3NUpnXr2s0BmknCpyb59YsG9V0YXIQsIkwioEWiJskcAznXT/yB4XqDCq693b+0sxldsUVPw2JkMU+40V5ay2itH3SeP/LyXVFUARdWB+nn6avaFRVaZ1nHYP95CrBXC8JGB1bd7ejeEm9+cOvBOgvsZp71uRJ2OdEXN5Z3i373cyvWXPFHVbQRJS5l1dRBJR0sozYcPe8BMQ4Pv+xahFWIeyDAErUwJSiOf1Uv/x6PNxJaZTTZKCYGSRo6Ywb15bw4YnlOzDXllBxNg3IsJjJes1qFBJGR1eRMq/U9Ne+eHLk7cn2r7Fa77DtFsbONTDHftXDFHk46LDLF+HlL2wHIoTJVzLl/tXyBm3MJuaghGEvvZSwalWS3UnvMTQOBlDG0qC/ww6mlkv+Y="
# skip_cleanup: true
# file_glob: true
# file:
# - "package/breakhack*.tar.gz"
# on:
# tags: true
# condition: $CC = gcc
# condition: $BUILD_TYPE = Release
2 changes: 1 addition & 1 deletion .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nnoremap <F4> :ter ++close ./_build/breakhack<cr>
packadd termdebug
let g:termdebug_wide = 1
let g:syntastic_c_include_dirs = [ '_build', '/usr/include/SDL2' ]
let g:syntastic_c_include_dirs = [ '_build', '/usr/include/SDL2', 'steamworks_c_wrapper/src', 'steamworks_c_wrapper/sdk/public/steam' ]
69 changes: 59 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ SET(CMAKE_COLOR_MAKEFILE ON)
project(breakhack C)

set(breakhack_GAME_TITLE "BreakHack")
set(breakhack_MAJOR_VERSION 0)
set(breakhack_MINOR_VERSION 2)
set(breakhack_PATCH_VERSION 0)
set(breakhack_RELEASE_TYPE "(beta)")
set(breakhack_MAJOR_VERSION 1)
set(breakhack_MINOR_VERSION 0)
set(breakhack_PATCH_VERSION 2)
set(breakhack_RELEASE_TYPE "")

include(FindLua)
include(FindPhysFS)
Expand All @@ -25,6 +25,17 @@ configure_file(
"${PROJECT_BINARY_DIR}/config.h"
)

if (EXISTS "${PROJECT_SOURCE_DIR}/steamworks_c_wrapper/sdk")
MESSAGE ( STATUS "Steam SDK located, Steam build enabled")
set(STEAM 1)
else ()
MESSAGE ( STATUS "Steam SDK not found, Steam build disabled")
endif()

if (STEAM)
add_subdirectory(steamworks_c_wrapper)
endif()

if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
set(CLANG 1)
elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
Expand Down Expand Up @@ -54,22 +65,22 @@ IF ( MSVC )
MESSAGE ( STATUS "Setting MSVC MT switches")
SET (
CMAKE_C_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} /MTd"
"${CMAKE_C_FLAGS_DEBUG} /MTd"
CACHE STRING "MSVC MT flags " FORCE
)
SET (
CMAKE_C_FLAGS_RELEASE
"${CMAKE_CXX_FLAGS_RELEASE} /MT"
"${CMAKE_C_FLAGS_RELEASE} /MT"
CACHE STRING "MSVC MT flags " FORCE
)
ELSEIF ( WIN32 )
SET (
CMAKE_C_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -mconsole"
"${CMAKE_C_FLAGS_DEBUG} -mconsole"
)
SET (
CMAKE_C_FLAGS_RELEASE
"${CMAKE_CXX_FLAGS_RELEASE} -mwindows"
"${CMAKE_C_FLAGS_RELEASE} -mwindows"
)
ENDIF ()
IF ( GCC OR CLANG )
Expand All @@ -93,6 +104,13 @@ else ()
)
endif ()

if (STEAM)
include_directories(
${STEAMWORKS_INCLUDE_DIR}
steamworks_c_wrapper/src
)
endif ()

include_directories(
${PROJECT_BINARY_DIR}
${LUA_INCLUDE_DIR}
Expand Down Expand Up @@ -123,12 +141,24 @@ if (NOT MSVC)
endif (NOT MSVC)

set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
if (STEAM)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSTEAM_BUILD")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DSTEAM_BUILD")
endif ()
if (NOT MSVC)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__FNAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")
else (NOT MSVC)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__FNAME__=__FILE__")
endif (NOT MSVC)

if (STEAM)
set(STEAM_SOURCES
src/steam/steamworks_api_wrapper
)
else ()
set(STEAM_SOURCES "")
endif ()

# PROGRAMS:
add_executable(breakhack
src/main
Expand Down Expand Up @@ -180,6 +210,7 @@ add_executable(breakhack
src/object
src/gui_util
src/tooltip
${STEAM_SOURCES}
)

# Sqlite has some warnings that I we don't need to see
Expand All @@ -195,6 +226,12 @@ target_link_libraries(breakhack
${SDL2_MIXER_LIBRARY}
)

if (STEAM)
target_link_libraries(breakhack
steamworks_c_wrapper
)
endif ()

if (NOT PHYSFS_FOUND)
target_link_libraries(breakhack
physfs-static
Expand Down Expand Up @@ -287,6 +324,7 @@ SET(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT "Release")
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ".")
if (WIN32)
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
${CMAKE_SOURCE_DIR}/bin/libFLAC-8.dll
${CMAKE_SOURCE_DIR}/bin/libfreetype-6.dll
${CMAKE_SOURCE_DIR}/bin/libmodplug-1.dll
Expand All @@ -301,6 +339,13 @@ if (WIN32)
${CMAKE_SOURCE_DIR}/bin/SDL2_ttf.dll
${CMAKE_SOURCE_DIR}/bin/zlib1.dll
)
if (STEAM)
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
steamworks_c_wrapper/sdk/redistributable_bin/steam_api.dll
build/steam/steam_appid.txt
)
endif ()
endif (WIN32)
include(InstallRequiredSystemLibraries)

Expand All @@ -323,11 +368,15 @@ set(CPACK_PACKAGE_VERSION_MAJOR ${breakhack_MAJOR_VERSION})
set(CPACK_PACKAGE_VERSION_MINOR ${breakhack_MINOR_VERSION})
set(CPACK_PACKAGE_VERSION_PATCH ${breakhack_PATCH_VERSION})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "BreakHack")
set(CPACK_PACKAGE_FILE_NAME "breakhack-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
if (WIN32)
set(CPACK_PACKAGE_FILE_NAME "breakhack-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-win32")
else ()
set(CPACK_PACKAGE_FILE_NAME "breakhack-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
endif ()
set(CPACK_PACKAGE_CHECKSUM "MD5")

if(UNIX)
set(CPACK_GENERATOR STGZ TGZ TZ)
set(CPACK_GENERATOR TGZ)
set(CPACK_STRIP_FILES breakhack)
set(CPACK_SOURCE_STRIP_FILES "")
elseif(WIN32)
Expand Down
1 change: 1 addition & 0 deletions build/steam/steam_appid.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
931040
3 changes: 3 additions & 0 deletions data/trapgen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function module.add_traps_to_room(room)
end

local count = random(4)
local attempts = 0;
local i = 0
while i < count do
local rx = random(13) + 1
Expand All @@ -55,6 +56,8 @@ function module.add_traps_to_room(room)
i = i + 1
end
end
attempts = attempts + 1
if attempts > 100 then break end
end
end

Expand Down
2 changes: 2 additions & 0 deletions src/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ typedef int16_t Sint16;
typedef uint16_t Uint16;
typedef int32_t Sint32;
typedef uint32_t Uint32;
typedef int64_t Sint64;
typedef uint64_t Uint64;

typedef enum Direction_t {
UP, DOWN, LEFT, RIGHT
Expand Down
4 changes: 2 additions & 2 deletions src/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ get_event_modkey(SDL_Event *event)
key = KEY_CTRL_M; break;
case SDLK_d:
key = KEY_CTRL_D; break;
case SDLK_f:
key = KEY_CTRL_F; break;
}
} else if (event->key.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) {
switch (event->key.keysym.sym) {
Expand All @@ -122,8 +124,6 @@ get_event_modkey(SDL_Event *event)
key = KEY_SHIFT_NUM4; break;
case SDLK_5:
key = KEY_SHIFT_NUM5; break;
default:
key = 0; break;
}
}
return key;
Expand Down
1 change: 1 addition & 0 deletions src/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#define KEY_SHIFT_NUM3 0x20
#define KEY_SHIFT_NUM4 0x40
#define KEY_SHIFT_NUM5 0x80
#define KEY_CTRL_F 0x100

#define MBUTTON_LEFT 1
#define MBUTTON_MIDDLE 2
Expand Down
Loading

0 comments on commit 89168de

Please sign in to comment.