Compare commits

...

167 Commits

Author SHA1 Message Date
George Sokianos c076098ad9 Fixed hiscore date and compiled with latest SDL 2023-07-04 20:52:03 +01:00
George Sokianos 5dd814e452 Prepare first release 2022-12-21 17:46:45 +00:00
George Sokianos 43c8bd610f Some more fixes and minor changes 2022-09-10 11:57:02 +01:00
George Sokianos 6a78b47ae6 Cleaned up the makefile.os4 2022-09-09 23:38:37 +01:00
George Sokianos 2b1fd35298 Added makefile for OS4 and some fixes to make texts show right 2022-08-31 22:39:46 +01:00
lprobert fc6bb50460
Fixes a bunch of lint errors 2022-08-24 16:00:13 +02:00
lprobert 2aba6c4338
Adds setup/teardown to Makefile 2022-08-24 15:26:02 +02:00
Linus Probert 39bc060a77
Adds maintenance badge 2021-10-05 09:28:01 +02:00
Linus Probert abef4ed9a6
Patches all CMakeLists.txt to new CMake version 2021-10-05 09:15:29 +02:00
Linus Probert 26c5448a30
Fixes linting and some lint warnings 2020-07-11 10:16:57 +02:00
Linus Probert 1a559741e2
Create FUNDING.yml 2020-05-27 21:25:12 +02:00
Linus Probert 38207e03d1 Patch version raised to 3 2020-03-04 21:51:31 +01:00
Linus Probert e636ec1e53 Don't delete saves from other architectures on death 2020-03-04 21:50:51 +01:00
417e7d3cc8 Patch version raised to 2 2020-03-04 17:06:57 +01:00
Linus Probert 4edeb17ddc Fixes cross save problems due to architecture differences 2020-03-04 17:03:02 +01:00
Linus Probert de770ccc9f Patch version raised to 1 2020-03-04 12:50:39 +01:00
Linus Probert 8a347790c1 Update major version 2020-03-04 12:50:20 +01:00
Linus Probert 5a9335576a Completes game saving and resuming 2020-03-03 23:50:11 +01:00
Linus Probert b385f6e73a Don't want to store compile commands like this 2020-03-03 13:57:44 +01:00
Linus Probert 4106a856fc Begin an idea for "continue game" functionality 2020-03-03 13:07:32 +01:00
Linus Probert 8221304df8 Fixes some odd indentations 2019-12-03 15:18:47 +01:00
Linus Probert 4ceb82f171 Fixes MAGICAL achievemnt 2019-06-10 11:37:13 +02:00
Linus Probert 9e5e1d0a1e Patch version raised to 2 2019-06-10 11:20:24 +02:00
Linus Probert 6d323ca500 Adds steam achievements and LB for the Mage class 2019-06-10 11:19:40 +02:00
Linus Probert 9aefed0d00 Adds an dev env setup script 2019-06-10 09:43:39 +02:00
Linus Probert f102e49daf Realeasenotes v3.1.1 2019-06-10 09:19:43 +02:00
Linus Probert 392edd843c Updates blink tooltip to include item pickups. 2019-06-07 07:45:36 +02:00
Boris Vanhoof 6584981d10 remove unnecessary pickup 2019-06-06 23:56:15 +02:00
Boris Vanhoof d2cf79710a Mage blink skill pickup items in the path #60 2019-06-06 23:56:15 +02:00
Boris Vanhoof 78e9413188 Fix : Missing with vampiric blow doesn't seem to trigger a 'Dodge' action text #59 2019-06-06 00:53:52 +02:00
Linus Probert af957eb662 Disables mouse square rendering for all classes 2019-05-25 13:18:25 +02:00
Linus Probert 1d988d7f2f Fixes working explosions and artifacts
Artifacts:
- Explosive daggers
- Explosive kills
2019-05-25 13:11:24 +02:00
Linus Probert 68f4e152d3 Fixes returning daggers and resets erupt attack 2019-05-20 15:37:25 +02:00
Linus Probert 7f232beb32 A beginning to the new exploding artifacts 2019-05-16 07:43:19 +02:00
Linus Probert 12aff9afad Fixes erupt so it has a base push of 1 2019-05-15 20:33:56 +02:00
Linus Probert 2dc25c9b53 Adds the DAGGER_MAGNET artifact
* Adds sprites for volotile and synamite as well
2019-05-15 20:32:48 +02:00
Linus Probert 5e67ca7ef7 Removes stun from backstab skill 2019-05-15 07:50:45 +02:00
Linus Probert cac3fea106 Altered the vampiric blow icon slightly 2019-05-15 07:46:27 +02:00
Linus Probert 9ed80acbee Removes erupt test code 2019-05-14 22:48:29 +02:00
Linus Probert 05cbce0abc Adds vampiric blow icon 2019-05-14 22:47:35 +02:00
Linus Probert 6c135c6b9c Adds gui display for held keys
Also makes the gold key actually golden
2019-05-14 22:27:13 +02:00
Linus Probert fb031e2af3 Bumps version 2019-05-14 20:36:00 +02:00
Linus Probert b861e6e452 Fixes SENTINEL monsters from ignoring forced fear 2019-05-14 16:30:02 +02:00
Linus Probert 046551ad6d Changes ERUPT to cause fear instead of bleeding 2019-05-14 16:10:28 +02:00
Linus Probert 8fb1bbcc1e Fixes bug with erupt pushing direction 2019-05-14 15:57:36 +02:00
Linus Probert 35164a9876 Introduces vampiric blow
Icon isn't done yet.
2019-05-14 15:20:45 +02:00
Linus Probert dd3e84d70d Makes critical hits cause bleeding 2019-05-14 10:26:28 +02:00
Linus Probert 8f21e8bfb2 Prevents skill radius from impacting push back range 2019-05-14 09:00:59 +02:00
Linus Probert 2b743160aa Updates erupt tooltip to mention push back 2019-05-14 08:56:39 +02:00
Linus Probert 7ddaab816e Make erupt always push back 1 tile without any artifacts 2019-05-14 08:38:42 +02:00
Linus Probert 43ca8f4560 Fixes #58 - Game crash with AOE attacks 2019-05-14 08:36:37 +02:00
Linus Probert ef5cd4e244 Adds PUSH_BACK and SKILL_RADIUS effects to erupt skill 2019-05-14 08:27:49 +02:00
Linus Probert b00e607dec Start with debug gold 2019-05-10 12:51:42 +02:00
Linus Probert 67e29d609d Added the SKILL_RADIUS artifact (not used yet)
Also drops the levelcap on artifact drops. I don't think it really
matters if you get an artifact before you have the skill. This should
make the shop a bit more useful.
2019-05-10 12:47:33 +02:00
Linus Probert 81e7df1920 Adds skill icons for the two mage skills 2019-05-09 21:06:06 +02:00
Linus Probert 18effa2416 Rogue backstab skill now triggers bleeding as well 2019-05-09 16:13:25 +02:00
Linus Probert c043ad09cf Implements the erupt skill
Also fixed monsters dying through bleeding logic
2019-05-09 16:02:33 +02:00
Linus Probert 223a3b00c1 Implements the blink skill
The icon still needs to be created but the skill is complete
2019-05-09 10:16:38 +02:00
Linus Probert 2ca78e2ec7 Adds monster bleed damage every turn 2019-05-08 12:59:15 +02:00
Linus Probert 0476d4d1bd Introduces particle emitters on monsters
Also adds the bleed emitter to monsters for later use with the mage.
2019-05-07 11:52:30 +02:00
Linus Probert 826cbe11ff A quick start to the Mage 2019-05-06 13:48:40 +02:00
Linus Probert fcc6527a93 Minor fix 2019-04-23 16:06:20 +02:00
Linus Probert b409b76eca Improved build instruction structure 2019-04-23 16:05:47 +02:00
Andriy Svyryd b0753901ec React to PR feedback 2019-04-23 15:55:20 +02:00
Andriy Svyryd 86e6f66b58 Adds Windows compilation instructions 2019-04-23 15:55:20 +02:00
Linus Probert c0a4a4eb93 Make ninja builds smoother 2019-04-06 12:27:42 +02:00
Linus Probert c917981bad Patch version raised to 2 2019-03-24 17:19:44 +01:00
Linus Probert c2b8fd40eb Adds key pickup SFX 2019-03-24 12:20:45 +01:00
Linus Probert 7a59d15be0 Don't add walls to crumbling rooms before lvl 4 2019-03-24 12:13:38 +01:00
Linus Probert c9fde8dde1 Updated releasenotes 2019-03-21 15:58:23 +01:00
Linus Probert c4811ed073 Fixes checksumtool output again 2019-03-21 10:01:04 +01:00
Linus Probert eceb241162 Removes useless text from checksumtool output 2019-03-21 08:53:31 +01:00
Linus Probert cea891f87d Move checksum configuration to CMakeLists.txt and config.h 2019-03-21 08:52:39 +01:00
Linus Probert 8e282304ad Fixes release notes 2019-03-20 20:29:59 +01:00
Linus Probert 53703f1761 Patch version raised to 1 2019-03-20 20:28:29 +01:00
Linus Probert ce182ad20f Updates checksums 2019-03-20 20:27:06 +01:00
Linus Probert ebfe2715e0 Fixes compile error and some graphical issues
- Keys and artifacts should render on to of other items
- Locked doors will impact surrounding wall layouts
2019-03-20 19:56:30 +01:00
Linus Probert 2ae6ada297 Completes locked room generation 2019-03-20 09:53:35 +01:00
Linus Probert 18987e2c2a Incomplete monster key fixes 2019-03-19 21:54:58 +01:00
Linus Probert 59a1e81c6e Implementation of keys. Completely untested 2019-03-18 11:39:26 +01:00
Linus Probert 1065216b67 Include all files in pack files 2019-03-16 10:32:58 +01:00
Linus Probert 68533f05b3 Remove memory leaks from map destruction 2019-03-15 16:00:20 +01:00
Linus Probert 38dc3deb2c Merge branch 'dev' of github.com:liquidityc/breakhack into dev 2019-03-14 19:15:52 +01:00
Linus Probert beda4f6c7e Reduces fairy frequency 2019-03-14 19:15:45 +01:00
Linus Probert e50d40fb1c Adds doors and greater chance of walls 2019-03-14 19:11:25 +01:00
Linus Probert 0983bd1bd2 Fixes a weird issue with missing code 2019-03-14 08:52:27 +01:00
Linus Probert 184b42ff5a Fixes door logic 2019-03-11 16:28:57 +01:00
Linus Probert e42e0243af Adds some door logic 2019-03-11 16:22:39 +01:00
Linus Probert 756afbae9d Separates walls from regular tiles 2019-03-11 16:21:15 +01:00
Linus Probert 40a20e936c Adapts fopen/fopen_s to WIN32/GCC compile 2019-03-11 08:02:31 +01:00
Linus Probert af930f6b23 Fixes win compiler warnings 2019-03-11 07:27:50 +01:00
Linus Probert c4fd16d925 Updated dll checksums for windows build 2019-03-11 07:21:43 +01:00
Linus Probert f840b28839 Adds mediocre crack protection
- Added a simple checksum calculation lib
- Validates the hardcoded "lib file" checksum against the calculated
    checksum.

