Compare commits

..

No commits in common. "amigaos" and "coverity_scan" have entirely different histories.

345 changed files with 2456 additions and 37454 deletions

View File

@ -60,10 +60,6 @@ before_build:
%DEPENDS% copy cmocka-1.1.0\include\* %PREFIX%\include > nul
%DEPENDS% copy cmocka-1.1.0\lib\*.a %PREFIX%\lib > nul
%DEPENDS% copy cmocka-1.1.0\bin\*.dll %PREFIX%\lib > nul
# Copy dll's for test exec
- |-
copy %PREFIX%\lib\SDL2.dll %APPVEYOR_BUILD_FOLDER% > nul
copy %PREFIX%\lib\cmocka.dll %APPVEYOR_BUILD_FOLDER% > nul
# Lua
@ -86,29 +82,29 @@ build_script:
# Build
- |-
cmake --version
cmake -DCMAKE_PREFIX_PATH="%PREFIX%" -DCMAKE_C_COMPILER=mingw32-gcc.exe -DCMAKE_MAKE_PROGRAM=mingw32-make.exe -G "MinGW Makefiles" .
cmake -DCMAKE_PREFIX_PATH="%PREFIX%" -DCMAKE_C_COMPILER=mingw32-gcc.exe -DCMAKE_MAKE_PROGRAM=mingw32-make.exe -G "MinGW Makefiles"
- |-
mingw32-make
ctest -V
# mingw32-make package
mingw32-make package
# artifacts:
# - path: package/breakhack-*.zip
# name: breakhack_zip
artifacts:
- path: package/breakhack-*.zip
name: breakhack_zip
# - path: package/breakhack-*.exe
# name: breakhack_exe
- 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
deploy:
provider: GitHub
description: 'Alpha pre-release'
auth_token:
secure: IlMEyGp0AuDI8/MkFAY2KpRr70c3p8eVEMdcqC1EcgyCCbvoMOppBQ0gY44ao0gq
draft: false
prerelease: true
on:
branch: master
appveyor_repo_tag: true

View File

@ -1,4 +1,5 @@
-DDEBUG
-DSTEAM_BUILD
-I./build/config.h
-I/usr/include/SDL2/
-include./_build/debug/config.h
-I/usr/include/lua5.2/
-I/usr/include/physfs.h

12
.github/FUNDING.yml vendored
View File

@ -1,12 +0,0 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: LiquidityC
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@ -1,29 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- Version [e.g. 1.1.4]
- OS: [e.g. Windows, Archlinux, Ubuntu]
- Architecture: 32 or 64 bit?
**Additional context**
Add any other context about the problem here.

View File

@ -1,17 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

12
.gitignore vendored
View File

