Compare commits

...

9 Commits

31 changed files with 721 additions and 97 deletions

3
.gitignore vendored
View File

@ -16,3 +16,6 @@
/*.so /*.so
/breakhack*.run /breakhack*.run
compile_commands.json compile_commands.json
*.o
breakhack

View File

@ -184,62 +184,62 @@ endif ()
# PROGRAMS: # PROGRAMS:
add_executable(breakhack add_executable(breakhack
src/main src/main.c
src/texture src/texture.c
src/screenresolution src/screenresolution.c
src/sprite src/sprite.c
src/sprite_util src/sprite_util.c
src/util src/util.c
src/event src/event.c
src/player src/player.c
src/save src/save.c
src/map src/map.c
src/map_lua src/map_lua.c
src/camera src/camera.c
src/timer src/timer.c
src/roommatrix src/roommatrix.c
src/position src/position.c
src/monster src/monster.c
src/stats src/stats.c
src/actiontext src/actiontext.c
src/random src/random.c
src/time src/time.c
src/linkedlist src/linkedlist.c
src/hashtable src/hashtable.c
src/gui src/gui.c
src/item src/item.c
src/item_builder src/item_builder.c
src/pointer src/pointer.c
src/gui_button src/gui_button.c
src/particle_engine src/particle_engine.c
src/particle_emitter src/particle_emitter.c
src/menu src/menu.c
src/collisions src/collisions.c
src/keyboard src/keyboard.c
src/input src/input.c
src/mixer src/mixer.c
src/io_util src/io_util.c
src/physfsrwops src/physfsrwops.c
src/skillbar src/skillbar.c
src/texturecache src/texturecache.c
src/skill src/skill.c
src/projectile src/projectile.c
src/vector2d src/vector2d.c
src/map_room_modifiers src/map_room_modifiers.c
sqlite3/sqlite3 sqlite3/sqlite3.c
src/db src/db.c
src/settings src/settings.c
src/actiontextbuilder src/actiontextbuilder.c
src/animation src/animation.c
src/trap src/trap.c
src/artifact src/artifact.c
src/screen src/screen.c
src/hiscore src/hiscore.c
src/object src/object.c
src/gui_util src/gui_util.c
src/tooltip src/tooltip.c
src/gamecontroller src/gamecontroller.c
src/effect_util src/effect_util.c
${STEAM_SOURCES} ${STEAM_SOURCES}
) )
@ -283,19 +283,19 @@ endif (MSVC)
IF (CMOCKA_FOUND AND NOT OSX AND NOT CLANG) IF (CMOCKA_FOUND AND NOT OSX AND NOT CLANG)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
enable_testing() 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}) target_link_libraries(test_util ${CMOCKA_LIBRARY})
add_test(test_util test_util) 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}) target_link_libraries(test_linkedlist ${CMOCKA_LIBRARY})
add_test(test_linkedlist test_linkedlist) 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}) target_link_libraries(test_hashtable ${CMOCKA_LIBRARY})
add_test(test_hashtable test_hashtable) 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 target_link_libraries(test_input
${CMOCKA_LIBRARY} ${CMOCKA_LIBRARY}
${SDL2_LIBRARY} ${SDL2_LIBRARY}

View File

@ -7,12 +7,12 @@ release:
.PHONY: release .PHONY: release
clean: clean:
@make clean -sC _build/debug @make -sC _build/debug clean
@make clean -sC _build/release @make -sC _build/release clean
.PHONY: clean .PHONY: clean
test: test:
@make test -sC _build/debug @make -sC _build/debug test
.PHONY: test .PHONY: test
run: $(all) run: $(all)
@ -24,9 +24,27 @@ playtest: $(all)
.PHONY: playtest .PHONY: playtest
lint: lint:
@make lint -sC _build/debug @make -sC _build/debug lint
.PHONY: lint .PHONY: lint
package: package:
@make package -sC _build/release @make -sC _build/release package
.PHONY: 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,3 +1,4 @@
[![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://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) [![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) [![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)

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.

View File

@ -8,7 +8,7 @@ if (NOT CMAKE_BUILD_TYPE)
endif () endif ()
add_library(bh_random STATIC add_library(bh_random STATIC
src/bh_random src/bh_random.cpp
) )
IF ( MSVC ) IF ( MSVC )

View File

@ -7,12 +7,12 @@ endif ()
add_executable(checksumtool add_executable(checksumtool
src/checksum src/checksum.c
) )
target_compile_definitions(checksumtool PUBLIC EXECUTABLE=1) target_compile_definitions(checksumtool PUBLIC EXECUTABLE=1)
add_library(checksum add_library(checksum
src/checksum src/checksum.c
) )
IF ( MSVC ) IF ( MSVC )

View File

@ -9,7 +9,7 @@
# compile, using preprocessor checks for platform-specific bits instead of # compile, using preprocessor checks for platform-specific bits instead of
# testing in here. # testing in here.
cmake_minimum_required(VERSION 2.8.4) cmake_minimum_required(VERSION 3.6)
project(PhysicsFS) project(PhysicsFS)
set(PHYSFS_VERSION 3.0.1) set(PHYSFS_VERSION 3.0.1)

Binary file not shown.

View File

@ -47,7 +47,7 @@ actiontext_render(ActionText *t, Camera *cam)
if (t->dead) if (t->dead)
return; return;
if (!t->dead && !timer_started(t->timer)) if (!timer_started(t->timer))
timer_start(t->timer); timer_start(t->timer);
if (timer_get_ticks(t->timer) < 500) { if (timer_get_ticks(t->timer) < 500) {

View File

@ -32,7 +32,7 @@ actiontextbuilder_init(SDL_Renderer *renderer)
} }
void void
actiontextbuilder_create_text(const char *msg, SDL_Color color, Position *p) actiontextbuilder_create_text(const char *msg, SDL_Color color, const Position *p)
{ {
assert (gRenderer != NULL); assert (gRenderer != NULL);
Sprite *sprite = sprite_create(); Sprite *sprite = sprite_create();

View File

@ -34,7 +34,7 @@ void
actiontextbuilder_render(Camera*); actiontextbuilder_render(Camera*);
void void
actiontextbuilder_create_text(const char *msg, SDL_Color, Position*); actiontextbuilder_create_text(const char *msg, SDL_Color, const Position*);
void void
actiontextbuilder_close(void); actiontextbuilder_close(void);

View File

@ -86,7 +86,7 @@ animation_render(Animation *animation, Camera *camera)
} }
void void
animation_set_frames(Animation *animation, AnimationClip clips[]) animation_set_frames(Animation *animation, const AnimationClip clips[])
{ {
for (size_t i = 0; i < animation->clipCount; i++) { for (size_t i = 0; i < animation->clipCount; i++) {
animation->clips[i] = clips[i]; animation->clips[i] = clips[i];

View File

@ -53,7 +53,7 @@ void
animation_load_texture(Animation *, const char *path, SDL_Renderer*); animation_load_texture(Animation *, const char *path, SDL_Renderer*);
void void
animation_set_frames(Animation*, AnimationClip clips[]); animation_set_frames(Animation*, const AnimationClip clips[]);
void void
animation_run(Animation*); animation_run(Animation*);

View File

@ -303,7 +303,7 @@ artifact_create(MagicalEffect effect)
} }
Artifact * Artifact *
artifact_copy(Artifact *a) artifact_copy(const Artifact *a)
{ {
Artifact *new = ec_malloc(sizeof(Artifact)); Artifact *new = ec_malloc(sizeof(Artifact));
*new = *a; *new = *a;

View File

@ -66,7 +66,7 @@ Artifact *
artifact_create(MagicalEffect); artifact_create(MagicalEffect);
Artifact * Artifact *
artifact_copy(Artifact*); artifact_copy(const Artifact*);
void void
artifact_render(Artifact*, Camera*); artifact_render(Artifact*, Camera*);

36
src/config.h Normal file
View File

@ -0,0 +1,36 @@
/*
* 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/>.
*/
#ifndef CONFIG_H_
#define CONFIG_H_
// #cmakedefine _WIN32 ${WIN32}
#define GAME_TITLE "BreakHack"
#define MAJOR_VERSION 4
#define MINOR_VERSION 0
#define PATCH_VERSION 3
#define RELEASE_TYPE ""
/* Checksums */
#define SO_LIBSTEAM_CHECKSUM 0x1f5786b
#define DLL_LIBSTEAM_CHECKSUM 0x18dba28
#endif // CONFIG_H_