By looking at instructions for the cracked version of BreakHack on
various sites that show up on google it seems that the common theme is
to replace the steamlib dll/so with a modified version. Now the Steam
version of the game will validate a hardcoded checksum against a live
validated version to see if everything seems ok before boot.

It's not a major hinderance but it should eliminate the more basic
sites modus operandi.

Honestly I don't really care if people steal the game. IT'S OPEN SOURCE
FFS!

And the above exclamation confirms why I did this. Also, I wanted to se
if it was possible. Game on Crackers! :D
2019-03-11 00:06:06 +01:00
Linus Probert 7fbeaa3907 Introduced base structure for doors in maps 2019-03-10 19:33:47 +01:00
Linus Probert 3e43c30bcb Adds funny casting to avoid pedantic ISO C warning 2019-03-10 07:30:12 +01:00
Linus Probert fd3a625249 Adds monster bloodlust
- Introduces the beginning of an event listener system
- Introduces fairies. When they are killed monsters in the room rage!
2019-03-10 00:15:47 +01:00
Linus Probert d749861477 Make jumbled rooms more likely 2019-03-09 08:55:59 +01:00
Linus Probert 7ab5ece83b Nicer wall decorations on interior walls 2019-03-08 16:58:25 +01:00
Linus Probert 8c9622d6bd Shopkeeper now has bodyguards next time you meet after kiling him
Fixed cl warnings in cmake and added some more walldecorations as well.
Wall decorations needs better logic so we get the right decoration on
the right tile.
2019-03-08 14:39:23 +01:00
Linus Probert af0c61684d Adds juice
- Dust puffs when tiles begin to fall
- Fixed shop prices. 100 gold is a lot of money and it impacts your
    score when buying.
2019-03-08 13:02:56 +01:00
Linus Probert 46fbdc1b3c Fixed jumble layout logic 2019-03-08 12:39:21 +01:00
Linus Probert b40c54a88d Layouts can now be jumbled with each other
This takes quadrants from 4 random layouts and creates a new layout
based on those quadrants.

This is not done for shop layouts.
2019-03-08 12:00:08 +01:00
Linus Probert 8f20f36db7 Lighting on wall layouts and aggro shopkeepers 2019-03-08 10:17:06 +01:00
Linus Probert 3ba33d8852 Adds light tiles to layout files and a shopkeeper
Next step is to add game logic for shopkeeper murderers and
ability to take items after the shopkeeper is dead.
2019-03-07 20:06:04 +01:00
Linus Probert 447c1a773c Monster shopkeeper logic 2019-03-07 15:31:09 +01:00
Linus Probert 7e1dffb45e Shops implemented
Only need to add the shopkeeper now
2019-03-07 11:09:14 +01:00
Linus Probert 6009aa17f1 Merge branch 'dev' into shops
Conflicts:
	src/artifact.c