@ -1,6 +1,3 @@
/.vscode/
/vscode_build/
/CMakeSettings.json
/_build/
/*.dll
/tags
@ -8,14 +5,5 @@
/data.pack
/.vs/
/.data.db
/steamworks_c_wrapper/_build
/steamworks_c_wrapper/sdk
*.swp
*~
/steam_appid.txt
/*.so
/breakhack*.run
compile_commands.json
*.o
breakhack

View File

@ -52,18 +52,19 @@ 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"
# 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"
- "package/breakhack*.tar.Z"
on:
tags: true
condition: $CC = gcc
condition: $BUILD_TYPE = Release

11
.vimrc
View File

@ -1,9 +1,6 @@
nnoremap <F1> :Make<cr>
nnoremap <F2> :Make lint test<cr>
nnoremap <F3> :Termdebug _build/debug/breakhack<cr>
nnoremap <F4> :ter ++close env LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./ ./_build/debug/breakhack<cr>
nnoremap <F2> :Make clean<cr>
nnoremap <F3> :Make lint test<cr>
nnoremap <F4> :!./_build/breakhack<cr>
packadd termdebug
let g:termdebug_wide = 1
let g:syntastic_c_include_dirs = [ '_build/debug', '/usr/include/SDL2', 'steamworks_c_wrapper/src', 'physfs-3.0/src', 'bh_random/src', 'checksum/src' ]
let g:syntastic_cpp_include_dirs = [ 'steamworks_c_wrapper/sdk/public/steam', 'bh_random/src' ]
let g:syntastic_c_include_dirs = [ '_build', '/usr/include/SDL2' ]

View File

@ -5,14 +5,10 @@ SET(CMAKE_COLOR_MAKEFILE ON)
project(breakhack C)
set(breakhack_GAME_TITLE "BreakHack")
set(breakhack_MAJOR_VERSION 4)
set(breakhack_MINOR_VERSION 0)
set(breakhack_PATCH_VERSION 3)
set(breakhack_RELEASE_TYPE "")
# Checksums
set(breakhack_STEAMAPI_DLL_CHECKSUM 0x18dba28)
set(breakhack_STEAMAPI_SO_CHECKSUM 0x1f5786b)
set(breakhack_MAJOR_VERSION 0)
set(breakhack_MINOR_VERSION 1)
set(breakhack_PATCH_VERSION 4)
set(breakhack_RELEASE_TYPE "(early access)")
include(FindLua)
include(FindPhysFS)
@ -29,37 +25,12 @@ configure_file(
"${PROJECT_BINARY_DIR}/config.h"
)
macro(set_option option value)
set(${option} ${value} CACHE INTERNAL "" FORCE)
endmacro()
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()
add_subdirectory(bh_random)
add_subdirectory(checksum)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
set(CLANG 1)
elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
set(GCC 1)
endif()
if ("${CMAKE_GENERATOR}" STREQUAL "Ninja")
set(NINJA 1)
endif()
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set(OSX 1)
endif()
set (default_build_type "Release")
if (NOT CMAKE_BUILD_TYPE AND default_build_type)
message( STATUS "Setting default buildtype to '${default_build_type}' as none was specified")
@ -77,26 +48,24 @@ endif()
IF ( MSVC )
MESSAGE ( STATUS "Setting MSVC MT switches")
string (REPLACE
"/MDd"
"/MTd"
CMAKE_C_FLAGS_DEBUG
${CMAKE_C_FLAGS_DEBUG}
SET (
CMAKE_C_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} /MTd"
CACHE STRING "MSVC MT flags " FORCE
)
string (REPLACE
"/MDd"
"/MTd"
CMAKE_C_FLAGS_RELEASE
${CMAKE_C_FLAGS_RELEASE}
SET (
CMAKE_C_FLAGS_RELEASE
"${CMAKE_CXX_FLAGS_RELEASE} /MT"
CACHE STRING "MSVC MT flags " FORCE
)
ELSEIF ( WIN32 )
SET (
CMAKE_C_FLAGS_DEBUG
"${CMAKE_C_FLAGS_DEBUG} -mconsole"
"${CMAKE_CXX_FLAGS_DEBUG} -mconsole"
)
SET (
CMAKE_C_FLAGS_RELEASE
"${CMAKE_C_FLAGS_RELEASE} -mwindows"
"${CMAKE_CXX_FLAGS_RELEASE} -mwindows"
)
ENDIF ()
IF ( GCC OR CLANG )
@ -106,40 +75,27 @@ IF ( GCC OR CLANG )
)
ENDIF ( GCC OR CLANG )
if (STEAM)
if (NOT PHYSFS_FOUND OR WIN32)
set(PHYSFS_BUILD_STATIC TRUE)
set(PHYSFS_BUILD_SHARED FALSE)
set(PHYSFS_BUILD_TEST FALSE)
add_subdirectory(physfs-3.0.1)
include_directories(
${STEAMWORKS_INCLUDE_DIR}
steamworks_c_wrapper/src
)
endif ()
if (NOT LUA_FOUND OR STEAM)
add_subdirectory(lua-5.3.5)
include_directories(lua-5.3.5/src)
set(LUA_LIBRARIES lua)
set(LUA_INCLUDE_DIR lua-5.3.5/src)
endif ()
if (NOT PHYSFS_FOUND OR STEAM)
set_option(PHYSFS_BUILD_SHARED off)
set_option(PHYSFS_BUILD_TEST off)
add_subdirectory(physfs-3.0)
include_directories(physfs-3.0/src)
set(PHYSFS_LIBRARY physfs-static)
set(PHYSFS_INCLUDE_DIR physfs-3.0/src)
physfs-3.0.1/src
)
else ()
include_directories(
${PHYSFS_INCLUDE_DIR}
)
endif ()
include_directories(
${PROJECT_BINARY_DIR}
${LUA_INCLUDE_DIR}
${SDL2_INCLUDE_DIR}
${SDL2_IMAGE_INCLUDE_DIR}
${SDL2_TTF_INCLUDE_DIR}
${SDL2_MIXER_INCLUDE_DIR}
${PHYSFS_INCLUDE_DIR}
${LUA_INCLUDE_DIR}
sqlite3
bh_random/src
checksum/src
)
if (CMOCKA_FOUND)
@ -162,154 +118,109 @@ 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")
set(STEAM_SOURCES
src/steam/steamworks_api_wrapper
)
else ()
set(STEAM_SOURCES "")
endif ()
if (MINGW)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DMINGW")
endif (MINGW)
if (NOT MSVC)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__FNAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")
else ()
else (NOT MSVC)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__FNAME__=__FILE__")
endif ()
endif (NOT MSVC)
# PROGRAMS:
add_executable(breakhack
src/main.c
src/texture.c
src/screenresolution.c
src/sprite.c
src/sprite_util.c
src/util.c
src/event.c
src/player.c
src/save.c
src/map.c
src/map_lua.c
src/camera.c
src/timer.c
src/roommatrix.c
src/position.c
src/monster.c
src/stats.c
src/actiontext.c
src/random.c
src/time.c
src/linkedlist.c
src/hashtable.c
src/gui.c
src/item.c
src/item_builder.c
src/pointer.c
src/gui_button.c
src/particle_engine.c
src/particle_emitter.c
src/menu.c
src/collisions.c
src/keyboard.c
src/input.c
src/mixer.c
src/io_util.c
src/physfsrwops.c
src/skillbar.c
src/texturecache.c
src/skill.c
src/projectile.c
src/vector2d.c
src/map_room_modifiers.c
sqlite3/sqlite3.c
src/db.c
src/settings.c
src/actiontextbuilder.c
src/animation.c
src/trap.c
src/artifact.c
src/screen.c
src/hiscore.c
src/object.c
src/gui_util.c
src/tooltip.c
src/gamecontroller.c
src/effect_util.c
${STEAM_SOURCES}
src/main
src/texture
src/screenresolution
src/sprite
src/util
src/player
src/map
src/map_lua
src/camera
src/timer
src/roommatrix
src/position
src/monster
src/stats
src/actiontext
src/random
src/linkedlist
src/hashtable
src/gui
src/item
src/item_builder
src/pointer
src/gui_button
src/particle_engine
src/menu
src/collisions
src/keyboard
src/mixer
src/io_util
src/physfsrwops
src/skillbar
src/texturecache
src/skill
src/projectile
src/vector2d
src/map_room_modifiers
src/sqlite3
src/db
src/settings
src/actiontextbuilder
)
if (MSVC)
source_group("Header files" REGULAR_EXPRESSION ".*\\.h")
source_group("Source files" REGULAR_EXPRESSION ".*\\.c")
endif ()
# Sqlite has some warnings that I we don't need to see
set_source_files_properties(sqlite3/sqlite3.c COMPILE_FLAGS -w)
set_source_files_properties(src/sqlite3.c COMPILE_FLAGS -w)
target_link_libraries(breakhack
${CMAKE_DL_LIBS} # Sqlite needs DL libs
${LUA_LIBRARY}
${SDL2_LIBRARY}
${SDL2MAIN_LIBRARY}
${SDL2_IMAGE_LIBRARY}
${SDL2_TTF_LIBRARY}
${SDL2_MIXER_LIBRARY}
${LUA_LIBRARIES}
${PHYSFS_LIBRARY}
bh_random
checksum
)
if (STEAM)
if (NOT PHYSFS_FOUND)
target_link_libraries(breakhack
steamworks_c_wrapper
physfs-static
)
else ()
target_link_libraries(breakhack
${PHYSFS_LIBRARY}
)
endif ()
if (MSVC)
set_target_properties(breakhack PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE /NODEFAULTLIB:MSVCRTD")
set_target_properties(breakhack PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
set_target_properties(breakhack PROPERTIES COMPILE_DEFINITIONS_DEBUG "_CONSOLE")
set_target_properties(breakhack PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE")
set_target_properties(breakhack PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "_CONSOLE")
set_target_properties(breakhack PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS /NODEFAULTLIB:MSVCRTD")
set_target_properties(breakhack PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
set_target_properties(breakhack PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS")
endif (MSVC)
# TESTS:
IF (CMOCKA_FOUND AND NOT OSX AND NOT CLANG)
IF (CMOCKA_FOUND)
find_package(Threads REQUIRED)
enable_testing()
add_executable(test_util test/test_util.c src/util.c)
target_link_libraries(test_util ${CMOCKA_LIBRARY})
add_executable(test_util test/test_util src/util)
target_link_libraries(test_util ${CMOCKA_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
add_test(test_util test_util)
add_executable(test_linkedlist test/test_linkedlist.c src/linkedlist.c src/util.c)
target_link_libraries(test_linkedlist ${CMOCKA_LIBRARY})
add_executable(test_linkedlist test/test_linkedlist src/linkedlist src/util)
target_link_libraries(test_linkedlist ${CMOCKA_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
add_test(test_linkedlist test_linkedlist)
add_executable(test_hashtable test/test_hashtable.c src/hashtable.c src/util.c)
target_link_libraries(test_hashtable ${CMOCKA_LIBRARY})
add_executable(test_hashtable test/test_hashtable src/hashtable src/util)
target_link_libraries(test_hashtable ${CMOCKA_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
add_test(test_hashtable test_hashtable)
add_executable(test_input test/test_input.c src/input.c src/keyboard.c)
target_link_libraries(test_input
${CMOCKA_LIBRARY}
${SDL2_LIBRARY}
${SDL2MAIN_LIBRARY}
)
#set_target_properties(test_input PROPERTIES
#LINK_FLAGS "-Wl,--wrap,keyboard_direction_press -Wl,--wrap,keyboard_press")
add_test(test_input test_input)
ENDIF ()
ENDIF (CMOCKA_FOUND )
# LINT:
if (CPPCHECK_FOUND)
add_custom_target(lint
COMMAND ${CPPCHECK_EXECUTABLE} --force --language=c --template=gcc --error-exitcode=1 --quiet --suppress=missingInclude --enable=warning,style,performance,portability,information,missingInclude src/
COMMAND ${CPPCHECK_EXECUTABLE} --force --language=c --template=gcc --error-exitcode=1 --quiet --enable=warning,style,performance,portability,information,missingInclude --suppress=*:src/sqlite3.? -isrc/sqlite3.c src/
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Run cppcheck"
)
@ -334,22 +245,22 @@ if (NOT DEBUG_BUILD)
"maproombuilder.lua"
"menumapgen.lua"
"monstergen.lua"
"trapgen.lua"
"chestgen.lua"
"layoutparser.lua"
"pitlayouts.dat"
"walllayouts.dat"
"shoplayouts.dat"
"lockedroomlayouts.dat"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data
)
if (WIN32)
add_definitions(-mwindows)
endif()
else()
if (WIN32)
add_definitions(-mconsole)
endif()
endif ()
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
@ -364,20 +275,6 @@ 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
)
endif ()
else (WIN32)
if (STEAM)
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
steamworks_c_wrapper/sdk/redistributable_bin/linux64/libsteam_api.so
build/linux/breakhack.run
)
endif ()
endif (WIN32)
include(InstallRequiredSystemLibraries)
@ -396,23 +293,15 @@ set(CPACK_PACKAGE_VENDOR "OliveShark")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
set(CPACK_PACKAGE_DIRECTORY ${PROJECT_BINARY_DIR}/package)
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_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "1")
set(CPACK_PACKAGE_VERSION_PATCH "1")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "BreakHack")
set(CPACK_PACKAGE_FILE_NAME "breakhack-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_PACKAGE_CHECKSUM "MD5")
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 ()
if (STEAM)
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-steambuild")
endif ()
if(UNIX)
set(CPACK_GENERATOR TGZ ZIP)
set(CPACK_GENERATOR STGZ TGZ TZ)
set(CPACK_STRIP_FILES breakhack)
set(CPACK_SOURCE_STRIP_FILES "")
elseif(WIN32)

View File

@ -1,46 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at contact@oliveshark.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@ -1,20 +0,0 @@
- Game -
--------
Code: Linus Probert
liquidityc.github.io
@LiquidityC
- Graphics -
------------
Palette: DawnBringer
- Music and Sound -
-------------------
Music: Eric Matyas
www.soundimage.org
Sound: Eric Matyas
www.soundimage.org
ArtisticDuded
opengameart.org/users/artisticdude

View File

@ -1,10 +0,0 @@
Apart from basic compile tools (*GCC/Clang, Make*) you'll also need to install **sdl2, sdl2-image, sdl2-ttf, sdl2-mixer** (If on a debian based dist you need to install the *dev* packages).
Optionally you can also install **cppcheck** and **physfs**
Once that is done run the following:
```bash
mkdir _build
cd _build
cmake -DCMAKE_BUILD_TYPE=Debug .. # Build type flag is optional
make
```

View File

@ -1,16 +0,0 @@
Compile on Windows with Visual Studio
-------------------------------------
1. Install [Visual Studio Community 2019](https://visualstudio.microsoft.com/vs/community/) with the "Desktop development with C++" workload
2. Install [CMake](https://cmake.org/download/)
3. Install [NSIS](https://nsis.sourceforge.io/Download)
4. Download and unzip [SDL2-devel-2.x.x-VC.zip](https://www.libsdl.org/download-2.0.php), [SDL2_image-devel-2.x.x-VC.zip](https://www.libsdl.org/projects/SDL_image/), [SDL2_mixer-devel-2.x.x-VC.zip](https://www.libsdl.org/projects/SDL_mixer/), [SDL2_ttf-devel-2.x.x-VC.zip](https://www.libsdl.org/projects/SDL_ttf/)
5. Open Developer Command Prompt for VS 2019 and run the following, substituting paths as appropriate:
```batch
SET SDL2DIR=C:\repos\breakhackBuild\SDL2-2.0.9
SET SDL2MIXERDIR=C:\repos\breakhackBuild\SDL2_mixer-2.0.4
SET SDL2_IMAGE=C:\repos\breakhackBuild\SDL2_image-2.0.4
SET SDLTTFDIR=C:\repos\breakhackBuild\SDL2_ttf-2.0.15
cmake -S C:\repos\breakhack -B C:\repos\breakhackBuild
cmake --build C:\repos\breakhackBuild --target package --config Release
```

View File

@ -1,50 +1,19 @@
all:
@make -sC _build/debug
@make -sC _build
.PHONY: all
release:
@make -sC _build/release
.PHONY: release
clean:
@make -sC _build/debug clean
@make -sC _build/release clean
@make clean -sC _build
.PHONY: clean
test:
@make -sC _build/debug test
@make test -sC _build
.PHONY: test
run: $(all)
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./ ./_build/debug/breakhack
@./_build/breakhack
.PHONY: run
playtest: $(all)
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./ ./_build/release/breakhack
.PHONY: playtest
lint:
@make -sC _build/debug lint
@make lint -sC _build
.PHONY: lint
package:
@make -sC _build/release package
.PHONY: package
setup:
@mkdir -p _build/release
@mkdir -p _build/debug
@cd _build/debug/ && \
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=YES ../.. && \
cd -
@cd _build/debug/ && \
cmake -DCMAKE_BUILD_TYPE=Release ../.. && \
cd -
@ln -s _build/debug/compile_commands.json
@echo "Setup complete"
.PHONY: setup
teardown:
@rm -rf _build
@rm compile_commands.json
.PHONY: teardown

View File

@ -1,503 +0,0 @@
#
# Project: breakhack
#
# Created on: 29-08-2022 21:00:37
# by George Sokianos
#
###################################################################
##
##//// Objects
##
###################################################################
breakhack_OBJ := \
src/actiontext.o src/actiontextbuilder.o src/animation.o \
src/artifact.o src/camera.o src/collisions.o \
src/db.o src/effect_util.o src/event.o \
src/gamecontroller.o src/gui_button.o src/gui.o \
src/gui_util.o src/hashtable.o src/hiscore.o \
src/input.o src/io_util.o src/item_builder.o \
src/item.o src/keyboard.o src/linkedlist.o \
src/main.o src/map.o src/map_lua.o \
src/map_room_modifiers.o src/menu.o src/mixer.o \
src/monster.o src/object.o src/particle_emitter.o \
src/particle_engine.o src/physfsrwops.o src/player.o \
src/pointer.o src/position.o src/projectile.o \
src/random.o src/roommatrix.o src/save.o \
src/screen.o src/screenresolution.o src/settings.o \
src/skill.o src/skillbar.o src/sprite.o \
src/sprite_util.o src/stats.o src/texture.o \
src/texturecache.o src/time.o src/timer.o \
src/tooltip.o src/trap.o src/util.o \
src/vector2d.o bh_random/src/bh_random.o
###################################################################
##
##//// Variables and Environment
##
###################################################################
CC := gcc:bin/gcc
INCPATH := -I. -I/sdk/local/newlib/include/SDL2 -Ibh_random/src \
-I/sdk/local/common/include/lua53
# -DDEBUG
CFLAGS := $(INCPATH) -Wall -Wwrite-strings -Wno-discarded-qualifiers
# \
# -g -gstabs
# -ggdb -gdwarf-2
LFLAGS := -lauto -lSDL2_image -lSDL2_ttf -lfreetype -ltiff -lwebp -lpng -ljpeg \
-llua53 -lsqlite3 -lz \
-lSDL2_mixer -lmikmod -lmodplug -lFLAC -logg \
-lSDL2 -lphysfs -lpthread -athread=native -lstdc++
# \
# -g -gstabs
# -ggdb -gdwarf-2
# -lunix
# -lenet -lcrypto -lSDL2_gl4es -lglu_gl4es -lgl4es -lopenal \
###################################################################
##
##//// General rules
##
###################################################################
.PHONY: all all-before all-after clean clean-custom realclean
all: all-before breakhack all-after
all-before:
# You can add rules here to execute before the project is built
all-after:
# You can add rules here to execute after the project is built
clean: clean-custom
@echo "Cleaning compiler objects..."
@rm -f $(breakhack_OBJ)
realclean:
@echo "Cleaning compiler objects and targets..."
@rm -f $(breakhack_OBJ) breakhack
###################################################################
##
##//// Targets
##
###################################################################
breakhack: $(breakhack_OBJ)
@echo "Linking breakhack"
@gcc:bin/gcc -o breakhack $(breakhack_OBJ) $(LFLAGS)
@echo "Removing stale debug target: breakhack"
@rm -f breakhack.debug
###################################################################
##
##//// Standard rules
##
###################################################################
# A default rule to make all the objects listed below
# because we are hiding compiler commands from the output
.c.o:
@echo "Compiling $<"
@$(CC) -c $< -o $*.o $(CFLAGS)
src/actiontext.o: src/actiontext.c src/actiontext.h \
src/position.h src/sprite.h src/texture.h \
src/camera.h src/roommatrix.h src/timer.h \
src/vector2d.h src/util.h src/update_data.h \
src/player.h src/stats.h src/skill.h \
src/linkedlist.h src/input.h src/artifact.h \
src/map.h src/defines.h src/monster.h \
src/map_room_modifiers.h src/object.h src/doorlocktype.h
src/actiontextbuilder.o: src/actiontextbuilder.c src/actiontextbuilder.h src/actiontext.h \
src/position.h src/sprite.h src/timer.h \
src/vector2d.h src/camera.h src/update_data.h \
src/player.h src/map.h src/roommatrix.h \
src/gui.h src/util.h
src/animation.o: src/animation.c src/animation.h src/timer.h \
src/camera.h src/position.h src/vector2d.h \
src/sprite.h src/texture.h \
src/dimension.h src/roommatrix.h src/defines.h \
src/map_room_modifiers.h src/input.h
src/artifact.o: src/artifact.c src/artifact.h src/sprite.h \
src/texture.h src/position.h src/camera.h \
src/roommatrix.h src/timer.h \
src/vector2d.h src/util.h src/texturecache.h \
src/dimension.h src/particle_engine.h src/player.h \
src/stats.h src/actiontext.h src/skill.h \
src/linkedlist.h src/input.h src/random.h \
src/camera.o: src/camera.c src/camera.h src/position.h \
src/timer.h src/vector2d.h src/map.h \
src/linkedlist.h src/sprite.h src/texture.h \
src/roommatrix.h src/defines.h src/config.h \
src/monster.h src/stats.h src/actiontext.h \
src/player.h src/doorlocktype.h src/particle_emitter.h \
src/skill.h src/input.h src/artifact.h \
src/map_room_modifiers.h src/object.h src/util.h
src/collisions.o: src/collisions.c src/collisions.h
src/db.o: src/db.c src/db.h
src/effect_util.o: src/effect_util.c src/gui.h src/linkedlist.h \
src/sprite.h src/texture.h src/position.h \
src/camera.h src/roommatrix.h src/timer.h \
src/vector2d.h src/player.h \
src/stats.h src/actiontext.h src/skill.h \
src/input.h src/artifact.h src/monster.h src/doorlocktype.h \
src/particle_emitter.h src/dimension.h src/defines.h \
src/config.h src/map_room_modifiers.h
src/event.o: src/event.c src/event.h src/player.h \
src/sprite.h src/stats.h \
src/actiontext.h src/camera.h src/skill.h \
src/linkedlist.h src/input.h src/artifact.h
src/gamecontroller.o: src/gamecontroller.c src/gamecontroller.h
src/gui_button.o: src/gui_button.c src/util.h src/gui_button.h \
src/pointer.h src/sprite.h src/camera.h \
src/input.h src/texture.h src/position.h \
src/roommatrix.h src/timer.h src/linkedlist.h \
src/vector2d.h
src/gui.o: src/gui.c src/gui.h src/linkedlist.h \
src/sprite.h src/texture.h src/position.h \
src/camera.h src/roommatrix.h src/timer.h \
src/vector2d.h src/player.h \
src/stats.h src/actiontext.h src/skill.h \
src/input.h src/artifact.h src/util.h \
src/map.h \
src/defines.h src/config.h src/monster.h \
src/doorlocktype.h src/particle_emitter.h src/map_room_modifiers.h \
src/object.h src/texturecache.h \
src/dimension.h src/gui_util.h
src/gui_util.o: src/gui_util.c src/texturecache.h src/texture.h \
src/dimension.h src/position.h \
src/camera.h src/gui_util.h src/sprite.h \
src/roommatrix.h src/timer.h
src/hashtable.o: src/hashtable.c src/hashtable.h src/defines.h \
src/config.h
src/hiscore.o: src/hiscore.c src/hiscore.h src/linkedlist.h \
src/player.h src/sprite.h \
src/stats.h src/actiontext.h src/camera.h \
src/skill.h src/input.h src/artifact.h \
src/db.h
src/input.o: src/input.c src/input.h
src/io_util.o: src/io_util.c src/physfsrwops.h src/io_util.h
src/item_builder.o: src/item_builder.c src/item_builder.h \
src/item.h src/sprite.h src/position.h \
src/player.h src/camera.h src/linkedlist.h \
src/texture.h src/dimension.h \
src/timer.h src/vector2d.h src/util.h \
src/gui.h src/roommatrix.h src/stats.h \
src/actiontext.h src/skill.h src/input.h \
src/artifact.h src/mixer.h src/gamestate.h \
src/random.h src/texturecache.h src/defines.h \
src/map_room_modifiers.h src/sprite_util.h src/map.h \
src/config.h src/monster.h src/doorlocktype.h \
src/particle_emitter.h
src/item.o: src/item.c src/item.h src/sprite.h \
src/texture.h src/position.h src/camera.h \
src/roommatrix.h src/timer.h src/player.h \
src/stats.h src/actiontext.h \
src/skill.h src/linkedlist.h src/input.h \
src/artifact.h src/vector2d.h src/util.h \
src/mixer.h src/gamestate.h src/gui.h \
src/actiontextbuilder.h src/update_data.h
src/keyboard.o: src/keyboard.c src/keyboard.h src/defines.h \
src/config.h
src/linkedlist.o: src/linkedlist.c src/linkedlist.h
src/main.o: src/main.c /sdk/local/newlib/include/SDL2/SDL_main.h \
src/linkedlist.h src/player.h src/sprite.h \
src/texture.h src/position.h src/camera.h \
src/roommatrix.h src/timer.h src/stats.h \
src/actiontext.h src/vector2d.h src/skill.h \
src/input.h src/artifact.h src/screenresolution.h \
src/dimension.h src/map.h src/defines.h \
src/config.h src/monster.h src/doorlocktype.h \
src/particle_emitter.h src/map_room_modifiers.h src/object.h \
src/map_lua.h src/gamestate.h src/gui.h \
src/util.h src/item_builder.h src/item.h \
src/pointer.h src/gui_button.h src/particle_engine.h \
src/menu.h src/keyboard.h \
src/mixer.h src/random.h src/skillbar.h \
src/texturecache.h src/update_data.h src/settings.h \
src/actiontextbuilder.h src/screen.h src/hiscore.h \
src/io_util.h src/tooltip.h src/gamecontroller.h \
src/time.h src/sprite_util.h src/event.h \
src/save.h src/steam/steamworks_api_wrapper.h src/defines.h
src/map.o: src/map.c src/map.h src/linkedlist.h \
src/sprite.h src/texture.h src/position.h \
src/camera.h src/roommatrix.h src/timer.h \
src/vector2d.h src/defines.h src/config.h \
src/monster.h src/stats.h src/actiontext.h \
src/player.h src/doorlocktype.h src/particle_emitter.h \
src/skill.h src/input.h src/artifact.h \
src/map_room_modifiers.h src/object.h src/map_lua.h \
src/util.h src/item.h src/item_builder.h \
src/gui.h src/particle_engine.h src/dimension.h \
src/update_data.h src/trap.h src/mixer.h
src/map_lua.o: src/map_lua.c src/map_lua.h src/map.h \
src/linkedlist.h src/sprite.h \
src/camera.h src/position.h src/timer.h \
src/defines.h src/monster.h src/player.h \
src/map_room_modifiers.h src/object.h src/doorlocktype.h \
src/config.h src/util.h src/stats.h \
src/io_util.h src/texturecache.h src/texture.h \
src/dimension.h src/trap.h src/roommatrix.h \
src/actiontext.h src/skill.h src/input.h \
src/artifact.h src/update_data.h src/gui.h \
src/vector2d.h src/item.h src/item_builder.h
src/map_room_modifiers.o: src/map_room_modifiers.c src/map_room_modifiers.h src/vector2d.h \
src/player.h src/sprite.h src/texture.h \
src/position.h src/camera.h src/roommatrix.h \
src/timer.h src/stats.h src/actiontext.h \
src/skill.h src/linkedlist.h src/input.h \
src/artifact.h src/defines.h
src/menu.o: src/menu.c src/menu.h src/camera.h \
src/position.h src/timer.h src/vector2d.h \
src/linkedlist.h src/texture.h \
src/dimension.h src/sprite.h src/roommatrix.h \
src/util.h src/defines.h src/map_room_modifiers.h \
src/input.h src/config.h src/gui_button.h \
src/pointer.h src/keyboard.h src/mixer.h \
src/gamestate.h src/collisions.h
src/mixer.o: src/mixer.c src/mixer.h src/gamestate.h \
src/util.h src/io_util.h src/settings.h
src/monster.o: src/monster.c src/monster.h src/sprite.h \
src/texture.h src/position.h src/camera.h \
src/roommatrix.h src/timer.h src/stats.h \
src/actiontext.h src/vector2d.h src/player.h \
src/skill.h src/linkedlist.h src/input.h \
src/artifact.h src/doorlocktype.h src/particle_emitter.h \
src/dimension.h src/util.h src/random.h \
src/gui.h src/item.h src/item_builder.h \
src/map.h src/defines.h src/config.h \
src/map_room_modifiers.h src/object.h src/particle_engine.h \
src/update_data.h src/actiontextbuilder.h src/texturecache.h \
src/trap.h src/mixer.h
src/object.o: src/object.c src/object.h src/camera.h \
src/position.h src/timer.h src/vector2d.h \
src/player.h src/sprite.h src/stats.h \
src/actiontext.h src/skill.h src/linkedlist.h \
src/input.h src/artifact.h src/texture.h \
src/roommatrix.h src/util.h src/mixer.h \
src/gamestate.h src/random.h src/texturecache.h
src/particle_emitter.o: src/particle_emitter.c src/particle_emitter.h src/timer.h \
src/position.h src/dimension.h
src/particle_engine.o: src/particle_engine.c src/particle_engine.h src/position.h \
src/dimension.h src/camera.h src/timer.h \
src/vector2d.h src/linkedlist.h src/util.h \
src/defines.h src/config.h
src/physfsrwops.o: src/physfsrwops.c src/physfsrwops.h
src/player.o: src/player.c src/player.h src/sprite.h \
src/texture.h src/position.h src/camera.h \
src/roommatrix.h src/timer.h src/stats.h \
src/actiontext.h src/vector2d.h src/skill.h \
src/linkedlist.h src/input.h src/artifact.h \
src/monster.h src/doorlocktype.h src/particle_emitter.h \
src/dimension.h src/util.h src/gui.h \
src/item.h src/particle_engine.h src/keyboard.h \
src/defines.h src/config.h src/mixer.h \
src/gamestate.h src/random.h src/projectile.h \
src/map_room_modifiers.h src/update_data.h src/map.h \
src/texturecache.h src/actiontextbuilder.h \
src/animation.h src/trap.h src/gamecontroller.h \
src/event.h src/effect_util.h src/steam/steamworks_api_wrapper.h \
src/defines.h
src/pointer.o: src/pointer.c src/pointer.h src/sprite.h \
src/texture.h src/position.h src/camera.h \
src/roommatrix.h src/timer.h src/vector2d.h \
src/input.h src/util.h src/particle_engine.h
src/position.o: src/position.c src/position.h src/defines.h
src/projectile.o: src/projectile.c src/projectile.h src/sprite.h \
src/texture.h src/position.h src/camera.h \
src/roommatrix.h src/timer.h \
src/vector2d.h src/defines.h src/map_room_modifiers.h \
src/input.h src/update_data.h src/player.h \
src/map.h src/gui.h src/config.h \
src/util.h src/texturecache.h src/dimension.h \
src/stats.h src/actiontext.h src/skill.h \
src/linkedlist.h src/artifact.h src/monster.h \
src/doorlocktype.h src/particle_emitter.h src/mixer.h \
src/gamestate.h src/item_builder.h src/item.h \
src/random.h src/object.h src/effect_util.h
src/random.o: src/random.c src/time.h src/random.h
src/roommatrix.o: src/roommatrix.c src/defines.h src/config.h \
src/roommatrix.h src/position.h src/camera.h \
src/timer.h src/vector2d.h \
src/map_room_modifiers.h src/input.h src/util.h \
src/map.h src/linkedlist.h src/sprite.h src/texture.h \
src/monster.h src/stats.h src/actiontext.h \
src/player.h src/doorlocktype.h src/particle_emitter.h \
src/skill.h src/artifact.h src/object.h \
src/item.h src/update_data.h src/gui.h
src/save.o: src/save.c src/save.h src/player.h \
src/sprite.h src/stats.h \
src/actiontext.h src/camera.h src/skill.h \
src/linkedlist.h src/input.h src/artifact.h \
src/db.h src/defines.h src/config.h
src/screen.o: src/screen.c src/screen.h src/texture.h \
src/dimension.h \
src/position.h src/camera.h src/linkedlist.h \
src/sprite.h src/roommatrix.h src/timer.h \
src/vector2d.h src/util.h src/hiscore.h \
src/player.h src/stats.h src/actiontext.h \
src/skill.h src/input.h
src/screenresolution.o: src/screenresolution.c src/defines.h src/config.h \
src/util.h src/screenresolution.h
src/settings.o: src/settings.c src/settings.h src/util.h \
src/defines.h src/config.h
src/skill.o: src/skill.c src/texturecache.h src/texture.h \
src/dimension.h src/position.h \
src/camera.h src/skill.h src/roommatrix.h \
src/defines.h src/map_room_modifiers.h src/input.h \
src/sprite.h src/timer.h src/vector2d.h \
src/util.h src/player.h src/stats.h \
src/actiontext.h src/linkedlist.h src/artifact.h \
src/config.h src/monster.h src/doorlocktype.h \
src/particle_emitter.h src/mixer.h src/gamestate.h \
src/gui.h src/random.h src/particle_engine.h \
src/projectile.h src/update_data.h src/map.h \
src/item.h src/animation.h src/trap.h \
src/tooltip.h src/actiontextbuilder.h
src/skillbar.o: src/skillbar.c src/defines.h src/config.h \
src/skillbar.h src/linkedlist.h src/camera.h \
src/position.h src/timer.h src/vector2d.h \
src/player.h src/sprite.h src/stats.h \
src/actiontext.h src/skill.h src/input.h \
src/artifact.h src/texture.h \
src/dimension.h src/util.h src/roommatrix.h \
src/map_room_modifiers.h src/keyboard.h src/texturecache.h \
src/particle_engine.h src/update_data.h src/map.h \
src/monster.h src/object.h src/doorlocktype.h
src/sprite.o: src/sprite.c src/sprite.h src/texture.h \
src/dimension.h \
src/position.h src/camera.h src/timer.h \
src/vector2d.h src/roommatrix.h src/defines.h \
src/map_room_modifiers.h src/input.h src/util.h \
src/update_data.h src/player.h src/stats.h \
src/actiontext.h src/skill.h src/linkedlist.h \
src/artifact.h src/map.h src/monster.h \
src/object.h src/doorlocktype.h
src/sprite_util.o: src/sprite_util.c src/sprite_util.h src/sprite.h \
src/texture.h src/position.h src/camera.h \
src/roommatrix.h src/timer.h
src/stats.o: src/stats.c src/gui.h \
src/linkedlist.h src/sprite.h src/texture.h \
src/position.h src/camera.h src/roommatrix.h \
src/timer.h src/vector2d.h src/player.h \
src/stats.h src/actiontext.h src/skill.h \
src/input.h src/artifact.h src/random.h \
src/util.h src/defines.h
src/texture.o: src/texture.c src/texture.h \
src/dimension.h src/position.h \
src/camera.h src/timer.h src/vector2d.h \
src/util.h
src/texturecache.o: src/texturecache.c src/texturecache.h \
src/texture.h src/dimension.h \
src/position.h src/camera.h src/hashtable.h \
src/defines.h src/config.h src/util.h
src/time.o: src/time.c src/time.h
src/timer.o: src/timer.c src/util.h
src/tooltip.o: src/tooltip.c src/tooltip.h src/camera.h \
src/position.h src/timer.h \
src/vector2d.h src/sprite.h src/texture.h \
src/roommatrix.h src/gui_util.h src/defines.h \
src/config.h src/gui.h src/linkedlist.h \
src/player.h src/stats.h src/actiontext.h \
src/skill.h src/input.h src/artifact.h \
src/texturecache.h
src/trap.o: src/trap.c src/trap.h \
src/sprite.h src/texture.h src/position.h \
src/camera.h src/roommatrix.h src/timer.h \
src/player.h src/stats.h src/actiontext.h \
src/skill.h src/linkedlist.h src/input.h \
src/artifact.h src/update_data.h src/map.h \
src/gui.h src/vector2d.h src/util.h \
src/random.h
src/util.o: src/util.c src/time.h src/defines.h \
src/config.h
src/vector2d.o: src/vector2d.c
bh_random/src/bh_random.o:
@g++ -c bh_random/src/bh_random.cpp -o bh_random/src/bh_random.o $(CFLAGS)
# prepare an archive for the program
release:
@echo "Creating release files..."
@mkdir -p release/breakhack
@cp -r release_files/* release/breakhack/
@cp -r data release/breakhack/
@cp -r assets release/breakhack/
@cp breakhack release/breakhack/
@strip release/breakhack/breakhack
@cp README.md release/breakhack/
@cp README_Amiga.md release/breakhack/
@cp LICENSE.txt release/breakhack/
@cp CREDITS.md release/breakhack/
@echo "Creating release archive..."
@lha -aeqr3 a breakhack-OS4.lha release/
@echo "Clean release files..."
@delete release ALL QUIET FORCE

View File

@ -1,19 +1,12 @@
[![maintenance](https://img.shields.io/badge/maintenance-passively--maintained-orange)](https://img.shields.io/badge/maintenance-passively--maintained-orange)
[![Build Status](https://travis-ci.org/Oliveshark/breakhack.svg?branch=master)](https://travis-ci.org/Oliveshark/breakhack)
[![Build status](https://ci.appveyor.com/api/projects/status/2a18npdntkmlx3dc?svg=true)](https://ci.appveyor.com/project/LiquidityC/breakhack)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/fc02d56fa7194e61b2c7d260fd2e4186)](https://www.codacy.com/app/LiquidityC/breakhack?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Oliveshark/breakhack&amp;utm_campaign=Badge_Grade)
[![CodeFactor](https://www.codefactor.io/repository/github/oliveshark/breakhack/badge/dev)](https://www.codefactor.io/repository/github/oliveshark/breakhack/overview/master)
<!--[![Coverity Scan](https://scan.coverity.com/projects/15218/badge.svg)](https://scan.coverity.com/projects/oliveshark-breakhack)-->
[![GitHub issues](https://img.shields.io/github/issues/oliveshark/breakhack.svg)](https://github.com/oliveshark/breakhack/issues)
[![GitHub closed issues](https://img.shields.io/github/issues-closed/oliveshark/breakhack.svg)](https://github.com/oliveshark/breakhack/issues)
![GitHub (pre-)release](https://img.shields.io/github/release/oliveshark/breakhack/all.svg)
[![Github All Releases](https://img.shields.io/github/downloads/oliveshark/breakhack/total.svg)](https://github.com/oliveshark/breakhack/releases)
[![HitCount](http://hits.dwyl.io/oliveshark/breakhack.svg)](http://hits.dwyl.io/oliveshark/breakhack)
[![Build Status](https://travis-ci.org/LiquidityC/breakhack.svg?branch=master)](https://travis-ci.org/LiquidityC/breakhack)
[![Build Status](https://ci.appveyor.com/api/projects/status/2nvna97cmm4cf535?svg=true)](https://ci.appveyor.com/project/LiquidityC/breakhack)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/fc02d56fa7194e61b2c7d260fd2e4186)](https://www.codacy.com/app/LiquidityC/breakhack?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=LiquidityC/breakhack&amp;utm_campaign=Badge_Grade)
<!--[![Coverity Scan](https://scan.coverity.com/projects/15218/badge.svg)](https://scan.coverity.com/projects/liquidityc-breakhack)-->
Something in the ways of a roguelike
Something in the ways of NETHACK
================================
A simple roguelike written in C using SDL2.
A simple nethack similar game written in C using SDL2.
Idea
----
@ -25,30 +18,26 @@ I wanted to practice C and I'm comfortable using SDL2. The assets
are graciously taken from the web. More info in the README in the
assets folder.
Download
--------
This game is available in the [steam store](https://store.steampowered.com/app/931040/BreakHack/) (release Okt 2018).
If you enjoy the game and want a properly installed, signed copy of the game with achievements and
global highscores you are most welcome to purchase it there.
If you feel like getting a free copy you can download and compile from here.
Issues
Future
------
I'd prefer if issues could be handled here on github. Either check the list if your particular problem is reported
otherwise create a new issue. Support questions can be submitted as issues as well, I haven't figured out how I want to
work with support yet since I haven't received any questions.
License
-------
BreakHack is released under two different licenses.
- The source code is released under [GPLv3](https://github.com/oliveshark/breakhack/blob/master/LICENSE.txt)
- The Steam release is released under the [Steam subscriber agreement](https://store.steampowered.com/subscriber_agreement/)
I'm planning on releaseing this game on Steam once I'm happy with it.
Not to get rich, mostly because I think it will look nice on my resumé.
the code will remain open source under GPLv3 even after a possible Steam
release. So you'll still be able to download and compile it yourself if you
can and want to.
Compile
-------
* [Linux](LINUX_BUILD_INSTRUCTIONS.md)
* [Windows (Visual Studio)](MSVC_BUILD_INSTRUCTIONS.md)
Apart from basic compile tools (*GCC/Clang, Make*) you'll also need to install **lua, sdl2, sdl2-image, sdl2-ttf, sdl2-mixer** (If on a debian based dist you need to install the *dev* packages).
Optionally you can also install **cppcheck** and **physfs**
Once that is done run the following:
```bash
mkdir _build
cd _build
cmake -DCMAKE_BUILD_TYPE=Debug .. # Build type flag is optional
make
```
Contribute
----------
@ -56,14 +45,7 @@ Have an idea and able to implement it? Fork and send me a pull request and
I'll check it out. If I like it I will add it. If it's a big thing I'll add
your name to the credits list (once I add it in game).
If you do contribute something you should be aware that if your PR is merged
into the master code-base your code will eventually make it out with the Steam version
of the game. I don't make any revenue from those sales so don't expect any other compensation
than a "I have code on Steam" feeling. Which is quite nice and also why I decided to release
on Steam.
Links
-----
- [Itch.io](https://store.steampowered.com/app/931040/BreakHack/)
- [Steam](https://liquidityc.itch.io/breakhack)
- [https://liquidityc.itch.io/breakhack](https://liquidityc.itch.io/breakhack)

View File

@ -1,48 +0,0 @@
# breakhack for AmigaOS 4.1 FE
breakhack is a small roguelike game for having some good time, while
you wait for your amiga to compile or render a screen. It is developed
by Linus Probert and you can find it for various platforms on Steam.
## Installation
Extract the archive wherever you want and run the *breakhack* binary.
## I would like to thank
- Linus Probert for creating this awesome game and open sourcing it
- Capehill for his tireless work on SDL port for AmigaOS 4.1 FE
- Roman "kas1e" Kargin and Nouvel "HunoPPC" Hugues for their help
with libphysfs
## Known issues
There are some issues with the Fullscreen graphics, depending which
Renderer driver is used. I might fix them in the future.
## Support
If you enjoy what I am doing and would like to keep me up during the night,
please consider to buy me a coffee at:
https://ko-fi.com/walkero
## Known issues
You can find the known issues at
https://git.walkero.gr/walkero/breakhack/issues
# Changelog
## [4.0.3r2] - 2023-07-04
### Changed
- Compiled with latest SDL 2.0.28 that has a better support for 16bit
screens. Now it works under Qemu. Tested with Software rendering
### Fixed
- Fixed the hiscore date. Now it is saved on UTC +8 years which is
the Amiga epoch diff against the unix one. This doesn affect the
old hi-scores though
## [4.0.3r1] - 2022-12-21
### Added
- First release for AmigaOS 4

Binary file not shown.

20
TODO.txt Normal file
View File

@ -0,0 +1,20 @@
o Make things less difficult and more interesting
o Interesting items
x Daggers
- Bombs?
- Magical permanent items would be nice
- Piercing daggers
- Charge passthrough
- +1 atk / +1 def items
o Creat some nice room modifiers
x Windy room
x Liquid in rooms
- Falling floor tiles
- Credit screen showing music and graphics guys:
- Music: http://soundimage.org/ (Eric Matyas)
- SFX (Eric Matyas & https://opengameart.org/users/artisticdude & ZapSplat.com)
- Graphics: (see README)
Legend: ( '-' = future) ( 'x' = completed ) ( 'o' = begun )

59
assets/Examples/Blank.tmx Normal file
View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="20" height="15" tilewidth="16" tileheight="16">
<tileset firstgid="1" name="Wall" tilewidth="16" tileheight="16">
<image source="../Objects/Wall.png" width="320" height="432"/>
</tileset>
<tileset firstgid="541" name="Floor" tilewidth="16" tileheight="16">
<image source="../Objects/Floor.png" width="336" height="432"/>
</tileset>
<tileset firstgid="1108" name="Pit0" tilewidth="16" tileheight="16">
<image source="../Objects/Pit0.png" width="128" height="352"/>
</tileset>
<tileset firstgid="1284" name="Door0" tilewidth="16" tileheight="16">
<image source="../Objects/Door0.png" width="128" height="80"/>
</tileset>
<tileset firstgid="1324" name="Decor0" tilewidth="16" tileheight="16">
<image source="../Objects/Decor0.png" width="128" height="288"/>
</tileset>
<tileset firstgid="1468" name="Ground0" tilewidth="16" tileheight="16">
<image source="../Objects/Ground0.png" width="128" height="48"/>
</tileset>
<layer name="Tiles" width="20" height="15">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<layer name="Sprites" width="20" height="15">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
</map>

BIN
assets/Examples/Dungeon.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="20" height="15" tilewidth="16" tileheight="16">
<tileset firstgid="1" name="Wall" tilewidth="16" tileheight="16">
<image source="../Objects/Wall.png" width="320" height="816"/>
</tileset>
<tileset firstgid="1021" name="Floor" tilewidth="16" tileheight="16">
<image source="../Objects/Floor.png" width="336" height="624"/>
</tileset>
<tileset firstgid="1840" name="Pit0" tilewidth="16" tileheight="16">
<image source="../Objects/Pit0.png" width="128" height="512"/>
</tileset>
<tileset firstgid="2096" name="Door0" tilewidth="16" tileheight="16">
<image source="../Objects/Door0.png" width="128" height="80"/>
</tileset>
<tileset firstgid="2136" name="Decor0" tilewidth="16" tileheight="16">
<image source="../Objects/Decor0.png" width="128" height="352"/>
</tileset>
<tileset firstgid="2312" name="Ground0" tilewidth="16" tileheight="16">
<image source="../Objects/Ground0.png" width="128" height="112"/>
</tileset>
<tileset firstgid="2368" name="Player0" tilewidth="16" tileheight="16">
<image source="../Characters/Player0.png" width="128" height="240"/>
</tileset>
<tileset firstgid="2488" name="Pest0" tilewidth="16" tileheight="16">
<image source="../Characters/Pest0.png" width="128" height="176"/>
</tileset>
<tileset firstgid="2576" name="Rodent0" tilewidth="16" tileheight="16">
<image source="../Characters/Rodent0.png" width="128" height="64"/>
</tileset>
<tileset firstgid="2608" name="Undead0" tilewidth="16" tileheight="16">
<image source="../Characters/Undead0.png" width="128" height="160"/>
</tileset>
<tileset firstgid="2688" name="Money" tilewidth="16" tileheight="16">
<image source="../Items/Money.png" width="128" height="128"/>
</tileset>
<tileset firstgid="2752" name="Chest0" tilewidth="16" tileheight="16">
<image source="../Items/Chest0.png" width="128" height="48"/>
</tileset>
<layer name="Tiles" width="20" height="15">
<data encoding="csv">
1031,1031,1031,1031,1031,1031,1031,1031,1031,1031,1031,1031,1031,1031,1031,1031,1031,1031,1031,1031,
1031,181,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,183,1031,1031,
1031,201,1210,1211,1211,1211,1212,1232,1235,1236,1236,1236,1236,1236,1236,1236,1212,201,1031,1031,
1031,201,1231,1232,1232,1232,1233,181,182,182,182,182,182,182,182,183,1234,201,1031,1031,
1031,201,1231,1232,1232,1232,1233,223,1031,1031,1031,1031,1031,1031,1031,201,1234,201,1031,1031,
1031,201,1231,1232,1462,1463,1464,381,1031,181,182,182,182,182,182,182,1255,182,183,1031,
1031,201,1252,1253,1483,1484,1506,381,1031,201,1856,1857,1857,1857,1857,1857,1556,1858,201,1031,
1031,221,182,182,363,1506,361,403,1031,201,1864,1865,1865,1865,1865,1865,1556,1866,201,1031,
1031,1031,1031,1031,401,362,403,1031,1031,201,1864,1532,1558,1558,1558,1558,1576,1866,201,1031,
181,182,182,182,182,182,182,183,1031,201,1864,1556,1865,1865,1865,1865,1865,1866,201,1031,
201,1210,1211,1211,1211,1212,1535,201,1031,201,1864,1556,1865,1865,1865,1865,1865,1866,201,1031,
201,1231,1232,1232,1232,1233,1556,201,1031,221,183,1213,181,182,182,182,182,182,223,1031,
201,1252,1253,1253,1253,1254,1556,201,1031,1031,201,1234,201,1031,1031,1031,1031,1031,1031,1031,
221,182,182,182,182,183,1556,201,1031,1031,201,1234,201,1031,1031,1031,1031,1031,1031,1031,
1031,1031,1031,1031,1031,201,1556,201,1031,1031,201,1234,201,1031,1031,1031,1031,1031,1031,1031
</data>
</layer>
<layer name="Sprites" width="20" height="15">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,2200,0,0,0,0,0,0,0,2200,0,0,0,0,0,0,0,
0,0,2317,0,0,0,0,2097,0,0,2147486304,0,0,0,0,0,2317,0,0,0,
0,0,0,2692,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2691,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2147486401,0,2147486154,0,2326,0,0,0,0,2200,0,0,2200,0,2098,0,0,0,
0,0,0,2317,2315,2319,2585,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2592,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,2569,0,0,0,0,0,
0,0,2200,0,2200,0,0,0,0,0,0,2147486041,0,0,0,0,0,0,0,0,
0,2304,0,2208,2166,2113,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,2147486276,0,0,2117,0,0,0,0,0,2096,0,0,0,0,0,0,0,0,
0,2160,2192,2193,0,2113,0,0,0,0,0,2316,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,2104,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,2147486233,0,0,0,0,0,0,0,0
</data>
</layer>
</map>

BIN
assets/Examples/Ideas.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
assets/Examples/Logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

22
assets/Examples/Logo.tmx Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="15" height="12" tilewidth="16" tileheight="16">
<tileset firstgid="1" name="Wall" tilewidth="16" tileheight="16">
<image source="../Objects/Wall.png" width="320" height="432"/>
</tileset>
<layer name="Tile Layer 1" width="15" height="12">
<data encoding="csv">
121,123,83,83,83,141,83,0,141,83,141,83,141,83,141,
141,161,123,83,121,165,123,0,141,83,141,83,144,123,141,
141,0,141,83,141,0,141,0,141,141,141,83,141,141,141,
141,0,141,83,144,122,146,0,141,141,141,83,141,141,141,
141,121,163,83,141,83,141,0,144,122,146,83,141,161,146,
161,163,83,83,142,83,142,0,142,83,142,83,142,83,142,
381,83,381,83,83,381,83,83,83,361,362,83,381,83,381,
381,83,381,83,361,405,363,83,361,403,83,83,381,361,403,
384,362,386,83,381,83,381,83,381,83,83,83,384,386,83,
381,83,381,83,384,362,386,83,381,83,83,83,381,401,363,
381,83,381,83,381,83,381,83,401,363,83,83,381,83,381,
382,83,382,83,382,83,382,83,83,401,362,83,382,83,382
</data>
</layer>
</map>

BIN
assets/Examples/Mine.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

80
assets/Examples/Mine.tmx Normal file
View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="20" height="15" tilewidth="16" tileheight="16">
<tileset firstgid="1" name="Wall" tilewidth="16" tileheight="16">
<image source="../Objects/Wall.png" width="320" height="816"/>
</tileset>
<tileset firstgid="1021" name="Floor" tilewidth="16" tileheight="16">
<image source="../Objects/Floor.png" width="336" height="624"/>
</tileset>
<tileset firstgid="1840" name="Pit0" tilewidth="16" tileheight="16">
<image source="../Objects/Pit0.png" width="128" height="512"/>
</tileset>
<tileset firstgid="2096" name="Door0" tilewidth="16" tileheight="16">
<image source="../Objects/Door0.png" width="128" height="80"/>
</tileset>
<tileset firstgid="2136" name="Decor0" tilewidth="16" tileheight="16">
<image source="../Objects/Decor0.png" width="128" height="352"/>
</tileset>
<tileset firstgid="2312" name="Ground0" tilewidth="16" tileheight="16">
<image source="../Objects/Ground0.png" width="128" height="112"/>
</tileset>
<tileset firstgid="2368" name="Player0" tilewidth="16" tileheight="16">
<image source="../Characters/Player0.png" width="128" height="240"/>
</tileset>
<tileset firstgid="2488" name="Food" tilewidth="16" tileheight="16">
<image source="../Items/Food.png" width="128" height="96"/>
</tileset>
<tileset firstgid="2536" name="Ore0" tilewidth="16" tileheight="16">
<image source="../Objects/Ore0.png" width="144" height="112"/>
</tileset>
<tileset firstgid="2599" name="Elemental0" tilewidth="16" tileheight="16">
<image source="../Characters/Elemental0.png" width="128" height="176"/>
</tileset>
<tileset firstgid="2687" name="Misc0" tilewidth="16" tileheight="16">
<image source="../Characters/Misc0.png" width="128" height="128"/>
</tileset>
<tileset firstgid="2751" name="LongWep" tilewidth="16" tileheight="16">
<image source="../Items/LongWep.png" width="128" height="112"/>
</tileset>
<tileset firstgid="2807" name="Avian0" tilewidth="16" tileheight="16">
<image source="../Characters/Avian0.png" width="128" height="208"/>
</tileset>
<layer name="Tiles" width="20" height="15">
<data encoding="csv">
10,10,10,361,362,363,1423,381,361,403,1928,1930,401,362,363,10,10,10,10,10,
10,361,362,403,1402,382,1423,401,403,1402,1928,1927,1922,1404,401,362,363,10,10,10,
10,382,1424,1425,1421,1400,1421,1400,1400,1422,1928,1913,1927,1922,1399,1401,381,10,10,10,
1873,1873,1873,1873,1420,1421,1442,1442,1442,1422,1928,1913,1913,1930,1420,1443,381,10,10,10,
1881,1881,1882,1399,1421,1443,361,362,363,1441,1426,1928,1930,1424,1443,361,403,10,10,10,
10,1882,1399,1421,1422,361,403,10,401,362,362,362,362,362,362,403,10,10,10,10,
136,136,1441,1442,1443,175,136,136,136,136,136,136,136,136,136,136,136,136,136,136,
1432,1432,1432,1432,1432,1424,1425,1426,1432,1432,1432,1424,1426,1432,1432,1432,1404,1432,1404,1432,
136,136,136,136,136,136,136,136,1424,1400,1426,135,137,1404,135,136,136,136,136,136,
10,10,10,361,362,362,365,362,363,1423,361,403,155,1430,155,0,0,0,0,0,
10,10,361,403,1399,1400,401,362,403,1423,381,10,155,1430,175,136,136,136,136,136,
361,362,403,1399,1157,1421,1154,1156,1400,1159,381,10,155,1424,1426,1432,1432,1432,1432,1424,
381,1399,1400,1442,1199,1154,1176,1176,1177,1444,381,10,175,136,136,136,136,136,136,136,
403,1420,1443,381,1441,1196,1176,1176,1176,361,403,10,10,10,10,10,10,10,10,10,
1399,1422,361,405,362,362,362,362,362,403,10,10,10,10,10,10,10,10,10,10
</data>
</layer>
<layer name="Sprites" width="20" height="15">
<data encoding="csv">
0,0,0,0,0,0,2316,0,0,2545,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,2895,0,0,2327,0,0,0,0,0,2554,0,0,0,0,
0,0,2327,0,0,0,0,0,2895,0,0,2895,0,0,0,2316,2569,0,0,0,
0,0,0,0,0,2522,0,0,0,0,0,0,0,0,0,2759,2569,0,0,0,
0,0,0,2147485973,0,0,0,0,0,2325,0,0,0,0,2500,0,0,0,0,0,
0,0,2319,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,2147486132,0,0,0,0,0,2568,0,0,0,2554,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,2608,0,0,0,0,0,0,
0,0,0,0,2586,0,0,0,0,0,0,0,2574,0,0,0,0,0,0,0,
0,0,0,0,2166,0,0,0,0,0,2587,0,0,2147486107,0,0,0,2581,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2459,0,0,0,0,
0,2319,0,0,0,0,2331,2488,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,2330,0,2147485979,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
</map>

BIN
assets/Examples/Town.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

77
assets/Examples/Town.tmx Normal file
View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="20" height="15" tilewidth="16" tileheight="16">
<tileset firstgid="1" name="Wall" tilewidth="16" tileheight="16">
<image source="../Objects/Wall.png" width="320" height="816"/>
</tileset>
<tileset firstgid="1021" name="Floor" tilewidth="16" tileheight="16">
<image source="../Objects/Floor.png" width="336" height="624"/>
</tileset>
<tileset firstgid="1840" name="Pit0" tilewidth="16" tileheight="16">
<image source="../Objects/Pit0.png" width="128" height="512"/>
</tileset>
<tileset firstgid="2096" name="Door0" tilewidth="16" tileheight="16">
<image source="../Objects/Door0.png" width="128" height="80"/>
</tileset>
<tileset firstgid="2136" name="Decor0" tilewidth="16" tileheight="16">
<image source="../Objects/Decor0.png" width="128" height="352"/>
</tileset>
<tileset firstgid="2312" name="Ground0" tilewidth="16" tileheight="16">
<image source="../Objects/Ground0.png" width="128" height="112"/>
</tileset>
<tileset firstgid="2368" name="Player0" tilewidth="16" tileheight="16">
<image source="../Characters/Player0.png" width="128" height="240"/>
</tileset>
<tileset firstgid="2488" name="Tree0" tilewidth="16" tileheight="16">
<image source="../Objects/Tree0.png" width="128" height="528"/>
</tileset>
<tileset firstgid="2752" name="Humanoid0" tilewidth="16" tileheight="16">
<image source="../Characters/Humanoid0.png" width="128" height="432"/>
</tileset>
<tileset firstgid="2968" name="Cat0" tilewidth="16" tileheight="16">
<image source="../Characters/Cat0.png" width="128" height="80"/>
</tileset>
<tileset firstgid="3008" name="Quadraped0" tilewidth="16" tileheight="16">
<image source="../Characters/Quadraped0.png" width="128" height="192"/>
</tileset>
<tileset firstgid="3104" name="Container0" tilewidth="16" tileheight="16">
<image source="../Items/Chest0.png" width="128" height="48"/>
</tileset>
<layer name="Tiles" width="20" height="15">
<data encoding="csv">
1176,1176,1176,1176,1176,1176,1177,1171,1175,1176,1176,1176,1176,1176,1176,1176,1176,1176,1176,1176,
1176,1176,1176,1176,1176,1176,1177,1171,1175,1197,1197,1197,1197,1197,1197,1197,1197,1197,1197,1176,
1176,1176,1176,1176,1176,1176,1177,1171,1178,1421,129,129,129,129,129,129,129,129,1421,1175,
1176,1176,1176,1176,1176,1176,1177,1171,1178,148,1406,1408,1411,1406,1407,1407,1407,1408,148,1175,
1197,1197,1197,1197,1197,1176,1177,1171,1178,148,1448,1450,132,1427,1428,1428,1428,1429,148,1175,
129,129,129,129,1421,1175,1177,1171,1178,1421,129,129,153,1427,1428,1428,1428,1429,148,1196,
1407,1407,1407,1408,148,1175,1177,1171,1175,1155,1155,1156,148,1427,1428,1428,1428,1429,129,129,
1428,1428,1428,1429,148,1175,1177,1171,1175,1176,1176,1177,148,1427,1428,1428,1428,1429,1431,1432,
1428,1428,1428,1429,148,1175,1198,1171,1196,1197,1197,1177,148,1427,1428,1428,1428,1429,128,129,
1449,1449,1449,1450,148,1178,1147,1169,1148,1148,1149,1178,148,1448,1449,1449,1449,1450,148,1154,
129,1411,129,129,1421,1178,1168,1169,1169,1169,1170,1178,1421,129,129,1411,129,129,1421,1175,
1155,1402,1155,1155,1155,1177,1168,1169,1169,1169,1170,1175,1155,1155,1156,1402,1154,1155,1155,1176,
1197,1444,1197,1197,1197,1198,1168,1169,1169,1169,1170,1196,1197,1197,1198,1444,1196,1197,1197,1197,
1148,1148,1148,1173,1173,1173,1190,1169,1169,1169,1190,1173,1173,1173,1173,1148,1148,1148,1148,1148,
1190,1190,1191,1154,1155,1155,1156,1168,1169,1170,1154,1155,1155,1155,1156,1168,1169,1169,1169,1169
</data>
</layer>
<layer name="Sprites" width="20" height="15">
<data encoding="csv">
2497,2497,2498,2504,2505,2506,7,0,7,2147485969,7,2147485969,2313,2147486720,3073,2491,2147485969,2491,2496,2497,
2497,2497,2498,2491,2321,7,2491,0,7,7,2147485969,2147485969,7,2491,7,7,2491,7,2504,2505,
2497,2497,2498,2321,2491,2147485968,7,0,2461,128,7,7,7,7,7,7,7,7,130,2147485969,
2505,2505,2506,7,2321,2491,7,0,7,7,2147486752,7,2097,2164,2147486640,0,2848,2160,7,7,
2491,7,2321,7,2321,7,2147486109,0,7,7,3120,3120,7,2216,2217,2217,2217,2218,7,2147485969,
7,7,7,7,130,7,7,2147486109,2147485969,168,7,7,7,2192,7,2192,2800,2147485840,7,7,
2227,7,2849,2225,7,2147485961,7,0,7,2330,2330,2331,7,7,2248,2249,2250,7,7,7,
2217,2217,2217,2218,7,7,2313,0,2147485961,2331,2331,2330,7,7,2256,2257,2258,2832,2097,7,
2252,2252,2252,2253,7,2491,7,0,7,2147485961,2491,2491,7,2195,2264,2265,2266,2147485843,7,7,
2268,2268,2268,2269,7,2321,0,0,0,0,0,7,7,2196,2147485843,7,2195,2196,7,2491,
7,2096,7,2186,170,7,0,7,2305,7,2826,7,168,2185,7,2096,7,2185,170,2147485961,
2334,0,2334,2147485968,2491,7,0,7,7,2827,0,3050,7,7,2332,0,2332,2491,7,7,
0,0,0,0,7,2147485968,0,2147486472,7,7,0,7,2177,7,2320,0,7,7,2147485969,7,
0,0,0,2147486018,0,0,0,0,0,0,0,0,0,2460,0,0,0,0,7,7,
0,0,0,0,2491,2491,7,0,2374,0,2491,7,2491,7,7,0,0,0,2825,0
</data>
</layer>
</map>

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="20" height="15" tilewidth="16" tileheight="16">
<tileset firstgid="1" name="Wall" tilewidth="16" tileheight="16">
<image source="../Objects/Wall.png" width="320" height="816"/>
</tileset>
<tileset firstgid="1021" name="Floor" tilewidth="16" tileheight="16">
<image source="../Objects/Floor.png" width="336" height="624"/>
</tileset>
<tileset firstgid="1840" name="Pit0" tilewidth="16" tileheight="16">
<image source="../Objects/Pit0.png" width="128" height="512"/>
</tileset>
<tileset firstgid="2096" name="Door0" tilewidth="16" tileheight="16">
<image source="../Objects/Door0.png" width="128" height="80"/>
</tileset>
<tileset firstgid="2136" name="Decor0" tilewidth="16" tileheight="16">
<image source="../Objects/Decor0.png" width="128" height="352"/>
</tileset>
<tileset firstgid="2312" name="Ground0" tilewidth="16" tileheight="16">
<image source="../Objects/Ground0.png" width="128" height="112"/>
</tileset>
<tileset firstgid="2368" name="Player0" tilewidth="16" tileheight="16">
<image source="../Characters/Player0.png" width="128" height="240"/>
</tileset>
<tileset firstgid="2488" name="Tile" tilewidth="16" tileheight="16">
<image source="../Objects/Tile.png" width="128" height="64"/>
</tileset>
<tileset firstgid="2520" name="Demon0" tilewidth="16" tileheight="16">
<image source="../Characters/Demon0.png" width="128" height="144"/>
</tileset>
<tileset firstgid="2592" name="Dog0" tilewidth="16" tileheight="16">
<image source="../Characters/Dog0.png" width="128" height="112"/>
</tileset>
<tileset firstgid="2648" name="Tree0" tilewidth="16" tileheight="16">
<image source="../Objects/Tree0.png" width="128" height="528"/>
</tileset>
<tileset firstgid="2912" name="Money" tilewidth="16" tileheight="16">
<image source="../Items/Money.png" width="128" height="128"/>
</tileset>
<tileset firstgid="2976" name="Book" tilewidth="16" tileheight="16">
<image source="../Items/Book.png" width="128" height="144"/>
</tileset>
<tileset firstgid="3048" name="Amulet" tilewidth="16" tileheight="16">
<image source="../Items/Amulet.png" width="128" height="48"/>
</tileset>
<tileset firstgid="3072" name="Elemental0" tilewidth="16" tileheight="16">
<image source="../Characters/Elemental0.png" width="128" height="176"/>
</tileset>
<tileset firstgid="3160" name="Pest0" tilewidth="16" tileheight="16">
<image source="../Characters/Pest0.png" width="128" height="176"/>
</tileset>
<tileset firstgid="3248" name="Chest0" tilewidth="16" tileheight="16">
<image source="../Items/Chest0.png" width="128" height="48"/>
</tileset>
<tileset firstgid="3272" name="Fence" tilewidth="16" tileheight="16">
<image source="../Objects/Fence.png" width="128" height="192"/>
</tileset>
<layer name="Tiles" width="20" height="15">
<data encoding="csv">
10,261,1234,261,241,285,285,285,285,285,285,285,285,285,285,243,261,1234,261,10,
10,261,1234,261,261,1273,1274,1299,1299,1299,1299,1299,1299,1274,1275,261,261,1234,261,10,
10,261,1234,261,261,1294,262,1210,1211,1211,1211,1211,1212,262,1296,261,261,1234,261,10,
10,261,1234,281,283,1294,1296,1231,1232,1232,1232,1232,1233,1294,1296,281,283,1234,261,10,
285,283,1234,1298,1299,1316,262,1231,1232,1232,1232,1232,1233,262,1316,1299,1300,1234,281,285,
1236,1236,1253,1236,1236,1236,1236,1253,1253,1232,1232,1253,1253,1236,1236,1236,1236,1253,1236,1236,
285,243,1273,1274,1274,1274,1275,2048,2050,1231,1233,2048,2050,1273,1274,1274,1274,1275,241,285,
10,261,1315,1316,1295,1316,1317,2056,2058,1231,1233,2056,2058,1315,1316,1295,1316,1317,261,10,
10,281,285,285,1316,285,285,2056,2055,2049,2049,2053,2058,285,285,1316,285,285,283,10,
375,376,1462,1463,1463,1463,1464,2056,2058,1231,1233,2056,2058,1462,1463,1463,1464,376,377,10,
395,1462,1484,1484,1484,1484,1485,2056,2058,1231,1233,2056,2058,1483,1484,1484,1484,1485,395,10,
417,1504,1505,1484,1484,1484,1485,2056,2058,1231,1233,2056,2058,1483,1484,1484,1506,375,417,10,
2049,2049,2050,1504,1505,1505,1506,2056,2058,1231,1233,2056,2058,1483,1484,1485,375,400,10,10,
2057,2057,2055,2049,2049,2049,2049,2053,2055,2049,1233,2056,2058,1483,1484,1485,415,419,377,10,
2057,2057,2057,2057,2058,1462,1464,2056,2058,1231,1233,2056,2058,1483,1484,1484,1463,1464,415,376
</data>
</layer>
<layer name="Sprites" width="20" height="15">
<data encoding="csv">
0,0,0,0,0,0,2201,0,2200,0,0,2200,0,2201,0,0,0,0,0,0,
0,0,2147486722,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,2147486897,0,0,2920,2924,2916,2913,0,0,3251,0,0,0,0,0,
0,0,2106,2200,0,0,0,2920,2922,2147486713,3040,2924,2925,0,0,0,2200,2104,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,2105,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2105,0,
0,0,0,0,0,0,0,0,0,2147486282,0,0,0,0,0,0,3114,0,0,0,
0,0,0,2147486746,0,0,0,0,0,0,2633,0,0,0,0,0,0,0,0,0,
0,0,0,2200,3321,2200,0,0,0,2512,2512,0,0,0,2200,3321,2200,0,0,0,
0,0,2943,2318,0,0,2655,0,0,0,0,0,0,0,2319,0,2147485975,0,0,0,
0,2655,0,2276,2273,2282,0,0,0,0,0,0,0,0,3106,0,0,2147486303,0,0,
0,2930,0,2147486177,0,0,0,0,0,0,2467,0,0,0,0,2655,0,0,0,0,
0,0,0,0,2147486179,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,2147486842,0,0,0,0,0,0,0,0,0,0,0,0,2147486303,2147486201,0,0,0,0,
0,0,0,0,0,2147486303,0,0,0,0,0,0,0,2318,0,0,2147486202,2553,0,0
</data>
</layer>
</map>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 B

View File

@ -1,7 +0,0 @@
The image files contained in this folder are created by Linus Probert (author
of BreakHack).
They are either modifications of the DanwLike tileset or completely original
content. Feel free to use them as you please. The images that are combined
from DawnLike assets should be handled under the same licensing rights as the
original works. The others are completely unencumbered.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,29 +0,0 @@
cmake_minimum_required(VERSION 3.1)
project(bh_random CXX)
add_definitions(-std=c++11)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()
add_library(bh_random STATIC
src/bh_random.cpp
)
IF ( MSVC )
MESSAGE ( STATUS "Setting MSVC MT switches")
string (REPLACE
"/MDd"
"/MTd"
CMAKE_C_FLAGS_DEBUG
${CMAKE_C_FLAGS_DEBUG}
)
string (REPLACE
"/MDd"
"/MTd"
CMAKE_C_FLAGS_RELEASE
${CMAKE_C_FLAGS_RELEASE}
)
endif ()

View File

@ -1,51 +0,0 @@
/*
* BreakHack - A dungeone crawler RPG
* Copyright (C) 2018 Linus Probert <linus.probert@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <random>
#include <climits>
extern "C" {
#include "bh_random.h"
}
static std::mt19937 generator;
static std::mt19937 map_generator;
extern "C" void
bh_srand(unsigned int seed)
{
generator.seed(seed);
}
extern "C" unsigned int
bh_rand(void)
{
return generator();
}
extern "C" void
bh_map_srand(unsigned int seed)
{
map_generator.seed(seed);
}
extern "C" unsigned int
bh_map_rand(void)
{
return map_generator();
}

View File

@ -1,31 +0,0 @@
/*
* BreakHack - A dungeone crawler RPG
* Copyright (C) 2018 Linus Probert <linus.probert@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
void
bh_srand(unsigned int);
unsigned int
bh_rand(void);
void
bh_map_srand(unsigned int);
unsigned int
bh_map_rand(void);

View File

@ -64,14 +64,6 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(SDL2_ARCH_64 TRUE)
set(SDL2_PROCESSOR_ARCH "x64")
else()
set(SDL2_ARCH_64 FALSE)
set(SDL2_PROCESSOR_ARCH "x86")
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(SDL2_SEARCH_PATHS
~/Library/Frameworks
/Library/Frameworks
@ -95,7 +87,7 @@ FIND_LIBRARY(SDL2_LIBRARY_TEMP
NAMES SDL2
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib lib/${SDL2_PROCESSOR_ARCH}
PATH_SUFFIXES lib64 lib
PATHS ${SDL2_SEARCH_PATHS} ${SDL2_INCLUDE_DIR}/../..
)
@ -109,7 +101,7 @@ IF(NOT SDL2_BUILDING_LIBRARY)
NAMES SDL2main
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib lib/${SDL2_PROCESSOR_ARCH}
PATH_SUFFIXES lib64 lib
PATHS ${SDL2_SEARCH_PATHS}
)
ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")

View File

@ -28,14 +28,6 @@
# See the License for more information.
#=============================================================================
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(SDL2_ARCH_64 TRUE)
set(SDL2_PROCESSOR_ARCH "x64")
else()
set(SDL2_ARCH_64 FALSE)
set(SDL2_PROCESSOR_ARCH "x86")
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
if(NOT SDL2_TTF_INCLUDE_DIR AND SDL2TTF_INCLUDE_DIR)
set(SDL2_TTF_INCLUDE_DIR ${SDL2TTF_INCLUDE_DIR} CACHE PATH "directory cache
entry initialized from old variable name")
@ -56,7 +48,7 @@ find_library(SDL2_TTF_LIBRARY
HINTS
ENV SDLTTFDIR
ENV SDLDIR
PATH_SUFFIXES lib lib/${SDL2_PROCESSOR_ARCH}
PATH_SUFFIXES lib
)
if(SDL2_TTF_INCLUDE_DIR AND EXISTS "${SDL2_TTF_INCLUDE_DIR}/SDL_ttf.h")

View File

@ -1,4 +0,0 @@
#!/bin/sh
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./
exec ./breakhack

View File

@ -1,20 +0,0 @@
f5a88fc Introduces texture blending
52913af Completes #42 Add boss 2 & 3
449cc36 Fixes some minor buggs
f67aab0 Completes #43 Add win state
8c261fd Added the undead monsters for level > 10
6326a64 Begins #42 Add boss 2 & 3
f1b0045 Introduces the "orc levels"
ffe1736 Minor buggfixes and typos
8bf9329 Version bump and badges
8c25693 Moves sqlite3 files to separate dir
bec9eb4 Fixed a typo in skill tooltip
43f021a Created an FPS counter for debug mode
dbc36aa Fixes #41, Minimap
c390c02 Fixes #40, Prevent adjecant traps before lvl 4
9ef97c0 Fixes #38, Artifact inventory
358c0c7 Fixes #37 and #39 Adds tooltips to everything
5f754d5 Merge branch 'master' into dev
30058ea Creates gui_util and moves some code out from gui.c
854f2c0 Prevent levels > 10 from crashing the game.
549f47a Minor code fixes and a slight tweak to the blue color

View File

@ -1,22 +0,0 @@
69e5ff9 Fixes #35
b4a6c4b Fixes some render layer issues
4ba3017 Fixes: #30
62d1bbd Completes #31 Adds chests to game
1c7631c Starts #31 Items: Chests
83aa929 Don't open menu immidiately upon death.
5e3815a Fixes: #34 hopefully
71c1279 Completes #2 artifacts
8dd774b Continues #2 Completed impl of INCREASED_STUN
ba1d09a Continues #2 completed impl of DAGGER_RECOVERY
19e7583 Continues #2 FEAR_INDUCING impl
0aacdd2 Continues #2 Adds PUSH_BACK impl
ac7dada Fixes #23 possibly
a04f131 Continues #2: Adds charge skill impl
736eb79 Continues #2: Artifacts
095c93e Began #2: Added artifacts and the PIERCING_DAGGERS modifier
611d8ef Fixes a minor bug in the guerilla behaviour
aaa8e8c Makes stunned enemies "wobble" instead of having an indicator.
ffde079 Fixes: #4 Room stuff: Traps
a3c3c63 Adds the bash sound effect
41a9021 Fixes a bunch of msvc warnings
3720eb1 Minor READM change

View File

@ -1,2 +0,0 @@
3f1cdf8 Fixes: #5 Creates a creditscreen
2a80434 Adds posibility for daggers hitting walls to be recoverable.

View File

@ -1,4 +0,0 @@
369cfda Completes #33 Create score screen
2544172 Began #33 Create score screen
7739ac5 Merge branch 'dev'
ffd777e Buggfixes

View File

@ -1,8 +0,0 @@
9a610d5 Adds window icon
6af8d9d Completes #8 First boss
915ea59 Fixes a mistake in music loading.
6cc96a9 Begins #8 First boss
1a09328 Adds boss music and an additional attribution line per request.
6633db7 Adds room objects and FIRE rooms.
0b58e53 Removed "Examples" folder from assets
292f549 Minor compiler warning fix

View File

@ -1,8 +0,0 @@
769a659 Patch version raised to 5
0fcc1d2 Last time now
60750d7 Patch version raised to 5
a551c52 More trickery
fa0dbe2 Fixes miss in release script
beb2e79 Patch version raised to 5
7f09fbd Fiddled some more with release script
d4f2514 Patch version raised to 5

View File

@ -1,4 +0,0 @@
998501a Patch version raised to 6
2813a57 Separate player movement from input event loop.
c4dc838 Monsters now indicate their state with speech bubbles
f049d66 Fixed releasenotes and script again

View File

@ -1,18 +0,0 @@
f36a9dd Sleeping state indicator is always visible.
53dc7e2 Possibly more accurate scaling.
dff55a1 Fixes some buggs
6a9a3bd Removed some old debug output from pitlayouts.
cc229c8 Prepares pengine for more particle types.
bbe4526 Fixes colors to use defines.
2462e4c Adds sentinel monster behaviour.
a66f16d Reintroduces the pointer and mouse menu operation.
123ae90 Better mod key logic in input and mouse motion check.
821cac2 Completely separates input handling and game logic.
186cc7b Replaced state logic with behaviours instead.
b905232 ....and once again...
8573bad ...and include the SDL dll
8c58c6e And once again for windows!
6788e3c Another trywq
60114ed Hopefully fixes the build issues
e222e51 Don't test on clang and fix include problem in appveyor
138cba1 Mock test for keyboardinput and fixed the found issues

View File

@ -1,23 +0,0 @@
56af37e Removing natural lighting debug.
c16caf3 Comments out unused function
353b4ed Adds raycasting debug
68cf24d Dropps the particle line slash effect.
2aee360 Merge branch 'master' into dev
1491dfb Minor dev-env change
1124e88 Minor fixes
4819eda Adds "NEW GAME" menu option to game over menu
4612cab Adds sword animation to flurry
b9a4a80 Fixes: #27 Suspicious code: sign conversion
58e9c7e Fixes: #21 Complex method issue in monster.c
b12e5d4 Fixes: #26 Dagger kills should now give XP
b3b8208 Adds complete rewrite of lua scripts
18e7022 Restructured main game loop a bit. Reduced function size
252955b Removes "resume" option from menu when game over.
988d6c5 Implemented the sword swing effect.
79b0869 Adds sword swing effect that isn't horrible
c96d0b6 Removes bug that made it possible to move with daggers in air.
c6b6438 Added codefactor badge and fixed blank line issue.
be42981 Fixed errors and adapted to new vim 8.1
60052af Merge branch 'master' into dev
4684e04 Minor cleaning of lua scripts
ec67221 Adds an idea for slash animations that didn't look very good.

View File

@ -1,3 +0,0 @@
484fb30 Changes the log to fill from the bottom
d8615b2 Changes stun icon and fixes some syntax reports from codacy
9fe2ede Fixes: #29 and #17 New skill: bash

View File

@ -1,5 +0,0 @@
6811c42 Patch version raised to
e796fff Prepare release script for real versions
ae44d5c Adds minimal Steam fiddling protection
6e3343a License stuff and README updates
899d2e5 Update to build env

View File

@ -1,8 +0,0 @@
0730eb4 Disable text input since this is on by default in SDL2.0
7333d3d Update issue templates
70cc79f Merge pull request #47 from Oliveshark/add-code-of-conduct-1
bdbb10b Create CODE_OF_CONDUCT.md
75660a5 Update to readme.
5d1490b Another README badge fix
aefbd95 Update readme to match new github url
90603b4 Fix what my bad build script broke

View File

@ -1,93 +0,0 @@
cb6bd03 Patch version raised to 2
b0f2936 Removes beta release type
76c2f90 Fixes a compiler warning and arcade mode coverage
8233841 Adds burst sound to eldritch blast
c2eae7a Adds arcade game leaderboard
f53703d Introduces arcade mode
0f66b0f Adds the game type select menu
7005239 Fixed commit msg in version script
7991e7c Fixes COMPLETED state for quick games
aea9995 Reduved stun from trip skill
a38a21a Incorporates quickplay leaderboard
deb4638 Fixes a bad help text
120f8d7 Some tweaks to the rogue character
5985c3e Fixed a bad pointer reset
9968b37 Fixes another memory leak
7e71fcc Build updates
dd77f29 Fixes a typo
51d7b67 Completed the QUICK_GAME mode
97c95da Adds lua support for quick mode
f895fdb Add a title to char select menu.
1a0d806 Introduces menu option descriptions
f5a1c2f Removes a memory leak
d2fe3fc Fixes a codacy warning
bcdc9c1 Update README.md
8d09e8a Adds the new steam achievement and leaderboards
d034a69 Finnished up with the rogue
94ec8cf Removed bad options in .clang_complete
669a2fb Merge branch 'master' into dev
feed0e2 Completes crumbling rooms.
6e6f28d Prevent tiles with chests from falling.
fd8799f Prevent tiles with objects on them from falling.
ee56143 Initial implementation of the falling tiles room modifier.
f65bdd0 Add license header to gamecontroller files
a803578 Fixes a gcc warning
8792504 Adds the backstab skill icon
da3ff1a Small thumbstick tweak
850aae3 Adds controller haptics
423ff73 Fixes a leak and begins restructure of controller code
2e0a88e Switches the old MapTile texture system to use sprites instead
53151b6 Adds the phase skill icon
e6b5b76 Includes attempt to determine if PS3 controller aswell as PS4
894e3ba Merge branch 'master' into dev
c8900e8 Controller button rendering based on controller type
06d2da1 Controllers are working
3143236 Completely untested controller mappings.
bb7f9ef A beginning to controller support
2919ebf Adds controller button support for skillbar
c3b2b6f Fixed a typo and made controller layout toggleable.
e526c03 Completed the button implementation for the help tooltips
e845195 Got this texture stuff working
0723f62 New approach where we render button textures in tooltips.
a162646 More font modifications
60374c9 Font updates
2b02ae5 An attempt to group files in msvc
a4cb234 Re-aligned the credits file
e59f04b Merge branch 'dev' into feature/phase-skill
2d25e42 Merge branch 'master' into dev
c7c5346 Completes testing of phase and fixes some errors
97ad1dd Introduced the phase artifact
0dcb658 Merge branch 'dev' into feature/phase-skill
9610609 Attempt to bring the mouse menu click back
ee5ed14 Implementd the skill. Still not tested.
b4fd2cb Added the phase tooltip.
742d6e2 Untested phase code. Needs more work
35c3be4 Removed a type warning
3bbe917 Merge branch 'master' into dev
c97688a Incorporate artifacts in rogue skills
47082da Build env changes
3301437 Tuned the backstab skill slightly
743e4a3 Implemented the backstab skill
81ccf8a Fixed a windy room issue
083834d Maint: Remove CI compiler warnings
dc6b816 Add slash animation to trip skill
87b2b9d Fix pits added to room
5648be4 Merge branch 'master' into dev
5d5170c Version bump for future release
583a7d0 Fixes some minor bugs caused by coding without testing
60359d8 Untested implementation of the TRIP skill
dbf9fe3 Maint: Removed duplicate code
0fc1fed Maint: Clean up monster.c
e1b3364 Maint: Even more cleanup
620a7e3 Maint: Less complex main
983875d Maint: Cleaned up a complex function
e293c21 Rogue preparation
0ca70c7 Add the dagger skill to the rogue
c39f05d Fixed the player menu
02a4407 Got a bit further
f246c57 Broken commit
367be69 Buggfix: Prevent clip switching on falling sprite
988b53a Outline the rogue skillset
03b60f6 Merge branch 'master' into dev
5043a86 Cleaned up main a bit and moved some code
cb732a8 Adds possibility to push monsters into pits and traps.

View File

@ -1,2 +0,0 @@
8ab527c Makes monsters fall when the tile they are on falls
8e39ff8 Fix releasenotes for v2.0.2

View File

@ -1,3 +0,0 @@
4d01251 Merge branch 'master' into dev
9299087 Updates PhysicsFS to latest stable-3.0
cb2510c Rename physfs folder

View File

@ -1,16 +0,0 @@
ee4dd27 Patch version raised to 1
5ee20c9 Shifted to safer time functions and utc time
563ebf9 Adds another build fix
3533d5c Fixes build again
97b097a Fixes builds
685bf97 Makes the custom random generator deterministic across platforms
cc375bb Implements control over lua random numbers
1205856 Attempt att syncing random generation
d1efa84 Create new leaderboards with attribute 'Descending'
2775780 Makes weekly leaderboards creatable from app.
269b25b Removes a mingw warning
72c3817 Adds weekly challenge seed play and leaderboard saving
1212b1a Weekly challenge option added to play menu
ce2a348 Generate seeds from the core seed so that levels will look different.
bc9d37e Connects the random seed through all the generators
3c7dcb5 Begins new random impl

View File

@ -1,9 +0,0 @@
a03aec7 Handles the second mingw special case which I kept forgetting.
0de018f Fix mingw preprocessor define from cmake
3eeb4d0 Include mingw32 64bit in the exclusion
5f369da Fixed preprocessor command for mingw
c98e6e6 Fix wonky mingw errors in appveyor
499f015 Only use gmtime_s for MSVC
9b9a0ca Fixed bad include
926054b Ensure that we have seed when making a map
49b7ebb Include patch notes for v2.2.1

View File

@ -1,4 +0,0 @@
e455523 Update README.md
791dd7e Removes cppcheck warning
b08ef10 Code maintenance and cleanup
fffcac1 Makes sure til effects and items apply after backstab

View File

@ -1 +0,0 @@
c3464eb Fixes a typo

View File

@ -1,60 +0,0 @@
c4811ed Fixes checksumtool output again
eceb241 Removes useless text from checksumtool output
cea891f Move checksum configuration to CMakeLists.txt and config.h
8e28230 Fixes release notes
53703f1 Patch version raised to 1
ce182ad Updates checksums
ebfe271 Fixes compile error and some graphical issues
2ae6ada Completes locked room generation
18987e2 Incomplete monster key fixes
59a1e81 Implementation of keys. Completely untested
1065216 Include all files in pack files
68533f0 Remove memory leaks from map destruction
38dc3de Merge branch 'dev' of github.com:liquidityc/breakhack into dev
beda4f6 Reduces fairy frequency
e50d40f Adds doors and greater chance of walls
0983bd1 Fixes a weird issue with missing code
184b42f Fixes door logic
e42e024 Adds some door logic
756afba Separates walls from regular tiles
40a20e9 Adapts fopen/fopen_s to WIN32/GCC compile
af930f6 Fixes win compiler warnings
c4fd16d Updated dll checksums for windows build
f840b28 Adds mediocre crack protection
7fbeaa3 Introduced base structure for doors in maps
3e43c30 Adds funny casting to avoid pedantic ISO C warning
fd3a625 Adds monster bloodlust
d749861 Make jumbled rooms more likely
7ab5ece Nicer wall decorations on interior walls
8c9622d Shopkeeper now has bodyguards next time you meet after kiling him
af0c616 Adds juice
46fbdc1 Fixed jumble layout logic
b40c54a Layouts can now be jumbled with each other
8f20f36 Lighting on wall layouts and aggro shopkeepers
3ba33d8 Adds light tiles to layout files and a shopkeeper
447c1a7 Monster shopkeeper logic
7e1dffb Shops implemented
6009aa1 Merge branch 'dev' into shops
9b4a7b6 Removes crazy old bug that never presented itself before
63812fb More wall layouts and cordinated walls
c6a022e Moved text sprite logic to sprite_util
06ca6c3 Not finnished yet, commit
bab5fd7 Merge branch 'dev' into shops
68f4409 Add amt sprite to all items where value != 0
959fae1 Add value sprite to items.
ca41520 Wall layouts added to regular build
88f4703 Some more fence layouts
486c1bb Merge branch 'dev' into shops
206f95f Fences and walls in layout files
1c4e600 Wall layout data
57a1688 Merge branch 'dev' into shops
13ca11c Begins refactoring of layout parser to accomodate more layout details
33efba8 Merge branch 'dev' into shops
5d61a91 Split pit layout logic into separate file
6542e4f Moves item update to its own function
7b47c6a Completes buyable items
16d9035 Merge branch 'dev' into shops
4054c37 Ignore vscode_build dir
ad227f1 A start to "priced" items
37ba189 Suppress cppcheck issues
645a02c Ignore .vscode folder

View File

@ -1,6 +0,0 @@
c2b8fd4 Adds key pickup SFX
7a59d15 Don't add walls to crumbling rooms before lvl 4
c9fde8d Updated releasenotes
c4811ed Fixes checksumtool output again
eceb241 Removes useless text from checksumtool output
cea891f Move checksum configuration to CMakeLists.txt and config.h

View File

@ -1,40 +0,0 @@
392edd8 Updates blink tooltip to include item pickups.
6584981 remove unnecessary pickup
d2cf797 Mage blink skill pickup items in the path #60
78e9413 Fix : Missing with vampiric blow doesn't seem to trigger a 'Dodge' action text #59
af957eb Disables mouse square rendering for all classes
1d988d7 Fixes working explosions and artifacts
68f4e15 Fixes returning daggers and resets erupt attack
7f232be A beginning to the new exploding artifacts
12aff9a Fixes erupt so it has a base push of 1
2dc25c9 Adds the DAGGER_MAGNET artifact
5e67ca7 Removes stun from backstab skill
cac3fea Altered the vampiric blow icon slightly
9ed80ac Removes erupt test code
05cbce0 Adds vampiric blow icon
6c135c6 Adds gui display for held keys
fb031e2 Bumps version
b861e6e Fixes SENTINEL monsters from ignoring forced fear
046551a Changes ERUPT to cause fear instead of bleeding
8fb1bbc Fixes bug with erupt pushing direction
35164a9 Introduces vampiric blow
dd3e84d Makes critical hits cause bleeding
8f21e8b Prevents skill radius from impacting push back range
2b74316 Updates erupt tooltip to mention push back
7ddaab8 Make erupt always push back 1 tile without any artifacts
43ca8f4 Fixes #58 - Game crash with AOE attacks
ef5cd4e Adds PUSH_BACK and SKILL_RADIUS effects to erupt skill
b00e607 Start with debug gold
67e29d6 Added the SKILL_RADIUS artifact (not used yet)
81e7df1 Adds skill icons for the two mage skills
18effa2 Rogue backstab skill now triggers bleeding as well
c043ad0 Implements the erupt skill
223a3b0 Implements the blink skill
2ca78e2 Adds monster bleed damage every turn
0476d4d Introduces particle emitters on monsters
826cbe1 A quick start to the Mage
fcc6527 Minor fix
b409b76 Improved build instruction structure
b075390 React to PR feedback
86e6f66 Adds Windows compilation instructions
c0a4a4e Make ninja builds smoother

View File

@ -1,2 +0,0 @@
6d323ca Adds steam achievements and LB for the Mage class
9aefed0 Adds an dev env setup script

View File

@ -1 +0,0 @@
4edeb17 Fixes cross save problems due to architecture differences

View File

@ -1 +0,0 @@
e636ec1 Don't delete saves from other architectures on death

View File

@ -1,24 +0,0 @@
#!/bin/sh
# Get the current patch version
MAJOR_VERSION=$(egrep -o 'breakhack_MAJOR_VERSION [0-9]+' CMakeLists.txt | awk '{print $2}')
MINOR_VERSION=$(egrep -o 'breakhack_MINOR_VERSION [0-9]+' CMakeLists.txt | awk '{print $2}')
LAST_PATCH_VERSION=$(egrep -o 'breakhack_PATCH_VERSION [0-9]+' CMakeLists.txt | awk '{print $2}')
NEXT_PATCH_VERSION=$((LAST_PATCH_VERSION + 1))
LAST_TAG=v$MAJOR_VERSION.$MINOR_VERSION.$LAST_PATCH_VERSION
NEXT_TAG=v$MAJOR_VERSION.$MINOR_VERSION.$NEXT_PATCH_VERSION
# Update the version and create release notes
sed -i -e "s/breakhack_PATCH_VERSION [0-9]\+/breakhack_PATCH_VERSION $NEXT_PATCH_VERSION/" CMakeLists.txt
git log --oneline $LAST_TAG..HEAD > build/releasenotes/$NEXT_TAG.txt
git add build/releasenotes/$NEXT_TAG.txt
git commit -a -m"Patch version raised to $NEXT_PATCH_VERSION"
# Create the tag
git tag $NEXT_TAG
# Push to repo
git push
git push origin $NEXT_TAG

View File

@ -1,12 +0,0 @@
#!/bin/sh
mkdir -p _build/debug
mkdir -p _build/release
cd _build/debug
cmake -DCMAKE_BUILD_TYPE=Debug ../..
cd -
cd _build/release
cmake -DCMAKE_BUILD_TYPE=Release ../..
cd -

View File

@ -1,33 +0,0 @@
cmake_minimum_required(VERSION 3.1)
project(checksum C)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()
add_executable(checksumtool
src/checksum.c
)
target_compile_definitions(checksumtool PUBLIC EXECUTABLE=1)
add_library(checksum
src/checksum.c
)
IF ( MSVC )
MESSAGE ( STATUS "Setting MSVC MT switches")
string (REPLACE
"/MDd"
"/MTd"
CMAKE_C_FLAGS_DEBUG
${CMAKE_C_FLAGS_DEBUG}
)
string (REPLACE
"/MDd"
"/MTd"
CMAKE_C_FLAGS_RELEASE
${CMAKE_C_FLAGS_RELEASE}
)
endif ()

View File

@ -1,61 +0,0 @@
/*
** CHECKSUM.C - Compute the checksum of a file
**
** public somain demo by Bob Stout
*/
#include <stdlib.h>
#include "checksum.h"
unsigned
checksum(void *buffer, size_t len, unsigned int seed)
{
unsigned char *buf = (unsigned char *)buffer;
size_t i;
for (i = 0; i < len; ++i)
seed += (unsigned int)(*buf++);
return seed;
}
unsigned
checksum_fp(FILE *fp)
{
unsigned int seed = 0;
char buf[4096];
size_t len;
do {
len = fread(buf, sizeof(char), sizeof(buf), fp);
seed = checksum(buf, len, seed);
} while (len > 0);
return seed;
}
#ifdef EXECUTABLE
#include <stdio.h>
int main(int argc, char *argv[])
{
FILE *fp;
const char *file;
if (argc < 2) {
printf("You need to provide an input file\n");
printf("Example: %s <file>", argv[0]);
}
file = argv[1];
if (NULL == (fp = fopen(file, "rb")))
{
printf("Unable to open %s for reading\n", file);
return -1;
}
printf("%#x\n", checksum_fp(fp));
return 0;
}
#endif