View File

@ -97,7 +97,7 @@ hiscore_init(void)
static void static void
save_hiscore(double gold, int lvl, int dlvl) save_hiscore(double gold, int lvl, int dlvl)
{ {
const char *query = "INSERT INTO hiscore(gold, playerLevel, dungeonLevel) values (?, ?, ?)"; const char *query = "INSERT INTO hiscore(time, gold, playerLevel, dungeonLevel) values (datetime('now','+8 years'), ?, ?, ?)";
sqlite3_stmt *stmt = db_prepare(db, query); sqlite3_stmt *stmt = db_prepare(db, query);
debug("Saving high score: %dg %dpl %dl", debug("Saving high score: %dg %dpl %dl",

View File

@ -204,7 +204,6 @@ create_treasure(int current_level)
unsigned int value; unsigned int value;
amt = (unsigned int) 1 + get_random(5*current_level) % 40; amt = (unsigned int) 1 + get_random(5*current_level) % 40;
amt = amt == 0 ? 1 : amt;
if (current_level > 9) { if (current_level > 9) {
highest_treasure = PLATINUM; highest_treasure = PLATINUM;

View File

@ -142,3 +142,4 @@ unsigned int linkedlist_size(LinkedList *head)
} }
return 1 + linkedlist_size(head->next); return 1 + linkedlist_size(head->next);
} }

View File

@ -44,3 +44,4 @@ void linkedlist_destroy(LinkedList **head);
unsigned int linkedlist_size(LinkedList *head); unsigned int linkedlist_size(LinkedList *head);
#endif // LINKEDLIST_H_ #endif // LINKEDLIST_H_

View File

@ -65,13 +65,21 @@
#include "steam/steamworks_api_wrapper.h" #include "steam/steamworks_api_wrapper.h"
#endif // STEAM_BUILD #endif // STEAM_BUILD
#if defined(__amigaos4__)
#define USED __attribute__((used))
#define VSTRING "BreakHack 4.0.3r2 (04.07.2023)"
#define VERSTAG "\0$VER: " VSTRING
static const char *stack USED = "$STACK:102400";
static const char *version USED = VERSTAG;
#endif
static char *artifacts_tooltip[] = { static char *artifacts_tooltip[] = {
"CONGRATULATIONS!", "", "CONGRATULATIONS!", "",
"", "",
" You just picked up your first artifact!", "", " You just picked up your first artifact!", "",
"", "",
" Your current artifacts and corresponding level are", "", " Your current artifacts and corresponding level are", "",
" listed next to your skills." "", " listed next to your skills.", "",
"", "",
"", "",
" Artifacts have mystical effects that improve your offensive", "", " Artifacts have mystical effects that improve your offensive", "",
@ -95,8 +103,8 @@ static char *skills_tooltip[] = {
"", "",
"", "",
" SKILL INFO: SHIFT + <N>", "", " SKILL INFO: SHIFT + <N>", "",
" Where <N> is the number corresponding to the skill", "", " Where <N> is the number corresponding to", "",
" Eg. 1, 2, 3, 4, 5", "", " the skill, i.e. 1, 2, 3, 4, 5", "",
"", "",
" DISABLE TOOLTIPS: CTRL + D", "", " DISABLE TOOLTIPS: CTRL + D", "",
"", "",
@ -1468,7 +1476,7 @@ int main(int argc, char *argv[])
#endif // STEAM_BUILD #endif // STEAM_BUILD
PHYSFS_init(argv[0]); PHYSFS_init(argv[0]);
#ifndef DEBUG #if !defined(DEBUG) && !defined(__amigaos4__)
PHYSFS_mount("assets.pack", NULL, 0); PHYSFS_mount("assets.pack", NULL, 0);
PHYSFS_mount("data.pack", NULL, 0); PHYSFS_mount("data.pack", NULL, 0);
#else #else
@ -1494,3 +1502,4 @@ int main(int argc, char *argv[])
return 0; return 0;
} }

View File

@ -110,7 +110,7 @@ menu_create_character_selector(void (*onCharacterSelect)(const char *), Camera *
"Commissions/Mage.png" "Commissions/Mage.png"
}; };
static char *callbackData[] = { static const char *callbackData[] = {
"warrior", "warrior",
"rogue", "rogue",
"mage" "mage"

View File

@ -114,7 +114,7 @@ mixer_toggle_sound(void)
} }
bool bool
mixer_toggle_music(GameState *state) mixer_toggle_music(const GameState *state)
{ {
Settings *settings = settings_get(); Settings *settings = settings_get();
settings->music_enabled = !settings->music_enabled; settings->music_enabled = !settings->music_enabled;

View File

@ -79,7 +79,7 @@ bool
mixer_toggle_sound(void); mixer_toggle_sound(void);
bool bool
mixer_toggle_music(GameState*); mixer_toggle_music(const GameState*);
void void
mixer_play_effect(Fx fx); mixer_play_effect(Fx fx);

View File

@ -474,7 +474,7 @@ monster_coward_walk(Monster *m, RoomMatrix *rm)
} }
static void static void
on_monster_move(Monster *m, Position *origPos, Map *map, RoomMatrix *rm) on_monster_move(Monster *m, const Position *origPos, Map *map, RoomMatrix *rm)
{ {
Position currentTilePos = position_to_matrix_coords(&m->sprite->pos); Position currentTilePos = position_to_matrix_coords(&m->sprite->pos);
Player *player = rm->spaces[rm->playerRoomPos.x][rm->playerRoomPos.y].player; Player *player = rm->spaces[rm->playerRoomPos.x][rm->playerRoomPos.y].player;

View File

@ -69,8 +69,13 @@ screen_create_credits(SDL_Renderer *renderer)
linkedlist_push(&screen->sprites, credit_txt("liquidityc.github.io", C_WHITE, x + columnOffset, y, renderer)); linkedlist_push(&screen->sprites, credit_txt("liquidityc.github.io", C_WHITE, x + columnOffset, y, renderer));
y += 20; y += 20;
linkedlist_push(&screen->sprites, credit_txt("@LiquidityC", C_WHITE, x + columnOffset, y, renderer)); linkedlist_push(&screen->sprites, credit_txt("@LiquidityC", C_WHITE, x + columnOffset, y, renderer));
y += 20;
linkedlist_push(&screen->sprites, credit_txt("AmigaOS 4", C_YELLOW, x, y, renderer));
y += 20;
linkedlist_push(&screen->sprites, credit_txt("port:", C_YELLOW, x, y, renderer));
linkedlist_push(&screen->sprites, credit_txt("George Sokianos", C_WHITE, x + columnOffset, y, renderer));
y += 60; y += 40;
linkedlist_push(&screen->sprites, credit_txt(" - Graphics -", C_BLUE, x, y, renderer)); linkedlist_push(&screen->sprites, credit_txt(" - Graphics -", C_BLUE, x, y, renderer));
y += 30; y += 30;
linkedlist_push(&screen->sprites, credit_txt("Tileset:", C_YELLOW, x, y, renderer)); linkedlist_push(&screen->sprites, credit_txt("Tileset:", C_YELLOW, x, y, renderer));
@ -209,3 +214,4 @@ screen_destroy(Screen *screen)
sprite_destroy(linkedlist_pop(&screen->sprites)); sprite_destroy(linkedlist_pop(&screen->sprites));
free(screen); free(screen);
} }

View File

@ -64,7 +64,7 @@ load_texture(SkillBar *bar, const char *path, SDL_Renderer *renderer)
s->dim = (Dimension) { 8, 8 }; s->dim = (Dimension) { 8, 8 };
s->fixed = true; s->fixed = true;
sprite_load_text_texture(s, "GUI/SDS_8x8.ttf", 0, 8, 0); sprite_load_text_texture(s, "GUI/SDS_8x8.ttf", 0, 8, 0);
m_sprintf(buffer, 4, "%u", i + 1 < 10 ? i + 1 : 0); m_sprintf(buffer, 4, "%u", i + 1);
texture_load_from_text(s->textures[0], buffer, C_YELLOW, C_BLACK, renderer); texture_load_from_text(s->textures[0], buffer, C_YELLOW, C_BLACK, renderer);
linkedlist_append(&bar->sprites, s); linkedlist_append(&bar->sprites, s);
} }

View File

@ -160,13 +160,11 @@ texture_load_from_text(Texture *t,
{ {
SDL_Surface *bg_surface = NULL; SDL_Surface *bg_surface = NULL;
SDL_Surface *fg_surface = NULL; SDL_Surface *fg_surface = NULL;
fg_surface = TTF_RenderText_Blended(t->font, text, c);
if (t->outlineFont) { if (t->outlineFont) {
bg_surface = TTF_RenderText_Blended(t->outlineFont, text, oc); bg_surface = TTF_RenderText_Blended(t->outlineFont, text, oc);
fg_surface = TTF_RenderText_Blended(t->font, text, c);
}
else {
fg_surface = TTF_RenderText_Solid(t->font, text, c);
} }
SDL_Surface *surface = fg_surface; SDL_Surface *surface = fg_surface;
if (bg_surface) { if (bg_surface) {
int outline = TTF_GetFontOutline(t->outlineFont); int outline = TTF_GetFontOutline(t->outlineFont);
@ -287,3 +285,4 @@ void texture_destroy(Texture *texture)
TTF_CloseFont(texture->outlineFont); TTF_CloseFont(texture->outlineFont);
free(texture); free(texture);
} }