2019-03-06 22:30:17 +01:00
Linus Probert 9b4a7b6cfc Removes crazy old bug that never presented itself before
This isn't an issue with the current release because destruction of
objects and artifact objects is identical. Only became an issue now that
the artifact struct and destruction is chaning.
2019-03-06 22:28:13 +01:00
Linus Probert 63812fbe05 More wall layouts and cordinated walls 2019-03-06 18:21:27 +01:00
Linus Probert c6a022e2db Moved text sprite logic to sprite_util 2019-03-04 20:32:09 +01:00
Linus Probert 06ca6c3e1e Not finnished yet, commit 2019-03-04 18:06:46 +01:00
Linus Probert bab5fd7980 Merge branch 'dev' into shops 2019-03-04 16:06:58 +01:00
Linus Probert 68f44090ed Add amt sprite to all items where value != 0 2019-03-04 16:06:13 +01:00
Linus Probert 959fae1730 Add value sprite to items.
Completely untested
2019-03-04 15:00:35 +01:00
Linus Probert ca41520c06 Wall layouts added to regular build 2019-03-04 13:13:58 +01:00
Linus Probert 88f4703d00 Some more fence layouts 2019-03-04 13:05:23 +01:00
Linus Probert 486c1bb641 Merge branch 'dev' into shops 2019-03-04 12:52:20 +01:00
Linus Probert 206f95f3b6 Fences and walls in layout files 2019-03-04 10:09:55 +01:00
Linus Probert 1c4e600dd4 Wall layout data 2019-03-04 07:35:26 +01:00
Linus Probert 57a16888b8 Merge branch 'dev' into shops 2019-03-01 12:44:49 +01:00
Linus Probert 13ca11c70e Begins refactoring of layout parser to accomodate more layout details 2019-03-01 12:44:12 +01:00
Linus Probert 33efba87b5 Merge branch 'dev' into shops 2019-03-01 08:58:33 +01:00
Linus Probert 5d61a91139 Split pit layout logic into separate file
The plan is to extend this further to incorporate walls and stuff.
This can later be used for the shop layout.
2019-03-01 08:57:15 +01:00
Linus Probert 6542e4f1d0 Moves item update to its own function 2019-02-28 21:53:30 +01:00
Linus Probert 7b47c6a6bf Completes buyable items 2019-02-28 20:37:19 +01:00
Linus Probert 16d9035941 Merge branch 'dev' into shops 2019-02-28 19:41:30 +01:00
Linus Probert 4054c37caa Ignore vscode_build dir 2019-02-28 19:41:07 +01:00
Linus Probert ad227f1bed A start to "priced" items 2019-02-28 13:49:15 +01:00
Linus Probert 37ba189e54 Suppress cppcheck issues 2019-02-28 13:31:56 +01:00
Linus Probert 645a02c99e Ignore .vscode folder 2019-02-27 10:40:43 +01:00
Linus Probert 35b5d7a8c1 Patch version raised to 4 2019-02-26 17:52:24 +01:00
Linus Probert c3464eb37d Fixes a typo 2019-02-26 17:51:46 +01:00
Linus Probert fe18240060 Patch version raised to 3 2019-02-26 17:30:15 +01:00
Linus Probert e4555237ed
Update README.md
Codefactor badge change
2019-02-26 12:02:32 +01:00
Linus Probert 791dd7ecfd Removes cppcheck warning 2019-02-26 12:02:04 +01:00
Linus Probert b08ef10e82 Code maintenance and cleanup 2019-02-26 11:59:07 +01:00
Linus Probert fffcac12c0 Makes sure til effects and items apply after backstab 2019-02-24 23:33:08 +01:00
Linus Probert 1b440c248d Patch version raised to 2 2019-02-24 23:02:08 +01:00
Linus Probert a03aec7c46 Handles the second mingw special case which I kept forgetting.
Because I'm an idiot
2019-02-24 22:48:03 +01:00
Linus Probert 0de018f3be Fix mingw preprocessor define from cmake 2019-02-24 22:42:51 +01:00
Linus Probert 3eeb4d05a9 Include mingw32 64bit in the exclusion 2019-02-24 22:37:45 +01:00
Linus Probert 5f369da4e1 Fixed preprocessor command for mingw 2019-02-24 22:34:20 +01:00
Linus Probert c98e6e6d05 Fix wonky mingw errors in appveyor 2019-02-24 22:31:32 +01:00
Linus Probert 499f015db9 Only use gmtime_s for MSVC 2019-02-24 20:05:23 +01:00
Linus Probert 9b9a0ca2a0 Fixed bad include 2019-02-24 20:01:06 +01:00
Linus Probert 926054b116 Ensure that we have seed when making a map 2019-02-24 19:57:33 +01:00
Linus Probert 49b7ebb923 Include patch notes for v2.2.1 2019-02-24 19:48:40 +01:00
Linus Probert ee4dd273b9 Patch version raised to 1 2019-02-24 19:46:18 +01:00
Linus Probert 5ee20c9c20 Shifted to safer time functions and utc time 2019-02-24 19:43:41 +01:00
Linus Probert 563ebf9204 Adds another build fix 2019-02-22 00:38:39 +01:00
Linus Probert 3533d5ca58 Fixes build again 2019-02-22 00:36:10 +01:00
Linus Probert 97b097af41 Fixes builds 2019-02-22 00:34:56 +01:00
Linus Probert 685bf97467 Makes the custom random generator deterministic across platforms
TIL that the generators are implemented according to spec but the
distributions are custom. Since this is C I think we can manage without
distributions.

This still needs a test.
2019-02-22 00:27:19 +01:00
Linus Probert cc375bba4e Implements control over lua random numbers 2019-02-22 00:09:31 +01:00
Linus Probert 1205856d00 Attempt att syncing random generation
The default rand() and srand() differ between msvc and gcc.
Attempting to fix this by implementing a custom C++ library.
2019-02-21 20:57:38 +01:00
Linus Probert d1efa8450d Create new leaderboards with attribute 'Descending' 2019-02-20 20:18:52 +01:00
Linus Probert 2775780d5b Makes weekly leaderboards creatable from app.
Removes dependency on breakhack.net if that site ever goes offline.
2019-02-20 20:03:06 +01:00
Linus Probert 269b25ba86 Removes a mingw warning 2019-02-20 19:48:24 +01:00
Linus Probert 72c3817927 Adds weekly challenge seed play and leaderboard saving 2019-02-20 19:45:55 +01:00
Linus Probert 1212b1a88a Weekly challenge option added to play menu 2019-02-20 18:08:13 +01:00
Linus Probert ce2a3482d1 Generate seeds from the core seed so that levels will look different. 2019-01-10 19:26:19 +01:00
Linus Probert bc9d37eb91 Connects the random seed through all the generators
This is very untested and I'm guessing that every level will look
identical with this implementation.

Need to extend this so that generation seeds are created on boot for
every level based on the original seed.