View File

@ -1,27 +0,0 @@
/*
* BreakHack - A dungeone crawler RPG
* Copyright (C) 2018 Linus Probert <linus.probert@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stdio.h>
unsigned
checksum(void *buffer, size_t len, unsigned int seed);
unsigned
checksum_fp(FILE *fp);

View File

@ -1,63 +0,0 @@
local room_builder = require "maproombuilder"
local module = {}
local random = map_random
local textures = {
"Items/Chest0.png",
"Items/Chest1.png"
}
local chests = {}
for i=0,1 do
table.insert(chests, {
textures[1],
textures[2],
0,
i * 16
});
table.insert(chests, {
textures[1],
textures[2],
16,
i * 16
});
end
local function repack(data)
return {
texturePath1 = data[1],
texturePath2 = data[2],
clipX = data[3],
clipY = data[4]
}
end
function module.add_chests_to_room(room)
if room.type == "coridoor" then
return
end
local count = random(3) - 1
local i = 0
while i < count do
local rx = random(13) + 1
local ry = random(9) + 1
if room_builder.is_tile_avilable(room, rx, ry) then
room.chests[rx][ry] = chests[random(#chests)]
i = i + 1
end
end
end
function module.load_chests(map, chests)
for i=0,15 do
for j=0,11 do
chest = chests[i][j]
if chest then
add_chest(map, i, j, CURRENT_LEVEL, repack(chest))
end
end
end
end
return module

View File

@ -1,406 +0,0 @@
local random = map_random
local pits = {}
local walls = {}
local fences = {}
local lights = {}
local doors = {}
local walldecor = {}
local chest
local function readLayoutFile(file)
local layoutfile = read_file(file)
local cleanData = ""
for i=1, #layoutfile do
local c = layoutfile:sub(i+1, i+1)
if c ~= " " and c ~= "\n" and c ~= "\r" then
cleanData = cleanData .. c
end
end
local matrix = {}
for i=0, #cleanData-1 do
local c = cleanData:sub(i, i)
local col = i % 16
local row = (i - col)/16
local layout = 1 + (row - (row % 12))/12
local row = row % 12
if not matrix[layout] then matrix[layout] = {} end
if not matrix[layout][col] then matrix[layout][col] = {} end
matrix[layout][col][row] = c
end
return matrix;
end
local function has_value(list, char)
for _, value in ipairs(list) do
if value == char then return true end
end
return false
end
local function getTileStateFor(matrix, i, j, c)
local charList
if type(c) == "string" then
charList = { c }
else
charList = c
end
local above = has_value(charList, matrix[i][j-1])
local below = has_value(charList, matrix[i][j+1])
local left = has_value(charList, matrix[i-1][j])
local right = has_value(charList, matrix[i+1][j])
local above_left = has_value(charList, matrix[i-1][j-1])
local above_right = has_value(charList, matrix[i+1][j-1])
local below_left = has_value(charList, matrix[i-1][j+1])
local below_right = has_value(charList, matrix[i+1][j+1])
return above, below, left, right, above_left, above_right, below_left, below_right
end
local function getRandomWallDecorFrom(wallDecorations)
return wallDecorations[random(#wallDecorations)]
end
local function setBlockTile(room, matrix, i, j, tiles, char, decor)
local above, below, left, right, above_left, above_right, below_left, below_right = getTileStateFor(matrix, i, j, char);
room.decor[i][j] = nil
local tile = nil
local decorTile = nil
if above and below and left and right then
tile = tiles.cross
elseif not above and below and left and right then
tile = tiles.top_t
elseif not below and above and left and right then
tile = tiles.bottom_t
decorTile = getRandomWallDecorFrom(walldecor.bottom_t)
elseif not left and above and below and right then
tile = tiles.left_t
decorTile = getRandomWallDecorFrom(walldecor.left_t)
elseif not right and above and below and left then
tile = tiles.right_t
decorTile = getRandomWallDecorFrom(walldecor.right_t)
elseif not above and not left and right and below then
tile = tiles.topleft
decorTile = getRandomWallDecorFrom(walldecor.topleft)
elseif not above and not right and left and below then
tile = tiles.topright
decorTile = getRandomWallDecorFrom(walldecor.topright)
elseif not below and not left and above and right then
tile = tiles.bottomleft
decorTile = getRandomWallDecorFrom(walldecor.bottomleft)
elseif not below and not right and above and left then
tile = tiles.bottomright
decorTile = getRandomWallDecorFrom(walldecor.bottomright)
elseif not left and not right and below then
tile = tiles.left
decorTile = getRandomWallDecorFrom(walldecor.left)
elseif not above and not below and (left or right) then
tile = tiles.top
decorTile = getRandomWallDecorFrom(walldecor.top)
else
tile = tiles.single
decorTile = getRandomWallDecorFrom(walldecor.single)
end
room.walls[i][j] = tile
if random(8) == 1 and decor then
room.decor[i][j] = decorTile
end
end
local function setPitTile(room, matrix, i, j)
local above, below, left, right, above_left, above_right, below_left, below_right = getTileStateFor(matrix, i, j, "p");
room.decor[i][j] = nil
if not above_left and not above_right and left and right and above then
room.tiles[i][j] = pits.innermid
elseif not above_left and left and above then
room.tiles[i][j] = pits.innerleft
elseif not above_right and right and above then
room.tiles[i][j] = pits.innerright
elseif not left and not above and not right then
room.tiles[i][j] = pits.topcrevice
elseif not left and not right then
room.tiles[i][j] = pits.bottomcrevice
elseif not left and not above then
room.tiles[i][j] = pits.topleft
elseif not right and not above then
room.tiles[i][j] = pits.topright
elseif not left then
room.tiles[i][j] = pits.left
elseif not right then
room.tiles[i][j] = pits.right
elseif not above then
room.tiles[i][j] = pits.top
else
room.tiles[i][j] = pits.center
end
end
local function getDoor(matrix, i, j, topDoor, leftDoor)
local above, below, left, right, above_left, above_right, below_left, below_right = getTileStateFor(matrix, i, j, { "#", "\"", "/"});
if above and below then
return leftDoor
else
return topDoor
end
end
local module = {}
function module.load_textures(map, wall_xoffset, wall_yoffset)
local t_pit0 = add_texture(map, "Objects/Pit0.png")
local t_pit1 = add_texture(map, "Objects/Pit1.png")
local t_wall = add_texture(map, "Objects/Wall.png")
local t_fence = add_texture(map, "Objects/Fence.png")
local t_decor0 = add_texture(map, "Objects/Decor0.png")
local t_decor1 = add_texture(map, "Objects/Decor1.png")
local t_door0 = add_texture(map, "Objects/Door0.png")
local t_door1 = add_texture(map, "Objects/Door1.png")
local yo = (random(5) + random(3)) * (16 * 2)
pits = {
center = { t_pit0, t_pit1, 16, yo + 16, false, false, false, true },
top = { t_pit0, t_pit1, 16, yo, false, false, false, true },
left = { t_pit0, t_pit1, 0, yo + 16, false, false, false, true },
right = { t_pit0, t_pit1, 32, yo + 16, false, false, false, true },
topleft = { t_pit0, t_pit1, 0, yo, false, false, false, true },
topright = { t_pit0, t_pit1, 32, yo, false, false, false, true },
innerleft = { t_pit0, t_pit1, 80, yo, false, false, false, true },
innermid = { t_pit0, t_pit1, 96, yo, false, false, false, true },
innerright = { t_pit0, t_pit1, 112, yo, false, false, false, true },
topcrevice = { t_pit0, t_pit1, 64, yo, false, false, false, true },
bottomcrevice = { t_pit0, t_pit1, 64, yo + 16, false, false, false, true },
}
local xo = wall_xoffset
yo = wall_yoffset
walls = {
topleft = { t_wall, nil, xo + 0, yo, true },
top = { t_wall, nil, xo + 16, yo, true },
single = { t_wall, nil, xo + 16, yo + 16, true },
topright = { t_wall, nil, xo + 32, yo, true },
left = { t_wall, nil, xo + 0, yo + 16, true },
bottomleft = { t_wall, nil, xo + 0, yo + 32, true },
bottomright = { t_wall, nil, xo + 32, yo + 32, true },
center = { t_wall, nil, xo + 48, yo, true },
top_t = { t_wall, nil, xo + 64, yo, true },
left_t = { t_wall, nil, xo + 48, yo + 16, true },
cross = { t_wall, nil, xo + 64, yo + 16, true },
right_t = { t_wall, nil, xo + 80, yo + 16, true },
bottom_t = { t_wall, nil, xo + 64, yo + 32, true },
}
yo = 48 * random(3)
fences = {
topleft = { t_fence, nil, 0, yo, true },
top = { t_fence, nil, 16, yo, true },
single = { t_fence, nil, 0, yo + 16, true },
topright = { t_fence, nil, 32, yo, true },
left = { t_fence, nil, 0, yo + 16, true },
bottomleft = { t_fence, nil, 0, yo + 32, true },
bottomright = { t_fence, nil, 32, yo + 32, true },
center = { t_fence, nil, 48, yo, true },
top_t = { t_fence, nil, 64, yo, true },
left_t = { t_fence, nil, 48, yo + 16, true },
cross = { t_fence, nil, 64, yo + 16, true },
right_t = { t_fence, nil, 80, yo + 16, true },
bottom_t = { t_fence, nil, 64, yo + 32, true },
}
doors = {
door_top_nolock = { t_door0, t_door1, 0, 0, true },
door_left_nolock = { t_door0, t_door1, 16, 0, true },
door_top_silverlock = { t_door0, t_door1, 32, 0, true, false, false, false, 1 },
door_left_silverlock = { t_door0, t_door1, 48, 0, true, false, false, false, 1 },
door_top_goldlock = { t_door0, t_door1, 64, 0, true, false, false, false, 2 },
door_left_goldlock = { t_door0, t_door1, 80, 0, true, false, false, false, 2 },
gate_top_nolock = { t_door0, t_door1, 0, 32, true },
gate_left_nolock = { t_door0, t_door1, 16, 32, true },
gate_top_silverlock = { t_door0, t_door1, 32, 32, true, false, false, false, 1 },
gate_left_silverlock = { t_door0, t_door1, 48, 32, true, false, false, false, 1 },
gate_top_goldlock = { t_door0, t_door1, 64, 32, true, false, false, false, 2 },
gate_left_goldlock = { t_door0, t_door1, 80, 32, true, false, false, false, 2 },
}
lights = {
candle0 = { t_decor0, t_decor1, 3 * 16, 8 * 16, true, true },
candle1 = { t_decor0, t_decor1, 1 * 16, 8 * 16, true, true },
candle2 = { t_decor0, t_decor1, 5 * 16, 8 * 16, true, false },
}
walldecor = {
topleft = {
{ t_decor0, nil, 2 * 16, 2 * 16, false },
{ t_decor0, nil, 6 * 16, 2 * 16, false },
{ t_decor0, nil, 7 * 16, 2 * 16, false },
},
top = {
{ t_decor0, nil, 0 * 16, 2 * 16, false },
{ t_decor0, nil, 1 * 16, 2 * 16, false },
{ t_decor0, nil, 4 * 16, 2 * 16, false },
{ t_decor0, nil, 5 * 16, 2 * 16, false },
},
single = {
{ t_decor0, nil, 0 * 16, 2 * 16, false },
{ t_decor0, nil, 1 * 16, 2 * 16, false },
{ t_decor0, nil, 4 * 16, 2 * 16, false },
{ t_decor0, nil, 5 * 16, 2 * 16, false },
},
topright = {
{ t_decor0, nil, 3 * 16, 2 * 16, false },
},
left = {
{ t_decor0, nil, 2 * 16, 2 * 16, false },
{ t_decor0, nil, 3 * 16, 2 * 16, false },
{ t_decor0, nil, 6 * 16, 2 * 16, false },
{ t_decor0, nil, 7 * 16, 2 * 16, false },
},
bottomleft = {
{ t_decor0, nil, 0 * 16, 2 * 16, false },
{ t_decor0, nil, 1 * 16, 2 * 16, false },
{ t_decor0, nil, 2 * 16, 2 * 16, false },
{ t_decor0, nil, 4 * 16, 2 * 16, false },
{ t_decor0, nil, 5 * 16, 2 * 16, false },
{ t_decor0, nil, 6 * 16, 2 * 16, false },
{ t_decor0, nil, 7 * 16, 2 * 16, false },
},
bottomright = {
{ t_decor0, nil, 0 * 16, 2 * 16, false },
{ t_decor0, nil, 1 * 16, 2 * 16, false },
{ t_decor0, nil, 3 * 16, 2 * 16, false },
{ t_decor0, nil, 4 * 16, 2 * 16, false },
{ t_decor0, nil, 5 * 16, 2 * 16, false },
},
left_t = {
{ t_decor0, nil, 2 * 16, 2 * 16, false },
{ t_decor0, nil, 6 * 16, 2 * 16, false },
{ t_decor0, nil, 7 * 16, 2 * 16, false },
},
right_t = {
{ t_decor0, nil, 3 * 16, 2 * 16, false },
},
bottom_t = {
{ t_decor0, nil, 0 * 16, 2 * 16, false },
{ t_decor0, nil, 1 * 16, 2 * 16, false },
{ t_decor0, nil, 4 * 16, 2 * 16, false },
{ t_decor0, nil, 5 * 16, 2 * 16, false },
},
}
chest = { "Items/Chest0.png", "Items/Chest1.png", 16, 0}
end
function createJumbleLayout(matrix)
local room1 = matrix[random(#matrix)]
local room2 = matrix[random(#matrix)]
local room3 = matrix[random(#matrix)]
local room4 = matrix[random(#matrix)]
local room = {}
for i=0,15 do
for j=0,12 do
if not room[i] then room[i] = {} end
if not room[i][j] then room[i][j] = {} end
if i < 7 then
if j < 6 then
room[i][j] = room1[i][j]
else
room[i][j] = room2[i][j]
end
else
if j < 6 then
room[i][j] = room3[i][j]
else
room[i][j] = room4[i][j]
end
end
end
end
return room
end
function draw_layout_to_room(room, matrix, roomx, roomy)
local wallTypes = {"#", "\"", "/", "d", "g", "S", "G"}
for i=2,13 do
for j=2,10 do
if matrix[i][j] == "p" then
setPitTile(room, matrix, i, j);
elseif matrix[i][j] == "#" then
setBlockTile(room, matrix, i, j, walls, wallTypes, false)
elseif matrix[i][j] == "\"" then
setBlockTile(room, matrix, i, j, walls, wallTypes, false)
room.decor[i][j] = lights.candle1
elseif matrix[i][j] == "/" then
setBlockTile(room, matrix, i, j, walls, wallTypes, false)
if random(2) == 1 then
room.decor[i][j] = lights.candle1
else
room.decor[i][j] = lights.candle2
end
elseif matrix[i][j] == "f" then
setBlockTile(room, matrix, i, j, fences, "f", true)
elseif matrix[i][j] == "a" then
create_shop_artifact(map, (roomx*512) + i*32, (roomy * 384) + j*32)
elseif matrix[i][j] == "l" then
room.decor[i][j] = lights.candle0
elseif matrix[i][j] == "c" then
room.chests[i][j] = chest
elseif matrix[i][j] == "d" then
room.doors[i][j] = getDoor(matrix, i, j, doors.door_top_nolock, doors.door_left_nolock)
elseif matrix[i][j] == "S" then
room.doors[i][j] = getDoor(matrix, i, j, doors.door_top_silverlock, doors.door_left_silverlock)
elseif matrix[i][j] == "G" then
room.doors[i][j] = getDoor(matrix, i, j, doors.door_top_goldlock, doors.door_left_goldlock)
elseif matrix[i][j] == "g" then
room.doors[i][j] = getDoor(matrix, i, j, doors.gate_top_nolock, doors.gate_left_nolock)
end
end
end
end
function pickALayout(matrix)
-- Chose a random layout
if random(3) == 1 then
return matrix[random(#matrix)]
else
return createJumbleLayout(matrix)
end
end
function module.add_walls_to_room(room)
if random(2) == 1 then
return false
end
draw_layout_to_room(room, pickALayout(readLayoutFile("walllayouts.dat")))
return true
end
function module.add_pits_to_room(room)
if CURRENT_LEVEL < 2 or random(5) ~= 1 then
return false
end
draw_layout_to_room(room, pickALayout(readLayoutFile("pitlayouts.dat")))
return true
end
function module.add_shop_layout(room, roomx, roomy)
local matrix = readLayoutFile("shoplayouts.dat")
draw_layout_to_room(room, matrix[random(#matrix)], roomx, roomy)
return true
end
function module.add_locked_room_layout(room, roomx, roomy)
local matrix = readLayoutFile("lockedroomlayouts.dat")
draw_layout_to_room(room, matrix[random(#matrix)], roomx, roomy)
return true
end
return module

View File

@ -1,90 +0,0 @@
++++++++++++++++
++++++++++++++++
++"#####G####"++
++#-c--c--c--#++
++#----------#++
++#-c--c--c--#++
++G----------G++
++#-c--c--c--#++
++#----------#++
++"#####G####"++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++"#####S####"++
++#-c--c--c--#++
++#----------#++
++#-c--c--c--#++
++S----------S++
++#-c--c--c--#++
++#----------#++
++"#####S####"++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++/####-#####/++
++#--c#-#c---#++
++S---#-#----G++
++#####-######++
++------------++
++#####-######++
++S--c#-#c---G++
++/####-#####/++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++----#S#-----++
++----#c#-----++
++----#c#-----++
++----#c#-----++
++----###-----++
++------------++
++------------++
++------------++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++------------++
++------------++
++------------++
++---###S##---++
++---#cccc#---++
++---######---++
++------------++
++------------++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++----#G#-----++
++----#c#-----++
++----#c#-----++
++----#c#-----++
++----###-----++
++------------++
++------------++
++------------++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++------------++
++------------++
++------------++
++---###G##---++
++---#cccc#---++
++---######---++
++------------++
++------------++
++++++++++++++++
++++++++++++++++

View File

@ -1,12 +1,10 @@
local room_builder = require "maproombuilder"
local monster_gen = require "monstergen"
local trap_gen = require "trapgen"
local chest_gen = require "chestgen"
-- Setting up some functions
local time = os.time
local random = map_random
local randomseed = map_randomseed
local random = math.random
local randomseed = math.randomseed
-- CONSTANTS
local UP = 1
@ -14,14 +12,12 @@ local LEFT = 2
local RIGHT = 3
local DOWN = 4
local lockedDoorsAdded = false
-- BEGIN FUNCTIONS
local function matrix_coverage (matrix)
local cov = 0
for i=1,10 do
for j=1,10 do
if matrix[i][j] then cov = cov + 1 end
if matrix[i][j].active then cov = cov + 1 end
end
end
return cov
@ -40,125 +36,82 @@ local function generate_path ()
for i=1,10 do
map_matrix[i] = {}
for j=1,10 do
map_matrix[i][j] = nil
map_matrix[i][j] = room_builder.create_room()
end
end
local cx, cy = 1, 1
local seed = get_random_seed(CURRENT_LEVEL)
local seed = time();
info("Map generation seed: " .. seed)
randomseed(seed)
local direction = 0
local lastDirection = 0
local coridoor_count = 0
local shopLevel = CURRENT_LEVEL % 4 == 0
local bossLevel = CURRENT_LEVEL % 5 == 0
if QUICK_MODE then
bossLevel = CURRENT_LEVEL % 3 == 0
shopLevel = CURRENT_LEVEL % 2 == 0
end
local coverage = 8 + CURRENT_LEVEL
if bossLevel or CURRENT_LEVEL == 1 then
coverage = 5
end
if ARCADE_MODE then
coverage = 40
shopLevel = true
end
if shopLevel then
coverage = coverage + 1
end
-- Create the first room
map_matrix[cx][cy] = room_builder.create_empty_room()
local coverage = 10
while matrix_coverage(map_matrix) < coverage do
local direction = random(4)
if coridoor_count < coverage/2 then
if lastDirection > 0 then
if random(24) <= 6 then direction = lastDirection end
end
while lastDirection == reverse_direction(direction) do
direction = random(4)
end
map_matrix[cx][cy].active = true
if coridoor_count < coverage/3 then
if random(3) == 1 and (cx > 1 or cy > 1) then
map_matrix[cx][cy].type = "coridoor"
coridoor_count = coridoor_count + 1
end
end
valid_direction = false
if direction == UP and cy > 1 then -- UP
room_builder.add_exit(map_matrix[cx][cy], direction)
table.insert(map_matrix[cx][cy].exits, direction)
map_matrix[cx][cy].path_dir = direction
cy = cy - 1
valid_direction = true
cy = cy - 1;
table.insert(map_matrix[cx][cy].exits, reverse_direction(direction))
elseif direction == LEFT and cx > 1 then -- LEFT
room_builder.add_exit(map_matrix[cx][cy], direction)
table.insert(map_matrix[cx][cy].exits, direction)
map_matrix[cx][cy].path_dir = direction
cx = cx - 1
valid_direction = true
cx = cx - 1;
table.insert(map_matrix[cx][cy].exits, reverse_direction(direction))
elseif direction == RIGHT and cx < 10 then -- RIGHT
room_builder.add_exit(map_matrix[cx][cy], direction)
table.insert(map_matrix[cx][cy].exits, direction)
map_matrix[cx][cy].path_dir = direction
cx = cx + 1
valid_direction = true
cx = cx + 1;
table.insert(map_matrix[cx][cy].exits, reverse_direction(direction))
elseif direction == DOWN and cy < 10 then -- DOWN
room_builder.add_exit(map_matrix[cx][cy], direction)
table.insert(map_matrix[cx][cy].exits, direction)
map_matrix[cx][cy].path_dir = direction
cy = cy + 1
valid_direction = true
end
-- Create the next room and add the reverse exit
-- if a valid direction was found
if valid_direction then
if not map_matrix[cx][cy] then
map_matrix[cx][cy] = room_builder.create_empty_room()
end
room_builder.add_exit(map_matrix[cx][cy], reverse_direction(direction))
cy = cy + 1;
table.insert(map_matrix[cx][cy].exits, reverse_direction(direction))
end
lastDirection = direction
end
-- Last room rules
map_matrix[cx][cy].active = true
map_matrix[cx][cy].goal = true
map_matrix[cx][cy].type = "room"
local roomCount = 0
local bossAdded = false
local shopAdded = false
return map_matrix;
end
-- Build all the rooms
local function print_matrix(matrix)
for i=1,10 do
for j=1,10 do
room = map_matrix[i][j]
if room then
if roomCount > 4 and shopLevel and not shopAdded and not room.goal then
room.type = "shop"
shopAdded = true
elseif random(8) == 1 and not room.goal then
room.type = "locked"
lockedDoorsAdded = true
end
roomCount = roomCount + 1
room_builder.build_room(room, i-1, j-1)
if room.type ~= "shop" then
monster_gen.add_monsters_to_room(room, i-1, j-1)
trap_gen.add_traps_to_room(room, i-1, j-1)
chest_gen.add_chests_to_room(room, i-1, j-1)
else
monster_gen.add_shopkeeper_to_room(room, i-1, j-1)
if PlayerData.shopOwnerKiller then
monster_gen.add_bodyguard_to_room(room, i-1, j-1)
monster_gen.add_bodyguard_to_room(room, i-1, j-1)
end
end
if roomCount > 3 and bossLevel and not bossAdded then
bossAdded = true
monster_gen.add_boss_to_room(room, i-1, j-1)
end
if not map_matrix[j][i].goal then
io.write(map_matrix[j][i].path_dir .. " ")
else
io.write("G ")
end
end
io.write("\n")
end
return map_matrix;
end
-- END FUNCTIONS
@ -173,17 +126,15 @@ local map_matrix = generate_path()
for i=1,10 do
for j=1,10 do
local room = map_matrix[i][j]
if room then
if room.active then
set_current_room(map, i-1, j-1);
room_builder.load_room(map, room)
monster_gen.load_monsters(map, room.monsters)
trap_gen.load_traps(map, room.traps)
chest_gen.load_chests(map, room.chests)
if room.type == "room" then
room_builder.build_square_room(map, room)
monster_gen.add_monster_to_room(map, i-1, j-1);
elseif room.type == "coridoor" then
room_builder.build_coridoor_room(map, room)
end
end
end
end
if lockedDoorsAdded then
add_keybearers(map)
end
-- END SCRIPT

View File

@ -1,6 +1,5 @@
-- FUNCTIONS
local random = map_random
local layoutparser = require "layoutparser"
local random = math.random
-- CONSTANTS
local UP = 1
@ -29,10 +28,18 @@ local wall = {
horizontal = nil
}
local pits = {
center = nil,
top = nil,
left = nil,
right = nil,
topleft = nil,
topright = nil,
}
local special = { level_exit = nil }
local floorDecor = { }
local blockingFloorDecor = { }
local lightDecor = { }
local function load_decor_textures()
@ -42,9 +49,9 @@ local function load_decor_textures()
-- Skulls
table.insert(floorDecor, { td0, td1, 0, 12 * 16, false, false })
table.insert(floorDecor, { td0, td1, 32, 12 * 16, false, false })
table.insert(floorDecor, { td0, td1, 64, 12 * 16, false, true })
table.insert(floorDecor, { td0, td1, 0, 13 * 16, false, false })
table.insert(floorDecor, { td0, td1, 32, 13 * 16, false, false })
table.insert(floorDecor, { td0, td1, 64, 12 * 16, false, true })
table.insert(floorDecor, { td0, td1, 64, 13 * 16, false, true })
-- Bones
@ -53,6 +60,42 @@ local function load_decor_textures()
table.insert(floorDecor, { td0, td1, 16, 13 * 16, false, false })
table.insert(floorDecor, { td0, td1, 48, 13 * 16, false, false })
-- Urns
table.insert(floorDecor, { td0, td1, 0 * 16, 48, true, false })
table.insert(floorDecor, { td0, td1, 1 * 16, 48, true, false })
table.insert(floorDecor, { td0, td1, 2 * 16, 48, true, false })
table.insert(floorDecor, { td0, td1, 3 * 16, 48, true, false })
table.insert(floorDecor, { td0, td1, 4 * 16, 48, true, false })
table.insert(floorDecor, { td0, td1, 5 * 16, 48, true, false })
table.insert(floorDecor, { td0, td1, 6 * 16, 48, false, false })
table.insert(floorDecor, { td0, td1, 7 * 16, 48, false, false })
-- Racks
table.insert(floorDecor, { td0, td1, 0 * 16, 11 * 16, true, false })
table.insert(floorDecor, { td0, td1, 1 * 16, 11 * 16, true, false })
table.insert(floorDecor, { td0, td1, 2 * 16, 11 * 16, true, false })
table.insert(floorDecor, { td0, td1, 3 * 16, 11 * 16, true, false })
table.insert(floorDecor, { td0, td1, 4 * 16, 11 * 16, true, false })
table.insert(floorDecor, { td0, td1, 5 * 16, 11 * 16, true, false })
table.insert(floorDecor, { td0, td1, 6 * 16, 11 * 16, true, false })
-- Headstones
table.insert(floorDecor, { td0, td1, 0 * 16, 17 * 16, true, false })
table.insert(floorDecor, { td0, td1, 1 * 16, 17 * 16, true, false })
table.insert(floorDecor, { td0, td1, 2 * 16, 17 * 16, true, false })
table.insert(floorDecor, { td0, td1, 3 * 16, 17 * 16, true, false })
table.insert(floorDecor, { td0, td1, 4 * 16, 17 * 16, true, false })
table.insert(floorDecor, { td0, td1, 0 * 16, 18 * 16, true, false })
table.insert(floorDecor, { td0, td1, 1 * 16, 18 * 16, true, false })
table.insert(floorDecor, { td0, td1, 2 * 16, 18 * 16, true, false })
table.insert(floorDecor, { td0, td1, 3 * 16, 18 * 16, true, false })
table.insert(floorDecor, { td0, td1, 4 * 16, 18 * 16, true, false })
-- Altars
table.insert(floorDecor, { td0, td1, 0 * 16, 20 * 16, true, false })
table.insert(floorDecor, { td0, td1, 1 * 16, 20 * 16, true, false })
table.insert(floorDecor, { td0, td1, 2 * 16, 20 * 16, true, false })
-- Webs
--table.insert(floorDecor, { td0, td1, 0 * 16, 19 * 16, false })
--table.insert(floorDecor, { td0, td1, 1 * 16, 19 * 16, false })
@ -60,47 +103,9 @@ local function load_decor_textures()
--table.insert(floorDecor, { td0, td1, 3 * 16, 19 * 16, false })
--table.insert(floorDecor, { td0, td1, 4 * 16, 19 * 16, false })
-- Urns
table.insert(floorDecor, { td0, td1, 6 * 16, 48, false, false })
table.insert(floorDecor, { td0, td1, 7 * 16, 48, false, false })
-- Urns
--table.insert(blockingFloorDecor, { td0, td1, 0 * 16, 48, true, false })
--table.insert(blockingFloorDecor, { td0, td1, 1 * 16, 48, true, false })
--table.insert(blockingFloorDecor, { td0, td1, 2 * 16, 48, true, false })
--table.insert(blockingFloorDecor, { td0, td1, 3 * 16, 48, true, false })
--table.insert(blockingFloorDecor, { td0, td1, 4 * 16, 48, true, false })
--table.insert(blockingFloorDecor, { td0, td1, 5 * 16, 48, true, false })
-- Racks
--table.insert(blockingFloorDecor, { td0, td1, 0 * 16, 11 * 16, true, false })
--table.insert(blockingFloorDecor, { td0, td1, 1 * 16, 11 * 16, true, false })
--table.insert(blockingFloorDecor, { td0, td1, 2 * 16, 11 * 16, true, false })
--table.insert(blockingFloorDecor, { td0, td1, 3 * 16, 11 * 16, true, false })
--table.insert(blockingFloorDecor, { td0, td1, 4 * 16, 11 * 16, true, false })
--table.insert(blockingFloorDecor, { td0, td1, 5 * 16, 11 * 16, true, false })
--table.insert(blockingFloorDecor, { td0, td1, 6 * 16, 11 * 16, true, false })
-- Headstones
table.insert(blockingFloorDecor, { td0, td1, 0 * 16, 17 * 16, true, false })
table.insert(blockingFloorDecor, { td0, td1, 1 * 16, 17 * 16, true, false })
table.insert(blockingFloorDecor, { td0, td1, 2 * 16, 17 * 16, true, false })
table.insert(blockingFloorDecor, { td0, td1, 3 * 16, 17 * 16, true, false })
table.insert(blockingFloorDecor, { td0, td1, 4 * 16, 17 * 16, true, false })
table.insert(blockingFloorDecor, { td0, td1, 0 * 16, 18 * 16, true, false })
table.insert(blockingFloorDecor, { td0, td1, 1 * 16, 18 * 16, true, false })
table.insert(blockingFloorDecor, { td0, td1, 2 * 16, 18 * 16, true, false })
table.insert(blockingFloorDecor, { td0, td1, 3 * 16, 18 * 16, true, false })
table.insert(blockingFloorDecor, { td0, td1, 4 * 16, 18 * 16, true, false })
-- Altars
table.insert(blockingFloorDecor, { td0, td1, 0 * 16, 20 * 16, true, false })
table.insert(blockingFloorDecor, { td0, td1, 1 * 16, 20 * 16, true, false })
table.insert(blockingFloorDecor, { td0, td1, 2 * 16, 20 * 16, true, false })
-- Statues
--table.insert(blockingFloorDecor, { td0, td1, 3 * 16, 20 * 16, true })
--table.insert(blockingFloorDecor, { td0, td1, 4 * 16, 20 * 16, true })
--table.insert(floorDecor, { td0, td1, 3 * 16, 20 * 16, true })
--table.insert(floorDecor, { td0, td1, 4 * 16, 20 * 16, true })
lightDecor.candle0 = { td0, td1, 0, 8 * 16, false, true }
lightDecor.candle1 = { td0, td1, 16, 8 * 16, false, true }
@ -121,225 +126,284 @@ local function repack(data)
isCollider = data[5] or false,
isLightSource = data[6] or false,
isLevelExit = data[7] or false,
isLethal = data[8] or false,
lockType = data[9] or 0
isLethal = data[8] or false
}
end
local function room_tile_available(room, rx, ry)
return not room.chests[rx][ry]
and not room.traps[rx][ry]
and not room.walls[rx][ry]
and not room.doors[rx][ry]
and not room.monsters[rx][ry]
and not room.decor[rx][ry]
and (room.tiles[rx][ry]
and not room.tiles[rx][ry][5]
and not room.tiles[rx][ry][7]
and not room.tiles[rx][ry][8])
local function check_add_decoration(map, x, y, data)
if tile_occupied(map, x, y) then
return false
end
add_decoration(map, x, y, repack(data))
return true
end
local function add_random_decor_to_room(room, blockingDecor)
local decor_count = random(8)
if blockingDecor then
decor_count = random(4)
local function check_add_tile(map, x, y, data)
if tile_occupied(map, x, y) then
return false
end
add_tile(map, x, y, repack(data))
return true
end
local function add_random_decor_to_room(map)
local decor_count = random(4) - 1
for i=1,decor_count do
local success = false
while not success do
x = random(11) + 1
y = random(8) + 1
if room_tile_available(room, x, y) then
room.decor[x][y] = floorDecor[random(#floorDecor)]
success = true
end
check_add_decoration(map, random(11)+1, random(8)+1, floorDecor[random(#floorDecor)])
end
end
local function add_pits_to_room(map)
if CURRENT_LEVEL < 2 then
return
elseif random(5) ~= 1 then
return
end
local pitdata = read_file("pitlayouts.dat")
local cleanData = ""
for i=1, #pitdata do
local c = pitdata:sub(i+1, i+1)
if c == "#" or c == "-" then
cleanData = cleanData .. c
end
end
if blockingDecor then
decor_count = random(4)
for i=1,decor_count do
local success = false
while not success do
x = random(11) + 1
y = random(8) + 1
if room_tile_available(room, x, y) then
room.decor[x][y] = blockingFloorDecor[random(#blockingFloorDecor)]
success = true
local matrix = {}
for i=0, #cleanData-1 do
local c = cleanData:sub(i, i)
local col = i % 16
local row = (i - col)/16
local layout = 1 + (row - (row % 12))/12
local row = row % 12
if not matrix[layout] then matrix[layout] = {} end
if not matrix[layout][col] then matrix[layout][col] = {} end
if c == "#" then
matrix[layout][col][row] = true
elseif c == "-" then
matrix[layout][col][row] = false
end
end
print(#matrix)
matrix = matrix[random(#matrix)]
for i=0, 11 do
for j=0, 15 do
if matrix[j][i] then
io.write("#")
else
io.write("-")
end
end
io.write("\n")
end
for i=2,13 do
for j=2,10 do
if not tile_occupied(map, (i), (j)) and matrix[i][j] then
if not matrix[i-1][j-1] and not matrix[i+1][j-1] and matrix[i-1][j] and matrix[i+1][j] and matrix[i][j-1] then
add_tile(map, i, j, repack(pits.innermid))
elseif not matrix[i-1][j-1] and matrix[i-1][j] and matrix[i][j-1] then
add_tile(map, i, j, repack(pits.innerleft))
elseif not matrix[i+1][j-1] and matrix[i+1][j] and matrix[i][j-1] then
add_tile(map, i, j, repack(pits.innerright))
elseif not matrix[i-1][j] and not matrix[i][j-1] and not matrix[i+1][j] then
add_tile(map, i, j, repack(pits.topcrevice))
elseif not matrix[i-1][j] and not matrix[i+1][j] then
add_tile(map, i, j, repack(pits.bottomcrevice))
elseif not matrix[i-1][j] and not matrix[i][j-1] then
add_tile(map, i, j, repack(pits.topleft))
elseif not matrix[i+1][j] and not matrix[i][j-1] then
add_tile(map, i, j, repack(pits.topright))
elseif not matrix[i-1][j] then
add_tile(map, i, j, repack(pits.left))
elseif not matrix[i+1][j] then
add_tile(map, i, j, repack(pits.right))
elseif not matrix[i][j-1] then
add_tile(map, i, j, repack(pits.top))
else
add_tile(map, i, j, repack(pits.center))
end
end
end
end
if blockingDecor then
if random(2) == 1 and room_tile_available(room, 4, 3) then
room.decor[4][3] = lightDecor.candle2
end
if random(2) == 1 and room_tile_available(room, 11, 3) then
room.decor[11][3] = lightDecor.candle2
end
if random(2) == 1 and room_tile_available(room, 4, 9) then
room.decor[4][9] = lightDecor.candle2
end
if random(2) == 1 and room_tile_available(room, 11, 9) then
room.decor[11][9] = lightDecor.candle2
end
end
end
local function add_tiles_to_room (room, singletile)
local function add_tiles_to_room (map)
for i=0,15 do
for j=0,11 do
if (i >= 1 and i <= 14 and j >= 1 and j <= 10) then
if (i == 1 and j == 1) then
room.tiles[i][j] = singletile and floor.single or floor.topleft
add_tile(map, i, j, repack(floor.topleft))
elseif (i == 14 and j == 1) then
room.tiles[i][j] = singletile and floor.single or floor.topright
add_tile(map, i, j, repack(floor.topright))
elseif (i == 1 and j == 10) then
room.tiles[i][j] = singletile and floor.single or floor.bottomleft
add_tile(map, i, j, repack(floor.bottomleft))
elseif (i == 14 and j == 10) then
room.tiles[i][j] = singletile and floor.single or floor.bottomright
add_tile(map, i, j, repack(floor.bottomright))
elseif (i == 1) then
room.tiles[i][j] = singletile and floor.single or floor.left
add_tile(map, i, j, repack(floor.left))
elseif (i == 14) then
room.tiles[i][j] = singletile and floor.single or floor.right
add_tile(map, i, j, repack(floor.right))
elseif (j == 1) then
room.tiles[i][j] = singletile and floor.single or floor.top
add_tile(map, i, j, repack(floor.top))
elseif (j == 10) then
room.tiles[i][j] = singletile and floor.single or floor.bottom
add_tile(map, i, j, repack(floor.bottom))
else
room.tiles[i][j] = singletile and floor.single or floor.center
add_tile(map, i, j, repack(floor.center))
end
else
room.tiles[i][j] = floor.single
end
end
end
add_random_decor_to_room(map)
add_pits_to_room(map)
end
local function add_walls_to_room (room)
local function add_walls_to_room (map)
for i=0,15 do
for j=0,11 do
if (i == 0 and j == 0) then
room.walls[i][j] = wall.topleft
add_tile(map, i, j, repack(wall.topleft))
elseif (i == 15 and j == 0) then
room.walls[i][j] = wall.topright
add_tile(map, i, j, repack(wall.topright))
elseif (i == 0 and j == 11) then
room.walls[i][j] = wall.bottomleft
add_tile(map, i, j, repack(wall.bottomleft))
elseif (i == 15 and j == 11) then
room.walls[i][j] = wall.bottomright
add_tile(map, i, j, repack(wall.bottomright))
elseif (i == 0 or i == 15) then
room.walls[i][j] = wall.vertical
add_tile(map, i, j, repack(wall.vertical))
elseif (j == 0 or j == 11) then
room.walls[i][j] = wall.horizontal
add_tile(map, i, j, repack(wall.horizontal))
end
end
end
end
local function build_vert_center_coridoor(room, offset)
for i=0,4 do
room.walls[6][offset+i] = wall.vertical
room.tiles[7][offset+i] = floor.center
room.tiles[8][offset+i] = floor.center
room.walls[7][offset+i] = nil
room.walls[8][offset+i] = nil
room.walls[9][offset+i] = wall.vertical
if random(2) == 1 then
check_add_decoration(map, 4, 3, lightDecor.candle2)
end
if random(2) == 1 then
room.decor[6][offset+2] = lightDecor.candle1
check_add_decoration(map, 11, 3, lightDecor.candle2)
end
if random(2) == 1 then
room.decor[6][offset+2] = lightDecor.candle1
if random(2) == 1 then
check_add_decoration(map, 4, 9, lightDecor.candle2)
end
if random(2) == 1 then
check_add_decoration(map, 11, 9, lightDecor.candle2)
end
end
local function build_horiz_center_coridoor(room, offset)
local function add_exit(map, direction)
if direction > 4 then return end
if direction == UP then
add_tile(map, 6, 0, repack(wall.bottomright))
add_tile(map, 7, 0, repack(floor.singleleft))
add_tile(map, 8, 0, repack(floor.singleright))
add_tile(map, 9, 0, repack(wall.bottomleft))
elseif direction == LEFT then
add_tile(map, 0, 4, repack(wall.bottomright))
add_tile(map, 0, 5, repack(floor.singletop))
add_tile(map, 0, 6, repack(floor.singlebottom))
add_tile(map, 0, 7, repack(wall.topright))
elseif direction == RIGHT then
add_tile(map, 15, 4, repack(wall.bottomleft))
add_tile(map, 15, 5, repack(floor.singletop))
add_tile(map, 15, 6, repack(floor.singlebottom))
add_tile(map, 15, 7, repack(wall.topleft))
elseif direction == DOWN then
add_tile(map, 6, 11, repack(wall.topright))
add_tile(map, 7, 11, repack(floor.singleleft))
add_tile(map, 8, 11, repack(floor.singleright))
add_tile(map, 9, 11, repack(wall.topleft))
end
end
local function add_level_exit(map)
success = false
while not success do
x = random(14)
y = random(10)
success = check_add_tile(map, x, y, special.level_exit)
end
end
local function build_vert_center_coridoor(map, offset)
for j=0,4 do
add_tile(map, 6, offset+j, repack(wall.vertical));
add_tile(map, 7, offset+j, repack(floor.center));
add_tile(map, 8, offset+j, repack(floor.center));
add_tile(map, 9, offset+j, repack(wall.vertical));
end
if random(2) == 1 then
add_decoration(map, 6, offset + 2, repack(lightDecor.candle1))
end
if random(2) == 1 then
add_decoration(map, 9, offset + 2, repack(lightDecor.candle1))
end
end
local function build_horiz_center_coridoor(map, offset)
for i=0,6 do
room.walls[offset+i][4] = wall.horizontal
room.tiles[offset+i][5] = floor.center
room.tiles[offset+i][6] = floor.center
room.walls[offset+i][5] = nil
room.walls[offset+i][6] = nil
room.walls[offset+i][7] = wall.horizontal
add_tile(map, offset+i, 4, repack(wall.horizontal));
add_tile(map, offset+i, 5, repack(floor.center));
add_tile(map, offset+i, 6, repack(floor.center));
add_tile(map, offset+i, 7, repack(wall.horizontal));
end
if random(2) == 1 then
room.decor[offset+3][4] = lightDecor.candle1
check_add_decoration(map, offset+3, 4, lightDecor.candle1)
end
if random(2) == 1 then
room.decor[offset+3][7] = lightDecor.candle1
check_add_decoration(map, offset+3, 7, lightDecor.candle1)
end
end
local function build_center_corner_walls(room, exits)
local function build_center_corner_walls(map, exits)
if exits.down then
if exits.left then
room.walls[6][7] = wall.topright
add_tile(map, 6, 7, repack(wall.topright))
end
if exits.right then
room.walls[9][7] = wall.topleft
add_tile(map, 9, 7, repack(wall.topleft))
end
else
if not exits.left then
room.walls[6][7] = wall.bottomleft
add_tile(map, 6, 7, repack(wall.bottomleft))
end
if not exits.right then
room.walls[9][7] = wall.bottomright
add_tile(map, 9, 7, repack(wall.bottomright))
end
end
if exits.up then
if exits.left then
room.walls[6][4] = wall.bottomright
add_tile(map, 6, 4, repack(wall.bottomright))
end
if exits.right then
room.walls[9][4] = wall.bottomleft
add_tile(map, 9, 4, repack(wall.bottomleft))
end
else
if not exits.left then
room.walls[6][4] = wall.topleft
add_tile(map, 6, 4, repack(wall.topleft))
end
if not exits.right then
room.walls[9][4] = wall.topright
add_tile(map, 9, 4, repack(wall.topright))
end
end
end
local function add_exits_to_room(room)
for _,direction in ipairs(room.exits) do
if direction == UP then
room.walls[6][0] = wall.bottomright
room.tiles[7][0] = floor.singleleft
room.tiles[8][0] = floor.singleright
room.walls[7][0] = nil
room.walls[8][0] = nil
room.walls[9][0] = wall.bottomleft
elseif direction == LEFT then
room.walls[0][4] = wall.bottomright
room.tiles[0][5] = floor.singletop
room.tiles[0][6] = floor.singlebottom
room.walls[0][5] = nil
room.walls[0][6] = nil
room.walls[0][7] = wall.topright
elseif direction == RIGHT then
room.walls[15][4] = wall.bottomleft
room.tiles[15][5] = floor.singletop
room.tiles[15][6] = floor.singlebottom
room.walls[15][5] = nil
room.walls[15][6] = nil
room.walls[15][7] = wall.topleft
elseif direction == DOWN then
room.walls[6][11] = wall.topright
room.tiles[7][11] = floor.singleleft
room.tiles[8][11] = floor.singleright
room.walls[7][11] = nil
room.walls[8][11] = nil
room.walls[9][11] = wall.topleft
end
end
local module = {}
function module.add_full_lighting(map)
check_add_decoration(map, 4, 3, lightDecor.candle2)
check_add_decoration(map, 11, 3, lightDecor.candle2)
check_add_decoration(map, 4, 9, lightDecor.candle2)
check_add_decoration(map, 11, 9, lightDecor.candle2)
end
local function build_coridoor_room(room)
function module.build_coridoor_room(map, room)
local exits = {
up = false,
down = false,
@ -356,203 +420,64 @@ local function build_coridoor_room(room)
end
-- Fill the center
room.tiles[7][5] = floor.center
room.tiles[7][6] = floor.center
room.tiles[8][5] = floor.center
room.tiles[8][6] = floor.center
room.walls[6][5] = wall.vertical
room.walls[6][6] = wall.vertical
room.walls[7][4] = wall.horizontal
room.walls[7][7] = wall.horizontal
room.walls[8][4] = wall.horizontal
room.walls[8][7] = wall.horizontal
room.walls[9][5] = wall.vertical
room.walls[9][6] = wall.vertical
add_tile(map, 6, 5, repack(wall.vertical))
add_tile(map, 6, 6, repack(wall.vertical))
add_tile(map, 7, 4, repack(wall.horizontal))
add_tile(map, 7, 5, repack(floor.center))
add_tile(map, 7, 6, repack(floor.center))
add_tile(map, 7, 7, repack(wall.horizontal))
add_tile(map, 8, 4, repack(wall.horizontal))
add_tile(map, 8, 5, repack(floor.center))
add_tile(map, 8, 6, repack(floor.center))
add_tile(map, 8, 7, repack(wall.horizontal))
add_tile(map, 9, 5, repack(wall.vertical))
add_tile(map, 9, 6, repack(wall.vertical))
-- Build the coridoors
if exits.down then build_vert_center_coridoor(room, 7) end
if exits.up then build_vert_center_coridoor(room, 0) end
if exits.left then build_horiz_center_coridoor(room, 0) end
if exits.right then build_horiz_center_coridoor(room, 9) end
if exits.down then build_vert_center_coridoor(map, 7) end
if exits.up then build_vert_center_coridoor(map, 0) end
if exits.left then build_horiz_center_coridoor(map, 0) end
if exits.right then build_horiz_center_coridoor(map, 9) end
build_center_corner_walls(room, exits)
build_center_corner_walls(map, exits)
end
local function add_level_exit(room)
local success = false
while not success do
x = random(14)
y = random(10)
if room_tile_available(room, x, y) then
success = true
room.tiles[x][y] = special.level_exit
end
end
end
local function build_shop_room(room, roomx, roomy)
add_tiles_to_room(room, false)
add_walls_to_room(room)
add_exits_to_room(room)
layoutparser.add_shop_layout(room, roomx, roomy)
return room
end
local function build_locked_room(room, roomx, roomy)
add_tiles_to_room(room, false)
add_walls_to_room(room)
add_exits_to_room(room)
layoutparser.add_locked_room_layout(room, roomx, roomy)
return room
end
local function build_normal_room(room)
local crumbling = (CURRENT_LEVEL > 3 or QUICK_MODE) and random(8) == 1
local pitsAdded = false;
local interiorWallsAdded = false
add_tiles_to_room(room, crumbling)
add_walls_to_room(room)
add_exits_to_room(room)
if not crumbling then
pitsAdded = layoutparser.add_pits_to_room(room)
end
if not pitsAdded and (not crumbling or CURRENT_LEVEL > 3) then
interiorWallsAdded = layoutparser.add_walls_to_room(room)
end
add_random_decor_to_room(room, not interiorWallsAdded)
if room.goal then
add_level_exit(room)
end
if crumbling then
room.modifier.type = "CRUMBLING"
room.modifier.arg = ""
elseif (CURRENT_LEVEL > 3 or QUICK_MODE) and random(8) == 1 then
room.modifier.type = "FIRE"
room.modifier.arg = ""
elseif ((not pitsAdded and not crumbling and (CURRENT_LEVEL > 1 or QUICK_MODE)) or CURRENT_LEVEL > 3) and random(8) == 1 then
directions = { "LEFT", "RIGHT", "UP", "DOWN" }
room.modifier.type = "WINDY"
room.modifier.arg = directions[random(#directions)]
end
return room
end
local module = {}
function module.add_exit(room, direction)
if direction > 4 then
return
end
table.insert(room.exits, direction)
end
function module.add_full_lighting(room)
room.decor[4][3] = lightDecor.candle2
room.decor[11][3] = lightDecor.candle2
room.decor[4][9] = lightDecor.candle2
room.decor[11][9] = lightDecor.candle2
end
function module.is_tile_avilable(room, rx, ry)
return room_tile_available(room, rx, ry);
end
function module.create_empty_room()
room = {
function module.create_room ()
return {
exits = {},
active = false,
goal = false,
path_dir = 0,
type = "room",
tiles = {},
walls = {},
doors = {},
decor = {},
modifier = {
type = nil,
arg = nil
},
monsters = {},
chests = {},
traps = {}
type = "room"
}
for i=0,15 do
room.tiles[i] = {}
room.walls[i] = {}
room.doors[i] = {}
room.decor[i] = {}
room.monsters[i] = {}
room.traps[i] = {}
room.chests[i] = {}
for j=0,11 do
room.tiles[i][j] = nil
room.walls[i][j] = nil
room.doors[i][j] = nil
room.decor[i][j] = nil
room.monsters[i][j] = nil
room.traps[i][j] = nil
room.chests[i][j] = nil
end
end
return room
end
function module.build_room(room, roomx, roomy)
if room.type == "coridoor" then
build_coridoor_room(room)
elseif room.type == "shop" then
build_shop_room(room, roomx, roomy)
elseif room.type == "locked" then
build_locked_room(room, roomx, roomy)
else
build_normal_room(room)
--build_locked_room(room, roomx, roomy)
function module.build_square_room(map, room)
add_tiles_to_room(map);
add_walls_to_room(map);
for exit=1, #room.exits do
add_exit(map, room.exits[exit]);
end
if room.goal then
add_level_exit(map);
end
end
function module.load_room(map, room)
for i=0, 15 do
for j=0, 11 do
if room.tiles[i][j] then
add_tile(map, i, j, repack(room.tiles[i][j]))
end
if room.walls[i][j] then
add_wall(map, i, j, repack(room.walls[i][j]))
end
if room.doors[i][j] then
add_door(map, i, j, repack(room.doors[i][j]))
end
if room.decor[i][j] then
add_decoration(map, i, j, repack(room.decor[i][j]))
end
end
end
if room.modifier.type then
set_modifier(map, room.modifier.type, room.modifier.arg)
if CURRENT_LEVEL > 3 and random(10) == 1 then
directions = { "LEFT", "RIGHT", "UP", "DOWN" }
set_modifier(map, "WINDY", directions[random(#directions)]);
end
end
function module.load_textures(map)
t_floor = add_texture(map, "Objects/Floor.png")
t_wall = add_texture(map, "Objects/Wall.png")
t_pit0 = add_texture(map, "Objects/Pit0.png")
t_pit1 = add_texture(map, "Objects/Pit1.png")
local seed = get_random_seed(CURRENT_LEVEL);
info("Map room random seed: " .. seed)
map_randomseed(seed)
math.randomseed(os.time())
local xo = (random(3) - 1) * 112
local yo = (random(8)) * 48
layoutparser.load_textures(map, xo, yo)
floor.center = { t_floor, -1, xo + 16, yo + 16, false }
floor.top = { t_floor, -1, xo + 16, yo + 0, false }
floor.bottom = { t_floor, -1, xo + 16, yo + 32, false }
@ -566,7 +491,19 @@ function module.load_textures(map)
floor.singlebottom = { t_floor, -1, xo + 48, yo + 32, false }
floor.singleleft = { t_floor, -1, xo + 64, yo + 16, false }
floor.singleright = { t_floor, -1, xo + 96, yo + 16, false }
floor.single = { t_floor, -1, xo + 80, yo + 0, false }
local pit_yo = (random(5) + random(3)) * (16 * 2)
pits.topleft = { t_pit0, t_pit1, 0, pit_yo, false, false, false, true }
pits.top = { t_pit0, t_pit1, 16, pit_yo, false, false, false, true }
pits.topright = { t_pit0, t_pit1, 32, pit_yo, false, false, false, true }
pits.left = { t_pit0, t_pit1, 0, pit_yo + 16, false, false, false, true }
pits.center = { t_pit0, t_pit1, 16, pit_yo + 16, false, false, false, true }
pits.right = { t_pit0, t_pit1, 32, pit_yo + 16, false, false, false, true }
pits.innerleft = { t_pit0, t_pit1, 80, pit_yo, false, false, false, true }
pits.innermid = { t_pit0, t_pit1, 96, pit_yo, false, false, false, true }
pits.innerright = { t_pit0, t_pit1, 112, pit_yo, false, false, false, true }
pits.topcrevice = { t_pit0, t_pit1, 64, pit_yo, false, false, false, true }
pits.bottomcrevice = { t_pit0, t_pit1, 64, pit_yo + 16, false, false, false, true }
wall.topleft = { t_wall, -1, xo + 0, yo + 0, true }
wall.topright = { t_wall, -1, xo + 32, yo + 0, true }

View File

@ -1,20 +1,12 @@
local room_builder = require "maproombuilder"
local monster_gen = require "monstergen"
local trap_gen = require "trapgen"
local chest_gen = require "chestgen"
map = create_map(CURRENT_LEVEL) -- 'map' needs to be global
room_builder.load_textures(map)
local room = room_builder.create_room()
set_current_room(map, 0, 0)
local room = room_builder.create_empty_room()
room_builder.build_room(room, 0, 0)
room_builder.add_full_lighting(room)
monster_gen.add_monsters_to_room(room, 0, 0)
trap_gen.add_traps_to_room(room, 0, 0)
chest_gen.add_chests_to_room(room, 0, 0)
room_builder.load_room(map, room)
monster_gen.load_monsters(map, room.monsters)
trap_gen.load_traps(map, room.traps)
chest_gen.load_chests(map, room.chests)
room_builder.build_square_room(map, room)
monster_gen.add_monster_to_room(map, 0, 0);
room_builder.add_full_lighting(map);

View File

@ -1,6 +1,5 @@
local room_builder = require "maproombuilder"
local module = {}
local random = map_random
local random = math.random
local texturePaths = {
aquatic0 = "Characters/Aquatic0.png",
@ -38,16 +37,10 @@ local texturePaths = {
}
local behaviour = {
pacifist = 0,
normal = 1,
hostile = 2,
guerilla = 3,
coward = 4,
sentinel = 5,
fire_demon = 6,
sorcerer = 7,
assassin = 8
local state = {
passive = 0,
agressive = 1,
scared = 2,
}
local stats = {
@ -65,13 +58,6 @@ local stats = {
def = 0,
speed = 1
},
misc = {
hp = 18,
dmg = 2,
atk = 0,
def = 0,
speed = 1
},
dog = {
hp = 12,
dmg = 2,
@ -86,34 +72,123 @@ local stats = {
def = 0,
speed = 1
},
orc = {
hp = 20,
dmg = 2,
atk = 0,
def = 0,
speed = 1
},
boss = {
hp = 60,
dmg = 3,
atk = 1,
def = 0,
speed = 1
},
platino = {
hp = 90,
dmg = 1,
atk = 0,
def = 0,
speed = 1
},
shopkeeper = {
hp = 200,
dmg = 10,
atk = 2,
def = 0,
speed = 1
},
hp = 60,
dmg = 60,
atk = 60,
def = 60,
speed = 3
}
}
local pests = {
-- PESTS
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 0, 0, "A Beetle" },
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 16, 0, "A Beetle" },
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 32, 0, "A Beetle" },
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 48, 0, "A Beetle" },
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 64, 0, "A Large Grub" },
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 80, 0, "A Small Grub" },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 96, 0, "A Slim Worm" },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 112, 0, "A Fat Worm" },
--{ texturePaths.pest0, texturePaths.pest1, 0, 16, "Female Dragonfly" },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 16, 16, "A Fly" },
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 32, 16, "A Larva" },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 48, 16, "A Moth" },
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 64, 16 },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 80, 16, "A Gnat" },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 0, 32, "A Small Spider" },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 16, 32, "A Medium Spider" },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 32, 32, "A Large Spider" },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 48, 32, "A Small Scorpion" },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 64, 32, "A Medium Scorpion" },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 80, 32, "A Large Scorpion" },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 0, 48, "A Slug" },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 16, 48, "A Large Slug" },
--{ texturePaths.pest0, texturePaths.pest1, 32, 48 },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 48, 48, "A Red Slug" },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 64, 48, "A Large Red Slug" },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 0, 64, "A Giant Brown Ant" },
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 16, 64, "A Giant Black Ant" },
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 32, 64, "A Giant Gold Ant" },
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 48, 64, "A Giant Silver Ant" },
--{ texturePaths.pest0, texturePaths.pest1, 0, 80 },
--{ texturePaths.pest0, texturePaths.pest1, 16, 80 },
--{ texturePaths.pest0, texturePaths.pest1, 32, 80 },
--{ texturePaths.pest0, texturePaths.pest1, 48, 80 },
--{ texturePaths.pest0, texturePaths.pest1, 0, 96 },
--{ texturePaths.pest0, texturePaths.pest1, 16, 96 },
--{ texturePaths.pest0, texturePaths.pest1, 32, 96 },
--{ texturePaths.pest0, texturePaths.pest1, 0, 112 },
--{ texturePaths.pest0, texturePaths.pest1, 16, 112 },
--{ texturePaths.pest0, texturePaths.pest1, 32, 112 },
--{ texturePaths.pest0, texturePaths.pest1, 48, 112 },
}
local undead = {
-- UNDEAD
--{ texturePaths.undead0, texturePaths.undead1, 0, 0, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 16, 0, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 32, 0, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 48, 0, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 64, 0, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 80, 0, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 96, 0, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 112, 0, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 0, 16, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 16, 16, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 32, 16, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 48, 16, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 64, 16, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 80, 16, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 96, 16, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 112, 16, "", state.passive, state.agressive };
{ texturePaths.undead0, texturePaths.undead1, stats.undead, 0, 32, "A Skeleton", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 16, 32, "An Umber Skeleton", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 32, 32, "A Caustic Skeleton", state.passive, state.agressive };
{ texturePaths.undead0, texturePaths.undead1, stats.undead, 48, 32, "A Black Skeleton", state.passive, state.agressive };
{ texturePaths.undead0, texturePaths.undead1, stats.undead, 64, 32, "A Zombie", state.passive, state.agressive };
{ texturePaths.undead0, texturePaths.undead1, stats.undead, 80, 32, "A Zombie", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 96, 32, "", state.passive, state.agressive };
--{ texturePaths.undead0, texturePaths.undead1, 112, 32, "", state.passive, state.scared };
}
local dogs = {
{ texturePaths.dog0, texturePaths.dog1, stats.dog, 0, 16, "A Rabid Dog", state.passive, state.agressive };
{ texturePaths.dog0, texturePaths.dog1, stats.dog, 16, 16, "An Angry Rabid Dog", state.agressive, state.agressive };
}
local reptile = {
{ texturePaths.reptile0, texturePaths.reptile1, stats.default, 0, 64, "A Small Brown Snake", state.passive, state.agressive };
{ texturePaths.reptile0, texturePaths.reptile1, stats.default, 16, 64, "A Medium Brown Snake", state.passive, state.agressive };
{ texturePaths.reptile0, texturePaths.reptile1, stats.default, 32, 64, "A Large Brown Snake", state.passive, state.agressive };
{ texturePaths.reptile0, texturePaths.reptile1, stats.default, 48, 64, "A Small Black Snake", state.agressive, state.agressive };
{ texturePaths.reptile0, texturePaths.reptile1, stats.default, 64, 64, "A Medium Black Snake", state.agressive, state.agressive };
{ texturePaths.reptile0, texturePaths.reptile1, stats.default, 80, 64, "A Large Black Snake", state.agressive, state.agressive };
}
local platino = {
{ texturePaths.reptile0, texturePaths.reptile1, stats.platino, 48, 12*16, "Platino", state.agressive, state.agressive };
}
local demon = {
{ texturePaths.demon0, texturePaths.demon1, stats.default, 0, 0, "A Demon", state.agressive, state.agressive };
{ texturePaths.demon0, texturePaths.demon1, stats.default, 16, 0, "A Demon", state.agressive, state.agressive };
{ texturePaths.demon0, texturePaths.demon1, stats.default, 32, 0, "A Demon", state.agressive, state.agressive };
{ texturePaths.demon0, texturePaths.demon1, stats.default, 48, 0, "A Demon", state.agressive, state.agressive };
{ texturePaths.demon0, texturePaths.demon1, stats.default, 64, 0, "A Demon", state.agressive, state.agressive };
{ texturePaths.demon0, texturePaths.demon1, stats.default, 80, 0, "A Demon", state.agressive, state.agressive };
{ texturePaths.demon0, texturePaths.demon1, stats.default, 96, 0, "A Demon", state.agressive, state.agressive };
{ texturePaths.demon0, texturePaths.demon1, stats.default, 112, 0, "A Demon", state.agressive, state.agressive };
}
local function concat(table1, table2)
@ -123,209 +198,6 @@ local function concat(table1, table2)
return table1
end
local pests = {
{ stats.pest, 96, 0, "A Slim Worm", behaviour.pacifist },
{ stats.pest, 112, 0, "A Fat Worm", behaviour.pacifist },
{ stats.pest, 16, 16, "A Fly", behaviour.pacifist },
{ stats.pest, 48, 16, "A Moth", behaviour.pacifist },
{ stats.pest, 80, 16, "A Gnat", behaviour.pacifist },
{ stats.pest, 0, 32, "A Small Spider", behaviour.pacifist },
{ stats.pest, 16, 32, "A Medium Spider", behaviour.pacifist },
{ stats.pest, 32, 32, "A Large Spider", behaviour.pacifist },
{ stats.pest, 48, 32, "A Small Scorpion", behaviour.pacifist },
{ stats.pest, 64, 32, "A Medium Scorpion", behaviour.pacifist },
{ stats.pest, 80, 32, "A Large Scorpion", behaviour.pacifist },
{ stats.pest, 0, 48, "A Slug", behaviour.pacifist },
{ stats.pest, 16, 48, "A Large Slug", behaviour.pacifist },
{ stats.pest, 48, 48, "A Red Slug", behaviour.pacifist },
{ stats.pest, 64, 48, "A Large Red Slug", behaviour.pacifist },
{ stats.pest, 0, 64, "A Giant Brown Ant", behaviour.pacifist },
{ stats.pest, 16, 64, "A Giant Black Ant", behaviour.pacifist },
}
for i=1,#pests do
pests[i] = concat({ texturePaths.pest0, texturePaths.pest1 }, pests[i])
end
local avian = {
{ stats.default, 0, 11*16, "A Small Brown Bat", behaviour.pacifist },
{ stats.default, 16, 11*16, "A Big Brown Bat", behaviour.normal },
{ stats.default, 32, 11*16, "A Vampire Bat", behaviour.guerilla },
{ stats.default, 48, 11*16, "A Rabid Bat", behaviour.hostile },
}
for i=1,#avian do
avian[i] = concat({ texturePaths.avian0, texturePaths.avian1 }, avian[i])
end
local misc = {
{ stats.misc, 0, 0, "A Giant Black Rat", behaviour.sentinel },
{ stats.misc, 16, 0, "A Giant White Rat", behaviour.sentinel },
{ stats.misc, 64, 0, "An Owl Bear", behaviour.sentinel },
}
for i=1,#misc do
misc[i] = concat({ texturePaths.misc0, texturePaths.misc1 }, misc[i])
end
local fairies = {
{ stats.misc, 0, 48, "A Fairy", behaviour.pacifist },
{ stats.misc, 16, 48, "A Fairy", behaviour.pacifist },
{ stats.misc, 32, 48, "A Fairy", behaviour.pacifist },
{ stats.misc, 48, 48, "A Fairy", behaviour.pacifist },
{ stats.misc, 64, 48, "A Fairy", behaviour.pacifist },
{ stats.misc, 80, 48, "A Fairy", behaviour.pacifist },
}
for i=1,#fairies do
fairies[i] = concat({ texturePaths.humanoid0, texturePaths.humanoid1 }, fairies[i])
end
local reanimated = {
{ stats.undead, 0, 32, "A Skeleton", behaviour.normal },
{ stats.undead, 48, 32, "A Black Skeleton", behaviour.normal },
{ stats.undead, 64, 32, "A Zombie", behaviour.normal },
{ stats.undead, 80, 32, "A Zombie", behaviour.normal }
}
for i=1,#reanimated do
reanimated[i] = concat({ texturePaths.undead0, texturePaths.undead1 }, reanimated[i])
end
local undead = {
{ stats.undead, 5*16, 16, "A Mummy", behaviour.normal },
{ stats.undead, 6*16, 16, "A Two Headed Mummy", behaviour.sentinel },
{ stats.undead, 0*16, 32, "A Skeleton", behaviour.normal },
{ stats.misc, 1*16, 32, "A Burning Skeleton", behaviour.fire_demon },
{ stats.misc, 2*16, 32, "An Eldritch Skeleton", behaviour.sorcerer },
{ stats.misc, 3*16, 32, "A Black Skeleton", behaviour.guerilla },
{ stats.misc, 4*16, 32, "A Zombie", behaviour.coward },
{ stats.misc, 5*16, 32, "A Pale Zombie", behaviour.coward },
{ stats.misc, 7*16, 32, "A Scorched Zombie", behaviour.fire_demon },
{ stats.undead, 0*16, 4*16, "A Whight", behaviour.coward },
{ stats.undead, 1*16, 4*16, "A Ghast", behaviour.sentinel },
{ stats.misc, 1*16, 4*16, "A Ghost", behaviour.guerilla },
{ stats.misc, 0*16, 5*16, "A Spectre", behaviour.sentinel },
{ stats.undead, 1*16, 5*16, "An Eldritch Spectre", behaviour.sorcerer },
{ stats.undead, 2*16, 5*16, "A Scorched Spectre", behaviour.fire_demon },
}
for i=1,#undead do
undead[i] = concat({ texturePaths.undead0, texturePaths.undead1 }, undead[i])
end
local dogs = {
{ stats.dog, 0, 16, "A Rabid Dog", behaviour.normal },
{ stats.dog, 16, 16, "An Angry Rabid Dog", behaviour.hostile }
}
for i=1,#dogs do
dogs[i] = concat({ texturePaths.dog0, texturePaths.dog1 }, dogs[i])
end
local reptile = {
{ stats.default, 0, 64, "A Small Brown Snake", behaviour.coward },
{ stats.default, 16, 64, "A Medium Brown Snake", behaviour.guerilla },
{ stats.default, 32, 64, "A Large Brown Snake", behaviour.hostile },
{ stats.default, 48, 64, "A Small Black Snake", behaviour.coward },
{ stats.default, 64, 64, "A Medium Black Snake", behaviour.guerilla },
{ stats.default, 80, 64, "A Large Black Snake", behaviour.hostile },
}
for i=1,#reptile do
reptile[i] = concat({ texturePaths.reptile0, texturePaths.reptile1 }, reptile[i])
end
local demon = {
{ stats.default, 0, 0, "A Demon", behaviour.hostile },
{ stats.default, 16, 0, "A Demon", behaviour.hostile },
{ stats.default, 32, 0, "A Demon", behaviour.hostile },
{ stats.default, 48, 0, "A Demon", behaviour.hostile },
{ stats.default, 64, 0, "A Demon", behaviour.hostile },
{ stats.default, 80, 0, "A Demon", behaviour.hostile },
{ stats.default, 96, 0, "A Demon", behaviour.hostile },
{ stats.default, 112, 0, "A Demon", behaviour.hostile },
}
for i=1,#demon do
demon[i] = concat({ texturePaths.demon0, texturePaths.demon1 }, demon[i])
end
local orcs = {
{ stats.orc, 0, 4*16, "An Orc Guard", behaviour.normal },
{ stats.orc, 16, 4*16, "An Orc Seargeant", behaviour.coward },
{ stats.orc, 32, 4*16, "An Orc Militia", behaviour.hostile },
{ stats.orc, 48, 4*16, "An Orc Sentry", behaviour.sentinel },
{ stats.orc, 64, 4*16, "An Orc Brute", behaviour.guerilla },
{ stats.orc, 80, 4*16, "An Orc Captain", behaviour.hostile },
{ stats.orc, 96, 4*16, "An Orc Pyro", behaviour.fire_demon },
}
for i=1,#orcs do
orcs[i] = concat({ texturePaths.humanoid0, texturePaths.humanoid1 }, orcs[i])
end
local assassins = {
{ stats.misc, 1*16, 6*16, "A Reaper", behaviour.assassin },
{ stats.misc, 0*16, 7*16, "An Assassin", behaviour.assassin },
{ stats.misc, 1*16, 7*16, "A Royal Assassin", behaviour.assassin },
}
for i=1,#assassins do
assassins[i] = concat({ texturePaths.undead0, texturePaths.undead1 }, assassins[i])
end
local bosses = {
{ stats.boss, 16, 5*16, "The Hell Hound", behaviour.fire_demon, true },
{ stats.boss, 16, 23*16, "The Cleric", behaviour.sorcerer, true },
{ stats.boss, 16, 8*16, "The Shadow", behaviour.assassin, true },
}
bosses[1] = concat({ texturePaths.dog0, texturePaths.dog1 }, bosses[1])
bosses[2] = concat({ texturePaths.humanoid0, texturePaths.humanoid1 }, bosses[2])
bosses[3] = concat({ texturePaths.undead0, texturePaths.undead1 }, bosses[3])
local eastereggs = {
{ stats.misc, 6*16, 1*16, "Linus, the Developer", behaviour.passive },
{ stats.misc, 2*16, 3*16, "Lialynn, the Ranger", behaviour.passive },
{ stats.misc, 4*16, 3*16, "Miniel, the Paladin", behaviour.passive },
{ stats.misc, 2*16,12*16, "Feng, the Fighter", behaviour.passive },
{ stats.misc, 0*16, 7*16, "Adnis, the Ranger", behaviour.passive },
{ stats.misc, 7*16, 8*16, "Ti, the Mage", behaviour.passive },
}
for i=1,#eastereggs do
eastereggs[i] = concat({ texturePaths.player0, texturePaths.player1 }, eastereggs[i])
end
local shopkeeperBehaviour = behaviour.passive
if PlayerData.shopOwnerKiller then
shopkeeperBehaviour = behaviour.hostile
end
local shopkeeper = {
texturePaths.humanoid0,
texturePaths.humanoid1,
stats.shopkeeper,
16,
12*16,
"The Trader",
shopkeeperBehaviour
}
local bodyguard = {
texturePaths.humanoid0,
texturePaths.humanoid1,
stats.orc,
32,
12*16,
"A Bodyguard",
behaviour.hostile
}
-- Add Platino
table.insert(eastereggs, {
texturePaths.reptile0,
texturePaths.reptile1,
stats.platino,
48,
12*16,
"Platino",
behaviour.sentinel,
true
})
local function repack(data)
return {
texturePath1 = data[1],
@ -334,151 +206,51 @@ local function repack(data)
clipX = data[4],
clipY = data[5],
label = data[6] or "",
behaviour = data[7] or behaviour.normal,
boss = data[8] or false,
nstate = data[7] or state.passive,
cstate = data[8] or state.scared,
}
end
-- Begin script
local enemies = {}
if(CURRENT_LEVEL > 0) then
if(CURRENT_LEVEL > 0 and CURRENT_LEVEL < 10) then
if (CURRENT_LEVEL == 1) then
enemies = concat(enemies, pests)
enemies = concat(enemies, avian)
enemies = concat(enemies, misc)
enemies = concat(enemies, dogs)
elseif (CURRENT_LEVEL > 15 or (QUICK_MODE and CURRENT_LEVEL > 9)) then
elseif (CURRENT_LEVEL > 5) then
enemies = {}
enemies = concat(enemies, demon)
enemies = concat(enemies, undead)
enemies = concat(enemies, reptile)
elseif (CURRENT_LEVEL > 3) then
enemies = {}
enemies = concat(enemies, undead)
enemies = concat(enemies, orcs)
enemies = concat(enemies, assassins)
elseif (CURRENT_LEVEL > 10 or (QUICK_MODE and CURRENT_LEVEL > 6)) then
enemies = concat(enemies, reptile)
enemies = concat(enemies, dogs)
elseif (CURRENT_LEVEL > 2) then
enemies = {}
enemies = concat(enemies, undead)
enemies = concat(enemies, avian)
elseif (CURRENT_LEVEL > 5 or (QUICK_MODE and CURRENT_LEVEL > 3)) then
enemies = {}
enemies = concat(enemies, orcs)
enemies = concat(enemies, avian)
enemies = concat(enemies, reptile)
enemies = concat(enemies, dogs)
elseif (CURRENT_LEVEL > 1) then
enemies = {}
enemies = concat(enemies, reanimated)
enemies = concat(enemies, undead)
enemies = concat(enemies, reptile)
enemies = concat(enemies, avian)
enemies = concat(enemies, misc)
enemies = concat(enemies, dogs)
end
end
local addSpecialInLevel = random(100) == 1
local addFairyToLevel = random(3) == 1;
local function add_monster_to_tile(room, roomx, roomy, rx, ry, monster)
local x = (roomx * 512) + rx * 32
local y = (roomy * 384) + ry * 32
room.monsters[rx][ry] = {
x,
y,
monster
}
if random(100) == 1 then
enemies = concat(enemies, platino);
end
function module.add_monsters_to_room(room, roomx, roomy)
local addSpecial = addSpecialInLevel and random(2) == 1
local addFairy = random(4) == 1
function module.add_monster_to_room(map, roomx, roomy)
local count = random(3)
if (CURRENT_LEVEL > 3) then
count = random(4)
end
count = count + 1
local i = 0
while i < count do
local rx = random(13) + 1
local ry = random(9) + 1
if room_builder.is_tile_avilable(room, rx, ry) then
if addSpecial then
addSpecialInLevel = false
addSpecial = false
add_monster_to_tile(room, roomx, roomy, rx, ry, eastereggs[random(#eastereggs)])
elseif addFairyToLevel and addFairy then
addFairyToLevel = false
add_monster_to_tile(room, roomx, roomy, rx, ry, fairies[random(#fairies)])
else
add_monster_to_tile(room, roomx, roomy, rx, ry, enemies[random(#enemies)])
end
i = i + 1
end
end
end
function module.add_boss_to_room(room, roomx, roomy)
local boss = bosses[CURRENT_LEVEL / 5]
if QUICK_MODE then
boss = bosses[CURRENT_LEVEL / 3]
end
local success = false
while not success do
local rx = random(13) + 1
local ry = random(9) + 1
if room_builder.is_tile_avilable(room, rx, ry) then
local x = (roomx * 512) + rx * 32
local y = (roomy * 384) + ry * 32
room.monsters[rx][ry] = {
x,
y,
boss
}
success = true
end
end
end
function module.add_shopkeeper_to_room(room, roomx, roomy)
local success = false
while not success do
local rx = random(13) + 1
local ry = random(9) + 1
if room_builder.is_tile_avilable(room, rx, ry) then
local x = (roomx * 512) + rx * 32
local y = (roomy * 384) + ry * 32
room.monsters[rx][ry] = {
x,
y,
shopkeeper
}
success = true
end
end
end
function module.add_bodyguard_to_room(room, roomx, roomy)
local success = false
while not success do
local rx = random(13) + 1
local ry = random(9) + 1
if room_builder.is_tile_avilable(room, rx, ry) then
local x = (roomx * 512) + rx * 32
local y = (roomy * 384) + ry * 32
room.monsters[rx][ry] = {
x,
y,
bodyguard
}
success = true
end
end
end
function module.load_monsters(map, monsters)
for i=0,15 do
for j=0,11 do
monster = monsters[i][j]
if monster then
add_monster(map, monster[1], monster[2], repack(monster[3]))
end
end
for i=0,count do
local x = (roomx * 512) + (random(13) + 1) * 32
local y = (roomy * 384) + (random(9) + 1) * 32
add_monster(map, x, y, repack(enemies[random(#enemies)]));
end
end
return module

View File

@ -1,13 +1,13 @@
----------------
----------------
--pp--------pp--
--pp--pppp--pp--
-------pp-------
-------pp-------
-------pp-------
-------pp-------
--pp--pppp--pp--
--pp--------pp--
--##--------##--
--##--####--##--
-------##-------
-------##-------
-------##-------
-------##-------
--##--####--##--
--##--------##--
----------------
----------------
@ -15,11 +15,11 @@
----------------
----------------
----------------
-----pp-pp------
-----pp-pp------
-----##-##------
-----##-##------
----------------
-----pp-pp------
-----pp-pp------
-----##-##------
-----##-##------
----------------
----------------
----------------
@ -27,12 +27,12 @@
----------------
----------------
----------------
--pppppppppppp--
--############--
----------------
----------------
----------------
----------------
--pppppppppppp--
--############--
----------------
----------------
----------------
@ -40,194 +40,77 @@
----------------
----------------
----------------
--pppppppppppp--
--############--
----------------
--pppppppppppp--
--pppppppppppp--
--############--
--############--
----------------
--pppppppppppp--
--############--
----------------
----------------
----------------
----------------
----------------
--pppppppppppp--
--pppppppppppp--
--############--
--############--
----------------
----------------
----------------
----------------
--pppppppppppp--
--pppppppppppp--
--############--
--############--
----------------
----------------
----------------
----------------
-------p--------
------ppp-------
-------p--------
------ppp-------
------ppp-------
-------p--------
------ppp-------
-------p--------
-------#--------
------###-------
-------#--------
------###-------
------###-------
-------#--------
------###-------
-------#--------
----------------
----------------
----------------
----------------
--pppppppppppp--
--p----------p--
--p----------p--
--############--
--#----------#--
--#----------#--
----------------
----------------
--p----------p--
--p----------p--
--pppppppppppp--
--#----------#--
--#----------#--
--############--
----------------
----------------
----------------
----------------
--pppppppppppp--
--p----------p--
--p-pppppppp-p--
----p-----------
-----------p----
--p-pppppppp-p--
--p----------p--
--pppppppppppp--
--############--
--#----------#--
--#-########-#--
----#-----------
-----------#----
--#-########-#--
--#----------#--
--############--
----------------
----------------
----------------
----------------
--pppppppppppp--
--p----------p--
--p-ppp-pppp-p--
----ppp---pp----
----ppppp-pp----
--p-ppppp-pp-p--
--p----------p--
--pppppppppppp--
----------------
----------------
----------------
----------------
--pp--------pp--
--pp--------pp--
----------------
-------pp-------
-------pp-------
--p----------p--
--p----------p--
--pppppppppppp--
----------------
----------------
----------------
----------------
--pp--------pp--
--pp--------pp--
----------------
-------pp-------
-------pp-------
----------------
--pp--------pp--
--pp--------pp--
----------------
----------------
----------------
----------------
--pp--------pp--
--pp--------pp--
----------------
----------------
----------------
----------------
--pp--------pp--
--pp--------pp--
----------------
----------------
----------------
----------------
--pp---pp---pp--
--pp---pp---pp--
----------------
----------------
----------------
----------------
--pp---pp---pp--
--pp---pp---pp--
----------------
----------------
----------------
----------------
--pp---pp---pp--
--pp---pp---pp--
----------------
--pp---pp---pp--
--pp---pp---pp--
----------------
--pp---pp---pp--
--pp---pp---pp--
----------------
----------------
----------------
----------------
---p----p----p--
--pp---pp---pp--
----------------
---p----p----p--
--pp---pp---pp--
----------------
---p----p----p--
--pp---pp---pp--
----------------
----------------
----------------
----------------
--pp---pp---pp--
--p----------p--
----------------
--p----pp----p--
--p----pp----p--
----------------
--p----------p--
--pp---pp---pp--
----------------
----------------
----------------
----------------
--pp---pp---pp--
--p----------p--
----------------
--p----------p--
--p----------p--
----------------
--p----------p--
--pp---pp---pp--
----------------
----------------
----------------
----------------
--pp---pp---pp--
--p----------p--
-----pp--pp-----
--p--p----p--p--
--p--p----p--p--
-----pp--pp-----
--p----------p--
--pp---pp---pp--
--############--
--#----------#--
--#-###-####-#--
----###---##----
----#####-##----
--#-#####-##-#--
--#----------#--
--############--
----------------
----------------

View File

@ -1,64 +0,0 @@
++++++++++++++++
++++++++++++++++
++##ffffffff##++
++#"--------"#++
++f---a--a---f++
++-----------f++
++-----------f++
++f---a--a---f++
++#"--------"#++
++##ffffffff##++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++ffff----ffff++
++fppf-a--fppf++
++ffff--l-ffff++
++------a-----++
++------------++
++ffff-a--ffff++
++fppf-l--fppf++
++ffff--a-ffff++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++###########"++
++#----------#++
++#-####"###-#++
++--#aa--aa#-#++
++--#--------#++
++#-####"###-#++
++#----------#++
++"###########++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++--pppppppp--++
++--pffffffp--++
++--pfl--afp--++
++-------afp--++
++-------afp--++
++--pfl--afp--++
++--pffffffp--++
++--pppppppp--++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++pppppppppppp++
++ppffffffffpp++
++fffa----afff++
++------l-----++
++-----l------++
++fffa----afff++
++ppffffffffpp++
++pppppppppppp++
++++++++++++++++
++++++++++++++++

Some files were not shown because too many files have changed in this diff Show More