diff options
34 files changed, 2343 insertions, 416 deletions
diff --git a/CMakeFiles/sdl_test.dir/CXX.includecache b/CMakeFiles/sdl_test.dir/CXX.includecache index 60ea70a..cf9bd6c 100644 --- a/CMakeFiles/sdl_test.dir/CXX.includecache +++ b/CMakeFiles/sdl_test.dir/CXX.includecache @@ -6,6 +6,636 @@ #IncludeRegexTransform: +C:/MinGW_libs/include/SDL2/SDL.h +SDL_main.h +C:/MinGW_libs/include/SDL2/SDL_main.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_assert.h +C:/MinGW_libs/include/SDL2/SDL_assert.h +SDL_atomic.h +C:/MinGW_libs/include/SDL2/SDL_atomic.h +SDL_audio.h +C:/MinGW_libs/include/SDL2/SDL_audio.h +SDL_clipboard.h +C:/MinGW_libs/include/SDL2/SDL_clipboard.h +SDL_cpuinfo.h +C:/MinGW_libs/include/SDL2/SDL_cpuinfo.h +SDL_endian.h +C:/MinGW_libs/include/SDL2/SDL_endian.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +SDL_events.h +C:/MinGW_libs/include/SDL2/SDL_events.h +SDL_filesystem.h +C:/MinGW_libs/include/SDL2/SDL_filesystem.h +SDL_gamecontroller.h +C:/MinGW_libs/include/SDL2/SDL_gamecontroller.h +SDL_haptic.h +C:/MinGW_libs/include/SDL2/SDL_haptic.h +SDL_hints.h +C:/MinGW_libs/include/SDL2/SDL_hints.h +SDL_joystick.h +C:/MinGW_libs/include/SDL2/SDL_joystick.h +SDL_loadso.h +C:/MinGW_libs/include/SDL2/SDL_loadso.h +SDL_log.h +C:/MinGW_libs/include/SDL2/SDL_log.h +SDL_messagebox.h +C:/MinGW_libs/include/SDL2/SDL_messagebox.h +SDL_metal.h +C:/MinGW_libs/include/SDL2/SDL_metal.h +SDL_mutex.h +C:/MinGW_libs/include/SDL2/SDL_mutex.h +SDL_power.h +C:/MinGW_libs/include/SDL2/SDL_power.h +SDL_render.h +C:/MinGW_libs/include/SDL2/SDL_render.h +SDL_rwops.h +C:/MinGW_libs/include/SDL2/SDL_rwops.h +SDL_sensor.h +C:/MinGW_libs/include/SDL2/SDL_sensor.h +SDL_shape.h +C:/MinGW_libs/include/SDL2/SDL_shape.h +SDL_system.h +C:/MinGW_libs/include/SDL2/SDL_system.h +SDL_thread.h +C:/MinGW_libs/include/SDL2/SDL_thread.h +SDL_timer.h +C:/MinGW_libs/include/SDL2/SDL_timer.h +SDL_version.h +C:/MinGW_libs/include/SDL2/SDL_version.h +SDL_video.h +C:/MinGW_libs/include/SDL2/SDL_video.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_assert.h +SDL_config.h +C:/MinGW_libs/include/SDL2/SDL_config.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +signal.h +- +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_atomic.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_platform.h +C:/MinGW_libs/include/SDL2/SDL_platform.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +sys/cpuinline.h +- +mbarrier.h +- +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_audio.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +SDL_endian.h +C:/MinGW_libs/include/SDL2/SDL_endian.h +SDL_mutex.h +C:/MinGW_libs/include/SDL2/SDL_mutex.h +SDL_thread.h +C:/MinGW_libs/include/SDL2/SDL_thread.h +SDL_rwops.h +C:/MinGW_libs/include/SDL2/SDL_rwops.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_blendmode.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_clipboard.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_config.h +SDL_platform.h +C:/MinGW_libs/include/SDL2/SDL_platform.h + +C:/MinGW_libs/include/SDL2/SDL_cpuinfo.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +intrin.h +- +intrin.h +- +altivec.h +- +arm_neon.h +- +armintr.h +- +arm_neon.h +- +arm64intr.h +- +arm64_neon.h +- +mm3dnow.h +- +immintrin.h +- +mmintrin.h +- +xmmintrin.h +- +emmintrin.h +- +pmmintrin.h +- +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_endian.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +endian.h +- +endian.h +- +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_error.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_events.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +SDL_video.h +C:/MinGW_libs/include/SDL2/SDL_video.h +SDL_keyboard.h +C:/MinGW_libs/include/SDL2/SDL_keyboard.h +SDL_mouse.h +C:/MinGW_libs/include/SDL2/SDL_mouse.h +SDL_joystick.h +C:/MinGW_libs/include/SDL2/SDL_joystick.h +SDL_gamecontroller.h +C:/MinGW_libs/include/SDL2/SDL_gamecontroller.h +SDL_quit.h +C:/MinGW_libs/include/SDL2/SDL_quit.h +SDL_gesture.h +C:/MinGW_libs/include/SDL2/SDL_gesture.h +SDL_touch.h +C:/MinGW_libs/include/SDL2/SDL_touch.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_filesystem.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_gamecontroller.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +SDL_rwops.h +C:/MinGW_libs/include/SDL2/SDL_rwops.h +SDL_joystick.h +C:/MinGW_libs/include/SDL2/SDL_joystick.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_gesture.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +SDL_video.h +C:/MinGW_libs/include/SDL2/SDL_video.h +SDL_touch.h +C:/MinGW_libs/include/SDL2/SDL_touch.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_haptic.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +SDL_joystick.h +C:/MinGW_libs/include/SDL2/SDL_joystick.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_hints.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_joystick.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_keyboard.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +SDL_keycode.h +C:/MinGW_libs/include/SDL2/SDL_keycode.h +SDL_video.h +C:/MinGW_libs/include/SDL2/SDL_video.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_keycode.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_scancode.h +C:/MinGW_libs/include/SDL2/SDL_scancode.h + +C:/MinGW_libs/include/SDL2/SDL_loadso.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_log.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_main.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_messagebox.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_video.h +C:/MinGW_libs/include/SDL2/SDL_video.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_metal.h +SDL_video.h +C:/MinGW_libs/include/SDL2/SDL_video.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_mouse.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +SDL_video.h +C:/MinGW_libs/include/SDL2/SDL_video.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_mutex.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_pixels.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_endian.h +C:/MinGW_libs/include/SDL2/SDL_endian.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_platform.h +AvailabilityMacros.h +C:/MinGW_libs/include/SDL2/AvailabilityMacros.h +TargetConditionals.h +C:/MinGW_libs/include/SDL2/TargetConditionals.h +winapifamily.h +- +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_power.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_quit.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h + +C:/MinGW_libs/include/SDL2/SDL_rect.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +SDL_pixels.h +C:/MinGW_libs/include/SDL2/SDL_pixels.h +SDL_rwops.h +C:/MinGW_libs/include/SDL2/SDL_rwops.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_render.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_rect.h +C:/MinGW_libs/include/SDL2/SDL_rect.h +SDL_video.h +C:/MinGW_libs/include/SDL2/SDL_video.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_rwops.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_scancode.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h + +C:/MinGW_libs/include/SDL2/SDL_sensor.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_shape.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_pixels.h +C:/MinGW_libs/include/SDL2/SDL_pixels.h +SDL_rect.h +C:/MinGW_libs/include/SDL2/SDL_rect.h +SDL_surface.h +C:/MinGW_libs/include/SDL2/SDL_surface.h +SDL_video.h +C:/MinGW_libs/include/SDL2/SDL_video.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_config.h +C:/MinGW_libs/include/SDL2/SDL_config.h +sys/types.h +- +stdio.h +- +stdlib.h +- +stddef.h +- +stdarg.h +- +stdlib.h +- +malloc.h +- +stddef.h +- +stdarg.h +- +memory.h +- +string.h +- +strings.h +- +wchar.h +- +inttypes.h +- +stdint.h +- +ctype.h +- +math.h +- +float.h +- +alloca.h +- +malloc.h +- +malloc.h +- +malloc.h +- +stdlib.h +- +sal.h +- +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_surface.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_pixels.h +C:/MinGW_libs/include/SDL2/SDL_pixels.h +SDL_rect.h +C:/MinGW_libs/include/SDL2/SDL_rect.h +SDL_blendmode.h +C:/MinGW_libs/include/SDL2/SDL_blendmode.h +SDL_rwops.h +C:/MinGW_libs/include/SDL2/SDL_rwops.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_system.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_keyboard.h +C:/MinGW_libs/include/SDL2/SDL_keyboard.h +SDL_render.h +C:/MinGW_libs/include/SDL2/SDL_render.h +SDL_video.h +C:/MinGW_libs/include/SDL2/SDL_video.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_thread.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +SDL_atomic.h +C:/MinGW_libs/include/SDL2/SDL_atomic.h +SDL_mutex.h +C:/MinGW_libs/include/SDL2/SDL_mutex.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +process.h +- +process.h +- +stdlib.h +- +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_timer.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_touch.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_error.h +C:/MinGW_libs/include/SDL2/SDL_error.h +SDL_video.h +C:/MinGW_libs/include/SDL2/SDL_video.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_version.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/SDL_video.h +SDL_stdinc.h +C:/MinGW_libs/include/SDL2/SDL_stdinc.h +SDL_pixels.h +C:/MinGW_libs/include/SDL2/SDL_pixels.h +SDL_rect.h +C:/MinGW_libs/include/SDL2/SDL_rect.h +SDL_surface.h +C:/MinGW_libs/include/SDL2/SDL_surface.h +begin_code.h +C:/MinGW_libs/include/SDL2/begin_code.h +close_code.h +C:/MinGW_libs/include/SDL2/close_code.h + +C:/MinGW_libs/include/SDL2/begin_code.h + +C:/MinGW_libs/include/SDL2/close_code.h + +C:/Users/jaksk/Desktop/dev/_cpp/age/commands/commands.h +iostream +- +vector +- +SDL2/SDL.h +- + +C:/Users/jaksk/Desktop/dev/_cpp/age/game/entity.cpp +entity.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/entity.h +iostream +- + C:/Users/jaksk/Desktop/dev/_cpp/age/game/entity.h vector - @@ -16,6 +646,16 @@ iostream ../umath/vec2.h C:/Users/jaksk/Desktop/dev/_cpp/age/umath/vec2.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/ground.cpp +ground.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/ground.h +gst.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/gst.h +iostream +- +algorithm +- + C:/Users/jaksk/Desktop/dev/_cpp/age/game/ground.h entity.h C:/Users/jaksk/Desktop/dev/_cpp/age/game/entity.h @@ -48,10 +688,410 @@ C:/Users/jaksk/Desktop/dev/_cpp/age/game/player.h tech.h C:/Users/jaksk/Desktop/dev/_cpp/age/game/tech.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/load.cpp +iostream +- +fstream +- +vector +- +load.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/load.h +nlohmann/json.hpp +C:/Users/jaksk/Desktop/dev/_cpp/age/game/nlohmann/json.hpp + +C:/Users/jaksk/Desktop/dev/_cpp/age/game/load.h +gst.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/gst.h + +C:/Users/jaksk/Desktop/dev/_cpp/age/game/menu.h +vector +- +string +- +../umath/vec2.h +C:/Users/jaksk/Desktop/dev/_cpp/age/umath/vec2.h +tech.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/tech.h + +C:/Users/jaksk/Desktop/dev/_cpp/age/game/nlohmann/json.hpp +algorithm +- +cstddef +- +functional +- +initializer_list +- +iosfwd +- +iterator +- +memory +- +numeric +- +string +- +utility +- +vector +- +type_traits +- +utility +- +algorithm +- +array +- +forward_list +- +iterator +- +map +- +string +- +tuple +- +type_traits +- +unordered_map +- +utility +- +valarray +- +exception +- +stdexcept +- +string +- +vector +- +array +- +cstddef +- +cstdint +- +string +- +string +- +utility +- +stdint.h +- +stdint.h +- +cstdlib +- +cassert +- +cstddef +- +cstddef +- +type_traits +- +utility +- +limits +- +type_traits +- +utility +- +tuple +- +iterator +- +type_traits +- +cstdint +- +map +- +memory +- +string +- +vector +- +algorithm +- +iterator +- +string +- +tuple +- +type_traits +- +utility +- +valarray +- +vector +- +cstddef +- +iterator +- +string +- +tuple +- +utility +- +cstdint +- +tuple +- +utility +- +cstdint +- +cstddef +- +functional +- +algorithm +- +array +- +cmath +- +cstddef +- +cstdint +- +cstdio +- +cstring +- +iterator +- +limits +- +string +- +utility +- +vector +- +array +- +cstddef +- +cstring +- +iterator +- +memory +- +numeric +- +string +- +type_traits +- +utility +- +cstdio +- +istream +- +cstddef +- +string +- +utility +- +vector +- +array +- +clocale +- +cstddef +- +cstdio +- +cstdlib +- +initializer_list +- +string +- +utility +- +vector +- +cstdint +- +utility +- +string +- +cmath +- +cstdint +- +functional +- +string +- +utility +- +vector +- +cstddef +- +limits +- +iterator +- +type_traits +- +cstddef +- +iterator +- +utility +- +algorithm +- +cctype +- +limits +- +numeric +- +string +- +utility +- +vector +- +initializer_list +- +utility +- +algorithm +- +array +- +cmath +- +cstdint +- +cstring +- +limits +- +string +- +utility +- +algorithm +- +cstddef +- +iterator +- +memory +- +string +- +vector +- +ios +- +ostream +- +algorithm +- +array +- +clocale +- +cmath +- +cstddef +- +cstdint +- +cstdio +- +limits +- +string +- +type_traits +- +utility +- +array +- +cmath +- +cstdint +- +cstring +- +limits +- +type_traits +- +functional +- +initializer_list +- +iterator +- +memory +- +stdexcept +- +type_traits +- +utility +- +vector +- +string_view +- + C:/Users/jaksk/Desktop/dev/_cpp/age/game/player.h vector - +C:/Users/jaksk/Desktop/dev/_cpp/age/game/playercontrol.cpp +iostream +- +string +- +playercontrol.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/playercontrol.h +entity.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/entity.h + +C:/Users/jaksk/Desktop/dev/_cpp/age/game/playercontrol.h +iostream +- +gst.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/gst.h +view.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/view.h +vector +- +functional +- + C:/Users/jaksk/Desktop/dev/_cpp/age/game/tech.h vector - @@ -68,5 +1108,85 @@ string ../umath/vec2.h C:/Users/jaksk/Desktop/dev/_cpp/age/umath/vec2.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/view.cpp +view.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/view.h + +C:/Users/jaksk/Desktop/dev/_cpp/age/game/view.h +vector +- +functional +- +gst.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/gst.h +menu.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/menu.h + +C:/Users/jaksk/Desktop/dev/_cpp/age/graphics/cam.h +vector +- + +C:/Users/jaksk/Desktop/dev/_cpp/age/graphics/graphics.cpp +algorithm +- +iostream +- +string +- +math.h +- +graphics.h +C:/Users/jaksk/Desktop/dev/_cpp/age/graphics/graphics.h +../game/menu.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/menu.h +../game/tile.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/tile.h + +C:/Users/jaksk/Desktop/dev/_cpp/age/graphics/graphics.h +vector +- +string +- +SDL2/SDL.h +- +../game/gst.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/gst.h +../game/view.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/view.h +cam.h +C:/Users/jaksk/Desktop/dev/_cpp/age/graphics/cam.h +string +- + +C:/Users/jaksk/Desktop/dev/_cpp/age/main.cpp +iostream +- +vector +- +umath/vec2.h +C:/Users/jaksk/Desktop/dev/_cpp/age/umath/vec2.h +graphics/graphics.h +C:/Users/jaksk/Desktop/dev/_cpp/age/graphics/graphics.h +commands/commands.h +C:/Users/jaksk/Desktop/dev/_cpp/age/commands/commands.h +timing/timing.h +C:/Users/jaksk/Desktop/dev/_cpp/age/timing/timing.h +game/entity.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/entity.h +game/ground.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/ground.h +game/playercontrol.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/playercontrol.h +game/gst.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/gst.h +game/tile.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/tile.h +game/load.h +C:/Users/jaksk/Desktop/dev/_cpp/age/game/load.h + +C:/Users/jaksk/Desktop/dev/_cpp/age/timing/timing.h +SDL2/SDL.h +- + C:/Users/jaksk/Desktop/dev/_cpp/age/umath/vec2.h diff --git a/CMakeFiles/sdl_test.dir/depend.internal b/CMakeFiles/sdl_test.dir/depend.internal index 67a2d8e..f191c0c 100644 --- a/CMakeFiles/sdl_test.dir/depend.internal +++ b/CMakeFiles/sdl_test.dir/depend.internal @@ -86,6 +86,7 @@ CMakeFiles/sdl_test.dir/game/load.cpp.obj CMakeFiles/sdl_test.dir/game/menu.cpp.obj C:/Users/jaksk/Desktop/dev/_cpp/age/game/menu.cpp C:/Users/jaksk/Desktop/dev/_cpp/age/game/menu.h + C:/Users/jaksk/Desktop/dev/_cpp/age/game/tech.h C:/Users/jaksk/Desktop/dev/_cpp/age/umath/vec2.h CMakeFiles/sdl_test.dir/game/playercontrol.cpp.obj C:/Users/jaksk/Desktop/dev/_cpp/age/game/entity.h diff --git a/CMakeFiles/sdl_test.dir/depend.make b/CMakeFiles/sdl_test.dir/depend.make index 0a246e4..e197c59 100644 --- a/CMakeFiles/sdl_test.dir/depend.make +++ b/CMakeFiles/sdl_test.dir/depend.make @@ -85,6 +85,7 @@ CMakeFiles/sdl_test.dir/game/load.cpp.obj: umath/vec2.h CMakeFiles/sdl_test.dir/game/menu.cpp.obj: game/menu.cpp CMakeFiles/sdl_test.dir/game/menu.cpp.obj: game/menu.h +CMakeFiles/sdl_test.dir/game/menu.cpp.obj: game/tech.h CMakeFiles/sdl_test.dir/game/menu.cpp.obj: umath/vec2.h CMakeFiles/sdl_test.dir/game/playercontrol.cpp.obj: game/entity.h diff --git a/CMakeFiles/sdl_test.dir/game/ground.cpp.obj b/CMakeFiles/sdl_test.dir/game/ground.cpp.obj Binary files differindex a5b97a9..2426007 100644 --- a/CMakeFiles/sdl_test.dir/game/ground.cpp.obj +++ b/CMakeFiles/sdl_test.dir/game/ground.cpp.obj diff --git a/CMakeFiles/sdl_test.dir/game/gst.cpp.obj b/CMakeFiles/sdl_test.dir/game/gst.cpp.obj Binary files differindex befdc3b..1ade445 100644 --- a/CMakeFiles/sdl_test.dir/game/gst.cpp.obj +++ b/CMakeFiles/sdl_test.dir/game/gst.cpp.obj diff --git a/CMakeFiles/sdl_test.dir/game/load.cpp.obj b/CMakeFiles/sdl_test.dir/game/load.cpp.obj Binary files differindex 70cb174..5fee533 100644 --- a/CMakeFiles/sdl_test.dir/game/load.cpp.obj +++ b/CMakeFiles/sdl_test.dir/game/load.cpp.obj diff --git a/CMakeFiles/sdl_test.dir/game/menu.cpp.obj b/CMakeFiles/sdl_test.dir/game/menu.cpp.obj Binary files differindex a7eb752..507e390 100644 --- a/CMakeFiles/sdl_test.dir/game/menu.cpp.obj +++ b/CMakeFiles/sdl_test.dir/game/menu.cpp.obj diff --git a/CMakeFiles/sdl_test.dir/game/playercontrol.cpp.obj b/CMakeFiles/sdl_test.dir/game/playercontrol.cpp.obj Binary files differindex 26f4ca2..7b273d0 100644 --- a/CMakeFiles/sdl_test.dir/game/playercontrol.cpp.obj +++ b/CMakeFiles/sdl_test.dir/game/playercontrol.cpp.obj diff --git a/CMakeFiles/sdl_test.dir/game/view.cpp.obj b/CMakeFiles/sdl_test.dir/game/view.cpp.obj Binary files differindex b4bb2aa..5292e10 100644 --- a/CMakeFiles/sdl_test.dir/game/view.cpp.obj +++ b/CMakeFiles/sdl_test.dir/game/view.cpp.obj diff --git a/CMakeFiles/sdl_test.dir/graphics/graphics.cpp.obj b/CMakeFiles/sdl_test.dir/graphics/graphics.cpp.obj Binary files differindex edc51da..1823965 100644 --- a/CMakeFiles/sdl_test.dir/graphics/graphics.cpp.obj +++ b/CMakeFiles/sdl_test.dir/graphics/graphics.cpp.obj diff --git a/CMakeFiles/sdl_test.dir/main.cpp.obj b/CMakeFiles/sdl_test.dir/main.cpp.obj Binary files differindex b59be06..902c25e 100644 --- a/CMakeFiles/sdl_test.dir/main.cpp.obj +++ b/CMakeFiles/sdl_test.dir/main.cpp.obj diff --git a/CMakeFiles/sdl_test.dir/objects.a b/CMakeFiles/sdl_test.dir/objects.a Binary files differindex 9fd1454..f1914f9 100644 --- a/CMakeFiles/sdl_test.dir/objects.a +++ b/CMakeFiles/sdl_test.dir/objects.a diff --git a/build/content/entities.json b/build/content/entities.json index fcfb92d..06026e6 100644 --- a/build/content/entities.json +++ b/build/content/entities.json @@ -1,7 +1,7 @@ [ { "name": "Town Center", - "id": 100, "unit": 0, "class": "bld", + "id": 100, "unit": 0, "class": "bld", "level": 0, "move" : 0, "attack": 0, "defence": 600, "range": 0, "sight": 10, "spritebounds": [ 528, 16 ], @@ -10,7 +10,7 @@ "cost": [ 600, 400 ] },{ "name": "Mill", - "id": 101, "unit": 0, "class": "bld", + "id": 101, "unit": 0, "class": "bld", "level": 0, "move" : 0, "attack": 0, "defence": 250, "range": 0, "sight": 7, "spritebounds": [ 544, 16 ], @@ -18,7 +18,7 @@ "cost": [ 120, 90 ] },{ "name": "Mine", - "id": 102, "unit": 0, "class": "bld", + "id": 102, "unit": 0, "class": "bld", "level": 0, "move" : 0, "attack": 0, "defence": 300, "range": 0, "sight": 7, "spritebounds": [ 560, 16 ], @@ -26,7 +26,7 @@ "cost": [ 360, 240 ] },{ "name": "Farm", - "id": 103, "unit": 0, "class": "bld", + "id": 103, "unit": 0, "class": "bld", "level": 0, "move" : 0, "attack": 0, "defence": 150, "range": 0, "sight": 7, "spritebounds": [ 576, 16 ], @@ -35,7 +35,7 @@ "adjacent": [ 101 ] },{ "name": "Barracks", - "id": 104, "unit": 0, "class": "bld", + "id": 104, "unit": 0, "class": "bld", "level": 0, "move" : 0, "attack": 0, "defence": 300, "range": 0, "sight": 7, "spritebounds": [ 592, 16 ], @@ -45,7 +45,7 @@ "adjacent": [ 100 ] },{ "name": "Archery Range", - "id": 105, "unit": 0, "class": "bld", + "id": 105, "unit": 0, "class": "bld", "level": 1, "move" : 0, "attack": 0, "defence": 300, "range": 0, "sight": 7, "spritebounds": [ 608, 16 ], @@ -55,7 +55,7 @@ "adjacent": [ 100 ] },{ "name": "Blacksmith", - "id": 106, "unit": 0, "class": "bld", + "id": 106, "unit": 0, "class": "bld", "level": 1, "move" : 0, "attack": 0, "defence": 300, "range": 0, "sight": 7, "spritebounds": [ 624, 16 ], @@ -63,71 +63,141 @@ "cost": [ 285, 165 ], "adjacent": [ 100 ] },{ + "name": "Market", + "id": 107, "unit": 0, "class": "bld", "level": 1, + "move" : 0, "attack": 0, "defence": 300, + "range": 0, "sight": 7, + "spritebounds": [ 640, 16 ], + "prod": [ 0, 0 ], + "cost": [ 360, 240 ], + "adjacent": [ 100 ] + },{ + "name": "Stable", + "id": 108, "unit": 0, "class": "bld", "level": 0, + "move" : 0, "attack": 0, "defence": 300, + "range": 0, "sight": 7, + "spritebounds": [ 656, 16 ], + "prod": [ 0, 0 ], + "cost": [ 360, 240 ], + "adjacent": [ 100 ] + },{ + "name": "Siege Workshop", + "id": 109, "unit": 0, "class": "bld", "level": 2, + "move" : 0, "attack": 0, "defence": 300, + "range": 0, "sight": 7, + "spritebounds": [ 672, 16 ], + "prod": [ 0, 0 ], + "cost": [ 360, 240 ], + "adjacent": [ 100 ] + },{ + "name": "Church", + "id": 110, "unit": 0, "class": "bld", "level": 2, + "move" : 0, "attack": 0, "defence": 300, + "range": 0, "sight": 7, + "spritebounds": [ 688, 16 ], + "prod": [ 0, 0 ], + "cost": [ 360, 240 ], + "adjacent": [ 100 ] + },{ + "name": "University", + "id": 111, "unit": 0, "class": "bld", "level": 2, + "move" : 0, "attack": 0, "defence": 300, + "range": 0, "sight": 7, + "spritebounds": [ 704, 16 ], + "prod": [ 0, 0 ], + "cost": [ 360, 240 ], + "adjacent": [ 100 ] + },{ + "name": "Tower", + "id": 112, "unit": 0, "class": "bld", "level": 2, + "move" : 0, "attack": 0, "defence": 300, + "range": 0, "sight": 7, + "spritebounds": [ 720, 16 ], + "prod": [ 0, 0 ], + "cost": [ 360, 240 ], + "diagonal": [ 100 ] + },{ + "name": "Castle", + "id": 113, "unit": 0, "class": "bld", "level": 2, + "move" : 0, "attack": 0, "defence": 300, + "range": 0, "sight": 7, + "spritebounds": [ 720, 16 ], + "prod": [ 0, 0 ], + "cost": [ 360, 240 ], + "diagonal": [ 100 ] + },{ "name": "Villager", - "id": 0, "unit": 1, "class": "inf", + "id": 0, "unit": 1, "class": "inf", "level": -1, "move" : 7, "attack": 50, "defence": 50, "range": 1, "sight": 7, "spritebounds": [ 96, 16 ], "build": [ - 100, 101, 102, 103, 104, 105, 106 + 100, 101, 102, 103, 104, 105, 106, 107 ], "cost": [ 100, 100 ] },{ "name": "Militia", - "id": 1, "unit": 1, "class": "inf", + "id": 1, "unit": 1, "class": "inf", "level": 0, "move" : 7, "attack": 100, "defence": 100, "range": 1, "sight": 7, "spritebounds": [ 112, 16 ], - "cost": [ 75, 25 ] + "cost": [ 75, 25 ], + "upgrade": 6 },{ "name": "Scout Cavalry", - "id": 2, "unit": 1, "class": "cav", + "id": 2, "unit": 1, "class": "cav", "level": 0, "move" : 12, "attack": 100, "defence": 100, "range": 1, "sight": 7, "spritebounds": [ 128, 16 ], "cost": [ 100, 50 ], - "abilities": [ "Scout" ] + "abilities": [ "Scout" ], + "upgrade": 5 },{ "name": "Archers", - "id": 3, "unit": 1, "class": "ran", + "id": 3, "unit": 1, "class": "ran", "level": 1, "move" : 7, "attack": 150, "defence": 100, "range": 3, "sight": 7, "spritebounds": [ 160, 32 ], - "cost": [ 125, 50 ] + "cost": [ 125, 50 ], + "upgrade": 24 },{ "name": "Skirmishers", - "id": 4, "unit": 1, "class": "ran", + "id": 4, "unit": 1, "class": "ran", "level": 1, "move" : 7, "attack": 110, "defence": 110, "range": 2, "sight": 7, "spritebounds": [ 176, 32 ], "cost": [ 125, 50 ], - "abilities": [ "Skirmish" ] + "abilities": [ "Skirmish" ], + "upgrade": 14 },{ "name": "Light Cavalry", - "id": 5, "unit": 1, "class": "cav", + "id": 5, "unit": 1, "class": "cav", "level": 1, "move" : 10, "attack": 150, "defence": 150, "range": 1, "sight": 7, "spritebounds": [ 128, 32 ], "cost": [ 125, 50 ], - "abilities": [ "Plains Charge" ] + "abilities": [ "Plains Charge" ], + "upgrade": 8 },{ "name": "Men at Arms", - "id": 6, "unit": 1, "class": "inf", + "id": 6, "unit": 1, "class": "inf", "level": 1, "move" : 7, "attack": 150, "defence": 150, "range": 1, "sight": 7, "spritebounds": [ 112, 32 ], - "cost": [ 125, 50 ] + "cost": [ 125, 50 ], + "upgrade": 10 },{ "name": "Spearmen", - "id": 7, "unit": 1, "class": "inf", + "id": 7, "unit": 1, "class": "inf", "level": 1, "move" : 7, "attack": 150, "defence": 150, "range": 1, "sight": 7, "spritebounds": [ 144, 32 ], "cost": [ 125, 50 ], - "abilities": [ "Anti-Cavalry" ] + "abilities": [ "Anti-Cavalry" ], + "upgrade": 11 },{ "name": "Knight", - "id": 8, "unit": 1, "class": "cav", + "id": 8, "unit": 1, "class": "cav", "level": 2, "move" : 10, "attack": 200, "defence": 200, "range": 1, "sight": 7, "spritebounds": [ 128, 48 ], @@ -135,7 +205,7 @@ "abilities": [ "Plains Charge" ] },{ "name": "Camels", - "id": 9, "unit": 1, "class": "cav", + "id": 9, "unit": 1, "class": "cav", "level": 2, "move" : 10, "attack": 200, "defence": 200, "range": 1, "sight": 7, "spritebounds": [ 192, 48 ], @@ -143,14 +213,14 @@ "abilities": [ "Desert Charge", "Scares Horses" ] },{ "name": "Longswordmen", - "id": 10, "unit": 1, "class": "inf", + "id": 10, "unit": 1, "class": "inf", "level": 2, "move" : 7, "attack": 200, "defence": 200, "range": 1, "sight": 7, "spritebounds": [ 112, 48 ], "cost": [ 125, 50 ] },{ "name": "Pikemen", - "id": 11, "unit": 1, "class": "inf", + "id": 11, "unit": 1, "class": "inf", "level": 2, "move" : 7, "attack": 150, "defence": 200, "range": 1, "sight": 7, "spritebounds": [ 144, 48 ], @@ -158,7 +228,7 @@ "abilities": [ "Anti-Cavalry" ] },{ "name": "Viking Berserkers", - "id": 12, "unit": 1, "class": "inf", + "id": 12, "unit": 1, "class": "inf", "level": 2, "move" : 7, "attack": 200, "defence": 200, "range": 1, "sight": 7, "spritebounds": [ 208, 48 ], @@ -166,7 +236,7 @@ "abilities": [ "Frenzy" ] },{ "name": "Crossbowmen", - "id": 13, "unit": 1, "class": "ran", + "id": 13, "unit": 1, "class": "ran", "level": 2, "move" : 7, "attack": 200, "defence": 175, "range": 3, "sight": 7, "spritebounds": [ 224, 48 ], @@ -174,7 +244,7 @@ "abilities": [ "No Move & Attack" ] },{ "name": "Elite Skirmishers", - "id": 14, "unit": 1, "class": "ran", + "id": 14, "unit": 1, "class": "ran", "level": 2, "move" : 7, "attack": 150, "defence": 150, "range": 2, "sight": 7, "spritebounds": [ 176, 48 ], @@ -182,14 +252,14 @@ "abilities": [ "Skirmish" ] },{ "name": "Horse Archers", - "id": 15, "unit": 1, "class": "ran", + "id": 15, "unit": 1, "class": "ran", "level": 2, "move" : 10, "attack": 150, "defence": 150, "range": 2, "sight": 7, "spritebounds": [ 240, 48 ], "cost": [ 125, 50 ] },{ "name": "Throwing Axmen", - "id": 16, "unit": 1, "class": "inf", + "id": 16, "unit": 1, "class": "inf", "level": 2, "move" : 7, "attack": 225, "defence": 250, "range": 1, "sight": 7, "spritebounds": [ 256, 48 ], @@ -197,7 +267,7 @@ "abilities": [ "Skirmish", "Woodsman" ] },{ "name": "Persian War Elephants", - "id": 17, "unit": 1, "class": "cav", + "id": 17, "unit": 1, "class": "cav", "level": 2, "move" : 7, "attack": 200, "defence": 250, "range": 1, "sight": 7, "spritebounds": [ 272, 48 ], @@ -205,7 +275,7 @@ "abilities": [ "Causes Fear" ] },{ "name": "Celtic Woad Raiders", - "id": 18, "unit": 1, "class": "inf", + "id": 18, "unit": 1, "class": "inf", "level": 2, "move" : 7, "attack": 200, "defence": 200, "range": 1, "sight": 7, "spritebounds": [ 288, 48 ], @@ -213,7 +283,7 @@ "abilities": [ "Causes Fear" ] },{ "name": "Knights Templar", - "id": 19, "unit": 1, "class": "cav", + "id": 19, "unit": 1, "class": "cav", "level": 2, "move" : 7, "attack": 200, "defence": 200, "range": 1, "sight": 7, "spritebounds": [ 304, 48 ], @@ -221,7 +291,7 @@ "abilities": [ "Plains Charge", "Zeal" ] },{ "name": "Scorpions", - "id": 20, "unit": 1, "class": "sie", + "id": 20, "unit": 1, "class": "sie", "level": 2, "move" : 7, "attack": 350, "defence": 250, "range": 3, "sight": 7, "spritebounds": [ 320, 48 ], @@ -229,7 +299,7 @@ "abilities": [ "Units Only", "No Counter", "No Move & Attack" ] },{ "name": "Battering Rams", - "id": 21, "unit": 1, "class": "sie", + "id": 21, "unit": 1, "class": "sie", "level": 2, "move" : 7, "attack": 400, "defence": 325, "range": 1, "sight": 7, "spritebounds": [ 336, 48 ], @@ -237,7 +307,7 @@ "abilities": [ "Buildings Only", "No Counter" ] },{ "name": "Onagers", - "id": 22, "unit": 1, "class": "sie", + "id": 22, "unit": 1, "class": "sie", "level": 2, "move" : 7, "attack": 275, "defence": 275, "range": 1, "sight": 7, "spritebounds": [ 352, 48 ], @@ -245,11 +315,18 @@ "abilities": [ "No Move & Attack", "No Counter" ] },{ "name": "Monks", - "id": 23, "unit": 1, "class": "inf", + "id": 23, "unit": 1, "class": "inf", "level": 2, "move" : 7, "attack": 50, "defence": 200, "range": 1, "sight": 7, "spritebounds": [ 368, 48 ], "cost": [ 125, 50 ], "abilities": [ "Heal", "Convert" ] + },{ + "name": "Archers", + "id": 24, "unit": 1, "class": "ran", "level": 2, + "move" : 7, "attack": 150, "defence": 100, + "range": 3, "sight": 7, + "spritebounds": [ 160, 32 ], + "cost": [ 125, 50 ] } ]
\ No newline at end of file diff --git a/build/content/gf.bmp b/build/content/gf.bmp Binary files differindex dbe9758..9450576 100644 --- a/build/content/gf.bmp +++ b/build/content/gf.bmp diff --git a/build/content/sprites.bmp b/build/content/sprites.bmp Binary files differindex 2696bb5..0cb4039 100644 --- a/build/content/sprites.bmp +++ b/build/content/sprites.bmp diff --git a/build/content/techs.json b/build/content/techs.json index f724969..df2ac8d 100644 --- a/build/content/techs.json +++ b/build/content/techs.json @@ -1,304 +1,398 @@ [ { - "name": "Loom", - "cost": [ 50, 150 ] - "" + "name": "Loom", "id": 0, "level": 0, + "cost": [ 50, 150 ], "req_id": 100, + "bonus": { + "aff_id": [ 0 ], + "defence": 0.25 + } + },{ + "name": "Town Scouts", "id": 1, "level": 0, + "cost": [ 50, 150 ], "req_id": 100, + "bonus": { + "aff_id": [ 100 ], + "sight": 4 + } + },{ + "name": "Leather Soles", "id": 2, "level": 0, + "cost": [ 50, 150 ], "req_id": 100, + "bonus": { + "aff_id": [ 0 ], + "move": 1 + } + },{ + "name": "Weaponsmith", "id": 3, "level": 0, + "cost": [ 50, 150 ], "req_id": 104, + "bonus": { + "aff_id": [ 1 ], + "attack": 0.25 + } + },{ + "name": "Town Watch", "id": 4, "level": 1, + "cost": [ 95, 280 ], "req_id": 100, + "bonus": { + "aff_id": [ 100 ], + "defence": 0.2, "sight": 2 + } + },{ + "name": "Wheelbarrow", "id": 5, "level": 1, + "cost": [ 125, 375 ], "req_id": 100, + "bonus": { + "aff_class": [ "bld" ], + "cost": [ -0.1, -0.1 ] + } + },{ + "name": "Advanced Mining", "id": 6, "level": 1, + "cost": [ 95, 280 ], "req_id": 102, + "bonus": { + "aff_id": [ 102 ], + "prod": [ 0, 0.15 ] + } + },{ + "name": "Horse Collar", "id": 7, "level": 1, + "cost": [ 95, 280 ], "req_id": 101, + "bonus": { + "prod": [ 0.15, 0 ] + } + },{ + "name": "Scale Mail Armor", "id": 8, "level": 1, + "cost": [ 95, 280 ], "req_id": 106, + "bonus": { + "aff_class": [ "inf" ], + "aff_level": 1, + "defence": 0.25 + } + },{ + "name": "Scale Barding", "id": 9, "level": 1, + "cost": [ 95, 280 ], "req_id": 106, + "bonus": { + "aff_class": [ "cav" ], + "aff_level": 1, + "defence": 0.25 + } + },{ + "name": "Fletching", "id": 10, "level": 1, + "cost": [ 95, 280 ], "req_id": 106, + "bonus": { + "aff_class": [ "ran" ], + "aff_level": 1, + "attack": 0.25 + } + },{ + "name": "Padded Armor", "id": 11, "level": 1, + "cost": [ 95, 280 ], "req_id": 106, + "bonus": { + "aff_class": [ "ran" ], + "aff_level": 1, + "defence": 0.25 + } + },{ + "name": "Forging", "id": 12, "level": 1, + "cost": [ 155, 470 ], "req_id": 106, + "bonus": { + "aff_class": [ "inf", "cav" ], + "aff_level": 1, + "attack": 0.25 + } + },{ + "name": "Tracking", "id": 13, "level": 1, + "cost": [ 95, 280 ], "req_id": 104, + "bonus": { + "aff_class": [ "inf" ], + "sight": 2 + } + },{ + "name": "Cartography", "id": 14, "level": 1, + "cost": [ 95, 280 ], "req_id": 107, + "bonus": { + "sight": 1 + } + },{ + "name": "Trading", "id": 15, "level": 1, + "cost": [ 95, 280 ], "req_id": 107, + "bonus": { + "trade": 1 + } + },{ + "name": "Coniage", "id": 16, "level": 1, + "cost": [ 125, 375 ], "req_id": 107, + "bonus": { + "prod": [ 0, 0.1 ] + } + },{ + "name": "Town Patrol", "id": 17, "level": 2, + "cost": [ 150, 450 ], "req_id": 100, + "bonus": { + "aff_id": [ 100 ], + "defence": 0.2, "sight": 2 + } + },{ + "name": "Hand Cart", "id": 18, "level": 2, + "cost": [ 150, 450 ], "req_id": 100, + "bonus": { + "aff_class": [ "bld" ], + "cost": [ -0.1, -0.1 ] + } + },{ + "name": "Shaft Mining", "id": 19, "level": 2, + "cost": [ 150, 450 ], "req_id": 102, + "bonus": { + "aff_id": [ 102 ], + "prod": [ 0, 0.15 ] + } + },{ + "name": "Heavy Plow", "id": 20, "level": 2, + "cost": [ 150, 450 ], "req_id": 101, + "bonus": { + "prod": [ 0.1, 0 ] + } + },{ + "name": "Chain Mail Armor", "id": 21, "level": 2, + "cost": [ 150, 450 ], "req_id": 106, + "bonus": { + "aff_level": 2, + "aff_class": [ "inf" ], + "defence": 0.25 + } + },{ + "name": "Chain Barding", "id": 22, "level": 2, + "cost": [ 150, 450 ], "req_id": 106, + "bonus": { + "aff_level": 2, + "aff_class": [ "cav" ], + "defence": 0.25 + } + },{ + "name": "Bodkin Arrow", "id": 23, "level": 2, + "cost": [ 150, 450 ], "req_id": 106, + "bonus": { + "aff_level": 2, + "aff_class": [ "ran" ], + "attack": 0.25 + } + },{ + "name": "Leather Armor", "id": 24, "level": 2, + "cost": [ 150, 450 ], "req_id": 106, + "bonus": { + "aff_level": 2, + "aff_class": [ "ran" ], + "defence": 0.25 + } + },{ + "name": "Iron Casting", "id": 25, "level": 2, + "cost": [ 250, 750 ], "req_id": 106, + "bonus": { + "aff_level": 2, + "aff_class": [ "inf", "cav" ], + "attack": 0.25 + } + },{ + "name": "Conscription", "id": 26, "level": 2, + "cost": [ 150, 450 ], "req_id": 104, + "bonus": { + "aff_class": [ "inf" ], + "cost_abs": [ -15, -15 ] + } + },{ + "name": "Husbandry", "id": 27, "level": 2, + "cost": [ 150, 450 ], "req_id": 108, + "bonus": { + "aff_class": [ "cav" ], + "cost_abs": [ -15, -15 ] + } + },{ + "name": "Tournaments", "id": 28, "level": 2, + "cost": [ 150, 450 ], "req_id": 105, + "bonus": { + "aff_class": [ "ran" ], + "cost_abs": [ -15, -15 ] + } + },{ + "name": "Mechanics Guild", "id": 29, "level": 2, + "cost": [ 150, 450 ], "req_id": 109, + "bonus": { + "aff_class": [ "sie" ], + "cost_abs": [ -15, -15 ] + } + },{ + "name": "Banking", "id": 30, "level": 2, + "cost": [ 200, 600 ], "req_id": 107, + "bonus": { + "trade": 1, + "prod": [ 0, 0.05 ] + } + },{ + "name": "Merchant Network", "id": 31, "level": 2, + "cost": [ 150, 450 ], "req_id": 107, + "bonus": { + "aff_mercs": 1, + "cost_abs": [ 0, -25 ] + } + },{ + "name": "Redemption", "id": 32, "level": 2, + "cost": [ 150, 450 ], "req_id": 110, + "bonus": { + "aff_id": [ 23 ], + "improved_heal": 1 + } + },{ + "name": "Fervor", "id": 33, "level": 2, + "cost": [ 150, 450 ], "req_id": 110, + "bonus": { + "aff_id": [ 23 ], + "improved_convert": 1 + } + },{ + "name": "Sanctity", "id": 34, "level": 2, + "cost": [ 150, 450 ], "req_id": 110, + "bonus": { + "aff_id": [ 23 ], + "defence": 0.25 + } + },{ + "name": "Murder Holes", "id": 35, "level": 2, + "cost": [ 95, 280 ], "req_id": 111, + "bonus": { + "aff_id": [ 112 ], + "defence": 0.25 + } + },{ + "name": "Masonry", "id": 36, "level": 2, + "cost": [ 95, 280 ], "req_id": 111, + "bonus": { + "aff_class": [ "bld" ], + "defence": 0.05 + } + },{ + "name": "Crop Rotation", "id": 37, "level": 3, + "cost": [ 250, 750 ], "req_id": 101, + "bonus": { + "prod": [ 0.1, 0 ] + } + },{ + "name": "Plate Mail", "id": 38, "level": 3, + "cost": [ 250, 750 ], "req_id": 106, + "bonus": { + "aff_level": 3, + "aff_class": [ "inf" ], + "defence": 0.25 + } + },{ + "name": "Plate Barding", "id": 39, "level": 3, + "cost": [ 250, 750 ], "req_id": 106, + "bonus": { + "aff_level": 3, + "aff_class": [ "cav" ], + "defence": 0.25 + } + },{ + "name": "Bracers", "id": 40, "level": 3, + "cost": [ 250, 750 ], "req_id": 106, + "bonus": { + "aff_level": 3, + "aff_class": [ "ran" ], + "attack": 0.25 + } + },{ + "name": "Ring Archer Armor", "id": 41, "level": 3, + "cost": [ 250, 750 ], "req_id": 106, + "bonus": { + "aff_level": 3, + "aff_class": [ "ran" ], + "defence": 0.25 + } + },{ + "name": "Blast Furnace", "id": 42, "level": 3, + "cost": [ 625, 975 ], "req_id": 106, + "bonus": { + "aff_level": 3, + "aff_class": [ "inf", "cav" ], + "attack": 0.25 + } + },{ + "name": "Arena", "id": 43, "level": 3, + "cost": [ 250, 750 ], "req_id": 104 + },{ + "name": "Squires", "id": 44, "level": 3, + "cost": [ 250, 750 ], "req_id": 108 + },{ + "name": "Flaming Arrows", "id": 45, "level": 3, + "cost": [ 300, 900 ], "req_id": 105 + },{ + "name": "Sappers", "id": 46, "level": 3, + "cost": [ 300, 900 ], "req_id": 113 + },{ + "name": "Hoardings", "id": 47, "level": 3, + "cost": [ 250, 750 ], "req_id": 113, + "bonus": { + "aff_id": [ 113 ], + "defence": 0.35 + } + },{ + "name": "Spies", "id": 48, "level": 3, + "cost": [ 300, 900 ], "req_id": 113 + },{ + "name": "Guilds", "id": 49, "level": 3, + "cost": [ 250, 750 ], "req_id": 107, + "bonus": { + "trade": 1, + "prod": [ 0, 0.05 ] + } + },{ + "name": "Atonement", "id": 50, "level": 3, + "cost": [ 250, 750 ], "req_id": 110, + "bonus": { + "aff_id": [ 23 ], + "improved_heal": 1 + } + },{ + "name": "Block Printing", "id": 51, "level": 3, + "cost": [ 250, 750 ], "req_id": 110, + "bonus": { + "aff_id": [ 23 ], + "improved_convert": 1 + } + },{ + "name": "Illumination", "id": 52, "level": 3, + "cost": [ 250, 750 ], "req_id": 110, + "bonus": { + "aff_id": [ 110 ], + "prod": [ 0, 0.5 ] + } + },{ + "name": "Faith", "id": 53, "level": 3, + "cost": [ 250, 750 ], "req_id": 110, + "bonus": { + "aff_id": [ 23 ], + "defence": 0.25 + } + },{ + "name": "Treadmill Crane", "id": 54, "level": 3, + "cost": [ 250, 750 ], "req_id": 111, + "bonus": { + "aff_class": [ "bld" ], + "cost": [ 0.1, 0.1 ] + } + },{ + "name": "Siege Engineers", "id": 55, "level": 3, + "cost": [ 250, 750 ], "req_id": 111 + },{ + "name": "Architecture", "id": 56, "level": 3, + "cost": [ 250, 750 ], "req_id": 111, + "bonus": { + "aff_class": [ "bld" ], + "defence": 0.05 + } + },{ + "name": "Chemistry", "id": 57, "level": 3, + "cost": [ 250, 750 ], "req_id": 111 + },{ + "name": "Ballistics", "id": 58, "level": 3, + "cost": [ 300, 900 ], "req_id": 111, + "bonus": { + "aff_class": [ "sie" ], + "req_range": 1, + "attack": 0.25 + } } -] -* Loom -Requires: Town Center -Cost: 50f 150g -All Villagers get +25 DEF - -* Town Scouts -Requires: Town Center -Cost: 50f 150g -Town Centers gain +4 Sight - -* Leather Soles -Prereqs: Town Center -Cost: 50f 150g -Villagers gain +1 Move - -* Weaponsmith -Requires: Barracks -Cost: 50f 150g -Militia gain +25 ATT - -============ --Feudal Age: -============ - -* Town Watch -Requires: Town Center -Cost: 95f 280g -Improves Town Center DEF by +20% and Sight by +2 - -* Wheelbarrow -Requires: Town Center -Cost: 125f 375g -Cost of buildings is reduced by 10% - -* Advanced Mining -Requires: Mine -Cost: 95f 280g -+15% to Mine income - -* Horse Collar -Requires: Mill -Cost: 95f 280g -+15% to food income - -* Scale Mail Armor -Requires: Blacksmith -Cost: 95f 280g -+25% DEF for Infantry - -* Scale Barding -Requires: Blacksmith -Cost: 95f 280g -+25% DEF for Cavalry - -* Fletching -Requires: Blacksmith -Cost: 95f 280g -+25% ATT for Ranged Units - -* Padded Armor -Requires: Blacksmith -Cost: 95f 280g -+25% DEF for Ranged Units - -* Forging -Requires: Blacksmith -Cost: 155f 470g -+25% ATT for Infantry and Cavalry - -* Tracking -Requires: Barracks -Cost: 95f 280g -+2 Sight for Infantry - -* Cartography -Requires: Market -Cost: 95f 280g -+1 Sight for all units - -++++++++++++ --Castle Age: -++++++++++++ - -* Town Patrol -Requires: Town Center -Cost: 150f 450g -+2 Sight and +20% DEF for Town Center - -* Hand Cart -Requires: Town Center -Cost: 150f 450g -Cost of Building is reduced by 10% - -* Shaft Mining -Requires: Mine -Cost: 150f 450g -+15% to Mine income - -* Heavy Plow -Requires: Mill -Cost: 150f 450g -+15% to food income - -* Chain Mail Armor -Requires: Blacksmith -Cost: 150f 450g -+25% DEF to Age 3 infantry - -* Chain Barding -Requires: Blacksmith -Cost: 150f 450g -+25% DEF to Age 3 Cavalry - -* Bodkin Arrow -Requires: Blacksmith -Cost: 150f 450g -+25% ATT to Age 3 Ranged Units - -* Leather Armor -Requires: Blacksmith -Cost: 150f 450g -+25% DEF to Age 3 Ranged Units - -* Iron Casting -Requires: Blacksmith -Cost: 250f 750g -+25% ATT to Age 3 Infantry and Cavalry - -* Conscription -Requires: Barracks -Cost: 150f 450g -Cost of Infantry is reduced by 15 food and 15 gold - -* Husbandry -Requires: Stable -Cost: 150f 450g -Cost of Cavalry is reduced by 15 food and 15 gold - -* Archery Tournaments -Requires: Archery Range -Cost: 150f 450g -Cost of Ranged Units is reduced by 15 food and 15 gold - -* Mechanics Guild -Requires: Siege Workshop -Cost: 150f 450g -Cost of Siege Units is reduced by 15 food and 15 gold - -* Banking -Requires: Market -Cost: 200f 600g -+ 5% gold Income and improved Trade Rate - -* Merchant Network -Requires: Market -Cost: 150f 450g -Price for Mercenaries is reduced by 25% - -* Redemption -Requires: Church -Cost: 150f 450g -Improves Heal ability of Monks and Elite Monks - -* Fervor -Requires: Church -Cost: 150f 450g -Improves Convert ability of Monks and Elite Monks - -* Sanctity -Requires: Church -Cost: 150f 450g -+25% DEF for Monks and Elite Monks - -* Murder Holes -Requires: University -Cost: 95f 280g -+25% DEF for Towers - -* Masonry -Requires: University -Cost: 150f 450g -+5% DEF for all buildings - -///////////// -Imperial Age: -\\\\\\\\\\\\\ - - -* Crop Rotation -Requires: Mill -Cost: 250f 750g -+10% to food income - -* Plate Mail Armor -Requires: Blacksmith -Cost: 250f 750g -Age 4 Infantry units gain +25% DEF - -* Plate Barding -Requires: Blacksmith -Cost: 250f 750g -Age 4 Cavalry units gain +25% DEF - -* Bracers -Requires: Blacksmith -Cost: 250f 750g -Age 4 Ranged units gain +25% ATK - -* Ring Archer Armor -Requires: Blacksmith -Cost: 250f 750g -Age 4 Ranged units gain +25% DEF - -* Blast Furnace -Requires: Blacksmith -Cost: 625f 975g -Age 4 INF and CAV units gain +25% ATK - -* Arena -Requires: Barracks -Cost: 250f 750g -Allows Champions - -* Squires -Requires: Stables -Cost: 250f 750g -Allows Paladins - -* Flaming Arrows -Requires: Archery Range -Cost: 300f 900g -RNG units no longer suffer penalty vs. BLDGS - -* Sappers -Requires: Castle -Cost: 300f 900g -All INF units improve in +50% ATK vs. buildings - -* Hoardings -Requires: Castle -Cost: 250f 750g -Improves Castle DEF by +35% - -* Spies -Requires: Castles -Cost: 300f 900g -All enemy Town Complexes are now sighted - -* Guilds -Requires: Market -Cost: 300f 900g -+5% gold income and improves Trade rate - -* Atonement -Requires: Church -Cost: 250f 750g -Improves Heal ability of Monks or Elite Monks - -* Block Printing -Requires: Church -Cost: 250f 750g -Improves Convert ability of Monks or Elite Monks - -* Illumination -Requires: Church -Cost: 250f 750g -+505 gold income from all relics - -* Faith -Requires: Church -Cost: 250f 750g -Monks and Elite Monks gain +25% DEF - -* Treadmill Crane -Requires: University -Cost: 250f 750g -Cost of buildings is reduced by 10% - -* Siege Engineers -Requires: University -Cost: 250f 750g -Allows Imperial Age Siege units to be built - -* Architecture -Requires: University -Cost: 250f 750g -+5% DEF for all buildings - -* Chemistry -Requires: University -Cost: 250f 750g -Allows Hand Cannondeers and Bombard Cannons - -* Ballistics -Requires: University -Cost: 300f 900g -+25% ATK for Siege units with Range above 1
\ No newline at end of file +]
\ No newline at end of file diff --git a/build/content/tiles.json b/build/content/tiles.json index bb34075..40373ed 100644 --- a/build/content/tiles.json +++ b/build/content/tiles.json @@ -4,7 +4,7 @@ "move_cost": 2, "sight_cost": 2, "range_bonus": 0, - "defence_bonus": 0.2, + "defence_bonus": 0.0, "spritebounds": [ 0, 16 ] },{ "name": "Mountain", diff --git a/build/sdl_test.exe b/build/sdl_test.exe Binary files differindex 6d3f0c7..12fa827 100644 --- a/build/sdl_test.exe +++ b/build/sdl_test.exe diff --git a/game/entity.h b/game/entity.h index 36c8198..eeab110 100644 --- a/game/entity.h +++ b/game/entity.h @@ -49,7 +49,7 @@ class Entity { return x == oth.x && y == oth.y && info->unit == oth.info->unit; } - int building = 0; + int building { 0 }; float hp; /**/ int x, y; bool done = false; diff --git a/game/ground.cpp b/game/ground.cpp index 0ea273d..e6055bf 100644 --- a/game/ground.cpp +++ b/game/ground.cpp @@ -88,9 +88,7 @@ std::vector<int> Ground::move_area (Gst &gst, Entity &ent) { std::vector<int> Ground::attack_targets (Gst &gst, Entity &ent) { std::vector<int> attacks; - int range = ent.info->range; - range += gst.tiles[gst.ground.tiles[gst.ground.at(ent.x, ent.y)]] - .range_bonus; + int range = gst.get_range(ent); bool builds = !gst.info_has_ability(ent.info, "Units Only"); bool units = !gst.info_has_ability(ent.info, "Buildings Only"); for (Entity &e : gst.entities) { diff --git a/game/gst.cpp b/game/gst.cpp index f6d5aa1..0a524fc 100644 --- a/game/gst.cpp +++ b/game/gst.cpp @@ -28,25 +28,25 @@ Entity& Gst::get_at (int x, int y) { } float Gst::get_type_bonus (Entity &atk, Entity &def) { - float b = 1; + float b = 0; switch(atk.info->ent_class) { case EntityInfo::Class::inf: - if (def.info->ent_class == EntityInfo::Class::bld) b += 1.0/3; - if (def.info->ent_class == EntityInfo::Class::sie) b += 1.0/3; + if (def.info->ent_class == EntityInfo::Class::bld) b += 1.0f/3.0f; + if (def.info->ent_class == EntityInfo::Class::sie) b += 1.0f/3.0f; break; case EntityInfo::Class::cav: if (def.info->ent_class == EntityInfo::Class::bld) b += -0.5; - if (def.info->ent_class == EntityInfo::Class::inf) b += 1.0/3; - if (def.info->ent_class == EntityInfo::Class::ran) b += 1.0/3; + if (def.info->ent_class == EntityInfo::Class::inf) b += 1.0f/3.0f; + if (def.info->ent_class == EntityInfo::Class::ran) b += 1.0f/3.0f; break; case EntityInfo::Class::ran: - if (def.info->ent_class == EntityInfo::Class::bld) b += -0.5; + if (def.info->ent_class == EntityInfo::Class::bld) b += -0.5f; break; case EntityInfo::Class::sie: - if (def.info->ent_class == EntityInfo::Class::bld) b += +0.5; + if (def.info->ent_class == EntityInfo::Class::bld) b += +0.5f; break; } return b; @@ -54,15 +54,24 @@ float Gst::get_type_bonus (Entity &atk, Entity &def) { std::vector<Bonus> Gst::get_bonuses (Entity &atk, Entity &def) { std::vector<Bonus> bs; - bs.emplace_back( - tiles[ground.tiles[ground.at(atk.x, atk.y)]].attack_bonus, - Bonus::Id::ground, true); - bs.emplace_back( - tiles[ground.tiles[ground.at(def.x, def.y)]].defence_bonus, - Bonus::Id::ground, false); + if (tiles[ground.tiles[ground.at(atk.x, atk.y)]].attack_bonus != 0) { - bs.emplace_back(get_type_bonus(atk, def), Bonus::Id::type, true); - bs.emplace_back(get_type_bonus(def, atk), Bonus::Id::type, false); + bs.emplace_back( + tiles[ground.tiles[ground.at(atk.x, atk.y)]].attack_bonus, + Bonus::Id::ground, true); + } + if (tiles[ground.tiles[ground.at(def.x, def.y)]].defence_bonus != 0) { + bs.emplace_back( + tiles[ground.tiles[ground.at(def.x, def.y)]].defence_bonus, + Bonus::Id::ground, false); + } + + if (get_type_bonus(atk, def) != 0) { + bs.emplace_back(get_type_bonus(atk, def), Bonus::Id::type, true); + } + if (get_type_bonus(def, atk) != 0) { + bs.emplace_back(get_type_bonus(def, atk), Bonus::Id::type, false); + } if (info_has_ability(atk.info, "Causes Fear")) bs.emplace_back(-1.0f/3, Bonus::Id::ability, false); @@ -95,11 +104,10 @@ std::vector<Bonus> Gst::get_bonuses (Entity &atk, Entity &def) { if (info_has_ability(atk.info, "Frenzy")) bs.emplace_back(1/atk.hp, Bonus::Id::ability, true); - return bs; } -float Gst::get_damage (Entity &atk, Entity &def) { +float Gst::get_damage (Entity &atk, Entity &def, float atk_hp) { float atkmul = 1; float defmul = 1; @@ -109,24 +117,30 @@ float Gst::get_damage (Entity &atk, Entity &def) { else { defmul += bonus.amt; } } - float dam = (atk.info->attack * atk.hp * atkmul) + float dam = (atk.info->attack * atk_hp * atkmul) / (2.0f*def.info->defence * defmul); return dam; } +float Gst::get_damage (Entity &atk, Entity &def) { + return get_damage(atk, def, atk.hp); +} + bool Gst::get_first_strike (Entity &atk, Entity &def) { bool fs { false }; fs = info_has_ability(atk.info, "First Strike"); return fs; } -float clamp (float hp) { if (hp > 100) hp = 100; return hp; } +float clamp (float hp) { + if (hp > 100) hp = 100; + if (hp < 0) hp = 0; + return hp; +} -void Gst::battle (Entity &atk, Entity &def) { - std::cout << "! attack " << atk.info->name << "(hp:" << atk.hp << "), " - << def.info->name << "(hp:" << def.hp << ") \n"; - +BattleResult Gst::battle_res (Entity &atk, Entity &def) { + BattleResult result { atk.hp, def.hp }; bool first_strike_atk = info_has_ability(atk.info, "First Strike"); bool first_strike_def = info_has_ability(def.info, "First Strike"); bool skirmish_atk = info_has_ability(atk.info, "Skirmish"); @@ -142,30 +156,54 @@ void Gst::battle (Entity &atk, Entity &def) { first_strike_def = first_strike_def || (anticav_def && atk.info->ent_class == EntityInfo::Class::cav); + int dist = abs(atk.x-def.x) + abs(atk.y-def.y); + bool def_inrange = (dist <= get_range(def)) ? true : false; + bool swap = false; if (first_strike_def && !first_strike_atk) swap = true; if (swap) { - atk.hp = clamp(atk.hp - get_damage(def, atk)); + if (def_inrange) { + result.atk_hp = clamp( + result.atk_hp - get_damage(def, atk, result.def_hp)); + } if (!info_has_ability(atk.info, "No Counter")) - if (atk.hp > 0) def.hp -= get_damage(atk, def); + if (result.atk_hp > 0) + result.def_hp = clamp( + result.def_hp - get_damage(atk, def, result.atk_hp)); } else { - def.hp = clamp(def.hp - get_damage(atk, def)); - if (!info_has_ability(def.info, "No Counter")) - if (def.hp > 0) atk.hp -= get_damage(def, atk); + result.def_hp = clamp( + result.def_hp - get_damage(atk, def, result.atk_hp)); + if (!info_has_ability(def.info, "No Counter") && def_inrange) + if (result.def_hp > 0) + result.atk_hp = clamp( + result.atk_hp - get_damage(def, atk, result.def_hp)); } if (info_has_ability(atk.info, "Rapid Fire")) - if (def.hp > 0) - def.hp = clamp(def.hp - get_damage(atk, def)); + if (result.def_hp > 0) + result.def_hp = clamp( + result.def_hp - get_damage(atk, def, result.def_hp)); + + if (info_has_ability(def.info, "Rapid Fire") && def_inrange) + if (result.atk_hp > 0) + result.atk_hp = clamp( + result.atk_hp - get_damage(def, atk, result.def_hp)); - if (info_has_ability(def.info, "Rapid Fire")) - if (atk.hp > 0) - atk.hp = clamp(atk.hp - get_damage(def, atk)); + if (result.atk_hp > 0 && info_has_ability(atk.info, "Zeal")) + result.atk_hp = clamp(result.atk_hp + 20); + if (result.def_hp > 0 && info_has_ability(def.info, "Zeal")) + result.def_hp = clamp(result.def_hp + 20); + + return result; +} + +void Gst::battle (Entity &atk, Entity &def) { + std::cout << "! attack " << atk.info->name << "(hp:" << atk.hp << "), " + << def.info->name << "(hp:" << def.hp << ") \n"; - if (atk.hp > 0 && info_has_ability(atk.info, "Zeal")) - atk.hp = clamp(atk.hp + 20); - if (def.hp > 0 && info_has_ability(def.info, "Zeal")) - def.hp = clamp(def.hp + 20); + auto result = battle_res(atk, def); + atk.hp = result.atk_hp; + def.hp = result.def_hp; std::cout << "! result " << atk.info->name << "(hp:" << atk.hp << "), " << def.info->name << "(hp:" << def.hp << ") \n"; @@ -182,6 +220,15 @@ void Gst::clear_dead() { } } +int Gst::get_range (Entity &ent) { + int range = ent.info->range; + if (range > 1) { + range += tiles[ground.tiles[ground.at(ent.x, ent.y)]].range_bonus; + } + if (range < 1) range = 1; + return range; +} + std::vector<int> Gst::get_possible_builds (Entity &ent) { std::vector<int> builds; for (int id : ent.info->build) { @@ -196,7 +243,7 @@ bool Gst::check_req_build(Entity &ent, EntityInfo *info) { for (int id : info->adjacent) { bool adj = false; for (Entity &e : entities) { - if (e.info->id == id) { + if (e.info->id == id && ent.owner == e.owner) { int dist = abs(e.x-ent.x) + abs(e.y-ent.y); if (dist == 1) { adj = true; @@ -213,7 +260,7 @@ bool Gst::check_req_build(Entity &ent, EntityInfo *info) { } int mindist = 9999; for (Entity &e : entities) { - if (e.info->id == 100) { + if (e.info->id == 100 && ent.owner == e.owner) { int dist = abs(e.x-ent.x) + abs(ent.y-e.y); if (dist < mindist) { mindist = dist; @@ -260,4 +307,21 @@ void Gst::end_day () { turn = 0; day++; } + for (Entity &e : entities) { + e.done = false; + e.moved = 0; + if (e.owner == turn) { + Player &player = players[e.owner]; + for (int i=0; i<player.res.size(); i++) { + player.res[i] += e.info->prod[i]; + } + // todo heal when on top of building + if (e.building < 0) { + e.building++; + if (e.building == 0) { + e.hp += 50; if (e.hp > 100) e.hp = 100; + } + } + } + } }
\ No newline at end of file @@ -24,6 +24,21 @@ class Bonus { Bonus(float amt, int id, bool atk) : amt(amt), id(id), atk(atk) {} float amt; int id; bool atk; enum Id { ground, type, ability, tech }; + std::string id_string () { + switch (id) { + case ground: return "Ground"; + case type: return "Class"; + case ability: return "Ability"; + case tech: return "Tech"; + } + } +}; + +class BattleResult { + public: + BattleResult(float atk_hp, float def_hp) + : atk_hp(atk_hp), def_hp(def_hp) {} + float atk_hp, def_hp; }; class Gst { @@ -47,9 +62,12 @@ class Gst { float get_type_bonus (Entity &atk, Entity &def); std::vector<Bonus> get_bonuses (Entity &atk, Entity &def); float get_damage (Entity &atk, Entity &def); + float get_damage (Entity &atk, Entity &def, float atk_hp); bool get_first_strike (Entity &atk, Entity &def); + BattleResult battle_res (Entity &atk, Entity &def); void battle (Entity &atk, Entity &def); void clear_dead(); + int get_range(Entity &ent); std::vector<int> get_possible_builds (Entity &ent); diff --git a/game/load.cpp b/game/load.cpp index d1a1722..5baae6c 100644 --- a/game/load.cpp +++ b/game/load.cpp @@ -41,6 +41,8 @@ void load_json (Gst &gst) { Tile tile; tile.name = it["name"]; tile.move_cost = it["move_cost"]; + tile.defence_bonus = it["defence_bonus"]; + tile.range_bonus = it["range_bonus"]; tile.spritebounds = vec2 { it["spritebounds"][0], it["spritebounds"][1] }; gst.tiles.push_back(tile); } @@ -88,4 +90,18 @@ void load_json (Gst &gst) { ent.spritebounds = vec2 { it["spritebounds"][0], it["spritebounds"][1] }; gst.infos.push_back(ent); } + + std::ifstream file_techs("content/techs.json"); + json j_techs; file_techs >> j_techs; + for (auto it : j_techs) { + Tech tech; + tech.name = it["name"]; + tech.id = it["id"]; + tech.level = it["level"]; + tech.req_id = it["req_id"]; + for (int i=0; i<it["cost"].size(); i++) { + tech.cost[i] = it["cost"][i]; + } + gst.techs.push_back(tech); + } }
\ No newline at end of file diff --git a/game/menu.cpp b/game/menu.cpp index a9ec886..b5a91b9 100644 --- a/game/menu.cpp +++ b/game/menu.cpp @@ -1,3 +1,5 @@ +#include <iostream> + #include "menu.h" void Menu::close () { @@ -5,6 +7,7 @@ void Menu::close () { } void Menu::open (vec2 res) { + over = -1; active = true; pos = vec2 { (float)res.x, (float)res.y }; float height = options.size() * 20; @@ -26,4 +29,49 @@ int Menu::mouse_option (vec2 mouse) { i++; } return -1; +} + + +void Menu_tech::open (vec2 res) { + over = -1; + active = true; + pos = vec2 { (float)res.x, (float)res.y }; + + tech_opt_ordered.clear(); + tech_opt_ordered.emplace_back(); + tech_opt_ordered.emplace_back(); + tech_opt_ordered.emplace_back(); + tech_opt_ordered.emplace_back(); + + for (OptionTech opt : tech_options) { + tech_opt_ordered[opt.tech->level].emplace_back(opt); + } + int maxsize = 0; + for (auto v : tech_opt_ordered) { + maxsize = maxsize < v.size() ? v.size() : maxsize; + } + + float width = 150 * tech_opt_ordered.size(); + float height = maxsize * 10; + size = vec2 { width, height+20 }; + pos *= 0.5f; + pos -= size/2; +} + +int Menu_tech::mouse_option (vec2 mouse) { + float x = 0, y = 0; + for (auto v : tech_opt_ordered) { + for (auto opt : v) { + vec2 off { x*150, 10.0f + y*10 }; + vec2 sizeopt { 150, 10 }; + off += pos; + if (off.x < mouse.x && mouse.x < off.x+sizeopt.x + && off.y < mouse.y && mouse.y < off.y+sizeopt.y ) { + return opt.tech->id; + } + y++; + } + x++; y=0; + } + return -1; }
\ No newline at end of file diff --git a/game/menu.h b/game/menu.h index bf181b5..462d893 100644 --- a/game/menu.h +++ b/game/menu.h @@ -5,6 +5,7 @@ #include <string> #include "../umath/vec2.h" +#include "tech.h" class Option { public: @@ -22,10 +23,11 @@ class Menu { bool active { false }; std::vector<Option> options; vec2 pos, size; + int over; - void open (vec2 res); void close (); - int mouse_option (vec2 mouse); + virtual void open (vec2 res); + virtual int mouse_option (vec2 mouse); }; class Menu_unit : public Menu { @@ -55,4 +57,23 @@ class Menu_train : public Menu { Menu_train () {} }; + +class OptionTech { + public: + OptionTech(std::string name, Tech *tech) : name(name), tech(tech) {} + + std::string name; + Tech *tech; +}; + +class Menu_tech : public Menu { + public: + Menu_tech () {} + std::vector<OptionTech> tech_options; + std::vector<std::vector<OptionTech>> tech_opt_ordered; + + void open (vec2 res) override; + int mouse_option (vec2 mouse) override; +}; + #endif
\ No newline at end of file diff --git a/game/player.h b/game/player.h index ec4657e..01d8ee9 100644 --- a/game/player.h +++ b/game/player.h @@ -11,6 +11,8 @@ class Player { std::vector<int> res { 0, 0 }; std::vector<int> techs; + int level { 0 }; + int r, g, b; }; diff --git a/game/playercontrol.cpp b/game/playercontrol.cpp index 647f487..90e063e 100644 --- a/game/playercontrol.cpp +++ b/game/playercontrol.cpp @@ -63,23 +63,6 @@ Player_control::Player_control () { view.menu_day.close(); view.selected_ground = -1; gst.end_day(); - for (Entity &e : gst.entities) { - e.done = false; - e.moved = 0; - if (e.owner == gst.turn) { - Player &player = gst.players[e.owner]; - for (int i=0; i<player.res.size(); i++) { - player.res[i] += e.info->prod[i]; - } - // todo heal when on top of building - if (e.building < 0) { - e.building++; - if (e.building == 0) { - e.hp += 50; if (e.hp > 100) e.hp = 100; - } - } - } - } std::cout << "end day " << p << "\n"; return select; } @@ -93,6 +76,36 @@ Player_control::Player_control () { } ); fsm.arcs.emplace_back( + menu_day, opt, Menu_day::Opts::tech, + [](Gst &gst, View &view, Fsm &fsm, int p) { + view.menu_day.close(); + view.menu_tech.tech_options.clear(); + for (Tech &tech : gst.techs) { + view.menu_tech.tech_options.emplace_back(tech.name, &tech); + } + view.menu_tech.open(view.res); + std::cout << "tech screen " << "\n"; + return menu_tech; + } + ); + fsm.arcs.emplace_back( + menu_tech, opt, -1, + [](Gst &gst, View &view, Fsm &fsm, int p) { + view.menu_tech.close(); + view.selected_ground = -1; + std::cout << "selected tech " << p << "\n"; + return select; + } + ); + fsm.arcs.emplace_back( + menu_tech, back, -1, + [](Gst &gst, View &view, Fsm &fsm, int p) { + view.menu_tech.close(); + view.selected_ground = -1; + return select; + } + ); + fsm.arcs.emplace_back( select, sel_unit, -1, [](Gst &gst, View &view, Fsm &fsm, int p) { view.selected_entity = p; diff --git a/game/playercontrol.h b/game/playercontrol.h index 62de46d..3096ada 100644 --- a/game/playercontrol.h +++ b/game/playercontrol.h @@ -31,6 +31,7 @@ enum pc_state { target_power, menu_unit, menu_day, + menu_tech, end }; diff --git a/game/tech.h b/game/tech.h index a8de9c1..84ef05c 100644 --- a/game/tech.h +++ b/game/tech.h @@ -11,6 +11,9 @@ class Tech { Tech() {} std::string name; + int id; + int level; + int req_id; std::vector<int> cost { 0, 0 }; vec2 spritebounds { 0, 0 }; diff --git a/game/view.cpp b/game/view.cpp index d00fd2a..095a99a 100644 --- a/game/view.cpp +++ b/game/view.cpp @@ -11,6 +11,36 @@ void View::process (Gst &gst, vec2 cam, vec2 mouse, int *mheld) { cursor_entity = -1; back = -1; opt = -1; + hover_ground = -1; + + bool hfound = false; + for (int y=0; y<gr.sizey && !hfound; y++) { + for (int x=0; x<gr.sizex && !hfound; x++) { + vec2 pos { (float)x*32, (float)y*32 }; + if (pos.x < absmouse.x && absmouse.x <= pos.x+32 + && pos.y < absmouse.y && absmouse.y <= pos.y+32) + { + hover_ground = x+y*gr.sizex; + hfound = true; + } + } + } + + if (menu_train.active) { + menu_train.over = menu_train.mouse_option(mouse); + } + if (menu_build.active) { + menu_build.over = menu_build.mouse_option(mouse); + } + if (menu_unit.active) { + menu_unit.over = menu_unit.mouse_option(mouse); + } + if (menu_day.active) { + menu_day.over = menu_day.mouse_option(mouse); + } + if (menu_tech.active) { + menu_tech.over = menu_tech.mouse_option(mouse); + } if (mheld[0] == 1) { bool found = false; @@ -27,8 +57,8 @@ void View::process (Gst &gst, vec2 cam, vec2 mouse, int *mheld) { } if (!valid) continue; vec2 pos { (float)x*32, (float)y*32 }; - if (pos.x < absmouse.x && absmouse.x < pos.x+32 - && pos.y < absmouse.y && absmouse.y < pos.y+32) + if (pos.x < absmouse.x && absmouse.x <= pos.x+32 + && pos.y < absmouse.y && absmouse.y <= pos.y+32) { cursor_ground = moves[i]; } @@ -41,8 +71,8 @@ void View::process (Gst &gst, vec2 cam, vec2 mouse, int *mheld) { int x = attacks[i] % gr.sizex; int y = attacks[i] / gr.sizex; vec2 pos { (float)x*32, (float)y*32 }; - if (pos.x < absmouse.x && absmouse.x < pos.x+32 - && pos.y < absmouse.y && absmouse.y < pos.y+32) + if (pos.x < absmouse.x && absmouse.x <= pos.x+32 + && pos.y < absmouse.y && absmouse.y <= pos.y+32) { cursor_ground = attacks[i]; } @@ -85,13 +115,22 @@ void View::process (Gst &gst, vec2 cam, vec2 mouse, int *mheld) { back = 1; found = 1; } } + + if (menu_tech.active && !found) { + int selected = menu_tech.mouse_option(mouse); + if (selected != -1) { + opt = selected; found = true; + } else { + back = 1; found = 1; + } + } for (int i=0; i<entities.size() && !found; i++) { if (entities[i].done) continue; if (entities[i].owner != gst.turn) continue; vec2 pos { (float)entities[i].x*32, (float)entities[i].y*32 }; - if (pos.x < absmouse.x && absmouse.x < pos.x+32 - && pos.y < absmouse.y && absmouse.y < pos.y+32) + if (pos.x < absmouse.x && absmouse.x <= pos.x+32 + && pos.y < absmouse.y && absmouse.y <= pos.y+32) { cursor_entity = i; if (entities[i].info->unit == 1) { @@ -104,8 +143,8 @@ void View::process (Gst &gst, vec2 cam, vec2 mouse, int *mheld) { for (int y=0; y<gr.sizey && !found; y++) { for (int x=0; x<gr.sizex && !found; x++) { vec2 pos { (float)x*32, (float)y*32 }; - if (pos.x < absmouse.x && absmouse.x < pos.x+32 - && pos.y < absmouse.y && absmouse.y < pos.y+32) + if (pos.x < absmouse.x && absmouse.x <= pos.x+32 + && pos.y < absmouse.y && absmouse.y <= pos.y+32) { cursor_ground = x+y*gr.sizex; found = true; diff --git a/game/view.h b/game/view.h index a9d196b..5aab193 100644 --- a/game/view.h +++ b/game/view.h @@ -13,6 +13,7 @@ class View { vec2 res; + int hover_ground {-1}; int selected_ground {-1}; int selected_entity {-1}; int cursor_ground {-1}; @@ -27,6 +28,7 @@ class View { Menu_day menu_day; Menu_build menu_build; Menu_train menu_train; + Menu_tech menu_tech; void process (Gst &gst, vec2 cam, vec2 mouse, int *mheld); }; diff --git a/graphics/graphics.cpp b/graphics/graphics.cpp index 9658605..3b943a4 100644 --- a/graphics/graphics.cpp +++ b/graphics/graphics.cpp @@ -2,6 +2,8 @@ #include <iostream> #include <string> +#include <math.h> + #include "graphics.h" #include "../game/menu.h" #include "../game/tile.h" @@ -53,7 +55,13 @@ void render_menu (Graphics *graphics, Gst &gst, Menu &menu) { ); float acc = 0; for (Option opt : menu.options) { - graphics->backend.txt.render_text(opt.name, menu.pos + vec2 {10, 10 + acc}); + int r=0, g=0, b=0; + if (opt.id == menu.over) { + Player &player = gst.players[gst.turn]; + r = player.r; g = player.g; b = player.b; + } + graphics->backend.txt.render_text( + opt.name, menu.pos + vec2 {10, 10 + acc}, r, g, b); float width = graphics->backend.txt.get_width(opt.name); if (opt.cost.size() > 0) { graphics->backend.txt.render_text( @@ -68,6 +76,343 @@ void render_menu (Graphics *graphics, Gst &gst, Menu &menu) { } } +void render_menu_tech (Graphics *graphics, Gst &gst, View &view) { + vec2 res { (float)graphics->resx, (float)graphics->resy }; + if (view.menu_tech.active) { + vec2 pos { res }; + float height = view.menu_tech.options.size() * 20; + vec2 size { 120, height+10 }; + pos *= 0.5f; + pos -= size/2; + graphics->backend.render_rect( + 255,255,255,255, + view.menu_tech.pos.x,view.menu_tech.pos.y, + view.menu_tech.size.x,view.menu_tech.size.y + ); + + float x = 0, y = 0; + for (auto v : view.menu_tech.tech_opt_ordered) { + for (auto opt : v) { + int r=0, g=0, b=0; + Player &player = gst.players[gst.turn]; + if (opt.tech->id == view.menu_tech.over) { + r = player.r; g = player.g; b = player.b; + } + if (opt.tech->level > player.level) { + r = 100; g = 100; b = 100; + } + if (opt.tech->cost[0] > player.res[0] + || opt.tech->cost[1] > player.res[1] ) + { + r = 100; g = 100; b = 100; + } + bool req_id = false; + for (auto &ent : gst.entities) { + if (ent.owner == gst.turn + && ent.info->id == opt.tech->req_id + && ent.building == 0) + { + req_id = true; + } + } + if (!req_id) { + r = 100; g = 100; b = 100; + } + graphics->backend.txt.render_text(opt.name, + view.menu_tech.pos + vec2 {10 + x, 10 + y}, r, g, b); + float width = graphics->backend.txt.get_width(opt.name); + /* + if (opt.tech->cost.size() > 0) { + graphics->backend.txt.render_text( + std::to_string (opt.tech->cost[0]) + "f", + view.menu_tech.pos + vec2 { width + 20 + x, 10 + y }); + graphics->backend.txt.render_text( + std::to_string (opt.tech->cost[1]) + "g", + view.menu_tech.pos + vec2 { width + 50 + x, 10 + y }); + }*/ + y += 10; + } + x += 150; y = 0; + } + } +} + + +int get_entity_info_height (Entity &ent) { + return 155+10*ent.info->abilities.size(); +} + +void render_entity_info (Graphics *graphics, Gst &gst, vec2 pos, int i) { + Entity &ent = gst.entities[i]; + int w = 200, h = get_entity_info_height(ent); + + graphics->backend.render_rect (0,0,0,255, + (int)pos.x,(int)pos.y,w,h); + graphics->backend.render_rect (255,255,255,255, + (int)pos.x+1,(int)pos.y+1,w-2,h-2); + + graphics->backend.render_rect ( + 0,0,0,255, (int)pos.x+w-32-10-1, (int)pos.y+10-1,34,34); + graphics->backend.render_rect ( + 255,255,255,255, (int)pos.x+w-32-10, (int)pos.y+10,32,32); + + graphics->backend.render_sprite ( + (int)gst.entities[i].info->spritebounds.x, + (int)gst.entities[i].info->spritebounds.y, 16, 16, + (int)pos.x + w-32-10, + (int)pos.y + 10, 32, 32 + ); + + graphics->backend.txt.render_text(ent.info->name, pos + vec2 { 10, 10 }); + graphics->backend.txt.render_text("Attack", pos + vec2 { 10, 30 }); + graphics->backend.txt.render_text( + std::to_string((int)roundf(ent.info->attack)), pos + vec2 { 90, 30 }); + graphics->backend.txt.render_text("Defence", pos + vec2 { 10, 45 }); + graphics->backend.txt.render_text( + std::to_string((int)roundf(ent.info->defence)), pos + vec2 { 90, 45 }); + graphics->backend.txt.render_text("Move", pos + vec2 { 10, 60 }); + graphics->backend.txt.render_text( + std::to_string((int)roundf(ent.info->move)), pos + vec2 { 90, 60 }); + graphics->backend.txt.render_text("Range", pos + vec2 { 10, 75 }); + graphics->backend.txt.render_text( + std::to_string((int)roundf(ent.info->range)), pos + vec2 { 90, 75 }); + graphics->backend.txt.render_text("Sight", pos + vec2 { 10, 90 }); + graphics->backend.txt.render_text( + std::to_string((int)roundf(ent.info->sight)), pos + vec2 { 90, 90 }); + graphics->backend.txt.render_text("Health", pos + vec2 { 10, 105 }); + graphics->backend.txt.render_text( + std::to_string((int)roundf(ent.hp)), pos + vec2 { 90, 105 }); + graphics->backend.txt.render_text("Class", pos + vec2 { 10, 120 }); + std::string ent_class = ""; + switch (ent.info->ent_class) { + case EntityInfo::Class::inf: ent_class = "Infantry"; break; + case EntityInfo::Class::cav: ent_class = "Cavalry"; break; + case EntityInfo::Class::ran: ent_class = "Ranged"; break; + case EntityInfo::Class::sie: ent_class = "Siege"; break; + case EntityInfo::Class::bld: ent_class = "Building"; break; + } + graphics->backend.txt.render_text(ent_class, pos + vec2 { 90, 120 }); + graphics->backend.txt.render_text("Abilities", pos + vec2 { 10, 135 }); + std::string abname; + for (int s=0; s<ent.info->abilities.size(); s++) { + abname = gst.abilities[ent.info->abilities[s]].name; + graphics->backend.txt.render_text(abname, + pos + vec2 { 90, 135+s*10.0f }); + } +} + +void render_tile_info (Graphics *graphics, Gst &gst, vec2 pos, int i) { + int x = i % gst.ground.sizex; + int y = i / gst.ground.sizex; + Tile &tile = gst.tiles[gst.ground.tiles[gst.ground.at(x,y)]]; + + int w = 200, h = 95; + graphics->backend.render_rect ( + 0,0,0,255, + (int)pos.x,(int)pos.y,w,h + ); + graphics->backend.render_rect ( + 255,255,255,255, + (int)pos.x+1,(int)pos.y+1,w-2,h-2 + ); + + graphics->backend.render_sprite ( + (int)tile.spritebounds.x, + (int)tile.spritebounds.y-16, 16, 32, + (int)pos.x + w-32-10, + (int)pos.y + 10-32, 32, 64 + ); + + graphics->backend.txt.render_text(tile.name, pos + vec2 { 10, 10 }); + graphics->backend.txt.render_text("Move", pos + vec2 { 10, 30 }); + graphics->backend.txt.render_text( + std::to_string(tile.move_cost), pos + vec2 { 90, 30 }); + graphics->backend.txt.render_text("Sight", pos + vec2 { 10, 45 }); + graphics->backend.txt.render_text( + std::to_string(tile.sight_cost), pos + vec2 { 90, 45 }); + graphics->backend.txt.render_text("Defence Bonus", pos + vec2 { 10, 60 }); + graphics->backend.txt.render_text( + std::to_string((int)roundf(tile.defence_bonus*100))+"%", pos + vec2 { 90, 60 }); + graphics->backend.txt.render_text("Range Bonus", pos + vec2 { 10, 75 }); + graphics->backend.txt.render_text( + std::to_string(tile.range_bonus), pos + vec2 { 90, 75 }); +} + +int render_attack_info_bonus (Graphics *graphics, Gst &gst, vec2 pos, + Entity &atk, Entity &def, bool attack, int rtl) +{ + std::vector<Bonus> bonuses; + if (attack) { bonuses = gst.get_bonuses(atk, def); } + else { bonuses = gst.get_bonuses(def, atk); } + + float value = attack ? atk.info->attack : atk.info->defence; + + { + std::string nlabel = attack ? "Attack" : "Defence"; + float labw = graphics->backend.txt.get_width(nlabel); + graphics->backend.txt.render_text(nlabel, + pos + vec2 { -labw*rtl, 0 }); + } { + std::string nlabel = std::to_string((int)roundf(value)); + float labw = graphics->backend.txt.get_width(nlabel); + graphics->backend.txt.render_text(nlabel, + pos + vec2 { 50*(1-rtl*2)-labw*rtl, 0 }); + } + + int bonusnum = 0; float atk_mod = 1; + for (int s=0; s<bonuses.size(); s++) { + Bonus &b = bonuses[s]; + if (b.atk == attack) { + float idw = graphics->backend.txt.get_width(b.id_string()); + graphics->backend.txt.render_text( + b.id_string(), pos + vec2 { -idw*rtl, 10.0f+bonusnum*10 }); + std::string amt; + if (b.amt > 0) amt += "+"; + amt += std::to_string((int)roundf(b.amt*100)) + "%"; + float labw = graphics->backend.txt.get_width(amt); + graphics->backend.txt.render_text( + amt, pos + vec2 { 50*(1-rtl*2)-labw*rtl, 10.0f+bonusnum*10 }); + atk_mod += b.amt; + bonusnum ++; + } + } + + if (bonusnum > 0) { + { + std::string label = attack ? "->" : "<-"; + float labw = graphics->backend.txt.get_width(label); + graphics->backend.txt.render_text(label, + pos + vec2 { 70*(1-rtl*2)-labw*rtl, 0 }); + } + { + std::string label = std::to_string((int)roundf(value * atk_mod)); + float labw = graphics->backend.txt.get_width(label); + graphics->backend.txt.render_text(label, + pos + vec2 { 83*(1-rtl*2)-labw*rtl, 0 }); + } + } + + return bonusnum*10; +} + + +void render_attack_info (Graphics *graphics, Gst &gst, vec2 pos, int i, int j) { + Entity &atk = gst.entities[i]; + Entity &def = gst.entities[j]; + int w = 300, h = 250; + + graphics->backend.render_rect (0,0,0,255, + (int)pos.x,(int)pos.y,w,h); + graphics->backend.render_rect (255,255,255,255, + (int)pos.x+1,(int)pos.y+1,w-2,h-2); + + graphics->backend.render_rect ( + 0,0,0,255, (int)pos.x+10-1, (int)pos.y+35-1,34,34); + graphics->backend.render_rect ( + 255,255,255,255, (int)pos.x+10, (int)pos.y+35,32,32); + graphics->backend.render_sprite ( + (int)atk.info->spritebounds.x, + (int)atk.info->spritebounds.y, 16, 16, + (int)pos.x + 10, + (int)pos.y + 35, 32, 32 + ); + { + Tile &tile = gst.tiles[gst.ground.tiles[gst.ground.at(atk.x,atk.y)]]; + graphics->backend.render_sprite ( + (int)tile.spritebounds.x, + (int)tile.spritebounds.y-16, 16, 32, + (int)pos.x + 52, + (int)pos.y + 35-32, 32, 64 + ); + } + + graphics->backend.render_rect ( + 0,0,0,255, (int)pos.x+w-42-1, (int)pos.y+35-1,34,34); + graphics->backend.render_rect ( + 255,255,255,255, (int)pos.x+w-42, (int)pos.y+35,32,32); + graphics->backend.render_sprite ( + (int)def.info->spritebounds.x, + (int)def.info->spritebounds.y, 16, 16, + (int)pos.x + w-42, + (int)pos.y + 35, 32, 32 + ); + { + Tile &tile = gst.tiles[gst.ground.tiles[gst.ground.at(def.x,def.y)]]; + graphics->backend.render_sprite ( + (int)tile.spritebounds.x, + (int)tile.spritebounds.y-16, 16, 32, + (int)pos.x + w-84, + (int)pos.y + 35-32, 32, 64 + ); + } + + graphics->backend.txt.render_text(atk.info->name, pos + vec2 { 10, 10 }); + { + int txtwidth = graphics->backend.txt.get_width(def.info->name); + graphics->backend.txt.render_text(def.info->name, + pos + vec2 { w-10.0f-txtwidth, 10 }); + } + + BattleResult result = gst.battle_res(atk, def); + std::vector<std::string> sres = { "++", "+", "=", "-", "--" }; + float atk_loss = atk.hp-result.atk_hp; + float def_loss = def.hp-result.def_hp; + float est_atk = def_loss - atk_loss; + float est_def = atk_loss - def_loss; + int atk_res = 2; + int def_res = 2; + if (est_atk > 40) { atk_res = 0; } + else if (est_atk > 5) { atk_res = 1; } + if (est_atk < -40) { atk_res = 4; } + else if (est_atk < -5) { atk_res = 3; } + if (est_def > 40) { def_res = 0; } + else if (est_def > 5) { def_res = 1; } + if (est_def < -40) { def_res = 4; } + else if (est_def < -5) { def_res = 3; } + + graphics->backend.txt.render_text("Health", pos + vec2 { 10, 80 }); + graphics->backend.txt.render_text( + std::to_string((int)roundf(atk.hp)), pos + vec2 { 60, 80 }); + graphics->backend.txt.render_text("->", pos + vec2 { 80, 80 }); + graphics->backend.txt.render_text( + std::to_string((int)roundf(result.atk_hp)), pos + vec2 { 93, 80 }); + graphics->backend.txt.render_text(sres[atk_res], pos + vec2 { 115, 80 }); + { + int txtwidth = graphics->backend.txt.get_width("Health"); + graphics->backend.txt.render_text("Health", + pos + vec2 { w-10.0f-txtwidth, 80 }); + std::string label = std::to_string((int)roundf(def.hp)); + int txtwidthlabel = graphics->backend.txt.get_width(label); + graphics->backend.txt.render_text(label, + pos + vec2 { w-60.0f-txtwidthlabel, 80 }); + } { + int txtwidth = graphics->backend.txt.get_width("<-"); + graphics->backend.txt.render_text("<-", + pos + vec2 { w-80.0f-txtwidth, 80 }); + } { + std::string label = std::to_string((int)roundf(result.def_hp)); + int txtwidth = graphics->backend.txt.get_width(label); + graphics->backend.txt.render_text(label, + pos + vec2 { w-93.0f-txtwidth, 80 }); + } { + int txtwidth = graphics->backend.txt.get_width(sres[def_res]); + graphics->backend.txt.render_text(sres[def_res], + pos + vec2 { w-115.0f-txtwidth, 80 }); + } + + { + int batkh = render_attack_info_bonus(graphics, gst, + pos + vec2 { 10, 95 }, atk, def, true, 0); + int bdefh = render_attack_info_bonus(graphics, gst, + pos + vec2 { 10, 95 + batkh + 15.0f }, atk, def, false, 0); + } { + int batkh = render_attack_info_bonus(graphics, gst, + pos + vec2 { w-10.0f, 95 }, def, atk, true, 1); + int bdefh = render_attack_info_bonus(graphics, gst, + pos + vec2 { w-10.0f, 95 + batkh + 15.0f }, def, atk, false, 1); + } +} + void Graphics::render (Gst &gst, View &view) { Ground &gr = gst.ground; @@ -154,6 +499,7 @@ void Graphics::render (Gst &gst, View &view) render_menu(this, gst, view.menu_day); render_menu(this, gst, view.menu_build); render_menu(this, gst, view.menu_train); + render_menu_tech(this, gst, view); if (view.moves.size() > 0) { for (int m : view.moves) { @@ -202,6 +548,59 @@ void Graphics::render (Gst &gst, View &view) 255,255,255,255, 0,(int)res.y-30,(int)res.x, 30 ); + + // info stack box + int info_ground = -1; + if (view.hover_ground != -1) { info_ground = view.hover_ground; } + if (view.selected_entity != -1) { + int i = view.selected_entity; + info_ground = gst.ground.at(entities[i].x, entities[i].y); + } + if (view.selected_ground != -1) { info_ground = view.selected_ground; } + + if (info_ground != -1) { + int unit = -1; + int bld = -1; + int x = info_ground % gr.sizex; + int y = info_ground / gr.sizex; + for (int i=0; i < gst.entities.size(); i++) { + Entity &ent = gst.entities[i]; + if (ent.x == x && ent.y == y) { + if (ent.info->unit) { unit = i; } + else { bld = i; } + } + } + + float hoff = -95; + if (bld != -1) hoff -= get_entity_info_height(gst.entities[bld]); + if (unit != -1) hoff -= get_entity_info_height(gst.entities[unit]); + + if (unit != -1) { + render_entity_info(this, gst, vec2 { 0, res.y-30+hoff }, unit); + hoff += get_entity_info_height(gst.entities[unit]); + } + if (bld != -1) { + render_entity_info(this, gst, vec2 { 0, res.y-30+hoff }, bld); + hoff += get_entity_info_height(gst.entities[bld]); + } + render_tile_info(this, gst, vec2 { 0, res.y-30+hoff }, info_ground); + } + + if (view.attacks.size() > 0 && view.hover_ground != -1) { + int def = -1; + int x = view.hover_ground % gr.sizex; + int y = view.hover_ground / gr.sizex; + for (int i=0; i < gst.entities.size(); i++) { + Entity &ent = gst.entities[i]; + if (ent.x == x && ent.y == y && ent.owner != gst.turn) { + def = i; break; + } + } + if (def != -1) { + render_attack_info(this, gst, vec2 { res.x/2-175, res.y/2-125 }, + view.selected_entity, def); + } + } } @@ -293,7 +692,7 @@ Graphics_sdl_text::Graphics_sdl_text () { char_width['('] = 2; char_width[')'] = 2; char_width['['] = 2; char_width[']'] = 2; char_width['{'] = 3; char_width['}'] = 3; - char_width[','] = 1; char_width['-'] = 3; char_width['.'] = 1; + char_width[','] = 1; char_width['-'] = 5; char_width['.'] = 1; char_width['/'] = 4; char_width['!'] = 1; char_width[':'] = 1; char_width[';'] = 1; char_width['%'] = 4; @@ -313,7 +712,13 @@ int Graphics_sdl_text::get_width (std::string str) { } void Graphics_sdl_text::render_text (std::string str, vec2 off) { - SDL_SetTextureColorMod(tex, 0, 0, 0); + render_text(str, off, 0, 0, 0); +} + +void Graphics_sdl_text::render_text (std::string str, vec2 off, + int r, int g, int b) +{ + SDL_SetTextureColorMod(tex, r, g, b); int width = 0; for (int i=0; str[i]!='\0'; i++) { int char_i = str[i]; diff --git a/graphics/graphics.h b/graphics/graphics.h index dd7e51a..af8630a 100644 --- a/graphics/graphics.h +++ b/graphics/graphics.h @@ -19,6 +19,7 @@ class Graphics_sdl_text { Graphics_sdl_text(); int get_width (std::string str); void render_text (std::string str, vec2 off); + void render_text (std::string str, vec2 off, int r, int g, int b); SDL_Renderer* gRenderer; SDL_Texture *tex; int char_width[128]; @@ -59,9 +59,9 @@ int main () { load_json(gst); gst.players.emplace_back(255, 0, 0); - gst.players[0].res = std::vector<int> { 1000, 1000 }; + gst.players[0].res = std::vector<int> { 1500, 1500 }; gst.players.emplace_back(0, 0, 255); - gst.players[1].res = std::vector<int> { 1000, 1000 }; + gst.players[1].res = std::vector<int> { 1500, 1500 }; gst.ground.tiles[1] = 1; gst.ground.tiles[8] = 1; @@ -87,6 +87,9 @@ int main () { gst.entities.emplace_back(1, 5, gst.get_info("Villager"), 1); gst.entities.emplace_back(2, 5, gst.get_info("Militia"), 1); gst.entities.emplace_back(0, 0, gst.get_info("Scout Cavalry"), 0); + gst.entities.emplace_back(1, 0, gst.get_info("Persian War Elephants"), 0); + gst.entities.emplace_back(0, 1, gst.get_info("Scorpions"), 1); + gst.entities.emplace_back(1, 2, gst.get_info("Archers"), 1); View view (vec2 { (float)graphics.resx, (float)graphics.resy }); |