Perhaps the "attack"/"defend" seed should also differ from the
generation seed to prevent playthroughs from becoming completely
identical.
2018-12-17 13:10:11 +01:00
Linus Probert 3c7dcb5ea1 Begins new random impl 2018-12-17 13:09:04 +01:00
Linus Probert 57b57c5051 Patch version raised to 4 2018-12-04 14:31:33 +01:00
Linus Probert 4d01251d1f Merge branch 'master' into dev 2018-12-04 14:30:20 +01:00
Linus Probert 9299087b44 Updates PhysicsFS to latest stable-3.0
This should solve issues related to a crash on windows update 1809
2018-12-04 14:09:18 +01:00
Linus Probert cb2510cf77 Rename physfs folder 2018-12-04 13:59:34 +01:00
189 changed files with 4928 additions and 795 deletions

View File

@ -86,7 +86,7 @@ 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

12
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,12 @@
# 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']

6
.gitignore vendored
View File

@ -1,3 +1,5 @@
/.vscode/
/vscode_build/
/CMakeSettings.json
/_build/
/*.dll
@ -13,3 +15,7 @@
/steam_appid.txt
/*.so
/breakhack*.run
compile_commands.json
*.o
breakhack

4
.vimrc
View File

@ -5,5 +5,5 @@ nnoremap <F4> :ter ++close env LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./ ./_build/debu
packadd termdebug
let g:termdebug_wide = 1
let g:syntastic_c_include_dirs = [ '_build/debug', '/usr/include/SDL2', 'steamworks_c_wrapper/src' ]
let g:syntastic_cpp_include_dirs = [ 'steamworks_c_wrapper/sdk/public/steam' ]
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' ]

View File

@ -5,11 +5,15 @@ SET(CMAKE_COLOR_MAKEFILE ON)
project(breakhack C)
set(breakhack_GAME_TITLE "BreakHack")
set(breakhack_MAJOR_VERSION 2)
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)
include(FindLua)
include(FindPhysFS)
include(build/cmake/FindSDL2.cmake)
@ -25,6 +29,10 @@ 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)
@ -35,6 +43,8 @@ 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)
@ -42,6 +52,10 @@ 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()
@ -63,15 +77,17 @@ endif()
IF ( MSVC )
MESSAGE ( STATUS "Setting MSVC MT switches")
SET (
CMAKE_C_FLAGS_DEBUG
"${CMAKE_C_FLAGS_DEBUG} /MTd"
CACHE STRING "MSVC MT flags " FORCE
string (REPLACE
"/MDd"
"/MTd"
CMAKE_C_FLAGS_DEBUG
${CMAKE_C_FLAGS_DEBUG}
)
SET (
CMAKE_C_FLAGS_RELEASE
"${CMAKE_C_FLAGS_RELEASE} /MT"
CACHE STRING "MSVC MT flags " FORCE
string (REPLACE
"/MDd"
"/MTd"
CMAKE_C_FLAGS_RELEASE
${CMAKE_C_FLAGS_RELEASE}
)
ELSEIF ( WIN32 )
SET (
@ -105,10 +121,12 @@ if (NOT LUA_FOUND OR STEAM)
endif ()
if (NOT PHYSFS_FOUND OR STEAM)
add_subdirectory(physfs-3.0.1)
include_directories(physfs-3.0.1/src)
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.1/src)
set(PHYSFS_INCLUDE_DIR physfs-3.0/src)
endif ()
include_directories(
@ -120,6 +138,8 @@ include_directories(
${PHYSFS_INCLUDE_DIR}
${LUA_INCLUDE_DIR}
sqlite3
bh_random/src
checksum/src
)
if (CMOCKA_FOUND)
@ -145,14 +165,6 @@ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
if (STEAM)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSTEAM_BUILD")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DSTEAM_BUILD")
endif ()
if (NOT MSVC)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__FNAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")
else (NOT MSVC)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__FNAME__=__FILE__")
endif (NOT MSVC)
if (STEAM)
set(STEAM_SOURCES
src/steam/steamworks_api_wrapper
)
@ -160,58 +172,74 @@ 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 ()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__FNAME__=__FILE__")
endif ()
# PROGRAMS:
add_executable(breakhack
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/input
src/mixer
src/io_util
src/physfsrwops
src/skillbar
src/texturecache
src/skill
src/projectile
src/vector2d
src/map_room_modifiers
sqlite3/sqlite3
src/db
src/settings
src/actiontextbuilder
src/animation
src/trap
src/artifact
src/screen
src/hiscore
src/object
src/gui_util
src/tooltip
src/gamecontroller
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}
)
@ -232,6 +260,8 @@ target_link_libraries(breakhack
${SDL2_MIXER_LIBRARY}
${LUA_LIBRARIES}
${PHYSFS_LIBRARY}
bh_random
checksum
)
if (STEAM)
@ -241,11 +271,11 @@ if (STEAM)
endif ()
if (MSVC)
set_target_properties(breakhack PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
set_target_properties(breakhack PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE /NODEFAULTLIB:MSVCRTD")
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")
set_target_properties(breakhack PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS /NODEFAULTLIB:MSVCRTD")
set_target_properties(breakhack PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS")
endif (MSVC)
@ -253,19 +283,19 @@ endif (MSVC)
IF (CMOCKA_FOUND AND NOT OSX AND NOT CLANG)
find_package(Threads REQUIRED)
enable_testing()
add_executable(test_util test/test_util src/util)
add_executable(test_util test/test_util.c src/util.c)
target_link_libraries(test_util ${CMOCKA_LIBRARY})
add_test(test_util test_util)
add_executable(test_linkedlist test/test_linkedlist src/linkedlist src/util)
add_executable(test_linkedlist test/test_linkedlist.c src/linkedlist.c src/util.c)
target_link_libraries(test_linkedlist ${CMOCKA_LIBRARY})
add_test(test_linkedlist test_linkedlist)
add_executable(test_hashtable test/test_hashtable src/hashtable src/util)
add_executable(test_hashtable test/test_hashtable.c src/hashtable.c src/util.c)
target_link_libraries(test_hashtable ${CMOCKA_LIBRARY})
add_test(test_hashtable test_hashtable)
add_executable(test_input test/test_input src/input src/keyboard)
add_executable(test_input test/test_input.c src/input.c src/keyboard.c)
target_link_libraries(test_input
${CMOCKA_LIBRARY}
${SDL2_LIBRARY}
@ -279,7 +309,7 @@ ENDIF ()
# LINT:
if (CPPCHECK_FOUND)
add_custom_target(lint
COMMAND ${CPPCHECK_EXECUTABLE} --force --language=c --template=gcc --error-exitcode=1 --quiet --enable=warning,style,performance,portability,information,missingInclude src/
COMMAND ${CPPCHECK_EXECUTABLE} --force --language=c --template=gcc --error-exitcode=1 --quiet --suppress=missingInclude --enable=warning,style,performance,portability,information,missingInclude src/
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Run cppcheck"
)
@ -306,16 +336,13 @@ if (NOT DEBUG_BUILD)
"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 AND NOT MSVC)
add_definitions(-mwindows)
endif()
else()
if (WIN32)
add_definitions(-mconsole)
endif()
endif ()
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT "Release")

View File

@ -0,0 +1,10 @@
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

@ -0,0 +1,16 @@
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

@ -7,12 +7,12 @@ release:
.PHONY: release
clean:
@make clean -sC _build/debug
@make clean -sC _build/release
@make -sC _build/debug clean
@make -sC _build/release clean
.PHONY: clean
test:
@make test -sC _build/debug
@make -sC _build/debug test
.PHONY: test
run: $(all)
@ -21,12 +21,30 @@ run: $(all)
playtest: $(all)
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./ ./_build/release/breakhack
.PHONY: run
.PHONY: playtest
lint:
@make lint -sC _build/debug
@make -sC _build/debug lint
.PHONY: lint
package:
@make package -sC _build/release
@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

503
Makefile.os4 Normal file
View File

@ -0,0 +1,503 @@
#
# 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,7 +1,8 @@
[![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/master)](https://www.codefactor.io/repository/github/oliveshark/breakhack/overview/master)
[![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)
@ -46,16 +47,8 @@ BreakHack is released under two different licenses.
Compile
-------
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
```
* [Linux](LINUX_BUILD_INSTRUCTIONS.md)
* [Windows (Visual Studio)](MSVC_BUILD_INSTRUCTIONS.md)
Contribute
----------

48
README_Amiga.md Normal file
View File

@ -0,0 +1,48 @@
# 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

BIN
README_Amiga.md.info Normal file

Binary file not shown.

BIN
assets/Extras/Artifacts.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

BIN
assets/Extras/Keys.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
assets/Sounds/FX/blast.wav Normal file

Binary file not shown.

BIN
assets/Sounds/FX/blink.wav Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

29
bh_random/CMakeLists.txt Normal file
View File

@ -0,0 +1,29 @@
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

@ -0,0 +1,51 @@
/*
* 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();
}

31
bh_random/src/bh_random.h Normal file
View File

@ -0,0 +1,31 @@
/*
* 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,6 +64,14 @@
# (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
@ -87,7 +95,7 @@ FIND_LIBRARY(SDL2_LIBRARY_TEMP
NAMES SDL2
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib
PATH_SUFFIXES lib64 lib lib/${SDL2_PROCESSOR_ARCH}
PATHS ${SDL2_SEARCH_PATHS} ${SDL2_INCLUDE_DIR}/../..
)
@ -101,7 +109,7 @@ IF(NOT SDL2_BUILDING_LIBRARY)
NAMES SDL2main
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib
PATH_SUFFIXES lib64 lib lib/${SDL2_PROCESSOR_ARCH}
PATHS ${SDL2_SEARCH_PATHS}
)
ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")

View File

@ -28,6 +28,14 @@
# 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")
@ -48,7 +56,7 @@ find_library(SDL2_TTF_LIBRARY
HINTS
ENV SDLTTFDIR
ENV SDLDIR
PATH_SUFFIXES lib
PATH_SUFFIXES lib lib/${SDL2_PROCESSOR_ARCH}
)
if(SDL2_TTF_INCLUDE_DIR AND EXISTS "${SDL2_TTF_INCLUDE_DIR}/SDL_ttf.h")

View File

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

View File

@ -0,0 +1,16 @@
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

@ -0,0 +1,9 @@
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

@ -0,0 +1,4 @@
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

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

View File

@ -0,0 +1,60 @@
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

@ -0,0 +1,6 @@
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

@ -0,0 +1,40 @@
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

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

View File

View File

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

View File

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

View File

@ -0,0 +1,12 @@
#!/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 -

33
checksum/CMakeLists.txt Normal file
View File

@ -0,0 +1,33 @@
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 ()

61
checksum/src/checksum.c Normal file
View File

@ -0,0 +1,61 @@
/*
** 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

27
checksum/src/checksum.h Normal file
View File

@ -0,0 +1,27 @@
/*
* 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,6 +1,6 @@
local room_builder = require "maproombuilder"
local module = {}
local random = math.random
local random = map_random
local textures = {
"Items/Chest0.png",

406
data/layoutparser.lua Normal file
View File

@ -0,0 +1,406 @@
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

@ -0,0 +1,90 @@
++++++++++++++++
++++++++++++++++
++"#####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

@ -5,8 +5,8 @@ local chest_gen = require "chestgen"
-- Setting up some functions
local time = os.time
local random = math.random
local randomseed = math.randomseed
local random = map_random
local randomseed = map_randomseed
-- CONSTANTS
local UP = 1
@ -14,6 +14,8 @@ local LEFT = 2
local RIGHT = 3
local DOWN = 4
local lockedDoorsAdded = false
-- BEGIN FUNCTIONS
local function matrix_coverage (matrix)
local cov = 0
@ -43,15 +45,17 @@ local function generate_path ()
end
local cx, cy = 1, 1
local seed = time();
local seed = get_random_seed(CURRENT_LEVEL)
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
@ -59,6 +63,11 @@ local function generate_path ()
end
if ARCADE_MODE then
coverage = 40
shopLevel = true
end
if shopLevel then
coverage = coverage + 1
end
-- Create the first room
@ -114,17 +123,33 @@ local function generate_path ()
local roomCount = 0
local bossAdded = false
local shopAdded = false
-- Build all the rooms
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)
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)
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)
@ -157,4 +182,8 @@ for i=1,10 do
end
end
end
if lockedDoorsAdded then
add_keybearers(map)
end
-- END SCRIPT

View File

@ -1,5 +1,6 @@
-- FUNCTIONS
local random = math.random
local random = map_random
local layoutparser = require "layoutparser"
-- CONSTANTS
local UP = 1
@ -28,18 +29,10 @@ 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()
@ -49,9 +42,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
@ -60,42 +53,6 @@ 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 })
@ -103,9 +60,47 @@ 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(floorDecor, { td0, td1, 3 * 16, 20 * 16, true })
--table.insert(floorDecor, { td0, td1, 4 * 16, 20 * 16, true })
--table.insert(blockingFloorDecor, { td0, td1, 3 * 16, 20 * 16, true })
--table.insert(blockingFloorDecor, { 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 }
@ -126,100 +121,71 @@ local function repack(data)
isCollider = data[5] or false,
isLightSource = data[6] or false,
isLevelExit = data[7] or false,
isLethal = data[8] or false
isLethal = data[8] or false,
lockType = data[9] or 0
}
end
local function add_random_decor_to_room(room)
local decor_count = random(8)
for i=1,decor_count do
x = random(11) + 1
y = random(8) + 1
if not room.decor[x][y] then
room.decor[x][y] = floorDecor[random(#floorDecor)]
end
end
if random(2) == 1 then
room.decor[4][3] = lightDecor.candle2
end
if random(2) == 1 then
room.decor[11][3] = lightDecor.candle2
end
if random(2) == 1 then
room.decor[4][9] = lightDecor.candle2
end
if random(2) == 1 then
room.decor[11][9] = lightDecor.candle2
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])
end
local function add_pits_to_room(room)
if CURRENT_LEVEL < 2 or random(5) ~= 1 then
return false
local function add_random_decor_to_room(room, blockingDecor)
local decor_count = random(8)
if blockingDecor then
decor_count = random(4)
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
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
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
if c == "#" then
matrix[layout][col][row] = true
else
matrix[layout][col][row] = false
end
end
-- Chose a random layout
matrix = matrix[random(#matrix)]
for i=2,13 do
for j=2,10 do
if matrix[i][j] then
room.decor[i][j] = nil
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
room.tiles[i][j] = pits.innermid
elseif not matrix[i-1][j-1] and matrix[i-1][j] and matrix[i][j-1] then
room.tiles[i][j] = pits.innerleft
elseif not matrix[i+1][j-1] and matrix[i+1][j] and matrix[i][j-1] then
room.tiles[i][j] = pits.innerright
elseif not matrix[i-1][j] and not matrix[i][j-1] and not matrix[i+1][j] then
room.tiles[i][j] = pits.topcrevice
elseif not matrix[i-1][j] and not matrix[i+1][j] then
room.tiles[i][j] = pits.bottomcrevice
elseif not matrix[i-1][j] and not matrix[i][j-1] then
room.tiles[i][j] = pits.topleft
elseif not matrix[i+1][j] and not matrix[i][j-1] then
room.tiles[i][j] = pits.topright
elseif not matrix[i-1][j] then
room.tiles[i][j] = pits.left
elseif not matrix[i+1][j] then
room.tiles[i][j] = pits.right
elseif not matrix[i][j-1] then
room.tiles[i][j] = pits.top
else
room.tiles[i][j] = pits.center
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
end
end
end
end
return true
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)
@ -245,6 +211,8 @@ local function add_tiles_to_room (room, singletile)
else
room.tiles[i][j] = singletile and floor.single or floor.center
end
else
room.tiles[i][j] = floor.single
end
end
end
@ -254,17 +222,17 @@ local function add_walls_to_room (room)
for i=0,15 do
for j=0,11 do
if (i == 0 and j == 0) then
room.tiles[i][j] = wall.topleft
room.walls[i][j] = wall.topleft
elseif (i == 15 and j == 0) then
room.tiles[i][j] = wall.topright
room.walls[i][j] = wall.topright
elseif (i == 0 and j == 11) then
room.tiles[i][j] = wall.bottomleft
room.walls[i][j] = wall.bottomleft
elseif (i == 15 and j == 11) then
room.tiles[i][j] = wall.bottomright
room.walls[i][j] = wall.bottomright
elseif (i == 0 or i == 15) then
room.tiles[i][j] = wall.vertical
room.walls[i][j] = wall.vertical
elseif (j == 0 or j == 11) then
room.tiles[i][j] = wall.horizontal
room.walls[i][j] = wall.horizontal
end
end
end
@ -272,10 +240,12 @@ end
local function build_vert_center_coridoor(room, offset)
for i=0,4 do
room.tiles[6][offset+i] = wall.vertical
room.walls[6][offset+i] = wall.vertical
room.tiles[7][offset+i] = floor.center
room.tiles[8][offset+i] = floor.center
room.tiles[9][offset+i] = wall.vertical
room.walls[7][offset+i] = nil
room.walls[8][offset+i] = nil
room.walls[9][offset+i] = wall.vertical
end
if random(2) == 1 then
room.decor[6][offset+2] = lightDecor.candle1
@ -287,10 +257,12 @@ end
local function build_horiz_center_coridoor(room, offset)
for i=0,6 do
room.tiles[offset+i][4] = wall.horizontal
room.walls[offset+i][4] = wall.horizontal
room.tiles[offset+i][5] = floor.center
room.tiles[offset+i][6] = floor.center
room.tiles[offset+i][7] = wall.horizontal
room.walls[offset+i][5] = nil
room.walls[offset+i][6] = nil
room.walls[offset+i][7] = wall.horizontal
end
if random(2) == 1 then
room.decor[offset+3][4] = lightDecor.candle1
@ -303,32 +275,32 @@ end
local function build_center_corner_walls(room, exits)
if exits.down then
if exits.left then
room.tiles[6][7] = wall.topright
room.walls[6][7] = wall.topright
end
if exits.right then
room.tiles[9][7] = wall.topleft
room.walls[9][7] = wall.topleft
end
else
if not exits.left then
room.tiles[6][7] = wall.bottomleft
room.walls[6][7] = wall.bottomleft
end
if not exits.right then
room.tiles[9][7] = wall.bottomright
room.walls[9][7] = wall.bottomright
end
end
if exits.up then
if exits.left then
room.tiles[6][4] = wall.bottomright
room.walls[6][4] = wall.bottomright
end
if exits.right then
room.tiles[9][4] = wall.bottomleft
room.walls[9][4] = wall.bottomleft
end
else
if not exits.left then
room.tiles[6][4] = wall.topleft
room.walls[6][4] = wall.topleft
end
if not exits.right then
room.tiles[9][4] = wall.topright
room.walls[9][4] = wall.topright
end
end
end
@ -336,25 +308,33 @@ end
local function add_exits_to_room(room)
for _,direction in ipairs(room.exits) do
if direction == UP then
room.tiles[6][0] = wall.bottomright
room.walls[6][0] = wall.bottomright
room.tiles[7][0] = floor.singleleft
room.tiles[8][0] = floor.singleright
room.tiles[9][0] = wall.bottomleft
room.walls[7][0] = nil
room.walls[8][0] = nil
room.walls[9][0] = wall.bottomleft
elseif direction == LEFT then
room.tiles[0][4] = wall.bottomright
room.walls[0][4] = wall.bottomright
room.tiles[0][5] = floor.singletop
room.tiles[0][6] = floor.singlebottom
room.tiles[0][7] = wall.topright
room.walls[0][5] = nil
room.walls[0][6] = nil
room.walls[0][7] = wall.topright
elseif direction == RIGHT then
room.tiles[15][4] = wall.bottomleft
room.walls[15][4] = wall.bottomleft
room.tiles[15][5] = floor.singletop
room.tiles[15][6] = floor.singlebottom
room.tiles[15][7] = wall.topleft
room.walls[15][5] = nil
room.walls[15][6] = nil
room.walls[15][7] = wall.topleft
elseif direction == DOWN then
room.tiles[6][11] = wall.topright
room.walls[6][11] = wall.topright
room.tiles[7][11] = floor.singleleft
room.tiles[8][11] = floor.singleright
room.tiles[9][11] = wall.topleft
room.walls[7][11] = nil
room.walls[8][11] = nil
room.walls[9][11] = wall.topleft
end
end
end
@ -376,18 +356,19 @@ local function build_coridoor_room(room)
end
-- Fill the center
room.tiles[6][5] = wall.vertical
room.tiles[6][6] = wall.vertical
room.tiles[7][4] = wall.horizontal
room.tiles[7][5] = floor.center
room.tiles[7][6] = floor.center
room.tiles[7][7] = wall.horizontal
room.tiles[8][4] = wall.horizontal
room.tiles[8][5] = floor.center
room.tiles[8][6] = floor.center
room.tiles[8][7] = wall.horizontal
room.tiles[9][5] = wall.vertical
room.tiles[9][6] = wall.vertical
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
-- Build the coridoors
if exits.down then build_vert_center_coridoor(room, 7) end
@ -398,19 +379,8 @@ local function build_coridoor_room(room)
build_center_corner_walls(room, exits)
end
local function room_tile_available(room, rx, ry)
return not room.chests[rx][ry]
and not room.traps[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])
end
local function add_level_exit(room)
success = false
local success = false
while not success do
x = random(14)
y = random(10)
@ -421,14 +391,39 @@ local function add_level_exit(room)
end
end
local function build_normal_room(room)
local crumbling = (CURRENT_LEVEL > 3 or QUICK_MODE) and random(8) == 1
add_tiles_to_room(room, crumbling)
add_random_decor_to_room(room)
local function build_shop_room(room, roomx, roomy)
add_tiles_to_room(room, false)
add_walls_to_room(room)
add_exits_to_room(room)
local pitsAdded = crumbling or add_pits_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)
@ -440,7 +435,7 @@ local function build_normal_room(room)
elseif (CURRENT_LEVEL > 3 or QUICK_MODE) and random(8) == 1 then
room.modifier.type = "FIRE"
room.modifier.arg = ""
elseif ((not pitsAdded and (CURRENT_LEVEL > 1 or QUICK_MODE)) or CURRENT_LEVEL > 3) and random(8) == 1 then
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)]
@ -478,6 +473,8 @@ function module.create_empty_room()
path_dir = 0,
type = "room",
tiles = {},
walls = {},
doors = {},
decor = {},
modifier = {
type = nil,
@ -489,12 +486,16 @@ function module.create_empty_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
@ -504,11 +505,16 @@ function module.create_empty_room()
return room
end
function module.build_room(room)
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)
end
end
@ -518,6 +524,12 @@ function module.load_room(map, room)
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
@ -531,13 +543,16 @@ 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")
math.randomseed(os.time())
local seed = get_random_seed(CURRENT_LEVEL);
info("Map room random seed: " .. seed)
map_randomseed(seed)
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 }
@ -553,19 +568,6 @@ function module.load_textures(map)
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 }
wall.bottomleft = { t_wall, -1, xo + 0, yo + 32, true }

View File

@ -9,7 +9,7 @@ room_builder.load_textures(map)
set_current_room(map, 0, 0)
local room = room_builder.create_empty_room()
room_builder.build_room(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)

View File

@ -1,6 +1,6 @@
local room_builder = require "maproombuilder"
local module = {}
local random = math.random
local random = map_random
local texturePaths = {
aquatic0 = "Characters/Aquatic0.png",
@ -106,7 +106,14 @@ local stats = {
atk = 0,
def = 0,
speed = 1
}
},
shopkeeper = {
hp = 200,
dmg = 10,
atk = 2,
def = 0,
speed = 1
},
}
local function concat(table1, table2)
@ -162,6 +169,18 @@ 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 },
@ -270,6 +289,31 @@ 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,
@ -327,6 +371,7 @@ if(CURRENT_LEVEL > 0) then
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
@ -339,7 +384,8 @@ local function add_monster_to_tile(room, roomx, roomy, rx, ry, monster)
end
function module.add_monsters_to_room(room, roomx, roomy)
local addSpecial = addSpecialInLevel and random(5) == 1
local addSpecial = addSpecialInLevel and random(2) == 1
local addFairy = random(4) == 1
local count = random(3)
if (CURRENT_LEVEL > 3) then
count = random(4)
@ -354,6 +400,9 @@ function module.add_monsters_to_room(room, roomx, roomy)
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
@ -384,6 +433,42 @@ function module.add_boss_to_room(room, roomx, roomy)
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

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,194 @@
----------------
----------------
----------------
--############--
--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--
----------------
----------------

64
data/shoplayouts.dat Normal file
View File

@ -0,0 +1,64 @@
++++++++++++++++
++++++++++++++++
++##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++
++++++++++++++++
++++++++++++++++

View File

@ -1,6 +1,6 @@
local room_builder = require "maproombuilder"
local module = {}
local random = math.random
local random = map_random
local textures = {
"Objects/Trap1.png",

90
data/walllayouts.dat Normal file
View File

@ -0,0 +1,90 @@
++++++++++++++++
++++++++++++++++
++/#--------#/++
++##--------##++
++------------++
++------------++
++------------++
++------------++
++##--------##++
++/#--------#/++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++#--#-#-#-#-#++
++---c--------++
++/-#-#-#-#--/++
++-------c----++
++/--#-#-#-#-/++
++------------++
++--#-#-#-#---++
++#-########-#++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++############++
++#----------#++
++#-/#######-#++
++--#------#-#++
++--d--cc--d-#++
++#-/#######-#++
++#----------#++
++############++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++/#--------#/++
++##-ffffdf-##++
++---f--c-f---++
++---f----f---++
++---f-c--f---++
++---f----f---++
++##-fdffff-##++
++/#--------#/++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++/#ffffffff#/++
++#----------#++
++---######---++
++---d----#---++
++---#-cc-d---++
++---######---++
++#----------#++
++/#ffffffff#/++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++/##########/++
++d-----d----d++
++#c----#---c#++
++############++
++#----#-----#++
++#-c--d--c--#++
++d----#-----d++
++/##########/++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++++++++++++++++
++/####-#####/++
++#--c#-#c---#++
++d---#-#----d++
++#####-######++
++------------++
++#####-######++
++d--c#-#c---d++
++/####-#####/++
++++++++++++++++
++++++++++++++++

View File

@ -1,4 +0,0 @@
repo: 7672c9962ce627edaaa67ff54fe4ad8f9a46dc2b
node: fa8e38bcc3545000a38704b65b604a2c1b764d10
branch: stable-3.0
tag: release-3.0.1

View File

@ -1,2 +0,0 @@
syntax:glob
cmake-build

View File

@ -1,15 +0,0 @@
0bb92a5f0fffd2452cc737346e8b796c213a5688 release-0.1.1
2f2afcbd8abd784f738ac45b0368044763d63748 release-0.1.0
3c7cf50a58fbf220154acd4bdfdf00a21f259eb7 release-0.1.8
473b50402f55b2340fc286775d1b78d18a810362 release-0.1.3
60b5f566a2585d78b2ffadd8d9c16299d0340820 release-1.0.0
67aff4091bf129f7167ed87f937b15f31093e19e release-0.1.9
6ad1722bbcaec1265cb74c9b7be13fe02a547d37 release-0.1.7
8f3ccaaea1cd5dc19235882494d6102e5e9176fb release-0.1.2
c966316c89981bea6ccaa2c2909bb303bfeeb82b release-0.1.6
d2f04ab4b4127757234af6b30bfc98ad4ee9cb15 release-0.1.4
d94f1ccac8095509c57ad640d54796aea0d260f0 release-0.1.5
fe0c1d6f40afa6fca09a277a1ade59231f16c66f release-1.1.1
5d70fca3be361258edfb59c3edaba5abe75a1e88 release-2.0.0
df04959950eb3830c39adfa983789f70f86062d7 release-1.1.0
3396e6dd19fbb52a3fa7e171ffb38ed9acb285a4 release-2.1.1

View File

@ -9,7 +9,7 @@
# compile, using preprocessor checks for platform-specific bits instead of
# testing in here.
cmake_minimum_required(VERSION 2.8.4)
cmake_minimum_required(VERSION 3.6)
project(PhysicsFS)
set(PHYSFS_VERSION 3.0.1)
@ -168,7 +168,7 @@ if(PHYSFS_BUILD_STATIC)
set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static")
endif()
option(PHYSFS_BUILD_SHARED "Build shared library" FALSE)
option(PHYSFS_BUILD_SHARED "Build shared library" TRUE)
if(PHYSFS_BUILD_SHARED)
add_library(physfs SHARED ${PHYSFS_SRCS})
set_target_properties(physfs PROPERTIES MACOSX_RPATH 1)
@ -192,7 +192,7 @@ if(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC AND NOT WINDOWS)
set_target_properties(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
endif()
option(PHYSFS_BUILD_TEST "Build stdio test program." FALSE)
option(PHYSFS_BUILD_TEST "Build stdio test program." TRUE)
mark_as_advanced(PHYSFS_BUILD_TEST)
if(PHYSFS_BUILD_TEST)
find_path(READLINE_H readline/readline.h)

View File

@ -1,5 +1,5 @@
Copyright (c) 2001-2017 Ryan C. Gordon and others.
Copyright (c) 2001-2018 Ryan C. Gordon and others.
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from

View File

@ -164,6 +164,9 @@ CMake fixes:
Bug fixes,
Rémi Verschelde
Bug fixes:
Rob Loach
Other stuff:
Your name here! Patches go to icculus@icculus.org ...

View File

@ -50,18 +50,22 @@ static int locateOneElement(char *buf)
ptr++; /* point past dirsep to entry itself. */
} /* else */
for (i = rc; *i != NULL; i++)
if (rc != NULL)
{
if (PHYSFS_utf8stricmp(*i, ptr) == 0)
for (i = rc; *i != NULL; i++)
{
strcpy(ptr, *i); /* found a match. Overwrite with this case. */
PHYSFS_freeList(rc);
return 1;
} /* if */
} /* for */
if (PHYSFS_utf8stricmp(*i, ptr) == 0)
{
strcpy(ptr, *i); /* found a match. Overwrite with this case. */
PHYSFS_freeList(rc);
return 1;
} /* if */
} /* for */
PHYSFS_freeList(rc);
} /* if */
/* no match at all... */
PHYSFS_freeList(rc);
return 0;
} /* locateOneElement */

View File

@ -32,10 +32,16 @@
#endif
#if !TARGET_SDL2
#ifndef RW_SEEK_SET
#define RW_SEEK_SET SEEK_SET
#endif
#ifndef RW_SEEK_CUR
#define RW_SEEK_CUR SEEK_CUR
#endif
#ifndef RW_SEEK_END
#define RW_SEEK_END SEEK_END
#endif
#endif
#if TARGET_SDL2
static Sint64 SDLCALL physfsrwops_size(struct SDL_RWops *rw)

View File

@ -879,13 +879,20 @@ static DirHandle *openDirectory(PHYSFS_Io *io, const char *d, int forWriting)
if (io == NULL)
{
/* file doesn't exist, etc? Just fail out. */
PHYSFS_Stat statbuf;
BAIL_IF_ERRPASS(!__PHYSFS_platformStat(d, &statbuf, 1), NULL);
/* DIR gets first shot (unlike the rest, it doesn't deal with files). */
retval = tryOpenDir(io, &__PHYSFS_Archiver_DIR, d, forWriting, &claimed);
if (retval || claimed)
return retval;
if (statbuf.filetype == PHYSFS_FILETYPE_DIRECTORY)
{
retval = tryOpenDir(io, &__PHYSFS_Archiver_DIR, d, forWriting, &claimed);
if (retval || claimed)
return retval;
} /* if */
io = __PHYSFS_createNativeIo(d, forWriting ? 'w' : 'r');
BAIL_IF_ERRPASS(!io, 0);
BAIL_IF_ERRPASS(!io, NULL);
created_io = 1;
} /* if */
@ -2662,7 +2669,6 @@ static int closeHandleInOpenList(FileHandle **list, FileHandle *handle)
{
FileHandle *prev = NULL;
FileHandle *i;
int rc = 1;
for (i = *list; i != NULL; i = i->next)
{
@ -2670,9 +2676,16 @@ static int closeHandleInOpenList(FileHandle **list, FileHandle *handle)
{
PHYSFS_Io *io = handle->io;
PHYSFS_uint8 *tmp = handle->buffer;
rc = PHYSFS_flush((PHYSFS_File *) handle);
if (!rc)
/* send our buffer to io... */
if (!PHYSFS_flush((PHYSFS_File *) handle))
return -1;
/* ...then have io send it to the disk... */
else if (io->flush && !io->flush(io))
return -1;
/* ...then close the underlying file. */
io->destroy(io);
if (tmp != NULL) /* free any associated buffer. */
@ -2970,7 +2983,7 @@ int PHYSFS_flush(PHYSFS_File *handle)
rc = io->write(io, fh->buffer + fh->bufpos, fh->buffill - fh->bufpos);
BAIL_IF_ERRPASS(rc <= 0, 0);
fh->bufpos = fh->buffill = 0;
return io->flush ? io->flush(io) : 1;
return 1;
} /* PHYSFS_flush */

View File

@ -225,11 +225,11 @@ extern "C" {
#if defined(PHYSFS_DECL)
/* do nothing. */
#elif (defined _MSC_VER)
#elif defined(_MSC_VER)
#define PHYSFS_DECL __declspec(dllexport)
#elif (defined __SUNPRO_C)
#elif defined(__SUNPRO_C)
#define PHYSFS_DECL __global
#elif ((__GNUC__ >= 3) && (!__EMX__) && (!sun))
#elif ((__GNUC__ >= 3) && (!defined(__EMX__)) && (!defined(sun)))
#define PHYSFS_DECL __attribute__((visibility("default")))
#else
#define PHYSFS_DECL

View File

@ -203,6 +203,8 @@ static void SZIP_closeArchive(void *opaque)
SZIPinfo *info = (SZIPinfo *) opaque;
if (info)
{
if (info->io)
info->io->destroy(info->io);
SzArEx_Free(&info->db, &SZIP_SzAlloc);
__PHYSFS_DirTreeDeinit(&info->tree);
allocator.Free(info);

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